From 65022dce146bb9b623880ebf7c2f49ecb447ff0d Mon Sep 17 00:00:00 2001 From: pujidjayanto Date: Wed, 1 Apr 2026 13:56:03 +0700 Subject: [PATCH 01/78] chore: remove rand.Seed usage --- cmd/cloud-controller-manager/main.go | 4 ---- test/e2e/suite_test.go | 3 --- 2 files changed, 7 deletions(-) diff --git a/cmd/cloud-controller-manager/main.go b/cmd/cloud-controller-manager/main.go index 105590275d..1bef2f43cc 100644 --- a/cmd/cloud-controller-manager/main.go +++ b/cmd/cloud-controller-manager/main.go @@ -20,9 +20,7 @@ limitations under the License. package main import ( - "math/rand" "os" - "time" "github.com/spf13/pflag" "k8s.io/apimachinery/pkg/util/wait" @@ -86,8 +84,6 @@ var ( ) func main() { - rand.Seed(time.Now().UnixNano()) - pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc) ccmOptions, err := options.NewCloudControllerManagerOptions() diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 35a7027301..7d0b8b0827 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -18,12 +18,10 @@ package e2e import ( "flag" - "math/rand" "os" "path" "path/filepath" "testing" - "time" ginkgo "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/reporters" @@ -36,7 +34,6 @@ import ( const kubeconfigEnvVar = "KUBECONFIG" func init() { - rand.Seed(time.Now().UTC().UnixNano()) testing.Init() framework.RegisterProvider("gce", factory) From 54a86b6f48c426d0aaa4d001d33e19911fdec626 Mon Sep 17 00:00:00 2001 From: yifeizhuang Date: Wed, 8 Apr 2026 08:45:19 -0700 Subject: [PATCH 02/78] update vendor for metis (#1038) --- metis/go.sum | 9 +++++++++ tools/update_vendor.sh | 1 + 2 files changed, 10 insertions(+) diff --git a/metis/go.sum b/metis/go.sum index 92c51ea51a..eda9db54cb 100644 --- a/metis/go.sum +++ b/metis/go.sum @@ -14,13 +14,16 @@ github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj2 github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -69,11 +72,15 @@ github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c= go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE= go.opentelemetry.io/otel/metric v1.41.0 h1:rFnDcs4gRzBcsO9tS8LCpgR0dxg4aaxWlJxCno7JlTQ= +go.opentelemetry.io/otel/metric v1.41.0/go.mod h1:xPvCwd9pU0VN8tPZYzDZV/BMj9CM9vs00GuBjeKhJps= go.opentelemetry.io/otel/sdk v1.41.0 h1:YPIEXKmiAwkGl3Gu1huk1aYWwtpRLeskpV+wPisxBp8= +go.opentelemetry.io/otel/sdk v1.41.0/go.mod h1:ahFdU0G5y8IxglBf0QBJXgSe7agzjE4GiTJ6HT9ud90= go.opentelemetry.io/otel/sdk/metric v1.41.0 h1:siZQIYBAUd1rlIWQT2uCxWJxcCO7q3TriaMlf08rXw8= +go.opentelemetry.io/otel/sdk/metric v1.41.0/go.mod h1:HNBuSvT7ROaGtGI50ArdRLUnvRTRGniSUZbxiWxSO8Y= go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -91,7 +98,9 @@ golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8= +google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tools/update_vendor.sh b/tools/update_vendor.sh index 3df3cad97d..b86517bfcd 100755 --- a/tools/update_vendor.sh +++ b/tools/update_vendor.sh @@ -44,4 +44,5 @@ go work vendor # clean up unused dependencies (cd providers && go mod tidy) (cd test/e2e && go mod tidy) +(cd metis && go mod tidy) go mod tidy From 72a75b900559d2f43bb3ef9070ea7a27b937431b Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Wed, 8 Apr 2026 10:51:24 -0700 Subject: [PATCH 03/78] feat(metis): Add build-tarball target and remove local image load --- metis/Makefile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/metis/Makefile b/metis/Makefile index f7b9677e6c..dc0e6ea7fb 100644 --- a/metis/Makefile +++ b/metis/Makefile @@ -4,6 +4,7 @@ IMAGE_REGISTRY ?= gcr.io/$(USER)-gke-dev IMAGE_NAME ?= metis ALL_PLATFORMS ?= linux/amd64,linux/arm64 +OCI_TARBALL_PATH ?= /workspace/metis.tar # Optional space-separated list of arbitrary extra tags (e.g., pipeline IDs or dev tags) ADDITIONAL_IMAGE_TAGS ?= @@ -90,6 +91,15 @@ init-buildx: ## Initialize the docker buildx multi-arch builder if it doesn't ex docker buildx create --name builder --use; \ fi +.PHONY: build-tarball +build-tarball: init-buildx + @echo "Building OCI tarball for multi-arch image: $(IMAGE_NAME)..." + docker buildx build --platform $(ALL_PLATFORMS) \ + $(DOCKER_BUILD_ARGS) \ + --output=type=oci,dest=$(OCI_TARBALL_PATH) \ + --provenance=false \ + --sbom=false . + .PHONY: push-image push-image: init-buildx ## Build and push the multi-arch image. @echo "Building and Pushing multi-arch image: $(IMAGE_REGISTRY)/$(IMAGE_NAME)..." @@ -97,10 +107,6 @@ push-image: init-buildx ## Build and push the multi-arch image. docker buildx build --platform $(ALL_PLATFORMS) \ $(DOCKER_BUILD_ARGS) \ $(DOCKER_TAG_ARGS) --push . - @echo "Building and loading local image for host architecture..." - docker buildx build --platform linux/amd64 \ - $(DOCKER_BUILD_ARGS) \ - $(DOCKER_TAG_ARGS) --load . .PHONY: build-image-local build-image-local: From a928fbd013ae9405068b94292a6df0f7ab83ebd8 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Wed, 8 Apr 2026 11:00:46 -0700 Subject: [PATCH 04/78] feat: enforce release branch matches k8s version --- .github/workflows/check-version.yml | 23 ++++++++++++ tools/check-kubernetes-version.sh | 56 +++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 .github/workflows/check-version.yml create mode 100755 tools/check-kubernetes-version.sh diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml new file mode 100644 index 0000000000..c50d362df1 --- /dev/null +++ b/.github/workflows/check-version.yml @@ -0,0 +1,23 @@ +name: Check Kubernetes Version + +on: + push: + branches: [ "**" ] + pull_request: + branches: [ "**" ] + +jobs: + check-version: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run version check script + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + BRANCH_NAME="${{ github.base_ref }}" + else + BRANCH_NAME="${{ github.ref_name }}" + fi + ./tools/check-kubernetes-version.sh "$BRANCH_NAME" diff --git a/tools/check-kubernetes-version.sh b/tools/check-kubernetes-version.sh new file mode 100755 index 0000000000..bcd10ea9c3 --- /dev/null +++ b/tools/check-kubernetes-version.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Copyright 2026 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 + +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +cd "${KUBE_ROOT}" + +# Get branch name from argument or environment or git +BRANCH_NAME=${1:-${GITHUB_REF_NAME:-$(git rev-parse --abbrev-ref HEAD)}} + +echo "Checking branch: $BRANCH_NAME" + +# Check if branch matches release-1.X +if [[ ! "$BRANCH_NAME" =~ ^release-1\.([0-9]+)$ ]]; then + echo "Not a release branch (release-1.X), skipping check." + exit 0 +fi + +EXPECTED_MINOR="${BASH_REMATCH[1]}" +echo "Expected minor version: $EXPECTED_MINOR" + +# Get version from go.mod +VERSION_STRING=$(grep -E 'k8s.io/client-go' go.mod | grep -oE 'v0\.[0-9]+\.[0-9]+' | head -n 1) +echo "Found client-go version string: $VERSION_STRING" + +if [[ "$VERSION_STRING" =~ v0\.([0-9]+)\. ]]; then + ACTUAL_MINOR="${BASH_REMATCH[1]}" + echo "Actual client-go minor version: $ACTUAL_MINOR" +else + echo "Could not determine client-go version from go.mod" + exit 1 +fi + +if [ "$EXPECTED_MINOR" != "$ACTUAL_MINOR" ]; then + echo "ERROR: Branch version (1.$EXPECTED_MINOR) does not match client-go version (v0.$ACTUAL_MINOR)" + exit 1 +fi + +echo "Success: Branch version matches client-go version." +exit 0 From b50c53a9409e8ae48414f0b15ce79ac8ed7ff1ac Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Wed, 8 Apr 2026 13:03:44 -0700 Subject: [PATCH 05/78] update OCI_TARBALL_PATH so that it works well in local --- metis/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metis/Makefile b/metis/Makefile index dc0e6ea7fb..18c2ac136d 100644 --- a/metis/Makefile +++ b/metis/Makefile @@ -4,7 +4,7 @@ IMAGE_REGISTRY ?= gcr.io/$(USER)-gke-dev IMAGE_NAME ?= metis ALL_PLATFORMS ?= linux/amd64,linux/arm64 -OCI_TARBALL_PATH ?= /workspace/metis.tar +OCI_TARBALL_PATH ?= metis.tar # Optional space-separated list of arbitrary extra tags (e.g., pipeline IDs or dev tags) ADDITIONAL_IMAGE_TAGS ?= From 2f155742bcf44629915766a5890f158a65dd0d9e Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Wed, 8 Apr 2026 13:11:40 -0700 Subject: [PATCH 06/78] update help text --- metis/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metis/Makefile b/metis/Makefile index 18c2ac136d..5be0fdd818 100644 --- a/metis/Makefile +++ b/metis/Makefile @@ -92,7 +92,7 @@ init-buildx: ## Initialize the docker buildx multi-arch builder if it doesn't ex fi .PHONY: build-tarball -build-tarball: init-buildx +build-tarball: init-buildx ## Build the multi-arch image as an OCI tarball. @echo "Building OCI tarball for multi-arch image: $(IMAGE_NAME)..." docker buildx build --platform $(ALL_PLATFORMS) \ $(DOCKER_BUILD_ARGS) \ From a3ee7eea57c25a7464d9fdc6ee23caf299294c1a Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Wed, 8 Apr 2026 13:19:34 -0700 Subject: [PATCH 07/78] add rm *.tar to make clean --- metis/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/metis/Makefile b/metis/Makefile index 5be0fdd818..8d1d6d334b 100644 --- a/metis/Makefile +++ b/metis/Makefile @@ -74,6 +74,7 @@ all: clean tidy fmt vet test build ## Run all standard development targets. .PHONY: clean clean: ## Clean up build artifacts. rm -rf bin + rm -rf *.tar go clean ##@ Docker From 326ede6d2fbecb344186292ed80163d46334958d Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Wed, 8 Apr 2026 11:14:44 -0700 Subject: [PATCH 08/78] feat: add automation to create release tags --- tools/auto-tag.sh | 93 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100755 tools/auto-tag.sh diff --git a/tools/auto-tag.sh b/tools/auto-tag.sh new file mode 100755 index 0000000000..dd8e6b8246 --- /dev/null +++ b/tools/auto-tag.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash + +# Copyright 2026 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 + +KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. +cd "${KUBE_ROOT}" + +DRY_RUN=${DRY_RUN:-true} +FORCE_BRANCH=${FORCE_BRANCH:-""} + +# Get branch name +BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) + +if [[ -n "$FORCE_BRANCH" ]]; then + echo "Forcing branch name to: $FORCE_BRANCH" + BRANCH_NAME="$FORCE_BRANCH" +fi + +echo "Current branch: $BRANCH_NAME" + +# Enforce release branch +if [[ ! "$BRANCH_NAME" =~ ^release-1\.([0-9]+)$ ]]; then + echo "ERROR: This script must be run only in a release branch (release-1.X)." + exit 1 +fi + +# Get version from go.mod +VERSION_STRING=$(grep -E 'k8s.io/client-go' go.mod | grep -oE 'v0\.[0-9]+\.[0-9]+' | head -n 1) +echo "Found client-go version string: $VERSION_STRING" + +if [[ "$VERSION_STRING" =~ v0\.([0-9]+)\.([0-9]+) ]]; then + MINOR="${BASH_REMATCH[1]}" + PATCH="${BASH_REMATCH[2]}" + echo "Extracted version parameters: MINOR=$MINOR, PATCH=$PATCH" +else + echo "Could not determine client-go version from go.mod" + exit 1 +fi + +TAG_PREFIX="v$MINOR.$PATCH." +echo "Tag prefix: $TAG_PREFIX" + +# Fetch tags +echo "Fetching tags..." +git fetch --tags + +# Find largest tag +TAGS=$(git tag -l "$TAG_PREFIX*") + +LARGEST_CCM_PATCH=-1 +for t in $TAGS; do + if [[ "$t" =~ ^v$MINOR\.$PATCH\.([0-9]+)$ ]]; then + p="${BASH_REMATCH[1]}" + if (( p > LARGEST_CCM_PATCH )); then + LARGEST_CCM_PATCH=$p + fi + fi +done + +CCM_PATCH=$((LARGEST_CCM_PATCH + 1)) +NEW_TAG="v$MINOR.$PATCH.$CCM_PATCH" + +echo "Calculated new tag: $NEW_TAG" + +if [ "$DRY_RUN" = "true" ]; then + echo "DRY RUN: Skipping tag creation and push." + echo "To create the tag, run with DRY_RUN=false" + exit 0 +fi + +echo "Creating tag $NEW_TAG..." +git tag "$NEW_TAG" -m "CCM build for Kubernetes v1.$MINOR.$PATCH" + +echo "Pushing tag $NEW_TAG..." +git push origin "$NEW_TAG" + +echo "Successfully created and pushed tag $NEW_TAG" From 2e273706a739a6ee82211deea1019610b2278723 Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Thu, 9 Apr 2026 13:16:29 -0700 Subject: [PATCH 09/78] fix METIS_BINARY path in install-plugin.sh --- metis/install-plugin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metis/install-plugin.sh b/metis/install-plugin.sh index 908089c984..5076baa4b4 100644 --- a/metis/install-plugin.sh +++ b/metis/install-plugin.sh @@ -1,7 +1,7 @@ #!/bin/sh -ex CNI_DIR="${CNI_DIR:-/host/opt/cni/bin}" -METIS_BINARY="/metis" +METIS_BINARY="/bin/metis" echo "Installing metis CNI binary to ${CNI_DIR}..." mkdir -p "${CNI_DIR}" From 253600796ce6161f5abb61078c7141932b51d591 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Thu, 9 Apr 2026 14:12:54 -0700 Subject: [PATCH 10/78] feat: add workflow to auto tags release branch --- .github/workflows/auto-tag.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/auto-tag.yml diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml new file mode 100644 index 0000000000..d127e76857 --- /dev/null +++ b/.github/workflows/auto-tag.yml @@ -0,0 +1,28 @@ +name: Auto Tag release branches + +on: + push: + branches: + - 'release-1.*' + +jobs: + auto-tag: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Configure Git User + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Run auto-tag script + env: + DRY_RUN: "false" + FORCE_BRANCH: ${{ github.ref_name }} + run: ./tools/auto-tag.sh From 1281423a1ae6df037e2543dd68e820d045367bfc Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Mon, 13 Apr 2026 15:23:20 -0700 Subject: [PATCH 11/78] Sync go.work.sum for dependabot PRs --- .github/dependabot-sync.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/dependabot-sync.yml diff --git a/.github/dependabot-sync.yml b/.github/dependabot-sync.yml new file mode 100644 index 0000000000..ecbac61f08 --- /dev/null +++ b/.github/dependabot-sync.yml @@ -0,0 +1,37 @@ +name: Dependabot Go Work Sync + +on: + pull_request: + paths: + - '**/go.mod' + - '**/go.sum' + +permissions: + contents: write + +jobs: + go-work-sync: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.work' + + - name: Sync Go Workspace + run: go work sync + + - name: Commit and Push changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add go.work.sum + # Only commit if there are actual changes + git diff --quiet && git diff --staged --quiet || git commit -m "chore: update go.work.sum" + git push \ No newline at end of file From 1c772f1edf9acf061c62f94689c721ce875f203f Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Tue, 14 Apr 2026 14:08:37 -0700 Subject: [PATCH 12/78] fix: isolate k8s deps update w/ dependabot (#1049) Because k8s deps are tightly coupled, they should ideally be updated together and isolated from other deps update. Also, clean up configs for obsolete directories. --- .github/dependabot.yml | 69 +++++++++--------------------------------- 1 file changed, 15 insertions(+), 54 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b1c1ce62bf..4dbec43eed 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,35 +1,11 @@ version: 2 updates: -- package-ecosystem: docker - directory: /cluster/gce/gci/mounter - schedule: - interval: weekly - labels: - - 'area/dependency' - - 'release-note-none' - - 'ok-to-test' -- package-ecosystem: docker - directory: /cluster/addons/addon-manager - schedule: - interval: weekly - labels: - - 'area/dependency' - - 'release-note-none' - - 'ok-to-test' -- package-ecosystem: gomod - directory: /providers - schedule: - interval: weekly - labels: - - 'area/dependency' - - 'release-note-none' - - 'ok-to-test' - groups: - gomod-dependencies: - patterns: - - '*' - package-ecosystem: gomod - directory: / + directories: + - "/" + - "/providers" + - "/metis" + - "/test/e2e" schedule: interval: weekly labels: @@ -37,30 +13,15 @@ updates: - 'release-note-none' - 'ok-to-test' groups: - gomod-dependencies: + k8s-dependencies: patterns: - - '*' -- package-ecosystem: gomod - directory: /crd - schedule: - interval: weekly - labels: - - 'area/dependency' - - 'release-note-none' - - 'ok-to-test' - groups: - gomod-dependencies: - patterns: - - '*' -- package-ecosystem: gomod - directory: /crd/hack - schedule: - interval: weekly - labels: - - 'area/dependency' - - 'release-note-none' - - 'ok-to-test' - groups: - gomod-dependencies: + - "k8s.io/*" + - "sigs.k8s.io/*" + workspace-deps: patterns: - - '*' + - "*" + exclude-patterns: + - "k8s.io/*" + - "sigs.k8s.io/*" + + From b64003d65a2c845af5b0bef7011a451d4537fd44 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Tue, 14 Apr 2026 14:50:46 -0700 Subject: [PATCH 13/78] fix: move dependabot-sync.yml under workflows --- .github/{ => workflows}/dependabot-sync.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/dependabot-sync.yml (100%) diff --git a/.github/dependabot-sync.yml b/.github/workflows/dependabot-sync.yml similarity index 100% rename from .github/dependabot-sync.yml rename to .github/workflows/dependabot-sync.yml From 3c09f61b0532d99e0256a0f459bcd1796fd23c0f Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Wed, 15 Apr 2026 10:59:01 -0700 Subject: [PATCH 14/78] fix(metis): include DOCKER_TAG_ARGS in build-tarball target (#1052) --- metis/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/metis/Makefile b/metis/Makefile index 8d1d6d334b..65737a1b13 100644 --- a/metis/Makefile +++ b/metis/Makefile @@ -97,6 +97,7 @@ build-tarball: init-buildx ## Build the multi-arch image as an OCI tarball. @echo "Building OCI tarball for multi-arch image: $(IMAGE_NAME)..." docker buildx build --platform $(ALL_PLATFORMS) \ $(DOCKER_BUILD_ARGS) \ + $(DOCKER_TAG_ARGS) \ --output=type=oci,dest=$(OCI_TARBALL_PATH) \ --provenance=false \ --sbom=false . From 2d68b1f2255c0508a0cff4c8c439d216733d3e8c Mon Sep 17 00:00:00 2001 From: Damiano Donati Date: Thu, 16 Apr 2026 14:18:11 +0200 Subject: [PATCH 15/78] chore(bump): update google.golang.org/grpc to v1.79.3 --- go.mod | 18 +++++++++--------- go.sum | 38 ++++++++++++++++++++------------------ go.work.sum | 7 ++++++- metis/go.mod | 6 +++--- metis/go.sum | 14 ++++++++------ providers/go.mod | 10 +++++----- providers/go.sum | 26 ++++++++++++++------------ test/e2e/go.mod | 18 +++++++++--------- test/e2e/go.sum | 38 ++++++++++++++++++++------------------ 9 files changed, 94 insertions(+), 81 deletions(-) diff --git a/go.mod b/go.mod index 79a9b9291f..2cf46f4509 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/spf13/cobra v1.10.0 github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.11.1 - golang.org/x/oauth2 v0.30.0 + golang.org/x/oauth2 v0.34.0 google.golang.org/api v0.199.0 gopkg.in/gcfg.v1 v1.2.3 gopkg.in/warnings.v0 v0.1.2 // indirect @@ -42,10 +42,10 @@ require ( ) require ( - cel.dev/expr v0.24.0 // indirect + cel.dev/expr v0.25.1 // indirect cloud.google.com/go/auth v0.9.5 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect - cloud.google.com/go/compute/metadata v0.6.0 // indirect + cloud.google.com/go/compute/metadata v0.9.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/google/btree v1.1.3 // indirect @@ -59,8 +59,8 @@ require ( go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect @@ -97,7 +97,7 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -127,7 +127,7 @@ require ( go.opentelemetry.io/otel/metric v1.41.0 // indirect go.opentelemetry.io/otel/sdk v1.41.0 // indirect go.opentelemetry.io/otel/trace v1.41.0 // indirect - go.opentelemetry.io/proto/otlp v1.5.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect golang.org/x/crypto v0.48.0 // indirect @@ -139,8 +139,8 @@ require ( golang.org/x/text v0.34.0 // indirect golang.org/x/time v0.10.0 // indirect golang.org/x/tools v0.41.0 // indirect - google.golang.org/grpc v1.72.2 // indirect - google.golang.org/protobuf v1.36.8 // indirect + google.golang.org/grpc v1.79.3 // indirect + google.golang.org/protobuf v1.36.10 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 4a0790d0b2..3f90f1522c 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,12 @@ -cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= -cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go/auth v0.9.5 h1:4CTn43Eynw40aFVr3GpPqsQponx2jv0BQpjvajsbbzw= cloud.google.com/go/auth v0.9.5/go.mod h1:Xo0n7n66eHyOWWCnitop6870Ilwo3PiZyodVkkH1xWM= cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= -cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= -cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -134,8 +134,8 @@ github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0 h1:FbSCl+KggFl+Ocym490i/E github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0/go.mod h1:qOchhhIlmRcqk/O9uCo/puJlyo07YINaIqdZfZG3Jkc= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= @@ -268,8 +268,8 @@ go.opentelemetry.io/otel/sdk/metric v1.41.0 h1:siZQIYBAUd1rlIWQT2uCxWJxcCO7q3Tri go.opentelemetry.io/otel/sdk/metric v1.41.0/go.mod h1:HNBuSvT7ROaGtGI50ArdRLUnvRTRGniSUZbxiWxSO8Y= go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= -go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= -go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -307,8 +307,8 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= +golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= +golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -351,6 +351,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/api v0.199.0 h1:aWUXClp+VFJmqE0JPvpZOK3LDQMyFKYIow4etYd9qxs= google.golang.org/api v0.199.0/go.mod h1:ohG4qSztDJmZdjK/Ar6MhbAmb/Rpi4JHOqagsh90K28= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -358,17 +360,17 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8= -google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -378,8 +380,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/go.work.sum b/go.work.sum index 73716a2fd7..13dcc9ac2b 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,6 +1,11 @@ +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= +golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= diff --git a/metis/go.mod b/metis/go.mod index 2266e9ee43..3cf7419d6a 100644 --- a/metis/go.mod +++ b/metis/go.mod @@ -9,8 +9,8 @@ require ( github.com/mattn/go-sqlite3 v1.14.37 github.com/spf13/cobra v1.10.0 github.com/spf13/pflag v1.0.10 - google.golang.org/grpc v1.72.2 - google.golang.org/protobuf v1.36.8 + google.golang.org/grpc v1.79.3 + google.golang.org/protobuf v1.36.10 k8s.io/component-base v0.35.1 k8s.io/klog/v2 v2.140.0 ) @@ -40,7 +40,7 @@ require ( golang.org/x/net v0.49.0 // indirect golang.org/x/sys v0.41.0 // indirect golang.org/x/text v0.34.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect gopkg.in/inf.v0 v0.9.1 // indirect k8s.io/apimachinery v0.35.1 // indirect k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect diff --git a/metis/go.sum b/metis/go.sum index eda9db54cb..22d76d1c65 100644 --- a/metis/go.sum +++ b/metis/go.sum @@ -97,12 +97,14 @@ golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= -google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8= -google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/providers/go.mod b/providers/go.mod index d8d92b3986..9f33c770d9 100644 --- a/providers/go.mod +++ b/providers/go.mod @@ -8,7 +8,7 @@ require ( github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 github.com/google/go-cmp v0.7.0 github.com/stretchr/testify v1.11.1 - golang.org/x/oauth2 v0.30.0 + golang.org/x/oauth2 v0.34.0 google.golang.org/api v0.199.0 gopkg.in/gcfg.v1 v1.2.3 gopkg.in/warnings.v0 v0.1.2 // indirect @@ -21,7 +21,7 @@ require ( ) require ( - cloud.google.com/go/compute/metadata v0.6.0 + cloud.google.com/go/compute/metadata v0.9.0 k8s.io/cloud-provider v0.35.1 ) @@ -78,9 +78,9 @@ require ( golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect golang.org/x/time v0.10.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect - google.golang.org/grpc v1.72.2 // indirect - google.golang.org/protobuf v1.36.8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/grpc v1.79.3 // indirect + google.golang.org/protobuf v1.36.10 // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/providers/go.sum b/providers/go.sum index 878a2a7ce0..d297c47546 100644 --- a/providers/go.sum +++ b/providers/go.sum @@ -3,8 +3,8 @@ cloud.google.com/go/auth v0.9.5 h1:4CTn43Eynw40aFVr3GpPqsQponx2jv0BQpjvajsbbzw= cloud.google.com/go/auth v0.9.5/go.mod h1:Xo0n7n66eHyOWWCnitop6870Ilwo3PiZyodVkkH1xWM= cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= -cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= -cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= @@ -180,8 +180,8 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= +golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= +golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -209,6 +209,8 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/api v0.199.0 h1:aWUXClp+VFJmqE0JPvpZOK3LDQMyFKYIow4etYd9qxs= google.golang.org/api v0.199.0/go.mod h1:ohG4qSztDJmZdjK/Ar6MhbAmb/Rpi4JHOqagsh90K28= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -217,17 +219,17 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8= -google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -237,8 +239,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/test/e2e/go.mod b/test/e2e/go.mod index 0749f111ce..1fe0e8d1b0 100644 --- a/test/e2e/go.mod +++ b/test/e2e/go.mod @@ -19,10 +19,10 @@ require ( ) require ( - cel.dev/expr v0.24.0 // indirect + cel.dev/expr v0.25.1 // indirect cloud.google.com/go/auth v0.9.5 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect - cloud.google.com/go/compute/metadata v0.6.0 // indirect + cloud.google.com/go/compute/metadata v0.9.0 // indirect github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect @@ -58,7 +58,7 @@ require ( github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -93,7 +93,7 @@ require ( go.opentelemetry.io/otel/metric v1.41.0 // indirect go.opentelemetry.io/otel/sdk v1.41.0 // indirect go.opentelemetry.io/otel/trace v1.41.0 // indirect - go.opentelemetry.io/proto/otlp v1.5.0 // indirect + go.opentelemetry.io/proto/otlp v1.7.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect @@ -102,17 +102,17 @@ require ( golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect golang.org/x/mod v0.32.0 // indirect golang.org/x/net v0.49.0 // indirect - golang.org/x/oauth2 v0.30.0 // indirect + golang.org/x/oauth2 v0.34.0 // indirect golang.org/x/sync v0.19.0 // indirect golang.org/x/sys v0.41.0 // indirect golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect golang.org/x/time v0.10.0 // indirect golang.org/x/tools v0.41.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect - google.golang.org/grpc v1.72.2 // indirect - google.golang.org/protobuf v1.36.8 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/grpc v1.79.3 // indirect + google.golang.org/protobuf v1.36.10 // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/gcfg.v1 v1.2.3 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/test/e2e/go.sum b/test/e2e/go.sum index 278e8ae477..f9c052a1f1 100644 --- a/test/e2e/go.sum +++ b/test/e2e/go.sum @@ -1,12 +1,12 @@ -cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= -cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= +cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4= +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go/auth v0.9.5 h1:4CTn43Eynw40aFVr3GpPqsQponx2jv0BQpjvajsbbzw= cloud.google.com/go/auth v0.9.5/go.mod h1:Xo0n7n66eHyOWWCnitop6870Ilwo3PiZyodVkkH1xWM= cloud.google.com/go/auth/oauth2adapt v0.2.4 h1:0GWE/FUsXhf6C+jAkWgYm7X9tK8cuEIfy19DBn6B6bY= cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLMC/Pe3eaL4NmdvqPtc= -cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= -cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= +cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= @@ -132,8 +132,8 @@ github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0 h1:FbSCl+KggFl+Ocym490i/E github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0/go.mod h1:qOchhhIlmRcqk/O9uCo/puJlyo07YINaIqdZfZG3Jkc= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I= @@ -269,8 +269,8 @@ go.opentelemetry.io/otel/sdk/metric v1.41.0 h1:siZQIYBAUd1rlIWQT2uCxWJxcCO7q3Tri go.opentelemetry.io/otel/sdk/metric v1.41.0/go.mod h1:HNBuSvT7ROaGtGI50ArdRLUnvRTRGniSUZbxiWxSO8Y= go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= -go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= -go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= +go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -308,8 +308,8 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= +golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw= +golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -345,6 +345,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= google.golang.org/api v0.199.0 h1:aWUXClp+VFJmqE0JPvpZOK3LDQMyFKYIow4etYd9qxs= google.golang.org/api v0.199.0/go.mod h1:ohG4qSztDJmZdjK/Ar6MhbAmb/Rpi4JHOqagsh90K28= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -352,17 +354,17 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= +google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= +google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8= -google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -372,8 +374,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= +google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From c77685c5cf8e314123fa83dc3382cdac47bf2725 Mon Sep 17 00:00:00 2001 From: Damiano Donati Date: Thu, 16 Apr 2026 14:18:19 +0200 Subject: [PATCH 16/78] chore(bump): update google.golang.org/grpc to v1.79.3: vendor --- vendor/cel.dev/expr/BUILD.bazel | 1 - vendor/cel.dev/expr/MODULE.bazel | 22 +- vendor/cel.dev/expr/checked.pb.go | 749 ++++++-------- vendor/cel.dev/expr/eval.pb.go | 77 +- vendor/cel.dev/expr/explain.pb.go | 113 +-- vendor/cel.dev/expr/syntax.pb.go | 879 ++++++----------- vendor/cel.dev/expr/value.pb.go | 348 +++---- .../go/compute/metadata/CHANGES.md | 49 + .../go/compute/metadata/metadata.go | 255 +++-- .../go/compute/metadata/retry.go | 3 + .../go/compute/metadata/syscheck.go | 4 +- .../go/compute/metadata/syscheck_linux.go | 4 +- .../go/compute/metadata/syscheck_windows.go | 3 +- .../trace/v1/trace_service_grpc.pb.go | 4 - .../proto/otlp/common/v1/common.pb.go | 138 ++- .../proto/otlp/resource/v1/resource.pb.go | 56 +- vendor/golang.org/x/oauth2/deviceauth.go | 31 +- .../x/oauth2/google/externalaccount/aws.go | 7 +- vendor/golang.org/x/oauth2/google/google.go | 2 +- vendor/golang.org/x/oauth2/oauth2.go | 5 +- vendor/golang.org/x/oauth2/pkce.go | 2 +- vendor/golang.org/x/oauth2/token.go | 2 +- vendor/golang.org/x/oauth2/transport.go | 2 +- .../api/annotations/annotations.pb.go | 2 +- .../googleapis/api/annotations/client.pb.go | 2 +- .../api/annotations/field_behavior.pb.go | 2 +- .../api/annotations/field_info.pb.go | 2 +- .../googleapis/api/annotations/http.pb.go | 2 +- .../googleapis/api/annotations/resource.pb.go | 2 +- .../googleapis/api/annotations/routing.pb.go | 2 +- .../api/expr/v1alpha1/checked.pb.go | 2 +- .../googleapis/api/expr/v1alpha1/eval.pb.go | 2 +- .../api/expr/v1alpha1/explain.pb.go | 2 +- .../googleapis/api/expr/v1alpha1/syntax.pb.go | 2 +- .../googleapis/api/expr/v1alpha1/value.pb.go | 2 +- .../googleapis/api/httpbody/httpbody.pb.go | 2 +- .../googleapis/api/launch_stage.pb.go | 2 +- vendor/google.golang.org/grpc/CONTRIBUTING.md | 184 +++- vendor/google.golang.org/grpc/MAINTAINERS.md | 8 +- vendor/google.golang.org/grpc/README.md | 1 + .../grpc/balancer/balancer.go | 10 +- .../endpointsharding/endpointsharding.go | 57 +- .../balancer/pickfirst/internal/internal.go | 2 + .../grpc/balancer/pickfirst/pickfirst.go | 922 ++++++++++++++--- .../pickfirst/pickfirstleaf/pickfirstleaf.go | 927 ------------------ .../grpc/balancer/roundrobin/roundrobin.go | 13 +- .../grpc/balancer/subconn.go | 14 - .../grpc/balancer_wrapper.go | 15 +- .../grpc_binarylog_v1/binarylog.pb.go | 191 ++-- vendor/google.golang.org/grpc/clientconn.go | 211 +++- .../grpc/credentials/credentials.go | 62 +- .../grpc/credentials/insecure/insecure.go | 8 +- .../google.golang.org/grpc/credentials/tls.go | 50 +- vendor/google.golang.org/grpc/dialoptions.go | 25 +- .../grpc/encoding/encoding.go | 24 +- .../grpc/encoding/gzip/gzip.go | 12 - .../grpc/encoding/internal/internal.go | 28 + .../grpc/encoding/proto/proto.go | 20 +- .../grpc/experimental/stats/metricregistry.go | 72 ++ .../grpc/experimental/stats/metrics.go | 79 +- .../grpc/health/grpc_health_v1/health.pb.go | 82 +- .../health/grpc_health_v1/health_grpc.pb.go | 8 +- vendor/google.golang.org/grpc/interceptor.go | 12 +- .../balancer/gracefulswitch/gracefulswitch.go | 22 +- .../grpc/internal/balancer/weight/weight.go | 66 ++ .../grpc/internal/buffer/unbounded.go | 1 + .../grpc/internal/channelz/trace.go | 2 +- .../grpc/internal/credentials/credentials.go | 14 - .../grpc/internal/envconfig/envconfig.go | 63 +- .../grpc/internal/envconfig/xds.go | 16 + .../grpc/internal/experimental.go | 7 + .../internal/grpcsync/callback_serializer.go | 22 +- .../grpc/internal/grpcsync/event.go | 19 +- .../grpc/internal/idle/idle.go | 77 +- .../grpc/internal/internal.go | 65 +- .../delegatingresolver/delegatingresolver.go | 58 +- .../internal/resolver/dns/dns_resolver.go | 35 +- .../internal/stats/metrics_recorder_list.go | 70 ++ .../grpc/internal/stats/stats.go | 70 ++ .../grpc/internal/status/status.go | 8 + .../grpc/internal/transport/client_stream.go | 34 +- .../grpc/internal/transport/controlbuf.go | 126 ++- .../grpc/internal/transport/flowcontrol.go | 23 +- .../grpc/internal/transport/handler_server.go | 50 +- .../grpc/internal/transport/http2_client.go | 288 +++--- .../grpc/internal/transport/http2_server.go | 213 ++-- .../grpc/internal/transport/http_util.go | 172 +++- .../grpc/internal/transport/server_stream.go | 13 +- .../grpc/internal/transport/transport.go | 132 ++- .../google.golang.org/grpc/mem/buffer_pool.go | 31 +- .../grpc/mem/buffer_slice.go | 104 +- vendor/google.golang.org/grpc/mem/buffers.go | 65 +- .../google.golang.org/grpc/picker_wrapper.go | 36 +- vendor/google.golang.org/grpc/preloader.go | 3 - .../grpc/resolver/resolver.go | 6 + .../grpc/resolver_wrapper.go | 1 + vendor/google.golang.org/grpc/rpc_util.go | 138 ++- vendor/google.golang.org/grpc/server.go | 188 ++-- .../google.golang.org/grpc/stats/handlers.go | 9 + vendor/google.golang.org/grpc/stats/stats.go | 20 +- vendor/google.golang.org/grpc/stream.go | 280 ++++-- vendor/google.golang.org/grpc/version.go | 2 +- .../internal/editionssupport/editions.go | 2 +- .../protobuf/internal/filedesc/desc.go | 52 +- .../protobuf/internal/filedesc/desc_init.go | 14 + .../protobuf/internal/filedesc/desc_lazy.go | 20 + .../protobuf/internal/filedesc/editions.go | 12 +- .../protobuf/internal/version/version.go | 2 +- .../protobuf/reflect/protodesc/desc.go | 22 + .../protobuf/reflect/protodesc/desc_init.go | 2 + .../protobuf/reflect/protodesc/proto.go | 37 +- vendor/modules.txt | 35 +- 112 files changed, 4722 insertions(+), 3846 deletions(-) delete mode 100644 vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go create mode 100644 vendor/google.golang.org/grpc/encoding/internal/internal.go create mode 100644 vendor/google.golang.org/grpc/internal/balancer/weight/weight.go create mode 100644 vendor/google.golang.org/grpc/internal/stats/stats.go diff --git a/vendor/cel.dev/expr/BUILD.bazel b/vendor/cel.dev/expr/BUILD.bazel index 37d8adc950..f5bda3bb17 100644 --- a/vendor/cel.dev/expr/BUILD.bazel +++ b/vendor/cel.dev/expr/BUILD.bazel @@ -16,7 +16,6 @@ go_library( importpath = "cel.dev/expr", visibility = ["//visibility:public"], deps = [ - "@org_golang_google_genproto_googleapis_rpc//status:go_default_library", "@org_golang_google_protobuf//reflect/protoreflect", "@org_golang_google_protobuf//runtime/protoimpl", "@org_golang_google_protobuf//types/known/anypb", diff --git a/vendor/cel.dev/expr/MODULE.bazel b/vendor/cel.dev/expr/MODULE.bazel index 85ac9ff617..cb98ed5991 100644 --- a/vendor/cel.dev/expr/MODULE.bazel +++ b/vendor/cel.dev/expr/MODULE.bazel @@ -11,26 +11,9 @@ bazel_dep( version = "0.39.1", repo_name = "bazel_gazelle", ) -bazel_dep( - name = "googleapis", - version = "0.0.0-20241220-5e258e33.bcr.1", - repo_name = "com_google_googleapis", -) -bazel_dep( - name = "googleapis-cc", - version = "1.0.0", -) -bazel_dep( - name = "googleapis-java", - version = "1.0.0", -) -bazel_dep( - name = "googleapis-go", - version = "1.0.0", -) bazel_dep( name = "protobuf", - version = "27.0", + version = "27.1", repo_name = "com_google_protobuf", ) bazel_dep( @@ -63,12 +46,11 @@ python.toolchain( ) go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk") -go_sdk.download(version = "1.22.0") +go_sdk.download(version = "1.23.0") go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//:go.mod") use_repo( go_deps, - "org_golang_google_genproto_googleapis_rpc", "org_golang_google_protobuf", ) diff --git a/vendor/cel.dev/expr/checked.pb.go b/vendor/cel.dev/expr/checked.pb.go index bb225c8ab3..b18085e9b6 100644 --- a/vendor/cel.dev/expr/checked.pb.go +++ b/vendor/cel.dev/expr/checked.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.36.10 +// protoc v5.27.1 // source: cel/expr/checked.proto package expr @@ -13,6 +13,7 @@ import ( structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -136,24 +137,21 @@ func (Type_WellKnownType) EnumDescriptor() ([]byte, []int) { } type CheckedExpr struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + ReferenceMap map[int64]*Reference `protobuf:"bytes,2,rep,name=reference_map,json=referenceMap,proto3" json:"reference_map,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + TypeMap map[int64]*Type `protobuf:"bytes,3,rep,name=type_map,json=typeMap,proto3" json:"type_map,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` + SourceInfo *SourceInfo `protobuf:"bytes,5,opt,name=source_info,json=sourceInfo,proto3" json:"source_info,omitempty"` + ExprVersion string `protobuf:"bytes,6,opt,name=expr_version,json=exprVersion,proto3" json:"expr_version,omitempty"` + Expr *Expr `protobuf:"bytes,4,opt,name=expr,proto3" json:"expr,omitempty"` unknownFields protoimpl.UnknownFields - - ReferenceMap map[int64]*Reference `protobuf:"bytes,2,rep,name=reference_map,json=referenceMap,proto3" json:"reference_map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - TypeMap map[int64]*Type `protobuf:"bytes,3,rep,name=type_map,json=typeMap,proto3" json:"type_map,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - SourceInfo *SourceInfo `protobuf:"bytes,5,opt,name=source_info,json=sourceInfo,proto3" json:"source_info,omitempty"` - ExprVersion string `protobuf:"bytes,6,opt,name=expr_version,json=exprVersion,proto3" json:"expr_version,omitempty"` - Expr *Expr `protobuf:"bytes,4,opt,name=expr,proto3" json:"expr,omitempty"` + sizeCache protoimpl.SizeCache } func (x *CheckedExpr) Reset() { *x = CheckedExpr{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *CheckedExpr) String() string { @@ -164,7 +162,7 @@ func (*CheckedExpr) ProtoMessage() {} func (x *CheckedExpr) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -215,11 +213,8 @@ func (x *CheckedExpr) GetExpr() *Expr { } type Type struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to TypeKind: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to TypeKind: // // *Type_Dyn // *Type_Null @@ -234,16 +229,16 @@ type Type struct { // *Type_Type // *Type_Error // *Type_AbstractType_ - TypeKind isType_TypeKind `protobuf_oneof:"type_kind"` + TypeKind isType_TypeKind `protobuf_oneof:"type_kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Type) Reset() { *x = Type{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Type) String() string { @@ -254,7 +249,7 @@ func (*Type) ProtoMessage() {} func (x *Type) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -269,100 +264,126 @@ func (*Type) Descriptor() ([]byte, []int) { return file_cel_expr_checked_proto_rawDescGZIP(), []int{1} } -func (m *Type) GetTypeKind() isType_TypeKind { - if m != nil { - return m.TypeKind +func (x *Type) GetTypeKind() isType_TypeKind { + if x != nil { + return x.TypeKind } return nil } func (x *Type) GetDyn() *emptypb.Empty { - if x, ok := x.GetTypeKind().(*Type_Dyn); ok { - return x.Dyn + if x != nil { + if x, ok := x.TypeKind.(*Type_Dyn); ok { + return x.Dyn + } } return nil } func (x *Type) GetNull() structpb.NullValue { - if x, ok := x.GetTypeKind().(*Type_Null); ok { - return x.Null + if x != nil { + if x, ok := x.TypeKind.(*Type_Null); ok { + return x.Null + } } return structpb.NullValue(0) } func (x *Type) GetPrimitive() Type_PrimitiveType { - if x, ok := x.GetTypeKind().(*Type_Primitive); ok { - return x.Primitive + if x != nil { + if x, ok := x.TypeKind.(*Type_Primitive); ok { + return x.Primitive + } } return Type_PRIMITIVE_TYPE_UNSPECIFIED } func (x *Type) GetWrapper() Type_PrimitiveType { - if x, ok := x.GetTypeKind().(*Type_Wrapper); ok { - return x.Wrapper + if x != nil { + if x, ok := x.TypeKind.(*Type_Wrapper); ok { + return x.Wrapper + } } return Type_PRIMITIVE_TYPE_UNSPECIFIED } func (x *Type) GetWellKnown() Type_WellKnownType { - if x, ok := x.GetTypeKind().(*Type_WellKnown); ok { - return x.WellKnown + if x != nil { + if x, ok := x.TypeKind.(*Type_WellKnown); ok { + return x.WellKnown + } } return Type_WELL_KNOWN_TYPE_UNSPECIFIED } func (x *Type) GetListType() *Type_ListType { - if x, ok := x.GetTypeKind().(*Type_ListType_); ok { - return x.ListType + if x != nil { + if x, ok := x.TypeKind.(*Type_ListType_); ok { + return x.ListType + } } return nil } func (x *Type) GetMapType() *Type_MapType { - if x, ok := x.GetTypeKind().(*Type_MapType_); ok { - return x.MapType + if x != nil { + if x, ok := x.TypeKind.(*Type_MapType_); ok { + return x.MapType + } } return nil } func (x *Type) GetFunction() *Type_FunctionType { - if x, ok := x.GetTypeKind().(*Type_Function); ok { - return x.Function + if x != nil { + if x, ok := x.TypeKind.(*Type_Function); ok { + return x.Function + } } return nil } func (x *Type) GetMessageType() string { - if x, ok := x.GetTypeKind().(*Type_MessageType); ok { - return x.MessageType + if x != nil { + if x, ok := x.TypeKind.(*Type_MessageType); ok { + return x.MessageType + } } return "" } func (x *Type) GetTypeParam() string { - if x, ok := x.GetTypeKind().(*Type_TypeParam); ok { - return x.TypeParam + if x != nil { + if x, ok := x.TypeKind.(*Type_TypeParam); ok { + return x.TypeParam + } } return "" } func (x *Type) GetType() *Type { - if x, ok := x.GetTypeKind().(*Type_Type); ok { - return x.Type + if x != nil { + if x, ok := x.TypeKind.(*Type_Type); ok { + return x.Type + } } return nil } func (x *Type) GetError() *emptypb.Empty { - if x, ok := x.GetTypeKind().(*Type_Error); ok { - return x.Error + if x != nil { + if x, ok := x.TypeKind.(*Type_Error); ok { + return x.Error + } } return nil } func (x *Type) GetAbstractType() *Type_AbstractType { - if x, ok := x.GetTypeKind().(*Type_AbstractType_); ok { - return x.AbstractType + if x != nil { + if x, ok := x.TypeKind.(*Type_AbstractType_); ok { + return x.AbstractType + } } return nil } @@ -450,25 +471,22 @@ func (*Type_Error) isType_TypeKind() {} func (*Type_AbstractType_) isType_TypeKind() {} type Decl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // Types that are assignable to DeclKind: + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Types that are valid to be assigned to DeclKind: // // *Decl_Ident // *Decl_Function - DeclKind isDecl_DeclKind `protobuf_oneof:"decl_kind"` + DeclKind isDecl_DeclKind `protobuf_oneof:"decl_kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Decl) Reset() { *x = Decl{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Decl) String() string { @@ -479,7 +497,7 @@ func (*Decl) ProtoMessage() {} func (x *Decl) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -501,23 +519,27 @@ func (x *Decl) GetName() string { return "" } -func (m *Decl) GetDeclKind() isDecl_DeclKind { - if m != nil { - return m.DeclKind +func (x *Decl) GetDeclKind() isDecl_DeclKind { + if x != nil { + return x.DeclKind } return nil } func (x *Decl) GetIdent() *Decl_IdentDecl { - if x, ok := x.GetDeclKind().(*Decl_Ident); ok { - return x.Ident + if x != nil { + if x, ok := x.DeclKind.(*Decl_Ident); ok { + return x.Ident + } } return nil } func (x *Decl) GetFunction() *Decl_FunctionDecl { - if x, ok := x.GetDeclKind().(*Decl_Function); ok { - return x.Function + if x != nil { + if x, ok := x.DeclKind.(*Decl_Function); ok { + return x.Function + } } return nil } @@ -539,22 +561,19 @@ func (*Decl_Ident) isDecl_DeclKind() {} func (*Decl_Function) isDecl_DeclKind() {} type Reference struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + OverloadId []string `protobuf:"bytes,3,rep,name=overload_id,json=overloadId,proto3" json:"overload_id,omitempty"` + Value *Constant `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - OverloadId []string `protobuf:"bytes,3,rep,name=overload_id,json=overloadId,proto3" json:"overload_id,omitempty"` - Value *Constant `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Reference) Reset() { *x = Reference{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Reference) String() string { @@ -565,7 +584,7 @@ func (*Reference) ProtoMessage() {} func (x *Reference) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -602,20 +621,17 @@ func (x *Reference) GetValue() *Constant { } type Type_ListType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + ElemType *Type `protobuf:"bytes,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` unknownFields protoimpl.UnknownFields - - ElemType *Type `protobuf:"bytes,1,opt,name=elem_type,json=elemType,proto3" json:"elem_type,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Type_ListType) Reset() { *x = Type_ListType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Type_ListType) String() string { @@ -626,7 +642,7 @@ func (*Type_ListType) ProtoMessage() {} func (x *Type_ListType) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -649,21 +665,18 @@ func (x *Type_ListType) GetElemType() *Type { } type Type_MapType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + KeyType *Type `protobuf:"bytes,1,opt,name=key_type,json=keyType,proto3" json:"key_type,omitempty"` + ValueType *Type `protobuf:"bytes,2,opt,name=value_type,json=valueType,proto3" json:"value_type,omitempty"` unknownFields protoimpl.UnknownFields - - KeyType *Type `protobuf:"bytes,1,opt,name=key_type,json=keyType,proto3" json:"key_type,omitempty"` - ValueType *Type `protobuf:"bytes,2,opt,name=value_type,json=valueType,proto3" json:"value_type,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Type_MapType) Reset() { *x = Type_MapType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Type_MapType) String() string { @@ -674,7 +687,7 @@ func (*Type_MapType) ProtoMessage() {} func (x *Type_MapType) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -704,21 +717,18 @@ func (x *Type_MapType) GetValueType() *Type { } type Type_FunctionType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + ResultType *Type `protobuf:"bytes,1,opt,name=result_type,json=resultType,proto3" json:"result_type,omitempty"` + ArgTypes []*Type `protobuf:"bytes,2,rep,name=arg_types,json=argTypes,proto3" json:"arg_types,omitempty"` unknownFields protoimpl.UnknownFields - - ResultType *Type `protobuf:"bytes,1,opt,name=result_type,json=resultType,proto3" json:"result_type,omitempty"` - ArgTypes []*Type `protobuf:"bytes,2,rep,name=arg_types,json=argTypes,proto3" json:"arg_types,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Type_FunctionType) Reset() { *x = Type_FunctionType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Type_FunctionType) String() string { @@ -729,7 +739,7 @@ func (*Type_FunctionType) ProtoMessage() {} func (x *Type_FunctionType) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -759,21 +769,18 @@ func (x *Type_FunctionType) GetArgTypes() []*Type { } type Type_AbstractType struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - ParameterTypes []*Type `protobuf:"bytes,2,rep,name=parameter_types,json=parameterTypes,proto3" json:"parameter_types,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + ParameterTypes []*Type `protobuf:"bytes,2,rep,name=parameter_types,json=parameterTypes,proto3" json:"parameter_types,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Type_AbstractType) Reset() { *x = Type_AbstractType{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Type_AbstractType) String() string { @@ -784,7 +791,7 @@ func (*Type_AbstractType) ProtoMessage() {} func (x *Type_AbstractType) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -814,22 +821,19 @@ func (x *Type_AbstractType) GetParameterTypes() []*Type { } type Decl_IdentDecl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Type *Type `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Value *Constant `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + Doc string `protobuf:"bytes,3,opt,name=doc,proto3" json:"doc,omitempty"` unknownFields protoimpl.UnknownFields - - Type *Type `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Value *Constant `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Doc string `protobuf:"bytes,3,opt,name=doc,proto3" json:"doc,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Decl_IdentDecl) Reset() { *x = Decl_IdentDecl{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Decl_IdentDecl) String() string { @@ -840,7 +844,7 @@ func (*Decl_IdentDecl) ProtoMessage() {} func (x *Decl_IdentDecl) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -877,20 +881,18 @@ func (x *Decl_IdentDecl) GetDoc() string { } type Decl_FunctionDecl struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Overloads []*Decl_FunctionDecl_Overload `protobuf:"bytes,1,rep,name=overloads,proto3" json:"overloads,omitempty"` + Doc string `protobuf:"bytes,2,opt,name=doc,proto3" json:"doc,omitempty"` unknownFields protoimpl.UnknownFields - - Overloads []*Decl_FunctionDecl_Overload `protobuf:"bytes,1,rep,name=overloads,proto3" json:"overloads,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Decl_FunctionDecl) Reset() { *x = Decl_FunctionDecl{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[11] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Decl_FunctionDecl) String() string { @@ -901,7 +903,7 @@ func (*Decl_FunctionDecl) ProtoMessage() {} func (x *Decl_FunctionDecl) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[11] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -923,26 +925,30 @@ func (x *Decl_FunctionDecl) GetOverloads() []*Decl_FunctionDecl_Overload { return nil } -type Decl_FunctionDecl_Overload struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func (x *Decl_FunctionDecl) GetDoc() string { + if x != nil { + return x.Doc + } + return "" +} - OverloadId string `protobuf:"bytes,1,opt,name=overload_id,json=overloadId,proto3" json:"overload_id,omitempty"` - Params []*Type `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` - TypeParams []string `protobuf:"bytes,3,rep,name=type_params,json=typeParams,proto3" json:"type_params,omitempty"` - ResultType *Type `protobuf:"bytes,4,opt,name=result_type,json=resultType,proto3" json:"result_type,omitempty"` - IsInstanceFunction bool `protobuf:"varint,5,opt,name=is_instance_function,json=isInstanceFunction,proto3" json:"is_instance_function,omitempty"` - Doc string `protobuf:"bytes,6,opt,name=doc,proto3" json:"doc,omitempty"` +type Decl_FunctionDecl_Overload struct { + state protoimpl.MessageState `protogen:"open.v1"` + OverloadId string `protobuf:"bytes,1,opt,name=overload_id,json=overloadId,proto3" json:"overload_id,omitempty"` + Params []*Type `protobuf:"bytes,2,rep,name=params,proto3" json:"params,omitempty"` + TypeParams []string `protobuf:"bytes,3,rep,name=type_params,json=typeParams,proto3" json:"type_params,omitempty"` + ResultType *Type `protobuf:"bytes,4,opt,name=result_type,json=resultType,proto3" json:"result_type,omitempty"` + IsInstanceFunction bool `protobuf:"varint,5,opt,name=is_instance_function,json=isInstanceFunction,proto3" json:"is_instance_function,omitempty"` + Doc string `protobuf:"bytes,6,opt,name=doc,proto3" json:"doc,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Decl_FunctionDecl_Overload) Reset() { *x = Decl_FunctionDecl_Overload{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_checked_proto_msgTypes[12] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_checked_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Decl_FunctionDecl_Overload) String() string { @@ -953,7 +959,7 @@ func (*Decl_FunctionDecl_Overload) ProtoMessage() {} func (x *Decl_FunctionDecl_Overload) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_checked_proto_msgTypes[12] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1012,185 +1018,113 @@ func (x *Decl_FunctionDecl_Overload) GetDoc() string { var File_cel_expr_checked_proto protoreflect.FileDescriptor -var file_cel_expr_checked_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, - 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x1a, 0x15, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x73, 0x79, 0x6e, - 0x74, 0x61, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xba, 0x03, 0x0a, 0x0b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, - 0x45, 0x78, 0x70, 0x72, 0x12, 0x4c, 0x0a, 0x0d, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x78, - 0x70, 0x72, 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4d, - 0x61, 0x70, 0x12, 0x3d, 0x0a, 0x08, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x03, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x43, 0x68, 0x65, 0x63, 0x6b, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, - 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x74, 0x79, 0x70, 0x65, 0x4d, 0x61, - 0x70, 0x12, 0x35, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x78, 0x70, 0x72, - 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x65, 0x78, 0x70, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x65, - 0x78, 0x70, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x04, 0x65, 0x78, 0x70, 0x72, 0x1a, - 0x54, 0x0a, 0x11, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x4d, 0x61, 0x70, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x2e, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4a, 0x0a, 0x0c, 0x54, 0x79, 0x70, 0x65, 0x4d, 0x61, 0x70, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0xe6, 0x09, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x03, 0x64, 0x79, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, - 0x00, 0x52, 0x03, 0x64, 0x79, 0x6e, 0x12, 0x30, 0x0a, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x48, 0x00, 0x52, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x12, 0x3c, 0x0a, 0x09, 0x70, 0x72, 0x69, 0x6d, - 0x69, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x50, 0x72, 0x69, 0x6d, - 0x69, 0x74, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x09, 0x70, 0x72, 0x69, - 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x12, 0x38, 0x0a, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, - 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x07, 0x77, 0x72, 0x61, 0x70, 0x70, 0x65, 0x72, - 0x12, 0x3d, 0x0a, 0x0a, 0x77, 0x65, 0x6c, 0x6c, 0x5f, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x54, 0x79, 0x70, 0x65, 0x2e, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x54, 0x79, - 0x70, 0x65, 0x48, 0x00, 0x52, 0x09, 0x77, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, 0x77, 0x6e, 0x12, - 0x36, 0x0a, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x08, 0x6c, - 0x69, 0x73, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x08, 0x6d, 0x61, 0x70, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x4d, 0x61, 0x70, 0x54, 0x79, 0x70, - 0x65, 0x48, 0x00, 0x52, 0x07, 0x6d, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x39, 0x0a, 0x08, - 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x46, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x08, 0x66, - 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x23, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, - 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0a, - 0x74, 0x79, 0x70, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x09, 0x74, 0x79, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x24, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x2e, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x0c, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x48, 0x00, 0x52, 0x05, 0x65, 0x72, - 0x72, 0x6f, 0x72, 0x12, 0x42, 0x0a, 0x0d, 0x61, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x2e, 0x41, 0x62, 0x73, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x0c, 0x61, 0x62, 0x73, 0x74, 0x72, - 0x61, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x1a, 0x37, 0x0a, 0x08, 0x4c, 0x69, 0x73, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x09, 0x65, 0x6c, 0x65, 0x6d, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x54, 0x79, 0x70, 0x65, - 0x1a, 0x63, 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x29, 0x0a, 0x08, 0x6b, - 0x65, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07, 0x6b, - 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x1a, 0x6c, 0x0a, 0x0c, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2b, 0x0a, 0x09, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x61, 0x72, 0x67, 0x54, 0x79, - 0x70, 0x65, 0x73, 0x1a, 0x5b, 0x0a, 0x0c, 0x41, 0x62, 0x73, 0x74, 0x72, 0x61, 0x63, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x37, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x65, 0x74, 0x65, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0e, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x73, - 0x22, 0x73, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x6d, 0x69, 0x74, 0x69, 0x76, 0x65, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x50, 0x52, 0x49, 0x4d, 0x49, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x54, - 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, - 0x00, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4f, 0x4f, 0x4c, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x49, - 0x4e, 0x54, 0x36, 0x34, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x49, 0x4e, 0x54, 0x36, 0x34, - 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x4f, 0x55, 0x42, 0x4c, 0x45, 0x10, 0x04, 0x12, 0x0a, - 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x42, 0x59, - 0x54, 0x45, 0x53, 0x10, 0x06, 0x22, 0x56, 0x0a, 0x0d, 0x57, 0x65, 0x6c, 0x6c, 0x4b, 0x6e, 0x6f, - 0x77, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x57, 0x45, 0x4c, 0x4c, 0x5f, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, - 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x01, - 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x49, 0x4d, 0x45, 0x53, 0x54, 0x41, 0x4d, 0x50, 0x10, 0x02, 0x12, - 0x0c, 0x0a, 0x08, 0x44, 0x55, 0x52, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x03, 0x42, 0x0b, 0x0a, - 0x09, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xc2, 0x04, 0x0a, 0x04, 0x44, - 0x65, 0x63, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, 0x6c, - 0x48, 0x00, 0x52, 0x05, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x08, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x2e, 0x46, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, 0x63, 0x6c, 0x48, 0x00, 0x52, 0x08, 0x66, 0x75, 0x6e, 0x63, - 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x6b, 0x0a, 0x09, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x63, - 0x6c, 0x12, 0x22, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, - 0x10, 0x0a, 0x03, 0x64, 0x6f, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, 0x6f, - 0x63, 0x1a, 0xbe, 0x02, 0x0a, 0x0c, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x63, 0x6c, 0x12, 0x42, 0x0a, 0x09, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x2e, 0x44, 0x65, 0x63, 0x6c, 0x2e, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x65, - 0x63, 0x6c, 0x2e, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x52, 0x09, 0x6f, 0x76, 0x65, - 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x73, 0x1a, 0xe9, 0x01, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x6c, - 0x6f, 0x61, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, - 0x61, 0x64, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1f, 0x0a, 0x0b, - 0x74, 0x79, 0x70, 0x65, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2f, 0x0a, - 0x0b, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x54, 0x79, - 0x70, 0x65, 0x52, 0x0a, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x30, - 0x0a, 0x14, 0x69, 0x73, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x66, 0x75, - 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x73, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x46, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, - 0x12, 0x10, 0x0a, 0x03, 0x64, 0x6f, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x64, - 0x6f, 0x63, 0x42, 0x0b, 0x0a, 0x09, 0x64, 0x65, 0x63, 0x6c, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, - 0x6a, 0x0a, 0x09, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x6f, 0x61, 0x64, 0x49, - 0x64, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x2c, 0x0a, 0x0c, 0x64, - 0x65, 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x09, 0x44, 0x65, 0x63, - 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, 0x65, - 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} +const file_cel_expr_checked_proto_rawDesc = "" + + "\n" + + "\x16cel/expr/checked.proto\x12\bcel.expr\x1a\x15cel/expr/syntax.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1cgoogle/protobuf/struct.proto\"\xba\x03\n" + + "\vCheckedExpr\x12L\n" + + "\rreference_map\x18\x02 \x03(\v2'.cel.expr.CheckedExpr.ReferenceMapEntryR\freferenceMap\x12=\n" + + "\btype_map\x18\x03 \x03(\v2\".cel.expr.CheckedExpr.TypeMapEntryR\atypeMap\x125\n" + + "\vsource_info\x18\x05 \x01(\v2\x14.cel.expr.SourceInfoR\n" + + "sourceInfo\x12!\n" + + "\fexpr_version\x18\x06 \x01(\tR\vexprVersion\x12\"\n" + + "\x04expr\x18\x04 \x01(\v2\x0e.cel.expr.ExprR\x04expr\x1aT\n" + + "\x11ReferenceMapEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x03R\x03key\x12)\n" + + "\x05value\x18\x02 \x01(\v2\x13.cel.expr.ReferenceR\x05value:\x028\x01\x1aJ\n" + + "\fTypeMapEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x03R\x03key\x12$\n" + + "\x05value\x18\x02 \x01(\v2\x0e.cel.expr.TypeR\x05value:\x028\x01\"\xe6\t\n" + + "\x04Type\x12*\n" + + "\x03dyn\x18\x01 \x01(\v2\x16.google.protobuf.EmptyH\x00R\x03dyn\x120\n" + + "\x04null\x18\x02 \x01(\x0e2\x1a.google.protobuf.NullValueH\x00R\x04null\x12<\n" + + "\tprimitive\x18\x03 \x01(\x0e2\x1c.cel.expr.Type.PrimitiveTypeH\x00R\tprimitive\x128\n" + + "\awrapper\x18\x04 \x01(\x0e2\x1c.cel.expr.Type.PrimitiveTypeH\x00R\awrapper\x12=\n" + + "\n" + + "well_known\x18\x05 \x01(\x0e2\x1c.cel.expr.Type.WellKnownTypeH\x00R\twellKnown\x126\n" + + "\tlist_type\x18\x06 \x01(\v2\x17.cel.expr.Type.ListTypeH\x00R\blistType\x123\n" + + "\bmap_type\x18\a \x01(\v2\x16.cel.expr.Type.MapTypeH\x00R\amapType\x129\n" + + "\bfunction\x18\b \x01(\v2\x1b.cel.expr.Type.FunctionTypeH\x00R\bfunction\x12#\n" + + "\fmessage_type\x18\t \x01(\tH\x00R\vmessageType\x12\x1f\n" + + "\n" + + "type_param\x18\n" + + " \x01(\tH\x00R\ttypeParam\x12$\n" + + "\x04type\x18\v \x01(\v2\x0e.cel.expr.TypeH\x00R\x04type\x12.\n" + + "\x05error\x18\f \x01(\v2\x16.google.protobuf.EmptyH\x00R\x05error\x12B\n" + + "\rabstract_type\x18\x0e \x01(\v2\x1b.cel.expr.Type.AbstractTypeH\x00R\fabstractType\x1a7\n" + + "\bListType\x12+\n" + + "\telem_type\x18\x01 \x01(\v2\x0e.cel.expr.TypeR\belemType\x1ac\n" + + "\aMapType\x12)\n" + + "\bkey_type\x18\x01 \x01(\v2\x0e.cel.expr.TypeR\akeyType\x12-\n" + + "\n" + + "value_type\x18\x02 \x01(\v2\x0e.cel.expr.TypeR\tvalueType\x1al\n" + + "\fFunctionType\x12/\n" + + "\vresult_type\x18\x01 \x01(\v2\x0e.cel.expr.TypeR\n" + + "resultType\x12+\n" + + "\targ_types\x18\x02 \x03(\v2\x0e.cel.expr.TypeR\bargTypes\x1a[\n" + + "\fAbstractType\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x127\n" + + "\x0fparameter_types\x18\x02 \x03(\v2\x0e.cel.expr.TypeR\x0eparameterTypes\"s\n" + + "\rPrimitiveType\x12\x1e\n" + + "\x1aPRIMITIVE_TYPE_UNSPECIFIED\x10\x00\x12\b\n" + + "\x04BOOL\x10\x01\x12\t\n" + + "\x05INT64\x10\x02\x12\n" + + "\n" + + "\x06UINT64\x10\x03\x12\n" + + "\n" + + "\x06DOUBLE\x10\x04\x12\n" + + "\n" + + "\x06STRING\x10\x05\x12\t\n" + + "\x05BYTES\x10\x06\"V\n" + + "\rWellKnownType\x12\x1f\n" + + "\x1bWELL_KNOWN_TYPE_UNSPECIFIED\x10\x00\x12\a\n" + + "\x03ANY\x10\x01\x12\r\n" + + "\tTIMESTAMP\x10\x02\x12\f\n" + + "\bDURATION\x10\x03B\v\n" + + "\ttype_kind\"\xd4\x04\n" + + "\x04Decl\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x120\n" + + "\x05ident\x18\x02 \x01(\v2\x18.cel.expr.Decl.IdentDeclH\x00R\x05ident\x129\n" + + "\bfunction\x18\x03 \x01(\v2\x1b.cel.expr.Decl.FunctionDeclH\x00R\bfunction\x1ak\n" + + "\tIdentDecl\x12\"\n" + + "\x04type\x18\x01 \x01(\v2\x0e.cel.expr.TypeR\x04type\x12(\n" + + "\x05value\x18\x02 \x01(\v2\x12.cel.expr.ConstantR\x05value\x12\x10\n" + + "\x03doc\x18\x03 \x01(\tR\x03doc\x1a\xd0\x02\n" + + "\fFunctionDecl\x12B\n" + + "\toverloads\x18\x01 \x03(\v2$.cel.expr.Decl.FunctionDecl.OverloadR\toverloads\x12\x10\n" + + "\x03doc\x18\x02 \x01(\tR\x03doc\x1a\xe9\x01\n" + + "\bOverload\x12\x1f\n" + + "\voverload_id\x18\x01 \x01(\tR\n" + + "overloadId\x12&\n" + + "\x06params\x18\x02 \x03(\v2\x0e.cel.expr.TypeR\x06params\x12\x1f\n" + + "\vtype_params\x18\x03 \x03(\tR\n" + + "typeParams\x12/\n" + + "\vresult_type\x18\x04 \x01(\v2\x0e.cel.expr.TypeR\n" + + "resultType\x120\n" + + "\x14is_instance_function\x18\x05 \x01(\bR\x12isInstanceFunction\x12\x10\n" + + "\x03doc\x18\x06 \x01(\tR\x03docB\v\n" + + "\tdecl_kind\"j\n" + + "\tReference\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1f\n" + + "\voverload_id\x18\x03 \x03(\tR\n" + + "overloadId\x12(\n" + + "\x05value\x18\x04 \x01(\v2\x12.cel.expr.ConstantR\x05valueB,\n" + + "\fdev.cel.exprB\tDeclProtoP\x01Z\fcel.dev/expr\xf8\x01\x01b\x06proto3" var ( file_cel_expr_checked_proto_rawDescOnce sync.Once - file_cel_expr_checked_proto_rawDescData = file_cel_expr_checked_proto_rawDesc + file_cel_expr_checked_proto_rawDescData []byte ) func file_cel_expr_checked_proto_rawDescGZIP() []byte { file_cel_expr_checked_proto_rawDescOnce.Do(func() { - file_cel_expr_checked_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_checked_proto_rawDescData) + file_cel_expr_checked_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cel_expr_checked_proto_rawDesc), len(file_cel_expr_checked_proto_rawDesc))) }) return file_cel_expr_checked_proto_rawDescData } var file_cel_expr_checked_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_cel_expr_checked_proto_msgTypes = make([]protoimpl.MessageInfo, 13) -var file_cel_expr_checked_proto_goTypes = []interface{}{ +var file_cel_expr_checked_proto_goTypes = []any{ (Type_PrimitiveType)(0), // 0: cel.expr.Type.PrimitiveType (Type_WellKnownType)(0), // 1: cel.expr.Type.WellKnownType (*CheckedExpr)(nil), // 2: cel.expr.CheckedExpr @@ -1257,141 +1191,7 @@ func file_cel_expr_checked_proto_init() { return } file_cel_expr_syntax_proto_init() - if !protoimpl.UnsafeEnabled { - file_cel_expr_checked_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CheckedExpr); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Reference); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_ListType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_MapType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_FunctionType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Type_AbstractType); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl_IdentDecl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl_FunctionDecl); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_checked_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Decl_FunctionDecl_Overload); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cel_expr_checked_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_cel_expr_checked_proto_msgTypes[1].OneofWrappers = []any{ (*Type_Dyn)(nil), (*Type_Null)(nil), (*Type_Primitive)(nil), @@ -1406,7 +1206,7 @@ func file_cel_expr_checked_proto_init() { (*Type_Error)(nil), (*Type_AbstractType_)(nil), } - file_cel_expr_checked_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_cel_expr_checked_proto_msgTypes[2].OneofWrappers = []any{ (*Decl_Ident)(nil), (*Decl_Function)(nil), } @@ -1414,7 +1214,7 @@ func file_cel_expr_checked_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_checked_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cel_expr_checked_proto_rawDesc), len(file_cel_expr_checked_proto_rawDesc)), NumEnums: 2, NumMessages: 13, NumExtensions: 0, @@ -1426,7 +1226,6 @@ func file_cel_expr_checked_proto_init() { MessageInfos: file_cel_expr_checked_proto_msgTypes, }.Build() File_cel_expr_checked_proto = out.File - file_cel_expr_checked_proto_rawDesc = nil file_cel_expr_checked_proto_goTypes = nil file_cel_expr_checked_proto_depIdxs = nil } diff --git a/vendor/cel.dev/expr/eval.pb.go b/vendor/cel.dev/expr/eval.pb.go index a7aae0900c..83acb8935b 100644 --- a/vendor/cel.dev/expr/eval.pb.go +++ b/vendor/cel.dev/expr/eval.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.3 +// protoc-gen-go v1.36.10 // protoc v5.27.1 // source: cel/expr/eval.proto @@ -12,6 +12,7 @@ import ( anypb "google.golang.org/protobuf/types/known/anypb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -373,58 +374,39 @@ func (x *EvalState_Result) GetValue() int64 { var File_cel_expr_eval_proto protoreflect.FileDescriptor -var file_cel_expr_eval_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x65, 0x76, 0x61, 0x6c, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x1a, - 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x63, 0x65, 0x6c, 0x2f, - 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0xa2, 0x01, 0x0a, 0x09, 0x45, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2b, - 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x34, 0x0a, 0x07, 0x72, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, - 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x76, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x73, 0x1a, 0x32, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x65, - 0x78, 0x70, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x65, 0x78, 0x70, 0x72, 0x12, - 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x9a, 0x01, 0x0a, 0x09, 0x45, 0x78, 0x70, 0x72, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x05, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x48, - 0x00, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x30, 0x0a, 0x07, 0x75, 0x6e, 0x6b, 0x6e, - 0x6f, 0x77, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x65, 0x74, 0x48, - 0x00, 0x52, 0x07, 0x75, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, - 0x6e, 0x64, 0x22, 0x34, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x53, 0x65, 0x74, 0x12, 0x28, - 0x0a, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x06, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x22, 0x66, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, - 0x22, 0x22, 0x0a, 0x0a, 0x55, 0x6e, 0x6b, 0x6e, 0x6f, 0x77, 0x6e, 0x53, 0x65, 0x74, 0x12, 0x14, - 0x0a, 0x05, 0x65, 0x78, 0x70, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x03, 0x52, 0x05, 0x65, - 0x78, 0x70, 0x72, 0x73, 0x42, 0x2c, 0x0a, 0x0c, 0x64, 0x65, 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x42, 0x09, 0x45, 0x76, 0x61, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, - 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} +const file_cel_expr_eval_proto_rawDesc = "" + + "\n" + + "\x13cel/expr/eval.proto\x12\bcel.expr\x1a\x19google/protobuf/any.proto\x1a\x14cel/expr/value.proto\"\xa2\x01\n" + + "\tEvalState\x12+\n" + + "\x06values\x18\x01 \x03(\v2\x13.cel.expr.ExprValueR\x06values\x124\n" + + "\aresults\x18\x03 \x03(\v2\x1a.cel.expr.EvalState.ResultR\aresults\x1a2\n" + + "\x06Result\x12\x12\n" + + "\x04expr\x18\x01 \x01(\x03R\x04expr\x12\x14\n" + + "\x05value\x18\x02 \x01(\x03R\x05value\"\x9a\x01\n" + + "\tExprValue\x12'\n" + + "\x05value\x18\x01 \x01(\v2\x0f.cel.expr.ValueH\x00R\x05value\x12*\n" + + "\x05error\x18\x02 \x01(\v2\x12.cel.expr.ErrorSetH\x00R\x05error\x120\n" + + "\aunknown\x18\x03 \x01(\v2\x14.cel.expr.UnknownSetH\x00R\aunknownB\x06\n" + + "\x04kind\"4\n" + + "\bErrorSet\x12(\n" + + "\x06errors\x18\x01 \x03(\v2\x10.cel.expr.StatusR\x06errors\"f\n" + + "\x06Status\x12\x12\n" + + "\x04code\x18\x01 \x01(\x05R\x04code\x12\x18\n" + + "\amessage\x18\x02 \x01(\tR\amessage\x12.\n" + + "\adetails\x18\x03 \x03(\v2\x14.google.protobuf.AnyR\adetails\"\"\n" + + "\n" + + "UnknownSet\x12\x14\n" + + "\x05exprs\x18\x01 \x03(\x03R\x05exprsB,\n" + + "\fdev.cel.exprB\tEvalProtoP\x01Z\fcel.dev/expr\xf8\x01\x01b\x06proto3" var ( file_cel_expr_eval_proto_rawDescOnce sync.Once - file_cel_expr_eval_proto_rawDescData = file_cel_expr_eval_proto_rawDesc + file_cel_expr_eval_proto_rawDescData []byte ) func file_cel_expr_eval_proto_rawDescGZIP() []byte { file_cel_expr_eval_proto_rawDescOnce.Do(func() { - file_cel_expr_eval_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_eval_proto_rawDescData) + file_cel_expr_eval_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cel_expr_eval_proto_rawDesc), len(file_cel_expr_eval_proto_rawDesc))) }) return file_cel_expr_eval_proto_rawDescData } @@ -470,7 +452,7 @@ func file_cel_expr_eval_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_eval_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cel_expr_eval_proto_rawDesc), len(file_cel_expr_eval_proto_rawDesc)), NumEnums: 0, NumMessages: 6, NumExtensions: 0, @@ -481,7 +463,6 @@ func file_cel_expr_eval_proto_init() { MessageInfos: file_cel_expr_eval_proto_msgTypes, }.Build() File_cel_expr_eval_proto = out.File - file_cel_expr_eval_proto_rawDesc = nil file_cel_expr_eval_proto_goTypes = nil file_cel_expr_eval_proto_depIdxs = nil } diff --git a/vendor/cel.dev/expr/explain.pb.go b/vendor/cel.dev/expr/explain.pb.go index 79fd5443b9..4239933978 100644 --- a/vendor/cel.dev/expr/explain.pb.go +++ b/vendor/cel.dev/expr/explain.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.36.10 +// protoc v5.27.1 // source: cel/expr/explain.proto package expr @@ -11,6 +11,7 @@ import ( protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -20,23 +21,20 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in cel/expr/explain.proto. type Explain struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + ExprSteps []*Explain_ExprStep `protobuf:"bytes,2,rep,name=expr_steps,json=exprSteps,proto3" json:"expr_steps,omitempty"` unknownFields protoimpl.UnknownFields - - Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` - ExprSteps []*Explain_ExprStep `protobuf:"bytes,2,rep,name=expr_steps,json=exprSteps,proto3" json:"expr_steps,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Explain) Reset() { *x = Explain{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_explain_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_explain_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Explain) String() string { @@ -47,7 +45,7 @@ func (*Explain) ProtoMessage() {} func (x *Explain) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_explain_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -77,21 +75,18 @@ func (x *Explain) GetExprSteps() []*Explain_ExprStep { } type Explain_ExprStep struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + ValueIndex int32 `protobuf:"varint,2,opt,name=value_index,json=valueIndex,proto3" json:"value_index,omitempty"` unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - ValueIndex int32 `protobuf:"varint,2,opt,name=value_index,json=valueIndex,proto3" json:"value_index,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Explain_ExprStep) Reset() { *x = Explain_ExprStep{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_explain_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_explain_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Explain_ExprStep) String() string { @@ -102,7 +97,7 @@ func (*Explain_ExprStep) ProtoMessage() {} func (x *Explain_ExprStep) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_explain_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -133,42 +128,33 @@ func (x *Explain_ExprStep) GetValueIndex() int32 { var File_cel_expr_explain_proto protoreflect.FileDescriptor -var file_cel_expr_explain_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x65, 0x78, 0x70, 0x6c, 0x61, - 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x1a, 0x14, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xae, 0x01, 0x0a, 0x07, 0x45, 0x78, 0x70, - 0x6c, 0x61, 0x69, 0x6e, 0x12, 0x27, 0x0a, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x12, 0x39, 0x0a, - 0x0a, 0x65, 0x78, 0x70, 0x72, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, - 0x6c, 0x61, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x53, 0x74, 0x65, 0x70, 0x52, 0x09, 0x65, - 0x78, 0x70, 0x72, 0x53, 0x74, 0x65, 0x70, 0x73, 0x1a, 0x3b, 0x0a, 0x08, 0x45, 0x78, 0x70, 0x72, - 0x53, 0x74, 0x65, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x02, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x69, 0x6e, - 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x3a, 0x02, 0x18, 0x01, 0x42, 0x2f, 0x0a, 0x0c, 0x64, 0x65, 0x76, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x0c, 0x45, 0x78, 0x70, 0x6c, 0x61, - 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, - 0x65, 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} +const file_cel_expr_explain_proto_rawDesc = "" + + "\n" + + "\x16cel/expr/explain.proto\x12\bcel.expr\x1a\x14cel/expr/value.proto\"\xae\x01\n" + + "\aExplain\x12'\n" + + "\x06values\x18\x01 \x03(\v2\x0f.cel.expr.ValueR\x06values\x129\n" + + "\n" + + "expr_steps\x18\x02 \x03(\v2\x1a.cel.expr.Explain.ExprStepR\texprSteps\x1a;\n" + + "\bExprStep\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1f\n" + + "\vvalue_index\x18\x02 \x01(\x05R\n" + + "valueIndex:\x02\x18\x01B/\n" + + "\fdev.cel.exprB\fExplainProtoP\x01Z\fcel.dev/expr\xf8\x01\x01b\x06proto3" var ( file_cel_expr_explain_proto_rawDescOnce sync.Once - file_cel_expr_explain_proto_rawDescData = file_cel_expr_explain_proto_rawDesc + file_cel_expr_explain_proto_rawDescData []byte ) func file_cel_expr_explain_proto_rawDescGZIP() []byte { file_cel_expr_explain_proto_rawDescOnce.Do(func() { - file_cel_expr_explain_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_explain_proto_rawDescData) + file_cel_expr_explain_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cel_expr_explain_proto_rawDesc), len(file_cel_expr_explain_proto_rawDesc))) }) return file_cel_expr_explain_proto_rawDescData } var file_cel_expr_explain_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_cel_expr_explain_proto_goTypes = []interface{}{ +var file_cel_expr_explain_proto_goTypes = []any{ (*Explain)(nil), // 0: cel.expr.Explain (*Explain_ExprStep)(nil), // 1: cel.expr.Explain.ExprStep (*Value)(nil), // 2: cel.expr.Value @@ -189,37 +175,11 @@ func file_cel_expr_explain_proto_init() { return } file_cel_expr_value_proto_init() - if !protoimpl.UnsafeEnabled { - file_cel_expr_explain_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Explain); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_explain_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Explain_ExprStep); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_explain_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cel_expr_explain_proto_rawDesc), len(file_cel_expr_explain_proto_rawDesc)), NumEnums: 0, NumMessages: 2, NumExtensions: 0, @@ -230,7 +190,6 @@ func file_cel_expr_explain_proto_init() { MessageInfos: file_cel_expr_explain_proto_msgTypes, }.Build() File_cel_expr_explain_proto = out.File - file_cel_expr_explain_proto_rawDesc = nil file_cel_expr_explain_proto_goTypes = nil file_cel_expr_explain_proto_depIdxs = nil } diff --git a/vendor/cel.dev/expr/syntax.pb.go b/vendor/cel.dev/expr/syntax.pb.go index 48a952872e..72d19b20d4 100644 --- a/vendor/cel.dev/expr/syntax.pb.go +++ b/vendor/cel.dev/expr/syntax.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.36.10 +// protoc v5.27.1 // source: cel/expr/syntax.proto package expr @@ -14,6 +14,7 @@ import ( timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -76,21 +77,18 @@ func (SourceInfo_Extension_Component) EnumDescriptor() ([]byte, []int) { } type ParsedExpr struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Expr *Expr `protobuf:"bytes,2,opt,name=expr,proto3" json:"expr,omitempty"` + SourceInfo *SourceInfo `protobuf:"bytes,3,opt,name=source_info,json=sourceInfo,proto3" json:"source_info,omitempty"` unknownFields protoimpl.UnknownFields - - Expr *Expr `protobuf:"bytes,2,opt,name=expr,proto3" json:"expr,omitempty"` - SourceInfo *SourceInfo `protobuf:"bytes,3,opt,name=source_info,json=sourceInfo,proto3" json:"source_info,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ParsedExpr) Reset() { *x = ParsedExpr{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ParsedExpr) String() string { @@ -101,7 +99,7 @@ func (*ParsedExpr) ProtoMessage() {} func (x *ParsedExpr) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -131,12 +129,9 @@ func (x *ParsedExpr) GetSourceInfo() *SourceInfo { } type Expr struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` - // Types that are assignable to ExprKind: + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + // Types that are valid to be assigned to ExprKind: // // *Expr_ConstExpr // *Expr_IdentExpr @@ -145,16 +140,16 @@ type Expr struct { // *Expr_ListExpr // *Expr_StructExpr // *Expr_ComprehensionExpr - ExprKind isExpr_ExprKind `protobuf_oneof:"expr_kind"` + ExprKind isExpr_ExprKind `protobuf_oneof:"expr_kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Expr) Reset() { *x = Expr{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr) String() string { @@ -165,7 +160,7 @@ func (*Expr) ProtoMessage() {} func (x *Expr) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -187,58 +182,72 @@ func (x *Expr) GetId() int64 { return 0 } -func (m *Expr) GetExprKind() isExpr_ExprKind { - if m != nil { - return m.ExprKind +func (x *Expr) GetExprKind() isExpr_ExprKind { + if x != nil { + return x.ExprKind } return nil } func (x *Expr) GetConstExpr() *Constant { - if x, ok := x.GetExprKind().(*Expr_ConstExpr); ok { - return x.ConstExpr + if x != nil { + if x, ok := x.ExprKind.(*Expr_ConstExpr); ok { + return x.ConstExpr + } } return nil } func (x *Expr) GetIdentExpr() *Expr_Ident { - if x, ok := x.GetExprKind().(*Expr_IdentExpr); ok { - return x.IdentExpr + if x != nil { + if x, ok := x.ExprKind.(*Expr_IdentExpr); ok { + return x.IdentExpr + } } return nil } func (x *Expr) GetSelectExpr() *Expr_Select { - if x, ok := x.GetExprKind().(*Expr_SelectExpr); ok { - return x.SelectExpr + if x != nil { + if x, ok := x.ExprKind.(*Expr_SelectExpr); ok { + return x.SelectExpr + } } return nil } func (x *Expr) GetCallExpr() *Expr_Call { - if x, ok := x.GetExprKind().(*Expr_CallExpr); ok { - return x.CallExpr + if x != nil { + if x, ok := x.ExprKind.(*Expr_CallExpr); ok { + return x.CallExpr + } } return nil } func (x *Expr) GetListExpr() *Expr_CreateList { - if x, ok := x.GetExprKind().(*Expr_ListExpr); ok { - return x.ListExpr + if x != nil { + if x, ok := x.ExprKind.(*Expr_ListExpr); ok { + return x.ListExpr + } } return nil } func (x *Expr) GetStructExpr() *Expr_CreateStruct { - if x, ok := x.GetExprKind().(*Expr_StructExpr); ok { - return x.StructExpr + if x != nil { + if x, ok := x.ExprKind.(*Expr_StructExpr); ok { + return x.StructExpr + } } return nil } func (x *Expr) GetComprehensionExpr() *Expr_Comprehension { - if x, ok := x.GetExprKind().(*Expr_ComprehensionExpr); ok { - return x.ComprehensionExpr + if x != nil { + if x, ok := x.ExprKind.(*Expr_ComprehensionExpr); ok { + return x.ComprehensionExpr + } } return nil } @@ -290,11 +299,8 @@ func (*Expr_StructExpr) isExpr_ExprKind() {} func (*Expr_ComprehensionExpr) isExpr_ExprKind() {} type Constant struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to ConstantKind: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to ConstantKind: // // *Constant_NullValue // *Constant_BoolValue @@ -305,16 +311,16 @@ type Constant struct { // *Constant_BytesValue // *Constant_DurationValue // *Constant_TimestampValue - ConstantKind isConstant_ConstantKind `protobuf_oneof:"constant_kind"` + ConstantKind isConstant_ConstantKind `protobuf_oneof:"constant_kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Constant) Reset() { *x = Constant{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Constant) String() string { @@ -325,7 +331,7 @@ func (*Constant) ProtoMessage() {} func (x *Constant) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -340,74 +346,92 @@ func (*Constant) Descriptor() ([]byte, []int) { return file_cel_expr_syntax_proto_rawDescGZIP(), []int{2} } -func (m *Constant) GetConstantKind() isConstant_ConstantKind { - if m != nil { - return m.ConstantKind +func (x *Constant) GetConstantKind() isConstant_ConstantKind { + if x != nil { + return x.ConstantKind } return nil } func (x *Constant) GetNullValue() structpb.NullValue { - if x, ok := x.GetConstantKind().(*Constant_NullValue); ok { - return x.NullValue + if x != nil { + if x, ok := x.ConstantKind.(*Constant_NullValue); ok { + return x.NullValue + } } return structpb.NullValue(0) } func (x *Constant) GetBoolValue() bool { - if x, ok := x.GetConstantKind().(*Constant_BoolValue); ok { - return x.BoolValue + if x != nil { + if x, ok := x.ConstantKind.(*Constant_BoolValue); ok { + return x.BoolValue + } } return false } func (x *Constant) GetInt64Value() int64 { - if x, ok := x.GetConstantKind().(*Constant_Int64Value); ok { - return x.Int64Value + if x != nil { + if x, ok := x.ConstantKind.(*Constant_Int64Value); ok { + return x.Int64Value + } } return 0 } func (x *Constant) GetUint64Value() uint64 { - if x, ok := x.GetConstantKind().(*Constant_Uint64Value); ok { - return x.Uint64Value + if x != nil { + if x, ok := x.ConstantKind.(*Constant_Uint64Value); ok { + return x.Uint64Value + } } return 0 } func (x *Constant) GetDoubleValue() float64 { - if x, ok := x.GetConstantKind().(*Constant_DoubleValue); ok { - return x.DoubleValue + if x != nil { + if x, ok := x.ConstantKind.(*Constant_DoubleValue); ok { + return x.DoubleValue + } } return 0 } func (x *Constant) GetStringValue() string { - if x, ok := x.GetConstantKind().(*Constant_StringValue); ok { - return x.StringValue + if x != nil { + if x, ok := x.ConstantKind.(*Constant_StringValue); ok { + return x.StringValue + } } return "" } func (x *Constant) GetBytesValue() []byte { - if x, ok := x.GetConstantKind().(*Constant_BytesValue); ok { - return x.BytesValue + if x != nil { + if x, ok := x.ConstantKind.(*Constant_BytesValue); ok { + return x.BytesValue + } } return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in cel/expr/syntax.proto. func (x *Constant) GetDurationValue() *durationpb.Duration { - if x, ok := x.GetConstantKind().(*Constant_DurationValue); ok { - return x.DurationValue + if x != nil { + if x, ok := x.ConstantKind.(*Constant_DurationValue); ok { + return x.DurationValue + } } return nil } -// Deprecated: Do not use. +// Deprecated: Marked as deprecated in cel/expr/syntax.proto. func (x *Constant) GetTimestampValue() *timestamppb.Timestamp { - if x, ok := x.GetConstantKind().(*Constant_TimestampValue); ok { - return x.TimestampValue + if x != nil { + if x, ok := x.ConstantKind.(*Constant_TimestampValue); ok { + return x.TimestampValue + } } return nil } @@ -445,12 +469,12 @@ type Constant_BytesValue struct { } type Constant_DurationValue struct { - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in cel/expr/syntax.proto. DurationValue *durationpb.Duration `protobuf:"bytes,8,opt,name=duration_value,json=durationValue,proto3,oneof"` } type Constant_TimestampValue struct { - // Deprecated: Do not use. + // Deprecated: Marked as deprecated in cel/expr/syntax.proto. TimestampValue *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=timestamp_value,json=timestampValue,proto3,oneof"` } @@ -473,25 +497,22 @@ func (*Constant_DurationValue) isConstant_ConstantKind() {} func (*Constant_TimestampValue) isConstant_ConstantKind() {} type SourceInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` SyntaxVersion string `protobuf:"bytes,1,opt,name=syntax_version,json=syntaxVersion,proto3" json:"syntax_version,omitempty"` Location string `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"` LineOffsets []int32 `protobuf:"varint,3,rep,packed,name=line_offsets,json=lineOffsets,proto3" json:"line_offsets,omitempty"` - Positions map[int64]int32 `protobuf:"bytes,4,rep,name=positions,proto3" json:"positions,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - MacroCalls map[int64]*Expr `protobuf:"bytes,5,rep,name=macro_calls,json=macroCalls,proto3" json:"macro_calls,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Positions map[int64]int32 `protobuf:"bytes,4,rep,name=positions,proto3" json:"positions,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"varint,2,opt,name=value"` + MacroCalls map[int64]*Expr `protobuf:"bytes,5,rep,name=macro_calls,json=macroCalls,proto3" json:"macro_calls,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` Extensions []*SourceInfo_Extension `protobuf:"bytes,6,rep,name=extensions,proto3" json:"extensions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SourceInfo) Reset() { *x = SourceInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SourceInfo) String() string { @@ -502,7 +523,7 @@ func (*SourceInfo) ProtoMessage() {} func (x *SourceInfo) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -560,20 +581,17 @@ func (x *SourceInfo) GetExtensions() []*SourceInfo_Extension { } type Expr_Ident struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Expr_Ident) Reset() { *x = Expr_Ident{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr_Ident) String() string { @@ -584,7 +602,7 @@ func (*Expr_Ident) ProtoMessage() {} func (x *Expr_Ident) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -607,22 +625,19 @@ func (x *Expr_Ident) GetName() string { } type Expr_Select struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Operand *Expr `protobuf:"bytes,1,opt,name=operand,proto3" json:"operand,omitempty"` + Field string `protobuf:"bytes,2,opt,name=field,proto3" json:"field,omitempty"` + TestOnly bool `protobuf:"varint,3,opt,name=test_only,json=testOnly,proto3" json:"test_only,omitempty"` unknownFields protoimpl.UnknownFields - - Operand *Expr `protobuf:"bytes,1,opt,name=operand,proto3" json:"operand,omitempty"` - Field string `protobuf:"bytes,2,opt,name=field,proto3" json:"field,omitempty"` - TestOnly bool `protobuf:"varint,3,opt,name=test_only,json=testOnly,proto3" json:"test_only,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Expr_Select) Reset() { *x = Expr_Select{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr_Select) String() string { @@ -633,7 +648,7 @@ func (*Expr_Select) ProtoMessage() {} func (x *Expr_Select) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -670,22 +685,19 @@ func (x *Expr_Select) GetTestOnly() bool { } type Expr_Call struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Target *Expr `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` + Function string `protobuf:"bytes,2,opt,name=function,proto3" json:"function,omitempty"` + Args []*Expr `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` unknownFields protoimpl.UnknownFields - - Target *Expr `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - Function string `protobuf:"bytes,2,opt,name=function,proto3" json:"function,omitempty"` - Args []*Expr `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Expr_Call) Reset() { *x = Expr_Call{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr_Call) String() string { @@ -696,7 +708,7 @@ func (*Expr_Call) ProtoMessage() {} func (x *Expr_Call) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -733,21 +745,18 @@ func (x *Expr_Call) GetArgs() []*Expr { } type Expr_CreateList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Elements []*Expr `protobuf:"bytes,1,rep,name=elements,proto3" json:"elements,omitempty"` - OptionalIndices []int32 `protobuf:"varint,2,rep,packed,name=optional_indices,json=optionalIndices,proto3" json:"optional_indices,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + Elements []*Expr `protobuf:"bytes,1,rep,name=elements,proto3" json:"elements,omitempty"` + OptionalIndices []int32 `protobuf:"varint,2,rep,packed,name=optional_indices,json=optionalIndices,proto3" json:"optional_indices,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Expr_CreateList) Reset() { *x = Expr_CreateList{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr_CreateList) String() string { @@ -758,7 +767,7 @@ func (*Expr_CreateList) ProtoMessage() {} func (x *Expr_CreateList) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -788,21 +797,18 @@ func (x *Expr_CreateList) GetOptionalIndices() []int32 { } type Expr_CreateStruct struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + MessageName string `protobuf:"bytes,1,opt,name=message_name,json=messageName,proto3" json:"message_name,omitempty"` + Entries []*Expr_CreateStruct_Entry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"` unknownFields protoimpl.UnknownFields - - MessageName string `protobuf:"bytes,1,opt,name=message_name,json=messageName,proto3" json:"message_name,omitempty"` - Entries []*Expr_CreateStruct_Entry `protobuf:"bytes,2,rep,name=entries,proto3" json:"entries,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Expr_CreateStruct) Reset() { *x = Expr_CreateStruct{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[8] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr_CreateStruct) String() string { @@ -813,7 +819,7 @@ func (*Expr_CreateStruct) ProtoMessage() {} func (x *Expr_CreateStruct) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[8] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -843,26 +849,24 @@ func (x *Expr_CreateStruct) GetEntries() []*Expr_CreateStruct_Entry { } type Expr_Comprehension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + IterVar string `protobuf:"bytes,1,opt,name=iter_var,json=iterVar,proto3" json:"iter_var,omitempty"` + IterVar2 string `protobuf:"bytes,8,opt,name=iter_var2,json=iterVar2,proto3" json:"iter_var2,omitempty"` + IterRange *Expr `protobuf:"bytes,2,opt,name=iter_range,json=iterRange,proto3" json:"iter_range,omitempty"` + AccuVar string `protobuf:"bytes,3,opt,name=accu_var,json=accuVar,proto3" json:"accu_var,omitempty"` + AccuInit *Expr `protobuf:"bytes,4,opt,name=accu_init,json=accuInit,proto3" json:"accu_init,omitempty"` + LoopCondition *Expr `protobuf:"bytes,5,opt,name=loop_condition,json=loopCondition,proto3" json:"loop_condition,omitempty"` + LoopStep *Expr `protobuf:"bytes,6,opt,name=loop_step,json=loopStep,proto3" json:"loop_step,omitempty"` + Result *Expr `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` unknownFields protoimpl.UnknownFields - - IterVar string `protobuf:"bytes,1,opt,name=iter_var,json=iterVar,proto3" json:"iter_var,omitempty"` - IterRange *Expr `protobuf:"bytes,2,opt,name=iter_range,json=iterRange,proto3" json:"iter_range,omitempty"` - AccuVar string `protobuf:"bytes,3,opt,name=accu_var,json=accuVar,proto3" json:"accu_var,omitempty"` - AccuInit *Expr `protobuf:"bytes,4,opt,name=accu_init,json=accuInit,proto3" json:"accu_init,omitempty"` - LoopCondition *Expr `protobuf:"bytes,5,opt,name=loop_condition,json=loopCondition,proto3" json:"loop_condition,omitempty"` - LoopStep *Expr `protobuf:"bytes,6,opt,name=loop_step,json=loopStep,proto3" json:"loop_step,omitempty"` - Result *Expr `protobuf:"bytes,7,opt,name=result,proto3" json:"result,omitempty"` + sizeCache protoimpl.SizeCache } func (x *Expr_Comprehension) Reset() { *x = Expr_Comprehension{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr_Comprehension) String() string { @@ -873,7 +877,7 @@ func (*Expr_Comprehension) ProtoMessage() {} func (x *Expr_Comprehension) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[9] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -895,6 +899,13 @@ func (x *Expr_Comprehension) GetIterVar() string { return "" } +func (x *Expr_Comprehension) GetIterVar2() string { + if x != nil { + return x.IterVar2 + } + return "" +} + func (x *Expr_Comprehension) GetIterRange() *Expr { if x != nil { return x.IterRange @@ -938,27 +949,24 @@ func (x *Expr_Comprehension) GetResult() *Expr { } type Expr_CreateStruct_Entry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // Types that are assignable to KeyKind: + state protoimpl.MessageState `protogen:"open.v1"` + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Types that are valid to be assigned to KeyKind: // // *Expr_CreateStruct_Entry_FieldKey // *Expr_CreateStruct_Entry_MapKey KeyKind isExpr_CreateStruct_Entry_KeyKind `protobuf_oneof:"key_kind"` Value *Expr `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` OptionalEntry bool `protobuf:"varint,5,opt,name=optional_entry,json=optionalEntry,proto3" json:"optional_entry,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Expr_CreateStruct_Entry) Reset() { *x = Expr_CreateStruct_Entry{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[10] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Expr_CreateStruct_Entry) String() string { @@ -969,7 +977,7 @@ func (*Expr_CreateStruct_Entry) ProtoMessage() {} func (x *Expr_CreateStruct_Entry) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[10] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -991,23 +999,27 @@ func (x *Expr_CreateStruct_Entry) GetId() int64 { return 0 } -func (m *Expr_CreateStruct_Entry) GetKeyKind() isExpr_CreateStruct_Entry_KeyKind { - if m != nil { - return m.KeyKind +func (x *Expr_CreateStruct_Entry) GetKeyKind() isExpr_CreateStruct_Entry_KeyKind { + if x != nil { + return x.KeyKind } return nil } func (x *Expr_CreateStruct_Entry) GetFieldKey() string { - if x, ok := x.GetKeyKind().(*Expr_CreateStruct_Entry_FieldKey); ok { - return x.FieldKey + if x != nil { + if x, ok := x.KeyKind.(*Expr_CreateStruct_Entry_FieldKey); ok { + return x.FieldKey + } } return "" } func (x *Expr_CreateStruct_Entry) GetMapKey() *Expr { - if x, ok := x.GetKeyKind().(*Expr_CreateStruct_Entry_MapKey); ok { - return x.MapKey + if x != nil { + if x, ok := x.KeyKind.(*Expr_CreateStruct_Entry_MapKey); ok { + return x.MapKey + } } return nil } @@ -1043,22 +1055,19 @@ func (*Expr_CreateStruct_Entry_FieldKey) isExpr_CreateStruct_Entry_KeyKind() {} func (*Expr_CreateStruct_Entry_MapKey) isExpr_CreateStruct_Entry_KeyKind() {} type SourceInfo_Extension struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + state protoimpl.MessageState `protogen:"open.v1"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` AffectedComponents []SourceInfo_Extension_Component `protobuf:"varint,2,rep,packed,name=affected_components,json=affectedComponents,proto3,enum=cel.expr.SourceInfo_Extension_Component" json:"affected_components,omitempty"` Version *SourceInfo_Extension_Version `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *SourceInfo_Extension) Reset() { *x = SourceInfo_Extension{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[13] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SourceInfo_Extension) String() string { @@ -1069,7 +1078,7 @@ func (*SourceInfo_Extension) ProtoMessage() {} func (x *SourceInfo_Extension) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[13] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1106,21 +1115,18 @@ func (x *SourceInfo_Extension) GetVersion() *SourceInfo_Extension_Version { } type SourceInfo_Extension_Version struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Major int64 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` + Minor int64 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` unknownFields protoimpl.UnknownFields - - Major int64 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"` - Minor int64 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"` + sizeCache protoimpl.SizeCache } func (x *SourceInfo_Extension_Version) Reset() { *x = SourceInfo_Extension_Version{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_syntax_proto_msgTypes[14] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_syntax_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *SourceInfo_Extension_Version) String() string { @@ -1131,7 +1137,7 @@ func (*SourceInfo_Extension_Version) ProtoMessage() {} func (x *SourceInfo_Extension_Version) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_syntax_proto_msgTypes[14] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -1162,210 +1168,124 @@ func (x *SourceInfo_Extension_Version) GetMinor() int64 { var File_cel_expr_syntax_proto protoreflect.FileDescriptor -var file_cel_expr_syntax_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x73, 0x79, 0x6e, 0x74, 0x61, - 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, - 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x67, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x73, 0x65, 0x64, 0x45, 0x78, 0x70, 0x72, 0x12, 0x22, - 0x0a, 0x04, 0x65, 0x78, 0x70, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, - 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x04, 0x65, 0x78, - 0x70, 0x72, 0x12, 0x35, 0x0a, 0x0b, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, - 0x70, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0xfd, 0x0a, 0x0a, 0x04, 0x45, 0x78, - 0x70, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x33, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x48, 0x00, 0x52, 0x09, 0x63, 0x6f, - 0x6e, 0x73, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x35, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x49, 0x64, 0x65, 0x6e, - 0x74, 0x48, 0x00, 0x52, 0x09, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x38, - 0x0a, 0x0b, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, - 0x78, 0x70, 0x72, 0x2e, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x73, 0x65, - 0x6c, 0x65, 0x63, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x32, 0x0a, 0x09, 0x63, 0x61, 0x6c, 0x6c, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x61, 0x6c, 0x6c, - 0x48, 0x00, 0x52, 0x08, 0x63, 0x61, 0x6c, 0x6c, 0x45, 0x78, 0x70, 0x72, 0x12, 0x38, 0x0a, 0x09, - 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x00, 0x52, 0x08, 0x6c, 0x69, - 0x73, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x3e, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x65, - 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x00, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x75, - 0x63, 0x74, 0x45, 0x78, 0x70, 0x72, 0x12, 0x4d, 0x0a, 0x12, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, - 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x72, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, - 0x70, 0x72, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x48, 0x00, 0x52, 0x11, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, - 0x6e, 0x45, 0x78, 0x70, 0x72, 0x1a, 0x1b, 0x0a, 0x05, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x1a, 0x65, 0x0a, 0x06, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x12, 0x28, 0x0a, 0x07, - 0x6f, 0x70, 0x65, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x07, 0x6f, - 0x70, 0x65, 0x72, 0x61, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1b, 0x0a, 0x09, - 0x74, 0x65, 0x73, 0x74, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x74, 0x65, 0x73, 0x74, 0x4f, 0x6e, 0x6c, 0x79, 0x1a, 0x6e, 0x0a, 0x04, 0x43, 0x61, 0x6c, - 0x6c, 0x12, 0x26, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, - 0x72, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x75, 0x6e, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, - 0x78, 0x70, 0x72, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x1a, 0x63, 0x0a, 0x0a, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2a, 0x0a, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x08, 0x65, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, - 0x69, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0f, 0x6f, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x64, 0x69, 0x63, 0x65, 0x73, 0x1a, 0xab, - 0x02, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, - 0x21, 0x0a, 0x0c, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x3b, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, - 0x78, 0x70, 0x72, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, - 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, - 0xba, 0x01, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x09, 0x66, 0x69, 0x65, - 0x6c, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, - 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x29, 0x0a, 0x07, 0x6d, 0x61, 0x70, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, - 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x48, 0x00, 0x52, 0x06, 0x6d, 0x61, 0x70, - 0x4b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, - 0x70, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x6f, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x0d, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x42, 0x0a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x1a, 0xad, 0x02, 0x0a, - 0x0d, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x68, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x19, - 0x0a, 0x08, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x76, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x69, 0x74, 0x65, 0x72, 0x56, 0x61, 0x72, 0x12, 0x2d, 0x0a, 0x0a, 0x69, 0x74, 0x65, - 0x72, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x69, - 0x74, 0x65, 0x72, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x75, - 0x5f, 0x76, 0x61, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x75, - 0x56, 0x61, 0x72, 0x12, 0x2b, 0x0a, 0x09, 0x61, 0x63, 0x63, 0x75, 0x5f, 0x69, 0x6e, 0x69, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, - 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x08, 0x61, 0x63, 0x63, 0x75, 0x49, 0x6e, 0x69, 0x74, - 0x12, 0x35, 0x0a, 0x0e, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, - 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x0d, 0x6c, 0x6f, 0x6f, 0x70, 0x43, 0x6f, - 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x09, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, - 0x73, 0x74, 0x65, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x08, 0x6c, 0x6f, 0x6f, 0x70, - 0x53, 0x74, 0x65, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x07, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x45, 0x78, 0x70, 0x72, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x42, 0x0b, 0x0a, 0x09, - 0x65, 0x78, 0x70, 0x72, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xc1, 0x03, 0x0a, 0x08, 0x43, 0x6f, - 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, - 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, - 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, - 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, - 0x0b, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, - 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x01, 0x48, 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, - 0x79, 0x74, 0x65, 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x46, 0x0a, 0x0e, 0x64, 0x75, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x02, 0x18, 0x01, - 0x48, 0x00, 0x52, 0x0d, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x49, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x02, 0x18, 0x01, 0x48, 0x00, 0x52, 0x0e, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0f, 0x0a, 0x0d, - 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x5f, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0xac, 0x06, - 0x0a, 0x0a, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x25, 0x0a, 0x0e, - 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x79, 0x6e, 0x74, 0x61, 0x78, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x21, 0x0a, 0x0c, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x73, 0x18, - 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x6c, 0x69, 0x6e, 0x65, 0x4f, 0x66, 0x66, 0x73, 0x65, - 0x74, 0x73, 0x12, 0x41, 0x0a, 0x09, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, - 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x50, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x70, 0x6f, 0x73, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x45, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x72, 0x6f, 0x5f, 0x63, - 0x61, 0x6c, 0x6c, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x2e, 0x4d, 0x61, 0x63, 0x72, 0x6f, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0a, 0x6d, 0x61, 0x63, 0x72, 0x6f, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x12, 0x3e, 0x0a, 0x0a, - 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3c, 0x0a, 0x0e, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x4d, 0x0a, 0x0f, 0x4d, 0x61, - 0x63, 0x72, 0x6f, 0x43, 0x61, 0x6c, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, - 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, - 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0xe0, 0x02, 0x0a, 0x09, 0x45, 0x78, - 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x59, 0x0a, 0x13, 0x61, 0x66, 0x66, 0x65, 0x63, - 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0e, 0x32, 0x28, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, - 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x52, 0x12, - 0x61, 0x66, 0x66, 0x65, 0x63, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, - 0x74, 0x73, 0x12, 0x40, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, - 0x69, 0x6f, 0x6e, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x35, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, - 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x6f, 0x0a, 0x09, 0x43, - 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x15, 0x43, 0x4f, 0x4d, 0x50, - 0x4f, 0x4e, 0x45, 0x4e, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x43, 0x4f, 0x4d, 0x50, 0x4f, 0x4e, 0x45, 0x4e, 0x54, - 0x5f, 0x50, 0x41, 0x52, 0x53, 0x45, 0x52, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x43, 0x4f, 0x4d, - 0x50, 0x4f, 0x4e, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x48, 0x45, 0x43, - 0x4b, 0x45, 0x52, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x43, 0x4f, 0x4d, 0x50, 0x4f, 0x4e, 0x45, - 0x4e, 0x54, 0x5f, 0x52, 0x55, 0x4e, 0x54, 0x49, 0x4d, 0x45, 0x10, 0x03, 0x42, 0x2e, 0x0a, 0x0c, - 0x64, 0x65, 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x0b, 0x53, 0x79, - 0x6e, 0x74, 0x61, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, - 0x2e, 0x64, 0x65, 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} +const file_cel_expr_syntax_proto_rawDesc = "" + + "\n" + + "\x15cel/expr/syntax.proto\x12\bcel.expr\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"g\n" + + "\n" + + "ParsedExpr\x12\"\n" + + "\x04expr\x18\x02 \x01(\v2\x0e.cel.expr.ExprR\x04expr\x125\n" + + "\vsource_info\x18\x03 \x01(\v2\x14.cel.expr.SourceInfoR\n" + + "sourceInfo\"\x9a\v\n" + + "\x04Expr\x12\x0e\n" + + "\x02id\x18\x02 \x01(\x03R\x02id\x123\n" + + "\n" + + "const_expr\x18\x03 \x01(\v2\x12.cel.expr.ConstantH\x00R\tconstExpr\x125\n" + + "\n" + + "ident_expr\x18\x04 \x01(\v2\x14.cel.expr.Expr.IdentH\x00R\tidentExpr\x128\n" + + "\vselect_expr\x18\x05 \x01(\v2\x15.cel.expr.Expr.SelectH\x00R\n" + + "selectExpr\x122\n" + + "\tcall_expr\x18\x06 \x01(\v2\x13.cel.expr.Expr.CallH\x00R\bcallExpr\x128\n" + + "\tlist_expr\x18\a \x01(\v2\x19.cel.expr.Expr.CreateListH\x00R\blistExpr\x12>\n" + + "\vstruct_expr\x18\b \x01(\v2\x1b.cel.expr.Expr.CreateStructH\x00R\n" + + "structExpr\x12M\n" + + "\x12comprehension_expr\x18\t \x01(\v2\x1c.cel.expr.Expr.ComprehensionH\x00R\x11comprehensionExpr\x1a\x1b\n" + + "\x05Ident\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x1ae\n" + + "\x06Select\x12(\n" + + "\aoperand\x18\x01 \x01(\v2\x0e.cel.expr.ExprR\aoperand\x12\x14\n" + + "\x05field\x18\x02 \x01(\tR\x05field\x12\x1b\n" + + "\ttest_only\x18\x03 \x01(\bR\btestOnly\x1an\n" + + "\x04Call\x12&\n" + + "\x06target\x18\x01 \x01(\v2\x0e.cel.expr.ExprR\x06target\x12\x1a\n" + + "\bfunction\x18\x02 \x01(\tR\bfunction\x12\"\n" + + "\x04args\x18\x03 \x03(\v2\x0e.cel.expr.ExprR\x04args\x1ac\n" + + "\n" + + "CreateList\x12*\n" + + "\belements\x18\x01 \x03(\v2\x0e.cel.expr.ExprR\belements\x12)\n" + + "\x10optional_indices\x18\x02 \x03(\x05R\x0foptionalIndices\x1a\xab\x02\n" + + "\fCreateStruct\x12!\n" + + "\fmessage_name\x18\x01 \x01(\tR\vmessageName\x12;\n" + + "\aentries\x18\x02 \x03(\v2!.cel.expr.Expr.CreateStruct.EntryR\aentries\x1a\xba\x01\n" + + "\x05Entry\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1d\n" + + "\tfield_key\x18\x02 \x01(\tH\x00R\bfieldKey\x12)\n" + + "\amap_key\x18\x03 \x01(\v2\x0e.cel.expr.ExprH\x00R\x06mapKey\x12$\n" + + "\x05value\x18\x04 \x01(\v2\x0e.cel.expr.ExprR\x05value\x12%\n" + + "\x0eoptional_entry\x18\x05 \x01(\bR\roptionalEntryB\n" + + "\n" + + "\bkey_kind\x1a\xca\x02\n" + + "\rComprehension\x12\x19\n" + + "\biter_var\x18\x01 \x01(\tR\aiterVar\x12\x1b\n" + + "\titer_var2\x18\b \x01(\tR\biterVar2\x12-\n" + + "\n" + + "iter_range\x18\x02 \x01(\v2\x0e.cel.expr.ExprR\titerRange\x12\x19\n" + + "\baccu_var\x18\x03 \x01(\tR\aaccuVar\x12+\n" + + "\taccu_init\x18\x04 \x01(\v2\x0e.cel.expr.ExprR\baccuInit\x125\n" + + "\x0eloop_condition\x18\x05 \x01(\v2\x0e.cel.expr.ExprR\rloopCondition\x12+\n" + + "\tloop_step\x18\x06 \x01(\v2\x0e.cel.expr.ExprR\bloopStep\x12&\n" + + "\x06result\x18\a \x01(\v2\x0e.cel.expr.ExprR\x06resultB\v\n" + + "\texpr_kind\"\xc1\x03\n" + + "\bConstant\x12;\n" + + "\n" + + "null_value\x18\x01 \x01(\x0e2\x1a.google.protobuf.NullValueH\x00R\tnullValue\x12\x1f\n" + + "\n" + + "bool_value\x18\x02 \x01(\bH\x00R\tboolValue\x12!\n" + + "\vint64_value\x18\x03 \x01(\x03H\x00R\n" + + "int64Value\x12#\n" + + "\fuint64_value\x18\x04 \x01(\x04H\x00R\vuint64Value\x12#\n" + + "\fdouble_value\x18\x05 \x01(\x01H\x00R\vdoubleValue\x12#\n" + + "\fstring_value\x18\x06 \x01(\tH\x00R\vstringValue\x12!\n" + + "\vbytes_value\x18\a \x01(\fH\x00R\n" + + "bytesValue\x12F\n" + + "\x0eduration_value\x18\b \x01(\v2\x19.google.protobuf.DurationB\x02\x18\x01H\x00R\rdurationValue\x12I\n" + + "\x0ftimestamp_value\x18\t \x01(\v2\x1a.google.protobuf.TimestampB\x02\x18\x01H\x00R\x0etimestampValueB\x0f\n" + + "\rconstant_kind\"\xac\x06\n" + + "\n" + + "SourceInfo\x12%\n" + + "\x0esyntax_version\x18\x01 \x01(\tR\rsyntaxVersion\x12\x1a\n" + + "\blocation\x18\x02 \x01(\tR\blocation\x12!\n" + + "\fline_offsets\x18\x03 \x03(\x05R\vlineOffsets\x12A\n" + + "\tpositions\x18\x04 \x03(\v2#.cel.expr.SourceInfo.PositionsEntryR\tpositions\x12E\n" + + "\vmacro_calls\x18\x05 \x03(\v2$.cel.expr.SourceInfo.MacroCallsEntryR\n" + + "macroCalls\x12>\n" + + "\n" + + "extensions\x18\x06 \x03(\v2\x1e.cel.expr.SourceInfo.ExtensionR\n" + + "extensions\x1a<\n" + + "\x0ePositionsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x03R\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\x05R\x05value:\x028\x01\x1aM\n" + + "\x0fMacroCallsEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\x03R\x03key\x12$\n" + + "\x05value\x18\x02 \x01(\v2\x0e.cel.expr.ExprR\x05value:\x028\x01\x1a\xe0\x02\n" + + "\tExtension\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12Y\n" + + "\x13affected_components\x18\x02 \x03(\x0e2(.cel.expr.SourceInfo.Extension.ComponentR\x12affectedComponents\x12@\n" + + "\aversion\x18\x03 \x01(\v2&.cel.expr.SourceInfo.Extension.VersionR\aversion\x1a5\n" + + "\aVersion\x12\x14\n" + + "\x05major\x18\x01 \x01(\x03R\x05major\x12\x14\n" + + "\x05minor\x18\x02 \x01(\x03R\x05minor\"o\n" + + "\tComponent\x12\x19\n" + + "\x15COMPONENT_UNSPECIFIED\x10\x00\x12\x14\n" + + "\x10COMPONENT_PARSER\x10\x01\x12\x1a\n" + + "\x16COMPONENT_TYPE_CHECKER\x10\x02\x12\x15\n" + + "\x11COMPONENT_RUNTIME\x10\x03B.\n" + + "\fdev.cel.exprB\vSyntaxProtoP\x01Z\fcel.dev/expr\xf8\x01\x01b\x06proto3" var ( file_cel_expr_syntax_proto_rawDescOnce sync.Once - file_cel_expr_syntax_proto_rawDescData = file_cel_expr_syntax_proto_rawDesc + file_cel_expr_syntax_proto_rawDescData []byte ) func file_cel_expr_syntax_proto_rawDescGZIP() []byte { file_cel_expr_syntax_proto_rawDescOnce.Do(func() { - file_cel_expr_syntax_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_syntax_proto_rawDescData) + file_cel_expr_syntax_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cel_expr_syntax_proto_rawDesc), len(file_cel_expr_syntax_proto_rawDesc))) }) return file_cel_expr_syntax_proto_rawDescData } var file_cel_expr_syntax_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_cel_expr_syntax_proto_msgTypes = make([]protoimpl.MessageInfo, 15) -var file_cel_expr_syntax_proto_goTypes = []interface{}{ +var file_cel_expr_syntax_proto_goTypes = []any{ (SourceInfo_Extension_Component)(0), // 0: cel.expr.SourceInfo.Extension.Component (*ParsedExpr)(nil), // 1: cel.expr.ParsedExpr (*Expr)(nil), // 2: cel.expr.Expr @@ -1429,165 +1349,7 @@ func file_cel_expr_syntax_proto_init() { if File_cel_expr_syntax_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_cel_expr_syntax_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParsedExpr); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Constant); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Ident); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Select); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Call); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_CreateList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_CreateStruct); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_Comprehension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Expr_CreateStruct_Entry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceInfo_Extension); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_syntax_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SourceInfo_Extension_Version); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cel_expr_syntax_proto_msgTypes[1].OneofWrappers = []interface{}{ + file_cel_expr_syntax_proto_msgTypes[1].OneofWrappers = []any{ (*Expr_ConstExpr)(nil), (*Expr_IdentExpr)(nil), (*Expr_SelectExpr)(nil), @@ -1596,7 +1358,7 @@ func file_cel_expr_syntax_proto_init() { (*Expr_StructExpr)(nil), (*Expr_ComprehensionExpr)(nil), } - file_cel_expr_syntax_proto_msgTypes[2].OneofWrappers = []interface{}{ + file_cel_expr_syntax_proto_msgTypes[2].OneofWrappers = []any{ (*Constant_NullValue)(nil), (*Constant_BoolValue)(nil), (*Constant_Int64Value)(nil), @@ -1607,7 +1369,7 @@ func file_cel_expr_syntax_proto_init() { (*Constant_DurationValue)(nil), (*Constant_TimestampValue)(nil), } - file_cel_expr_syntax_proto_msgTypes[10].OneofWrappers = []interface{}{ + file_cel_expr_syntax_proto_msgTypes[10].OneofWrappers = []any{ (*Expr_CreateStruct_Entry_FieldKey)(nil), (*Expr_CreateStruct_Entry_MapKey)(nil), } @@ -1615,7 +1377,7 @@ func file_cel_expr_syntax_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_syntax_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cel_expr_syntax_proto_rawDesc), len(file_cel_expr_syntax_proto_rawDesc)), NumEnums: 1, NumMessages: 15, NumExtensions: 0, @@ -1627,7 +1389,6 @@ func file_cel_expr_syntax_proto_init() { MessageInfos: file_cel_expr_syntax_proto_msgTypes, }.Build() File_cel_expr_syntax_proto = out.File - file_cel_expr_syntax_proto_rawDesc = nil file_cel_expr_syntax_proto_goTypes = nil file_cel_expr_syntax_proto_depIdxs = nil } diff --git a/vendor/cel.dev/expr/value.pb.go b/vendor/cel.dev/expr/value.pb.go index e5e29228c2..1f53a6a296 100644 --- a/vendor/cel.dev/expr/value.pb.go +++ b/vendor/cel.dev/expr/value.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.36.10 +// protoc v5.27.1 // source: cel/expr/value.proto package expr @@ -13,6 +13,7 @@ import ( structpb "google.golang.org/protobuf/types/known/structpb" reflect "reflect" sync "sync" + unsafe "unsafe" ) const ( @@ -23,11 +24,8 @@ const ( ) type Value struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Types that are assignable to Kind: + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Kind: // // *Value_NullValue // *Value_BoolValue @@ -41,16 +39,16 @@ type Value struct { // *Value_MapValue // *Value_ListValue // *Value_TypeValue - Kind isValue_Kind `protobuf_oneof:"kind"` + Kind isValue_Kind `protobuf_oneof:"kind"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *Value) Reset() { *x = Value{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_value_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *Value) String() string { @@ -61,7 +59,7 @@ func (*Value) ProtoMessage() {} func (x *Value) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_value_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -76,93 +74,117 @@ func (*Value) Descriptor() ([]byte, []int) { return file_cel_expr_value_proto_rawDescGZIP(), []int{0} } -func (m *Value) GetKind() isValue_Kind { - if m != nil { - return m.Kind +func (x *Value) GetKind() isValue_Kind { + if x != nil { + return x.Kind } return nil } func (x *Value) GetNullValue() structpb.NullValue { - if x, ok := x.GetKind().(*Value_NullValue); ok { - return x.NullValue + if x != nil { + if x, ok := x.Kind.(*Value_NullValue); ok { + return x.NullValue + } } return structpb.NullValue(0) } func (x *Value) GetBoolValue() bool { - if x, ok := x.GetKind().(*Value_BoolValue); ok { - return x.BoolValue + if x != nil { + if x, ok := x.Kind.(*Value_BoolValue); ok { + return x.BoolValue + } } return false } func (x *Value) GetInt64Value() int64 { - if x, ok := x.GetKind().(*Value_Int64Value); ok { - return x.Int64Value + if x != nil { + if x, ok := x.Kind.(*Value_Int64Value); ok { + return x.Int64Value + } } return 0 } func (x *Value) GetUint64Value() uint64 { - if x, ok := x.GetKind().(*Value_Uint64Value); ok { - return x.Uint64Value + if x != nil { + if x, ok := x.Kind.(*Value_Uint64Value); ok { + return x.Uint64Value + } } return 0 } func (x *Value) GetDoubleValue() float64 { - if x, ok := x.GetKind().(*Value_DoubleValue); ok { - return x.DoubleValue + if x != nil { + if x, ok := x.Kind.(*Value_DoubleValue); ok { + return x.DoubleValue + } } return 0 } func (x *Value) GetStringValue() string { - if x, ok := x.GetKind().(*Value_StringValue); ok { - return x.StringValue + if x != nil { + if x, ok := x.Kind.(*Value_StringValue); ok { + return x.StringValue + } } return "" } func (x *Value) GetBytesValue() []byte { - if x, ok := x.GetKind().(*Value_BytesValue); ok { - return x.BytesValue + if x != nil { + if x, ok := x.Kind.(*Value_BytesValue); ok { + return x.BytesValue + } } return nil } func (x *Value) GetEnumValue() *EnumValue { - if x, ok := x.GetKind().(*Value_EnumValue); ok { - return x.EnumValue + if x != nil { + if x, ok := x.Kind.(*Value_EnumValue); ok { + return x.EnumValue + } } return nil } func (x *Value) GetObjectValue() *anypb.Any { - if x, ok := x.GetKind().(*Value_ObjectValue); ok { - return x.ObjectValue + if x != nil { + if x, ok := x.Kind.(*Value_ObjectValue); ok { + return x.ObjectValue + } } return nil } func (x *Value) GetMapValue() *MapValue { - if x, ok := x.GetKind().(*Value_MapValue); ok { - return x.MapValue + if x != nil { + if x, ok := x.Kind.(*Value_MapValue); ok { + return x.MapValue + } } return nil } func (x *Value) GetListValue() *ListValue { - if x, ok := x.GetKind().(*Value_ListValue); ok { - return x.ListValue + if x != nil { + if x, ok := x.Kind.(*Value_ListValue); ok { + return x.ListValue + } } return nil } func (x *Value) GetTypeValue() string { - if x, ok := x.GetKind().(*Value_TypeValue); ok { - return x.TypeValue + if x != nil { + if x, ok := x.Kind.(*Value_TypeValue); ok { + return x.TypeValue + } } return "" } @@ -244,21 +266,18 @@ func (*Value_ListValue) isValue_Kind() {} func (*Value_TypeValue) isValue_Kind() {} type EnumValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + Value int32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Value int32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"` + sizeCache protoimpl.SizeCache } func (x *EnumValue) Reset() { *x = EnumValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_value_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *EnumValue) String() string { @@ -269,7 +288,7 @@ func (*EnumValue) ProtoMessage() {} func (x *EnumValue) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_value_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -299,20 +318,17 @@ func (x *EnumValue) GetValue() int32 { } type ListValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` unknownFields protoimpl.UnknownFields - - Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + sizeCache protoimpl.SizeCache } func (x *ListValue) Reset() { *x = ListValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_value_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *ListValue) String() string { @@ -323,7 +339,7 @@ func (*ListValue) ProtoMessage() {} func (x *ListValue) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_value_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -346,20 +362,17 @@ func (x *ListValue) GetValues() []*Value { } type MapValue struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Entries []*MapValue_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` unknownFields protoimpl.UnknownFields - - Entries []*MapValue_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MapValue) Reset() { *x = MapValue{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_value_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MapValue) String() string { @@ -370,7 +383,7 @@ func (*MapValue) ProtoMessage() {} func (x *MapValue) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_value_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -393,21 +406,18 @@ func (x *MapValue) GetEntries() []*MapValue_Entry { } type MapValue_Entry struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + Key *Value `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` unknownFields protoimpl.UnknownFields - - Key *Value `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value *Value `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + sizeCache protoimpl.SizeCache } func (x *MapValue_Entry) Reset() { *x = MapValue_Entry{} - if protoimpl.UnsafeEnabled { - mi := &file_cel_expr_value_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } + mi := &file_cel_expr_value_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } func (x *MapValue_Entry) String() string { @@ -418,7 +428,7 @@ func (*MapValue_Entry) ProtoMessage() {} func (x *MapValue_Entry) ProtoReflect() protoreflect.Message { mi := &file_cel_expr_value_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { + if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { ms.StoreMessageInfo(mi) @@ -449,83 +459,58 @@ func (x *MapValue_Entry) GetValue() *Value { var File_cel_expr_value_proto protoreflect.FileDescriptor -var file_cel_expr_value_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x63, 0x65, 0x6c, 0x2f, 0x65, 0x78, 0x70, 0x72, 0x2f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, - 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, - 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9d, 0x04, 0x0a, 0x05, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x6e, 0x75, 0x6c, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4e, 0x75, 0x6c, 0x6c, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6e, 0x75, 0x6c, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0a, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x75, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0b, 0x75, 0x69, - 0x6e, 0x74, 0x36, 0x34, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0c, 0x64, 0x6f, 0x75, - 0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x01, 0x48, - 0x00, 0x52, 0x0b, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, - 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x21, 0x0a, 0x0b, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x0a, 0x62, 0x79, 0x74, 0x65, - 0x73, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x65, 0x6e, 0x75, 0x6d, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x45, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, - 0x00, 0x52, 0x09, 0x65, 0x6e, 0x75, 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x39, 0x0a, 0x0c, - 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x48, 0x00, 0x52, 0x0b, 0x6f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x31, 0x0a, 0x09, 0x6d, 0x61, 0x70, 0x5f, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x65, 0x6c, - 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, - 0x52, 0x08, 0x6d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x34, 0x0a, 0x0a, 0x6c, 0x69, - 0x73, 0x74, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, - 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x09, 0x6c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, - 0x12, 0x1f, 0x0a, 0x0a, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x74, 0x79, 0x70, 0x65, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x42, 0x06, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x35, 0x0a, 0x09, 0x45, 0x6e, 0x75, - 0x6d, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x22, 0x34, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x27, 0x0a, - 0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x06, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x70, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, - 0x4d, 0x61, 0x70, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, - 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x1a, 0x51, 0x0a, 0x05, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x21, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, - 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x2d, 0x0a, 0x0c, 0x64, 0x65, - 0x76, 0x2e, 0x63, 0x65, 0x6c, 0x2e, 0x65, 0x78, 0x70, 0x72, 0x42, 0x0a, 0x56, 0x61, 0x6c, 0x75, - 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0c, 0x63, 0x65, 0x6c, 0x2e, 0x64, 0x65, - 0x76, 0x2f, 0x65, 0x78, 0x70, 0x72, 0xf8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} +const file_cel_expr_value_proto_rawDesc = "" + + "\n" + + "\x14cel/expr/value.proto\x12\bcel.expr\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\"\x9d\x04\n" + + "\x05Value\x12;\n" + + "\n" + + "null_value\x18\x01 \x01(\x0e2\x1a.google.protobuf.NullValueH\x00R\tnullValue\x12\x1f\n" + + "\n" + + "bool_value\x18\x02 \x01(\bH\x00R\tboolValue\x12!\n" + + "\vint64_value\x18\x03 \x01(\x03H\x00R\n" + + "int64Value\x12#\n" + + "\fuint64_value\x18\x04 \x01(\x04H\x00R\vuint64Value\x12#\n" + + "\fdouble_value\x18\x05 \x01(\x01H\x00R\vdoubleValue\x12#\n" + + "\fstring_value\x18\x06 \x01(\tH\x00R\vstringValue\x12!\n" + + "\vbytes_value\x18\a \x01(\fH\x00R\n" + + "bytesValue\x124\n" + + "\n" + + "enum_value\x18\t \x01(\v2\x13.cel.expr.EnumValueH\x00R\tenumValue\x129\n" + + "\fobject_value\x18\n" + + " \x01(\v2\x14.google.protobuf.AnyH\x00R\vobjectValue\x121\n" + + "\tmap_value\x18\v \x01(\v2\x12.cel.expr.MapValueH\x00R\bmapValue\x124\n" + + "\n" + + "list_value\x18\f \x01(\v2\x13.cel.expr.ListValueH\x00R\tlistValue\x12\x1f\n" + + "\n" + + "type_value\x18\x0f \x01(\tH\x00R\ttypeValueB\x06\n" + + "\x04kind\"5\n" + + "\tEnumValue\x12\x12\n" + + "\x04type\x18\x01 \x01(\tR\x04type\x12\x14\n" + + "\x05value\x18\x02 \x01(\x05R\x05value\"4\n" + + "\tListValue\x12'\n" + + "\x06values\x18\x01 \x03(\v2\x0f.cel.expr.ValueR\x06values\"\x91\x01\n" + + "\bMapValue\x122\n" + + "\aentries\x18\x01 \x03(\v2\x18.cel.expr.MapValue.EntryR\aentries\x1aQ\n" + + "\x05Entry\x12!\n" + + "\x03key\x18\x01 \x01(\v2\x0f.cel.expr.ValueR\x03key\x12%\n" + + "\x05value\x18\x02 \x01(\v2\x0f.cel.expr.ValueR\x05valueB-\n" + + "\fdev.cel.exprB\n" + + "ValueProtoP\x01Z\fcel.dev/expr\xf8\x01\x01b\x06proto3" var ( file_cel_expr_value_proto_rawDescOnce sync.Once - file_cel_expr_value_proto_rawDescData = file_cel_expr_value_proto_rawDesc + file_cel_expr_value_proto_rawDescData []byte ) func file_cel_expr_value_proto_rawDescGZIP() []byte { file_cel_expr_value_proto_rawDescOnce.Do(func() { - file_cel_expr_value_proto_rawDescData = protoimpl.X.CompressGZIP(file_cel_expr_value_proto_rawDescData) + file_cel_expr_value_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cel_expr_value_proto_rawDesc), len(file_cel_expr_value_proto_rawDesc))) }) return file_cel_expr_value_proto_rawDescData } var file_cel_expr_value_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_cel_expr_value_proto_goTypes = []interface{}{ +var file_cel_expr_value_proto_goTypes = []any{ (*Value)(nil), // 0: cel.expr.Value (*EnumValue)(nil), // 1: cel.expr.EnumValue (*ListValue)(nil), // 2: cel.expr.ListValue @@ -556,69 +541,7 @@ func file_cel_expr_value_proto_init() { if File_cel_expr_value_proto != nil { return } - if !protoimpl.UnsafeEnabled { - file_cel_expr_value_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Value); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*EnumValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MapValue); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cel_expr_value_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MapValue_Entry); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cel_expr_value_proto_msgTypes[0].OneofWrappers = []interface{}{ + file_cel_expr_value_proto_msgTypes[0].OneofWrappers = []any{ (*Value_NullValue)(nil), (*Value_BoolValue)(nil), (*Value_Int64Value)(nil), @@ -636,7 +559,7 @@ func file_cel_expr_value_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cel_expr_value_proto_rawDesc, + RawDescriptor: unsafe.Slice(unsafe.StringData(file_cel_expr_value_proto_rawDesc), len(file_cel_expr_value_proto_rawDesc)), NumEnums: 0, NumMessages: 5, NumExtensions: 0, @@ -647,7 +570,6 @@ func file_cel_expr_value_proto_init() { MessageInfos: file_cel_expr_value_proto_msgTypes, }.Build() File_cel_expr_value_proto = out.File - file_cel_expr_value_proto_rawDesc = nil file_cel_expr_value_proto_goTypes = nil file_cel_expr_value_proto_depIdxs = nil } diff --git a/vendor/cloud.google.com/go/compute/metadata/CHANGES.md b/vendor/cloud.google.com/go/compute/metadata/CHANGES.md index bcfb5d8165..e384683c50 100644 --- a/vendor/cloud.google.com/go/compute/metadata/CHANGES.md +++ b/vendor/cloud.google.com/go/compute/metadata/CHANGES.md @@ -1,5 +1,54 @@ # Changes +## [0.9.0](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.8.4...compute/metadata/v0.9.0) (2025-09-24) + + +### Features + +* **compute/metadata:** Retry on HTTP 429 ([#12932](https://github.com/googleapis/google-cloud-go/issues/12932)) ([1e91f5c](https://github.com/googleapis/google-cloud-go/commit/1e91f5c07acacd38ecdd4ff3e83e092b745e0bc2)) + +## [0.8.4](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.8.3...compute/metadata/v0.8.4) (2025-09-18) + + +### Bug Fixes + +* **compute/metadata:** Set subClient for UseDefaultClient case ([#12911](https://github.com/googleapis/google-cloud-go/issues/12911)) ([9e2646b](https://github.com/googleapis/google-cloud-go/commit/9e2646b1821231183fd775bb107c062865eeaccd)) + +## [0.8.3](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.8.2...compute/metadata/v0.8.3) (2025-09-17) + + +### Bug Fixes + +* **compute/metadata:** Disable Client timeouts for subscription client ([#12910](https://github.com/googleapis/google-cloud-go/issues/12910)) ([187a58a](https://github.com/googleapis/google-cloud-go/commit/187a58a540494e1e8562b046325b8cad8cf7af4a)) + +## [0.8.2](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.8.1...compute/metadata/v0.8.2) (2025-09-17) + + +### Bug Fixes + +* **compute/metadata:** Racy test and uninitialized subClient ([#12892](https://github.com/googleapis/google-cloud-go/issues/12892)) ([4943ca2](https://github.com/googleapis/google-cloud-go/commit/4943ca2bf83908a23806247bc4252dfb440d09cc)), refs [#12888](https://github.com/googleapis/google-cloud-go/issues/12888) + +## [0.8.1](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.8.0...compute/metadata/v0.8.1) (2025-09-16) + + +### Bug Fixes + +* **compute/metadata:** Use separate client for subscribe methods ([#12885](https://github.com/googleapis/google-cloud-go/issues/12885)) ([76b80f8](https://github.com/googleapis/google-cloud-go/commit/76b80f8df9bf9339d175407e8c15936fe1ac1c9c)) + +## [0.8.0](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.7.0...compute/metadata/v0.8.0) (2025-08-06) + + +### Features + +* **compute/metadata:** Add Options.UseDefaultClient ([#12657](https://github.com/googleapis/google-cloud-go/issues/12657)) ([1a88209](https://github.com/googleapis/google-cloud-go/commit/1a8820900f20e038291c4bb2c5284a449196e81f)), refs [#11078](https://github.com/googleapis/google-cloud-go/issues/11078) + +## [0.7.0](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.6.0...compute/metadata/v0.7.0) (2025-05-13) + + +### Features + +* **compute/metadata:** Allow canceling GCE detection ([#11786](https://github.com/googleapis/google-cloud-go/issues/11786)) ([78100fe](https://github.com/googleapis/google-cloud-go/commit/78100fe7e28cd30f1e10b47191ac3c9839663b64)) + ## [0.6.0](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.5.2...compute/metadata/v0.6.0) (2024-12-13) diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go index 4c18a383a4..6bd1891660 100644 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ b/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -22,6 +22,7 @@ package metadata // import "cloud.google.com/go/compute/metadata" import ( "context" "encoding/json" + "errors" "fmt" "io" "log/slog" @@ -62,21 +63,26 @@ var ( ) var defaultClient = &Client{ - hc: newDefaultHTTPClient(), - logger: slog.New(noOpHandler{}), + hc: newDefaultHTTPClient(true), + subClient: newDefaultHTTPClient(false), + logger: slog.New(noOpHandler{}), } -func newDefaultHTTPClient() *http.Client { - return &http.Client{ - Transport: &http.Transport{ - Dial: (&net.Dialer{ - Timeout: 2 * time.Second, - KeepAlive: 30 * time.Second, - }).Dial, - IdleConnTimeout: 60 * time.Second, - }, - Timeout: 5 * time.Second, +func newDefaultHTTPClient(enableTimeouts bool) *http.Client { + transport := &http.Transport{ + Dial: (&net.Dialer{ + Timeout: 2 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, } + c := &http.Client{ + Transport: transport, + } + if enableTimeouts { + transport.IdleConnTimeout = 60 * time.Second + c.Timeout = 5 * time.Second + } + return c } // NotDefinedError is returned when requested metadata is not defined. @@ -117,80 +123,18 @@ var ( // NOTE: True returned from `OnGCE` does not guarantee that the metadata server // is accessible from this process and have all the metadata defined. func OnGCE() bool { - onGCEOnce.Do(initOnGCE) - return onGCE -} - -func initOnGCE() { - onGCE = testOnGCE() + return OnGCEWithContext(context.Background()) } -func testOnGCE() bool { - // The user explicitly said they're on GCE, so trust them. - if os.Getenv(metadataHostEnv) != "" { - return true - } - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - resc := make(chan bool, 2) - - // Try two strategies in parallel. - // See https://github.com/googleapis/google-cloud-go/issues/194 - go func() { - req, _ := http.NewRequest("GET", "http://"+metadataIP, nil) - req.Header.Set("User-Agent", userAgent) - res, err := newDefaultHTTPClient().Do(req.WithContext(ctx)) - if err != nil { - resc <- false - return - } - defer res.Body.Close() - resc <- res.Header.Get("Metadata-Flavor") == "Google" - }() - - go func() { - resolver := &net.Resolver{} - addrs, err := resolver.LookupHost(ctx, "metadata.google.internal.") - if err != nil || len(addrs) == 0 { - resc <- false - return - } - resc <- strsContains(addrs, metadataIP) - }() - - tryHarder := systemInfoSuggestsGCE() - if tryHarder { - res := <-resc - if res { - // The first strategy succeeded, so let's use it. - return true - } - // Wait for either the DNS or metadata server probe to - // contradict the other one and say we are running on - // GCE. Give it a lot of time to do so, since the system - // info already suggests we're running on a GCE BIOS. - timer := time.NewTimer(5 * time.Second) - defer timer.Stop() - select { - case res = <-resc: - return res - case <-timer.C: - // Too slow. Who knows what this system is. - return false - } - } - - // There's no hint from the system info that we're running on - // GCE, so use the first probe's result as truth, whether it's - // true or false. The goal here is to optimize for speed for - // users who are NOT running on GCE. We can't assume that - // either a DNS lookup or an HTTP request to a blackholed IP - // address is fast. Worst case this should return when the - // metaClient's Transport.ResponseHeaderTimeout or - // Transport.Dial.Timeout fires (in two seconds). - return <-resc +// OnGCEWithContext reports whether this process is running on Google Compute Platforms. +// This function's return value is memoized for better performance. +// NOTE: True returned from `OnGCEWithContext` does not guarantee that the metadata server +// is accessible from this process and have all the metadata defined. +func OnGCEWithContext(ctx context.Context) bool { + onGCEOnce.Do(func() { + onGCE = defaultClient.OnGCEWithContext(ctx) + }) + return onGCE } // Subscribe calls Client.SubscribeWithContext on the default client. @@ -412,47 +356,161 @@ func strsContains(ss []string, s string) bool { // A Client provides metadata. type Client struct { - hc *http.Client - logger *slog.Logger + hc *http.Client + // subClient by default is a HTTP Client that is only used for subscribe + // methods that should not specify a timeout. If the user specifies a client + // this with be the same as 'hc'. + subClient *http.Client + logger *slog.Logger } // Options for configuring a [Client]. type Options struct { // Client is the HTTP client used to make requests. Optional. + // If UseDefaultClient is true, this field is ignored. + // If this field is nil, a new default http.Client will be created. Client *http.Client // Logger is used to log information about HTTP request and responses. // If not provided, nothing will be logged. Optional. Logger *slog.Logger + // UseDefaultClient specifies that the client should use the same default + // internal http.Client that is used in functions such as GetWithContext. + // This is useful for sharing a single TCP connection pool across requests. + // The difference vs GetWithContext is the ability to use this struct + // to provide a custom logger. If this field is true, the Client + // field is ignored. + UseDefaultClient bool } // NewClient returns a Client that can be used to fetch metadata. // Returns the client that uses the specified http.Client for HTTP requests. -// If nil is specified, returns the default client. +// If nil is specified, returns the default internal Client that is +// also used in functions such as GetWithContext. This is useful for sharing +// a single TCP connection pool across requests. func NewClient(c *http.Client) *Client { - return NewWithOptions(&Options{ - Client: c, - }) + if c == nil { + // Preserve original behavior for nil argument. + return defaultClient + } + // Return a new client with a no-op logger for backward compatibility. + return &Client{hc: c, subClient: c, logger: slog.New(noOpHandler{})} } // NewWithOptions returns a Client that is configured with the provided Options. func NewWithOptions(opts *Options) *Client { + // Preserve original behavior for nil opts. if opts == nil { return defaultClient } + + // Handle explicit request for the internal default http.Client. + if opts.UseDefaultClient { + logger := opts.Logger + if logger == nil { + logger = slog.New(noOpHandler{}) + } + return &Client{hc: defaultClient.hc, subClient: defaultClient.subClient, logger: logger} + } + + // Handle isolated client creation. client := opts.Client + subClient := opts.Client if client == nil { - client = newDefaultHTTPClient() + client = newDefaultHTTPClient(true) + subClient = newDefaultHTTPClient(false) } logger := opts.Logger if logger == nil { logger = slog.New(noOpHandler{}) } - return &Client{hc: client, logger: logger} + return &Client{hc: client, subClient: subClient, logger: logger} +} + +// NOTE: metadataRequestStrategy is assigned to a variable for test stubbing purposes. +var metadataRequestStrategy = func(ctx context.Context, httpClient *http.Client, resc chan bool) { + req, _ := http.NewRequest("GET", "http://"+metadataIP, nil) + req.Header.Set("User-Agent", userAgent) + res, err := httpClient.Do(req.WithContext(ctx)) + if err != nil { + resc <- false + return + } + defer res.Body.Close() + resc <- res.Header.Get("Metadata-Flavor") == "Google" +} + +// NOTE: dnsRequestStrategy is assigned to a variable for test stubbing purposes. +var dnsRequestStrategy = func(ctx context.Context, resc chan bool) { + resolver := &net.Resolver{} + addrs, err := resolver.LookupHost(ctx, "metadata.google.internal.") + if err != nil || len(addrs) == 0 { + resc <- false + return + } + resc <- strsContains(addrs, metadataIP) +} + +// OnGCEWithContext reports whether this process is running on Google Compute Platforms. +// NOTE: True returned from `OnGCEWithContext` does not guarantee that the metadata server +// is accessible from this process and have all the metadata defined. +func (c *Client) OnGCEWithContext(ctx context.Context) bool { + // The user explicitly said they're on GCE, so trust them. + if os.Getenv(metadataHostEnv) != "" { + return true + } + + ctx, cancel := context.WithCancel(ctx) + defer cancel() + + resc := make(chan bool, 2) + + // Try two strategies in parallel. + // See https://github.com/googleapis/google-cloud-go/issues/194 + go metadataRequestStrategy(ctx, c.hc, resc) + go dnsRequestStrategy(ctx, resc) + + tryHarder := systemInfoSuggestsGCE() + if tryHarder { + res := <-resc + if res { + // The first strategy succeeded, so let's use it. + return true + } + + // Wait for either the DNS or metadata server probe to + // contradict the other one and say we are running on + // GCE. Give it a lot of time to do so, since the system + // info already suggests we're running on a GCE BIOS. + // Ensure cancellations from the calling context are respected. + waitContext, cancelWait := context.WithTimeout(ctx, 5*time.Second) + defer cancelWait() + select { + case res = <-resc: + return res + case <-waitContext.Done(): + // Too slow. Who knows what this system is. + return false + } + } + + // There's no hint from the system info that we're running on + // GCE, so use the first probe's result as truth, whether it's + // true or false. The goal here is to optimize for speed for + // users who are NOT running on GCE. We can't assume that + // either a DNS lookup or an HTTP request to a blackholed IP + // address is fast. Worst case this should return when the + // metaClient's Transport.ResponseHeaderTimeout or + // Transport.Dial.Timeout fires (in two seconds). + return <-resc } // getETag returns a value from the metadata service as well as the associated ETag. // This func is otherwise equivalent to Get. func (c *Client) getETag(ctx context.Context, suffix string) (value, etag string, err error) { + return c.getETagWithSubClient(ctx, suffix, false) +} + +func (c *Client) getETagWithSubClient(ctx context.Context, suffix string, enableSubClient bool) (value, etag string, err error) { // Using a fixed IP makes it very difficult to spoof the metadata service in // a container, which is an important use-case for local testing of cloud // deployments. To enable spoofing of the metadata service, the environment @@ -479,9 +537,13 @@ func (c *Client) getETag(ctx context.Context, suffix string) (value, etag string var reqErr error var body []byte retryer := newRetryer() + hc := c.hc + if enableSubClient { + hc = c.subClient + } for { c.logger.DebugContext(ctx, "metadata request", "request", httpRequest(req, nil)) - res, reqErr = c.hc.Do(req) + res, reqErr = hc.Do(req) var code int if res != nil { code = res.StatusCode @@ -827,7 +889,7 @@ func (c *Client) SubscribeWithContext(ctx context.Context, suffix string, fn fun const failedSubscribeSleep = time.Second * 5 // First check to see if the metadata value exists at all. - val, lastETag, err := c.getETag(ctx, suffix) + val, lastETag, err := c.getETagWithSubClient(ctx, suffix, true) if err != nil { return err } @@ -843,8 +905,11 @@ func (c *Client) SubscribeWithContext(ctx context.Context, suffix string, fn fun suffix += "?wait_for_change=true&last_etag=" } for { - val, etag, err := c.getETag(ctx, suffix+url.QueryEscape(lastETag)) + val, etag, err := c.getETagWithSubClient(ctx, suffix+url.QueryEscape(lastETag), true) if err != nil { + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return err + } if _, deleted := err.(NotDefinedError); !deleted { time.Sleep(failedSubscribeSleep) continue // Retry on other errors. diff --git a/vendor/cloud.google.com/go/compute/metadata/retry.go b/vendor/cloud.google.com/go/compute/metadata/retry.go index 3d4bc75ddf..d516f30f80 100644 --- a/vendor/cloud.google.com/go/compute/metadata/retry.go +++ b/vendor/cloud.google.com/go/compute/metadata/retry.go @@ -95,6 +95,9 @@ func shouldRetry(status int, err error) bool { if 500 <= status && status <= 599 { return true } + if status == http.StatusTooManyRequests { + return true + } if err == io.ErrUnexpectedEOF { return true } diff --git a/vendor/cloud.google.com/go/compute/metadata/syscheck.go b/vendor/cloud.google.com/go/compute/metadata/syscheck.go index e0704fa647..d57ae1b27c 100644 --- a/vendor/cloud.google.com/go/compute/metadata/syscheck.go +++ b/vendor/cloud.google.com/go/compute/metadata/syscheck.go @@ -20,7 +20,9 @@ package metadata // doing network requests) suggests that we're running on GCE. If this // returns true, testOnGCE tries a bit harder to reach its metadata // server. -func systemInfoSuggestsGCE() bool { +// +// NOTE: systemInfoSuggestsGCE is assigned to a varible for test stubbing purposes. +var systemInfoSuggestsGCE = func() bool { // We don't currently have checks for other GOOS return false } diff --git a/vendor/cloud.google.com/go/compute/metadata/syscheck_linux.go b/vendor/cloud.google.com/go/compute/metadata/syscheck_linux.go index 74689acbbb..17ba5a3a23 100644 --- a/vendor/cloud.google.com/go/compute/metadata/syscheck_linux.go +++ b/vendor/cloud.google.com/go/compute/metadata/syscheck_linux.go @@ -21,8 +21,10 @@ import ( "strings" ) -func systemInfoSuggestsGCE() bool { +// NOTE: systemInfoSuggestsGCE is assigned to a varible for test stubbing purposes. +var systemInfoSuggestsGCE = func() bool { b, _ := os.ReadFile("/sys/class/dmi/id/product_name") + name := strings.TrimSpace(string(b)) return name == "Google" || name == "Google Compute Engine" } diff --git a/vendor/cloud.google.com/go/compute/metadata/syscheck_windows.go b/vendor/cloud.google.com/go/compute/metadata/syscheck_windows.go index c0ce627872..f57a5b14e9 100644 --- a/vendor/cloud.google.com/go/compute/metadata/syscheck_windows.go +++ b/vendor/cloud.google.com/go/compute/metadata/syscheck_windows.go @@ -22,7 +22,8 @@ import ( "golang.org/x/sys/windows/registry" ) -func systemInfoSuggestsGCE() bool { +// NOTE: systemInfoSuggestsGCE is assigned to a varible for test stubbing purposes. +var systemInfoSuggestsGCE = func() bool { k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SYSTEM\HardwareConfig\Current`, registry.QUERY_VALUE) if err != nil { return false diff --git a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go index dd1b73f1e9..892864ea62 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/collector/trace/v1/trace_service_grpc.pb.go @@ -22,8 +22,6 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type TraceServiceClient interface { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. Export(ctx context.Context, in *ExportTraceServiceRequest, opts ...grpc.CallOption) (*ExportTraceServiceResponse, error) } @@ -48,8 +46,6 @@ func (c *traceServiceClient) Export(ctx context.Context, in *ExportTraceServiceR // All implementations must embed UnimplementedTraceServiceServer // for forward compatibility type TraceServiceServer interface { - // For performance reasons, it is recommended to keep this RPC - // alive for the entire life of the application. Export(context.Context, *ExportTraceServiceRequest) (*ExportTraceServiceResponse, error) mustEmbedUnimplementedTraceServiceServer() } diff --git a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go index 852209b097..a7c5d19bff 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go @@ -430,6 +430,101 @@ func (x *InstrumentationScope) GetDroppedAttributesCount() uint32 { return 0 } +// A reference to an Entity. +// Entity represents an object of interest associated with produced telemetry: e.g spans, metrics, profiles, or logs. +// +// Status: [Development] +type EntityRef struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The Schema URL, if known. This is the identifier of the Schema that the entity data + // is recorded in. To learn more about Schema URL see + // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url + // + // This schema_url applies to the data in this message and to the Resource attributes + // referenced by id_keys and description_keys. + // TODO: discuss if we are happy with this somewhat complicated definition of what + // the schema_url applies to. + // + // This field obsoletes the schema_url field in ResourceMetrics/ResourceSpans/ResourceLogs. + SchemaUrl string `protobuf:"bytes,1,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` + // Defines the type of the entity. MUST not change during the lifetime of the entity. + // For example: "service" or "host". This field is required and MUST not be empty + // for valid entities. + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + // Attribute Keys that identify the entity. + // MUST not change during the lifetime of the entity. The Id must contain at least one attribute. + // These keys MUST exist in the containing {message}.attributes. + IdKeys []string `protobuf:"bytes,3,rep,name=id_keys,json=idKeys,proto3" json:"id_keys,omitempty"` + // Descriptive (non-identifying) attribute keys of the entity. + // MAY change over the lifetime of the entity. MAY be empty. + // These attribute keys are not part of entity's identity. + // These keys MUST exist in the containing {message}.attributes. + DescriptionKeys []string `protobuf:"bytes,4,rep,name=description_keys,json=descriptionKeys,proto3" json:"description_keys,omitempty"` +} + +func (x *EntityRef) Reset() { + *x = EntityRef{} + if protoimpl.UnsafeEnabled { + mi := &file_opentelemetry_proto_common_v1_common_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *EntityRef) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EntityRef) ProtoMessage() {} + +func (x *EntityRef) ProtoReflect() protoreflect.Message { + mi := &file_opentelemetry_proto_common_v1_common_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EntityRef.ProtoReflect.Descriptor instead. +func (*EntityRef) Descriptor() ([]byte, []int) { + return file_opentelemetry_proto_common_v1_common_proto_rawDescGZIP(), []int{5} +} + +func (x *EntityRef) GetSchemaUrl() string { + if x != nil { + return x.SchemaUrl + } + return "" +} + +func (x *EntityRef) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *EntityRef) GetIdKeys() []string { + if x != nil { + return x.IdKeys + } + return nil +} + +func (x *EntityRef) GetDescriptionKeys() []string { + if x != nil { + return x.DescriptionKeys + } + return nil +} + var File_opentelemetry_proto_common_v1_common_proto protoreflect.FileDescriptor var file_opentelemetry_proto_common_v1_common_proto_rawDesc = []byte{ @@ -488,15 +583,23 @@ var file_opentelemetry_proto_common_v1_common_proto_rawDesc = []byte{ 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x7b, 0x0a, 0x20, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, - 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, 0x6f, 0x2e, 0x6f, 0x70, 0x65, - 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, - 0x76, 0x31, 0xaa, 0x02, 0x1d, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, - 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x82, 0x01, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x52, 0x65, 0x66, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x75, 0x72, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x55, + 0x72, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x69, 0x64, 0x5f, 0x6b, 0x65, 0x79, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x69, 0x64, 0x4b, 0x65, 0x79, 0x73, 0x12, + 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, + 0x65, 0x79, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x42, 0x7b, 0x0a, 0x20, 0x69, 0x6f, + 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0b, + 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x28, 0x67, + 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, + 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1d, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, + 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -511,13 +614,14 @@ func file_opentelemetry_proto_common_v1_common_proto_rawDescGZIP() []byte { return file_opentelemetry_proto_common_v1_common_proto_rawDescData } -var file_opentelemetry_proto_common_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_opentelemetry_proto_common_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_opentelemetry_proto_common_v1_common_proto_goTypes = []interface{}{ (*AnyValue)(nil), // 0: opentelemetry.proto.common.v1.AnyValue (*ArrayValue)(nil), // 1: opentelemetry.proto.common.v1.ArrayValue (*KeyValueList)(nil), // 2: opentelemetry.proto.common.v1.KeyValueList (*KeyValue)(nil), // 3: opentelemetry.proto.common.v1.KeyValue (*InstrumentationScope)(nil), // 4: opentelemetry.proto.common.v1.InstrumentationScope + (*EntityRef)(nil), // 5: opentelemetry.proto.common.v1.EntityRef } var file_opentelemetry_proto_common_v1_common_proto_depIdxs = []int32{ 1, // 0: opentelemetry.proto.common.v1.AnyValue.array_value:type_name -> opentelemetry.proto.common.v1.ArrayValue @@ -599,6 +703,18 @@ func file_opentelemetry_proto_common_v1_common_proto_init() { return nil } } + file_opentelemetry_proto_common_v1_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EntityRef); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_opentelemetry_proto_common_v1_common_proto_msgTypes[0].OneofWrappers = []interface{}{ (*AnyValue_StringValue)(nil), @@ -615,7 +731,7 @@ func file_opentelemetry_proto_common_v1_common_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_opentelemetry_proto_common_v1_common_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 6, NumExtensions: 0, NumServices: 0, }, diff --git a/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go b/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go index b7545b03b9..eb7745d66e 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go @@ -48,6 +48,12 @@ type Resource struct { // dropped_attributes_count is the number of dropped attributes. If the value is 0, then // no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,2,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + // Set of entities that participate in this Resource. + // + // Note: keys in the references MUST exist in attributes of this message. + // + // Status: [Development] + EntityRefs []*v1.EntityRef `protobuf:"bytes,3,rep,name=entity_refs,json=entityRefs,proto3" json:"entity_refs,omitempty"` } func (x *Resource) Reset() { @@ -96,6 +102,13 @@ func (x *Resource) GetDroppedAttributesCount() uint32 { return 0 } +func (x *Resource) GetEntityRefs() []*v1.EntityRef { + if x != nil { + return x.EntityRefs + } + return nil +} + var File_opentelemetry_proto_resource_v1_resource_proto protoreflect.FileDescriptor var file_opentelemetry_proto_resource_v1_resource_proto_rawDesc = []byte{ @@ -106,7 +119,7 @@ var file_opentelemetry_proto_resource_v1_resource_proto_rawDesc = []byte{ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x2a, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, - 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, + 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd8, 0x01, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, @@ -115,16 +128,21 @@ var file_opentelemetry_proto_resource_v1_resource_proto_rawDesc = []byte{ 0x74, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x18, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x16, 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x41, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x42, 0x83, 0x01, - 0x0a, 0x22, 0x69, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, - 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x72, - 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2a, 0x67, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, - 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x6f, 0x74, 0x6c, 0x70, 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, - 0x31, 0xaa, 0x02, 0x1f, 0x4f, 0x70, 0x65, 0x6e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, - 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x2e, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x49, 0x0a, + 0x0b, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x72, 0x65, 0x66, 0x73, 0x18, 0x03, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, + 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x66, 0x52, 0x0a, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x52, 0x65, 0x66, 0x73, 0x42, 0x83, 0x01, 0x0a, 0x22, 0x69, 0x6f, 0x2e, + 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x76, 0x31, 0x42, + 0x0d, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x2a, 0x67, 0x6f, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x74, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, + 0x72, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x74, 0x6c, 0x70, + 0x2f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2f, 0x76, 0x31, 0xaa, 0x02, 0x1f, 0x4f, + 0x70, 0x65, 0x6e, 0x54, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -141,16 +159,18 @@ func file_opentelemetry_proto_resource_v1_resource_proto_rawDescGZIP() []byte { var file_opentelemetry_proto_resource_v1_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_opentelemetry_proto_resource_v1_resource_proto_goTypes = []interface{}{ - (*Resource)(nil), // 0: opentelemetry.proto.resource.v1.Resource - (*v1.KeyValue)(nil), // 1: opentelemetry.proto.common.v1.KeyValue + (*Resource)(nil), // 0: opentelemetry.proto.resource.v1.Resource + (*v1.KeyValue)(nil), // 1: opentelemetry.proto.common.v1.KeyValue + (*v1.EntityRef)(nil), // 2: opentelemetry.proto.common.v1.EntityRef } var file_opentelemetry_proto_resource_v1_resource_proto_depIdxs = []int32{ 1, // 0: opentelemetry.proto.resource.v1.Resource.attributes:type_name -> opentelemetry.proto.common.v1.KeyValue - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 2, // 1: opentelemetry.proto.resource.v1.Resource.entity_refs:type_name -> opentelemetry.proto.common.v1.EntityRef + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_opentelemetry_proto_resource_v1_resource_proto_init() } diff --git a/vendor/golang.org/x/oauth2/deviceauth.go b/vendor/golang.org/x/oauth2/deviceauth.go index e99c92f39c..e783a94374 100644 --- a/vendor/golang.org/x/oauth2/deviceauth.go +++ b/vendor/golang.org/x/oauth2/deviceauth.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "mime" "net/http" "net/url" "strings" @@ -116,10 +117,38 @@ func retrieveDeviceAuth(ctx context.Context, c *Config, v url.Values) (*DeviceAu return nil, fmt.Errorf("oauth2: cannot auth device: %v", err) } if code := r.StatusCode; code < 200 || code > 299 { - return nil, &RetrieveError{ + retrieveError := &RetrieveError{ Response: r, Body: body, } + + content, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type")) + switch content { + case "application/x-www-form-urlencoded", "text/plain": + // some endpoints return a query string + vals, err := url.ParseQuery(string(body)) + if err != nil { + return nil, retrieveError + } + retrieveError.ErrorCode = vals.Get("error") + retrieveError.ErrorDescription = vals.Get("error_description") + retrieveError.ErrorURI = vals.Get("error_uri") + default: + var tj struct { + // https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 + ErrorCode string `json:"error"` + ErrorDescription string `json:"error_description"` + ErrorURI string `json:"error_uri"` + } + if json.Unmarshal(body, &tj) != nil { + return nil, retrieveError + } + retrieveError.ErrorCode = tj.ErrorCode + retrieveError.ErrorDescription = tj.ErrorDescription + retrieveError.ErrorURI = tj.ErrorURI + } + + return nil, retrieveError } da := &DeviceAuthResponse{} diff --git a/vendor/golang.org/x/oauth2/google/externalaccount/aws.go b/vendor/golang.org/x/oauth2/google/externalaccount/aws.go index e1a735e01b..f62ec99a5f 100644 --- a/vendor/golang.org/x/oauth2/google/externalaccount/aws.go +++ b/vendor/golang.org/x/oauth2/google/externalaccount/aws.go @@ -5,7 +5,6 @@ package externalaccount import ( - "bytes" "context" "crypto/hmac" "crypto/sha256" @@ -148,13 +147,13 @@ func canonicalHeaders(req *http.Request) (string, string) { } sort.Strings(headers) - var fullHeaders bytes.Buffer + var fullHeaders strings.Builder for _, header := range headers { headerValue := strings.Join(lowerCaseHeaders[header], ",") fullHeaders.WriteString(header) - fullHeaders.WriteRune(':') + fullHeaders.WriteByte(':') fullHeaders.WriteString(headerValue) - fullHeaders.WriteRune('\n') + fullHeaders.WriteByte('\n') } return strings.Join(headers, ";"), fullHeaders.String() diff --git a/vendor/golang.org/x/oauth2/google/google.go b/vendor/golang.org/x/oauth2/google/google.go index e2eb9c9272..7d1fdd31d3 100644 --- a/vendor/golang.org/x/oauth2/google/google.go +++ b/vendor/golang.org/x/oauth2/google/google.go @@ -252,7 +252,7 @@ func (f *credentialsFile) tokenSource(ctx context.Context, params CredentialsPar // Further information about retrieving access tokens from the GCE metadata // server can be found at https://cloud.google.com/compute/docs/authentication. func ComputeTokenSource(account string, scope ...string) oauth2.TokenSource { - // refresh 3 minutes and 45 seconds early. The shortest MDS cache is currently 4 minutes, so any + // Refresh 3 minutes and 45 seconds early. The shortest MDS cache is currently 4 minutes, so any // refreshes earlier are a waste of compute. earlyExpirySecs := 225 * time.Second return computeTokenSource(account, earlyExpirySecs, scope...) diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.go index de34feb844..5c527d31fd 100644 --- a/vendor/golang.org/x/oauth2/oauth2.go +++ b/vendor/golang.org/x/oauth2/oauth2.go @@ -9,7 +9,6 @@ package oauth2 // import "golang.org/x/oauth2" import ( - "bytes" "context" "errors" "net/http" @@ -99,7 +98,7 @@ const ( // in the POST body as application/x-www-form-urlencoded parameters. AuthStyleInParams AuthStyle = 1 - // AuthStyleInHeader sends the client_id and client_password + // AuthStyleInHeader sends the client_id and client_secret // using HTTP Basic Authorization. This is an optional style // described in the OAuth2 RFC 6749 section 2.3.1. AuthStyleInHeader AuthStyle = 2 @@ -158,7 +157,7 @@ func SetAuthURLParam(key, value string) AuthCodeOption { // PKCE), https://www.oauth.com/oauth2-servers/pkce/ and // https://www.ietf.org/archive/id/draft-ietf-oauth-v2-1-09.html#name-cross-site-request-forgery (describing both approaches) func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string { - var buf bytes.Buffer + var buf strings.Builder buf.WriteString(c.Endpoint.AuthURL) v := url.Values{ "response_type": {"code"}, diff --git a/vendor/golang.org/x/oauth2/pkce.go b/vendor/golang.org/x/oauth2/pkce.go index cea8374d51..f99384f0f5 100644 --- a/vendor/golang.org/x/oauth2/pkce.go +++ b/vendor/golang.org/x/oauth2/pkce.go @@ -51,7 +51,7 @@ func S256ChallengeFromVerifier(verifier string) string { return base64.RawURLEncoding.EncodeToString(sha[:]) } -// S256ChallengeOption derives a PKCE code challenge derived from verifier with +// S256ChallengeOption derives a PKCE code challenge from the verifier with // method S256. It should be passed to [Config.AuthCodeURL] or [Config.DeviceAuth] // only. func S256ChallengeOption(verifier string) AuthCodeOption { diff --git a/vendor/golang.org/x/oauth2/token.go b/vendor/golang.org/x/oauth2/token.go index 239ec32962..e995eebb5e 100644 --- a/vendor/golang.org/x/oauth2/token.go +++ b/vendor/golang.org/x/oauth2/token.go @@ -103,7 +103,7 @@ func (t *Token) WithExtra(extra any) *Token { } // Extra returns an extra field. -// Extra fields are key-value pairs returned by the server as a +// Extra fields are key-value pairs returned by the server as // part of the token retrieval response. func (t *Token) Extra(key string) any { if raw, ok := t.raw.(map[string]any); ok { diff --git a/vendor/golang.org/x/oauth2/transport.go b/vendor/golang.org/x/oauth2/transport.go index 8bbebbac9e..9922ec3316 100644 --- a/vendor/golang.org/x/oauth2/transport.go +++ b/vendor/golang.org/x/oauth2/transport.go @@ -58,7 +58,7 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { var cancelOnce sync.Once // CancelRequest does nothing. It used to be a legacy cancellation mechanism -// but now only it only logs on first use to warn that it's deprecated. +// but now only logs on first use to warn that it's deprecated. // // Deprecated: use contexts for cancellation instead. func (t *Transport) CancelRequest(req *http.Request) { diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go index 8b462f3dfe..0b789e2c5e 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go index db7806cb99..f840481726 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go index 08505ba3fe..5d583b8660 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_info.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_info.pb.go index a462e7d013..53e9dd1e99 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/field_info.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/field_info.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go index c93b4f5248..d30fcee4ce 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go index a1c543a948..175974a869 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/annotations/routing.pb.go b/vendor/google.golang.org/genproto/googleapis/api/annotations/routing.pb.go index 2b54db3045..b8c4aa71f2 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/annotations/routing.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/annotations/routing.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/checked.pb.go b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/checked.pb.go index 9f81dbcd86..af9c44d93e 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/checked.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/checked.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/eval.pb.go b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/eval.pb.go index 0a2ffb5955..4b4f15477f 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/eval.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/eval.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/explain.pb.go b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/explain.pb.go index 57aaa2c9f5..ef27e878b9 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/explain.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/explain.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/syntax.pb.go b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/syntax.pb.go index c90c6015d2..7b973217ed 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/syntax.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/syntax.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/value.pb.go b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/value.pb.go index 0a5ca6a1b9..4ba3c7b2a8 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/value.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/expr/v1alpha1/value.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go index f388426b08..d083dde3ed 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/genproto/googleapis/api/launch_stage.pb.go b/vendor/google.golang.org/genproto/googleapis/api/launch_stage.pb.go index 498020e33c..a69c1d4734 100644 --- a/vendor/google.golang.org/genproto/googleapis/api/launch_stage.pb.go +++ b/vendor/google.golang.org/genproto/googleapis/api/launch_stage.pb.go @@ -1,4 +1,4 @@ -// Copyright 2024 Google LLC +// Copyright 2025 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/vendor/google.golang.org/grpc/CONTRIBUTING.md b/vendor/google.golang.org/grpc/CONTRIBUTING.md index d9bfa6e1e7..2079de7b0e 100644 --- a/vendor/google.golang.org/grpc/CONTRIBUTING.md +++ b/vendor/google.golang.org/grpc/CONTRIBUTING.md @@ -1,73 +1,159 @@ # How to contribute -We definitely welcome your patches and contributions to gRPC! Please read the gRPC -organization's [governance rules](https://github.com/grpc/grpc-community/blob/master/governance.md) -and [contribution guidelines](https://github.com/grpc/grpc-community/blob/master/CONTRIBUTING.md) before proceeding. +We welcome your patches and contributions to gRPC! Please read the gRPC +organization's [governance +rules](https://github.com/grpc/grpc-community/blob/master/governance.md) before +proceeding. If you are new to GitHub, please start by reading [Pull Request howto](https://help.github.com/articles/about-pull-requests/) ## Legal requirements In order to protect both you and ourselves, you will need to sign the -[Contributor License Agreement](https://identity.linuxfoundation.org/projects/cncf). +[Contributor License +Agreement](https://identity.linuxfoundation.org/projects/cncf). When you create +your first PR, a link will be added as a comment that contains the steps needed +to complete this process. + +## Getting Started + +A great way to start is by searching through our open issues. [Unassigned issues +labeled as "help +wanted"](https://github.com/grpc/grpc-go/issues?q=sort%3Aupdated-desc%20is%3Aissue%20is%3Aopen%20label%3A%22Status%3A%20Help%20Wanted%22%20no%3Aassignee) +are especially nice for first-time contributors, as they should be well-defined +problems that already have agreed-upon solutions. + +## Code Style + +We follow [Google's published Go style +guide](https://google.github.io/styleguide/go/). Note that there are three +primary documents that make up this style guide; please follow them as closely +as possible. If a reviewer recommends something that contradicts those +guidelines, there may be valid reasons to do so, but it should be rare. ## Guidelines for Pull Requests -How to get your contributions merged smoothly and quickly. + +Please read the following carefully to ensure your contributions can be merged +smoothly and quickly. + +### PR Contents - Create **small PRs** that are narrowly focused on **addressing a single - concern**. We often times receive PRs that are trying to fix several things at - a time, but only one fix is considered acceptable, nothing gets merged and - both author's & review's time is wasted. Create more PRs to address different - concerns and everyone will be happy. + concern**. We often receive PRs that attempt to fix several things at the same + time, and if one part of the PR has a problem, that will hold up the entire + PR. + +- If your change does not address an **open issue** with an **agreed + resolution**, consider opening an issue and discussing it first. If you are + suggesting a behavioral or API change, consider starting with a [gRFC + proposal](https://github.com/grpc/proposal). Many new features that are not + bug fixes will require cross-language agreement. + +- If you want to fix **formatting or style**, consider whether your changes are + an obvious improvement or might be considered a personal preference. If a + style change is based on preference, it likely will not be accepted. If it + corrects widely agreed-upon anti-patterns, then please do create a PR and + explain the benefits of the change. + +- For correcting **misspellings**, please be aware that we use some terms that + are sometimes flagged by spell checkers. As an example, "if an only if" is + often written as "iff". Please do not make spelling correction changes unless + you are certain they are misspellings. + +- **All tests need to be passing** before your change can be merged. We + recommend you run tests locally before creating your PR to catch breakages + early on: -- If you are searching for features to work on, issues labeled [Status: Help - Wanted](https://github.com/grpc/grpc-go/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22Status%3A+Help+Wanted%22) - is a great place to start. These issues are well-documented and usually can be - resolved with a single pull request. + - `./scripts/vet.sh` to catch vet errors. + - `go test -cpu 1,4 -timeout 7m ./...` to run the tests. + - `go test -race -cpu 1,4 -timeout 7m ./...` to run tests in race mode. -- If you are adding a new file, make sure it has the copyright message template - at the top as a comment. You can copy over the message from an existing file - and update the year. + Note that we have a multi-module repo, so `go test` commands may need to be + run from the root of each module in order to cause all tests to run. + + *Alternatively*, you may find it easier to push your changes to your fork on + GitHub, which will trigger a GitHub Actions run that you can use to verify + everything is passing. + +- Note that there are two GitHub actions checks that need not be green: + + 1. We test the freshness of the generated proto code we maintain via the + `vet-proto` check. If the source proto files are updated, but our repo is + not updated, an optional checker will fail. This will be fixed by our team + in a separate PR and will not prevent the merge of your PR. + + 2. We run a checker that will fail if there is any change in dependencies of + an exported package via the `dependencies` check. If new dependencies are + added that are not appropriate, we may not accept your PR (see below). + +- If you are adding a **new file**, make sure it has the **copyright message** + template at the top as a comment. You can copy the message from an existing + file and update the year. - The grpc package should only depend on standard Go packages and a small number - of exceptions. If your contribution introduces new dependencies which are NOT - in the [list](https://godoc.org/google.golang.org/grpc?imports), you need a - discussion with gRPC-Go authors and consultants. + of exceptions. **If your contribution introduces new dependencies**, you will + need a discussion with gRPC-Go maintainers. -- For speculative changes, consider opening an issue and discussing it first. If - you are suggesting a behavioral or API change, consider starting with a [gRFC - proposal](https://github.com/grpc/proposal). +### PR Descriptions -- Provide a good **PR description** as a record of **what** change is being made - and **why** it was made. Link to a GitHub issue if it exists. +- **PR titles** should start with the name of the component being addressed, or + the type of change. Examples: transport, client, server, round_robin, xds, + cleanup, deps. -- If you want to fix formatting or style, consider whether your changes are an - obvious improvement or might be considered a personal preference. If a style - change is based on preference, it likely will not be accepted. If it corrects - widely agreed-upon anti-patterns, then please do create a PR and explain the - benefits of the change. +- Read and follow the **guidelines for PR titles and descriptions** here: + https://google.github.io/eng-practices/review/developer/cl-descriptions.html -- Unless your PR is trivial, you should expect there will be reviewer comments - that you'll need to address before merging. We'll mark it as `Status: Requires - Reporter Clarification` if we expect you to respond to these comments in a - timely manner. If the PR remains inactive for 6 days, it will be marked as - `stale` and automatically close 7 days after that if we don't hear back from - you. + *particularly* the sections "First Line" and "Body is Informative". -- Maintain **clean commit history** and use **meaningful commit messages**. PRs - with messy commit history are difficult to review and won't be merged. Use - `rebase -i upstream/master` to curate your commit history and/or to bring in - latest changes from master (but avoid rebasing in the middle of a code - review). + Note: your PR description will be used as the git commit message in a + squash-and-merge if your PR is approved. We may make changes to this as + necessary. -- Keep your PR up to date with upstream/master (if there are merge conflicts, we - can't really merge your change). +- **Does this PR relate to an open issue?** On the first line, please use the + tag `Fixes #` to ensure the issue is closed when the PR is merged. Or + use `Updates #` if the PR is related to an open issue, but does not fix + it. Consider filing an issue if one does not already exist. -- **All tests need to be passing** before your change can be merged. We - recommend you **run tests locally** before creating your PR to catch breakages - early on. - - `./scripts/vet.sh` to catch vet errors - - `go test -cpu 1,4 -timeout 7m ./...` to run the tests - - `go test -race -cpu 1,4 -timeout 7m ./...` to run tests in race mode +- PR descriptions *must* conclude with **release notes** as follows: + + ``` + RELEASE NOTES: + * : + ``` + + This need not match the PR title. + + The summary must: + + * be something that gRPC users will understand. + + * clearly explain the feature being added, the issue being fixed, or the + behavior being changed, etc. If fixing a bug, be clear about how the bug + can be triggered by an end-user. + + * begin with a capital letter and use complete sentences. -- Exceptions to the rules can be made if there's a compelling reason for doing so. + * be as short as possible to describe the change being made. + + If a PR is *not* end-user visible -- e.g. a cleanup, testing change, or + GitHub-related, use `RELEASE NOTES: n/a`. + +### PR Process + +- Please **self-review** your code changes before sending your PR. This will + prevent simple, obvious errors from causing delays. + +- Maintain a **clean commit history** and use **meaningful commit messages**. + PRs with messy commit histories are difficult to review and won't be merged. + Before sending your PR, ensure your changes are based on top of the latest + `upstream/master` commits, and avoid rebasing in the middle of a code review. + You should **never use `git push -f`** unless absolutely necessary during a + review, as it can interfere with GitHub's tracking of comments. + +- Unless your PR is trivial, you should **expect reviewer comments** that you + will need to address before merging. We'll label the PR as `Status: Requires + Reporter Clarification` if we expect you to respond to these comments in a + timely manner. If the PR remains inactive for 6 days, it will be marked as + `stale`, and we will automatically close it after 7 days if we don't hear back + from you. Please feel free to ping issues or bugs if you do not get a response + within a week. diff --git a/vendor/google.golang.org/grpc/MAINTAINERS.md b/vendor/google.golang.org/grpc/MAINTAINERS.md index 5d4096d46a..df35bb9a88 100644 --- a/vendor/google.golang.org/grpc/MAINTAINERS.md +++ b/vendor/google.golang.org/grpc/MAINTAINERS.md @@ -9,21 +9,19 @@ for general contribution guidelines. ## Maintainers (in alphabetical order) -- [aranjans](https://github.com/aranjans), Google LLC - [arjan-bal](https://github.com/arjan-bal), Google LLC - [arvindbr8](https://github.com/arvindbr8), Google LLC - [atollena](https://github.com/atollena), Datadog, Inc. - [dfawley](https://github.com/dfawley), Google LLC - [easwars](https://github.com/easwars), Google LLC -- [erm-g](https://github.com/erm-g), Google LLC - [gtcooke94](https://github.com/gtcooke94), Google LLC -- [purnesh42h](https://github.com/purnesh42h), Google LLC -- [zasweq](https://github.com/zasweq), Google LLC ## Emeritus Maintainers (in alphabetical order) - [adelez](https://github.com/adelez) +- [aranjans](https://github.com/aranjans) - [canguler](https://github.com/canguler) - [cesarghali](https://github.com/cesarghali) +- [erm-g](https://github.com/erm-g) - [iamqizhao](https://github.com/iamqizhao) - [jeanbza](https://github.com/jeanbza) - [jtattermusch](https://github.com/jtattermusch) @@ -32,5 +30,7 @@ for general contribution guidelines. - [matt-kwong](https://github.com/matt-kwong) - [menghanl](https://github.com/menghanl) - [nicolasnoble](https://github.com/nicolasnoble) +- [purnesh42h](https://github.com/purnesh42h) - [srini100](https://github.com/srini100) - [yongni](https://github.com/yongni) +- [zasweq](https://github.com/zasweq) diff --git a/vendor/google.golang.org/grpc/README.md b/vendor/google.golang.org/grpc/README.md index b572707c62..f9a88d597e 100644 --- a/vendor/google.golang.org/grpc/README.md +++ b/vendor/google.golang.org/grpc/README.md @@ -32,6 +32,7 @@ import "google.golang.org/grpc" - [Low-level technical docs](Documentation) from this repository - [Performance benchmark][] - [Examples](examples) +- [Contribution guidelines](CONTRIBUTING.md) ## FAQ diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go index c9b343c715..d08b7ad637 100644 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ b/vendor/google.golang.org/grpc/balancer/balancer.go @@ -75,8 +75,6 @@ func unregisterForTesting(name string) { func init() { internal.BalancerUnregister = unregisterForTesting - internal.ConnectedAddress = connectedAddress - internal.SetConnectedAddress = setConnectedAddress } // Get returns the resolver builder registered with the given name. @@ -360,6 +358,10 @@ type Balancer interface { // call SubConn.Shutdown for its existing SubConns; however, this will be // required in a future release, so it is recommended. Close() + // ExitIdle instructs the LB policy to reconnect to backends / exit the + // IDLE state, if appropriate and possible. Note that SubConns that enter + // the IDLE state will not reconnect until SubConn.Connect is called. + ExitIdle() } // ExitIdler is an optional interface for balancers to implement. If @@ -367,8 +369,8 @@ type Balancer interface { // the ClientConn is idle. If unimplemented, ClientConn.Connect will cause // all SubConns to connect. // -// Notice: it will be required for all balancers to implement this in a future -// release. +// Deprecated: All balancers must implement this interface. This interface will +// be removed in a future release. type ExitIdler interface { // ExitIdle instructs the LB policy to reconnect to backends / exit the // IDLE state, if appropriate and possible. Note that SubConns that enter diff --git a/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go b/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go index cc606f4dae..360db08ebc 100644 --- a/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go +++ b/vendor/google.golang.org/grpc/balancer/endpointsharding/endpointsharding.go @@ -37,6 +37,8 @@ import ( "google.golang.org/grpc/resolver" ) +var randIntN = rand.IntN + // ChildState is the balancer state of a child along with the endpoint which // identifies the child balancer. type ChildState struct { @@ -45,7 +47,15 @@ type ChildState struct { // Balancer exposes only the ExitIdler interface of the child LB policy. // Other methods of the child policy are called only by endpointsharding. - Balancer balancer.ExitIdler + Balancer ExitIdler +} + +// ExitIdler provides access to only the ExitIdle method of the child balancer. +type ExitIdler interface { + // ExitIdle instructs the LB policy to reconnect to backends / exit the + // IDLE state, if appropriate and possible. Note that SubConns that enter + // the IDLE state will not reconnect until SubConn.Connect is called. + ExitIdle() } // Options are the options to configure the behaviour of the @@ -104,6 +114,21 @@ type endpointSharding struct { mu sync.Mutex } +// rotateEndpoints returns a slice of all the input endpoints rotated a random +// amount. +func rotateEndpoints(es []resolver.Endpoint) []resolver.Endpoint { + les := len(es) + if les == 0 { + return es + } + r := randIntN(les) + // Make a copy to avoid mutating data beyond the end of es. + ret := make([]resolver.Endpoint, les) + copy(ret, es[r:]) + copy(ret[les-r:], es[:r]) + return ret +} + // UpdateClientConnState creates a child for new endpoints and deletes children // for endpoints that are no longer present. It also updates all the children, // and sends a single synchronous update of the childrens' aggregated state at @@ -125,7 +150,7 @@ func (es *endpointSharding) UpdateClientConnState(state balancer.ClientConnState newChildren := resolver.NewEndpointMap[*balancerWrapper]() // Update/Create new children. - for _, endpoint := range state.ResolverState.Endpoints { + for _, endpoint := range rotateEndpoints(state.ResolverState.Endpoints) { if _, ok := newChildren.Get(endpoint); ok { // Endpoint child was already created, continue to avoid duplicate // update. @@ -205,6 +230,16 @@ func (es *endpointSharding) Close() { } } +func (es *endpointSharding) ExitIdle() { + es.childMu.Lock() + defer es.childMu.Unlock() + for _, bw := range es.children.Load().Values() { + if !bw.isClosed { + bw.child.ExitIdle() + } + } +} + // updateState updates this component's state. It sends the aggregated state, // and a picker with round robin behavior with all the child states present if // needed. @@ -261,7 +296,7 @@ func (es *endpointSharding) updateState() { p := &pickerWithChildStates{ pickers: pickers, childStates: childStates, - next: uint32(rand.IntN(len(pickers))), + next: uint32(randIntN(len(pickers))), } es.cc.UpdateState(balancer.State{ ConnectivityState: aggState, @@ -326,15 +361,13 @@ func (bw *balancerWrapper) UpdateState(state balancer.State) { // ExitIdle pings an IDLE child balancer to exit idle in a new goroutine to // avoid deadlocks due to synchronous balancer state updates. func (bw *balancerWrapper) ExitIdle() { - if ei, ok := bw.child.(balancer.ExitIdler); ok { - go func() { - bw.es.childMu.Lock() - if !bw.isClosed { - ei.ExitIdle() - } - bw.es.childMu.Unlock() - }() - } + go func() { + bw.es.childMu.Lock() + if !bw.isClosed { + bw.child.ExitIdle() + } + bw.es.childMu.Unlock() + }() } // updateClientConnStateLocked delivers the ClientConnState to the child diff --git a/vendor/google.golang.org/grpc/balancer/pickfirst/internal/internal.go b/vendor/google.golang.org/grpc/balancer/pickfirst/internal/internal.go index 7d66cb491c..cc902a4de6 100644 --- a/vendor/google.golang.org/grpc/balancer/pickfirst/internal/internal.go +++ b/vendor/google.golang.org/grpc/balancer/pickfirst/internal/internal.go @@ -26,6 +26,8 @@ import ( var ( // RandShuffle pseudo-randomizes the order of addresses. RandShuffle = rand.Shuffle + // RandFloat64 returns, as a float64, a pseudo-random number in [0.0,1.0). + RandFloat64 = rand.Float64 // TimeAfterFunc allows mocking the timer for testing connection delay // related functionality. TimeAfterFunc = func(d time.Duration, f func()) func() { diff --git a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go index ea8899818c..dccd9f0bf3 100644 --- a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go +++ b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirst.go @@ -16,55 +16,129 @@ * */ -// Package pickfirst contains the pick_first load balancing policy. +// Package pickfirst contains the pick_first load balancing policy which +// is the universal leaf policy. package pickfirst import ( + "cmp" "encoding/json" "errors" "fmt" - rand "math/rand/v2" + "math" + "net" + "net/netip" + "slices" + "sync" + "time" "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/pickfirst/internal" "google.golang.org/grpc/connectivity" + expstats "google.golang.org/grpc/experimental/stats" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/balancer/weight" "google.golang.org/grpc/internal/envconfig" internalgrpclog "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/pretty" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" - - _ "google.golang.org/grpc/balancer/pickfirst/pickfirstleaf" // For automatically registering the new pickfirst if required. ) func init() { - if envconfig.NewPickFirstEnabled { - return - } balancer.Register(pickfirstBuilder{}) } -var logger = grpclog.Component("pick-first-lb") +// Name is the name of the pick_first balancer. +const Name = "pick_first" + +// enableHealthListenerKeyType is a unique key type used in resolver +// attributes to indicate whether the health listener usage is enabled. +type enableHealthListenerKeyType struct{} + +var ( + logger = grpclog.Component("pick-first-leaf-lb") + disconnectionsMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ + Name: "grpc.lb.pick_first.disconnections", + Description: "EXPERIMENTAL. Number of times the selected subchannel becomes disconnected.", + Unit: "{disconnection}", + Labels: []string{"grpc.target"}, + Default: false, + }) + connectionAttemptsSucceededMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ + Name: "grpc.lb.pick_first.connection_attempts_succeeded", + Description: "EXPERIMENTAL. Number of successful connection attempts.", + Unit: "{attempt}", + Labels: []string{"grpc.target"}, + Default: false, + }) + connectionAttemptsFailedMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ + Name: "grpc.lb.pick_first.connection_attempts_failed", + Description: "EXPERIMENTAL. Number of failed connection attempts.", + Unit: "{attempt}", + Labels: []string{"grpc.target"}, + Default: false, + }) +) const ( - // Name is the name of the pick_first balancer. - Name = "pick_first" - logPrefix = "[pick-first-lb %p] " + // TODO: change to pick-first when this becomes the default pick_first policy. + logPrefix = "[pick-first-leaf-lb %p] " + // connectionDelayInterval is the time to wait for during the happy eyeballs + // pass before starting the next connection attempt. + connectionDelayInterval = 250 * time.Millisecond +) + +type ipAddrFamily int + +const ( + // ipAddrFamilyUnknown represents strings that can't be parsed as an IP + // address. + ipAddrFamilyUnknown ipAddrFamily = iota + ipAddrFamilyV4 + ipAddrFamilyV6 ) type pickfirstBuilder struct{} -func (pickfirstBuilder) Build(cc balancer.ClientConn, _ balancer.BuildOptions) balancer.Balancer { - b := &pickfirstBalancer{cc: cc} +func (pickfirstBuilder) Build(cc balancer.ClientConn, bo balancer.BuildOptions) balancer.Balancer { + b := &pickfirstBalancer{ + cc: cc, + target: bo.Target.String(), + metricsRecorder: cc.MetricsRecorder(), + + subConns: resolver.NewAddressMapV2[*scData](), + state: connectivity.Connecting, + cancelConnectionTimer: func() {}, + } b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) return b } -func (pickfirstBuilder) Name() string { +func (b pickfirstBuilder) Name() string { return Name } +func (pickfirstBuilder) ParseConfig(js json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { + var cfg pfConfig + if err := json.Unmarshal(js, &cfg); err != nil { + return nil, fmt.Errorf("pickfirst: unable to unmarshal LB policy config: %s, error: %v", string(js), err) + } + return cfg, nil +} + +// EnableHealthListener updates the state to configure pickfirst for using a +// generic health listener. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a later +// release. +func EnableHealthListener(state resolver.State) resolver.State { + state.Attributes = state.Attributes.WithValue(enableHealthListenerKeyType{}, true) + return state +} + type pfConfig struct { serviceconfig.LoadBalancingConfig `json:"-"` @@ -74,90 +148,163 @@ type pfConfig struct { ShuffleAddressList bool `json:"shuffleAddressList"` } -func (pickfirstBuilder) ParseConfig(js json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { - var cfg pfConfig - if err := json.Unmarshal(js, &cfg); err != nil { - return nil, fmt.Errorf("pickfirst: unable to unmarshal LB policy config: %s, error: %v", string(js), err) +// scData keeps track of the current state of the subConn. +// It is not safe for concurrent access. +type scData struct { + // The following fields are initialized at build time and read-only after + // that. + subConn balancer.SubConn + addr resolver.Address + + rawConnectivityState connectivity.State + // The effective connectivity state based on raw connectivity, health state + // and after following sticky TransientFailure behaviour defined in A62. + effectiveState connectivity.State + lastErr error + connectionFailedInFirstPass bool +} + +func (b *pickfirstBalancer) newSCData(addr resolver.Address) (*scData, error) { + sd := &scData{ + rawConnectivityState: connectivity.Idle, + effectiveState: connectivity.Idle, + addr: addr, } - return cfg, nil + sc, err := b.cc.NewSubConn([]resolver.Address{addr}, balancer.NewSubConnOptions{ + StateListener: func(state balancer.SubConnState) { + b.updateSubConnState(sd, state) + }, + }) + if err != nil { + return nil, err + } + sd.subConn = sc + return sd, nil } type pickfirstBalancer struct { - logger *internalgrpclog.PrefixLogger - state connectivity.State - cc balancer.ClientConn - subConn balancer.SubConn + // The following fields are initialized at build time and read-only after + // that and therefore do not need to be guarded by a mutex. + logger *internalgrpclog.PrefixLogger + cc balancer.ClientConn + target string + metricsRecorder expstats.MetricsRecorder // guaranteed to be non nil + + // The mutex is used to ensure synchronization of updates triggered + // from the idle picker and the already serialized resolver, + // SubConn state updates. + mu sync.Mutex + // State reported to the channel based on SubConn states and resolver + // updates. + state connectivity.State + // scData for active subonns mapped by address. + subConns *resolver.AddressMapV2[*scData] + addressList addressList + firstPass bool + numTF int + cancelConnectionTimer func() + healthCheckingEnabled bool } +// ResolverError is called by the ClientConn when the name resolver produces +// an error or when pickfirst determined the resolver update to be invalid. func (b *pickfirstBalancer) ResolverError(err error) { + b.mu.Lock() + defer b.mu.Unlock() + b.resolverErrorLocked(err) +} + +func (b *pickfirstBalancer) resolverErrorLocked(err error) { if b.logger.V(2) { b.logger.Infof("Received error from the name resolver: %v", err) } - if b.subConn == nil { - b.state = connectivity.TransientFailure - } - if b.state != connectivity.TransientFailure { - // The picker will not change since the balancer does not currently - // report an error. + // The picker will not change since the balancer does not currently + // report an error. If the balancer hasn't received a single good resolver + // update yet, transition to TRANSIENT_FAILURE. + if b.state != connectivity.TransientFailure && b.addressList.size() > 0 { + if b.logger.V(2) { + b.logger.Infof("Ignoring resolver error because balancer is using a previous good update.") + } return } - b.cc.UpdateState(balancer.State{ + + b.updateBalancerState(balancer.State{ ConnectivityState: connectivity.TransientFailure, Picker: &picker{err: fmt.Errorf("name resolver error: %v", err)}, }) } -// Shuffler is an interface for shuffling an address list. -type Shuffler interface { - ShuffleAddressListForTesting(n int, swap func(i, j int)) -} - -// ShuffleAddressListForTesting pseudo-randomizes the order of addresses. n -// is the number of elements. swap swaps the elements with indexes i and j. -func ShuffleAddressListForTesting(n int, swap func(i, j int)) { rand.Shuffle(n, swap) } - func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState) error { + b.mu.Lock() + defer b.mu.Unlock() + b.cancelConnectionTimer() if len(state.ResolverState.Addresses) == 0 && len(state.ResolverState.Endpoints) == 0 { - // The resolver reported an empty address list. Treat it like an error by - // calling b.ResolverError. - if b.subConn != nil { - // Shut down the old subConn. All addresses were removed, so it is - // no longer valid. - b.subConn.Shutdown() - b.subConn = nil - } - b.ResolverError(errors.New("produced zero addresses")) + // Cleanup state pertaining to the previous resolver state. + // Treat an empty address list like an error by calling b.ResolverError. + b.closeSubConnsLocked() + b.addressList.updateAddrs(nil) + b.resolverErrorLocked(errors.New("produced zero addresses")) return balancer.ErrBadResolverState } - // We don't have to guard this block with the env var because ParseConfig - // already does so. + b.healthCheckingEnabled = state.ResolverState.Attributes.Value(enableHealthListenerKeyType{}) != nil cfg, ok := state.BalancerConfig.(pfConfig) if state.BalancerConfig != nil && !ok { - return fmt.Errorf("pickfirst: received illegal BalancerConfig (type %T): %v", state.BalancerConfig, state.BalancerConfig) + return fmt.Errorf("pickfirst: received illegal BalancerConfig (type %T): %v: %w", state.BalancerConfig, state.BalancerConfig, balancer.ErrBadResolverState) } if b.logger.V(2) { b.logger.Infof("Received new config %s, resolver state %s", pretty.ToJSON(cfg), pretty.ToJSON(state.ResolverState)) } - var addrs []resolver.Address + var newAddrs []resolver.Address if endpoints := state.ResolverState.Endpoints; len(endpoints) != 0 { - // Perform the optional shuffling described in gRFC A62. The shuffling will - // change the order of endpoints but not touch the order of the addresses - // within each endpoint. - A61 + // Perform the optional shuffling described in gRFC A62. The shuffling + // will change the order of endpoints but not touch the order of the + // addresses within each endpoint. - A61 if cfg.ShuffleAddressList { - endpoints = append([]resolver.Endpoint{}, endpoints...) - internal.RandShuffle(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) + if envconfig.PickFirstWeightedShuffling { + type weightedEndpoint struct { + endpoint resolver.Endpoint + weight float64 + } + + // For each endpoint, compute a key as described in A113 and + // https://utopia.duth.gr/~pefraimi/research/data/2007EncOfAlg.pdf: + var weightedEndpoints []weightedEndpoint + for _, endpoint := range endpoints { + u := internal.RandFloat64() // Random number in [0.0, 1.0) + weight := weightAttribute(endpoint) + weightedEndpoints = append(weightedEndpoints, weightedEndpoint{ + endpoint: endpoint, + weight: math.Pow(u, 1.0/float64(weight)), + }) + } + // Sort endpoints by key in descending order and reconstruct the + // endpoints slice. + slices.SortFunc(weightedEndpoints, func(a, b weightedEndpoint) int { + return cmp.Compare(b.weight, a.weight) + }) + + // Here, and in the "else" block below, we clone the endpoints + // slice to avoid mutating the resolver state. Doing the latter + // would lead to data races if the caller is accessing the same + // slice concurrently. + sortedEndpoints := make([]resolver.Endpoint, len(endpoints)) + for i, we := range weightedEndpoints { + sortedEndpoints[i] = we.endpoint + } + endpoints = sortedEndpoints + } else { + endpoints = slices.Clone(endpoints) + internal.RandShuffle(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) + } } - // "Flatten the list by concatenating the ordered list of addresses for each - // of the endpoints, in order." - A61 + // "Flatten the list by concatenating the ordered list of addresses for + // each of the endpoints, in order." - A61 for _, endpoint := range endpoints { - // "In the flattened list, interleave addresses from the two address - // families, as per RFC-8304 section 4." - A61 - // TODO: support the above language. - addrs = append(addrs, endpoint.Addresses...) + newAddrs = append(newAddrs, endpoint.Addresses...) } } else { // Endpoints not set, process addresses until we migrate resolver @@ -166,42 +313,53 @@ func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState // target do not forward the corresponding correct endpoints down/split // endpoints properly. Once all balancers correctly forward endpoints // down, can delete this else conditional. - addrs = state.ResolverState.Addresses + newAddrs = state.ResolverState.Addresses if cfg.ShuffleAddressList { - addrs = append([]resolver.Address{}, addrs...) - rand.Shuffle(len(addrs), func(i, j int) { addrs[i], addrs[j] = addrs[j], addrs[i] }) + newAddrs = append([]resolver.Address{}, newAddrs...) + internal.RandShuffle(len(newAddrs), func(i, j int) { newAddrs[i], newAddrs[j] = newAddrs[j], newAddrs[i] }) } } - if b.subConn != nil { - b.cc.UpdateAddresses(b.subConn, addrs) + // If an address appears in multiple endpoints or in the same endpoint + // multiple times, we keep it only once. We will create only one SubConn + // for the address because an AddressMap is used to store SubConns. + // Not de-duplicating would result in attempting to connect to the same + // SubConn multiple times in the same pass. We don't want this. + newAddrs = deDupAddresses(newAddrs) + newAddrs = interleaveAddresses(newAddrs) + + prevAddr := b.addressList.currentAddress() + prevSCData, found := b.subConns.Get(prevAddr) + prevAddrsCount := b.addressList.size() + isPrevRawConnectivityStateReady := found && prevSCData.rawConnectivityState == connectivity.Ready + b.addressList.updateAddrs(newAddrs) + + // If the previous ready SubConn exists in new address list, + // keep this connection and don't create new SubConns. + if isPrevRawConnectivityStateReady && b.addressList.seekTo(prevAddr) { return nil } - var subConn balancer.SubConn - subConn, err := b.cc.NewSubConn(addrs, balancer.NewSubConnOptions{ - StateListener: func(state balancer.SubConnState) { - b.updateSubConnState(subConn, state) - }, - }) - if err != nil { - if b.logger.V(2) { - b.logger.Infof("Failed to create new SubConn: %v", err) - } - b.state = connectivity.TransientFailure - b.cc.UpdateState(balancer.State{ - ConnectivityState: connectivity.TransientFailure, - Picker: &picker{err: fmt.Errorf("error creating connection: %v", err)}, + b.reconcileSubConnsLocked(newAddrs) + // If it's the first resolver update or the balancer was already READY + // (but the new address list does not contain the ready SubConn) or + // CONNECTING, enter CONNECTING. + // We may be in TRANSIENT_FAILURE due to a previous empty address list, + // we should still enter CONNECTING because the sticky TF behaviour + // mentioned in A62 applies only when the TRANSIENT_FAILURE is reported + // due to connectivity failures. + if isPrevRawConnectivityStateReady || b.state == connectivity.Connecting || prevAddrsCount == 0 { + // Start connection attempt at first address. + b.forceUpdateConcludedStateLocked(balancer.State{ + ConnectivityState: connectivity.Connecting, + Picker: &picker{err: balancer.ErrNoSubConnAvailable}, }) - return balancer.ErrBadResolverState + b.startFirstPassLocked() + } else if b.state == connectivity.TransientFailure { + // If we're in TRANSIENT_FAILURE, we stay in TRANSIENT_FAILURE until + // we're READY. See A62. + b.startFirstPassLocked() } - b.subConn = subConn - b.state = connectivity.Idle - b.cc.UpdateState(balancer.State{ - ConnectivityState: connectivity.Connecting, - Picker: &picker{err: balancer.ErrNoSubConnAvailable}, - }) - b.subConn.Connect() return nil } @@ -211,63 +369,484 @@ func (b *pickfirstBalancer) UpdateSubConnState(subConn balancer.SubConn, state b b.logger.Errorf("UpdateSubConnState(%v, %+v) called unexpectedly", subConn, state) } -func (b *pickfirstBalancer) updateSubConnState(subConn balancer.SubConn, state balancer.SubConnState) { - if b.logger.V(2) { - b.logger.Infof("Received SubConn state update: %p, %+v", subConn, state) +func (b *pickfirstBalancer) Close() { + b.mu.Lock() + defer b.mu.Unlock() + b.closeSubConnsLocked() + b.cancelConnectionTimer() + b.state = connectivity.Shutdown +} + +// ExitIdle moves the balancer out of idle state. It can be called concurrently +// by the idlePicker and clientConn so access to variables should be +// synchronized. +func (b *pickfirstBalancer) ExitIdle() { + b.mu.Lock() + defer b.mu.Unlock() + if b.state == connectivity.Idle { + // Move the balancer into CONNECTING state immediately. This is done to + // avoid staying in IDLE if a resolver update arrives before the first + // SubConn reports CONNECTING. + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.Connecting, + Picker: &picker{err: balancer.ErrNoSubConnAvailable}, + }) + b.startFirstPassLocked() + } +} + +func (b *pickfirstBalancer) startFirstPassLocked() { + b.firstPass = true + b.numTF = 0 + // Reset the connection attempt record for existing SubConns. + for _, sd := range b.subConns.Values() { + sd.connectionFailedInFirstPass = false } - if b.subConn != subConn { + b.requestConnectionLocked() +} + +func (b *pickfirstBalancer) closeSubConnsLocked() { + for _, sd := range b.subConns.Values() { + sd.subConn.Shutdown() + } + b.subConns = resolver.NewAddressMapV2[*scData]() +} + +// deDupAddresses ensures that each address appears only once in the slice. +func deDupAddresses(addrs []resolver.Address) []resolver.Address { + seenAddrs := resolver.NewAddressMapV2[bool]() + retAddrs := []resolver.Address{} + + for _, addr := range addrs { + if _, ok := seenAddrs.Get(addr); ok { + continue + } + seenAddrs.Set(addr, true) + retAddrs = append(retAddrs, addr) + } + return retAddrs +} + +// interleaveAddresses interleaves addresses of both families (IPv4 and IPv6) +// as per RFC-8305 section 4. +// Whichever address family is first in the list is followed by an address of +// the other address family; that is, if the first address in the list is IPv6, +// then the first IPv4 address should be moved up in the list to be second in +// the list. It doesn't support configuring "First Address Family Count", i.e. +// there will always be a single member of the first address family at the +// beginning of the interleaved list. +// Addresses that are neither IPv4 nor IPv6 are treated as part of a third +// "unknown" family for interleaving. +// See: https://datatracker.ietf.org/doc/html/rfc8305#autoid-6 +func interleaveAddresses(addrs []resolver.Address) []resolver.Address { + familyAddrsMap := map[ipAddrFamily][]resolver.Address{} + interleavingOrder := []ipAddrFamily{} + for _, addr := range addrs { + family := addressFamily(addr.Addr) + if _, found := familyAddrsMap[family]; !found { + interleavingOrder = append(interleavingOrder, family) + } + familyAddrsMap[family] = append(familyAddrsMap[family], addr) + } + + interleavedAddrs := make([]resolver.Address, 0, len(addrs)) + + for curFamilyIdx := 0; len(interleavedAddrs) < len(addrs); curFamilyIdx = (curFamilyIdx + 1) % len(interleavingOrder) { + // Some IP types may have fewer addresses than others, so we look for + // the next type that has a remaining member to add to the interleaved + // list. + family := interleavingOrder[curFamilyIdx] + remainingMembers := familyAddrsMap[family] + if len(remainingMembers) > 0 { + interleavedAddrs = append(interleavedAddrs, remainingMembers[0]) + familyAddrsMap[family] = remainingMembers[1:] + } + } + + return interleavedAddrs +} + +// addressFamily returns the ipAddrFamily after parsing the address string. +// If the address isn't of the format "ip-address:port", it returns +// ipAddrFamilyUnknown. The address may be valid even if it's not an IP when +// using a resolver like passthrough where the address may be a hostname in +// some format that the dialer can resolve. +func addressFamily(address string) ipAddrFamily { + // Parse the IP after removing the port. + host, _, err := net.SplitHostPort(address) + if err != nil { + return ipAddrFamilyUnknown + } + ip, err := netip.ParseAddr(host) + if err != nil { + return ipAddrFamilyUnknown + } + switch { + case ip.Is4() || ip.Is4In6(): + return ipAddrFamilyV4 + case ip.Is6(): + return ipAddrFamilyV6 + default: + return ipAddrFamilyUnknown + } +} + +// reconcileSubConnsLocked updates the active subchannels based on a new address +// list from the resolver. It does this by: +// - closing subchannels: any existing subchannels associated with addresses +// that are no longer in the updated list are shut down. +// - removing subchannels: entries for these closed subchannels are removed +// from the subchannel map. +// +// This ensures that the subchannel map accurately reflects the current set of +// addresses received from the name resolver. +func (b *pickfirstBalancer) reconcileSubConnsLocked(newAddrs []resolver.Address) { + newAddrsMap := resolver.NewAddressMapV2[bool]() + for _, addr := range newAddrs { + newAddrsMap.Set(addr, true) + } + + for _, oldAddr := range b.subConns.Keys() { + if _, ok := newAddrsMap.Get(oldAddr); ok { + continue + } + val, _ := b.subConns.Get(oldAddr) + val.subConn.Shutdown() + b.subConns.Delete(oldAddr) + } +} + +// shutdownRemainingLocked shuts down remaining subConns. Called when a subConn +// becomes ready, which means that all other subConn must be shutdown. +func (b *pickfirstBalancer) shutdownRemainingLocked(selected *scData) { + b.cancelConnectionTimer() + for _, sd := range b.subConns.Values() { + if sd.subConn != selected.subConn { + sd.subConn.Shutdown() + } + } + b.subConns = resolver.NewAddressMapV2[*scData]() + b.subConns.Set(selected.addr, selected) +} + +// requestConnectionLocked starts connecting on the subchannel corresponding to +// the current address. If no subchannel exists, one is created. If the current +// subchannel is in TransientFailure, a connection to the next address is +// attempted until a subchannel is found. +func (b *pickfirstBalancer) requestConnectionLocked() { + if !b.addressList.isValid() { + return + } + var lastErr error + for valid := true; valid; valid = b.addressList.increment() { + curAddr := b.addressList.currentAddress() + sd, ok := b.subConns.Get(curAddr) + if !ok { + var err error + // We want to assign the new scData to sd from the outer scope, + // hence we can't use := below. + sd, err = b.newSCData(curAddr) + if err != nil { + // This should never happen, unless the clientConn is being shut + // down. + if b.logger.V(2) { + b.logger.Infof("Failed to create a subConn for address %v: %v", curAddr.String(), err) + } + // Do nothing, the LB policy will be closed soon. + return + } + b.subConns.Set(curAddr, sd) + } + + switch sd.rawConnectivityState { + case connectivity.Idle: + sd.subConn.Connect() + b.scheduleNextConnectionLocked() + return + case connectivity.TransientFailure: + // The SubConn is being re-used and failed during a previous pass + // over the addressList. It has not completed backoff yet. + // Mark it as having failed and try the next address. + sd.connectionFailedInFirstPass = true + lastErr = sd.lastErr + continue + case connectivity.Connecting: + // Wait for the connection attempt to complete or the timer to fire + // before attempting the next address. + b.scheduleNextConnectionLocked() + return + default: + b.logger.Errorf("SubConn with unexpected state %v present in SubConns map.", sd.rawConnectivityState) + return + + } + } + + // All the remaining addresses in the list are in TRANSIENT_FAILURE, end the + // first pass if possible. + b.endFirstPassIfPossibleLocked(lastErr) +} + +func (b *pickfirstBalancer) scheduleNextConnectionLocked() { + b.cancelConnectionTimer() + if !b.addressList.hasNext() { + return + } + curAddr := b.addressList.currentAddress() + cancelled := false // Access to this is protected by the balancer's mutex. + closeFn := internal.TimeAfterFunc(connectionDelayInterval, func() { + b.mu.Lock() + defer b.mu.Unlock() + // If the scheduled task is cancelled while acquiring the mutex, return. + if cancelled { + return + } if b.logger.V(2) { - b.logger.Infof("Ignored state change because subConn is not recognized") + b.logger.Infof("Happy Eyeballs timer expired while waiting for connection to %q.", curAddr.Addr) + } + if b.addressList.increment() { + b.requestConnectionLocked() } + }) + // Access to the cancellation callback held by the balancer is guarded by + // the balancer's mutex, so it's safe to set the boolean from the callback. + b.cancelConnectionTimer = sync.OnceFunc(func() { + cancelled = true + closeFn() + }) +} + +func (b *pickfirstBalancer) updateSubConnState(sd *scData, newState balancer.SubConnState) { + b.mu.Lock() + defer b.mu.Unlock() + oldState := sd.rawConnectivityState + sd.rawConnectivityState = newState.ConnectivityState + // Previously relevant SubConns can still callback with state updates. + // To prevent pickers from returning these obsolete SubConns, this logic + // is included to check if the current list of active SubConns includes this + // SubConn. + if !b.isActiveSCData(sd) { return } - if state.ConnectivityState == connectivity.Shutdown { - b.subConn = nil + if newState.ConnectivityState == connectivity.Shutdown { + sd.effectiveState = connectivity.Shutdown return } - switch state.ConnectivityState { - case connectivity.Ready: - b.cc.UpdateState(balancer.State{ - ConnectivityState: state.ConnectivityState, - Picker: &picker{result: balancer.PickResult{SubConn: subConn}}, - }) - case connectivity.Connecting: - if b.state == connectivity.TransientFailure { - // We stay in TransientFailure until we are Ready. See A62. + // Record a connection attempt when exiting CONNECTING. + if newState.ConnectivityState == connectivity.TransientFailure { + sd.connectionFailedInFirstPass = true + connectionAttemptsFailedMetric.Record(b.metricsRecorder, 1, b.target) + } + + if newState.ConnectivityState == connectivity.Ready { + connectionAttemptsSucceededMetric.Record(b.metricsRecorder, 1, b.target) + b.shutdownRemainingLocked(sd) + if !b.addressList.seekTo(sd.addr) { + // This should not fail as we should have only one SubConn after + // entering READY. The SubConn should be present in the addressList. + b.logger.Errorf("Address %q not found address list in %v", sd.addr, b.addressList.addresses) + return + } + if !b.healthCheckingEnabled { + if b.logger.V(2) { + b.logger.Infof("SubConn %p reported connectivity state READY and the health listener is disabled. Transitioning SubConn to READY.", sd.subConn) + } + + sd.effectiveState = connectivity.Ready + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.Ready, + Picker: &picker{result: balancer.PickResult{SubConn: sd.subConn}}, + }) return } - b.cc.UpdateState(balancer.State{ - ConnectivityState: state.ConnectivityState, + if b.logger.V(2) { + b.logger.Infof("SubConn %p reported connectivity state READY. Registering health listener.", sd.subConn) + } + // Send a CONNECTING update to take the SubConn out of sticky-TF if + // required. + sd.effectiveState = connectivity.Connecting + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.Connecting, Picker: &picker{err: balancer.ErrNoSubConnAvailable}, }) + sd.subConn.RegisterHealthListener(func(scs balancer.SubConnState) { + b.updateSubConnHealthState(sd, scs) + }) + return + } + + // If the LB policy is READY, and it receives a subchannel state change, + // it means that the READY subchannel has failed. + // A SubConn can also transition from CONNECTING directly to IDLE when + // a transport is successfully created, but the connection fails + // before the SubConn can send the notification for READY. We treat + // this as a successful connection and transition to IDLE. + // TODO: https://github.com/grpc/grpc-go/issues/7862 - Remove the second + // part of the if condition below once the issue is fixed. + if oldState == connectivity.Ready || (oldState == connectivity.Connecting && newState.ConnectivityState == connectivity.Idle) { + // Once a transport fails, the balancer enters IDLE and starts from + // the first address when the picker is used. + b.shutdownRemainingLocked(sd) + sd.effectiveState = newState.ConnectivityState + // READY SubConn interspliced in between CONNECTING and IDLE, need to + // account for that. + if oldState == connectivity.Connecting { + // A known issue (https://github.com/grpc/grpc-go/issues/7862) + // causes a race that prevents the READY state change notification. + // This works around it. + connectionAttemptsSucceededMetric.Record(b.metricsRecorder, 1, b.target) + } + disconnectionsMetric.Record(b.metricsRecorder, 1, b.target) + b.addressList.reset() + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.Idle, + Picker: &idlePicker{exitIdle: sync.OnceFunc(b.ExitIdle)}, + }) + return + } + + if b.firstPass { + switch newState.ConnectivityState { + case connectivity.Connecting: + // The effective state can be in either IDLE, CONNECTING or + // TRANSIENT_FAILURE. If it's TRANSIENT_FAILURE, stay in + // TRANSIENT_FAILURE until it's READY. See A62. + if sd.effectiveState != connectivity.TransientFailure { + sd.effectiveState = connectivity.Connecting + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.Connecting, + Picker: &picker{err: balancer.ErrNoSubConnAvailable}, + }) + } + case connectivity.TransientFailure: + sd.lastErr = newState.ConnectionError + sd.effectiveState = connectivity.TransientFailure + // Since we're re-using common SubConns while handling resolver + // updates, we could receive an out of turn TRANSIENT_FAILURE from + // a pass over the previous address list. Happy Eyeballs will also + // cause out of order updates to arrive. + + if curAddr := b.addressList.currentAddress(); equalAddressIgnoringBalAttributes(&curAddr, &sd.addr) { + b.cancelConnectionTimer() + if b.addressList.increment() { + b.requestConnectionLocked() + return + } + } + + // End the first pass if we've seen a TRANSIENT_FAILURE from all + // SubConns once. + b.endFirstPassIfPossibleLocked(newState.ConnectionError) + } + return + } + + // We have finished the first pass, keep re-connecting failing SubConns. + switch newState.ConnectivityState { + case connectivity.TransientFailure: + b.numTF = (b.numTF + 1) % b.subConns.Len() + sd.lastErr = newState.ConnectionError + if b.numTF%b.subConns.Len() == 0 { + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.TransientFailure, + Picker: &picker{err: newState.ConnectionError}, + }) + } + // We don't need to request re-resolution since the SubConn already + // does that before reporting TRANSIENT_FAILURE. + // TODO: #7534 - Move re-resolution requests from SubConn into + // pick_first. case connectivity.Idle: - if b.state == connectivity.TransientFailure { - // We stay in TransientFailure until we are Ready. Also kick the - // subConn out of Idle into Connecting. See A62. - b.subConn.Connect() + sd.subConn.Connect() + } +} + +// endFirstPassIfPossibleLocked ends the first happy-eyeballs pass if all the +// addresses are tried and their SubConns have reported a failure. +func (b *pickfirstBalancer) endFirstPassIfPossibleLocked(lastErr error) { + // An optimization to avoid iterating over the entire SubConn map. + if b.addressList.isValid() { + return + } + // Connect() has been called on all the SubConns. The first pass can be + // ended if all the SubConns have reported a failure. + for _, sd := range b.subConns.Values() { + if !sd.connectionFailedInFirstPass { return } - b.cc.UpdateState(balancer.State{ - ConnectivityState: state.ConnectivityState, - Picker: &idlePicker{subConn: subConn}, + } + b.firstPass = false + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.TransientFailure, + Picker: &picker{err: lastErr}, + }) + // Start re-connecting all the SubConns that are already in IDLE. + for _, sd := range b.subConns.Values() { + if sd.rawConnectivityState == connectivity.Idle { + sd.subConn.Connect() + } + } +} + +func (b *pickfirstBalancer) isActiveSCData(sd *scData) bool { + activeSD, found := b.subConns.Get(sd.addr) + return found && activeSD == sd +} + +func (b *pickfirstBalancer) updateSubConnHealthState(sd *scData, state balancer.SubConnState) { + b.mu.Lock() + defer b.mu.Unlock() + // Previously relevant SubConns can still callback with state updates. + // To prevent pickers from returning these obsolete SubConns, this logic + // is included to check if the current list of active SubConns includes + // this SubConn. + if !b.isActiveSCData(sd) { + return + } + sd.effectiveState = state.ConnectivityState + switch state.ConnectivityState { + case connectivity.Ready: + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.Ready, + Picker: &picker{result: balancer.PickResult{SubConn: sd.subConn}}, }) case connectivity.TransientFailure: - b.cc.UpdateState(balancer.State{ - ConnectivityState: state.ConnectivityState, - Picker: &picker{err: state.ConnectionError}, + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.TransientFailure, + Picker: &picker{err: fmt.Errorf("pickfirst: health check failure: %v", state.ConnectionError)}, + }) + case connectivity.Connecting: + b.updateBalancerState(balancer.State{ + ConnectivityState: connectivity.Connecting, + Picker: &picker{err: balancer.ErrNoSubConnAvailable}, }) + default: + b.logger.Errorf("Got unexpected health update for SubConn %p: %v", state) } - b.state = state.ConnectivityState } -func (b *pickfirstBalancer) Close() { +// updateBalancerState stores the state reported to the channel and calls +// ClientConn.UpdateState(). As an optimization, it avoids sending duplicate +// updates to the channel. +func (b *pickfirstBalancer) updateBalancerState(newState balancer.State) { + // In case of TransientFailures allow the picker to be updated to update + // the connectivity error, in all other cases don't send duplicate state + // updates. + if newState.ConnectivityState == b.state && b.state != connectivity.TransientFailure { + return + } + b.forceUpdateConcludedStateLocked(newState) } -func (b *pickfirstBalancer) ExitIdle() { - if b.subConn != nil && b.state == connectivity.Idle { - b.subConn.Connect() - } +// forceUpdateConcludedStateLocked stores the state reported to the channel and +// calls ClientConn.UpdateState(). +// A separate function is defined to force update the ClientConn state since the +// channel doesn't correctly assume that LB policies start in CONNECTING and +// relies on LB policy to send an initial CONNECTING update. +func (b *pickfirstBalancer) forceUpdateConcludedStateLocked(newState balancer.State) { + b.state = newState.ConnectivityState + b.cc.UpdateState(newState) } type picker struct { @@ -282,10 +861,101 @@ func (p *picker) Pick(balancer.PickInfo) (balancer.PickResult, error) { // idlePicker is used when the SubConn is IDLE and kicks the SubConn into // CONNECTING when Pick is called. type idlePicker struct { - subConn balancer.SubConn + exitIdle func() } func (i *idlePicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { - i.subConn.Connect() + i.exitIdle() return balancer.PickResult{}, balancer.ErrNoSubConnAvailable } + +// addressList manages sequentially iterating over addresses present in a list +// of endpoints. It provides a 1 dimensional view of the addresses present in +// the endpoints. +// This type is not safe for concurrent access. +type addressList struct { + addresses []resolver.Address + idx int +} + +func (al *addressList) isValid() bool { + return al.idx < len(al.addresses) +} + +func (al *addressList) size() int { + return len(al.addresses) +} + +// increment moves to the next index in the address list. +// This method returns false if it went off the list, true otherwise. +func (al *addressList) increment() bool { + if !al.isValid() { + return false + } + al.idx++ + return al.idx < len(al.addresses) +} + +// currentAddress returns the current address pointed to in the addressList. +// If the list is in an invalid state, it returns an empty address instead. +func (al *addressList) currentAddress() resolver.Address { + if !al.isValid() { + return resolver.Address{} + } + return al.addresses[al.idx] +} + +func (al *addressList) reset() { + al.idx = 0 +} + +func (al *addressList) updateAddrs(addrs []resolver.Address) { + al.addresses = addrs + al.reset() +} + +// seekTo returns false if the needle was not found and the current index was +// left unchanged. +func (al *addressList) seekTo(needle resolver.Address) bool { + for ai, addr := range al.addresses { + if !equalAddressIgnoringBalAttributes(&addr, &needle) { + continue + } + al.idx = ai + return true + } + return false +} + +// hasNext returns whether incrementing the addressList will result in moving +// past the end of the list. If the list has already moved past the end, it +// returns false. +func (al *addressList) hasNext() bool { + if !al.isValid() { + return false + } + return al.idx+1 < len(al.addresses) +} + +// equalAddressIgnoringBalAttributes returns true is a and b are considered +// equal. This is different from the Equal method on the resolver.Address type +// which considers all fields to determine equality. Here, we only consider +// fields that are meaningful to the SubConn. +func equalAddressIgnoringBalAttributes(a, b *resolver.Address) bool { + return a.Addr == b.Addr && a.ServerName == b.ServerName && + a.Attributes.Equal(b.Attributes) +} + +// weightAttribute is a convenience function which returns the value of the +// weight endpoint Attribute. +// +// When used in the xDS context, the weight attribute is guaranteed to be +// non-zero. But, when used in a non-xDS context, the weight attribute could be +// unset. A Default of 1 is used in the latter case. +func weightAttribute(e resolver.Endpoint) uint32 { + w := weight.FromEndpoint(e).Weight + if w == 0 { + return 1 + } + return w +} diff --git a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go b/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go deleted file mode 100644 index 494314f235..0000000000 --- a/vendor/google.golang.org/grpc/balancer/pickfirst/pickfirstleaf/pickfirstleaf.go +++ /dev/null @@ -1,927 +0,0 @@ -/* - * - * Copyright 2024 gRPC 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. - * - */ - -// Package pickfirstleaf contains the pick_first load balancing policy which -// will be the universal leaf policy after dualstack changes are implemented. -// -// # Experimental -// -// Notice: This package is EXPERIMENTAL and may be changed or removed in a -// later release. -package pickfirstleaf - -import ( - "encoding/json" - "errors" - "fmt" - "net" - "net/netip" - "sync" - "time" - - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/balancer/pickfirst/internal" - "google.golang.org/grpc/connectivity" - expstats "google.golang.org/grpc/experimental/stats" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/internal/envconfig" - internalgrpclog "google.golang.org/grpc/internal/grpclog" - "google.golang.org/grpc/internal/pretty" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/serviceconfig" -) - -func init() { - if envconfig.NewPickFirstEnabled { - // Register as the default pick_first balancer. - Name = "pick_first" - } - balancer.Register(pickfirstBuilder{}) -} - -type ( - // enableHealthListenerKeyType is a unique key type used in resolver - // attributes to indicate whether the health listener usage is enabled. - enableHealthListenerKeyType struct{} - // managedByPickfirstKeyType is an attribute key type to inform Outlier - // Detection that the generic health listener is being used. - // TODO: https://github.com/grpc/grpc-go/issues/7915 - Remove this when - // implementing the dualstack design. This is a hack. Once Dualstack is - // completed, outlier detection will stop sending ejection updates through - // the connectivity listener. - managedByPickfirstKeyType struct{} -) - -var ( - logger = grpclog.Component("pick-first-leaf-lb") - // Name is the name of the pick_first_leaf balancer. - // It is changed to "pick_first" in init() if this balancer is to be - // registered as the default pickfirst. - Name = "pick_first_leaf" - disconnectionsMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ - Name: "grpc.lb.pick_first.disconnections", - Description: "EXPERIMENTAL. Number of times the selected subchannel becomes disconnected.", - Unit: "disconnection", - Labels: []string{"grpc.target"}, - Default: false, - }) - connectionAttemptsSucceededMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ - Name: "grpc.lb.pick_first.connection_attempts_succeeded", - Description: "EXPERIMENTAL. Number of successful connection attempts.", - Unit: "attempt", - Labels: []string{"grpc.target"}, - Default: false, - }) - connectionAttemptsFailedMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ - Name: "grpc.lb.pick_first.connection_attempts_failed", - Description: "EXPERIMENTAL. Number of failed connection attempts.", - Unit: "attempt", - Labels: []string{"grpc.target"}, - Default: false, - }) -) - -const ( - // TODO: change to pick-first when this becomes the default pick_first policy. - logPrefix = "[pick-first-leaf-lb %p] " - // connectionDelayInterval is the time to wait for during the happy eyeballs - // pass before starting the next connection attempt. - connectionDelayInterval = 250 * time.Millisecond -) - -type ipAddrFamily int - -const ( - // ipAddrFamilyUnknown represents strings that can't be parsed as an IP - // address. - ipAddrFamilyUnknown ipAddrFamily = iota - ipAddrFamilyV4 - ipAddrFamilyV6 -) - -type pickfirstBuilder struct{} - -func (pickfirstBuilder) Build(cc balancer.ClientConn, bo balancer.BuildOptions) balancer.Balancer { - b := &pickfirstBalancer{ - cc: cc, - target: bo.Target.String(), - metricsRecorder: cc.MetricsRecorder(), - - subConns: resolver.NewAddressMapV2[*scData](), - state: connectivity.Connecting, - cancelConnectionTimer: func() {}, - } - b.logger = internalgrpclog.NewPrefixLogger(logger, fmt.Sprintf(logPrefix, b)) - return b -} - -func (b pickfirstBuilder) Name() string { - return Name -} - -func (pickfirstBuilder) ParseConfig(js json.RawMessage) (serviceconfig.LoadBalancingConfig, error) { - var cfg pfConfig - if err := json.Unmarshal(js, &cfg); err != nil { - return nil, fmt.Errorf("pickfirst: unable to unmarshal LB policy config: %s, error: %v", string(js), err) - } - return cfg, nil -} - -// EnableHealthListener updates the state to configure pickfirst for using a -// generic health listener. -func EnableHealthListener(state resolver.State) resolver.State { - state.Attributes = state.Attributes.WithValue(enableHealthListenerKeyType{}, true) - return state -} - -// IsManagedByPickfirst returns whether an address belongs to a SubConn -// managed by the pickfirst LB policy. -// TODO: https://github.com/grpc/grpc-go/issues/7915 - This is a hack to disable -// outlier_detection via the with connectivity listener when using pick_first. -// Once Dualstack changes are complete, all SubConns will be created by -// pick_first and outlier detection will only use the health listener for -// ejection. This hack can then be removed. -func IsManagedByPickfirst(addr resolver.Address) bool { - return addr.BalancerAttributes.Value(managedByPickfirstKeyType{}) != nil -} - -type pfConfig struct { - serviceconfig.LoadBalancingConfig `json:"-"` - - // If set to true, instructs the LB policy to shuffle the order of the list - // of endpoints received from the name resolver before attempting to - // connect to them. - ShuffleAddressList bool `json:"shuffleAddressList"` -} - -// scData keeps track of the current state of the subConn. -// It is not safe for concurrent access. -type scData struct { - // The following fields are initialized at build time and read-only after - // that. - subConn balancer.SubConn - addr resolver.Address - - rawConnectivityState connectivity.State - // The effective connectivity state based on raw connectivity, health state - // and after following sticky TransientFailure behaviour defined in A62. - effectiveState connectivity.State - lastErr error - connectionFailedInFirstPass bool -} - -func (b *pickfirstBalancer) newSCData(addr resolver.Address) (*scData, error) { - addr.BalancerAttributes = addr.BalancerAttributes.WithValue(managedByPickfirstKeyType{}, true) - sd := &scData{ - rawConnectivityState: connectivity.Idle, - effectiveState: connectivity.Idle, - addr: addr, - } - sc, err := b.cc.NewSubConn([]resolver.Address{addr}, balancer.NewSubConnOptions{ - StateListener: func(state balancer.SubConnState) { - b.updateSubConnState(sd, state) - }, - }) - if err != nil { - return nil, err - } - sd.subConn = sc - return sd, nil -} - -type pickfirstBalancer struct { - // The following fields are initialized at build time and read-only after - // that and therefore do not need to be guarded by a mutex. - logger *internalgrpclog.PrefixLogger - cc balancer.ClientConn - target string - metricsRecorder expstats.MetricsRecorder // guaranteed to be non nil - - // The mutex is used to ensure synchronization of updates triggered - // from the idle picker and the already serialized resolver, - // SubConn state updates. - mu sync.Mutex - // State reported to the channel based on SubConn states and resolver - // updates. - state connectivity.State - // scData for active subonns mapped by address. - subConns *resolver.AddressMapV2[*scData] - addressList addressList - firstPass bool - numTF int - cancelConnectionTimer func() - healthCheckingEnabled bool -} - -// ResolverError is called by the ClientConn when the name resolver produces -// an error or when pickfirst determined the resolver update to be invalid. -func (b *pickfirstBalancer) ResolverError(err error) { - b.mu.Lock() - defer b.mu.Unlock() - b.resolverErrorLocked(err) -} - -func (b *pickfirstBalancer) resolverErrorLocked(err error) { - if b.logger.V(2) { - b.logger.Infof("Received error from the name resolver: %v", err) - } - - // The picker will not change since the balancer does not currently - // report an error. If the balancer hasn't received a single good resolver - // update yet, transition to TRANSIENT_FAILURE. - if b.state != connectivity.TransientFailure && b.addressList.size() > 0 { - if b.logger.V(2) { - b.logger.Infof("Ignoring resolver error because balancer is using a previous good update.") - } - return - } - - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.TransientFailure, - Picker: &picker{err: fmt.Errorf("name resolver error: %v", err)}, - }) -} - -func (b *pickfirstBalancer) UpdateClientConnState(state balancer.ClientConnState) error { - b.mu.Lock() - defer b.mu.Unlock() - b.cancelConnectionTimer() - if len(state.ResolverState.Addresses) == 0 && len(state.ResolverState.Endpoints) == 0 { - // Cleanup state pertaining to the previous resolver state. - // Treat an empty address list like an error by calling b.ResolverError. - b.closeSubConnsLocked() - b.addressList.updateAddrs(nil) - b.resolverErrorLocked(errors.New("produced zero addresses")) - return balancer.ErrBadResolverState - } - b.healthCheckingEnabled = state.ResolverState.Attributes.Value(enableHealthListenerKeyType{}) != nil - cfg, ok := state.BalancerConfig.(pfConfig) - if state.BalancerConfig != nil && !ok { - return fmt.Errorf("pickfirst: received illegal BalancerConfig (type %T): %v: %w", state.BalancerConfig, state.BalancerConfig, balancer.ErrBadResolverState) - } - - if b.logger.V(2) { - b.logger.Infof("Received new config %s, resolver state %s", pretty.ToJSON(cfg), pretty.ToJSON(state.ResolverState)) - } - - var newAddrs []resolver.Address - if endpoints := state.ResolverState.Endpoints; len(endpoints) != 0 { - // Perform the optional shuffling described in gRFC A62. The shuffling - // will change the order of endpoints but not touch the order of the - // addresses within each endpoint. - A61 - if cfg.ShuffleAddressList { - endpoints = append([]resolver.Endpoint{}, endpoints...) - internal.RandShuffle(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) - } - - // "Flatten the list by concatenating the ordered list of addresses for - // each of the endpoints, in order." - A61 - for _, endpoint := range endpoints { - newAddrs = append(newAddrs, endpoint.Addresses...) - } - } else { - // Endpoints not set, process addresses until we migrate resolver - // emissions fully to Endpoints. The top channel does wrap emitted - // addresses with endpoints, however some balancers such as weighted - // target do not forward the corresponding correct endpoints down/split - // endpoints properly. Once all balancers correctly forward endpoints - // down, can delete this else conditional. - newAddrs = state.ResolverState.Addresses - if cfg.ShuffleAddressList { - newAddrs = append([]resolver.Address{}, newAddrs...) - internal.RandShuffle(len(endpoints), func(i, j int) { endpoints[i], endpoints[j] = endpoints[j], endpoints[i] }) - } - } - - // If an address appears in multiple endpoints or in the same endpoint - // multiple times, we keep it only once. We will create only one SubConn - // for the address because an AddressMap is used to store SubConns. - // Not de-duplicating would result in attempting to connect to the same - // SubConn multiple times in the same pass. We don't want this. - newAddrs = deDupAddresses(newAddrs) - newAddrs = interleaveAddresses(newAddrs) - - prevAddr := b.addressList.currentAddress() - prevSCData, found := b.subConns.Get(prevAddr) - prevAddrsCount := b.addressList.size() - isPrevRawConnectivityStateReady := found && prevSCData.rawConnectivityState == connectivity.Ready - b.addressList.updateAddrs(newAddrs) - - // If the previous ready SubConn exists in new address list, - // keep this connection and don't create new SubConns. - if isPrevRawConnectivityStateReady && b.addressList.seekTo(prevAddr) { - return nil - } - - b.reconcileSubConnsLocked(newAddrs) - // If it's the first resolver update or the balancer was already READY - // (but the new address list does not contain the ready SubConn) or - // CONNECTING, enter CONNECTING. - // We may be in TRANSIENT_FAILURE due to a previous empty address list, - // we should still enter CONNECTING because the sticky TF behaviour - // mentioned in A62 applies only when the TRANSIENT_FAILURE is reported - // due to connectivity failures. - if isPrevRawConnectivityStateReady || b.state == connectivity.Connecting || prevAddrsCount == 0 { - // Start connection attempt at first address. - b.forceUpdateConcludedStateLocked(balancer.State{ - ConnectivityState: connectivity.Connecting, - Picker: &picker{err: balancer.ErrNoSubConnAvailable}, - }) - b.startFirstPassLocked() - } else if b.state == connectivity.TransientFailure { - // If we're in TRANSIENT_FAILURE, we stay in TRANSIENT_FAILURE until - // we're READY. See A62. - b.startFirstPassLocked() - } - return nil -} - -// UpdateSubConnState is unused as a StateListener is always registered when -// creating SubConns. -func (b *pickfirstBalancer) UpdateSubConnState(subConn balancer.SubConn, state balancer.SubConnState) { - b.logger.Errorf("UpdateSubConnState(%v, %+v) called unexpectedly", subConn, state) -} - -func (b *pickfirstBalancer) Close() { - b.mu.Lock() - defer b.mu.Unlock() - b.closeSubConnsLocked() - b.cancelConnectionTimer() - b.state = connectivity.Shutdown -} - -// ExitIdle moves the balancer out of idle state. It can be called concurrently -// by the idlePicker and clientConn so access to variables should be -// synchronized. -func (b *pickfirstBalancer) ExitIdle() { - b.mu.Lock() - defer b.mu.Unlock() - if b.state == connectivity.Idle { - b.startFirstPassLocked() - } -} - -func (b *pickfirstBalancer) startFirstPassLocked() { - b.firstPass = true - b.numTF = 0 - // Reset the connection attempt record for existing SubConns. - for _, sd := range b.subConns.Values() { - sd.connectionFailedInFirstPass = false - } - b.requestConnectionLocked() -} - -func (b *pickfirstBalancer) closeSubConnsLocked() { - for _, sd := range b.subConns.Values() { - sd.subConn.Shutdown() - } - b.subConns = resolver.NewAddressMapV2[*scData]() -} - -// deDupAddresses ensures that each address appears only once in the slice. -func deDupAddresses(addrs []resolver.Address) []resolver.Address { - seenAddrs := resolver.NewAddressMapV2[*scData]() - retAddrs := []resolver.Address{} - - for _, addr := range addrs { - if _, ok := seenAddrs.Get(addr); ok { - continue - } - retAddrs = append(retAddrs, addr) - } - return retAddrs -} - -// interleaveAddresses interleaves addresses of both families (IPv4 and IPv6) -// as per RFC-8305 section 4. -// Whichever address family is first in the list is followed by an address of -// the other address family; that is, if the first address in the list is IPv6, -// then the first IPv4 address should be moved up in the list to be second in -// the list. It doesn't support configuring "First Address Family Count", i.e. -// there will always be a single member of the first address family at the -// beginning of the interleaved list. -// Addresses that are neither IPv4 nor IPv6 are treated as part of a third -// "unknown" family for interleaving. -// See: https://datatracker.ietf.org/doc/html/rfc8305#autoid-6 -func interleaveAddresses(addrs []resolver.Address) []resolver.Address { - familyAddrsMap := map[ipAddrFamily][]resolver.Address{} - interleavingOrder := []ipAddrFamily{} - for _, addr := range addrs { - family := addressFamily(addr.Addr) - if _, found := familyAddrsMap[family]; !found { - interleavingOrder = append(interleavingOrder, family) - } - familyAddrsMap[family] = append(familyAddrsMap[family], addr) - } - - interleavedAddrs := make([]resolver.Address, 0, len(addrs)) - - for curFamilyIdx := 0; len(interleavedAddrs) < len(addrs); curFamilyIdx = (curFamilyIdx + 1) % len(interleavingOrder) { - // Some IP types may have fewer addresses than others, so we look for - // the next type that has a remaining member to add to the interleaved - // list. - family := interleavingOrder[curFamilyIdx] - remainingMembers := familyAddrsMap[family] - if len(remainingMembers) > 0 { - interleavedAddrs = append(interleavedAddrs, remainingMembers[0]) - familyAddrsMap[family] = remainingMembers[1:] - } - } - - return interleavedAddrs -} - -// addressFamily returns the ipAddrFamily after parsing the address string. -// If the address isn't of the format "ip-address:port", it returns -// ipAddrFamilyUnknown. The address may be valid even if it's not an IP when -// using a resolver like passthrough where the address may be a hostname in -// some format that the dialer can resolve. -func addressFamily(address string) ipAddrFamily { - // Parse the IP after removing the port. - host, _, err := net.SplitHostPort(address) - if err != nil { - return ipAddrFamilyUnknown - } - ip, err := netip.ParseAddr(host) - if err != nil { - return ipAddrFamilyUnknown - } - switch { - case ip.Is4() || ip.Is4In6(): - return ipAddrFamilyV4 - case ip.Is6(): - return ipAddrFamilyV6 - default: - return ipAddrFamilyUnknown - } -} - -// reconcileSubConnsLocked updates the active subchannels based on a new address -// list from the resolver. It does this by: -// - closing subchannels: any existing subchannels associated with addresses -// that are no longer in the updated list are shut down. -// - removing subchannels: entries for these closed subchannels are removed -// from the subchannel map. -// -// This ensures that the subchannel map accurately reflects the current set of -// addresses received from the name resolver. -func (b *pickfirstBalancer) reconcileSubConnsLocked(newAddrs []resolver.Address) { - newAddrsMap := resolver.NewAddressMapV2[bool]() - for _, addr := range newAddrs { - newAddrsMap.Set(addr, true) - } - - for _, oldAddr := range b.subConns.Keys() { - if _, ok := newAddrsMap.Get(oldAddr); ok { - continue - } - val, _ := b.subConns.Get(oldAddr) - val.subConn.Shutdown() - b.subConns.Delete(oldAddr) - } -} - -// shutdownRemainingLocked shuts down remaining subConns. Called when a subConn -// becomes ready, which means that all other subConn must be shutdown. -func (b *pickfirstBalancer) shutdownRemainingLocked(selected *scData) { - b.cancelConnectionTimer() - for _, sd := range b.subConns.Values() { - if sd.subConn != selected.subConn { - sd.subConn.Shutdown() - } - } - b.subConns = resolver.NewAddressMapV2[*scData]() - b.subConns.Set(selected.addr, selected) -} - -// requestConnectionLocked starts connecting on the subchannel corresponding to -// the current address. If no subchannel exists, one is created. If the current -// subchannel is in TransientFailure, a connection to the next address is -// attempted until a subchannel is found. -func (b *pickfirstBalancer) requestConnectionLocked() { - if !b.addressList.isValid() { - return - } - var lastErr error - for valid := true; valid; valid = b.addressList.increment() { - curAddr := b.addressList.currentAddress() - sd, ok := b.subConns.Get(curAddr) - if !ok { - var err error - // We want to assign the new scData to sd from the outer scope, - // hence we can't use := below. - sd, err = b.newSCData(curAddr) - if err != nil { - // This should never happen, unless the clientConn is being shut - // down. - if b.logger.V(2) { - b.logger.Infof("Failed to create a subConn for address %v: %v", curAddr.String(), err) - } - // Do nothing, the LB policy will be closed soon. - return - } - b.subConns.Set(curAddr, sd) - } - - switch sd.rawConnectivityState { - case connectivity.Idle: - sd.subConn.Connect() - b.scheduleNextConnectionLocked() - return - case connectivity.TransientFailure: - // The SubConn is being re-used and failed during a previous pass - // over the addressList. It has not completed backoff yet. - // Mark it as having failed and try the next address. - sd.connectionFailedInFirstPass = true - lastErr = sd.lastErr - continue - case connectivity.Connecting: - // Wait for the connection attempt to complete or the timer to fire - // before attempting the next address. - b.scheduleNextConnectionLocked() - return - default: - b.logger.Errorf("SubConn with unexpected state %v present in SubConns map.", sd.rawConnectivityState) - return - - } - } - - // All the remaining addresses in the list are in TRANSIENT_FAILURE, end the - // first pass if possible. - b.endFirstPassIfPossibleLocked(lastErr) -} - -func (b *pickfirstBalancer) scheduleNextConnectionLocked() { - b.cancelConnectionTimer() - if !b.addressList.hasNext() { - return - } - curAddr := b.addressList.currentAddress() - cancelled := false // Access to this is protected by the balancer's mutex. - closeFn := internal.TimeAfterFunc(connectionDelayInterval, func() { - b.mu.Lock() - defer b.mu.Unlock() - // If the scheduled task is cancelled while acquiring the mutex, return. - if cancelled { - return - } - if b.logger.V(2) { - b.logger.Infof("Happy Eyeballs timer expired while waiting for connection to %q.", curAddr.Addr) - } - if b.addressList.increment() { - b.requestConnectionLocked() - } - }) - // Access to the cancellation callback held by the balancer is guarded by - // the balancer's mutex, so it's safe to set the boolean from the callback. - b.cancelConnectionTimer = sync.OnceFunc(func() { - cancelled = true - closeFn() - }) -} - -func (b *pickfirstBalancer) updateSubConnState(sd *scData, newState balancer.SubConnState) { - b.mu.Lock() - defer b.mu.Unlock() - oldState := sd.rawConnectivityState - sd.rawConnectivityState = newState.ConnectivityState - // Previously relevant SubConns can still callback with state updates. - // To prevent pickers from returning these obsolete SubConns, this logic - // is included to check if the current list of active SubConns includes this - // SubConn. - if !b.isActiveSCData(sd) { - return - } - if newState.ConnectivityState == connectivity.Shutdown { - sd.effectiveState = connectivity.Shutdown - return - } - - // Record a connection attempt when exiting CONNECTING. - if newState.ConnectivityState == connectivity.TransientFailure { - sd.connectionFailedInFirstPass = true - connectionAttemptsFailedMetric.Record(b.metricsRecorder, 1, b.target) - } - - if newState.ConnectivityState == connectivity.Ready { - connectionAttemptsSucceededMetric.Record(b.metricsRecorder, 1, b.target) - b.shutdownRemainingLocked(sd) - if !b.addressList.seekTo(sd.addr) { - // This should not fail as we should have only one SubConn after - // entering READY. The SubConn should be present in the addressList. - b.logger.Errorf("Address %q not found address list in %v", sd.addr, b.addressList.addresses) - return - } - if !b.healthCheckingEnabled { - if b.logger.V(2) { - b.logger.Infof("SubConn %p reported connectivity state READY and the health listener is disabled. Transitioning SubConn to READY.", sd.subConn) - } - - sd.effectiveState = connectivity.Ready - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.Ready, - Picker: &picker{result: balancer.PickResult{SubConn: sd.subConn}}, - }) - return - } - if b.logger.V(2) { - b.logger.Infof("SubConn %p reported connectivity state READY. Registering health listener.", sd.subConn) - } - // Send a CONNECTING update to take the SubConn out of sticky-TF if - // required. - sd.effectiveState = connectivity.Connecting - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.Connecting, - Picker: &picker{err: balancer.ErrNoSubConnAvailable}, - }) - sd.subConn.RegisterHealthListener(func(scs balancer.SubConnState) { - b.updateSubConnHealthState(sd, scs) - }) - return - } - - // If the LB policy is READY, and it receives a subchannel state change, - // it means that the READY subchannel has failed. - // A SubConn can also transition from CONNECTING directly to IDLE when - // a transport is successfully created, but the connection fails - // before the SubConn can send the notification for READY. We treat - // this as a successful connection and transition to IDLE. - // TODO: https://github.com/grpc/grpc-go/issues/7862 - Remove the second - // part of the if condition below once the issue is fixed. - if oldState == connectivity.Ready || (oldState == connectivity.Connecting && newState.ConnectivityState == connectivity.Idle) { - // Once a transport fails, the balancer enters IDLE and starts from - // the first address when the picker is used. - b.shutdownRemainingLocked(sd) - sd.effectiveState = newState.ConnectivityState - // READY SubConn interspliced in between CONNECTING and IDLE, need to - // account for that. - if oldState == connectivity.Connecting { - // A known issue (https://github.com/grpc/grpc-go/issues/7862) - // causes a race that prevents the READY state change notification. - // This works around it. - connectionAttemptsSucceededMetric.Record(b.metricsRecorder, 1, b.target) - } - disconnectionsMetric.Record(b.metricsRecorder, 1, b.target) - b.addressList.reset() - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.Idle, - Picker: &idlePicker{exitIdle: sync.OnceFunc(b.ExitIdle)}, - }) - return - } - - if b.firstPass { - switch newState.ConnectivityState { - case connectivity.Connecting: - // The effective state can be in either IDLE, CONNECTING or - // TRANSIENT_FAILURE. If it's TRANSIENT_FAILURE, stay in - // TRANSIENT_FAILURE until it's READY. See A62. - if sd.effectiveState != connectivity.TransientFailure { - sd.effectiveState = connectivity.Connecting - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.Connecting, - Picker: &picker{err: balancer.ErrNoSubConnAvailable}, - }) - } - case connectivity.TransientFailure: - sd.lastErr = newState.ConnectionError - sd.effectiveState = connectivity.TransientFailure - // Since we're re-using common SubConns while handling resolver - // updates, we could receive an out of turn TRANSIENT_FAILURE from - // a pass over the previous address list. Happy Eyeballs will also - // cause out of order updates to arrive. - - if curAddr := b.addressList.currentAddress(); equalAddressIgnoringBalAttributes(&curAddr, &sd.addr) { - b.cancelConnectionTimer() - if b.addressList.increment() { - b.requestConnectionLocked() - return - } - } - - // End the first pass if we've seen a TRANSIENT_FAILURE from all - // SubConns once. - b.endFirstPassIfPossibleLocked(newState.ConnectionError) - } - return - } - - // We have finished the first pass, keep re-connecting failing SubConns. - switch newState.ConnectivityState { - case connectivity.TransientFailure: - b.numTF = (b.numTF + 1) % b.subConns.Len() - sd.lastErr = newState.ConnectionError - if b.numTF%b.subConns.Len() == 0 { - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.TransientFailure, - Picker: &picker{err: newState.ConnectionError}, - }) - } - // We don't need to request re-resolution since the SubConn already - // does that before reporting TRANSIENT_FAILURE. - // TODO: #7534 - Move re-resolution requests from SubConn into - // pick_first. - case connectivity.Idle: - sd.subConn.Connect() - } -} - -// endFirstPassIfPossibleLocked ends the first happy-eyeballs pass if all the -// addresses are tried and their SubConns have reported a failure. -func (b *pickfirstBalancer) endFirstPassIfPossibleLocked(lastErr error) { - // An optimization to avoid iterating over the entire SubConn map. - if b.addressList.isValid() { - return - } - // Connect() has been called on all the SubConns. The first pass can be - // ended if all the SubConns have reported a failure. - for _, sd := range b.subConns.Values() { - if !sd.connectionFailedInFirstPass { - return - } - } - b.firstPass = false - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.TransientFailure, - Picker: &picker{err: lastErr}, - }) - // Start re-connecting all the SubConns that are already in IDLE. - for _, sd := range b.subConns.Values() { - if sd.rawConnectivityState == connectivity.Idle { - sd.subConn.Connect() - } - } -} - -func (b *pickfirstBalancer) isActiveSCData(sd *scData) bool { - activeSD, found := b.subConns.Get(sd.addr) - return found && activeSD == sd -} - -func (b *pickfirstBalancer) updateSubConnHealthState(sd *scData, state balancer.SubConnState) { - b.mu.Lock() - defer b.mu.Unlock() - // Previously relevant SubConns can still callback with state updates. - // To prevent pickers from returning these obsolete SubConns, this logic - // is included to check if the current list of active SubConns includes - // this SubConn. - if !b.isActiveSCData(sd) { - return - } - sd.effectiveState = state.ConnectivityState - switch state.ConnectivityState { - case connectivity.Ready: - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.Ready, - Picker: &picker{result: balancer.PickResult{SubConn: sd.subConn}}, - }) - case connectivity.TransientFailure: - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.TransientFailure, - Picker: &picker{err: fmt.Errorf("pickfirst: health check failure: %v", state.ConnectionError)}, - }) - case connectivity.Connecting: - b.updateBalancerState(balancer.State{ - ConnectivityState: connectivity.Connecting, - Picker: &picker{err: balancer.ErrNoSubConnAvailable}, - }) - default: - b.logger.Errorf("Got unexpected health update for SubConn %p: %v", state) - } -} - -// updateBalancerState stores the state reported to the channel and calls -// ClientConn.UpdateState(). As an optimization, it avoids sending duplicate -// updates to the channel. -func (b *pickfirstBalancer) updateBalancerState(newState balancer.State) { - // In case of TransientFailures allow the picker to be updated to update - // the connectivity error, in all other cases don't send duplicate state - // updates. - if newState.ConnectivityState == b.state && b.state != connectivity.TransientFailure { - return - } - b.forceUpdateConcludedStateLocked(newState) -} - -// forceUpdateConcludedStateLocked stores the state reported to the channel and -// calls ClientConn.UpdateState(). -// A separate function is defined to force update the ClientConn state since the -// channel doesn't correctly assume that LB policies start in CONNECTING and -// relies on LB policy to send an initial CONNECTING update. -func (b *pickfirstBalancer) forceUpdateConcludedStateLocked(newState balancer.State) { - b.state = newState.ConnectivityState - b.cc.UpdateState(newState) -} - -type picker struct { - result balancer.PickResult - err error -} - -func (p *picker) Pick(balancer.PickInfo) (balancer.PickResult, error) { - return p.result, p.err -} - -// idlePicker is used when the SubConn is IDLE and kicks the SubConn into -// CONNECTING when Pick is called. -type idlePicker struct { - exitIdle func() -} - -func (i *idlePicker) Pick(balancer.PickInfo) (balancer.PickResult, error) { - i.exitIdle() - return balancer.PickResult{}, balancer.ErrNoSubConnAvailable -} - -// addressList manages sequentially iterating over addresses present in a list -// of endpoints. It provides a 1 dimensional view of the addresses present in -// the endpoints. -// This type is not safe for concurrent access. -type addressList struct { - addresses []resolver.Address - idx int -} - -func (al *addressList) isValid() bool { - return al.idx < len(al.addresses) -} - -func (al *addressList) size() int { - return len(al.addresses) -} - -// increment moves to the next index in the address list. -// This method returns false if it went off the list, true otherwise. -func (al *addressList) increment() bool { - if !al.isValid() { - return false - } - al.idx++ - return al.idx < len(al.addresses) -} - -// currentAddress returns the current address pointed to in the addressList. -// If the list is in an invalid state, it returns an empty address instead. -func (al *addressList) currentAddress() resolver.Address { - if !al.isValid() { - return resolver.Address{} - } - return al.addresses[al.idx] -} - -func (al *addressList) reset() { - al.idx = 0 -} - -func (al *addressList) updateAddrs(addrs []resolver.Address) { - al.addresses = addrs - al.reset() -} - -// seekTo returns false if the needle was not found and the current index was -// left unchanged. -func (al *addressList) seekTo(needle resolver.Address) bool { - for ai, addr := range al.addresses { - if !equalAddressIgnoringBalAttributes(&addr, &needle) { - continue - } - al.idx = ai - return true - } - return false -} - -// hasNext returns whether incrementing the addressList will result in moving -// past the end of the list. If the list has already moved past the end, it -// returns false. -func (al *addressList) hasNext() bool { - if !al.isValid() { - return false - } - return al.idx+1 < len(al.addresses) -} - -// equalAddressIgnoringBalAttributes returns true is a and b are considered -// equal. This is different from the Equal method on the resolver.Address type -// which considers all fields to determine equality. Here, we only consider -// fields that are meaningful to the SubConn. -func equalAddressIgnoringBalAttributes(a, b *resolver.Address) bool { - return a.Addr == b.Addr && a.ServerName == b.ServerName && - a.Attributes.Equal(b.Attributes) -} diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go index 35da5d1ec9..22e6e32679 100644 --- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go +++ b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go @@ -26,7 +26,7 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/endpointsharding" - "google.golang.org/grpc/balancer/pickfirst/pickfirstleaf" + "google.golang.org/grpc/balancer/pickfirst" "google.golang.org/grpc/grpclog" internalgrpclog "google.golang.org/grpc/internal/grpclog" ) @@ -47,7 +47,7 @@ func (bb builder) Name() string { } func (bb builder) Build(cc balancer.ClientConn, opts balancer.BuildOptions) balancer.Balancer { - childBuilder := balancer.Get(pickfirstleaf.Name).Build + childBuilder := balancer.Get(pickfirst.Name).Build bal := &rrBalancer{ cc: cc, Balancer: endpointsharding.NewBalancer(cc, opts, childBuilder, endpointsharding.Options{}), @@ -67,13 +67,6 @@ func (b *rrBalancer) UpdateClientConnState(ccs balancer.ClientConnState) error { return b.Balancer.UpdateClientConnState(balancer.ClientConnState{ // Enable the health listener in pickfirst children for client side health // checks and outlier detection, if configured. - ResolverState: pickfirstleaf.EnableHealthListener(ccs.ResolverState), + ResolverState: pickfirst.EnableHealthListener(ccs.ResolverState), }) } - -func (b *rrBalancer) ExitIdle() { - // Should always be ok, as child is endpoint sharding. - if ei, ok := b.Balancer.(balancer.ExitIdler); ok { - ei.ExitIdle() - } -} diff --git a/vendor/google.golang.org/grpc/balancer/subconn.go b/vendor/google.golang.org/grpc/balancer/subconn.go index 9ee44d4af0..c1ca7c92e7 100644 --- a/vendor/google.golang.org/grpc/balancer/subconn.go +++ b/vendor/google.golang.org/grpc/balancer/subconn.go @@ -111,20 +111,6 @@ type SubConnState struct { // ConnectionError is set if the ConnectivityState is TransientFailure, // describing the reason the SubConn failed. Otherwise, it is nil. ConnectionError error - // connectedAddr contains the connected address when ConnectivityState is - // Ready. Otherwise, it is indeterminate. - connectedAddress resolver.Address -} - -// connectedAddress returns the connected address for a SubConnState. The -// address is only valid if the state is READY. -func connectedAddress(scs SubConnState) resolver.Address { - return scs.connectedAddress -} - -// setConnectedAddress sets the connected address for a SubConnState. -func setConnectedAddress(scs *SubConnState, addr resolver.Address) { - scs.connectedAddress = addr } // A Producer is a type shared among potentially many consumers. It is diff --git a/vendor/google.golang.org/grpc/balancer_wrapper.go b/vendor/google.golang.org/grpc/balancer_wrapper.go index 948a21ef68..a1e56a3893 100644 --- a/vendor/google.golang.org/grpc/balancer_wrapper.go +++ b/vendor/google.golang.org/grpc/balancer_wrapper.go @@ -36,7 +36,6 @@ import ( ) var ( - setConnectedAddress = internal.SetConnectedAddress.(func(*balancer.SubConnState, resolver.Address)) // noOpRegisterHealthListenerFn is used when client side health checking is // disabled. It sends a single READY update on the registered listener. noOpRegisterHealthListenerFn = func(_ context.Context, listener func(balancer.SubConnState)) func() { @@ -305,7 +304,7 @@ func newHealthData(s connectivity.State) *healthData { // updateState is invoked by grpc to push a subConn state update to the // underlying balancer. -func (acbw *acBalancerWrapper) updateState(s connectivity.State, curAddr resolver.Address, err error) { +func (acbw *acBalancerWrapper) updateState(s connectivity.State, err error) { acbw.ccb.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil || acbw.ccb.balancer == nil { return @@ -317,9 +316,6 @@ func (acbw *acBalancerWrapper) updateState(s connectivity.State, curAddr resolve // opts.StateListener is set, so this cannot ever be nil. // TODO: delete this comment when UpdateSubConnState is removed. scs := balancer.SubConnState{ConnectivityState: s, ConnectionError: err} - if s == connectivity.Ready { - setConnectedAddress(&scs, curAddr) - } // Invalidate the health listener by updating the healthData. acbw.healthMu.Lock() // A race may occur if a health listener is registered soon after the @@ -450,13 +446,14 @@ func (acbw *acBalancerWrapper) healthListenerRegFn() func(context.Context, func( if acbw.ccb.cc.dopts.disableHealthCheck { return noOpRegisterHealthListenerFn } + cfg := acbw.ac.cc.healthCheckConfig() + if cfg == nil { + return noOpRegisterHealthListenerFn + } regHealthLisFn := internal.RegisterClientHealthCheckListener if regHealthLisFn == nil { // The health package is not imported. - return noOpRegisterHealthListenerFn - } - cfg := acbw.ac.cc.healthCheckConfig() - if cfg == nil { + channelz.Error(logger, acbw.ac.channelz, "Health check is requested but health package is not imported.") return noOpRegisterHealthListenerFn } return func(ctx context.Context, listener func(balancer.SubConnState)) func() { diff --git a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go index 825c31795f..42c61cf9fe 100644 --- a/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go +++ b/vendor/google.golang.org/grpc/binarylog/grpc_binarylog_v1/binarylog.pb.go @@ -18,7 +18,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.10 // protoc v5.27.1 // source: grpc/binlog/v1/binarylog.proto @@ -858,133 +858,68 @@ func (x *Address) GetIpPort() uint32 { var File_grpc_binlog_v1_binarylog_proto protoreflect.FileDescriptor -var file_grpc_binlog_v1_binarylog_proto_rawDesc = string([]byte{ - 0x0a, 0x1e, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x62, 0x69, 0x6e, 0x6c, 0x6f, 0x67, 0x2f, 0x76, 0x31, - 0x2f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x11, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, - 0x2e, 0x76, 0x31, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbb, 0x07, 0x0a, 0x0c, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x17, 0x0a, 0x07, 0x63, 0x61, 0x6c, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x06, 0x63, 0x61, 0x6c, 0x6c, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x17, 0x73, 0x65, 0x71, 0x75, - 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x5f, 0x77, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x5f, 0x63, - 0x61, 0x6c, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x73, 0x65, 0x71, 0x75, 0x65, - 0x6e, 0x63, 0x65, 0x49, 0x64, 0x57, 0x69, 0x74, 0x68, 0x69, 0x6e, 0x43, 0x61, 0x6c, 0x6c, 0x12, - 0x3d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x29, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, - 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, 0x45, - 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3e, - 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, - 0x76, 0x31, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x4c, 0x6f, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x2e, - 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x52, 0x06, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x46, - 0x0a, 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, - 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x46, 0x0a, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x5f, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, - 0x31, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x48, 0x00, - 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x36, - 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x07, 0x6d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x65, - 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, - 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x72, 0x61, 0x69, - 0x6c, 0x65, 0x72, 0x48, 0x00, 0x52, 0x07, 0x74, 0x72, 0x61, 0x69, 0x6c, 0x65, 0x72, 0x12, 0x2b, - 0x0a, 0x11, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x72, 0x75, 0x6e, 0x63, 0x61, - 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x2e, 0x0a, 0x04, 0x70, - 0x65, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x22, 0xf5, 0x01, 0x0a, 0x09, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x45, 0x56, 0x45, - 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x01, 0x12, - 0x1c, 0x0a, 0x18, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, - 0x52, 0x56, 0x45, 0x52, 0x5f, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x10, 0x02, 0x12, 0x1d, 0x0a, - 0x19, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4c, 0x49, 0x45, - 0x4e, 0x54, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, - 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, - 0x52, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10, 0x04, 0x12, 0x20, 0x0a, 0x1c, 0x45, - 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, - 0x5f, 0x48, 0x41, 0x4c, 0x46, 0x5f, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x10, 0x05, 0x12, 0x1d, 0x0a, - 0x19, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, 0x56, - 0x45, 0x52, 0x5f, 0x54, 0x52, 0x41, 0x49, 0x4c, 0x45, 0x52, 0x10, 0x06, 0x12, 0x15, 0x0a, 0x11, - 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, - 0x4c, 0x10, 0x07, 0x22, 0x42, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x0e, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, 0x45, - 0x4e, 0x54, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4c, 0x4f, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x53, - 0x45, 0x52, 0x56, 0x45, 0x52, 0x10, 0x02, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, - 0x61, 0x64, 0x22, 0xbb, 0x01, 0x0a, 0x0c, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x48, 0x65, 0x61, - 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, - 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, 0x0a, 0x0b, - 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, - 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x33, 0x0a, 0x07, 0x74, - 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, - 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, - 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x22, 0x47, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, - 0x12, 0x37, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, - 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, - 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0xb1, 0x01, 0x0a, 0x07, 0x54, 0x72, - 0x61, 0x69, 0x6c, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, - 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x1f, - 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, - 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, - 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, - 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x22, 0x35, 0x0a, - 0x07, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x6e, 0x67, - 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, - 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x22, 0x42, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x36, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x22, 0x37, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x22, 0xb8, 0x01, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x33, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 0x2e, 0x67, 0x72, - 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x17, 0x0a, 0x07, - 0x69, 0x70, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x69, - 0x70, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x45, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, - 0x0c, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, - 0x0d, 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x50, 0x56, 0x34, 0x10, 0x01, 0x12, 0x0d, - 0x0a, 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x50, 0x56, 0x36, 0x10, 0x02, 0x12, 0x0d, 0x0a, - 0x09, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x49, 0x58, 0x10, 0x03, 0x42, 0x5c, 0x0a, 0x14, - 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, - 0x67, 0x2e, 0x76, 0x31, 0x42, 0x0e, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x4c, 0x6f, 0x67, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x32, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, - 0x6f, 0x6c, 0x61, 0x6e, 0x67, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x62, - 0x69, 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x62, 0x69, - 0x6e, 0x61, 0x72, 0x79, 0x6c, 0x6f, 0x67, 0x5f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -}) +const file_grpc_binlog_v1_binarylog_proto_rawDesc = "" + + "\n" + + "\x1egrpc/binlog/v1/binarylog.proto\x12\x11grpc.binarylog.v1\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xbb\a\n" + + "\fGrpcLogEntry\x128\n" + + "\ttimestamp\x18\x01 \x01(\v2\x1a.google.protobuf.TimestampR\ttimestamp\x12\x17\n" + + "\acall_id\x18\x02 \x01(\x04R\x06callId\x125\n" + + "\x17sequence_id_within_call\x18\x03 \x01(\x04R\x14sequenceIdWithinCall\x12=\n" + + "\x04type\x18\x04 \x01(\x0e2).grpc.binarylog.v1.GrpcLogEntry.EventTypeR\x04type\x12>\n" + + "\x06logger\x18\x05 \x01(\x0e2&.grpc.binarylog.v1.GrpcLogEntry.LoggerR\x06logger\x12F\n" + + "\rclient_header\x18\x06 \x01(\v2\x1f.grpc.binarylog.v1.ClientHeaderH\x00R\fclientHeader\x12F\n" + + "\rserver_header\x18\a \x01(\v2\x1f.grpc.binarylog.v1.ServerHeaderH\x00R\fserverHeader\x126\n" + + "\amessage\x18\b \x01(\v2\x1a.grpc.binarylog.v1.MessageH\x00R\amessage\x126\n" + + "\atrailer\x18\t \x01(\v2\x1a.grpc.binarylog.v1.TrailerH\x00R\atrailer\x12+\n" + + "\x11payload_truncated\x18\n" + + " \x01(\bR\x10payloadTruncated\x12.\n" + + "\x04peer\x18\v \x01(\v2\x1a.grpc.binarylog.v1.AddressR\x04peer\"\xf5\x01\n" + + "\tEventType\x12\x16\n" + + "\x12EVENT_TYPE_UNKNOWN\x10\x00\x12\x1c\n" + + "\x18EVENT_TYPE_CLIENT_HEADER\x10\x01\x12\x1c\n" + + "\x18EVENT_TYPE_SERVER_HEADER\x10\x02\x12\x1d\n" + + "\x19EVENT_TYPE_CLIENT_MESSAGE\x10\x03\x12\x1d\n" + + "\x19EVENT_TYPE_SERVER_MESSAGE\x10\x04\x12 \n" + + "\x1cEVENT_TYPE_CLIENT_HALF_CLOSE\x10\x05\x12\x1d\n" + + "\x19EVENT_TYPE_SERVER_TRAILER\x10\x06\x12\x15\n" + + "\x11EVENT_TYPE_CANCEL\x10\a\"B\n" + + "\x06Logger\x12\x12\n" + + "\x0eLOGGER_UNKNOWN\x10\x00\x12\x11\n" + + "\rLOGGER_CLIENT\x10\x01\x12\x11\n" + + "\rLOGGER_SERVER\x10\x02B\t\n" + + "\apayload\"\xbb\x01\n" + + "\fClientHeader\x127\n" + + "\bmetadata\x18\x01 \x01(\v2\x1b.grpc.binarylog.v1.MetadataR\bmetadata\x12\x1f\n" + + "\vmethod_name\x18\x02 \x01(\tR\n" + + "methodName\x12\x1c\n" + + "\tauthority\x18\x03 \x01(\tR\tauthority\x123\n" + + "\atimeout\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\atimeout\"G\n" + + "\fServerHeader\x127\n" + + "\bmetadata\x18\x01 \x01(\v2\x1b.grpc.binarylog.v1.MetadataR\bmetadata\"\xb1\x01\n" + + "\aTrailer\x127\n" + + "\bmetadata\x18\x01 \x01(\v2\x1b.grpc.binarylog.v1.MetadataR\bmetadata\x12\x1f\n" + + "\vstatus_code\x18\x02 \x01(\rR\n" + + "statusCode\x12%\n" + + "\x0estatus_message\x18\x03 \x01(\tR\rstatusMessage\x12%\n" + + "\x0estatus_details\x18\x04 \x01(\fR\rstatusDetails\"5\n" + + "\aMessage\x12\x16\n" + + "\x06length\x18\x01 \x01(\rR\x06length\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\"B\n" + + "\bMetadata\x126\n" + + "\x05entry\x18\x01 \x03(\v2 .grpc.binarylog.v1.MetadataEntryR\x05entry\"7\n" + + "\rMetadataEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\fR\x05value\"\xb8\x01\n" + + "\aAddress\x123\n" + + "\x04type\x18\x01 \x01(\x0e2\x1f.grpc.binarylog.v1.Address.TypeR\x04type\x12\x18\n" + + "\aaddress\x18\x02 \x01(\tR\aaddress\x12\x17\n" + + "\aip_port\x18\x03 \x01(\rR\x06ipPort\"E\n" + + "\x04Type\x12\x10\n" + + "\fTYPE_UNKNOWN\x10\x00\x12\r\n" + + "\tTYPE_IPV4\x10\x01\x12\r\n" + + "\tTYPE_IPV6\x10\x02\x12\r\n" + + "\tTYPE_UNIX\x10\x03B\\\n" + + "\x14io.grpc.binarylog.v1B\x0eBinaryLogProtoP\x01Z2google.golang.org/grpc/binarylog/grpc_binarylog_v1b\x06proto3" var ( file_grpc_binlog_v1_binarylog_proto_rawDescOnce sync.Once diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go index 4f350ca56a..5dec2dacc0 100644 --- a/vendor/google.golang.org/grpc/clientconn.go +++ b/vendor/google.golang.org/grpc/clientconn.go @@ -35,16 +35,19 @@ import ( "google.golang.org/grpc/balancer/pickfirst" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials" + expstats "google.golang.org/grpc/experimental/stats" "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/idle" iresolver "google.golang.org/grpc/internal/resolver" - "google.golang.org/grpc/internal/stats" + istats "google.golang.org/grpc/internal/stats" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/keepalive" "google.golang.org/grpc/resolver" "google.golang.org/grpc/serviceconfig" + "google.golang.org/grpc/stats" "google.golang.org/grpc/status" _ "google.golang.org/grpc/balancer/roundrobin" // To register roundrobin. @@ -97,6 +100,41 @@ var ( errTransportCredentialsMissing = errors.New("grpc: the credentials require transport level security (use grpc.WithTransportCredentials() to set)") ) +var ( + disconnectionsMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ + Name: "grpc.subchannel.disconnections", + Description: "EXPERIMENTAL. Number of times the selected subchannel becomes disconnected.", + Unit: "{disconnection}", + Labels: []string{"grpc.target"}, + OptionalLabels: []string{"grpc.lb.backend_service", "grpc.lb.locality", "grpc.disconnect_error"}, + Default: false, + }) + connectionAttemptsSucceededMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ + Name: "grpc.subchannel.connection_attempts_succeeded", + Description: "EXPERIMENTAL. Number of successful connection attempts.", + Unit: "{attempt}", + Labels: []string{"grpc.target"}, + OptionalLabels: []string{"grpc.lb.backend_service", "grpc.lb.locality"}, + Default: false, + }) + connectionAttemptsFailedMetric = expstats.RegisterInt64Count(expstats.MetricDescriptor{ + Name: "grpc.subchannel.connection_attempts_failed", + Description: "EXPERIMENTAL. Number of failed connection attempts.", + Unit: "{attempt}", + Labels: []string{"grpc.target"}, + OptionalLabels: []string{"grpc.lb.backend_service", "grpc.lb.locality"}, + Default: false, + }) + openConnectionsMetric = expstats.RegisterInt64UpDownCount(expstats.MetricDescriptor{ + Name: "grpc.subchannel.open_connections", + Description: "EXPERIMENTAL. Number of open connections.", + Unit: "{attempt}", + Labels: []string{"grpc.target"}, + OptionalLabels: []string{"grpc.lb.backend_service", "grpc.security_level", "grpc.lb.locality"}, + Default: false, + }) +) + const ( defaultClientMaxReceiveMessageSize = 1024 * 1024 * 4 defaultClientMaxSendMessageSize = math.MaxInt32 @@ -208,9 +246,10 @@ func NewClient(target string, opts ...DialOption) (conn *ClientConn, err error) channelz.Infof(logger, cc.channelz, "Channel authority set to %q", cc.authority) cc.csMgr = newConnectivityStateManager(cc.ctx, cc.channelz) - cc.pickerWrapper = newPickerWrapper(cc.dopts.copts.StatsHandlers) + cc.pickerWrapper = newPickerWrapper() - cc.metricsRecorderList = stats.NewMetricsRecorderList(cc.dopts.copts.StatsHandlers) + cc.metricsRecorderList = istats.NewMetricsRecorderList(cc.dopts.copts.StatsHandlers) + cc.statsHandler = istats.NewCombinedHandler(cc.dopts.copts.StatsHandlers...) cc.initIdleStateLocked() // Safe to call without the lock, since nothing else has a reference to cc. cc.idlenessMgr = idle.NewManager((*idler)(cc), cc.dopts.idleTimeout) @@ -260,9 +299,10 @@ func DialContext(ctx context.Context, target string, opts ...DialOption) (conn * }() // This creates the name resolver, load balancer, etc. - if err := cc.idlenessMgr.ExitIdleMode(); err != nil { - return nil, err + if err := cc.exitIdleMode(); err != nil { + return nil, fmt.Errorf("failed to exit idle mode: %w", err) } + cc.idlenessMgr.UnsafeSetNotIdle() // Return now for non-blocking dials. if !cc.dopts.block { @@ -330,7 +370,7 @@ func (cc *ClientConn) addTraceEvent(msg string) { Severity: channelz.CtInfo, } } - channelz.AddTraceEvent(logger, cc.channelz, 0, ted) + channelz.AddTraceEvent(logger, cc.channelz, 1, ted) } type idler ClientConn @@ -339,14 +379,17 @@ func (i *idler) EnterIdleMode() { (*ClientConn)(i).enterIdleMode() } -func (i *idler) ExitIdleMode() error { - return (*ClientConn)(i).exitIdleMode() +func (i *idler) ExitIdleMode() { + // Ignore the error returned from this method, because from the perspective + // of the caller (idleness manager), the channel would have always moved out + // of IDLE by the time this method returns. + (*ClientConn)(i).exitIdleMode() } // exitIdleMode moves the channel out of idle mode by recreating the name // resolver and load balancer. This should never be called directly; use // cc.idlenessMgr.ExitIdleMode instead. -func (cc *ClientConn) exitIdleMode() (err error) { +func (cc *ClientConn) exitIdleMode() error { cc.mu.Lock() if cc.conns == nil { cc.mu.Unlock() @@ -354,11 +397,23 @@ func (cc *ClientConn) exitIdleMode() (err error) { } cc.mu.Unlock() + // Set state to CONNECTING before building the name resolver + // so the channel does not remain in IDLE. + cc.csMgr.updateState(connectivity.Connecting) + // This needs to be called without cc.mu because this builds a new resolver // which might update state or report error inline, which would then need to // acquire cc.mu. if err := cc.resolverWrapper.start(); err != nil { - return err + // If resolver creation fails, treat it like an error reported by the + // resolver before any valid updates. Set channel's state to + // TransientFailure, and set an erroring picker with the resolver build + // error, which will returned as part of any subsequent RPCs. + logger.Warningf("Failed to start resolver: %v", err) + cc.csMgr.updateState(connectivity.TransientFailure) + cc.mu.Lock() + cc.updateResolverStateAndUnlock(resolver.State{}, err) + return fmt.Errorf("failed to start resolver: %w", err) } cc.addTraceEvent("exiting idle mode") @@ -456,7 +511,7 @@ func (cc *ClientConn) validateTransportCredentials() error { func (cc *ClientConn) channelzRegistration(target string) { parentChannel, _ := cc.dopts.channelzParent.(*channelz.Channel) cc.channelz = channelz.RegisterChannel(parentChannel, target) - cc.addTraceEvent("created") + cc.addTraceEvent(fmt.Sprintf("created for target %q", target)) } // chainUnaryClientInterceptors chains all unary client interceptors into one. @@ -621,7 +676,8 @@ type ClientConn struct { channelz *channelz.Channel // Channelz object. resolverBuilder resolver.Builder // See initParsedTargetAndResolverBuilder(). idlenessMgr *idle.Manager - metricsRecorderList *stats.MetricsRecorderList + metricsRecorderList *istats.MetricsRecorderList + statsHandler stats.Handler // The following provide their own synchronization, and therefore don't // require cc.mu to be held to access them. @@ -678,10 +734,8 @@ func (cc *ClientConn) GetState() connectivity.State { // Notice: This API is EXPERIMENTAL and may be changed or removed in a later // release. func (cc *ClientConn) Connect() { - if err := cc.idlenessMgr.ExitIdleMode(); err != nil { - cc.addTraceEvent(err.Error()) - return - } + cc.idlenessMgr.ExitIdleMode() + // If the ClientConn was not in idle mode, we need to call ExitIdle on the // LB policy so that connections can be created. cc.mu.Lock() @@ -689,22 +743,31 @@ func (cc *ClientConn) Connect() { cc.mu.Unlock() } -// waitForResolvedAddrs blocks until the resolver has provided addresses or the -// context expires. Returns nil unless the context expires first; otherwise -// returns a status error based on the context. -func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error { +// waitForResolvedAddrs blocks until the resolver provides addresses or the +// context expires, whichever happens first. +// +// Error is nil unless the context expires first; otherwise returns a status +// error based on the context. +// +// The returned boolean indicates whether it did block or not. If the +// resolution has already happened once before, it returns false without +// blocking. Otherwise, it wait for the resolution and return true if +// resolution has succeeded or return false along with error if resolution has +// failed. +func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) (bool, error) { // This is on the RPC path, so we use a fast path to avoid the // more-expensive "select" below after the resolver has returned once. if cc.firstResolveEvent.HasFired() { - return nil + return false, nil } + internal.NewStreamWaitingForResolver() select { case <-cc.firstResolveEvent.Done(): - return nil + return true, nil case <-ctx.Done(): - return status.FromContextError(ctx.Err()).Err() + return false, status.FromContextError(ctx.Err()).Err() case <-cc.ctx.Done(): - return ErrClientConnClosing + return false, ErrClientConnClosing } } @@ -723,8 +786,8 @@ func init() { internal.EnterIdleModeForTesting = func(cc *ClientConn) { cc.idlenessMgr.EnterIdleModeForTesting() } - internal.ExitIdleModeForTesting = func(cc *ClientConn) error { - return cc.idlenessMgr.ExitIdleMode() + internal.ExitIdleModeForTesting = func(cc *ClientConn) { + cc.idlenessMgr.ExitIdleMode() } } @@ -849,6 +912,7 @@ func (cc *ClientConn) newAddrConnLocked(addrs []resolver.Address, opts balancer. channelz: channelz.RegisterSubChannel(cc.channelz, ""), resetBackoff: make(chan struct{}), } + ac.updateTelemetryLabelsLocked() ac.ctx, ac.cancel = context.WithCancel(cc.ctx) // Start with our address set to the first address; this may be updated if // we connect to different addresses. @@ -913,25 +977,24 @@ func (cc *ClientConn) incrCallsFailed() { // connect starts creating a transport. // It does nothing if the ac is not IDLE. // TODO(bar) Move this to the addrConn section. -func (ac *addrConn) connect() error { +func (ac *addrConn) connect() { ac.mu.Lock() if ac.state == connectivity.Shutdown { if logger.V(2) { logger.Infof("connect called on shutdown addrConn; ignoring.") } ac.mu.Unlock() - return errConnClosing + return } if ac.state != connectivity.Idle { if logger.V(2) { logger.Infof("connect called on addrConn in non-idle state (%v); ignoring.", ac.state) } ac.mu.Unlock() - return nil + return } ac.resetTransportAndUnlock() - return nil } // equalAddressIgnoringBalAttributes returns true is a and b are considered equal. @@ -965,7 +1028,7 @@ func (ac *addrConn) updateAddrs(addrs []resolver.Address) { } ac.addrs = addrs - + ac.updateTelemetryLabelsLocked() if ac.state == connectivity.Shutdown || ac.state == connectivity.TransientFailure || ac.state == connectivity.Idle { @@ -1067,13 +1130,6 @@ func (cc *ClientConn) healthCheckConfig() *healthCheckConfig { return cc.sc.healthCheckConfig } -func (cc *ClientConn) getTransport(ctx context.Context, failfast bool, method string) (transport.ClientTransport, balancer.PickResult, error) { - return cc.pickerWrapper.pick(ctx, failfast, balancer.PickInfo{ - Ctx: ctx, - FullMethodName: method, - }) -} - func (cc *ClientConn) applyServiceConfigAndBalancer(sc *ServiceConfig, configSelector iresolver.ConfigSelector) { if sc == nil { // should never reach here. @@ -1211,6 +1267,9 @@ type addrConn struct { resetBackoff chan struct{} channelz *channelz.SubChannel + + localityLabel string + backendServiceLabel string } // Note: this requires a lock on ac.mu. @@ -1218,6 +1277,18 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) if ac.state == s { return } + + // If we are transitioning out of Ready, it means there is a disconnection. + // A SubConn can also transition from CONNECTING directly to IDLE when + // a transport is successfully created, but the connection fails + // before the SubConn can send the notification for READY. We treat + // this as a successful connection and transition to IDLE. + // TODO: https://github.com/grpc/grpc-go/issues/7862 - Remove the second + // part of the if condition below once the issue is fixed. + if ac.state == connectivity.Ready || (ac.state == connectivity.Connecting && s == connectivity.Idle) { + disconnectionsMetric.Record(ac.cc.metricsRecorderList, 1, ac.cc.target, ac.backendServiceLabel, ac.localityLabel, "unknown") + openConnectionsMetric.Record(ac.cc.metricsRecorderList, -1, ac.cc.target, ac.backendServiceLabel, ac.securityLevelLocked(), ac.localityLabel) + } ac.state = s ac.channelz.ChannelMetrics.State.Store(&s) if lastErr == nil { @@ -1225,7 +1296,7 @@ func (ac *addrConn) updateConnectivityState(s connectivity.State, lastErr error) } else { channelz.Infof(logger, ac.channelz, "Subchannel Connectivity change to %v, last error: %s", s, lastErr) } - ac.acbw.updateState(s, ac.curAddr, lastErr) + ac.acbw.updateState(s, lastErr) } // adjustParams updates parameters used to create transports upon @@ -1275,6 +1346,15 @@ func (ac *addrConn) resetTransportAndUnlock() { ac.mu.Unlock() if err := ac.tryAllAddrs(acCtx, addrs, connectDeadline); err != nil { + if !errors.Is(err, context.Canceled) { + connectionAttemptsFailedMetric.Record(ac.cc.metricsRecorderList, 1, ac.cc.target, ac.backendServiceLabel, ac.localityLabel) + } else { + if logger.V(2) { + // This records cancelled connection attempts which can be later + // replaced by a metric. + logger.Infof("Context cancellation detected; not recording this as a failed connection attempt.") + } + } // TODO: #7534 - Move re-resolution requests into the pick_first LB policy // to ensure one resolution request per pass instead of per subconn failure. ac.cc.resolveNow(resolver.ResolveNowOptions{}) @@ -1314,10 +1394,50 @@ func (ac *addrConn) resetTransportAndUnlock() { } // Success; reset backoff. ac.mu.Lock() + connectionAttemptsSucceededMetric.Record(ac.cc.metricsRecorderList, 1, ac.cc.target, ac.backendServiceLabel, ac.localityLabel) + openConnectionsMetric.Record(ac.cc.metricsRecorderList, 1, ac.cc.target, ac.backendServiceLabel, ac.securityLevelLocked(), ac.localityLabel) ac.backoffIdx = 0 ac.mu.Unlock() } +// updateTelemetryLabelsLocked calculates and caches the telemetry labels based on the +// first address in addrConn. +func (ac *addrConn) updateTelemetryLabelsLocked() { + labelsFunc, ok := internal.AddressToTelemetryLabels.(func(resolver.Address) map[string]string) + if !ok || len(ac.addrs) == 0 { + // Reset defaults + ac.localityLabel = "" + ac.backendServiceLabel = "" + return + } + labels := labelsFunc(ac.addrs[0]) + ac.localityLabel = labels["grpc.lb.locality"] + ac.backendServiceLabel = labels["grpc.lb.backend_service"] +} + +type securityLevelKey struct{} + +func (ac *addrConn) securityLevelLocked() string { + var secLevel string + // During disconnection, ac.transport is nil. Fall back to the security level + // stored in the current address during connection. + if ac.transport == nil { + secLevel, _ = ac.curAddr.Attributes.Value(securityLevelKey{}).(string) + return secLevel + } + authInfo := ac.transport.Peer().AuthInfo + if ci, ok := authInfo.(interface { + GetCommonAuthInfo() credentials.CommonAuthInfo + }); ok { + secLevel = ci.GetCommonAuthInfo().SecurityLevel.String() + // Store the security level in the current address' attributes so + // that it remains available for disconnection metrics after the + // transport is closed. + ac.curAddr.Attributes = ac.curAddr.Attributes.WithValue(securityLevelKey{}, secLevel) + } + return secLevel +} + // tryAllAddrs tries to create a connection to the addresses, and stop when at // the first successful one. It returns an error if no address was successfully // connected, or updates ac appropriately with the new transport. @@ -1407,25 +1527,26 @@ func (ac *addrConn) createTransport(ctx context.Context, addr resolver.Address, } ac.mu.Lock() - defer ac.mu.Unlock() if ctx.Err() != nil { // This can happen if the subConn was removed while in `Connecting` // state. tearDown() would have set the state to `Shutdown`, but // would not have closed the transport since ac.transport would not // have been set at that point. - // - // We run this in a goroutine because newTr.Close() calls onClose() + + // We unlock ac.mu because newTr.Close() calls onClose() // inline, which requires locking ac.mu. - // + ac.mu.Unlock() + // The error we pass to Close() is immaterial since there are no open // streams at this point, so no trailers with error details will be sent // out. We just need to pass a non-nil error. // // This can also happen when updateAddrs is called during a connection // attempt. - go newTr.Close(transport.ErrConnClosing) + newTr.Close(transport.ErrConnClosing) return nil } + defer ac.mu.Unlock() if hctx.Err() != nil { // onClose was already called for this connection, but the connection // was successfully established first. Consider it a success and set @@ -1822,7 +1943,7 @@ func (cc *ClientConn) initAuthority() error { } else if auth, ok := cc.resolverBuilder.(resolver.AuthorityOverrider); ok { cc.authority = auth.OverrideAuthority(cc.parsedTarget) } else if strings.HasPrefix(endpoint, ":") { - cc.authority = "localhost" + endpoint + cc.authority = "localhost" + encodeAuthority(endpoint) } else { cc.authority = encodeAuthority(endpoint) } diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go index 665e790bb0..06f6c6c70a 100644 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/credentials/credentials.go @@ -44,8 +44,7 @@ type PerRPCCredentials interface { // A54). uri is the URI of the entry point for the request. When supported // by the underlying implementation, ctx can be used for timeout and // cancellation. Additionally, RequestInfo data will be available via ctx - // to this call. TODO(zhaoq): Define the set of the qualified keys instead - // of leaving it as an arbitrary string. + // to this call. GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) // RequireTransportSecurity indicates whether the credentials requires // transport security. @@ -96,10 +95,11 @@ func (c CommonAuthInfo) GetCommonAuthInfo() CommonAuthInfo { return c } -// ProtocolInfo provides information regarding the gRPC wire protocol version, -// security protocol, security protocol version in use, server name, etc. +// ProtocolInfo provides static information regarding transport credentials. type ProtocolInfo struct { // ProtocolVersion is the gRPC wire protocol version. + // + // Deprecated: this is unused by gRPC. ProtocolVersion string // SecurityProtocol is the security protocol in use. SecurityProtocol string @@ -109,7 +109,16 @@ type ProtocolInfo struct { // // Deprecated: please use Peer.AuthInfo. SecurityVersion string - // ServerName is the user-configured server name. + // ServerName is the user-configured server name. If set, this overrides + // the default :authority header used for all RPCs on the channel using the + // containing credentials, unless grpc.WithAuthority is set on the channel, + // in which case that setting will take precedence. + // + // This must be a valid `:authority` header according to + // [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2). + // + // Deprecated: Users should use grpc.WithAuthority to override the authority + // on a channel instead of configuring the credentials. ServerName string } @@ -120,6 +129,20 @@ type AuthInfo interface { AuthType() string } +// AuthorityValidator validates the authority used to override the `:authority` +// header. This is an optional interface that implementations of AuthInfo can +// implement if they support per-RPC authority overrides. It is invoked when the +// application attempts to override the HTTP/2 `:authority` header using the +// CallAuthority call option. +type AuthorityValidator interface { + // ValidateAuthority checks the authority value used to override the + // `:authority` header. The authority parameter is the override value + // provided by the application via the CallAuthority option. This value + // typically corresponds to the server hostname or endpoint the RPC is + // targeting. It returns non-nil error if the validation fails. + ValidateAuthority(authority string) error +} + // ErrConnDispatched indicates that rawConn has been dispatched out of gRPC // and the caller should not close rawConn. var ErrConnDispatched = errors.New("credentials: rawConn is dispatched out of gRPC") @@ -159,12 +182,17 @@ type TransportCredentials interface { // Clone makes a copy of this TransportCredentials. Clone() TransportCredentials // OverrideServerName specifies the value used for the following: + // // - verifying the hostname on the returned certificates // - as SNI in the client's handshake to support virtual hosting // - as the value for `:authority` header at stream creation time // - // Deprecated: use grpc.WithAuthority instead. Will be supported - // throughout 1.x. + // The provided string should be a valid `:authority` header according to + // [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2). + // + // Deprecated: this method is unused by gRPC. Users should use + // grpc.WithAuthority to override the authority on a channel instead of + // configuring the credentials. OverrideServerName(string) error } @@ -207,14 +235,32 @@ type RequestInfo struct { AuthInfo AuthInfo } +// requestInfoKey is a struct to be used as the key to store RequestInfo in a +// context. +type requestInfoKey struct{} + // RequestInfoFromContext extracts the RequestInfo from the context if it exists. // // This API is experimental. func RequestInfoFromContext(ctx context.Context) (ri RequestInfo, ok bool) { - ri, ok = icredentials.RequestInfoFromContext(ctx).(RequestInfo) + ri, ok = ctx.Value(requestInfoKey{}).(RequestInfo) return ri, ok } +// NewContextWithRequestInfo creates a new context from ctx and attaches ri to it. +// +// This RequestInfo will be accessible via RequestInfoFromContext. +// +// Intended to be used from tests for PerRPCCredentials implementations (that +// often need to check connection's SecurityLevel). Should not be used from +// non-test code: the gRPC client already prepares a context with the correct +// RequestInfo attached when calling PerRPCCredentials.GetRequestMetadata. +// +// This API is experimental. +func NewContextWithRequestInfo(ctx context.Context, ri RequestInfo) context.Context { + return context.WithValue(ctx, requestInfoKey{}, ri) +} + // ClientHandshakeInfo holds data to be passed to ClientHandshake. This makes // it possible to pass arbitrary data to the handshaker from gRPC, resolver, // balancer etc. Individual credential implementations control the actual diff --git a/vendor/google.golang.org/grpc/credentials/insecure/insecure.go b/vendor/google.golang.org/grpc/credentials/insecure/insecure.go index 4c805c6446..93156c0f34 100644 --- a/vendor/google.golang.org/grpc/credentials/insecure/insecure.go +++ b/vendor/google.golang.org/grpc/credentials/insecure/insecure.go @@ -30,7 +30,7 @@ import ( // NewCredentials returns a credentials which disables transport security. // // Note that using this credentials with per-RPC credentials which require -// transport security is incompatible and will cause grpc.Dial() to fail. +// transport security is incompatible and will cause RPCs to fail. func NewCredentials() credentials.TransportCredentials { return insecureTC{} } @@ -71,6 +71,12 @@ func (info) AuthType() string { return "insecure" } +// ValidateAuthority allows any value to be overridden for the :authority +// header. +func (info) ValidateAuthority(string) error { + return nil +} + // insecureBundle implements an insecure bundle. // An insecure bundle provides a thin wrapper around insecureTC to support // the credentials.Bundle interface. diff --git a/vendor/google.golang.org/grpc/credentials/tls.go b/vendor/google.golang.org/grpc/credentials/tls.go index bd5fe22b6a..0bcd16dbbf 100644 --- a/vendor/google.golang.org/grpc/credentials/tls.go +++ b/vendor/google.golang.org/grpc/credentials/tls.go @@ -22,6 +22,7 @@ import ( "context" "crypto/tls" "crypto/x509" + "errors" "fmt" "net" "net/url" @@ -50,6 +51,25 @@ func (t TLSInfo) AuthType() string { return "tls" } +// ValidateAuthority validates the provided authority being used to override the +// :authority header by verifying it against the peer certificates. It returns a +// non-nil error if the validation fails. +func (t TLSInfo) ValidateAuthority(authority string) error { + var errs []error + host, _, err := net.SplitHostPort(authority) + if err != nil { + host = authority + } + for _, cert := range t.State.PeerCertificates { + var err error + if err = cert.VerifyHostname(host); err == nil { + return nil + } + errs = append(errs, err) + } + return fmt.Errorf("credentials: invalid authority %q: %v", authority, errors.Join(errs...)) +} + // cipherSuiteLookup returns the string version of a TLS cipher suite ID. func cipherSuiteLookup(cipherSuiteID uint16) string { for _, s := range tls.CipherSuites() { @@ -94,14 +114,14 @@ func (c tlsCreds) Info() ProtocolInfo { func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (_ net.Conn, _ AuthInfo, err error) { // use local cfg to avoid clobbering ServerName if using multiple endpoints cfg := credinternal.CloneTLSConfig(c.config) - if cfg.ServerName == "" { - serverName, _, err := net.SplitHostPort(authority) - if err != nil { - // If the authority had no host port or if the authority cannot be parsed, use it as-is. - serverName = authority - } - cfg.ServerName = serverName + + serverName, _, err := net.SplitHostPort(authority) + if err != nil { + // If the authority had no host port or if the authority cannot be parsed, use it as-is. + serverName = authority } + cfg.ServerName = serverName + conn := tls.Client(rawConn, cfg) errChannel := make(chan error, 1) go func() { @@ -243,9 +263,11 @@ func applyDefaults(c *tls.Config) *tls.Config { // certificates to establish the identity of the client need to be included in // the credentials (eg: for mTLS), use NewTLS instead, where a complete // tls.Config can be specified. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header -// field) in requests. +// +// serverNameOverride is for testing only. If set to a non empty string, it will +// override the virtual host name of authority (e.g. :authority header field) in +// requests. Users should use grpc.WithAuthority passed to grpc.NewClient to +// override the authority of the client instead. func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials { return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}) } @@ -255,9 +277,11 @@ func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) Transpor // certificates to establish the identity of the client need to be included in // the credentials (eg: for mTLS), use NewTLS instead, where a complete // tls.Config can be specified. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header -// field) in requests. +// +// serverNameOverride is for testing only. If set to a non empty string, it will +// override the virtual host name of authority (e.g. :authority header field) in +// requests. Users should use grpc.WithAuthority passed to grpc.NewClient to +// override the authority of the client instead. func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) { b, err := os.ReadFile(certFile) if err != nil { diff --git a/vendor/google.golang.org/grpc/dialoptions.go b/vendor/google.golang.org/grpc/dialoptions.go index 405a2ffeb3..7a5ac2e7c4 100644 --- a/vendor/google.golang.org/grpc/dialoptions.go +++ b/vendor/google.golang.org/grpc/dialoptions.go @@ -213,6 +213,7 @@ func WithReadBufferSize(s int) DialOption { func WithInitialWindowSize(s int32) DialOption { return newFuncDialOption(func(o *dialOptions) { o.copts.InitialWindowSize = s + o.copts.StaticWindowSize = true }) } @@ -222,6 +223,26 @@ func WithInitialWindowSize(s int32) DialOption { func WithInitialConnWindowSize(s int32) DialOption { return newFuncDialOption(func(o *dialOptions) { o.copts.InitialConnWindowSize = s + o.copts.StaticWindowSize = true + }) +} + +// WithStaticStreamWindowSize returns a DialOption which sets the initial +// stream window size to the value provided and disables dynamic flow control. +func WithStaticStreamWindowSize(s int32) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.InitialWindowSize = s + o.copts.StaticWindowSize = true + }) +} + +// WithStaticConnWindowSize returns a DialOption which sets the initial +// connection window size to the value provided and disables dynamic flow +// control. +func WithStaticConnWindowSize(s int32) DialOption { + return newFuncDialOption(func(o *dialOptions) { + o.copts.InitialConnWindowSize = s + o.copts.StaticWindowSize = true }) } @@ -360,7 +381,7 @@ func WithReturnConnectionError() DialOption { // // Note that using this DialOption with per-RPC credentials (through // WithCredentialsBundle or WithPerRPCCredentials) which require transport -// security is incompatible and will cause grpc.Dial() to fail. +// security is incompatible and will cause RPCs to fail. // // Deprecated: use WithTransportCredentials and insecure.NewCredentials() // instead. Will be supported throughout 1.x. @@ -587,6 +608,8 @@ func WithChainStreamInterceptor(interceptors ...StreamClientInterceptor) DialOpt // WithAuthority returns a DialOption that specifies the value to be used as the // :authority pseudo-header and as the server name in authentication handshake. +// This overrides all other ways of setting authority on the channel, but can be +// overridden per-call by using grpc.CallAuthority. func WithAuthority(a string) DialOption { return newFuncDialOption(func(o *dialOptions) { o.authority = a diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go index 11d0ae142c..296f38c3a8 100644 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ b/vendor/google.golang.org/grpc/encoding/encoding.go @@ -27,8 +27,10 @@ package encoding import ( "io" + "slices" "strings" + "google.golang.org/grpc/encoding/internal" "google.golang.org/grpc/internal/grpcutil" ) @@ -36,12 +38,26 @@ import ( // It is intended for grpc internal use only. const Identity = "identity" +func init() { + internal.RegisterCompressorForTesting = func(c Compressor) func() { + name := c.Name() + curCompressor, found := registeredCompressor[name] + RegisterCompressor(c) + return func() { + if found { + registeredCompressor[name] = curCompressor + return + } + delete(registeredCompressor, name) + grpcutil.RegisteredCompressorNames = slices.DeleteFunc(grpcutil.RegisteredCompressorNames, func(s string) bool { + return s == name + }) + } + } +} + // Compressor is used for compressing and decompressing when sending or // receiving messages. -// -// If a Compressor implements `DecompressedSize(compressedBytes []byte) int`, -// gRPC will invoke it to determine the size of the buffer allocated for the -// result of decompression. A return value of -1 indicates unknown size. type Compressor interface { // Compress writes the data written to wc to w after compressing it. If an // error occurs while initializing the compressor, that error is returned diff --git a/vendor/google.golang.org/grpc/encoding/gzip/gzip.go b/vendor/google.golang.org/grpc/encoding/gzip/gzip.go index 6306e8bb0f..153e4dbfbf 100644 --- a/vendor/google.golang.org/grpc/encoding/gzip/gzip.go +++ b/vendor/google.golang.org/grpc/encoding/gzip/gzip.go @@ -27,7 +27,6 @@ package gzip import ( "compress/gzip" - "encoding/binary" "fmt" "io" "sync" @@ -111,17 +110,6 @@ func (z *reader) Read(p []byte) (n int, err error) { return n, err } -// RFC1952 specifies that the last four bytes "contains the size of -// the original (uncompressed) input data modulo 2^32." -// gRPC has a max message size of 2GB so we don't need to worry about wraparound. -func (c *compressor) DecompressedSize(buf []byte) int { - last := len(buf) - if last < 4 { - return -1 - } - return int(binary.LittleEndian.Uint32(buf[last-4 : last])) -} - func (c *compressor) Name() string { return Name } diff --git a/vendor/google.golang.org/grpc/encoding/internal/internal.go b/vendor/google.golang.org/grpc/encoding/internal/internal.go new file mode 100644 index 0000000000..ee9acb4377 --- /dev/null +++ b/vendor/google.golang.org/grpc/encoding/internal/internal.go @@ -0,0 +1,28 @@ +/* + * + * Copyright 2025 gRPC 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. + * + */ + +// Package internal contains code internal to the encoding package. +package internal + +// RegisterCompressorForTesting registers a compressor in the global compressor +// registry. It returns a cleanup function that should be called at the end +// of the test to unregister the compressor. +// +// This prevents compressors registered in one test from appearing in the +// encoding headers of subsequent tests. +var RegisterCompressorForTesting any // func RegisterCompressor(c Compressor) func() diff --git a/vendor/google.golang.org/grpc/encoding/proto/proto.go b/vendor/google.golang.org/grpc/encoding/proto/proto.go index ceec319dd2..1ab874c7ad 100644 --- a/vendor/google.golang.org/grpc/encoding/proto/proto.go +++ b/vendor/google.golang.org/grpc/encoding/proto/proto.go @@ -46,9 +46,25 @@ func (c *codecV2) Marshal(v any) (data mem.BufferSlice, err error) { return nil, fmt.Errorf("proto: failed to marshal, message is %T, want proto.Message", v) } + // Important: if we remove this Size call then we cannot use + // UseCachedSize in MarshalOptions below. size := proto.Size(vv) + + // MarshalOptions with UseCachedSize allows reusing the result from the + // previous Size call. This is safe here because: + // + // 1. We just computed the size. + // 2. We assume the message is not being mutated concurrently. + // + // Important: If the proto.Size call above is removed, using UseCachedSize + // becomes unsafe and may lead to incorrect marshaling. + // + // For more details, see the doc of UseCachedSize: + // https://pkg.go.dev/google.golang.org/protobuf/proto#MarshalOptions + marshalOptions := proto.MarshalOptions{UseCachedSize: true} + if mem.IsBelowBufferPoolingThreshold(size) { - buf, err := proto.Marshal(vv) + buf, err := marshalOptions.Marshal(vv) if err != nil { return nil, err } @@ -56,7 +72,7 @@ func (c *codecV2) Marshal(v any) (data mem.BufferSlice, err error) { } else { pool := mem.DefaultBufferPool() buf := pool.Get(size) - if _, err := (proto.MarshalOptions{}).MarshalAppend((*buf)[:0], vv); err != nil { + if _, err := marshalOptions.MarshalAppend((*buf)[:0], vv); err != nil { pool.Put(buf) return nil, err } diff --git a/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go index ad75313a18..472813f58f 100644 --- a/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go +++ b/vendor/google.golang.org/grpc/experimental/stats/metricregistry.go @@ -75,6 +75,8 @@ const ( MetricTypeIntHisto MetricTypeFloatHisto MetricTypeIntGauge + MetricTypeIntUpDownCount + MetricTypeIntAsyncGauge ) // Int64CountHandle is a typed handle for a int count metric. This handle @@ -93,6 +95,23 @@ func (h *Int64CountHandle) Record(recorder MetricsRecorder, incr int64, labels . recorder.RecordInt64Count(h, incr, labels...) } +// Int64UpDownCountHandle is a typed handle for an int up-down counter metric. +// This handle is passed at the recording point in order to know which metric +// to record on. +type Int64UpDownCountHandle MetricDescriptor + +// Descriptor returns the int64 up-down counter handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64UpDownCountHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 up-down counter value on the metrics recorder provided. +// The value 'v' can be positive to increment or negative to decrement. +func (h *Int64UpDownCountHandle) Record(recorder MetricsRecorder, v int64, labels ...string) { + recorder.RecordInt64UpDownCount(h, v, labels...) +} + // Float64CountHandle is a typed handle for a float count metric. This handle is // passed at the recording point in order to know which metric to record on. type Float64CountHandle MetricDescriptor @@ -154,6 +173,30 @@ func (h *Int64GaugeHandle) Record(recorder MetricsRecorder, incr int64, labels . recorder.RecordInt64Gauge(h, incr, labels...) } +// AsyncMetric is a marker interface for asynchronous metric types. +type AsyncMetric interface { + isAsync() + Descriptor() *MetricDescriptor +} + +// Int64AsyncGaugeHandle is a typed handle for an int gauge metric. This handle is +// passed at the recording point in order to know which metric to record on. +type Int64AsyncGaugeHandle MetricDescriptor + +// isAsync implements the AsyncMetric interface. +func (h *Int64AsyncGaugeHandle) isAsync() {} + +// Descriptor returns the int64 gauge handle typecast to a pointer to a +// MetricDescriptor. +func (h *Int64AsyncGaugeHandle) Descriptor() *MetricDescriptor { + return (*MetricDescriptor)(h) +} + +// Record records the int64 gauge value on the metrics recorder provided. +func (h *Int64AsyncGaugeHandle) Record(recorder AsyncMetricsRecorder, value int64, labels ...string) { + recorder.RecordInt64AsyncGauge(h, value, labels...) +} + // registeredMetrics are the registered metric descriptor names. var registeredMetrics = make(map[string]bool) @@ -249,6 +292,35 @@ func RegisterInt64Gauge(descriptor MetricDescriptor) *Int64GaugeHandle { return (*Int64GaugeHandle)(descPtr) } +// RegisterInt64UpDownCount registers the metric description onto the global registry. +// It returns a typed handle to use for recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64UpDownCount(descriptor MetricDescriptor) *Int64UpDownCountHandle { + registerMetric(descriptor.Name, descriptor.Default) + // Set the specific metric type for the up-down counter + descriptor.Type = MetricTypeIntUpDownCount + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64UpDownCountHandle)(descPtr) +} + +// RegisterInt64AsyncGauge registers the metric description onto the global registry. +// It returns a typed handle to use for recording data. +// +// NOTE: this function must only be called during initialization time (i.e. in +// an init() function), and is not thread-safe. If multiple metrics are +// registered with the same name, this function will panic. +func RegisterInt64AsyncGauge(descriptor MetricDescriptor) *Int64AsyncGaugeHandle { + registerMetric(descriptor.Name, descriptor.Default) + descriptor.Type = MetricTypeIntAsyncGauge + descPtr := &descriptor + metricsRegistry[descriptor.Name] = descPtr + return (*Int64AsyncGaugeHandle)(descPtr) +} + // snapshotMetricsRegistryForTesting snapshots the global data of the metrics // registry. Returns a cleanup function that sets the metrics registry to its // original state. diff --git a/vendor/google.golang.org/grpc/experimental/stats/metrics.go b/vendor/google.golang.org/grpc/experimental/stats/metrics.go index ee1423605a..88742724a4 100644 --- a/vendor/google.golang.org/grpc/experimental/stats/metrics.go +++ b/vendor/google.golang.org/grpc/experimental/stats/metrics.go @@ -19,9 +19,13 @@ // Package stats contains experimental metrics/stats API's. package stats -import "google.golang.org/grpc/stats" +import ( + "google.golang.org/grpc/internal" + "google.golang.org/grpc/stats" +) // MetricsRecorder records on metrics derived from metric registry. +// Implementors must embed UnimplementedMetricsRecorder. type MetricsRecorder interface { // RecordInt64Count records the measurement alongside labels on the int // count associated with the provided handle. @@ -38,6 +42,49 @@ type MetricsRecorder interface { // RecordInt64Gauge records the measurement alongside labels on the int // gauge associated with the provided handle. RecordInt64Gauge(handle *Int64GaugeHandle, incr int64, labels ...string) + // RecordInt64UpDownCounter records the measurement alongside labels on the int + // count associated with the provided handle. + RecordInt64UpDownCount(handle *Int64UpDownCountHandle, incr int64, labels ...string) + // RegisterAsyncReporter registers a reporter to produce metric values for + // only the listed descriptors. The returned function must be called when + // the metrics are no longer needed, which will remove the reporter. The + // returned method needs to be idempotent and concurrent safe. + RegisterAsyncReporter(reporter AsyncMetricReporter, descriptors ...AsyncMetric) func() + + // EnforceMetricsRecorderEmbedding is included to force implementers to embed + // another implementation of this interface, allowing gRPC to add methods + // without breaking users. + internal.EnforceMetricsRecorderEmbedding +} + +// AsyncMetricReporter is an interface for types that record metrics asynchronously +// for the set of descriptors they are registered with. The AsyncMetricsRecorder +// parameter is used to record values for these metrics. +// +// Implementations must make unique recordings across all registered +// AsyncMetricReporters. Meaning, they should not report values for a metric with +// the same attributes as another AsyncMetricReporter will report. +// +// Implementations must be concurrent-safe. +type AsyncMetricReporter interface { + // Report records metric values using the provided recorder. + Report(AsyncMetricsRecorder) error +} + +// AsyncMetricReporterFunc is an adapter to allow the use of ordinary functions as +// AsyncMetricReporters. +type AsyncMetricReporterFunc func(AsyncMetricsRecorder) error + +// Report calls f(r). +func (f AsyncMetricReporterFunc) Report(r AsyncMetricsRecorder) error { + return f(r) +} + +// AsyncMetricsRecorder records on asynchronous metrics derived from metric registry. +type AsyncMetricsRecorder interface { + // RecordInt64AsyncGauge records the measurement alongside labels on the int + // count associated with the provided handle asynchronously + RecordInt64AsyncGauge(handle *Int64AsyncGaugeHandle, incr int64, labels ...string) } // Metrics is an experimental legacy alias of the now-stable stats.MetricSet. @@ -52,3 +99,33 @@ type Metric = string func NewMetrics(metrics ...Metric) *Metrics { return stats.NewMetricSet(metrics...) } + +// UnimplementedMetricsRecorder must be embedded to have forward compatible implementations. +type UnimplementedMetricsRecorder struct { + internal.EnforceMetricsRecorderEmbedding +} + +// RecordInt64Count provides a no-op implementation. +func (UnimplementedMetricsRecorder) RecordInt64Count(*Int64CountHandle, int64, ...string) {} + +// RecordFloat64Count provides a no-op implementation. +func (UnimplementedMetricsRecorder) RecordFloat64Count(*Float64CountHandle, float64, ...string) {} + +// RecordInt64Histo provides a no-op implementation. +func (UnimplementedMetricsRecorder) RecordInt64Histo(*Int64HistoHandle, int64, ...string) {} + +// RecordFloat64Histo provides a no-op implementation. +func (UnimplementedMetricsRecorder) RecordFloat64Histo(*Float64HistoHandle, float64, ...string) {} + +// RecordInt64Gauge provides a no-op implementation. +func (UnimplementedMetricsRecorder) RecordInt64Gauge(*Int64GaugeHandle, int64, ...string) {} + +// RecordInt64UpDownCount provides a no-op implementation. +func (UnimplementedMetricsRecorder) RecordInt64UpDownCount(*Int64UpDownCountHandle, int64, ...string) { +} + +// RegisterAsyncReporter provides a no-op implementation. +func (UnimplementedMetricsRecorder) RegisterAsyncReporter(AsyncMetricReporter, ...AsyncMetric) func() { + // No-op: Return an empty function to ensure caller doesn't panic on nil function call + return func() {} +} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go index faa59e4182..8f7d9f6bbe 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.10 // protoc v5.27.1 // source: grpc/health/v1/health.proto @@ -261,63 +261,29 @@ func (x *HealthListResponse) GetStatuses() map[string]*HealthCheckResponse { var File_grpc_health_v1_health_proto protoreflect.FileDescriptor -var file_grpc_health_v1_health_proto_rawDesc = string([]byte{ - 0x0a, 0x1b, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2f, 0x76, 0x31, - 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x22, 0x2e, 0x0a, - 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x22, 0xb1, 0x01, - 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x31, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x22, 0x4f, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, - 0x0a, 0x07, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x4e, - 0x4f, 0x54, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, - 0x53, 0x45, 0x52, 0x56, 0x49, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x03, 0x22, 0x13, 0x0a, 0x11, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xc4, 0x01, 0x0a, 0x12, 0x48, 0x65, 0x61, 0x6c, 0x74, - 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, - 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x30, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, - 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x1a, 0x60, 0x0a, 0x0d, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x39, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, - 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0xfd, 0x01, - 0x0a, 0x06, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x12, 0x50, 0x0a, 0x05, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, - 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x04, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x21, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, - 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x05, 0x57, 0x61, 0x74, - 0x63, 0x68, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, - 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, - 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x42, 0x70, 0x0a, - 0x11, 0x69, 0x6f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, - 0x76, 0x31, 0x42, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x2c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x67, 0x6f, 0x6c, 0x61, 0x6e, 0x67, - 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, - 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f, 0x76, 0x31, 0xa2, - 0x02, 0x0c, 0x47, 0x72, 0x70, 0x63, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x56, 0x31, 0xaa, 0x02, - 0x0e, 0x47, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x2e, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -}) +const file_grpc_health_v1_health_proto_rawDesc = "" + + "\n" + + "\x1bgrpc/health/v1/health.proto\x12\x0egrpc.health.v1\".\n" + + "\x12HealthCheckRequest\x12\x18\n" + + "\aservice\x18\x01 \x01(\tR\aservice\"\xb1\x01\n" + + "\x13HealthCheckResponse\x12I\n" + + "\x06status\x18\x01 \x01(\x0e21.grpc.health.v1.HealthCheckResponse.ServingStatusR\x06status\"O\n" + + "\rServingStatus\x12\v\n" + + "\aUNKNOWN\x10\x00\x12\v\n" + + "\aSERVING\x10\x01\x12\x0f\n" + + "\vNOT_SERVING\x10\x02\x12\x13\n" + + "\x0fSERVICE_UNKNOWN\x10\x03\"\x13\n" + + "\x11HealthListRequest\"\xc4\x01\n" + + "\x12HealthListResponse\x12L\n" + + "\bstatuses\x18\x01 \x03(\v20.grpc.health.v1.HealthListResponse.StatusesEntryR\bstatuses\x1a`\n" + + "\rStatusesEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x129\n" + + "\x05value\x18\x02 \x01(\v2#.grpc.health.v1.HealthCheckResponseR\x05value:\x028\x012\xfd\x01\n" + + "\x06Health\x12P\n" + + "\x05Check\x12\".grpc.health.v1.HealthCheckRequest\x1a#.grpc.health.v1.HealthCheckResponse\x12M\n" + + "\x04List\x12!.grpc.health.v1.HealthListRequest\x1a\".grpc.health.v1.HealthListResponse\x12R\n" + + "\x05Watch\x12\".grpc.health.v1.HealthCheckRequest\x1a#.grpc.health.v1.HealthCheckResponse0\x01Bp\n" + + "\x11io.grpc.health.v1B\vHealthProtoP\x01Z,google.golang.org/grpc/health/grpc_health_v1\xa2\x02\fGrpcHealthV1\xaa\x02\x0eGrpc.Health.V1b\x06proto3" var ( file_grpc_health_v1_health_proto_rawDescOnce sync.Once diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go index 93136610ec..e99cd5c838 100644 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go +++ b/vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go @@ -17,7 +17,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc v5.27.1 // source: grpc/health/v1/health.proto @@ -188,13 +188,13 @@ type HealthServer interface { type UnimplementedHealthServer struct{} func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Check not implemented") + return nil, status.Error(codes.Unimplemented, "method Check not implemented") } func (UnimplementedHealthServer) List(context.Context, *HealthListRequest) (*HealthListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method List not implemented") + return nil, status.Error(codes.Unimplemented, "method List not implemented") } func (UnimplementedHealthServer) Watch(*HealthCheckRequest, grpc.ServerStreamingServer[HealthCheckResponse]) error { - return status.Errorf(codes.Unimplemented, "method Watch not implemented") + return status.Error(codes.Unimplemented, "method Watch not implemented") } func (UnimplementedHealthServer) testEmbeddedByValue() {} diff --git a/vendor/google.golang.org/grpc/interceptor.go b/vendor/google.golang.org/grpc/interceptor.go index 877d78fc3d..099e3d0933 100644 --- a/vendor/google.golang.org/grpc/interceptor.go +++ b/vendor/google.golang.org/grpc/interceptor.go @@ -97,8 +97,12 @@ type StreamServerInfo struct { IsServerStream bool } -// StreamServerInterceptor provides a hook to intercept the execution of a streaming RPC on the server. -// info contains all the information of this RPC the interceptor can operate on. And handler is the -// service method implementation. It is the responsibility of the interceptor to invoke handler to -// complete the RPC. +// StreamServerInterceptor provides a hook to intercept the execution of a +// streaming RPC on the server. +// +// srv is the service implementation on which the RPC was invoked, and needs to +// be passed to handler, and not used otherwise. ss is the server side of the +// stream. info contains all the information of this RPC the interceptor can +// operate on. And handler is the service method implementation. It is the +// responsibility of the interceptor to invoke handler to complete the RPC. type StreamServerInterceptor func(srv any, ss ServerStream, info *StreamServerInfo, handler StreamHandler) error diff --git a/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go index fbc1ca356a..f38de74a49 100644 --- a/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go +++ b/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/gracefulswitch.go @@ -67,6 +67,10 @@ type Balancer struct { // balancerCurrent before the UpdateSubConnState is called on the // balancerCurrent. currentMu sync.Mutex + + // activeGoroutines tracks all the goroutines that this balancer has started + // and that should be waited on when the balancer closes. + activeGoroutines sync.WaitGroup } // swap swaps out the current lb with the pending lb and updates the ClientConn. @@ -76,7 +80,9 @@ func (gsb *Balancer) swap() { cur := gsb.balancerCurrent gsb.balancerCurrent = gsb.balancerPending gsb.balancerPending = nil + gsb.activeGoroutines.Add(1) go func() { + defer gsb.activeGoroutines.Done() gsb.currentMu.Lock() defer gsb.currentMu.Unlock() cur.Close() @@ -223,15 +229,7 @@ func (gsb *Balancer) ExitIdle() { // There is no need to protect this read with a mutex, as the write to the // Balancer field happens in SwitchTo, which completes before this can be // called. - if ei, ok := balToUpdate.Balancer.(balancer.ExitIdler); ok { - ei.ExitIdle() - return - } - gsb.mu.Lock() - defer gsb.mu.Unlock() - for sc := range balToUpdate.subconns { - sc.Connect() - } + balToUpdate.ExitIdle() } // updateSubConnState forwards the update to the appropriate child. @@ -282,6 +280,7 @@ func (gsb *Balancer) Close() { currentBalancerToClose.Close() pendingBalancerToClose.Close() + gsb.activeGoroutines.Wait() } // balancerWrapper wraps a balancer.Balancer, and overrides some Balancer @@ -332,7 +331,12 @@ func (bw *balancerWrapper) UpdateState(state balancer.State) { defer bw.gsb.mu.Unlock() bw.lastState = state + // If Close() acquires the mutex before UpdateState(), the balancer + // will already have been removed from the current or pending state when + // reaching this point. if !bw.gsb.balancerCurrentOrPending(bw) { + // Returning here ensures that (*Balancer).swap() is not invoked after + // (*Balancer).Close() and therefore prevents "use after close". return } diff --git a/vendor/google.golang.org/grpc/internal/balancer/weight/weight.go b/vendor/google.golang.org/grpc/internal/balancer/weight/weight.go new file mode 100644 index 0000000000..11beb07d14 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/balancer/weight/weight.go @@ -0,0 +1,66 @@ +/* + * + * Copyright 2025 gRPC 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. + * + */ + +// Package weight contains utilities to manage endpoint weights. Weights are +// used by LB policies such as ringhash to distribute load across multiple +// endpoints. +package weight + +import ( + "fmt" + + "google.golang.org/grpc/resolver" +) + +// attributeKey is the type used as the key to store EndpointInfo in the +// Attributes field of resolver.Endpoint. +type attributeKey struct{} + +// EndpointInfo will be stored in the Attributes field of Endpoints in order to +// use the ringhash balancer. +type EndpointInfo struct { + Weight uint32 +} + +// Equal allows the values to be compared by Attributes.Equal. +func (a EndpointInfo) Equal(o any) bool { + oa, ok := o.(EndpointInfo) + return ok && oa.Weight == a.Weight +} + +// Set returns a copy of endpoint in which the Attributes field is updated with +// EndpointInfo. +func Set(endpoint resolver.Endpoint, epInfo EndpointInfo) resolver.Endpoint { + endpoint.Attributes = endpoint.Attributes.WithValue(attributeKey{}, epInfo) + return endpoint +} + +// String returns a human-readable representation of EndpointInfo. +// This method is intended for logging, testing, and debugging purposes only. +// Do not rely on the output format, as it is not guaranteed to remain stable. +func (a EndpointInfo) String() string { + return fmt.Sprintf("Weight: %d", a.Weight) +} + +// FromEndpoint returns the EndpointInfo stored in the Attributes field of an +// endpoint. It returns an empty EndpointInfo if attribute is not found. +func FromEndpoint(endpoint resolver.Endpoint) EndpointInfo { + v := endpoint.Attributes.Value(attributeKey{}) + ei, _ := v.(EndpointInfo) + return ei +} diff --git a/vendor/google.golang.org/grpc/internal/buffer/unbounded.go b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go index 11f91668ac..467392b8d4 100644 --- a/vendor/google.golang.org/grpc/internal/buffer/unbounded.go +++ b/vendor/google.golang.org/grpc/internal/buffer/unbounded.go @@ -83,6 +83,7 @@ func (b *Unbounded) Load() { default: } } else if b.closing && !b.closed { + b.closed = true close(b.c) } } diff --git a/vendor/google.golang.org/grpc/internal/channelz/trace.go b/vendor/google.golang.org/grpc/internal/channelz/trace.go index 2bffe47776..3b7ba59662 100644 --- a/vendor/google.golang.org/grpc/internal/channelz/trace.go +++ b/vendor/google.golang.org/grpc/internal/channelz/trace.go @@ -194,7 +194,7 @@ func (r RefChannelType) String() string { // If channelz is not turned ON, this will simply log the event descriptions. func AddTraceEvent(l grpclog.DepthLoggerV2, e Entity, depth int, desc *TraceEvent) { // Log only the trace description associated with the bottom most entity. - d := fmt.Sprintf("[%s]%s", e, desc.Desc) + d := fmt.Sprintf("[%s] %s", e, desc.Desc) switch desc.Severity { case CtUnknown, CtInfo: l.InfoDepth(depth+1, d) diff --git a/vendor/google.golang.org/grpc/internal/credentials/credentials.go b/vendor/google.golang.org/grpc/internal/credentials/credentials.go index 9deee7f651..48b22d9cf0 100644 --- a/vendor/google.golang.org/grpc/internal/credentials/credentials.go +++ b/vendor/google.golang.org/grpc/internal/credentials/credentials.go @@ -20,20 +20,6 @@ import ( "context" ) -// requestInfoKey is a struct to be used as the key to store RequestInfo in a -// context. -type requestInfoKey struct{} - -// NewRequestInfoContext creates a context with ri. -func NewRequestInfoContext(ctx context.Context, ri any) context.Context { - return context.WithValue(ctx, requestInfoKey{}, ri) -} - -// RequestInfoFromContext extracts the RequestInfo from ctx. -func RequestInfoFromContext(ctx context.Context) any { - return ctx.Value(requestInfoKey{}) -} - // clientHandshakeInfoKey is a struct used as the key to store // ClientHandshakeInfo in a context. type clientHandshakeInfoKey struct{} diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go index cc5713fd9d..7ad6fb44ca 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go @@ -26,35 +26,31 @@ import ( ) var ( - // TXTErrIgnore is set if TXT errors should be ignored ("GRPC_GO_IGNORE_TXT_ERRORS" is not "false"). + // EnableTXTServiceConfig is set if the DNS resolver should perform TXT + // lookups for service config ("GRPC_ENABLE_TXT_SERVICE_CONFIG" is not + // "false"). + EnableTXTServiceConfig = boolFromEnv("GRPC_ENABLE_TXT_SERVICE_CONFIG", true) + + // TXTErrIgnore is set if TXT errors should be ignored + // ("GRPC_GO_IGNORE_TXT_ERRORS" is not "false"). TXTErrIgnore = boolFromEnv("GRPC_GO_IGNORE_TXT_ERRORS", true) + // RingHashCap indicates the maximum ring size which defaults to 4096 // entries but may be overridden by setting the environment variable // "GRPC_RING_HASH_CAP". This does not override the default bounds // checking which NACKs configs specifying ring sizes > 8*1024*1024 (~8M). RingHashCap = uint64FromEnv("GRPC_RING_HASH_CAP", 4096, 1, 8*1024*1024) - // LeastRequestLB is set if we should support the least_request_experimental - // LB policy, which can be enabled by setting the environment variable - // "GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST" to "true". - LeastRequestLB = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_LEAST_REQUEST", false) + // ALTSMaxConcurrentHandshakes is the maximum number of concurrent ALTS // handshakes that can be performed. ALTSMaxConcurrentHandshakes = uint64FromEnv("GRPC_ALTS_MAX_CONCURRENT_HANDSHAKES", 100, 1, 100) + // EnforceALPNEnabled is set if TLS connections to servers with ALPN disabled // should be rejected. The HTTP/2 protocol requires ALPN to be enabled, this // option is present for backward compatibility. This option may be overridden // by setting the environment variable "GRPC_ENFORCE_ALPN_ENABLED" to "true" // or "false". EnforceALPNEnabled = boolFromEnv("GRPC_ENFORCE_ALPN_ENABLED", true) - // XDSFallbackSupport is the env variable that controls whether support for - // xDS fallback is turned on. If this is unset or is false, only the first - // xDS server in the list of server configs will be used. - XDSFallbackSupport = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FALLBACK", true) - // NewPickFirstEnabled is set if the new pickfirst leaf policy is to be used - // instead of the exiting pickfirst implementation. This can be disabled by - // setting the environment variable "GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST" - // to "false". - NewPickFirstEnabled = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_NEW_PICK_FIRST", true) // XDSEndpointHashKeyBackwardCompat controls the parsing of the endpoint hash // key from EDS LbEndpoint metadata. Endpoint hash keys can be disabled by @@ -69,6 +65,45 @@ var ( // to gRFC A76. It can be enabled by setting the environment variable // "GRPC_EXPERIMENTAL_RING_HASH_SET_REQUEST_HASH_KEY" to "true". RingHashSetRequestHashKey = boolFromEnv("GRPC_EXPERIMENTAL_RING_HASH_SET_REQUEST_HASH_KEY", false) + + // ALTSHandshakerKeepaliveParams is set if we should add the + // KeepaliveParams when dial the ALTS handshaker service. + ALTSHandshakerKeepaliveParams = boolFromEnv("GRPC_EXPERIMENTAL_ALTS_HANDSHAKER_KEEPALIVE_PARAMS", false) + + // EnableDefaultPortForProxyTarget controls whether the resolver adds a default port 443 + // to a target address that lacks one. This flag only has an effect when all of + // the following conditions are met: + // - A connect proxy is being used. + // - Target resolution is disabled. + // - The DNS resolver is being used. + EnableDefaultPortForProxyTarget = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_DEFAULT_PORT_FOR_PROXY_TARGET", true) + + // XDSAuthorityRewrite indicates whether xDS authority rewriting is enabled. + // This feature is defined in gRFC A81 and is enabled by setting the + // environment variable GRPC_EXPERIMENTAL_XDS_AUTHORITY_REWRITE to "true". + XDSAuthorityRewrite = boolFromEnv("GRPC_EXPERIMENTAL_XDS_AUTHORITY_REWRITE", false) + + // PickFirstWeightedShuffling indicates whether weighted endpoint shuffling + // is enabled in the pick_first LB policy, as defined in gRFC A113. This + // feature can be disabled by setting the environment variable + // GRPC_EXPERIMENTAL_PF_WEIGHTED_SHUFFLING to "false". + PickFirstWeightedShuffling = boolFromEnv("GRPC_EXPERIMENTAL_PF_WEIGHTED_SHUFFLING", true) + + // DisableStrictPathChecking indicates whether strict path checking is + // disabled. This feature can be disabled by setting the environment + // variable GRPC_GO_EXPERIMENTAL_DISABLE_STRICT_PATH_CHECKING to "true". + // + // When strict path checking is enabled, gRPC will reject requests with + // paths that do not conform to the gRPC over HTTP/2 specification found at + // https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md. + // + // When disabled, gRPC will allow paths that do not contain a leading slash. + // Enabling strict path checking is recommended for security reasons, as it + // prevents potential path traversal vulnerabilities. + // + // A future release will remove this environment variable, enabling strict + // path checking behavior unconditionally. + DisableStrictPathChecking = boolFromEnv("GRPC_GO_EXPERIMENTAL_DISABLE_STRICT_PATH_CHECKING", false) ) func boolFromEnv(envVar string, def bool) bool { diff --git a/vendor/google.golang.org/grpc/internal/envconfig/xds.go b/vendor/google.golang.org/grpc/internal/envconfig/xds.go index 2eb97f832b..7685d08b54 100644 --- a/vendor/google.golang.org/grpc/internal/envconfig/xds.go +++ b/vendor/google.golang.org/grpc/internal/envconfig/xds.go @@ -63,4 +63,20 @@ var ( // For more details, see: // https://github.com/grpc/proposal/blob/master/A82-xds-system-root-certs.md. XDSSystemRootCertsEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_SYSTEM_ROOT_CERTS", false) + + // XDSSPIFFEEnabled controls if SPIFFE Bundle Maps can be used as roots of + // trust. For more details, see: + // https://github.com/grpc/proposal/blob/master/A87-mtls-spiffe-support.md + XDSSPIFFEEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_MTLS_SPIFFE", false) + + // XDSHTTPConnectEnabled is true if gRPC should parse custom Metadata + // configuring use of an HTTP CONNECT proxy via xDS from cluster resources. + // For more details, see: + // https://github.com/grpc/proposal/blob/master/A86-xds-http-connect.md + XDSHTTPConnectEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_HTTP_CONNECT", false) + + // XDSBootstrapCallCredsEnabled controls if call credentials can be used in + // xDS bootstrap configuration via the `call_creds` field. For more details, + // see: https://github.com/grpc/proposal/blob/master/A97-xds-jwt-call-creds.md + XDSBootstrapCallCredsEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_BOOTSTRAP_CALL_CREDS", false) ) diff --git a/vendor/google.golang.org/grpc/internal/experimental.go b/vendor/google.golang.org/grpc/internal/experimental.go index 7617be2158..8a999917d9 100644 --- a/vendor/google.golang.org/grpc/internal/experimental.go +++ b/vendor/google.golang.org/grpc/internal/experimental.go @@ -25,4 +25,11 @@ var ( // BufferPool is implemented by the grpc package and returns a server // option to configure a shared buffer pool for a grpc.Server. BufferPool any // func (grpc.SharedBufferPool) grpc.ServerOption + + // SetDefaultBufferPool updates the default buffer pool. + SetDefaultBufferPool any // func(mem.BufferPool) + + // AcceptCompressors is implemented by the grpc package and returns + // a call option that restricts the grpc-accept-encoding header for a call. + AcceptCompressors any // func(...string) grpc.CallOption ) diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go index 8e8e861280..9b6d8a1fa3 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go @@ -80,25 +80,11 @@ func (cs *CallbackSerializer) ScheduleOr(f func(ctx context.Context), onFailure func (cs *CallbackSerializer) run(ctx context.Context) { defer close(cs.done) - // TODO: when Go 1.21 is the oldest supported version, this loop and Close - // can be replaced with: - // - // context.AfterFunc(ctx, cs.callbacks.Close) - for ctx.Err() == nil { - select { - case <-ctx.Done(): - // Do nothing here. Next iteration of the for loop will not happen, - // since ctx.Err() would be non-nil. - case cb := <-cs.callbacks.Get(): - cs.callbacks.Load() - cb.(func(context.Context))(ctx) - } - } - - // Close the buffer to prevent new callbacks from being added. - cs.callbacks.Close() + // Close the buffer when the context is canceled + // to prevent new callbacks from being added. + context.AfterFunc(ctx, cs.callbacks.Close) - // Run all pending callbacks. + // Run all callbacks. for cb := range cs.callbacks.Get() { cs.callbacks.Load() cb.(func(context.Context))(ctx) diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/event.go b/vendor/google.golang.org/grpc/internal/grpcsync/event.go index fbe697c376..d788c24930 100644 --- a/vendor/google.golang.org/grpc/internal/grpcsync/event.go +++ b/vendor/google.golang.org/grpc/internal/grpcsync/event.go @@ -21,28 +21,25 @@ package grpcsync import ( - "sync" "sync/atomic" ) // Event represents a one-time event that may occur in the future. type Event struct { - fired int32 + fired atomic.Bool c chan struct{} - o sync.Once } // Fire causes e to complete. It is safe to call multiple times, and // concurrently. It returns true iff this call to Fire caused the signaling -// channel returned by Done to close. +// channel returned by Done to close. If Fire returns false, it is possible +// the Done channel has not been closed yet. func (e *Event) Fire() bool { - ret := false - e.o.Do(func() { - atomic.StoreInt32(&e.fired, 1) + if e.fired.CompareAndSwap(false, true) { close(e.c) - ret = true - }) - return ret + return true + } + return false } // Done returns a channel that will be closed when Fire is called. @@ -52,7 +49,7 @@ func (e *Event) Done() <-chan struct{} { // HasFired returns true if Fire has been called. func (e *Event) HasFired() bool { - return atomic.LoadInt32(&e.fired) == 1 + return e.fired.Load() } // NewEvent returns a new, ready-to-use Event. diff --git a/vendor/google.golang.org/grpc/internal/idle/idle.go b/vendor/google.golang.org/grpc/internal/idle/idle.go index 2c13ee9dac..d3cd24f80b 100644 --- a/vendor/google.golang.org/grpc/internal/idle/idle.go +++ b/vendor/google.golang.org/grpc/internal/idle/idle.go @@ -21,7 +21,6 @@ package idle import ( - "fmt" "math" "sync" "sync/atomic" @@ -33,15 +32,15 @@ var timeAfterFunc = func(d time.Duration, f func()) *time.Timer { return time.AfterFunc(d, f) } -// Enforcer is the functionality provided by grpc.ClientConn to enter -// and exit from idle mode. -type Enforcer interface { - ExitIdleMode() error +// ClientConn is the functionality provided by grpc.ClientConn to enter and exit +// from idle mode. +type ClientConn interface { + ExitIdleMode() EnterIdleMode() } -// Manager implements idleness detection and calls the configured Enforcer to -// enter/exit idle mode when appropriate. Must be created by NewManager. +// Manager implements idleness detection and calls the ClientConn to enter/exit +// idle mode when appropriate. Must be created by NewManager. type Manager struct { // State accessed atomically. lastCallEndTime int64 // Unix timestamp in nanos; time when the most recent RPC completed. @@ -51,8 +50,8 @@ type Manager struct { // Can be accessed without atomics or mutex since these are set at creation // time and read-only after that. - enforcer Enforcer // Functionality provided by grpc.ClientConn. - timeout time.Duration + cc ClientConn // Functionality provided by grpc.ClientConn. + timeout time.Duration // idleMu is used to guarantee mutual exclusion in two scenarios: // - Opposing intentions: @@ -72,9 +71,9 @@ type Manager struct { // NewManager creates a new idleness manager implementation for the // given idle timeout. It begins in idle mode. -func NewManager(enforcer Enforcer, timeout time.Duration) *Manager { +func NewManager(cc ClientConn, timeout time.Duration) *Manager { return &Manager{ - enforcer: enforcer, + cc: cc, timeout: timeout, actuallyIdle: true, activeCallsCount: -math.MaxInt32, @@ -127,7 +126,7 @@ func (m *Manager) handleIdleTimeout() { // Now that we've checked that there has been no activity, attempt to enter // idle mode, which is very likely to succeed. - if m.tryEnterIdleMode() { + if m.tryEnterIdleMode(true) { // Successfully entered idle mode. No timer needed until we exit idle. return } @@ -142,10 +141,13 @@ func (m *Manager) handleIdleTimeout() { // that, it performs a last minute check to ensure that no new RPC has come in, // making the channel active. // +// checkActivity controls if a check for RPC activity, since the last time the +// idle_timeout fired, is made. + // Return value indicates whether or not the channel moved to idle mode. // // Holds idleMu which ensures mutual exclusion with exitIdleMode. -func (m *Manager) tryEnterIdleMode() bool { +func (m *Manager) tryEnterIdleMode(checkActivity bool) bool { // Setting the activeCallsCount to -math.MaxInt32 indicates to OnCallBegin() // that the channel is either in idle mode or is trying to get there. if !atomic.CompareAndSwapInt32(&m.activeCallsCount, 0, -math.MaxInt32) { @@ -166,7 +168,7 @@ func (m *Manager) tryEnterIdleMode() bool { atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) return false } - if atomic.LoadInt32(&m.activeSinceLastTimerCheck) == 1 { + if checkActivity && atomic.LoadInt32(&m.activeSinceLastTimerCheck) == 1 { // A very short RPC could have come in (and also finished) after we // checked for calls count and activity in handleIdleTimeout(), but // before the CAS operation. So, we need to check for activity again. @@ -177,44 +179,37 @@ func (m *Manager) tryEnterIdleMode() bool { // No new RPCs have come in since we set the active calls count value to // -math.MaxInt32. And since we have the lock, it is safe to enter idle mode // unconditionally now. - m.enforcer.EnterIdleMode() + m.cc.EnterIdleMode() m.actuallyIdle = true return true } // EnterIdleModeForTesting instructs the channel to enter idle mode. func (m *Manager) EnterIdleModeForTesting() { - m.tryEnterIdleMode() + m.tryEnterIdleMode(false) } // OnCallBegin is invoked at the start of every RPC. -func (m *Manager) OnCallBegin() error { +func (m *Manager) OnCallBegin() { if m.isClosed() { - return nil + return } if atomic.AddInt32(&m.activeCallsCount, 1) > 0 { // Channel is not idle now. Set the activity bit and allow the call. atomic.StoreInt32(&m.activeSinceLastTimerCheck, 1) - return nil + return } // Channel is either in idle mode or is in the process of moving to idle // mode. Attempt to exit idle mode to allow this RPC. - if err := m.ExitIdleMode(); err != nil { - // Undo the increment to calls count, and return an error causing the - // RPC to fail. - atomic.AddInt32(&m.activeCallsCount, -1) - return err - } - + m.ExitIdleMode() atomic.StoreInt32(&m.activeSinceLastTimerCheck, 1) - return nil } -// ExitIdleMode instructs m to call the enforcer's ExitIdleMode and update m's +// ExitIdleMode instructs m to call the ClientConn's ExitIdleMode and update its // internal state. -func (m *Manager) ExitIdleMode() error { +func (m *Manager) ExitIdleMode() { // Holds idleMu which ensures mutual exclusion with tryEnterIdleMode. m.idleMu.Lock() defer m.idleMu.Unlock() @@ -231,12 +226,10 @@ func (m *Manager) ExitIdleMode() error { // m.ExitIdleMode. // // In any case, there is nothing to do here. - return nil + return } - if err := m.enforcer.ExitIdleMode(); err != nil { - return fmt.Errorf("failed to exit idle mode: %w", err) - } + m.cc.ExitIdleMode() // Undo the idle entry process. This also respects any new RPC attempts. atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) @@ -244,7 +237,23 @@ func (m *Manager) ExitIdleMode() error { // Start a new timer to fire after the configured idle timeout. m.resetIdleTimerLocked(m.timeout) - return nil +} + +// UnsafeSetNotIdle instructs the Manager to update its internal state to +// reflect the reality that the channel is no longer in IDLE mode. +// +// N.B. This method is intended only for internal use by the gRPC client +// when it exits IDLE mode **manually** from `Dial`. The callsite must ensure: +// - The channel was **actually in IDLE mode** immediately prior to the call. +// - There is **no concurrent activity** that could cause the channel to exit +// IDLE mode *naturally* at the same time. +func (m *Manager) UnsafeSetNotIdle() { + m.idleMu.Lock() + defer m.idleMu.Unlock() + + atomic.AddInt32(&m.activeCallsCount, math.MaxInt32) + m.actuallyIdle = false + m.resetIdleTimerLocked(m.timeout) } // OnCallEnd is invoked at the end of every RPC. diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go index 2ce012cda1..4b3d563f8d 100644 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ b/vendor/google.golang.org/grpc/internal/internal.go @@ -182,35 +182,6 @@ var ( // other features, including the CSDS service. NewXDSResolverWithClientForTesting any // func(xdsclient.XDSClient) (resolver.Builder, error) - // RegisterRLSClusterSpecifierPluginForTesting registers the RLS Cluster - // Specifier Plugin for testing purposes, regardless of the XDSRLS environment - // variable. - // - // TODO: Remove this function once the RLS env var is removed. - RegisterRLSClusterSpecifierPluginForTesting func() - - // UnregisterRLSClusterSpecifierPluginForTesting unregisters the RLS Cluster - // Specifier Plugin for testing purposes. This is needed because there is no way - // to unregister the RLS Cluster Specifier Plugin after registering it solely - // for testing purposes using RegisterRLSClusterSpecifierPluginForTesting(). - // - // TODO: Remove this function once the RLS env var is removed. - UnregisterRLSClusterSpecifierPluginForTesting func() - - // RegisterRBACHTTPFilterForTesting registers the RBAC HTTP Filter for testing - // purposes, regardless of the RBAC environment variable. - // - // TODO: Remove this function once the RBAC env var is removed. - RegisterRBACHTTPFilterForTesting func() - - // UnregisterRBACHTTPFilterForTesting unregisters the RBAC HTTP Filter for - // testing purposes. This is needed because there is no way to unregister the - // HTTP Filter after registering it solely for testing purposes using - // RegisterRBACHTTPFilterForTesting(). - // - // TODO: Remove this function once the RBAC env var is removed. - UnregisterRBACHTTPFilterForTesting func() - // ORCAAllowAnyMinReportingInterval is for examples/orca use ONLY. ORCAAllowAnyMinReportingInterval any // func(so *orca.ServiceOptions) @@ -240,22 +211,11 @@ var ( // default resolver scheme. UserSetDefaultScheme = false - // ConnectedAddress returns the connected address for a SubConnState. The - // address is only valid if the state is READY. - ConnectedAddress any // func (scs SubConnState) resolver.Address - - // SetConnectedAddress sets the connected address for a SubConnState. - SetConnectedAddress any // func(scs *SubConnState, addr resolver.Address) - // SnapshotMetricRegistryForTesting snapshots the global data of the metric // registry. Returns a cleanup function that sets the metric registry to its // original state. Only called in testing functions. SnapshotMetricRegistryForTesting func() func() - // SetDefaultBufferPoolForTesting updates the default buffer pool, for - // testing purposes. - SetDefaultBufferPoolForTesting any // func(mem.BufferPool) - // SetBufferPoolingThresholdForTesting updates the buffer pooling threshold, for // testing purposes. SetBufferPoolingThresholdForTesting any // func(int) @@ -266,6 +226,25 @@ var ( TimeAfterFunc = func(d time.Duration, f func()) Timer { return time.AfterFunc(d, f) } + + // NewStreamWaitingForResolver is a test hook that is triggered when a + // new stream blocks while waiting for name resolution. This can be + // used in tests to synchronize resolver updates and avoid race conditions. + // When set, the function will be called before the stream enters + // the blocking state. + NewStreamWaitingForResolver = func() {} + + // AddressToTelemetryLabels is an xDS-provided function to extract telemetry + // labels from a resolver.Address. Callers must assert its type before calling. + AddressToTelemetryLabels any // func(addr resolver.Address) map[string]string + + // AsyncReporterCleanupDelegate is initialized to a pass-through function by + // default (production behavior), allowing tests to swap it with an + // implementation which tracks registration of async reporter and its + // corresponding cleanup. + AsyncReporterCleanupDelegate = func(cleanup func()) func() { + return cleanup + } ) // HealthChecker defines the signature of the client-side LB channel health @@ -313,3 +292,9 @@ type EnforceClientConnEmbedding interface { type Timer interface { Stop() bool } + +// EnforceMetricsRecorderEmbedding is used to enforce proper MetricsRecorder +// implementation embedding. +type EnforceMetricsRecorderEmbedding interface { + enforceMetricsRecorderEmbedding() +} diff --git a/vendor/google.golang.org/grpc/internal/resolver/delegatingresolver/delegatingresolver.go b/vendor/google.golang.org/grpc/internal/resolver/delegatingresolver/delegatingresolver.go index 20b8fb098a..5bfa67b726 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/delegatingresolver/delegatingresolver.go +++ b/vendor/google.golang.org/grpc/internal/resolver/delegatingresolver/delegatingresolver.go @@ -22,11 +22,13 @@ package delegatingresolver import ( "fmt" + "net" "net/http" "net/url" "sync" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/proxyattributes" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/internal/transport/networktype" @@ -40,6 +42,8 @@ var ( HTTPSProxyFromEnvironment = http.ProxyFromEnvironment ) +const defaultPort = "443" + // delegatingResolver manages both target URI and proxy address resolution by // delegating these tasks to separate child resolvers. Essentially, it acts as // an intermediary between the gRPC ClientConn and the child resolvers. @@ -107,10 +111,18 @@ func New(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOpti targetResolver: nopResolver{}, } + addr := target.Endpoint() var err error - r.proxyURL, err = proxyURLForTarget(target.Endpoint()) + if target.URL.Scheme == "dns" && !targetResolutionEnabled && envconfig.EnableDefaultPortForProxyTarget { + addr, err = parseTarget(addr) + if err != nil { + return nil, fmt.Errorf("delegating_resolver: invalid target address %q: %v", target.Endpoint(), err) + } + } + + r.proxyURL, err = proxyURLForTarget(addr) if err != nil { - return nil, fmt.Errorf("delegating_resolver: failed to determine proxy URL for target %s: %v", target, err) + return nil, fmt.Errorf("delegating_resolver: failed to determine proxy URL for target %q: %v", target, err) } // proxy is not configured or proxy address excluded using `NO_PROXY` env @@ -132,8 +144,8 @@ func New(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOpti // bypass the target resolver and store the unresolved target address. if target.URL.Scheme == "dns" && !targetResolutionEnabled { r.targetResolverState = &resolver.State{ - Addresses: []resolver.Address{{Addr: target.Endpoint()}}, - Endpoints: []resolver.Endpoint{{Addresses: []resolver.Address{{Addr: target.Endpoint()}}}}, + Addresses: []resolver.Address{{Addr: addr}}, + Endpoints: []resolver.Endpoint{{Addresses: []resolver.Address{{Addr: addr}}}}, } r.updateTargetResolverState(*r.targetResolverState) return r, nil @@ -202,6 +214,44 @@ func needsProxyResolver(state *resolver.State) bool { return false } +// parseTarget takes a target string and ensures it is a valid "host:port" target. +// +// It does the following: +// 1. If the target already has a port (e.g., "host:port", "[ipv6]:port"), +// it is returned as is. +// 2. If the host part is empty (e.g., ":80"), it defaults to "localhost", +// returning "localhost:80". +// 3. If the target is missing a port (e.g., "host", "ipv6"), the defaultPort +// is added. +// +// An error is returned for empty targets or targets with a trailing colon +// but no port (e.g., "host:"). +func parseTarget(target string) (string, error) { + if target == "" { + return "", fmt.Errorf("missing address") + } + + host, port, err := net.SplitHostPort(target) + if err != nil { + // If SplitHostPort fails, it's likely because the port is missing. + // We append the default port and return the result. + return net.JoinHostPort(target, defaultPort), nil + } + + // If SplitHostPort succeeds, we check for edge cases. + if port == "" { + // A success with an empty port means the target had a trailing colon, + // e.g., "host:", which is an error. + return "", fmt.Errorf("missing port after port-separator colon") + } + if host == "" { + // A success with an empty host means the target was like ":80". + // We default the host to "localhost". + host = "localhost" + } + return net.JoinHostPort(host, port), nil +} + func skipProxy(address resolver.Address) bool { // Avoid proxy when network is not tcp. networkType, ok := networktype.Get(address) diff --git a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go index ba5c5a95d0..70b89e4d7f 100644 --- a/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go +++ b/vendor/google.golang.org/grpc/internal/resolver/dns/dns_resolver.go @@ -125,20 +125,23 @@ func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts // IP address. if ipAddr, err := formatIP(host); err == nil { addr := []resolver.Address{{Addr: ipAddr + ":" + port}} - cc.UpdateState(resolver.State{Addresses: addr}) + cc.UpdateState(resolver.State{ + Addresses: addr, + Endpoints: []resolver.Endpoint{{Addresses: addr}}, + }) return deadResolver{}, nil } // DNS address (non-IP). ctx, cancel := context.WithCancel(context.Background()) d := &dnsResolver{ - host: host, - port: port, - ctx: ctx, - cancel: cancel, - cc: cc, - rn: make(chan struct{}, 1), - disableServiceConfig: opts.DisableServiceConfig, + host: host, + port: port, + ctx: ctx, + cancel: cancel, + cc: cc, + rn: make(chan struct{}, 1), + enableServiceConfig: envconfig.EnableTXTServiceConfig && !opts.DisableServiceConfig, } d.resolver, err = internal.NewNetResolver(target.URL.Host) @@ -181,8 +184,8 @@ type dnsResolver struct { // finishes, race detector sometimes will warn lookup (READ the lookup // function pointers) inside watcher() goroutine has data race with // replaceNetFunc (WRITE the lookup function pointers). - wg sync.WaitGroup - disableServiceConfig bool + wg sync.WaitGroup + enableServiceConfig bool } // ResolveNow invoke an immediate resolution of the target that this @@ -342,11 +345,19 @@ func (d *dnsResolver) lookup() (*resolver.State, error) { return nil, hostErr } - state := resolver.State{Addresses: addrs} + eps := make([]resolver.Endpoint, 0, len(addrs)) + for _, addr := range addrs { + eps = append(eps, resolver.Endpoint{Addresses: []resolver.Address{addr}}) + } + + state := resolver.State{ + Addresses: addrs, + Endpoints: eps, + } if len(srv) > 0 { state = grpclbstate.Set(state, &grpclbstate.State{BalancerAddresses: srv}) } - if !d.disableServiceConfig { + if d.enableServiceConfig { state.ServiceConfig = d.lookupTXT(ctx) } return &state, nil diff --git a/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go b/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go index 79044657be..1c8c2ab303 100644 --- a/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go +++ b/vendor/google.golang.org/grpc/internal/stats/metrics_recorder_list.go @@ -20,6 +20,7 @@ import ( "fmt" estats "google.golang.org/grpc/experimental/stats" + "google.golang.org/grpc/internal" "google.golang.org/grpc/stats" ) @@ -28,6 +29,7 @@ import ( // It eats any record calls where the label values provided do not match the // number of label keys. type MetricsRecorderList struct { + internal.EnforceMetricsRecorderEmbedding // metricsRecorders are the metrics recorders this list will forward to. metricsRecorders []estats.MetricsRecorder } @@ -64,6 +66,16 @@ func (l *MetricsRecorderList) RecordInt64Count(handle *estats.Int64CountHandle, } } +// RecordInt64UpDownCount records the measurement alongside labels on the int +// count associated with the provided handle. +func (l *MetricsRecorderList) RecordInt64UpDownCount(handle *estats.Int64UpDownCountHandle, incr int64, labels ...string) { + verifyLabels(handle.Descriptor(), labels...) + + for _, metricRecorder := range l.metricsRecorders { + metricRecorder.RecordInt64UpDownCount(handle, incr, labels...) + } +} + // RecordFloat64Count records the measurement alongside labels on the float // count associated with the provided handle. func (l *MetricsRecorderList) RecordFloat64Count(handle *estats.Float64CountHandle, incr float64, labels ...string) { @@ -103,3 +115,61 @@ func (l *MetricsRecorderList) RecordInt64Gauge(handle *estats.Int64GaugeHandle, metricRecorder.RecordInt64Gauge(handle, incr, labels...) } } + +// RegisterAsyncReporter forwards the registration to all underlying metrics +// recorders. +// +// It returns a cleanup function that, when called, invokes the cleanup function +// returned by each underlying recorder, ensuring the reporter is unregistered +// from all of them. +func (l *MetricsRecorderList) RegisterAsyncReporter(reporter estats.AsyncMetricReporter, metrics ...estats.AsyncMetric) func() { + descriptorsMap := make(map[*estats.MetricDescriptor]bool, len(metrics)) + for _, m := range metrics { + descriptorsMap[m.Descriptor()] = true + } + unregisterFns := make([]func(), 0, len(l.metricsRecorders)) + for _, mr := range l.metricsRecorders { + // Wrap the AsyncMetricsRecorder to intercept calls to RecordInt64Gauge + // and validate the labels. + wrappedCallback := func(recorder estats.AsyncMetricsRecorder) error { + wrappedRecorder := &asyncRecorderWrapper{ + delegate: recorder, + descriptors: descriptorsMap, + } + return reporter.Report(wrappedRecorder) + } + unregisterFns = append(unregisterFns, mr.RegisterAsyncReporter(estats.AsyncMetricReporterFunc(wrappedCallback), metrics...)) + } + + // Wrap the cleanup function using the internal delegate. + // In production, this returns realCleanup as-is. + // In tests, the leak checker can swap this to track the registration lifetime. + return internal.AsyncReporterCleanupDelegate(defaultCleanUp(unregisterFns)) +} + +func defaultCleanUp(unregisterFns []func()) func() { + return func() { + for _, unregister := range unregisterFns { + unregister() + } + } +} + +type asyncRecorderWrapper struct { + delegate estats.AsyncMetricsRecorder + descriptors map[*estats.MetricDescriptor]bool +} + +// RecordIntAsync64Gauge records the measurement alongside labels on the int +// gauge associated with the provided handle. +func (w *asyncRecorderWrapper) RecordInt64AsyncGauge(handle *estats.Int64AsyncGaugeHandle, value int64, labels ...string) { + // Ensure only metrics for descriptors passed during callback registration + // are emitted. + d := handle.Descriptor() + if _, ok := w.descriptors[d]; !ok { + return + } + // Validate labels and delegate. + verifyLabels(d, labels...) + w.delegate.RecordInt64AsyncGauge(handle, value, labels...) +} diff --git a/vendor/google.golang.org/grpc/internal/stats/stats.go b/vendor/google.golang.org/grpc/internal/stats/stats.go new file mode 100644 index 0000000000..49019b80d1 --- /dev/null +++ b/vendor/google.golang.org/grpc/internal/stats/stats.go @@ -0,0 +1,70 @@ +/* + * + * Copyright 2025 gRPC 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. + * + */ + +package stats + +import ( + "context" + + "google.golang.org/grpc/stats" +) + +type combinedHandler struct { + handlers []stats.Handler +} + +// NewCombinedHandler combines multiple stats.Handlers into a single handler. +// +// It returns nil if no handlers are provided. If only one handler is +// provided, it is returned directly without wrapping. +func NewCombinedHandler(handlers ...stats.Handler) stats.Handler { + switch len(handlers) { + case 0: + return nil + case 1: + return handlers[0] + default: + return &combinedHandler{handlers: handlers} + } +} + +func (ch *combinedHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { + for _, h := range ch.handlers { + ctx = h.TagRPC(ctx, info) + } + return ctx +} + +func (ch *combinedHandler) HandleRPC(ctx context.Context, stats stats.RPCStats) { + for _, h := range ch.handlers { + h.HandleRPC(ctx, stats) + } +} + +func (ch *combinedHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context { + for _, h := range ch.handlers { + ctx = h.TagConn(ctx, info) + } + return ctx +} + +func (ch *combinedHandler) HandleConn(ctx context.Context, stats stats.ConnStats) { + for _, h := range ch.handlers { + h.HandleConn(ctx, stats) + } +} diff --git a/vendor/google.golang.org/grpc/internal/status/status.go b/vendor/google.golang.org/grpc/internal/status/status.go index 1186f1e9a9..aad171cd02 100644 --- a/vendor/google.golang.org/grpc/internal/status/status.go +++ b/vendor/google.golang.org/grpc/internal/status/status.go @@ -236,3 +236,11 @@ func IsRestrictedControlPlaneCode(s *Status) bool { } return false } + +// RawStatusProto returns the internal protobuf message for use by gRPC itself. +func RawStatusProto(s *Status) *spb.Status { + if s == nil { + return nil + } + return s.s +} diff --git a/vendor/google.golang.org/grpc/internal/transport/client_stream.go b/vendor/google.golang.org/grpc/internal/transport/client_stream.go index ccc0e017e5..cd8152ef13 100644 --- a/vendor/google.golang.org/grpc/internal/transport/client_stream.go +++ b/vendor/google.golang.org/grpc/internal/transport/client_stream.go @@ -24,30 +24,34 @@ import ( "golang.org/x/net/http2" "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/stats" "google.golang.org/grpc/status" ) // ClientStream implements streaming functionality for a gRPC client. type ClientStream struct { - *Stream // Embed for common stream functionality. + Stream // Embed for common stream functionality. ct *http2Client done chan struct{} // closed at the end of stream to unblock writers. doneFunc func() // invoked at the end of stream. - headerChan chan struct{} // closed to indicate the end of header metadata. - headerChanClosed uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. + headerChan chan struct{} // closed to indicate the end of header metadata. + header metadata.MD // the received header metadata + + status *status.Status // the status error received from the server + + // Non-pointer fields are at the end to optimize GC allocations. + // headerValid indicates whether a valid header was received. Only // meaningful after headerChan is closed (always call waitOnHeader() before // reading its value). - headerValid bool - header metadata.MD // the received header metadata - noHeaders bool // set if the client never received headers (set only after the stream is done). - - bytesReceived atomic.Bool // indicates whether any bytes have been received on this stream - unprocessed atomic.Bool // set if the server sends a refused stream or GOAWAY including this stream - - status *status.Status // the status error received from the server + headerValid bool + noHeaders bool // set if the client never received headers (set only after the stream is done). + headerChanClosed uint32 // set when headerChan is closed. Used to avoid closing headerChan multiple times. + bytesReceived atomic.Bool // indicates whether any bytes have been received on this stream + unprocessed atomic.Bool // set if the server sends a refused stream or GOAWAY including this stream + statsHandler stats.Handler // nil for internal streams (e.g., health check, ORCA) where telemetry is not supported. } // Read reads an n byte message from the input stream. @@ -142,3 +146,11 @@ func (s *ClientStream) TrailersOnly() bool { func (s *ClientStream) Status() *status.Status { return s.status } + +func (s *ClientStream) requestRead(n int) { + s.ct.adjustWindow(s, uint32(n)) +} + +func (s *ClientStream) updateWindow(n int) { + s.ct.updateWindow(s, uint32(n)) +} diff --git a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go index ef72fbb3a0..7efa524785 100644 --- a/vendor/google.golang.org/grpc/internal/transport/controlbuf.go +++ b/vendor/google.golang.org/grpc/internal/transport/controlbuf.go @@ -24,22 +24,26 @@ import ( "fmt" "net" "runtime" - "strconv" "sync" "sync/atomic" "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" "google.golang.org/grpc/internal/grpclog" - "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/mem" - "google.golang.org/grpc/status" ) var updateHeaderTblSize = func(e *hpack.Encoder, v uint32) { e.SetMaxDynamicTableSizeLimit(v) } +// itemNodePool is used to reduce heap allocations. +var itemNodePool = sync.Pool{ + New: func() any { + return &itemNode{} + }, +} + type itemNode struct { it any next *itemNode @@ -51,7 +55,9 @@ type itemList struct { } func (il *itemList) enqueue(i any) { - n := &itemNode{it: i} + n := itemNodePool.Get().(*itemNode) + n.next = nil + n.it = i if il.tail == nil { il.head, il.tail = n, n return @@ -71,7 +77,9 @@ func (il *itemList) dequeue() any { return nil } i := il.head.it + temp := il.head il.head = il.head.next + itemNodePool.Put(temp) if il.head == nil { il.tail = nil } @@ -136,20 +144,19 @@ type cleanupStream struct { func (c *cleanupStream) isTransportResponseFrame() bool { return c.rst } // Results in a RST_STREAM type earlyAbortStream struct { - httpStatus uint32 - streamID uint32 - contentSubtype string - status *status.Status - rst bool + streamID uint32 + rst bool + hf []hpack.HeaderField // Pre-built header fields } func (*earlyAbortStream) isTransportResponseFrame() bool { return false } type dataFrame struct { - streamID uint32 - endStream bool - h []byte - reader mem.Reader + streamID uint32 + endStream bool + h []byte + data mem.BufferSlice + processing bool // onEachWrite is called every time // a part of data is written out. onEachWrite func() @@ -234,6 +241,7 @@ type outStream struct { itl *itemList bytesOutStanding int wq *writeQuota + reader mem.Reader next *outStream prev *outStream @@ -461,7 +469,9 @@ func (c *controlBuffer) finish() { v.onOrphaned(ErrConnClosing) } case *dataFrame: - _ = v.reader.Close() + if !v.processing { + v.data.Free() + } } } @@ -481,6 +491,16 @@ const ( serverSide ) +// maxWriteBufSize is the maximum length (number of elements) the cached +// writeBuf can grow to. The length depends on the number of buffers +// contained within the BufferSlice produced by the codec, which is +// generally small. +// +// If a writeBuf larger than this limit is required, it will be allocated +// and freed after use, rather than being cached. This avoids holding +// on to large amounts of memory. +const maxWriteBufSize = 64 + // Loopy receives frames from the control buffer. // Each frame is handled individually; most of the work done by loopy goes // into handling data frames. Loopy maintains a queue of active streams, and each @@ -515,6 +535,8 @@ type loopyWriter struct { // Side-specific handlers ssGoAwayHandler func(*goAway) (bool, error) + + writeBuf [][]byte // cached slice to avoid heap allocations for calls to mem.Reader.Peek. } func newLoopyWriter(s side, fr *framer, cbuf *controlBuffer, bdpEst *bdpEstimator, conn net.Conn, logger *grpclog.PrefixLogger, goAwayHandler func(*goAway) (bool, error), bufferPool mem.BufferPool) *loopyWriter { @@ -790,10 +812,13 @@ func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error { // a RST_STREAM before stream initialization thus the stream might // not be established yet. delete(l.estdStreams, c.streamID) + str.reader.Close() str.deleteSelf() for head := str.itl.dequeueAll(); head != nil; head = head.next { if df, ok := head.it.(*dataFrame); ok { - _ = df.reader.Close() + if !df.processing { + df.data.Free() + } } } } @@ -813,18 +838,7 @@ func (l *loopyWriter) earlyAbortStreamHandler(eas *earlyAbortStream) error { if l.side == clientSide { return errors.New("earlyAbortStream not handled on client") } - // In case the caller forgets to set the http status, default to 200. - if eas.httpStatus == 0 { - eas.httpStatus = 200 - } - headerFields := []hpack.HeaderField{ - {Name: ":status", Value: strconv.Itoa(int(eas.httpStatus))}, - {Name: "content-type", Value: grpcutil.ContentType(eas.contentSubtype)}, - {Name: "grpc-status", Value: strconv.Itoa(int(eas.status.Code()))}, - {Name: "grpc-message", Value: encodeGrpcMessage(eas.status.Message())}, - } - - if err := l.writeHeader(eas.streamID, true, headerFields, nil); err != nil { + if err := l.writeHeader(eas.streamID, true, eas.hf, nil); err != nil { return err } if eas.rst { @@ -928,7 +942,13 @@ func (l *loopyWriter) processData() (bool, error) { if str == nil { return true, nil } + reader := &str.reader dataItem := str.itl.peek().(*dataFrame) // Peek at the first data item this stream. + if !dataItem.processing { + dataItem.processing = true + reader.Reset(dataItem.data) + dataItem.data.Free() + } // A data item is represented by a dataFrame, since it later translates into // multiple HTTP2 data frames. // Every dataFrame has two buffers; h that keeps grpc-message header and data @@ -936,13 +956,13 @@ func (l *loopyWriter) processData() (bool, error) { // from data is copied to h to make as big as the maximum possible HTTP2 frame // size. - if len(dataItem.h) == 0 && dataItem.reader.Remaining() == 0 { // Empty data frame + if len(dataItem.h) == 0 && reader.Remaining() == 0 { // Empty data frame // Client sends out empty data frame with endStream = true - if err := l.framer.fr.WriteData(dataItem.streamID, dataItem.endStream, nil); err != nil { + if err := l.framer.writeData(dataItem.streamID, dataItem.endStream, nil); err != nil { return false, err } str.itl.dequeue() // remove the empty data item from stream - _ = dataItem.reader.Close() + reader.Close() if str.itl.isEmpty() { str.state = empty } else if trailer, ok := str.itl.peek().(*headerFrame); ok { // the next item is trailers. @@ -971,29 +991,24 @@ func (l *loopyWriter) processData() (bool, error) { } // Compute how much of the header and data we can send within quota and max frame length hSize := min(maxSize, len(dataItem.h)) - dSize := min(maxSize-hSize, dataItem.reader.Remaining()) - remainingBytes := len(dataItem.h) + dataItem.reader.Remaining() - hSize - dSize + dSize := min(maxSize-hSize, reader.Remaining()) + remainingBytes := len(dataItem.h) + reader.Remaining() - hSize - dSize size := hSize + dSize - var buf *[]byte - - if hSize != 0 && dSize == 0 { - buf = &dataItem.h - } else { - // Note: this is only necessary because the http2.Framer does not support - // partially writing a frame, so the sequence must be materialized into a buffer. - // TODO: Revisit once https://github.com/golang/go/issues/66655 is addressed. - pool := l.bufferPool - if pool == nil { - // Note that this is only supposed to be nil in tests. Otherwise, stream is - // always initialized with a BufferPool. - pool = mem.DefaultBufferPool() + l.writeBuf = l.writeBuf[:0] + if hSize > 0 { + l.writeBuf = append(l.writeBuf, dataItem.h[:hSize]) + } + if dSize > 0 { + var err error + l.writeBuf, err = reader.Peek(dSize, l.writeBuf) + if err != nil { + // This must never happen since the reader must have at least dSize + // bytes. + // Log an error to fail tests. + l.logger.Errorf("unexpected error while reading Data frame payload: %v", err) + return false, err } - buf = pool.Get(size) - defer pool.Put(buf) - - copy((*buf)[:hSize], dataItem.h) - _, _ = dataItem.reader.Read((*buf)[hSize:]) } // Now that outgoing flow controls are checked we can replenish str's write quota @@ -1006,7 +1021,14 @@ func (l *loopyWriter) processData() (bool, error) { if dataItem.onEachWrite != nil { dataItem.onEachWrite() } - if err := l.framer.fr.WriteData(dataItem.streamID, endStream, (*buf)[:size]); err != nil { + err := l.framer.writeData(dataItem.streamID, endStream, l.writeBuf) + reader.Discard(dSize) + if cap(l.writeBuf) > maxWriteBufSize { + l.writeBuf = nil + } else { + clear(l.writeBuf) + } + if err != nil { return false, err } str.bytesOutStanding += size @@ -1014,7 +1036,7 @@ func (l *loopyWriter) processData() (bool, error) { dataItem.h = dataItem.h[hSize:] if remainingBytes == 0 { // All the data from that message was written out. - _ = dataItem.reader.Close() + reader.Close() str.itl.dequeue() } if str.itl.isEmpty() { diff --git a/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go b/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go index dfc0f224ec..7cfbc9637b 100644 --- a/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go +++ b/vendor/google.golang.org/grpc/internal/transport/flowcontrol.go @@ -28,7 +28,7 @@ import ( // writeQuota is a soft limit on the amount of data a stream can // schedule before some of it is written out. type writeQuota struct { - quota int32 + _ noCopy // get waits on read from when quota goes less than or equal to zero. // replenish writes on it when quota goes positive again. ch chan struct{} @@ -38,16 +38,17 @@ type writeQuota struct { // It is implemented as a field so that it can be updated // by tests. replenish func(n int) + quota int32 } -func newWriteQuota(sz int32, done <-chan struct{}) *writeQuota { - w := &writeQuota{ - quota: sz, - ch: make(chan struct{}, 1), - done: done, - } +// init allows a writeQuota to be initialized in-place, which is useful for +// resetting a buffer or for avoiding a heap allocation when the buffer is +// embedded in another struct. +func (w *writeQuota) init(sz int32, done <-chan struct{}) { + w.quota = sz + w.ch = make(chan struct{}, 1) + w.done = done w.replenish = w.realReplenish - return w } func (w *writeQuota) get(sz int32) error { @@ -67,9 +68,9 @@ func (w *writeQuota) get(sz int32) error { func (w *writeQuota) realReplenish(n int) { sz := int32(n) - a := atomic.AddInt32(&w.quota, sz) - b := a - sz - if b <= 0 && a > 0 { + newQuota := atomic.AddInt32(&w.quota, sz) + previousQuota := newQuota - sz + if previousQuota <= 0 && newQuota > 0 { select { case w.ch <- struct{}{}: default: diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go index 3dea235735..7ab3422b8a 100644 --- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go @@ -50,7 +50,7 @@ import ( // NewServerHandlerTransport returns a ServerTransport handling gRPC from // inside an http.Handler, or writes an HTTP error to w and returns an error. // It requires that the http Server supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats []stats.Handler, bufferPool mem.BufferPool) (ServerTransport, error) { +func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request, stats stats.Handler, bufferPool mem.BufferPool) (ServerTransport, error) { if r.Method != http.MethodPost { w.Header().Set("Allow", http.MethodPost) msg := fmt.Sprintf("invalid gRPC request method %q", r.Method) @@ -170,7 +170,7 @@ type serverHandlerTransport struct { // TODO make sure this is consistent across handler_server and http2_server contentSubtype string - stats []stats.Handler + stats stats.Handler logger *grpclog.PrefixLogger bufferPool mem.BufferPool @@ -274,14 +274,14 @@ func (ht *serverHandlerTransport) writeStatus(s *ServerStream, st *status.Status } }) - if err == nil { // transport has not been closed + if err == nil && ht.stats != nil { // transport has not been closed // Note: The trailer fields are compressed with hpack after this call returns. // No WireLength field is set here. - for _, sh := range ht.stats { - sh.HandleRPC(s.Context(), &stats.OutTrailer{ - Trailer: s.trailer.Copy(), - }) - } + s.hdrMu.Lock() + ht.stats.HandleRPC(s.Context(), &stats.OutTrailer{ + Trailer: s.trailer.Copy(), + }) + s.hdrMu.Unlock() } ht.Close(errors.New("finished writing status")) return err @@ -372,19 +372,23 @@ func (ht *serverHandlerTransport) writeHeader(s *ServerStream, md metadata.MD) e ht.rw.(http.Flusher).Flush() }) - if err == nil { - for _, sh := range ht.stats { - // Note: The header fields are compressed with hpack after this call returns. - // No WireLength field is set here. - sh.HandleRPC(s.Context(), &stats.OutHeader{ - Header: md.Copy(), - Compression: s.sendCompress, - }) - } + if err == nil && ht.stats != nil { + // Note: The header fields are compressed with hpack after this call returns. + // No WireLength field is set here. + ht.stats.HandleRPC(s.Context(), &stats.OutHeader{ + Header: md.Copy(), + Compression: s.sendCompress, + }) } return err } +func (ht *serverHandlerTransport) adjustWindow(*ServerStream, uint32) { +} + +func (ht *serverHandlerTransport) updateWindow(*ServerStream, uint32) { +} + func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream func(*ServerStream)) { // With this transport type there will be exactly 1 stream: this HTTP request. var cancel context.CancelFunc @@ -409,11 +413,9 @@ func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream ctx = metadata.NewIncomingContext(ctx, ht.headerMD) req := ht.req s := &ServerStream{ - Stream: &Stream{ + Stream: Stream{ id: 0, // irrelevant ctx: ctx, - requestRead: func(int) {}, - buf: newRecvBuffer(), method: req.URL.Path, recvCompress: req.Header.Get("grpc-encoding"), contentSubtype: ht.contentSubtype, @@ -422,9 +424,11 @@ func (ht *serverHandlerTransport) HandleStreams(ctx context.Context, startStream st: ht, headerWireLength: 0, // won't have access to header wire length until golang/go#18997. } - s.trReader = &transportReader{ - reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf}, - windowHandler: func(int) {}, + s.Stream.buf.init() + s.readRequester = s + s.trReader = transportReader{ + reader: recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: &s.buf}, + windowHandler: s, } // readerDone is closed when the Body.Read-ing goroutine exits. diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go index 171e690a3f..37b1acc340 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go @@ -44,6 +44,7 @@ import ( "google.golang.org/grpc/internal/grpcutil" imetadata "google.golang.org/grpc/internal/metadata" "google.golang.org/grpc/internal/proxyattributes" + istats "google.golang.org/grpc/internal/stats" istatus "google.golang.org/grpc/internal/status" isyscall "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/internal/transport/networktype" @@ -105,7 +106,7 @@ type http2Client struct { kp keepalive.ClientParameters keepaliveEnabled bool - statsHandlers []stats.Handler + statsHandler stats.Handler initialWindowSize int32 @@ -309,11 +310,9 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts scheme = "https" } } - dynamicWindow := true icwz := int32(initialWindowSize) if opts.InitialConnWindowSize >= defaultWindowSize { icwz = opts.InitialConnWindowSize - dynamicWindow = false } writeBufSize := opts.WriteBufferSize readBufSize := opts.ReadBufferSize @@ -337,14 +336,14 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts writerDone: make(chan struct{}), goAway: make(chan struct{}), keepaliveDone: make(chan struct{}), - framer: newFramer(conn, writeBufSize, readBufSize, opts.SharedWriteBuffer, maxHeaderListSize), + framer: newFramer(conn, writeBufSize, readBufSize, opts.SharedWriteBuffer, maxHeaderListSize, opts.BufferPool), fc: &trInFlow{limit: uint32(icwz)}, scheme: scheme, activeStreams: make(map[uint32]*ClientStream), isSecure: isSecure, perRPCCreds: perRPCCreds, kp: kp, - statsHandlers: opts.StatsHandlers, + statsHandler: istats.NewCombinedHandler(opts.StatsHandlers...), initialWindowSize: initialWindowSize, nextID: 1, maxConcurrentStreams: defaultMaxStreamsClient, @@ -371,7 +370,7 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts }) t.logger = prefixLoggerForClientTransport(t) // Add peer information to the http2client context. - t.ctx = peer.NewContext(t.ctx, t.getPeer()) + t.ctx = peer.NewContext(t.ctx, t.Peer()) if md, ok := addr.Metadata.(*metadata.MD); ok { t.md = *md @@ -381,23 +380,21 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts t.controlBuf = newControlBuffer(t.ctxDone) if opts.InitialWindowSize >= defaultWindowSize { t.initialWindowSize = opts.InitialWindowSize - dynamicWindow = false } - if dynamicWindow { + if !opts.StaticWindowSize { t.bdpEst = &bdpEstimator{ bdp: initialWindowSize, updateFlowControl: t.updateFlowControl, } } - for _, sh := range t.statsHandlers { - t.ctx = sh.TagConn(t.ctx, &stats.ConnTagInfo{ + if t.statsHandler != nil { + t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{ RemoteAddr: t.remoteAddr, LocalAddr: t.localAddr, }) - connBegin := &stats.ConnBegin{ + t.statsHandler.HandleConn(t.ctx, &stats.ConnBegin{ Client: true, - } - sh.HandleConn(t.ctx, connBegin) + }) } if t.keepaliveEnabled { t.kpDormancyCond = sync.NewCond(&t.mu) @@ -481,45 +478,40 @@ func NewHTTP2Client(connectCtx, ctx context.Context, addr resolver.Address, opts return t, nil } -func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *ClientStream { +func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr, handler stats.Handler) *ClientStream { // TODO(zhaoq): Handle uint32 overflow of Stream.id. s := &ClientStream{ - Stream: &Stream{ + Stream: Stream{ method: callHdr.Method, sendCompress: callHdr.SendCompress, - buf: newRecvBuffer(), contentSubtype: callHdr.ContentSubtype, }, - ct: t, - done: make(chan struct{}), - headerChan: make(chan struct{}), - doneFunc: callHdr.DoneFunc, - } - s.wq = newWriteQuota(defaultWriteQuota, s.done) - s.requestRead = func(n int) { - t.adjustWindow(s, uint32(n)) - } + ct: t, + done: make(chan struct{}), + headerChan: make(chan struct{}), + doneFunc: callHdr.DoneFunc, + statsHandler: handler, + } + s.Stream.buf.init() + s.Stream.wq.init(defaultWriteQuota, s.done) + s.readRequester = s // The client side stream context should have exactly the same life cycle with the user provided context. // That means, s.ctx should be read-only. And s.ctx is done iff ctx is done. // So we use the original context here instead of creating a copy. s.ctx = ctx - s.trReader = &transportReader{ - reader: &recvBufferReader{ - ctx: s.ctx, - ctxDone: s.ctx.Done(), - recv: s.buf, - closeStream: func(err error) { - s.Close(err) - }, - }, - windowHandler: func(n int) { - t.updateWindow(s, uint32(n)) + s.trReader = transportReader{ + reader: recvBufferReader{ + ctx: s.ctx, + ctxDone: s.ctx.Done(), + recv: &s.buf, + clientStream: s, }, + windowHandler: s, } return s } -func (t *http2Client) getPeer() *peer.Peer { +func (t *http2Client) Peer() *peer.Peer { return &peer.Peer{ Addr: t.remoteAddr, AuthInfo: t.authInfo, // Can be nil @@ -545,7 +537,7 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) Method: callHdr.Method, AuthInfo: t.authInfo, } - ctxWithRequestInfo := icredentials.NewRequestInfoContext(ctx, ri) + ctxWithRequestInfo := credentials.NewContextWithRequestInfo(ctx, ri) authData, err := t.getTrAuthData(ctxWithRequestInfo, aud) if err != nil { return nil, err @@ -559,6 +551,22 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) // Make the slice of certain predictable size to reduce allocations made by append. hfLen := 7 // :method, :scheme, :path, :authority, content-type, user-agent, te hfLen += len(authData) + len(callAuthData) + registeredCompressors := t.registeredCompressors + if callHdr.AcceptedCompressors != nil { + registeredCompressors = *callHdr.AcceptedCompressors + } + if callHdr.PreviousAttempts > 0 { + hfLen++ + } + if callHdr.SendCompress != "" { + hfLen++ + } + if registeredCompressors != "" { + hfLen++ + } + if _, ok := ctx.Deadline(); ok { + hfLen++ + } headerFields := make([]hpack.HeaderField, 0, hfLen) headerFields = append(headerFields, hpack.HeaderField{Name: ":method", Value: "POST"}) headerFields = append(headerFields, hpack.HeaderField{Name: ":scheme", Value: t.scheme}) @@ -571,7 +579,6 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-previous-rpc-attempts", Value: strconv.Itoa(callHdr.PreviousAttempts)}) } - registeredCompressors := t.registeredCompressors if callHdr.SendCompress != "" { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) // Include the outgoing compressor name when compressor is not registered @@ -592,6 +599,9 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr) // Send out timeout regardless its value. The server can detect timeout context by itself. // TODO(mmukhi): Perhaps this field should be updated when actually writing out to the wire. timeout := time.Until(dl) + if timeout <= 0 { + return nil, status.Error(codes.DeadlineExceeded, context.DeadlineExceeded.Error()) + } headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-timeout", Value: grpcutil.EncodeDuration(timeout)}) } for k, v := range authData { @@ -735,8 +745,8 @@ func (e NewStreamError) Error() string { // NewStream creates a stream and registers it into the transport as "active" // streams. All non-nil errors returned will be *NewStreamError. -func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*ClientStream, error) { - ctx = peer.NewContext(ctx, t.getPeer()) +func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr, handler stats.Handler) (*ClientStream, error) { + ctx = peer.NewContext(ctx, t.Peer()) // ServerName field of the resolver returned address takes precedence over // Host field of CallHdr to determine the :authority header. This is because, @@ -749,11 +759,30 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*ClientS callHdr = &newCallHdr } + // The authority specified via the `CallAuthority` CallOption takes the + // highest precedence when determining the `:authority` header. It overrides + // any value present in the Host field of CallHdr. Before applying this + // override, the authority string is validated. If the credentials do not + // implement the AuthorityValidator interface, or if validation fails, the + // RPC is failed with a status code of `UNAVAILABLE`. + if callHdr.Authority != "" { + auth, ok := t.authInfo.(credentials.AuthorityValidator) + if !ok { + return nil, &NewStreamError{Err: status.Errorf(codes.Unavailable, "credentials type %q does not implement the AuthorityValidator interface, but authority override specified with CallAuthority call option", t.authInfo.AuthType())} + } + if err := auth.ValidateAuthority(callHdr.Authority); err != nil { + return nil, &NewStreamError{Err: status.Errorf(codes.Unavailable, "failed to validate authority %q : %v", callHdr.Authority, err)} + } + newCallHdr := *callHdr + newCallHdr.Host = callHdr.Authority + callHdr = &newCallHdr + } + headerFields, err := t.createHeaderFields(ctx, callHdr) if err != nil { return nil, &NewStreamError{Err: err, AllowTransparentRetry: false} } - s := t.newStream(ctx, callHdr) + s := t.newStream(ctx, callHdr, handler) cleanup := func(err error) { if s.swapState(streamDone) == streamDone { // If it was already done, return. @@ -792,7 +821,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*ClientS return nil }, onOrphaned: cleanup, - wq: s.wq, + wq: &s.wq, } firstTry := true var ch chan struct{} @@ -823,7 +852,7 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*ClientS transportDrainRequired = t.nextID > MaxStreamID s.id = hdr.streamID - s.fc = &inFlow{limit: uint32(t.initialWindowSize)} + s.fc = inFlow{limit: uint32(t.initialWindowSize)} t.activeStreams[s.id] = s t.mu.Unlock() @@ -874,27 +903,23 @@ func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (*ClientS return nil, &NewStreamError{Err: ErrConnClosing, AllowTransparentRetry: true} } } - if len(t.statsHandlers) != 0 { + if s.statsHandler != nil { header, ok := metadata.FromOutgoingContext(ctx) if ok { header.Set("user-agent", t.userAgent) } else { header = metadata.Pairs("user-agent", t.userAgent) } - for _, sh := range t.statsHandlers { - // Note: The header fields are compressed with hpack after this call returns. - // No WireLength field is set here. - // Note: Creating a new stats object to prevent pollution. - outHeader := &stats.OutHeader{ - Client: true, - FullMethod: callHdr.Method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: callHdr.SendCompress, - Header: header, - } - sh.HandleRPC(s.ctx, outHeader) - } + // Note: The header fields are compressed with hpack after this call returns. + // No WireLength field is set here. + s.statsHandler.HandleRPC(s.ctx, &stats.OutHeader{ + Client: true, + FullMethod: callHdr.Method, + RemoteAddr: t.remoteAddr, + LocalAddr: t.localAddr, + Compression: callHdr.SendCompress, + Header: header, + }) } if transportDrainRequired { if t.logger.V(logLevel) { @@ -971,6 +996,9 @@ func (t *http2Client) closeStream(s *ClientStream, err error, rst bool, rstCode // accessed anymore. func (t *http2Client) Close(err error) { t.conn.SetWriteDeadline(time.Now().Add(time.Second * 10)) + // For background on the deadline value chosen here, see + // https://github.com/grpc/grpc-go/issues/8425#issuecomment-3057938248 . + t.conn.SetReadDeadline(time.Now().Add(time.Second)) t.mu.Lock() // Make sure we only close once. if t.state == closing { @@ -1032,11 +1060,10 @@ func (t *http2Client) Close(err error) { for _, s := range streams { t.closeStream(s, err, false, http2.ErrCodeNo, st, nil, false) } - for _, sh := range t.statsHandlers { - connEnd := &stats.ConnEnd{ + if t.statsHandler != nil { + t.statsHandler.HandleConn(t.ctx, &stats.ConnEnd{ Client: true, - } - sh.HandleConn(t.ctx, connEnd) + }) } } @@ -1069,32 +1096,29 @@ func (t *http2Client) GracefulClose() { // Write formats the data into HTTP2 data frame(s) and sends it out. The caller // should proceed only if Write returns nil. func (t *http2Client) write(s *ClientStream, hdr []byte, data mem.BufferSlice, opts *WriteOptions) error { - reader := data.Reader() - if opts.Last { // If it's the last message, update stream state. if !s.compareAndSwapState(streamActive, streamWriteDone) { - _ = reader.Close() return errStreamDone } } else if s.getState() != streamActive { - _ = reader.Close() return errStreamDone } df := &dataFrame{ streamID: s.id, endStream: opts.Last, h: hdr, - reader: reader, + data: data, } - if hdr != nil || df.reader.Remaining() != 0 { // If it's not an empty data frame, check quota. - if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil { - _ = reader.Close() + dataLen := data.Len() + if hdr != nil || dataLen != 0 { // If it's not an empty data frame, check quota. + if err := s.wq.get(int32(len(hdr) + dataLen)); err != nil { return err } } + data.Ref() if err := t.controlBuf.put(df); err != nil { - _ = reader.Close() + data.Free() return err } t.incrMsgSent() @@ -1150,7 +1174,7 @@ func (t *http2Client) updateFlowControl(n uint32) { }) } -func (t *http2Client) handleData(f *http2.DataFrame) { +func (t *http2Client) handleData(f *parsedDataFrame) { size := f.Header().Length var sendBDPPing bool if t.bdpEst != nil { @@ -1194,22 +1218,15 @@ func (t *http2Client) handleData(f *http2.DataFrame) { t.closeStream(s, io.EOF, true, http2.ErrCodeFlowControl, status.New(codes.Internal, err.Error()), nil, false) return } + dataLen := f.data.Len() if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(size - uint32(len(f.Data()))); w > 0 { + if w := s.fc.onRead(size - uint32(dataLen)); w > 0 { t.controlBuf.put(&outgoingWindowUpdate{s.id, w}) } } - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - pool := t.bufferPool - if pool == nil { - // Note that this is only supposed to be nil in tests. Otherwise, stream is - // always initialized with a BufferPool. - pool = mem.DefaultBufferPool() - } - s.write(recvMsg{buffer: mem.Copy(f.Data(), pool)}) + if dataLen > 0 { + f.data.Ref() + s.write(recvMsg{buffer: f.data}) } } // The server has closed the stream without sending trailers. Record that @@ -1449,17 +1466,14 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { contentTypeErr = "malformed header: missing HTTP content-type" grpcMessage string recvCompress string - httpStatusCode *int httpStatusErr string - rawStatusCode = codes.Unknown + // the code from the grpc-status header, if present + grpcStatusCode = codes.Unknown // headerError is set if an error is encountered while parsing the headers headerError string + httpStatus string ) - if initialHeader { - httpStatusErr = "malformed header: missing HTTP status" - } - for _, hf := range frame.Fields { switch hf.Name { case "content-type": @@ -1475,35 +1489,15 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { case "grpc-status": code, err := strconv.ParseInt(hf.Value, 10, 32) if err != nil { - se := status.New(codes.Internal, fmt.Sprintf("transport: malformed grpc-status: %v", err)) + se := status.New(codes.Unknown, fmt.Sprintf("transport: malformed grpc-status: %v", err)) t.closeStream(s, se.Err(), true, http2.ErrCodeProtocol, se, nil, endStream) return } - rawStatusCode = codes.Code(uint32(code)) + grpcStatusCode = codes.Code(uint32(code)) case "grpc-message": grpcMessage = decodeGrpcMessage(hf.Value) case ":status": - if hf.Value == "200" { - httpStatusErr = "" - statusCode := 200 - httpStatusCode = &statusCode - break - } - - c, err := strconv.ParseInt(hf.Value, 10, 32) - if err != nil { - se := status.New(codes.Internal, fmt.Sprintf("transport: malformed http-status: %v", err)) - t.closeStream(s, se.Err(), true, http2.ErrCodeProtocol, se, nil, endStream) - return - } - statusCode := int(c) - httpStatusCode = &statusCode - - httpStatusErr = fmt.Sprintf( - "unexpected HTTP status code received from server: %d (%s)", - statusCode, - http.StatusText(statusCode), - ) + httpStatus = hf.Value default: if isReservedHeader(hf.Name) && !isWhitelistedHeader(hf.Name) { break @@ -1518,25 +1512,52 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { } } - if !isGRPC || httpStatusErr != "" { - var code = codes.Internal // when header does not include HTTP status, return INTERNAL - - if httpStatusCode != nil { + // If a non-gRPC response is received, then evaluate the HTTP status to + // process the response and close the stream. + // In case http status doesn't provide any error information (status : 200), + // then evalute response code to be Unknown. + if !isGRPC { + var grpcErrorCode = codes.Internal + if httpStatus == "" { + httpStatusErr = "malformed header: missing HTTP status" + } else { + // Parse the status codes (e.g. "200", 404"). + statusCode, err := strconv.Atoi(httpStatus) + if err != nil { + se := status.New(grpcErrorCode, fmt.Sprintf("transport: malformed http-status: %v", err)) + t.closeStream(s, se.Err(), true, http2.ErrCodeProtocol, se, nil, endStream) + return + } + if statusCode >= 100 && statusCode < 200 { + if endStream { + se := status.New(codes.Internal, fmt.Sprintf( + "protocol error: informational header with status code %d must not have END_STREAM set", statusCode)) + t.closeStream(s, se.Err(), true, http2.ErrCodeProtocol, se, nil, endStream) + } + // In case of informational headers, return. + return + } + httpStatusErr = fmt.Sprintf( + "unexpected HTTP status code received from server: %d (%s)", + statusCode, + http.StatusText(statusCode), + ) var ok bool - code, ok = HTTPStatusConvTab[*httpStatusCode] + grpcErrorCode, ok = HTTPStatusConvTab[statusCode] if !ok { - code = codes.Unknown + grpcErrorCode = codes.Unknown } } var errs []string if httpStatusErr != "" { errs = append(errs, httpStatusErr) } + if contentTypeErr != "" { errs = append(errs, contentTypeErr) } - // Verify the HTTP response is a 200. - se := status.New(code, strings.Join(errs, "; ")) + + se := status.New(grpcErrorCode, strings.Join(errs, "; ")) t.closeStream(s, se.Err(), true, http2.ErrCodeProtocol, se, nil, endStream) return } @@ -1567,22 +1588,20 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { } } - for _, sh := range t.statsHandlers { + if s.statsHandler != nil { if !endStream { - inHeader := &stats.InHeader{ + s.statsHandler.HandleRPC(s.ctx, &stats.InHeader{ Client: true, WireLength: int(frame.Header().Length), Header: metadata.MD(mdata).Copy(), Compression: s.recvCompress, - } - sh.HandleRPC(s.ctx, inHeader) + }) } else { - inTrailer := &stats.InTrailer{ + s.statsHandler.HandleRPC(s.ctx, &stats.InTrailer{ Client: true, WireLength: int(frame.Header().Length), Trailer: metadata.MD(mdata).Copy(), - } - sh.HandleRPC(s.ctx, inTrailer) + }) } } @@ -1590,7 +1609,7 @@ func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { return } - status := istatus.NewWithProto(rawStatusCode, grpcMessage, mdata[grpcStatusDetailsBinHeader]) + status := istatus.NewWithProto(grpcStatusCode, grpcMessage, mdata[grpcStatusDetailsBinHeader]) // If client received END_STREAM from server while stream was still active, // send RST_STREAM. @@ -1637,7 +1656,7 @@ func (t *http2Client) reader(errCh chan<- error) { // loop to keep reading incoming messages on this transport. for { t.controlBuf.throttle() - frame, err := t.framer.fr.ReadFrame() + frame, err := t.framer.readFrame() if t.keepaliveEnabled { atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) } @@ -1652,7 +1671,7 @@ func (t *http2Client) reader(errCh chan<- error) { if s != nil { // use error detail to provide better err message code := http2ErrConvTab[se.Code] - errorDetail := t.framer.fr.ErrorDetail() + errorDetail := t.framer.errorDetail() var msg string if errorDetail != nil { msg = errorDetail.Error() @@ -1670,8 +1689,9 @@ func (t *http2Client) reader(errCh chan<- error) { switch frame := frame.(type) { case *http2.MetaHeadersFrame: t.operateHeaders(frame) - case *http2.DataFrame: + case *parsedDataFrame: t.handleData(frame) + frame.data.Free() case *http2.RSTStreamFrame: t.handleRSTStream(frame) case *http2.SettingsFrame: @@ -1791,8 +1811,6 @@ func (t *http2Client) socketMetrics() *channelz.EphemeralSocketMetrics { } } -func (t *http2Client) RemoteAddr() net.Addr { return t.remoteAddr } - func (t *http2Client) incrMsgSent() { if channelz.IsOn() { t.channelz.SocketMetrics.MessagesSent.Add(1) diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go index 7e53eb1735..a1a14e14fc 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go +++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go @@ -35,13 +35,15 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" + "google.golang.org/protobuf/proto" + "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/internal/pretty" + istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/mem" - "google.golang.org/protobuf/proto" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" @@ -85,7 +87,7 @@ type http2Server struct { // updates, reset streams, and various settings) to the controller. controlBuf *controlBuffer fc *trInFlow - stats []stats.Handler + stats stats.Handler // Keepalive and max-age parameters for the server. kp keepalive.ServerParameters // Keepalive enforcement policy. @@ -131,6 +133,10 @@ type http2Server struct { maxStreamID uint32 // max stream ID ever seen logger *grpclog.PrefixLogger + // setResetPingStrikes is stored as a closure instead of making this a + // method on http2Server to avoid a heap allocation when converting a method + // to a closure for passing to frames objects. + setResetPingStrikes func() } // NewServerTransport creates a http2 transport with conn and configuration @@ -163,7 +169,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, if config.MaxHeaderListSize != nil { maxHeaderListSize = *config.MaxHeaderListSize } - framer := newFramer(conn, writeBufSize, readBufSize, config.SharedWriteBuffer, maxHeaderListSize) + framer := newFramer(conn, writeBufSize, readBufSize, config.SharedWriteBuffer, maxHeaderListSize, config.BufferPool) // Send initial settings as connection preface to client. isettings := []http2.Setting{{ ID: http2.SettingMaxFrameSize, @@ -175,16 +181,13 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, Val: config.MaxStreams, }) } - dynamicWindow := true iwz := int32(initialWindowSize) if config.InitialWindowSize >= defaultWindowSize { iwz = config.InitialWindowSize - dynamicWindow = false } icwz := int32(initialWindowSize) if config.InitialConnWindowSize >= defaultWindowSize { icwz = config.InitialConnWindowSize - dynamicWindow = false } if iwz != defaultWindowSize { isettings = append(isettings, http2.Setting{ @@ -258,13 +261,16 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, fc: &trInFlow{limit: uint32(icwz)}, state: reachable, activeStreams: make(map[uint32]*ServerStream), - stats: config.StatsHandlers, + stats: config.StatsHandler, kp: kp, idle: time.Now(), kep: kep, initialWindowSize: iwz, bufferPool: config.BufferPool, } + t.setResetPingStrikes = func() { + atomic.StoreUint32(&t.resetPingStrikes, 1) + } var czSecurity credentials.ChannelzSecurityValue if au, ok := authInfo.(credentials.ChannelzSecurityInfo); ok { czSecurity = au.GetSecurityValue() @@ -284,7 +290,7 @@ func NewServerTransport(conn net.Conn, config *ServerConfig) (_ ServerTransport, t.logger = prefixLoggerForServerTransport(t) t.controlBuf = newControlBuffer(t.done) - if dynamicWindow { + if !config.StaticWindowSize { t.bdpEst = &bdpEstimator{ bdp: initialWindowSize, updateFlowControl: t.updateFlowControl, @@ -385,16 +391,15 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade } t.maxStreamID = streamID - buf := newRecvBuffer() s := &ServerStream{ - Stream: &Stream{ - id: streamID, - buf: buf, - fc: &inFlow{limit: uint32(t.initialWindowSize)}, + Stream: Stream{ + id: streamID, + fc: inFlow{limit: uint32(t.initialWindowSize)}, }, st: t, headerWireLength: int(frame.Header().Length), } + s.Stream.buf.init() var ( // if false, content-type was missing or invalid isGRPC = false @@ -474,13 +479,7 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade if t.logger.V(logLevel) { t.logger.Infof("Aborting the stream early: %v", errMsg) } - t.controlBuf.put(&earlyAbortStream{ - httpStatus: http.StatusBadRequest, - streamID: streamID, - contentSubtype: s.contentSubtype, - status: status.New(codes.Internal, errMsg), - rst: !frame.StreamEnded(), - }) + t.writeEarlyAbort(streamID, s.contentSubtype, status.New(codes.Internal, errMsg), http.StatusBadRequest, !frame.StreamEnded()) return nil } @@ -494,23 +493,11 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade return nil } if !isGRPC { - t.controlBuf.put(&earlyAbortStream{ - httpStatus: http.StatusUnsupportedMediaType, - streamID: streamID, - contentSubtype: s.contentSubtype, - status: status.Newf(codes.InvalidArgument, "invalid gRPC request content-type %q", contentType), - rst: !frame.StreamEnded(), - }) + t.writeEarlyAbort(streamID, s.contentSubtype, status.Newf(codes.InvalidArgument, "invalid gRPC request content-type %q", contentType), http.StatusUnsupportedMediaType, !frame.StreamEnded()) return nil } if headerError != nil { - t.controlBuf.put(&earlyAbortStream{ - httpStatus: http.StatusBadRequest, - streamID: streamID, - contentSubtype: s.contentSubtype, - status: headerError, - rst: !frame.StreamEnded(), - }) + t.writeEarlyAbort(streamID, s.contentSubtype, headerError, http.StatusBadRequest, !frame.StreamEnded()) return nil } @@ -564,13 +551,7 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade if t.logger.V(logLevel) { t.logger.Infof("Aborting the stream early: %v", errMsg) } - t.controlBuf.put(&earlyAbortStream{ - httpStatus: http.StatusMethodNotAllowed, - streamID: streamID, - contentSubtype: s.contentSubtype, - status: status.New(codes.Internal, errMsg), - rst: !frame.StreamEnded(), - }) + t.writeEarlyAbort(streamID, s.contentSubtype, status.New(codes.Internal, errMsg), http.StatusMethodNotAllowed, !frame.StreamEnded()) s.cancel() return nil } @@ -585,20 +566,24 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade if !ok { stat = status.New(codes.PermissionDenied, err.Error()) } - t.controlBuf.put(&earlyAbortStream{ - httpStatus: http.StatusOK, - streamID: s.id, - contentSubtype: s.contentSubtype, - status: stat, - rst: !frame.StreamEnded(), - }) + t.writeEarlyAbort(s.id, s.contentSubtype, stat, http.StatusOK, !frame.StreamEnded()) return nil } } + + if s.ctx.Err() != nil { + t.mu.Unlock() + st := status.New(codes.DeadlineExceeded, context.DeadlineExceeded.Error()) + // Early abort in case the timeout was zero or so low it already fired. + t.writeEarlyAbort(s.id, s.contentSubtype, st, http.StatusOK, !frame.StreamEnded()) + return nil + } + t.activeStreams[streamID] = s if len(t.activeStreams) == 1 { t.idle = time.Time{} } + // Start a timer to close the stream on reaching the deadline. if timeoutSet { // We need to wait for s.cancel to be updated before calling @@ -620,25 +605,21 @@ func (t *http2Server) operateHeaders(ctx context.Context, frame *http2.MetaHeade t.channelz.SocketMetrics.StreamsStarted.Add(1) t.channelz.SocketMetrics.LastRemoteStreamCreatedTimestamp.Store(time.Now().UnixNano()) } - s.requestRead = func(n int) { - t.adjustWindow(s, uint32(n)) - } + s.readRequester = s s.ctxDone = s.ctx.Done() - s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) - s.trReader = &transportReader{ - reader: &recvBufferReader{ + s.Stream.wq.init(defaultWriteQuota, s.ctxDone) + s.trReader = transportReader{ + reader: recvBufferReader{ ctx: s.ctx, ctxDone: s.ctxDone, - recv: s.buf, - }, - windowHandler: func(n int) { - t.updateWindow(s, uint32(n)) + recv: &s.buf, }, + windowHandler: s, } // Register the stream with loopy. t.controlBuf.put(®isterStream{ streamID: s.id, - wq: s.wq, + wq: &s.wq, }) handle(s) return nil @@ -654,7 +635,7 @@ func (t *http2Server) HandleStreams(ctx context.Context, handle func(*ServerStre }() for { t.controlBuf.throttle() - frame, err := t.framer.fr.ReadFrame() + frame, err := t.framer.readFrame() atomic.StoreInt64(&t.lastRead, time.Now().UnixNano()) if err != nil { if se, ok := err.(http2.StreamError); ok { @@ -691,8 +672,9 @@ func (t *http2Server) HandleStreams(ctx context.Context, handle func(*ServerStre }) continue } - case *http2.DataFrame: + case *parsedDataFrame: t.handleData(frame) + frame.data.Free() case *http2.RSTStreamFrame: t.handleRSTStream(frame) case *http2.SettingsFrame: @@ -772,7 +754,7 @@ func (t *http2Server) updateFlowControl(n uint32) { } -func (t *http2Server) handleData(f *http2.DataFrame) { +func (t *http2Server) handleData(f *parsedDataFrame) { size := f.Header().Length var sendBDPPing bool if t.bdpEst != nil { @@ -817,22 +799,15 @@ func (t *http2Server) handleData(f *http2.DataFrame) { t.closeStream(s, true, http2.ErrCodeFlowControl, false) return } + dataLen := f.data.Len() if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(size - uint32(len(f.Data()))); w > 0 { + if w := s.fc.onRead(size - uint32(dataLen)); w > 0 { t.controlBuf.put(&outgoingWindowUpdate{s.id, w}) } } - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - pool := t.bufferPool - if pool == nil { - // Note that this is only supposed to be nil in tests. Otherwise, stream is - // always initialized with a BufferPool. - pool = mem.DefaultBufferPool() - } - s.write(recvMsg{buffer: mem.Copy(f.Data(), pool)}) + if dataLen > 0 { + f.data.Ref() + s.write(recvMsg{buffer: f.data}) } } if f.StreamEnded() { @@ -959,13 +934,12 @@ func appendHeaderFieldsFromMD(headerFields []hpack.HeaderField, md metadata.MD) return headerFields } -func (t *http2Server) checkForHeaderListSize(it any) bool { +func (t *http2Server) checkForHeaderListSize(hf []hpack.HeaderField) bool { if t.maxSendHeaderListSize == nil { return true } - hdrFrame := it.(*headerFrame) var sz int64 - for _, f := range hdrFrame.hf { + for _, f := range hf { if sz += int64(f.Size()); sz > int64(*t.maxSendHeaderListSize) { if t.logger.V(logLevel) { t.logger.Infof("Header list size to send violates the maximum size (%d bytes) set by client", *t.maxSendHeaderListSize) @@ -976,6 +950,42 @@ func (t *http2Server) checkForHeaderListSize(it any) bool { return true } +// writeEarlyAbort sends an early abort response with the given HTTP status and +// gRPC status. If the header list size exceeds the peer's limit, it sends a +// RST_STREAM instead. +func (t *http2Server) writeEarlyAbort(streamID uint32, contentSubtype string, stat *status.Status, httpStatus uint32, rst bool) { + hf := []hpack.HeaderField{ + {Name: ":status", Value: strconv.Itoa(int(httpStatus))}, + {Name: "content-type", Value: grpcutil.ContentType(contentSubtype)}, + {Name: "grpc-status", Value: strconv.Itoa(int(stat.Code()))}, + {Name: "grpc-message", Value: encodeGrpcMessage(stat.Message())}, + } + if p := istatus.RawStatusProto(stat); len(p.GetDetails()) > 0 { + stBytes, err := proto.Marshal(p) + if err != nil { + t.logger.Errorf("Failed to marshal rpc status: %s, error: %v", pretty.ToJSON(p), err) + } + if err == nil { + hf = append(hf, hpack.HeaderField{Name: grpcStatusDetailsBinHeader, Value: encodeBinHeader(stBytes)}) + } + } + success, _ := t.controlBuf.executeAndPut(func() bool { + return t.checkForHeaderListSize(hf) + }, &earlyAbortStream{ + streamID: streamID, + rst: rst, + hf: hf, + }) + if !success { + t.controlBuf.put(&cleanupStream{ + streamID: streamID, + rst: true, + rstCode: http2.ErrCodeInternal, + onWrite: func() {}, + }) + } +} + func (t *http2Server) streamContextErr(s *ServerStream) error { select { case <-t.done: @@ -1015,10 +1025,6 @@ func (t *http2Server) writeHeader(s *ServerStream, md metadata.MD) error { return nil } -func (t *http2Server) setResetPingStrikes() { - atomic.StoreUint32(&t.resetPingStrikes, 1) -} - func (t *http2Server) writeHeaderLocked(s *ServerStream) error { // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields // first and create a slice of that exact size. @@ -1035,7 +1041,7 @@ func (t *http2Server) writeHeaderLocked(s *ServerStream) error { endStream: false, onWrite: t.setResetPingStrikes, } - success, err := t.controlBuf.executeAndPut(func() bool { return t.checkForHeaderListSize(hf) }, hf) + success, err := t.controlBuf.executeAndPut(func() bool { return t.checkForHeaderListSize(hf.hf) }, hf) if !success { if err != nil { return err @@ -1043,19 +1049,18 @@ func (t *http2Server) writeHeaderLocked(s *ServerStream) error { t.closeStream(s, true, http2.ErrCodeInternal, false) return ErrHeaderListSizeLimitViolation } - for _, sh := range t.stats { + if t.stats != nil { // Note: Headers are compressed with hpack after this call returns. // No WireLength field is set here. - outHeader := &stats.OutHeader{ + t.stats.HandleRPC(s.Context(), &stats.OutHeader{ Header: s.header.Copy(), Compression: s.sendCompress, - } - sh.HandleRPC(s.Context(), outHeader) + }) } return nil } -// WriteStatus sends stream status to the client and terminates the stream. +// writeStatus sends stream status to the client and terminates the stream. // There is no further I/O operations being able to perform on this stream. // TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early // OK is adopted. @@ -1083,7 +1088,7 @@ func (t *http2Server) writeStatus(s *ServerStream, st *status.Status) error { headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) - if p := st.Proto(); p != nil && len(p.Details) > 0 { + if p := istatus.RawStatusProto(st); len(p.GetDetails()) > 0 { // Do not use the user's grpc-status-details-bin (if present) if we are // even attempting to set our own. delete(s.trailer, grpcStatusDetailsBinHeader) @@ -1106,7 +1111,7 @@ func (t *http2Server) writeStatus(s *ServerStream, st *status.Status) error { } success, err := t.controlBuf.executeAndPut(func() bool { - return t.checkForHeaderListSize(trailingHeader) + return t.checkForHeaderListSize(trailingHeader.hf) }, nil) if !success { if err != nil { @@ -1118,10 +1123,10 @@ func (t *http2Server) writeStatus(s *ServerStream, st *status.Status) error { // Send a RST_STREAM after the trailers if the client has not already half-closed. rst := s.getState() == streamActive t.finishStream(s, rst, http2.ErrCodeNo, trailingHeader, true) - for _, sh := range t.stats { + if t.stats != nil { // Note: The trailer fields are compressed with hpack after this call returns. // No WireLength field is set here. - sh.HandleRPC(s.Context(), &stats.OutTrailer{ + t.stats.HandleRPC(s.Context(), &stats.OutTrailer{ Trailer: s.trailer.Copy(), }) } @@ -1131,17 +1136,13 @@ func (t *http2Server) writeStatus(s *ServerStream, st *status.Status) error { // Write converts the data into HTTP2 data frame and sends it out. Non-nil error // is returns if it fails (e.g., framing error, transport error). func (t *http2Server) write(s *ServerStream, hdr []byte, data mem.BufferSlice, _ *WriteOptions) error { - reader := data.Reader() - if !s.isHeaderSent() { // Headers haven't been written yet. if err := t.writeHeader(s, nil); err != nil { - _ = reader.Close() return err } } else { // Writing headers checks for this condition. if s.getState() == streamDone { - _ = reader.Close() return t.streamContextErr(s) } } @@ -1149,15 +1150,16 @@ func (t *http2Server) write(s *ServerStream, hdr []byte, data mem.BufferSlice, _ df := &dataFrame{ streamID: s.id, h: hdr, - reader: reader, + data: data, onEachWrite: t.setResetPingStrikes, } - if err := s.wq.get(int32(len(hdr) + df.reader.Remaining())); err != nil { - _ = reader.Close() + dataLen := data.Len() + if err := s.wq.get(int32(len(hdr) + dataLen)); err != nil { return t.streamContextErr(s) } + data.Ref() if err := t.controlBuf.put(df); err != nil { - _ = reader.Close() + data.Free() return err } t.incrMsgSent() @@ -1292,7 +1294,8 @@ func (t *http2Server) Close(err error) { // deleteStream deletes the stream s from transport's active streams. func (t *http2Server) deleteStream(s *ServerStream, eosReceived bool) { t.mu.Lock() - if _, ok := t.activeStreams[s.id]; ok { + _, isActive := t.activeStreams[s.id] + if isActive { delete(t.activeStreams, s.id) if len(t.activeStreams) == 0 { t.idle = time.Now() @@ -1300,7 +1303,7 @@ func (t *http2Server) deleteStream(s *ServerStream, eosReceived bool) { } t.mu.Unlock() - if channelz.IsOn() { + if isActive && channelz.IsOn() { if eosReceived { t.channelz.SocketMetrics.StreamsSucceeded.Add(1) } else { @@ -1340,10 +1343,10 @@ func (t *http2Server) closeStream(s *ServerStream, rst bool, rstCode http2.ErrCo // called to interrupt the potential blocking on other goroutines. s.cancel() - oldState := s.swapState(streamDone) - if oldState == streamDone { - return - } + // We can't return early even if the stream's state is "done" as the state + // might have been set by the `finishStream` method. Deleting the stream via + // `finishStream` can get blocked on flow control. + s.swapState(streamDone) t.deleteStream(s, eosReceived) t.controlBuf.put(&cleanupStream{ diff --git a/vendor/google.golang.org/grpc/internal/transport/http_util.go b/vendor/google.golang.org/grpc/internal/transport/http_util.go index f997f9fdb5..5bbb641ad9 100644 --- a/vendor/google.golang.org/grpc/internal/transport/http_util.go +++ b/vendor/google.golang.org/grpc/internal/transport/http_util.go @@ -25,7 +25,6 @@ import ( "fmt" "io" "math" - "net" "net/http" "net/url" "strconv" @@ -37,6 +36,7 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/hpack" "google.golang.org/grpc/codes" + "google.golang.org/grpc/mem" ) const ( @@ -196,11 +196,11 @@ func decodeTimeout(s string) (time.Duration, error) { if !ok { return 0, fmt.Errorf("transport: timeout unit is not recognized: %q", s) } - t, err := strconv.ParseInt(s[:size-1], 10, 64) + t, err := strconv.ParseUint(s[:size-1], 10, 64) if err != nil { return 0, err } - const maxHours = math.MaxInt64 / int64(time.Hour) + const maxHours = math.MaxInt64 / uint64(time.Hour) if d == time.Hour && t > maxHours { // This timeout would overflow math.MaxInt64; clamp it. return time.Duration(math.MaxInt64), nil @@ -300,11 +300,11 @@ type bufWriter struct { buf []byte offset int batchSize int - conn net.Conn + conn io.Writer err error } -func newBufWriter(conn net.Conn, batchSize int, pool *sync.Pool) *bufWriter { +func newBufWriter(conn io.Writer, batchSize int, pool *sync.Pool) *bufWriter { w := &bufWriter{ batchSize: batchSize, conn: conn, @@ -388,15 +388,29 @@ func toIOError(err error) error { return ioError{error: err} } +type parsedDataFrame struct { + http2.FrameHeader + data mem.Buffer +} + +func (df *parsedDataFrame) StreamEnded() bool { + return df.FrameHeader.Flags.Has(http2.FlagDataEndStream) +} + type framer struct { - writer *bufWriter - fr *http2.Framer + writer *bufWriter + fr *http2.Framer + headerBuf []byte // cached slice for framer headers to reduce heap allocs. + reader io.Reader + dataFrame parsedDataFrame // Cached data frame to avoid heap allocations. + pool mem.BufferPool + errDetail error } var writeBufferPoolMap = make(map[int]*sync.Pool) var writeBufferMutex sync.Mutex -func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32) *framer { +func newFramer(conn io.ReadWriter, writeBufferSize, readBufferSize int, sharedWriteBuffer bool, maxHeaderListSize uint32, memPool mem.BufferPool) *framer { if writeBufferSize < 0 { writeBufferSize = 0 } @@ -412,6 +426,8 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBu f := &framer{ writer: w, fr: http2.NewFramer(w, r), + reader: r, + pool: memPool, } f.fr.SetMaxReadFrameSize(http2MaxFrameLen) // Opt-in to Frame reuse API on framer to reduce garbage. @@ -422,6 +438,146 @@ func newFramer(conn net.Conn, writeBufferSize, readBufferSize int, sharedWriteBu return f } +// writeData writes a DATA frame. +// +// It is the caller's responsibility not to violate the maximum frame size. +func (f *framer) writeData(streamID uint32, endStream bool, data [][]byte) error { + var flags http2.Flags + if endStream { + flags = http2.FlagDataEndStream + } + length := uint32(0) + for _, d := range data { + length += uint32(len(d)) + } + // TODO: Replace the header write with the framer API being added in + // https://github.com/golang/go/issues/66655. + f.headerBuf = append(f.headerBuf[:0], + byte(length>>16), + byte(length>>8), + byte(length), + byte(http2.FrameData), + byte(flags), + byte(streamID>>24), + byte(streamID>>16), + byte(streamID>>8), + byte(streamID)) + if _, err := f.writer.Write(f.headerBuf); err != nil { + return err + } + for _, d := range data { + if _, err := f.writer.Write(d); err != nil { + return err + } + } + return nil +} + +// readFrame reads a single frame. The returned Frame is only valid +// until the next call to readFrame. +func (f *framer) readFrame() (any, error) { + f.errDetail = nil + fh, err := f.fr.ReadFrameHeader() + if err != nil { + f.errDetail = f.fr.ErrorDetail() + return nil, err + } + // Read the data frame directly from the underlying io.Reader to avoid + // copies. + if fh.Type == http2.FrameData { + err = f.readDataFrame(fh) + return &f.dataFrame, err + } + fr, err := f.fr.ReadFrameForHeader(fh) + if err != nil { + f.errDetail = f.fr.ErrorDetail() + return nil, err + } + return fr, err +} + +// errorDetail returns a more detailed error of the last error +// returned by framer.readFrame. For instance, if readFrame +// returns a StreamError with code PROTOCOL_ERROR, errorDetail +// will say exactly what was invalid. errorDetail is not guaranteed +// to return a non-nil value. +// errorDetail is reset after the next call to readFrame. +func (f *framer) errorDetail() error { + return f.errDetail +} + +func (f *framer) readDataFrame(fh http2.FrameHeader) (err error) { + if fh.StreamID == 0 { + // DATA frames MUST be associated with a stream. If a + // DATA frame is received whose stream identifier + // field is 0x0, the recipient MUST respond with a + // connection error (Section 5.4.1) of type + // PROTOCOL_ERROR. + f.errDetail = errors.New("DATA frame with stream ID 0") + return http2.ConnectionError(http2.ErrCodeProtocol) + } + // Converting a *[]byte to a mem.SliceBuffer incurs a heap allocation. This + // conversion is performed by mem.NewBuffer. To avoid the extra allocation + // a []byte is allocated directly if required and cast to a mem.SliceBuffer. + var buf []byte + // poolHandle is the pointer returned by the buffer pool (if it's used.). + var poolHandle *[]byte + useBufferPool := !mem.IsBelowBufferPoolingThreshold(int(fh.Length)) + if useBufferPool { + poolHandle = f.pool.Get(int(fh.Length)) + buf = *poolHandle + defer func() { + if err != nil { + f.pool.Put(poolHandle) + } + }() + } else { + buf = make([]byte, int(fh.Length)) + } + if fh.Flags.Has(http2.FlagDataPadded) { + if fh.Length == 0 { + return io.ErrUnexpectedEOF + } + // This initial 1-byte read can be inefficient for unbuffered readers, + // but it allows the rest of the payload to be read directly to the + // start of the destination slice. This makes it easy to return the + // original slice back to the buffer pool. + if _, err := io.ReadFull(f.reader, buf[:1]); err != nil { + return err + } + padSize := buf[0] + buf = buf[:len(buf)-1] + if int(padSize) > len(buf) { + // If the length of the padding is greater than the + // length of the frame payload, the recipient MUST + // treat this as a connection error. + // Filed: https://github.com/http2/http2-spec/issues/610 + f.errDetail = errors.New("pad size larger than data payload") + return http2.ConnectionError(http2.ErrCodeProtocol) + } + if _, err := io.ReadFull(f.reader, buf); err != nil { + return err + } + buf = buf[:len(buf)-int(padSize)] + } else if _, err := io.ReadFull(f.reader, buf); err != nil { + return err + } + + f.dataFrame.FrameHeader = fh + if useBufferPool { + // Update the handle to point to the (potentially re-sliced) buf. + *poolHandle = buf + f.dataFrame.data = mem.NewBuffer(poolHandle, f.pool) + } else { + f.dataFrame.data = mem.SliceBuffer(buf) + } + return nil +} + +func (df *parsedDataFrame) Header() http2.FrameHeader { + return df.FrameHeader +} + func getWriteBufferPool(size int) *sync.Pool { writeBufferMutex.Lock() defer writeBufferMutex.Unlock() diff --git a/vendor/google.golang.org/grpc/internal/transport/server_stream.go b/vendor/google.golang.org/grpc/internal/transport/server_stream.go index cf8da0b52d..ed6a13b750 100644 --- a/vendor/google.golang.org/grpc/internal/transport/server_stream.go +++ b/vendor/google.golang.org/grpc/internal/transport/server_stream.go @@ -32,7 +32,7 @@ import ( // ServerStream implements streaming functionality for a gRPC server. type ServerStream struct { - *Stream // Embed for common stream functionality. + Stream // Embed for common stream functionality. st internalServerTransport ctxDone <-chan struct{} // closed at the end of stream. Cache of ctx.Done() (for performance) @@ -43,12 +43,13 @@ type ServerStream struct { // Holds compressor names passed in grpc-accept-encoding metadata from the // client. clientAdvertisedCompressors string - headerWireLength int // hdrMu protects outgoing header and trailer metadata. hdrMu sync.Mutex header metadata.MD // the outgoing header metadata. Updated by WriteHeader. headerSent atomic.Bool // atomically set when the headers are sent out. + + headerWireLength int } // Read reads an n byte message from the input stream. @@ -178,3 +179,11 @@ func (s *ServerStream) SetTrailer(md metadata.MD) error { s.hdrMu.Unlock() return nil } + +func (s *ServerStream) requestRead(n int) { + s.st.adjustWindow(s, uint32(n)) +} + +func (s *ServerStream) updateWindow(n int) { + s.st.updateWindow(s, uint32(n)) +} diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go index af4a4aeab1..b86094da94 100644 --- a/vendor/google.golang.org/grpc/internal/transport/transport.go +++ b/vendor/google.golang.org/grpc/internal/transport/transport.go @@ -68,11 +68,11 @@ type recvBuffer struct { err error } -func newRecvBuffer() *recvBuffer { - b := &recvBuffer{ - c: make(chan recvMsg, 1), - } - return b +// init allows a recvBuffer to be initialized in-place, which is useful +// for resetting a buffer or for avoiding a heap allocation when the buffer +// is embedded in another struct. +func (b *recvBuffer) init() { + b.c = make(chan recvMsg, 1) } func (b *recvBuffer) put(r recvMsg) { @@ -123,12 +123,13 @@ func (b *recvBuffer) get() <-chan recvMsg { // recvBufferReader implements io.Reader interface to read the data from // recvBuffer. type recvBufferReader struct { - closeStream func(error) // Closes the client transport stream with the given error and nil trailer metadata. - ctx context.Context - ctxDone <-chan struct{} // cache of ctx.Done() (for performance). - recv *recvBuffer - last mem.Buffer // Stores the remaining data in the previous calls. - err error + _ noCopy + clientStream *ClientStream // The client transport stream is closed with a status representing ctx.Err() and nil trailer metadata. + ctx context.Context + ctxDone <-chan struct{} // cache of ctx.Done() (for performance). + recv *recvBuffer + last mem.Buffer // Stores the remaining data in the previous calls. + err error } func (r *recvBufferReader) ReadMessageHeader(header []byte) (n int, err error) { @@ -139,7 +140,7 @@ func (r *recvBufferReader) ReadMessageHeader(header []byte) (n int, err error) { n, r.last = mem.ReadUnsafe(header, r.last) return n, nil } - if r.closeStream != nil { + if r.clientStream != nil { n, r.err = r.readMessageHeaderClient(header) } else { n, r.err = r.readMessageHeader(header) @@ -164,7 +165,7 @@ func (r *recvBufferReader) Read(n int) (buf mem.Buffer, err error) { } return buf, nil } - if r.closeStream != nil { + if r.clientStream != nil { buf, r.err = r.readClient(n) } else { buf, r.err = r.read(n) @@ -209,7 +210,7 @@ func (r *recvBufferReader) readMessageHeaderClient(header []byte) (n int, err er // TODO: delaying ctx error seems like a unnecessary side effect. What // we really want is to mark the stream as done, and return ctx error // faster. - r.closeStream(ContextErr(r.ctx.Err())) + r.clientStream.Close(ContextErr(r.ctx.Err())) m := <-r.recv.get() return r.readMessageHeaderAdditional(m, header) case m := <-r.recv.get(): @@ -236,7 +237,7 @@ func (r *recvBufferReader) readClient(n int) (buf mem.Buffer, err error) { // TODO: delaying ctx error seems like a unnecessary side effect. What // we really want is to mark the stream as done, and return ctx error // faster. - r.closeStream(ContextErr(r.ctx.Err())) + r.clientStream.Close(ContextErr(r.ctx.Err())) m := <-r.recv.get() return r.readAdditional(m, n) case m := <-r.recv.get(): @@ -285,27 +286,32 @@ const ( // Stream represents an RPC in the transport layer. type Stream struct { - id uint32 ctx context.Context // the associated context of the stream method string // the associated RPC method of the stream recvCompress string sendCompress string - buf *recvBuffer - trReader *transportReader - fc *inFlow - wq *writeQuota - - // Callback to state application's intentions to read data. This - // is used to adjust flow control, if needed. - requestRead func(int) - state streamState + readRequester readRequester // contentSubtype is the content-subtype for requests. // this must be lowercase or the behavior is undefined. contentSubtype string trailer metadata.MD // the key-value map of trailer metadata. + + // Non-pointer fields are at the end to optimize GC performance. + state streamState + id uint32 + buf recvBuffer + trReader transportReader + fc inFlow + wq writeQuota +} + +// readRequester is used to state application's intentions to read data. This +// is used to adjust flow control, if needed. +type readRequester interface { + requestRead(int) } func (s *Stream) swapState(st streamState) streamState { @@ -355,7 +361,7 @@ func (s *Stream) ReadMessageHeader(header []byte) (err error) { if er := s.trReader.er; er != nil { return er } - s.requestRead(len(header)) + s.readRequester.requestRead(len(header)) for len(header) != 0 { n, err := s.trReader.ReadMessageHeader(header) header = header[n:] @@ -372,13 +378,29 @@ func (s *Stream) ReadMessageHeader(header []byte) (err error) { return nil } +// ceil returns the ceil after dividing the numerator and denominator while +// avoiding integer overflows. +func ceil(numerator, denominator int) int { + if numerator == 0 { + return 0 + } + return (numerator-1)/denominator + 1 +} + // Read reads n bytes from the wire for this stream. func (s *Stream) read(n int) (data mem.BufferSlice, err error) { // Don't request a read if there was an error earlier if er := s.trReader.er; er != nil { return nil, er } - s.requestRead(n) + // gRPC Go accepts data frames with a maximum length of 16KB. Larger + // messages must be split into multiple frames. We pre-allocate the + // buffer to avoid resizing during the read loop, but cap the initial + // capacity to 128 frames (2MB) to prevent over-allocation or panics + // when reading extremely large streams. + allocCap := min(ceil(n, http2MaxFrameLen), 128) + data = make(mem.BufferSlice, 0, allocCap) + s.readRequester.requestRead(n) for n != 0 { buf, err := s.trReader.Read(n) var bufLen int @@ -401,16 +423,34 @@ func (s *Stream) read(n int) (data mem.BufferSlice, err error) { return data, nil } +// noCopy may be embedded into structs which must not be copied +// after the first use. +// +// See https://golang.org/issues/8005#issuecomment-190753527 +// for details. +type noCopy struct { +} + +func (*noCopy) Lock() {} +func (*noCopy) Unlock() {} + // transportReader reads all the data available for this Stream from the transport and // passes them into the decoder, which converts them into a gRPC message stream. // The error is io.EOF when the stream is done or another non-nil error if // the stream broke. type transportReader struct { - reader *recvBufferReader + _ noCopy // The handler to control the window update procedure for both this // particular stream and the associated transport. - windowHandler func(int) + windowHandler windowHandler er error + reader recvBufferReader +} + +// The handler to control the window update procedure for both this +// particular stream and the associated transport. +type windowHandler interface { + updateWindow(int) } func (t *transportReader) ReadMessageHeader(header []byte) (int, error) { @@ -419,7 +459,7 @@ func (t *transportReader) ReadMessageHeader(header []byte) (int, error) { t.er = err return 0, err } - t.windowHandler(n) + t.windowHandler.updateWindow(n) return n, nil } @@ -429,7 +469,7 @@ func (t *transportReader) Read(n int) (mem.Buffer, error) { t.er = err return buf, err } - t.windowHandler(buf.Len()) + t.windowHandler.updateWindow(buf.Len()) return buf, nil } @@ -454,7 +494,7 @@ type ServerConfig struct { ConnectionTimeout time.Duration Credentials credentials.TransportCredentials InTapHandle tap.ServerInHandle - StatsHandlers []stats.Handler + StatsHandler stats.Handler KeepaliveParams keepalive.ServerParameters KeepalivePolicy keepalive.EnforcementPolicy InitialWindowSize int32 @@ -466,6 +506,7 @@ type ServerConfig struct { MaxHeaderListSize *uint32 HeaderTableSize *uint32 BufferPool mem.BufferPool + StaticWindowSize bool } // ConnectOptions covers all relevant options for communicating with the server. @@ -504,6 +545,8 @@ type ConnectOptions struct { MaxHeaderListSize *uint32 // The mem.BufferPool to use when reading/writing to the wire. BufferPool mem.BufferPool + // StaticWindowSize controls whether dynamic window sizing is enabled. + StaticWindowSize bool } // WriteOptions provides additional hints and information for message @@ -526,6 +569,12 @@ type CallHdr struct { // outbound message. SendCompress string + // AcceptedCompressors overrides the grpc-accept-encoding header for this + // call. When nil, the transport advertises the default set of registered + // compressors. A non-nil pointer overrides that value (including the empty + // string to advertise none). + AcceptedCompressors *string + // Creds specifies credentials.PerRPCCredentials for a call. Creds credentials.PerRPCCredentials @@ -540,6 +589,16 @@ type CallHdr struct { PreviousAttempts int // value of grpc-previous-rpc-attempts header to set DoneFunc func() // called when the stream is finished + + // Authority is used to explicitly override the `:authority` header. + // + // This value comes from one of two sources: + // 1. The `CallAuthority` call option, if specified by the user. + // 2. An override provided by the LB picker (e.g. xDS authority rewriting). + // + // The `CallAuthority` call option always takes precedence over the LB + // picker override. + Authority string } // ClientTransport is the common interface for all gRPC client-side transport @@ -558,7 +617,7 @@ type ClientTransport interface { GracefulClose() // NewStream creates a Stream for an RPC. - NewStream(ctx context.Context, callHdr *CallHdr) (*ClientStream, error) + NewStream(ctx context.Context, callHdr *CallHdr, handler stats.Handler) (*ClientStream, error) // Error returns a channel that is closed when some I/O error // happens. Typically the caller should have a goroutine to monitor @@ -576,8 +635,9 @@ type ClientTransport interface { // with a human readable string with debug info. GetGoAwayReason() (GoAwayReason, string) - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr + // Peer returns information about the peer associated with the Transport. + // The returned information includes authentication and network address details. + Peer() *peer.Peer } // ServerTransport is the common interface for all gRPC server-side transport @@ -607,6 +667,8 @@ type internalServerTransport interface { write(s *ServerStream, hdr []byte, data mem.BufferSlice, opts *WriteOptions) error writeStatus(s *ServerStream, st *status.Status) error incrMsgRecv() + adjustWindow(s *ServerStream, n uint32) + updateWindow(s *ServerStream, n uint32) } // connectionErrorf creates an ConnectionError with the specified error description. diff --git a/vendor/google.golang.org/grpc/mem/buffer_pool.go b/vendor/google.golang.org/grpc/mem/buffer_pool.go index c37c58c023..2ea763a49a 100644 --- a/vendor/google.golang.org/grpc/mem/buffer_pool.go +++ b/vendor/google.golang.org/grpc/mem/buffer_pool.go @@ -32,12 +32,17 @@ type BufferPool interface { Get(length int) *[]byte // Put returns a buffer to the pool. + // + // The provided pointer must hold a prefix of the buffer obtained via + // BufferPool.Get to ensure the buffer's entire capacity can be re-used. Put(*[]byte) } +const goPageSize = 4 << 10 // 4KiB. N.B. this must be a power of 2. + var defaultBufferPoolSizes = []int{ 256, - 4 << 10, // 4KB (go page size) + goPageSize, 16 << 10, // 16KB (max HTTP/2 frame size used by gRPC) 32 << 10, // 32KB (default buffer size for io.Copy) 1 << 20, // 1MB @@ -48,7 +53,7 @@ var defaultBufferPool BufferPool func init() { defaultBufferPool = NewTieredBufferPool(defaultBufferPoolSizes...) - internal.SetDefaultBufferPoolForTesting = func(pool BufferPool) { + internal.SetDefaultBufferPool = func(pool BufferPool) { defaultBufferPool = pool } @@ -118,7 +123,11 @@ type sizedBufferPool struct { } func (p *sizedBufferPool) Get(size int) *[]byte { - buf := p.pool.Get().(*[]byte) + buf, ok := p.pool.Get().(*[]byte) + if !ok { + buf := make([]byte, size, p.defaultSize) + return &buf + } b := *buf clear(b[:cap(b)]) *buf = b[:size] @@ -137,12 +146,6 @@ func (p *sizedBufferPool) Put(buf *[]byte) { func newSizedBufferPool(size int) *sizedBufferPool { return &sizedBufferPool{ - pool: sync.Pool{ - New: func() any { - buf := make([]byte, size) - return &buf - }, - }, defaultSize: size, } } @@ -160,6 +163,7 @@ type simpleBufferPool struct { func (p *simpleBufferPool) Get(size int) *[]byte { bs, ok := p.pool.Get().(*[]byte) if ok && cap(*bs) >= size { + clear((*bs)[:cap(*bs)]) *bs = (*bs)[:size] return bs } @@ -170,7 +174,14 @@ func (p *simpleBufferPool) Get(size int) *[]byte { p.pool.Put(bs) } - b := make([]byte, size) + // If we're going to allocate, round up to the nearest page. This way if + // requests frequently arrive with small variation we don't allocate + // repeatedly if we get unlucky and they increase over time. By default we + // only allocate here if size > 1MiB. Because goPageSize is a power of 2, we + // can round up efficiently. + allocSize := (size + goPageSize - 1) & ^(goPageSize - 1) + + b := make([]byte, size, allocSize) return &b } diff --git a/vendor/google.golang.org/grpc/mem/buffer_slice.go b/vendor/google.golang.org/grpc/mem/buffer_slice.go index 65002e2cc8..084fb19c6d 100644 --- a/vendor/google.golang.org/grpc/mem/buffer_slice.go +++ b/vendor/google.golang.org/grpc/mem/buffer_slice.go @@ -19,6 +19,7 @@ package mem import ( + "fmt" "io" ) @@ -117,47 +118,53 @@ func (s BufferSlice) MaterializeToBuffer(pool BufferPool) Buffer { // Reader returns a new Reader for the input slice after taking references to // each underlying buffer. -func (s BufferSlice) Reader() Reader { +func (s BufferSlice) Reader() *Reader { s.Ref() - return &sliceReader{ + return &Reader{ data: s, len: s.Len(), } } // Reader exposes a BufferSlice's data as an io.Reader, allowing it to interface -// with other parts systems. It also provides an additional convenience method -// Remaining(), which returns the number of unread bytes remaining in the slice. +// with other systems. +// // Buffers will be freed as they are read. -type Reader interface { - io.Reader - io.ByteReader - // Close frees the underlying BufferSlice and never returns an error. Subsequent - // calls to Read will return (0, io.EOF). - Close() error - // Remaining returns the number of unread bytes remaining in the slice. - Remaining() int -} - -type sliceReader struct { +// +// A Reader can be constructed from a BufferSlice; alternatively the zero value +// of a Reader may be used after calling Reset on it. +type Reader struct { data BufferSlice len int // The index into data[0].ReadOnlyData(). bufferIdx int } -func (r *sliceReader) Remaining() int { +// Remaining returns the number of unread bytes remaining in the slice. +func (r *Reader) Remaining() int { return r.len } -func (r *sliceReader) Close() error { +// Reset frees the currently held buffer slice and starts reading from the +// provided slice. This allows reusing the reader object. +func (r *Reader) Reset(s BufferSlice) { + r.data.Free() + s.Ref() + r.data = s + r.len = s.Len() + r.bufferIdx = 0 +} + +// Close frees the underlying BufferSlice and never returns an error. Subsequent +// calls to Read will return (0, io.EOF). +func (r *Reader) Close() error { r.data.Free() r.data = nil r.len = 0 return nil } -func (r *sliceReader) freeFirstBufferIfEmpty() bool { +func (r *Reader) freeFirstBufferIfEmpty() bool { if len(r.data) == 0 || r.bufferIdx != len(r.data[0].ReadOnlyData()) { return false } @@ -168,7 +175,7 @@ func (r *sliceReader) freeFirstBufferIfEmpty() bool { return true } -func (r *sliceReader) Read(buf []byte) (n int, _ error) { +func (r *Reader) Read(buf []byte) (n int, _ error) { if r.len == 0 { return 0, io.EOF } @@ -191,7 +198,8 @@ func (r *sliceReader) Read(buf []byte) (n int, _ error) { return n, nil } -func (r *sliceReader) ReadByte() (byte, error) { +// ReadByte reads a single byte. +func (r *Reader) ReadByte() (byte, error) { if r.len == 0 { return 0, io.EOF } @@ -279,3 +287,59 @@ nextBuffer: } } } + +// Discard skips the next n bytes, returning the number of bytes discarded. +// +// It frees buffers as they are fully consumed. +// +// If Discard skips fewer than n bytes, it also returns an error. +func (r *Reader) Discard(n int) (discarded int, err error) { + total := n + for n > 0 && r.len > 0 { + curData := r.data[0].ReadOnlyData() + curSize := min(n, len(curData)-r.bufferIdx) + n -= curSize + r.len -= curSize + r.bufferIdx += curSize + if r.bufferIdx >= len(curData) { + r.data[0].Free() + r.data = r.data[1:] + r.bufferIdx = 0 + } + } + discarded = total - n + if n > 0 { + return discarded, fmt.Errorf("insufficient bytes in reader") + } + return discarded, nil +} + +// Peek returns the next n bytes without advancing the reader. +// +// Peek appends results to the provided res slice and returns the updated slice. +// This pattern allows re-using the storage of res if it has sufficient +// capacity. +// +// The returned subslices are views into the underlying buffers and are only +// valid until the reader is advanced past the corresponding buffer. +// +// If Peek returns fewer than n bytes, it also returns an error. +func (r *Reader) Peek(n int, res [][]byte) ([][]byte, error) { + for i := 0; n > 0 && i < len(r.data); i++ { + curData := r.data[i].ReadOnlyData() + start := 0 + if i == 0 { + start = r.bufferIdx + } + curSize := min(n, len(curData)-start) + if curSize == 0 { + continue + } + res = append(res, curData[start:start+curSize]) + n -= curSize + } + if n > 0 { + return nil, fmt.Errorf("insufficient bytes in reader") + } + return res, nil +} diff --git a/vendor/google.golang.org/grpc/mem/buffers.go b/vendor/google.golang.org/grpc/mem/buffers.go index ecbf0b9a73..db1620e6ac 100644 --- a/vendor/google.golang.org/grpc/mem/buffers.go +++ b/vendor/google.golang.org/grpc/mem/buffers.go @@ -62,7 +62,6 @@ var ( bufferPoolingThreshold = 1 << 10 bufferObjectPool = sync.Pool{New: func() any { return new(buffer) }} - refObjectPool = sync.Pool{New: func() any { return new(atomic.Int32) }} ) // IsBelowBufferPoolingThreshold returns true if the given size is less than or @@ -73,9 +72,19 @@ func IsBelowBufferPoolingThreshold(size int) bool { } type buffer struct { + refs atomic.Int32 + data []byte + + // rootBuf is the buffer responsible for returning origData to the pool + // once the reference count drops to 0. + // + // When a buffer is split, the new buffer inherits the rootBuf of the + // original and increments the root's reference count. For the + // initial buffer (the root), this field points to itself. + rootBuf *buffer + + // The following fields are only set for root buffers. origData *[]byte - data []byte - refs *atomic.Int32 pool BufferPool } @@ -103,8 +112,8 @@ func NewBuffer(data *[]byte, pool BufferPool) Buffer { b.origData = data b.data = *data b.pool = pool - b.refs = refObjectPool.Get().(*atomic.Int32) - b.refs.Add(1) + b.rootBuf = b + b.refs.Store(1) return b } @@ -127,42 +136,44 @@ func Copy(data []byte, pool BufferPool) Buffer { } func (b *buffer) ReadOnlyData() []byte { - if b.refs == nil { + if b.rootBuf == nil { panic("Cannot read freed buffer") } return b.data } func (b *buffer) Ref() { - if b.refs == nil { + if b.refs.Add(1) <= 1 { panic("Cannot ref freed buffer") } - b.refs.Add(1) } func (b *buffer) Free() { - if b.refs == nil { + refs := b.refs.Add(-1) + if refs < 0 { panic("Cannot free freed buffer") } - - refs := b.refs.Add(-1) - switch { - case refs > 0: + if refs > 0 { return - case refs == 0: + } + + b.data = nil + if b.rootBuf == b { + // This buffer is the owner of the data slice and its ref count reached + // 0, free the slice. if b.pool != nil { b.pool.Put(b.origData) + b.pool = nil } - - refObjectPool.Put(b.refs) b.origData = nil - b.data = nil - b.refs = nil - b.pool = nil - bufferObjectPool.Put(b) - default: - panic("Cannot free freed buffer") + } else { + // This buffer doesn't own the data slice, decrement a ref on the root + // buffer. + b.rootBuf.Free() } + + b.rootBuf = nil + bufferObjectPool.Put(b) } func (b *buffer) Len() int { @@ -170,16 +181,14 @@ func (b *buffer) Len() int { } func (b *buffer) split(n int) (Buffer, Buffer) { - if b.refs == nil { + if b.rootBuf == nil || b.rootBuf.refs.Add(1) <= 1 { panic("Cannot split freed buffer") } - b.refs.Add(1) split := newBuffer() - split.origData = b.origData split.data = b.data[n:] - split.refs = b.refs - split.pool = b.pool + split.rootBuf = b.rootBuf + split.refs.Store(1) b.data = b.data[:n] @@ -187,7 +196,7 @@ func (b *buffer) split(n int) (Buffer, Buffer) { } func (b *buffer) read(buf []byte) (int, Buffer) { - if b.refs == nil { + if b.rootBuf == nil { panic("Cannot read freed buffer") } diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go index a2d2a798d4..aa52bfe95f 100644 --- a/vendor/google.golang.org/grpc/picker_wrapper.go +++ b/vendor/google.golang.org/grpc/picker_wrapper.go @@ -29,7 +29,6 @@ import ( "google.golang.org/grpc/internal/channelz" istatus "google.golang.org/grpc/internal/status" "google.golang.org/grpc/internal/transport" - "google.golang.org/grpc/stats" "google.golang.org/grpc/status" ) @@ -48,14 +47,11 @@ type pickerGeneration struct { // actions and unblock when there's a picker update. type pickerWrapper struct { // If pickerGen holds a nil pointer, the pickerWrapper is closed. - pickerGen atomic.Pointer[pickerGeneration] - statsHandlers []stats.Handler // to record blocking picker calls + pickerGen atomic.Pointer[pickerGeneration] } -func newPickerWrapper(statsHandlers []stats.Handler) *pickerWrapper { - pw := &pickerWrapper{ - statsHandlers: statsHandlers, - } +func newPickerWrapper() *pickerWrapper { + pw := &pickerWrapper{} pw.pickerGen.Store(&pickerGeneration{ blockingCh: make(chan struct{}), }) @@ -93,6 +89,12 @@ func doneChannelzWrapper(acbw *acBalancerWrapper, result *balancer.PickResult) { } } +type pick struct { + transport transport.ClientTransport // the selected transport + result balancer.PickResult // the contents of the pick from the LB policy + blocked bool // set if a picker call queued for a new picker +} + // pick returns the transport that will be used for the RPC. // It may block in the following cases: // - there's no picker @@ -100,15 +102,16 @@ func doneChannelzWrapper(acbw *acBalancerWrapper, result *balancer.PickResult) { // - the current picker returns other errors and failfast is false. // - the subConn returned by the current picker is not READY // When one of these situations happens, pick blocks until the picker gets updated. -func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.PickInfo) (transport.ClientTransport, balancer.PickResult, error) { +func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer.PickInfo) (pick, error) { var ch chan struct{} var lastPickErr error + pickBlocked := false for { pg := pw.pickerGen.Load() if pg == nil { - return nil, balancer.PickResult{}, ErrClientConnClosing + return pick{}, ErrClientConnClosing } if pg.picker == nil { ch = pg.blockingCh @@ -127,9 +130,9 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. } switch ctx.Err() { case context.DeadlineExceeded: - return nil, balancer.PickResult{}, status.Error(codes.DeadlineExceeded, errStr) + return pick{}, status.Error(codes.DeadlineExceeded, errStr) case context.Canceled: - return nil, balancer.PickResult{}, status.Error(codes.Canceled, errStr) + return pick{}, status.Error(codes.Canceled, errStr) } case <-ch: } @@ -145,9 +148,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. // In the second case, the only way it will get to this conditional is // if there is a new picker. if ch != nil { - for _, sh := range pw.statsHandlers { - sh.HandleRPC(ctx, &stats.PickerUpdated{}) - } + pickBlocked = true } ch = pg.blockingCh @@ -164,7 +165,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. if istatus.IsRestrictedControlPlaneCode(st) { err = status.Errorf(codes.Internal, "received picker error with illegal status: %v", err) } - return nil, balancer.PickResult{}, dropError{error: err} + return pick{}, dropError{error: err} } // For all other errors, wait for ready RPCs should block and other // RPCs should fail with unavailable. @@ -172,7 +173,7 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. lastPickErr = err continue } - return nil, balancer.PickResult{}, status.Error(codes.Unavailable, err.Error()) + return pick{}, status.Error(codes.Unavailable, err.Error()) } acbw, ok := pickResult.SubConn.(*acBalancerWrapper) @@ -183,9 +184,8 @@ func (pw *pickerWrapper) pick(ctx context.Context, failfast bool, info balancer. if t := acbw.ac.getReadyTransport(); t != nil { if channelz.IsOn() { doneChannelzWrapper(acbw, &pickResult) - return t, pickResult, nil } - return t, pickResult, nil + return pick{transport: t, result: pickResult, blocked: pickBlocked}, nil } if pickResult.Done != nil { // Calling done with nil error, no bytes sent and no bytes received. diff --git a/vendor/google.golang.org/grpc/preloader.go b/vendor/google.golang.org/grpc/preloader.go index ee0ff969af..1e783febf9 100644 --- a/vendor/google.golang.org/grpc/preloader.go +++ b/vendor/google.golang.org/grpc/preloader.go @@ -47,9 +47,6 @@ func (p *PreparedMsg) Encode(s Stream, msg any) error { } // check if the context has the relevant information to prepareMsg - if rpcInfo.preloaderInfo == nil { - return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo is nil") - } if rpcInfo.preloaderInfo.codec == nil { return status.Errorf(codes.Internal, "grpc: rpcInfo.preloaderInfo.codec is nil") } diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go index b84ef26d46..598ed21a29 100644 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ b/vendor/google.golang.org/grpc/resolver/resolver.go @@ -182,6 +182,7 @@ type BuildOptions struct { // An Endpoint is one network endpoint, or server, which may have multiple // addresses with which it can be accessed. +// TODO(i/8773) : make resolver.Endpoint and resolver.Address immutable type Endpoint struct { // Addresses contains a list of addresses used to access this endpoint. Addresses []Address @@ -332,6 +333,11 @@ type AuthorityOverrider interface { // OverrideAuthority returns the authority to use for a ClientConn with the // given target. The implementation must generate it without blocking, // typically in line, and must keep it unchanged. + // + // The returned string must be a valid ":authority" header value, i.e. be + // encoded according to + // [RFC3986](https://datatracker.ietf.org/doc/html/rfc3986#section-3.2) as + // necessary. OverrideAuthority(Target) string } diff --git a/vendor/google.golang.org/grpc/resolver_wrapper.go b/vendor/google.golang.org/grpc/resolver_wrapper.go index 80e16a327c..6e61376437 100644 --- a/vendor/google.golang.org/grpc/resolver_wrapper.go +++ b/vendor/google.golang.org/grpc/resolver_wrapper.go @@ -69,6 +69,7 @@ func (ccr *ccResolverWrapper) start() error { errCh := make(chan error) ccr.serializer.TrySchedule(func(ctx context.Context) { if ctx.Err() != nil { + errCh <- ctx.Err() return } opts := resolver.BuildOptions{ diff --git a/vendor/google.golang.org/grpc/rpc_util.go b/vendor/google.golang.org/grpc/rpc_util.go index ad20e9dff2..8160f94304 100644 --- a/vendor/google.golang.org/grpc/rpc_util.go +++ b/vendor/google.golang.org/grpc/rpc_util.go @@ -33,6 +33,8 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding/proto" + "google.golang.org/grpc/internal" + "google.golang.org/grpc/internal/grpcutil" "google.golang.org/grpc/internal/transport" "google.golang.org/grpc/mem" "google.golang.org/grpc/metadata" @@ -41,6 +43,10 @@ import ( "google.golang.org/grpc/status" ) +func init() { + internal.AcceptCompressors = acceptCompressors +} + // Compressor defines the interface gRPC uses to compress a message. // // Deprecated: use package encoding. @@ -151,15 +157,32 @@ func (d *gzipDecompressor) Type() string { // callInfo contains all related configuration and information about an RPC. type callInfo struct { - compressorName string - failFast bool - maxReceiveMessageSize *int - maxSendMessageSize *int - creds credentials.PerRPCCredentials - contentSubtype string - codec baseCodec - maxRetryRPCBufferSize int - onFinish []func(err error) + compressorName string + failFast bool + maxReceiveMessageSize *int + maxSendMessageSize *int + creds credentials.PerRPCCredentials + contentSubtype string + codec baseCodec + maxRetryRPCBufferSize int + onFinish []func(err error) + authority string + acceptedResponseCompressors []string +} + +func acceptedCompressorAllows(allowed []string, name string) bool { + if allowed == nil { + return true + } + if name == "" || name == encoding.Identity { + return true + } + for _, a := range allowed { + if a == name { + return true + } + } + return false } func defaultCallInfo() *callInfo { @@ -169,6 +192,29 @@ func defaultCallInfo() *callInfo { } } +func newAcceptedCompressionConfig(names []string) ([]string, error) { + if len(names) == 0 { + return nil, nil + } + var allowed []string + seen := make(map[string]struct{}, len(names)) + for _, name := range names { + name = strings.TrimSpace(name) + if name == "" || name == encoding.Identity { + continue + } + if !grpcutil.IsCompressorNameRegistered(name) { + return nil, status.Errorf(codes.InvalidArgument, "grpc: compressor %q is not registered", name) + } + if _, dup := seen[name]; dup { + continue + } + seen[name] = struct{}{} + allowed = append(allowed, name) + } + return allowed, nil +} + // CallOption configures a Call before it starts or extracts information from // a Call after it completes. type CallOption interface { @@ -365,6 +411,36 @@ func (o MaxRecvMsgSizeCallOption) before(c *callInfo) error { } func (o MaxRecvMsgSizeCallOption) after(*callInfo, *csAttempt) {} +// CallAuthority returns a CallOption that sets the HTTP/2 :authority header of +// an RPC to the specified value. When using CallAuthority, the credentials in +// use must implement the AuthorityValidator interface. +// +// # Experimental +// +// Notice: This API is EXPERIMENTAL and may be changed or removed in a later +// release. +func CallAuthority(authority string) CallOption { + return AuthorityOverrideCallOption{Authority: authority} +} + +// AuthorityOverrideCallOption is a CallOption that indicates the HTTP/2 +// :authority header value to use for the call. +// +// # Experimental +// +// Notice: This type is EXPERIMENTAL and may be changed or removed in a later +// release. +type AuthorityOverrideCallOption struct { + Authority string +} + +func (o AuthorityOverrideCallOption) before(c *callInfo) error { + c.authority = o.Authority + return nil +} + +func (o AuthorityOverrideCallOption) after(*callInfo, *csAttempt) {} + // MaxCallSendMsgSize returns a CallOption which sets the maximum message size // in bytes the client can send. If this is not set, gRPC uses the default // `math.MaxInt32`. @@ -440,6 +516,31 @@ func (o CompressorCallOption) before(c *callInfo) error { } func (o CompressorCallOption) after(*callInfo, *csAttempt) {} +// acceptCompressors returns a CallOption that limits the compression algorithms +// advertised in the grpc-accept-encoding header for response messages. +// Compression algorithms not in the provided list will not be advertised, and +// responses compressed with non-listed algorithms will be rejected. +func acceptCompressors(names ...string) CallOption { + cp := append([]string(nil), names...) + return acceptCompressorsCallOption{names: cp} +} + +// acceptCompressorsCallOption is a CallOption that limits response compression. +type acceptCompressorsCallOption struct { + names []string +} + +func (o acceptCompressorsCallOption) before(c *callInfo) error { + allowed, err := newAcceptedCompressionConfig(o.names) + if err != nil { + return err + } + c.acceptedResponseCompressors = allowed + return nil +} + +func (acceptCompressorsCallOption) after(*callInfo, *csAttempt) {} + // CallContentSubtype returns a CallOption that will set the content-subtype // for a call. For example, if content-subtype is "json", the Content-Type over // the wire will be "application/grpc+json". The content-subtype is converted @@ -626,8 +727,20 @@ type streamReader interface { Read(n int) (mem.BufferSlice, error) } +// noCopy may be embedded into structs which must not be copied +// after the first use. +// +// See https://golang.org/issues/8005#issuecomment-190753527 +// for details. +type noCopy struct { +} + +func (*noCopy) Lock() {} +func (*noCopy) Unlock() {} + // parser reads complete gRPC messages from the underlying reader. type parser struct { + _ noCopy // r is the underlying reader. // See the comment on recvMsg for the permissible // error types. @@ -814,8 +927,7 @@ func (p *payloadInfo) free() { // the buffer is no longer needed. // TODO: Refactor this function to reduce the number of arguments. // See: https://google.github.io/styleguide/go/best-practices.html#function-argument-lists -func recvAndDecompress(p *parser, s recvCompressor, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, isServer bool, -) (out mem.BufferSlice, err error) { +func recvAndDecompress(p *parser, s recvCompressor, dc Decompressor, maxReceiveMessageSize int, payInfo *payloadInfo, compressor encoding.Compressor, isServer bool) (out mem.BufferSlice, err error) { pf, compressed, err := p.recvMsg(maxReceiveMessageSize) if err != nil { return nil, err @@ -918,7 +1030,7 @@ func recv(p *parser, c baseCodec, s recvCompressor, dc Decompressor, m any, maxR // Information about RPC type rpcInfo struct { failfast bool - preloaderInfo *compressorInfo + preloaderInfo compressorInfo } // Information about Preloader @@ -937,7 +1049,7 @@ type rpcInfoContextKey struct{} func newContextWithRPCInfo(ctx context.Context, failfast bool, codec baseCodec, cp Compressor, comp encoding.Compressor) context.Context { return context.WithValue(ctx, rpcInfoContextKey{}, &rpcInfo{ failfast: failfast, - preloaderInfo: &compressorInfo{ + preloaderInfo: compressorInfo{ codec: codec, cp: cp, comp: comp, diff --git a/vendor/google.golang.org/grpc/server.go b/vendor/google.golang.org/grpc/server.go index 976e70ae06..8efb29a7b9 100644 --- a/vendor/google.golang.org/grpc/server.go +++ b/vendor/google.golang.org/grpc/server.go @@ -42,6 +42,7 @@ import ( "google.golang.org/grpc/internal" "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/channelz" + "google.golang.org/grpc/internal/envconfig" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/internal/grpcutil" istats "google.golang.org/grpc/internal/stats" @@ -124,7 +125,8 @@ type serviceInfo struct { // Server is a gRPC server to serve RPC requests. type Server struct { - opts serverOptions + opts serverOptions + statsHandler stats.Handler mu sync.Mutex // guards following lis map[net.Listener]bool @@ -148,6 +150,8 @@ type Server struct { serverWorkerChannel chan func() serverWorkerChannelClose func() + + strictPathCheckingLogEmitted atomic.Bool } type serverOptions struct { @@ -179,6 +183,7 @@ type serverOptions struct { numServerWorkers uint32 bufferPool mem.BufferPool waitForHandlers bool + staticWindowSize bool } var defaultServerOptions = serverOptions{ @@ -279,6 +284,7 @@ func ReadBufferSize(s int) ServerOption { func InitialWindowSize(s int32) ServerOption { return newFuncServerOption(func(o *serverOptions) { o.initialWindowSize = s + o.staticWindowSize = true }) } @@ -287,6 +293,29 @@ func InitialWindowSize(s int32) ServerOption { func InitialConnWindowSize(s int32) ServerOption { return newFuncServerOption(func(o *serverOptions) { o.initialConnWindowSize = s + o.staticWindowSize = true + }) +} + +// StaticStreamWindowSize returns a ServerOption to set the initial stream +// window size to the value provided and disables dynamic flow control. +// The lower bound for window size is 64K and any value smaller than that +// will be ignored. +func StaticStreamWindowSize(s int32) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.initialWindowSize = s + o.staticWindowSize = true + }) +} + +// StaticConnWindowSize returns a ServerOption to set the initial connection +// window size to the value provided and disables dynamic flow control. +// The lower bound for window size is 64K and any value smaller than that +// will be ignored. +func StaticConnWindowSize(s int32) ServerOption { + return newFuncServerOption(func(o *serverOptions) { + o.initialConnWindowSize = s + o.staticWindowSize = true }) } @@ -667,13 +696,14 @@ func NewServer(opt ...ServerOption) *Server { o.apply(&opts) } s := &Server{ - lis: make(map[net.Listener]bool), - opts: opts, - conns: make(map[string]map[transport.ServerTransport]bool), - services: make(map[string]*serviceInfo), - quit: grpcsync.NewEvent(), - done: grpcsync.NewEvent(), - channelz: channelz.RegisterServer(""), + lis: make(map[net.Listener]bool), + opts: opts, + statsHandler: istats.NewCombinedHandler(opts.statsHandlers...), + conns: make(map[string]map[transport.ServerTransport]bool), + services: make(map[string]*serviceInfo), + quit: grpcsync.NewEvent(), + done: grpcsync.NewEvent(), + channelz: channelz.RegisterServer(""), } chainUnaryServerInterceptors(s) chainStreamServerInterceptors(s) @@ -896,9 +926,7 @@ func (s *Server) Serve(lis net.Listener) error { tempDelay = 5 * time.Millisecond } else { tempDelay *= 2 - } - if max := 1 * time.Second; tempDelay > max { - tempDelay = max + tempDelay = min(tempDelay, 1*time.Second) } s.mu.Lock() s.printf("Accept error: %v; retrying in %v", err, tempDelay) @@ -974,7 +1002,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { ConnectionTimeout: s.opts.connectionTimeout, Credentials: s.opts.creds, InTapHandle: s.opts.inTapHandle, - StatsHandlers: s.opts.statsHandlers, + StatsHandler: s.statsHandler, KeepaliveParams: s.opts.keepaliveParams, KeepalivePolicy: s.opts.keepalivePolicy, InitialWindowSize: s.opts.initialWindowSize, @@ -986,6 +1014,7 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { MaxHeaderListSize: s.opts.maxHeaderListSize, HeaderTableSize: s.opts.headerTableSize, BufferPool: s.opts.bufferPool, + StaticWindowSize: s.opts.staticWindowSize, } st, err := transport.NewServerTransport(c, config) if err != nil { @@ -1010,18 +1039,18 @@ func (s *Server) newHTTP2Transport(c net.Conn) transport.ServerTransport { func (s *Server) serveStreams(ctx context.Context, st transport.ServerTransport, rawConn net.Conn) { ctx = transport.SetConnection(ctx, rawConn) ctx = peer.NewContext(ctx, st.Peer()) - for _, sh := range s.opts.statsHandlers { - ctx = sh.TagConn(ctx, &stats.ConnTagInfo{ + if s.statsHandler != nil { + ctx = s.statsHandler.TagConn(ctx, &stats.ConnTagInfo{ RemoteAddr: st.Peer().Addr, LocalAddr: st.Peer().LocalAddr, }) - sh.HandleConn(ctx, &stats.ConnBegin{}) + s.statsHandler.HandleConn(ctx, &stats.ConnBegin{}) } defer func() { st.Close(errors.New("finished serving streams for the server transport")) - for _, sh := range s.opts.statsHandlers { - sh.HandleConn(ctx, &stats.ConnEnd{}) + if s.statsHandler != nil { + s.statsHandler.HandleConn(ctx, &stats.ConnEnd{}) } }() @@ -1078,7 +1107,7 @@ var _ http.Handler = (*Server)(nil) // Notice: This API is EXPERIMENTAL and may be changed or removed in a // later release. func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - st, err := transport.NewServerHandlerTransport(w, r, s.opts.statsHandlers, s.opts.bufferPool) + st, err := transport.NewServerHandlerTransport(w, r, s.statsHandler, s.opts.bufferPool) if err != nil { // Errors returned from transport.NewServerHandlerTransport have // already been written to w. @@ -1172,12 +1201,8 @@ func (s *Server) sendResponse(ctx context.Context, stream *transport.ServerStrea return status.Errorf(codes.ResourceExhausted, "grpc: trying to send message larger than max (%d vs. %d)", payloadLen, s.opts.maxSendMessageSize) } err = stream.Write(hdr, payload, opts) - if err == nil { - if len(s.opts.statsHandlers) != 0 { - for _, sh := range s.opts.statsHandlers { - sh.HandleRPC(ctx, outPayload(false, msg, dataLen, payloadLen, time.Now())) - } - } + if err == nil && s.statsHandler != nil { + s.statsHandler.HandleRPC(ctx, outPayload(false, msg, dataLen, payloadLen, time.Now())) } return err } @@ -1219,16 +1244,15 @@ func getChainUnaryHandler(interceptors []UnaryServerInterceptor, curr int, info } func (s *Server) processUnaryRPC(ctx context.Context, stream *transport.ServerStream, info *serviceInfo, md *MethodDesc, trInfo *traceInfo) (err error) { - shs := s.opts.statsHandlers - if len(shs) != 0 || trInfo != nil || channelz.IsOn() { + sh := s.statsHandler + if sh != nil || trInfo != nil || channelz.IsOn() { if channelz.IsOn() { s.incrCallsStarted() } var statsBegin *stats.Begin - for _, sh := range shs { - beginTime := time.Now() + if sh != nil { statsBegin = &stats.Begin{ - BeginTime: beginTime, + BeginTime: time.Now(), IsClientStream: false, IsServerStream: false, } @@ -1256,7 +1280,7 @@ func (s *Server) processUnaryRPC(ctx context.Context, stream *transport.ServerSt trInfo.tr.Finish() } - for _, sh := range shs { + if sh != nil { end := &stats.End{ BeginTime: statsBegin.BeginTime, EndTime: time.Now(), @@ -1353,7 +1377,7 @@ func (s *Server) processUnaryRPC(ctx context.Context, stream *transport.ServerSt } var payInfo *payloadInfo - if len(shs) != 0 || len(binlogs) != 0 { + if sh != nil || len(binlogs) != 0 { payInfo = &payloadInfo{} defer payInfo.free() } @@ -1379,7 +1403,7 @@ func (s *Server) processUnaryRPC(ctx context.Context, stream *transport.ServerSt return status.Errorf(codes.Internal, "grpc: error unmarshalling request: %v", err) } - for _, sh := range shs { + if sh != nil { sh.HandleRPC(ctx, &stats.InPayload{ RecvTime: time.Now(), Payload: v, @@ -1553,32 +1577,30 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv if channelz.IsOn() { s.incrCallsStarted() } - shs := s.opts.statsHandlers + sh := s.statsHandler var statsBegin *stats.Begin - if len(shs) != 0 { - beginTime := time.Now() + if sh != nil { statsBegin = &stats.Begin{ - BeginTime: beginTime, + BeginTime: time.Now(), IsClientStream: sd.ClientStreams, IsServerStream: sd.ServerStreams, } - for _, sh := range shs { - sh.HandleRPC(ctx, statsBegin) - } + sh.HandleRPC(ctx, statsBegin) } ctx = NewContextWithServerTransportStream(ctx, stream) ss := &serverStream{ ctx: ctx, s: stream, - p: &parser{r: stream, bufferPool: s.opts.bufferPool}, + p: parser{r: stream, bufferPool: s.opts.bufferPool}, codec: s.getCodec(stream.ContentSubtype()), + desc: sd, maxReceiveMessageSize: s.opts.maxReceiveMessageSize, maxSendMessageSize: s.opts.maxSendMessageSize, trInfo: trInfo, - statsHandler: shs, + statsHandler: sh, } - if len(shs) != 0 || trInfo != nil || channelz.IsOn() { + if sh != nil || trInfo != nil || channelz.IsOn() { // See comment in processUnaryRPC on defers. defer func() { if trInfo != nil { @@ -1592,7 +1614,7 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv ss.mu.Unlock() } - if len(shs) != 0 { + if sh != nil { end := &stats.End{ BeginTime: statsBegin.BeginTime, EndTime: time.Now(), @@ -1600,9 +1622,7 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv if err != nil && err != io.EOF { end.Error = toRPCErr(err) } - for _, sh := range shs { - sh.HandleRPC(ctx, end) - } + sh.HandleRPC(ctx, end) } if channelz.IsOn() { @@ -1745,6 +1765,24 @@ func (s *Server) processStreamingRPC(ctx context.Context, stream *transport.Serv return ss.s.WriteStatus(statusOK) } +func (s *Server) handleMalformedMethodName(stream *transport.ServerStream, ti *traceInfo) { + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"Malformed method name %q", []any{stream.Method()}}, true) + ti.tr.SetError() + } + errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) + if err := stream.WriteStatus(status.New(codes.Unimplemented, errDesc)); err != nil { + if ti != nil { + ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) + ti.tr.SetError() + } + channelz.Warningf(logger, s.channelz, "grpc: Server.handleStream failed to write status: %v", err) + } + if ti != nil { + ti.tr.Finish() + } +} + func (s *Server) handleStream(t transport.ServerTransport, stream *transport.ServerStream) { ctx := stream.Context() ctx = contextWithServer(ctx, s) @@ -1765,45 +1803,47 @@ func (s *Server) handleStream(t transport.ServerTransport, stream *transport.Ser } sm := stream.Method() - if sm != "" && sm[0] == '/' { + if sm == "" { + s.handleMalformedMethodName(stream, ti) + return + } + if sm[0] != '/' { + // TODO(easwars): Add a link to the CVE in the below log messages once + // published. + if envconfig.DisableStrictPathChecking { + if old := s.strictPathCheckingLogEmitted.Swap(true); !old { + channelz.Warningf(logger, s.channelz, "grpc: Server.handleStream received malformed method name %q. Allowing it because the environment variable GRPC_GO_EXPERIMENTAL_DISABLE_STRICT_PATH_CHECKING is set to true, but this option will be removed in a future release.", sm) + } + } else { + if old := s.strictPathCheckingLogEmitted.Swap(true); !old { + channelz.Warningf(logger, s.channelz, "grpc: Server.handleStream rejected malformed method name %q. To temporarily allow such requests, set the environment variable GRPC_GO_EXPERIMENTAL_DISABLE_STRICT_PATH_CHECKING to true. Note that this is not recommended as it may allow requests to bypass security policies.", sm) + } + s.handleMalformedMethodName(stream, ti) + return + } + } else { sm = sm[1:] } pos := strings.LastIndex(sm, "/") if pos == -1 { - if ti != nil { - ti.tr.LazyLog(&fmtStringer{"Malformed method name %q", []any{sm}}, true) - ti.tr.SetError() - } - errDesc := fmt.Sprintf("malformed method name: %q", stream.Method()) - if err := stream.WriteStatus(status.New(codes.Unimplemented, errDesc)); err != nil { - if ti != nil { - ti.tr.LazyLog(&fmtStringer{"%v", []any{err}}, true) - ti.tr.SetError() - } - channelz.Warningf(logger, s.channelz, "grpc: Server.handleStream failed to write status: %v", err) - } - if ti != nil { - ti.tr.Finish() - } + s.handleMalformedMethodName(stream, ti) return } service := sm[:pos] method := sm[pos+1:] // FromIncomingContext is expensive: skip if there are no statsHandlers - if len(s.opts.statsHandlers) > 0 { + if s.statsHandler != nil { md, _ := metadata.FromIncomingContext(ctx) - for _, sh := range s.opts.statsHandlers { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: stream.Method()}) - sh.HandleRPC(ctx, &stats.InHeader{ - FullMethod: stream.Method(), - RemoteAddr: t.Peer().Addr, - LocalAddr: t.Peer().LocalAddr, - Compression: stream.RecvCompress(), - WireLength: stream.HeaderWireLength(), - Header: md, - }) - } + ctx = s.statsHandler.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: stream.Method()}) + s.statsHandler.HandleRPC(ctx, &stats.InHeader{ + FullMethod: stream.Method(), + RemoteAddr: t.Peer().Addr, + LocalAddr: t.Peer().LocalAddr, + Compression: stream.RecvCompress(), + WireLength: stream.HeaderWireLength(), + Header: md, + }) } // To have calls in stream callouts work. Will delete once all stats handler // calls come from the gRPC layer. diff --git a/vendor/google.golang.org/grpc/stats/handlers.go b/vendor/google.golang.org/grpc/stats/handlers.go index dc03731e45..67194a592f 100644 --- a/vendor/google.golang.org/grpc/stats/handlers.go +++ b/vendor/google.golang.org/grpc/stats/handlers.go @@ -38,6 +38,15 @@ type RPCTagInfo struct { // FailFast indicates if this RPC is failfast. // This field is only valid on client side, it's always false on server side. FailFast bool + // NameResolutionDelay indicates if the RPC needed to wait for the + // initial name resolver update before it could begin. This should only + // happen if the channel is IDLE when the RPC is started. Note that + // all retry or hedging attempts for an RPC that experienced a delay + // will have it set. + // + // This field is only valid on the client side; it is always false on + // the server side. + NameResolutionDelay bool } // Handler defines the interface for the related stats handling (e.g., RPCs, connections). diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go index baf7740efb..10bf998aa5 100644 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ b/vendor/google.golang.org/grpc/stats/stats.go @@ -64,15 +64,21 @@ func (s *Begin) IsClient() bool { return s.Client } func (s *Begin) isRPCStats() {} -// PickerUpdated indicates that the LB policy provided a new picker while the -// RPC was waiting for one. -type PickerUpdated struct{} +// DelayedPickComplete indicates that the RPC is unblocked following a delay in +// selecting a connection for the call. +type DelayedPickComplete struct{} -// IsClient indicates if the stats information is from client side. Only Client -// Side interfaces with a Picker, thus always returns true. -func (*PickerUpdated) IsClient() bool { return true } +// IsClient indicates DelayedPickComplete is available on the client. +func (*DelayedPickComplete) IsClient() bool { return true } -func (*PickerUpdated) isRPCStats() {} +func (*DelayedPickComplete) isRPCStats() {} + +// PickerUpdated indicates that the RPC is unblocked following a delay in +// selecting a connection for the call. +// +// Deprecated: will be removed in a future release; use DelayedPickComplete +// instead. +type PickerUpdated = DelayedPickComplete // InPayload contains stats about an incoming payload. type InPayload struct { diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go index 12163150ba..eedb5f9b99 100644 --- a/vendor/google.golang.org/grpc/stream.go +++ b/vendor/google.golang.org/grpc/stream.go @@ -25,6 +25,7 @@ import ( "math" rand "math/rand/v2" "strconv" + "strings" "sync" "time" @@ -51,7 +52,8 @@ import ( var metadataFromOutgoingContextRaw = internal.FromOutgoingContextRaw.(func(context.Context) (metadata.MD, [][]string, bool)) // StreamHandler defines the handler called by gRPC server to complete the -// execution of a streaming RPC. +// execution of a streaming RPC. srv is the service implementation on which the +// RPC was invoked. // // If a StreamHandler returns an error, it should either be produced by the // status package, or be one of the context errors. Otherwise, gRPC will use @@ -101,9 +103,9 @@ type ClientStream interface { // It must only be called after stream.CloseAndRecv has returned, or // stream.Recv has returned a non-nil error (including io.EOF). Trailer() metadata.MD - // CloseSend closes the send direction of the stream. It closes the stream - // when non-nil error is met. It is also not safe to call CloseSend - // concurrently with SendMsg. + // CloseSend closes the send direction of the stream. This method always + // returns a nil error. The status of the stream may be discovered using + // RecvMsg. It is also not safe to call CloseSend concurrently with SendMsg. CloseSend() error // Context returns the context for this stream. // @@ -177,13 +179,43 @@ func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth return cc.NewStream(ctx, desc, method, opts...) } +var emptyMethodConfig = serviceconfig.MethodConfig{} + +// endOfClientStream performs cleanup actions required for both successful and +// failed streams. This includes incrementing channelz stats and invoking all +// registered OnFinish call options. +func endOfClientStream(cc *ClientConn, err error, opts ...CallOption) { + if channelz.IsOn() { + if err != nil { + cc.incrCallsFailed() + } else { + cc.incrCallsSucceeded() + } + } + + for _, o := range opts { + if o, ok := o.(OnFinishCallOption); ok { + o.OnFinish(err) + } + } +} + func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) { + if channelz.IsOn() { + cc.incrCallsStarted() + } + defer func() { + if err != nil { + // Ensure cleanup when stream creation fails. + endOfClientStream(cc, err, opts...) + } + }() + // Start tracking the RPC for idleness purposes. This is where a stream is // created for both streaming and unary RPCs, and hence is a good place to // track active RPC count. - if err := cc.idlenessMgr.OnCallBegin(); err != nil { - return nil, err - } + cc.idlenessMgr.OnCallBegin() + // Add a calloption, to decrement the active call count, that gets executed // when the RPC completes. opts = append([]CallOption{OnFinish(func(error) { cc.idlenessMgr.OnCallEnd() })}, opts...) @@ -202,24 +234,17 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth } } } - if channelz.IsOn() { - cc.incrCallsStarted() - defer func() { - if err != nil { - cc.incrCallsFailed() - } - }() - } // Provide an opportunity for the first RPC to see the first service config // provided by the resolver. - if err := cc.waitForResolvedAddrs(ctx); err != nil { + nameResolutionDelayed, err := cc.waitForResolvedAddrs(ctx) + if err != nil { return nil, err } - var mc serviceconfig.MethodConfig + mc := &emptyMethodConfig var onCommit func() newStream := func(ctx context.Context, done func()) (iresolver.ClientStream, error) { - return newClientStreamWithParams(ctx, desc, cc, method, mc, onCommit, done, opts...) + return newClientStreamWithParams(ctx, desc, cc, method, mc, onCommit, done, nameResolutionDelayed, opts...) } rpcInfo := iresolver.RPCInfo{Context: ctx, Method: method} @@ -239,7 +264,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth if rpcConfig.Context != nil { ctx = rpcConfig.Context } - mc = rpcConfig.MethodConfig + mc = &rpcConfig.MethodConfig onCommit = rpcConfig.OnCommitted if rpcConfig.Interceptor != nil { rpcInfo.Context = nil @@ -257,7 +282,7 @@ func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, meth return newStream(ctx, func() {}) } -func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, mc serviceconfig.MethodConfig, onCommit, doneFunc func(), opts ...CallOption) (_ iresolver.ClientStream, err error) { +func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, mc *serviceconfig.MethodConfig, onCommit, doneFunc func(), nameResolutionDelayed bool, opts ...CallOption) (_ iresolver.ClientStream, err error) { callInfo := defaultCallInfo() if mc.WaitForReady != nil { callInfo.failFast = !*mc.WaitForReady @@ -296,6 +321,11 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client Method: method, ContentSubtype: callInfo.contentSubtype, DoneFunc: doneFunc, + Authority: callInfo.authority, + } + if allowed := callInfo.acceptedResponseCompressors; len(allowed) > 0 { + headerValue := strings.Join(allowed, ",") + callHdr.AcceptedCompressors = &headerValue } // Set our outgoing compression according to the UseCompressor CallOption, if @@ -321,19 +351,20 @@ func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *Client } cs := &clientStream{ - callHdr: callHdr, - ctx: ctx, - methodConfig: &mc, - opts: opts, - callInfo: callInfo, - cc: cc, - desc: desc, - codec: callInfo.codec, - compressorV0: compressorV0, - compressorV1: compressorV1, - cancel: cancel, - firstAttempt: true, - onCommit: onCommit, + callHdr: callHdr, + ctx: ctx, + methodConfig: mc, + opts: opts, + callInfo: callInfo, + cc: cc, + desc: desc, + codec: callInfo.codec, + compressorV0: compressorV0, + compressorV1: compressorV1, + cancel: cancel, + firstAttempt: true, + onCommit: onCommit, + nameResolutionDelay: nameResolutionDelayed, } if !cc.dopts.disableRetry { cs.retryThrottler = cc.retryThrottler.Load().(*retryThrottler) @@ -415,19 +446,21 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error) ctx := newContextWithRPCInfo(cs.ctx, cs.callInfo.failFast, cs.callInfo.codec, cs.compressorV0, cs.compressorV1) method := cs.callHdr.Method var beginTime time.Time - shs := cs.cc.dopts.copts.StatsHandlers - for _, sh := range shs { - ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{FullMethodName: method, FailFast: cs.callInfo.failFast}) + sh := cs.cc.statsHandler + if sh != nil { beginTime = time.Now() - begin := &stats.Begin{ + ctx = sh.TagRPC(ctx, &stats.RPCTagInfo{ + FullMethodName: method, FailFast: cs.callInfo.failFast, + NameResolutionDelay: cs.nameResolutionDelay, + }) + sh.HandleRPC(ctx, &stats.Begin{ Client: true, BeginTime: beginTime, FailFast: cs.callInfo.failFast, IsClientStream: cs.desc.ClientStreams, IsServerStream: cs.desc.ServerStreams, IsTransparentRetryAttempt: isTransparent, - } - sh.HandleRPC(ctx, begin) + }) } var trInfo *traceInfo @@ -458,7 +491,7 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error) beginTime: beginTime, cs: cs, decompressorV0: cs.cc.dopts.dc, - statsHandlers: shs, + statsHandler: sh, trInfo: trInfo, }, nil } @@ -466,8 +499,9 @@ func (cs *clientStream) newAttemptLocked(isTransparent bool) (*csAttempt, error) func (a *csAttempt) getTransport() error { cs := a.cs - var err error - a.transport, a.pickResult, err = cs.cc.getTransport(a.ctx, cs.callInfo.failFast, cs.callHdr.Method) + pickInfo := balancer.PickInfo{Ctx: a.ctx, FullMethodName: cs.callHdr.Method} + pick, err := cs.cc.pickerWrapper.pick(a.ctx, cs.callInfo.failFast, pickInfo) + a.transport, a.pickResult = pick.transport, pick.result if err != nil { if de, ok := err.(dropError); ok { err = de.error @@ -476,7 +510,10 @@ func (a *csAttempt) getTransport() error { return err } if a.trInfo != nil { - a.trInfo.firstLine.SetRemoteAddr(a.transport.RemoteAddr()) + a.trInfo.firstLine.SetRemoteAddr(a.transport.Peer().Addr) + } + if pick.blocked && a.statsHandler != nil { + a.statsHandler.HandleRPC(a.ctx, &stats.DelayedPickComplete{}) } return nil } @@ -501,9 +538,17 @@ func (a *csAttempt) newStream() error { md, _ := metadata.FromOutgoingContext(a.ctx) md = metadata.Join(md, a.pickResult.Metadata) a.ctx = metadata.NewOutgoingContext(a.ctx, md) - } - s, err := a.transport.NewStream(a.ctx, cs.callHdr) + // If the `CallAuthority` CallOption is not set, check if the LB picker + // has provided an authority override in the PickResult metadata and + // apply it, as specified in gRFC A81. + if cs.callInfo.authority == "" { + if authMD := a.pickResult.Metadata.Get(":authority"); len(authMD) > 0 { + cs.callHdr.Authority = authMD[0] + } + } + } + s, err := a.transport.NewStream(a.ctx, cs.callHdr, a.statsHandler) if err != nil { nse, ok := err.(*transport.NewStreamError) if !ok { @@ -520,7 +565,7 @@ func (a *csAttempt) newStream() error { } a.transportStream = s a.ctx = s.Context() - a.parser = &parser{r: s, bufferPool: a.cs.cc.dopts.copts.BufferPool} + a.parser = parser{r: s, bufferPool: a.cs.cc.dopts.copts.BufferPool} return nil } @@ -540,6 +585,8 @@ type clientStream struct { sentLast bool // sent an end stream + receivedFirstMsg bool // set after the first message is received + methodConfig *MethodConfig ctx context.Context // the application's context, wrapped by stats/tracing @@ -573,6 +620,9 @@ type clientStream struct { onCommit func() replayBuffer []replayOp // operations to replay on retry replayBufferSize int // current size of replayBuffer + // nameResolutionDelay indicates if there was a delay in the name resolution. + // This field is only valid on client side, it's always false on server side. + nameResolutionDelay bool } type replayOp struct { @@ -587,7 +637,7 @@ type csAttempt struct { cs *clientStream transport transport.ClientTransport transportStream *transport.ClientStream - parser *parser + parser parser pickResult balancer.PickResult finished bool @@ -601,8 +651,8 @@ type csAttempt struct { // and cleared when the finish method is called. trInfo *traceInfo - statsHandlers []stats.Handler - beginTime time.Time + statsHandler stats.Handler + beginTime time.Time // set for newStream errors that may be transparently retried allowTransparentRetry bool @@ -987,7 +1037,7 @@ func (cs *clientStream) RecvMsg(m any) error { func (cs *clientStream) CloseSend() error { if cs.sentLast { - // TODO: return an error and finish the stream instead, due to API misuse? + // Return a nil error on repeated calls to this method. return nil } cs.sentLast = true @@ -1008,7 +1058,10 @@ func (cs *clientStream) CloseSend() error { binlog.Log(cs.ctx, chc) } } - // We never returned an error here for reasons. + // We don't return an error here as we expect users to read all messages + // from the stream and get the RPC status from RecvMsg(). Note that + // SendMsg() must return an error when one occurs so the application + // knows to stop sending messages, but that does not apply here. return nil } @@ -1023,9 +1076,6 @@ func (cs *clientStream) finish(err error) { return } cs.finished = true - for _, onFinish := range cs.callInfo.onFinish { - onFinish(err) - } cs.commitAttemptLocked() if cs.attempt != nil { cs.attempt.finish(err) @@ -1065,13 +1115,7 @@ func (cs *clientStream) finish(err error) { if err == nil { cs.retryThrottler.successfulRPC() } - if channelz.IsOn() { - if err != nil { - cs.cc.incrCallsFailed() - } else { - cs.cc.incrCallsSucceeded() - } - } + endOfClientStream(cs.cc, err, cs.opts...) cs.cancel() } @@ -1093,17 +1137,15 @@ func (a *csAttempt) sendMsg(m any, hdr []byte, payld mem.BufferSlice, dataLength } return io.EOF } - if len(a.statsHandlers) != 0 { - for _, sh := range a.statsHandlers { - sh.HandleRPC(a.ctx, outPayload(true, m, dataLength, payloadLength, time.Now())) - } + if a.statsHandler != nil { + a.statsHandler.HandleRPC(a.ctx, outPayload(true, m, dataLength, payloadLength, time.Now())) } return nil } func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { cs := a.cs - if len(a.statsHandlers) != 0 && payInfo == nil { + if a.statsHandler != nil && payInfo == nil { payInfo = &payloadInfo{} defer payInfo.free() } @@ -1117,6 +1159,10 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { a.decompressorV0 = nil a.decompressorV1 = encoding.GetCompressor(ct) } + // Validate that the compression method is acceptable for this call. + if !acceptedCompressorAllows(cs.callInfo.acceptedResponseCompressors, ct) { + return status.Errorf(codes.Internal, "grpc: peer compressed the response with %q which is not allowed by AcceptCompressors", ct) + } } else { // No compression is used; disable our decompressor. a.decompressorV0 = nil @@ -1124,16 +1170,21 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { // Only initialize this state once per stream. a.decompressorSet = true } - if err := recv(a.parser, cs.codec, a.transportStream, a.decompressorV0, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decompressorV1, false); err != nil { + if err := recv(&a.parser, cs.codec, a.transportStream, a.decompressorV0, m, *cs.callInfo.maxReceiveMessageSize, payInfo, a.decompressorV1, false); err != nil { if err == io.EOF { if statusErr := a.transportStream.Status().Err(); statusErr != nil { return statusErr } + // Received no msg and status OK for non-server streaming rpcs. + if !cs.desc.ServerStreams && !cs.receivedFirstMsg { + return status.Error(codes.Internal, "cardinality violation: received no response message from non-server-streaming RPC") + } return io.EOF // indicates successful end of stream. } return toRPCErr(err) } + cs.receivedFirstMsg = true if a.trInfo != nil { a.mu.Lock() if a.trInfo.tr != nil { @@ -1141,8 +1192,8 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { } a.mu.Unlock() } - for _, sh := range a.statsHandlers { - sh.HandleRPC(a.ctx, &stats.InPayload{ + if a.statsHandler != nil { + a.statsHandler.HandleRPC(a.ctx, &stats.InPayload{ Client: true, RecvTime: time.Now(), Payload: m, @@ -1157,12 +1208,12 @@ func (a *csAttempt) recvMsg(m any, payInfo *payloadInfo) (err error) { } // Special handling for non-server-stream rpcs. // This recv expects EOF or errors, so we don't collect inPayload. - if err := recv(a.parser, cs.codec, a.transportStream, a.decompressorV0, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decompressorV1, false); err == io.EOF { + if err := recv(&a.parser, cs.codec, a.transportStream, a.decompressorV0, m, *cs.callInfo.maxReceiveMessageSize, nil, a.decompressorV1, false); err == io.EOF { return a.transportStream.Status().Err() // non-server streaming Recv returns nil on success } else if err != nil { return toRPCErr(err) } - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) + return status.Error(codes.Internal, "cardinality violation: expected for non server-streaming RPCs, but received another message") } func (a *csAttempt) finish(err error) { @@ -1195,15 +1246,14 @@ func (a *csAttempt) finish(err error) { ServerLoad: balancerload.Parse(tr), }) } - for _, sh := range a.statsHandlers { - end := &stats.End{ + if a.statsHandler != nil { + a.statsHandler.HandleRPC(a.ctx, &stats.End{ Client: true, BeginTime: a.beginTime, EndTime: time.Now(), Trailer: tr, Error: err, - } - sh.HandleRPC(a.ctx, end) + }) } if a.trInfo != nil && a.trInfo.tr != nil { if err == nil { @@ -1300,16 +1350,18 @@ func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method strin codec: c.codec, sendCompressorV0: cp, sendCompressorV1: comp, + decompressorV0: ac.cc.dopts.dc, transport: t, } - s, err := as.transport.NewStream(as.ctx, as.callHdr) + // nil stats handler: internal streams like health and ORCA do not support telemetry. + s, err := as.transport.NewStream(as.ctx, as.callHdr, nil) if err != nil { err = toRPCErr(err) return nil, err } as.transportStream = s - as.parser = &parser{r: s, bufferPool: ac.dopts.copts.BufferPool} + as.parser = parser{r: s, bufferPool: ac.dopts.copts.BufferPool} ac.incrCallsStarted() if desc != unaryStreamDesc { // Listen on stream context to cleanup when the stream context is @@ -1344,6 +1396,7 @@ type addrConnStream struct { transport transport.ClientTransport ctx context.Context sentLast bool + receivedFirstMsg bool desc *StreamDesc codec baseCodec sendCompressorV0 Compressor @@ -1351,7 +1404,7 @@ type addrConnStream struct { decompressorSet bool decompressorV0 Decompressor decompressorV1 encoding.Compressor - parser *parser + parser parser // mu guards finished and is held for the entire finish method. mu sync.Mutex @@ -1372,7 +1425,7 @@ func (as *addrConnStream) Trailer() metadata.MD { func (as *addrConnStream) CloseSend() error { if as.sentLast { - // TODO: return an error and finish the stream instead, due to API misuse? + // Return a nil error on repeated calls to this method. return nil } as.sentLast = true @@ -1457,6 +1510,10 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { as.decompressorV0 = nil as.decompressorV1 = encoding.GetCompressor(ct) } + // Validate that the compression method is acceptable for this call. + if !acceptedCompressorAllows(as.callInfo.acceptedResponseCompressors, ct) { + return status.Errorf(codes.Internal, "grpc: peer compressed the response with %q which is not allowed by AcceptCompressors", ct) + } } else { // No compression is used; disable our decompressor. as.decompressorV0 = nil @@ -1464,15 +1521,20 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { // Only initialize this state once per stream. as.decompressorSet = true } - if err := recv(as.parser, as.codec, as.transportStream, as.decompressorV0, m, *as.callInfo.maxReceiveMessageSize, nil, as.decompressorV1, false); err != nil { + if err := recv(&as.parser, as.codec, as.transportStream, as.decompressorV0, m, *as.callInfo.maxReceiveMessageSize, nil, as.decompressorV1, false); err != nil { if err == io.EOF { if statusErr := as.transportStream.Status().Err(); statusErr != nil { return statusErr } + // Received no msg and status OK for non-server streaming rpcs. + if !as.desc.ServerStreams && !as.receivedFirstMsg { + return status.Error(codes.Internal, "cardinality violation: received no response message from non-server-streaming RPC") + } return io.EOF // indicates successful end of stream. } return toRPCErr(err) } + as.receivedFirstMsg = true if as.desc.ServerStreams { // Subsequent messages should be received by subsequent RecvMsg calls. @@ -1481,12 +1543,12 @@ func (as *addrConnStream) RecvMsg(m any) (err error) { // Special handling for non-server-stream rpcs. // This recv expects EOF or errors, so we don't collect inPayload. - if err := recv(as.parser, as.codec, as.transportStream, as.decompressorV0, m, *as.callInfo.maxReceiveMessageSize, nil, as.decompressorV1, false); err == io.EOF { + if err := recv(&as.parser, as.codec, as.transportStream, as.decompressorV0, m, *as.callInfo.maxReceiveMessageSize, nil, as.decompressorV1, false); err == io.EOF { return as.transportStream.Status().Err() // non-server streaming Recv returns nil on success } else if err != nil { return toRPCErr(err) } - return toRPCErr(errors.New("grpc: client streaming protocol violation: get , want ")) + return status.Error(codes.Internal, "cardinality violation: expected for non server-streaming RPCs, but received another message") } func (as *addrConnStream) finish(err error) { @@ -1569,8 +1631,9 @@ type ServerStream interface { type serverStream struct { ctx context.Context s *transport.ServerStream - p *parser + p parser codec baseCodec + desc *StreamDesc compressorV0 Compressor compressorV1 encoding.Compressor @@ -1579,11 +1642,13 @@ type serverStream struct { sendCompressorName string + recvFirstMsg bool // set after the first message is received + maxReceiveMessageSize int maxSendMessageSize int trInfo *traceInfo - statsHandler []stats.Handler + statsHandler stats.Handler binlogs []binarylog.MethodLogger // serverHeaderBinlogged indicates whether server header has been logged. It @@ -1719,10 +1784,8 @@ func (ss *serverStream) SendMsg(m any) (err error) { binlog.Log(ss.ctx, sm) } } - if len(ss.statsHandler) != 0 { - for _, sh := range ss.statsHandler { - sh.HandleRPC(ss.s.Context(), outPayload(false, m, dataLen, payloadLen, time.Now())) - } + if ss.statsHandler != nil { + ss.statsHandler.HandleRPC(ss.s.Context(), outPayload(false, m, dataLen, payloadLen, time.Now())) } return nil } @@ -1753,11 +1816,11 @@ func (ss *serverStream) RecvMsg(m any) (err error) { } }() var payInfo *payloadInfo - if len(ss.statsHandler) != 0 || len(ss.binlogs) != 0 { + if ss.statsHandler != nil || len(ss.binlogs) != 0 { payInfo = &payloadInfo{} defer payInfo.free() } - if err := recv(ss.p, ss.codec, ss.s, ss.decompressorV0, m, ss.maxReceiveMessageSize, payInfo, ss.decompressorV1, true); err != nil { + if err := recv(&ss.p, ss.codec, ss.s, ss.decompressorV0, m, ss.maxReceiveMessageSize, payInfo, ss.decompressorV1, true); err != nil { if err == io.EOF { if len(ss.binlogs) != 0 { chc := &binarylog.ClientHalfClose{} @@ -1765,6 +1828,10 @@ func (ss *serverStream) RecvMsg(m any) (err error) { binlog.Log(ss.ctx, chc) } } + // Received no request msg for non-client streaming rpcs. + if !ss.desc.ClientStreams && !ss.recvFirstMsg { + return status.Error(codes.Internal, "cardinality violation: received no request message from non-client-streaming RPC") + } return err } if err == io.ErrUnexpectedEOF { @@ -1772,16 +1839,15 @@ func (ss *serverStream) RecvMsg(m any) (err error) { } return toRPCErr(err) } - if len(ss.statsHandler) != 0 { - for _, sh := range ss.statsHandler { - sh.HandleRPC(ss.s.Context(), &stats.InPayload{ - RecvTime: time.Now(), - Payload: m, - Length: payInfo.uncompressedBytes.Len(), - WireLength: payInfo.compressedLength + headerLen, - CompressedLength: payInfo.compressedLength, - }) - } + ss.recvFirstMsg = true + if ss.statsHandler != nil { + ss.statsHandler.HandleRPC(ss.s.Context(), &stats.InPayload{ + RecvTime: time.Now(), + Payload: m, + Length: payInfo.uncompressedBytes.Len(), + WireLength: payInfo.compressedLength + headerLen, + CompressedLength: payInfo.compressedLength, + }) } if len(ss.binlogs) != 0 { cm := &binarylog.ClientMessage{ @@ -1791,7 +1857,19 @@ func (ss *serverStream) RecvMsg(m any) (err error) { binlog.Log(ss.ctx, cm) } } - return nil + + if ss.desc.ClientStreams { + // Subsequent messages should be received by subsequent RecvMsg calls. + return nil + } + // Special handling for non-client-stream rpcs. + // This recv expects EOF or errors, so we don't collect inPayload. + if err := recv(&ss.p, ss.codec, ss.s, ss.decompressorV0, m, ss.maxReceiveMessageSize, nil, ss.decompressorV1, true); err == io.EOF { + return nil + } else if err != nil { + return err + } + return status.Error(codes.Internal, "cardinality violation: received multiple request messages for non-client-streaming RPC") } // MethodFromServerStream returns the method string for the input stream. diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go index 2bae4db890..76c2eed773 100644 --- a/vendor/google.golang.org/grpc/version.go +++ b/vendor/google.golang.org/grpc/version.go @@ -19,4 +19,4 @@ package grpc // Version is the current grpc version. -const Version = "1.72.2" +const Version = "1.79.3" diff --git a/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go index bf1aba0e85..7b9f01afb0 100644 --- a/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go +++ b/vendor/google.golang.org/protobuf/internal/editionssupport/editions.go @@ -9,7 +9,7 @@ import "google.golang.org/protobuf/types/descriptorpb" const ( Minimum = descriptorpb.Edition_EDITION_PROTO2 - Maximum = descriptorpb.Edition_EDITION_2023 + Maximum = descriptorpb.Edition_EDITION_2024 // MaximumKnown is the maximum edition that is known to Go Protobuf, but not // declared as supported. In other words: end users cannot use it, but diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index 688aabe434..dbcf90b871 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -72,9 +72,10 @@ type ( EditionFeatures EditionFeatures } FileL2 struct { - Options func() protoreflect.ProtoMessage - Imports FileImports - Locations SourceLocations + Options func() protoreflect.ProtoMessage + Imports FileImports + OptionImports func() protoreflect.FileImports + Locations SourceLocations } // EditionFeatures is a frequently-instantiated struct, so please take care @@ -126,12 +127,9 @@ func (fd *File) ParentFile() protoreflect.FileDescriptor { return fd } func (fd *File) Parent() protoreflect.Descriptor { return nil } func (fd *File) Index() int { return 0 } func (fd *File) Syntax() protoreflect.Syntax { return fd.L1.Syntax } - -// Not exported and just used to reconstruct the original FileDescriptor proto -func (fd *File) Edition() int32 { return int32(fd.L1.Edition) } -func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() } -func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package } -func (fd *File) IsPlaceholder() bool { return false } +func (fd *File) Name() protoreflect.Name { return fd.L1.Package.Name() } +func (fd *File) FullName() protoreflect.FullName { return fd.L1.Package } +func (fd *File) IsPlaceholder() bool { return false } func (fd *File) Options() protoreflect.ProtoMessage { if f := fd.lazyInit().Options; f != nil { return f() @@ -150,6 +148,16 @@ func (fd *File) Format(s fmt.State, r rune) { descfmt.FormatD func (fd *File) ProtoType(protoreflect.FileDescriptor) {} func (fd *File) ProtoInternal(pragma.DoNotImplement) {} +// The next two are not part of the FileDescriptor interface. They are just used to reconstruct +// the original FileDescriptor proto. +func (fd *File) Edition() int32 { return int32(fd.L1.Edition) } +func (fd *File) OptionImports() protoreflect.FileImports { + if f := fd.lazyInit().OptionImports; f != nil { + return f() + } + return emptyFiles +} + func (fd *File) lazyInit() *FileL2 { if atomic.LoadUint32(&fd.once) == 0 { fd.lazyInitOnce() @@ -182,9 +190,9 @@ type ( L2 *EnumL2 // protected by fileDesc.once } EnumL1 struct { - eagerValues bool // controls whether EnumL2.Values is already populated - EditionFeatures EditionFeatures + Visibility int32 + eagerValues bool // controls whether EnumL2.Values is already populated } EnumL2 struct { Options func() protoreflect.ProtoMessage @@ -219,6 +227,11 @@ func (ed *Enum) ReservedNames() protoreflect.Names { return &ed.lazyInit() func (ed *Enum) ReservedRanges() protoreflect.EnumRanges { return &ed.lazyInit().ReservedRanges } func (ed *Enum) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, ed) } func (ed *Enum) ProtoType(protoreflect.EnumDescriptor) {} + +// This is not part of the EnumDescriptor interface. It is just used to reconstruct +// the original FileDescriptor proto. +func (ed *Enum) Visibility() int32 { return ed.L1.Visibility } + func (ed *Enum) lazyInit() *EnumL2 { ed.L0.ParentFile.lazyInit() // implicitly initializes L2 return ed.L2 @@ -244,13 +257,13 @@ type ( L2 *MessageL2 // protected by fileDesc.once } MessageL1 struct { - Enums Enums - Messages Messages - Extensions Extensions - IsMapEntry bool // promoted from google.protobuf.MessageOptions - IsMessageSet bool // promoted from google.protobuf.MessageOptions - + Enums Enums + Messages Messages + Extensions Extensions EditionFeatures EditionFeatures + Visibility int32 + IsMapEntry bool // promoted from google.protobuf.MessageOptions + IsMessageSet bool // promoted from google.protobuf.MessageOptions } MessageL2 struct { Options func() protoreflect.ProtoMessage @@ -319,6 +332,11 @@ func (md *Message) Messages() protoreflect.MessageDescriptors { return &md.L func (md *Message) Extensions() protoreflect.ExtensionDescriptors { return &md.L1.Extensions } func (md *Message) ProtoType(protoreflect.MessageDescriptor) {} func (md *Message) Format(s fmt.State, r rune) { descfmt.FormatDesc(s, r, md) } + +// This is not part of the MessageDescriptor interface. It is just used to reconstruct +// the original FileDescriptor proto. +func (md *Message) Visibility() int32 { return md.L1.Visibility } + func (md *Message) lazyInit() *MessageL2 { md.L0.ParentFile.lazyInit() // implicitly initializes L2 return md.L2 diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go index d2f549497e..e91860f5a2 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go @@ -284,6 +284,13 @@ func (ed *Enum) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protorefl case genid.EnumDescriptorProto_Value_field_number: numValues++ } + case protowire.VarintType: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + switch num { + case genid.EnumDescriptorProto_Visibility_field_number: + ed.L1.Visibility = int32(v) + } default: m := protowire.ConsumeFieldValue(num, typ, b) b = b[m:] @@ -365,6 +372,13 @@ func (md *Message) unmarshalSeed(b []byte, sb *strs.Builder, pf *File, pd protor md.unmarshalSeedOptions(v) } prevField = num + case protowire.VarintType: + v, m := protowire.ConsumeVarint(b) + b = b[m:] + switch num { + case genid.DescriptorProto_Visibility_field_number: + md.L1.Visibility = int32(v) + } default: m := protowire.ConsumeFieldValue(num, typ, b) b = b[m:] diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go index d4c94458bd..dd31faaeb0 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -134,6 +134,7 @@ func (fd *File) unmarshalFull(b []byte) { var enumIdx, messageIdx, extensionIdx, serviceIdx int var rawOptions []byte + var optionImports []string fd.L2 = new(FileL2) for len(b) > 0 { num, typ, n := protowire.ConsumeTag(b) @@ -157,6 +158,8 @@ func (fd *File) unmarshalFull(b []byte) { imp = PlaceholderFile(path) } fd.L2.Imports = append(fd.L2.Imports, protoreflect.FileImport{FileDescriptor: imp}) + case genid.FileDescriptorProto_OptionDependency_field_number: + optionImports = append(optionImports, sb.MakeString(v)) case genid.FileDescriptorProto_EnumType_field_number: fd.L1.Enums.List[enumIdx].unmarshalFull(v, sb) enumIdx++ @@ -178,6 +181,23 @@ func (fd *File) unmarshalFull(b []byte) { } } fd.L2.Options = fd.builder.optionsUnmarshaler(&descopts.File, rawOptions) + if len(optionImports) > 0 { + var imps FileImports + var once sync.Once + fd.L2.OptionImports = func() protoreflect.FileImports { + once.Do(func() { + imps = make(FileImports, len(optionImports)) + for i, path := range optionImports { + imp, _ := fd.builder.FileRegistry.FindFileByPath(path) + if imp == nil { + imp = PlaceholderFile(path) + } + imps[i] = protoreflect.FileImport{FileDescriptor: imp} + } + }) + return &imps + } + } } func (ed *Enum) unmarshalFull(b []byte, sb *strs.Builder) { diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go index a0aad2777f..66ba906806 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/editions.go @@ -13,8 +13,10 @@ import ( "google.golang.org/protobuf/reflect/protoreflect" ) -var defaultsCache = make(map[Edition]EditionFeatures) -var defaultsKeys = []Edition{} +var ( + defaultsCache = make(map[Edition]EditionFeatures) + defaultsKeys = []Edition{} +) func init() { unmarshalEditionDefaults(editiondefaults.Defaults) @@ -41,7 +43,7 @@ func unmarshalGoFeature(b []byte, parent EditionFeatures) EditionFeatures { b = b[m:] parent.StripEnumPrefix = int(v) default: - panic(fmt.Sprintf("unkown field number %d while unmarshalling GoFeatures", num)) + panic(fmt.Sprintf("unknown field number %d while unmarshalling GoFeatures", num)) } } return parent @@ -76,7 +78,7 @@ func unmarshalFeatureSet(b []byte, parent EditionFeatures) EditionFeatures { // DefaultSymbolVisibility is enforced in protoc, runtimes should not // inspect this value. default: - panic(fmt.Sprintf("unkown field number %d while unmarshalling FeatureSet", num)) + panic(fmt.Sprintf("unknown field number %d while unmarshalling FeatureSet", num)) } case protowire.BytesType: v, m := protowire.ConsumeBytes(b) @@ -150,7 +152,7 @@ func unmarshalEditionDefaults(b []byte) { _, m := protowire.ConsumeVarint(b) b = b[m:] default: - panic(fmt.Sprintf("unkown field number %d while unmarshalling EditionDefault", num)) + panic(fmt.Sprintf("unknown field number %d while unmarshalling EditionDefault", num)) } } } diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index 697d1c14f3..77de0f238c 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -52,7 +52,7 @@ import ( const ( Major = 1 Minor = 36 - Patch = 8 + Patch = 10 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go index 823dbf3ba6..9196288e4a 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go @@ -152,6 +152,28 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot imp := &f.L2.Imports[i] imps.importPublic(imp.Imports()) } + if len(fd.GetOptionDependency()) > 0 { + optionImports := make(filedesc.FileImports, len(fd.GetOptionDependency())) + for i, path := range fd.GetOptionDependency() { + imp := &optionImports[i] + f, err := r.FindFileByPath(path) + if err == protoregistry.NotFound { + // We always allow option imports to be unresolvable. + f = filedesc.PlaceholderFile(path) + } else if err != nil { + return nil, errors.New("could not resolve import %q: %v", path, err) + } + imp.FileDescriptor = f + + if imps[imp.Path()] { + return nil, errors.New("already imported %q", path) + } + imps[imp.Path()] = true + } + f.L2.OptionImports = func() protoreflect.FileImports { + return &optionImports + } + } // Handle source locations. f.L2.Locations.File = f diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go index 9da34998b1..c826ad0430 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go @@ -29,6 +29,7 @@ func (r descsByName) initEnumDeclarations(eds []*descriptorpb.EnumDescriptorProt e.L2.Options = func() protoreflect.ProtoMessage { return opts } } e.L1.EditionFeatures = mergeEditionFeatures(parent, ed.GetOptions().GetFeatures()) + e.L1.Visibility = int32(ed.GetVisibility()) for _, s := range ed.GetReservedName() { e.L2.ReservedNames.List = append(e.L2.ReservedNames.List, protoreflect.Name(s)) } @@ -70,6 +71,7 @@ func (r descsByName) initMessagesDeclarations(mds []*descriptorpb.DescriptorProt return nil, err } m.L1.EditionFeatures = mergeEditionFeatures(parent, md.GetOptions().GetFeatures()) + m.L1.Visibility = int32(md.GetVisibility()) if opts := md.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.MessageOptions) m.L2.Options = func() protoreflect.ProtoMessage { return opts } diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go index 9b880aa8c9..6f91074e36 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go @@ -70,16 +70,27 @@ func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileD if syntax := file.Syntax(); syntax != protoreflect.Proto2 && syntax.IsValid() { p.Syntax = proto.String(file.Syntax().String()) } + desc := file + if fileImportDesc, ok := file.(protoreflect.FileImport); ok { + desc = fileImportDesc.FileDescriptor + } if file.Syntax() == protoreflect.Editions { - desc := file - if fileImportDesc, ok := file.(protoreflect.FileImport); ok { - desc = fileImportDesc.FileDescriptor - } - if editionsInterface, ok := desc.(interface{ Edition() int32 }); ok { p.Edition = descriptorpb.Edition(editionsInterface.Edition()).Enum() } } + type hasOptionImports interface { + OptionImports() protoreflect.FileImports + } + if opts, ok := desc.(hasOptionImports); ok { + if optionImports := opts.OptionImports(); optionImports.Len() > 0 { + optionDeps := make([]string, optionImports.Len()) + for i := range optionImports.Len() { + optionDeps[i] = optionImports.Get(i).Path() + } + p.OptionDependency = optionDeps + } + } return p } @@ -123,6 +134,14 @@ func ToDescriptorProto(message protoreflect.MessageDescriptor) *descriptorpb.Des for i, names := 0, message.ReservedNames(); i < names.Len(); i++ { p.ReservedName = append(p.ReservedName, string(names.Get(i))) } + type hasVisibility interface { + Visibility() int32 + } + if vis, ok := message.(hasVisibility); ok { + if visibility := vis.Visibility(); visibility > 0 { + p.Visibility = descriptorpb.SymbolVisibility(visibility).Enum() + } + } return p } @@ -216,6 +235,14 @@ func ToEnumDescriptorProto(enum protoreflect.EnumDescriptor) *descriptorpb.EnumD for i, names := 0, enum.ReservedNames(); i < names.Len(); i++ { p.ReservedName = append(p.ReservedName, string(names.Get(i))) } + type hasVisibility interface { + Visibility() int32 + } + if vis, ok := enum.(hasVisibility); ok { + if visibility := vis.Visibility(); visibility > 0 { + p.Visibility = descriptorpb.SymbolVisibility(visibility).Enum() + } + } return p } diff --git a/vendor/modules.txt b/vendor/modules.txt index 9d2ef5b625..c0512c9b1f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,6 +1,6 @@ ## workspace -# cel.dev/expr v0.24.0 -## explicit; go 1.22.0 +# cel.dev/expr v0.25.1 +## explicit; go 1.23.0 cel.dev/expr # cloud.google.com/go/auth v0.9.5 ## explicit; go 1.21 @@ -20,8 +20,8 @@ cloud.google.com/go/auth/internal/transport/cert # cloud.google.com/go/auth/oauth2adapt v0.2.4 ## explicit; go 1.20 cloud.google.com/go/auth/oauth2adapt -# cloud.google.com/go/compute/metadata v0.6.0 -## explicit; go 1.21 +# cloud.google.com/go/compute/metadata v0.9.0 +## explicit; go 1.24.0 cloud.google.com/go/compute/metadata # github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 ## explicit; go 1.16 @@ -237,7 +237,7 @@ github.com/gorilla/websocket # github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 ## explicit github.com/grpc-ecosystem/go-grpc-prometheus -# github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 +# github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 ## explicit; go 1.23.0 github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options @@ -499,8 +499,8 @@ go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded go.opentelemetry.io/otel/trace/internal/telemetry go.opentelemetry.io/otel/trace/noop -# go.opentelemetry.io/proto/otlp v1.5.0 -## explicit; go 1.22.0 +# go.opentelemetry.io/proto/otlp v1.7.1 +## explicit; go 1.23.0 go.opentelemetry.io/proto/otlp/collector/trace/v1 go.opentelemetry.io/proto/otlp/common/v1 go.opentelemetry.io/proto/otlp/resource/v1 @@ -566,8 +566,8 @@ golang.org/x/net/internal/timeseries golang.org/x/net/proxy golang.org/x/net/trace golang.org/x/net/websocket -# golang.org/x/oauth2 v0.30.0 -## explicit; go 1.23.0 +# golang.org/x/oauth2 v0.34.0 +## explicit; go 1.24.0 golang.org/x/oauth2 golang.org/x/oauth2/authhandler golang.org/x/oauth2/google @@ -673,19 +673,19 @@ google.golang.org/api/option/internaloption google.golang.org/api/tpu/v1 google.golang.org/api/transport/http google.golang.org/api/transport/http/internal/propagation -# google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb -## explicit; go 1.23.0 +# google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 +## explicit; go 1.24.0 google.golang.org/genproto/googleapis/api google.golang.org/genproto/googleapis/api/annotations google.golang.org/genproto/googleapis/api/expr/v1alpha1 google.golang.org/genproto/googleapis/api/httpbody -# google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a -## explicit; go 1.23.0 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 +## explicit; go 1.24.0 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails google.golang.org/genproto/googleapis/rpc/status -# google.golang.org/grpc v1.72.2 -## explicit; go 1.23 +# google.golang.org/grpc v1.79.3 +## explicit; go 1.24.0 google.golang.org/grpc google.golang.org/grpc/attributes google.golang.org/grpc/backoff @@ -695,7 +695,6 @@ google.golang.org/grpc/balancer/endpointsharding google.golang.org/grpc/balancer/grpclb/state google.golang.org/grpc/balancer/pickfirst google.golang.org/grpc/balancer/pickfirst/internal -google.golang.org/grpc/balancer/pickfirst/pickfirstleaf google.golang.org/grpc/balancer/roundrobin google.golang.org/grpc/binarylog/grpc_binarylog_v1 google.golang.org/grpc/channelz @@ -705,6 +704,7 @@ google.golang.org/grpc/credentials google.golang.org/grpc/credentials/insecure google.golang.org/grpc/encoding google.golang.org/grpc/encoding/gzip +google.golang.org/grpc/encoding/internal google.golang.org/grpc/encoding/proto google.golang.org/grpc/experimental/stats google.golang.org/grpc/grpclog @@ -713,6 +713,7 @@ google.golang.org/grpc/health/grpc_health_v1 google.golang.org/grpc/internal google.golang.org/grpc/internal/backoff google.golang.org/grpc/internal/balancer/gracefulswitch +google.golang.org/grpc/internal/balancer/weight google.golang.org/grpc/internal/balancerload google.golang.org/grpc/internal/binarylog google.golang.org/grpc/internal/buffer @@ -749,7 +750,7 @@ google.golang.org/grpc/serviceconfig google.golang.org/grpc/stats google.golang.org/grpc/status google.golang.org/grpc/tap -# google.golang.org/protobuf v1.36.8 +# google.golang.org/protobuf v1.36.10 ## explicit; go 1.23 google.golang.org/protobuf/encoding/protodelim google.golang.org/protobuf/encoding/protojson From 9e38a61827dcbdb33f2bfe637f29f88586ad5cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Przychodze=C5=84?= Date: Thu, 16 Apr 2026 15:05:30 +0000 Subject: [PATCH 17/78] Move jprzychodzen to emeritus approvers --- OWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OWNERS b/OWNERS index c920e5c1a0..76dbb1cb64 100644 --- a/OWNERS +++ b/OWNERS @@ -6,7 +6,6 @@ approvers: - bowei - cheftako - hdp617 -- jprzychodzen - LogicalShark - mmamczur - SergeyKanzhelev @@ -15,6 +14,7 @@ approvers: emeritus_approvers: - bentheelder - dnardo +- jprzychodzen - nicksardo reviewers: - sig-cloud-provider-leads From 5049661f92d0c191b3e06c597ca569bbcfd6ba4f Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Thu, 16 Apr 2026 09:01:07 -0700 Subject: [PATCH 18/78] fix: use existing Prow test to verify k8s version (#1063) instead of GitHub Actions. --- .github/workflows/check-version.yml | 23 ------------------- tools/verify-all.sh | 6 +++++ ...netes-version.sh => verify-k8s-version.sh} | 0 3 files changed, 6 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/check-version.yml rename tools/{check-kubernetes-version.sh => verify-k8s-version.sh} (100%) diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml deleted file mode 100644 index c50d362df1..0000000000 --- a/.github/workflows/check-version.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Check Kubernetes Version - -on: - push: - branches: [ "**" ] - pull_request: - branches: [ "**" ] - -jobs: - check-version: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Run version check script - run: | - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - BRANCH_NAME="${{ github.base_ref }}" - else - BRANCH_NAME="${{ github.ref_name }}" - fi - ./tools/check-kubernetes-version.sh "$BRANCH_NAME" diff --git a/tools/verify-all.sh b/tools/verify-all.sh index 38c9b18005..b8c5c797eb 100755 --- a/tools/verify-all.sh +++ b/tools/verify-all.sh @@ -55,6 +55,12 @@ if [[ "${VERIFY_VENDOR:-true}" == "true" ]]; then cd "${KUBE_ROOT}" fi +if [[ "${VERIFY_K8S_VERSION:-true}" == "true" ]]; then + echo "[*] Verifying k8s version..." + tools/verify-k8s-version.sh || res=1 + cd "${KUBE_ROOT}" +fi + # exit based on verify scripts if [[ "${res}" = 0 ]]; then echo "" diff --git a/tools/check-kubernetes-version.sh b/tools/verify-k8s-version.sh similarity index 100% rename from tools/check-kubernetes-version.sh rename to tools/verify-k8s-version.sh From 87a2a611a2563d38a00c982f5e3afc344d05187d Mon Sep 17 00:00:00 2001 From: yifeizhuang Date: Thu, 16 Apr 2026 09:59:14 -0700 Subject: [PATCH 19/78] metis: implement gRPC daemon server (#1024) Implement standard adaptiveipam gRPC server (daemon_server.go) to listen for pod IP allocation requests over a Unix Domain Socket. And implement rpc AllocatePodIP and DeallocatePodIP. Implemented retries for DB errors within daemon serer. Implement new methods in the Store to interface with the SQLite DB, supporting idempotency for all: AddCIDR: Add CIDR blocks and seeds individual IP addresses. AllocateIPv4: Find available IP slots and flips is_allocated to true. ReleaseIPByOwner: Releases pod IP addresses by owner identifiers and sets cooldown period timestamp. Threading model: Each RPC request can call store concurrently to optimize request latency. The DB transactions guarantees thread safet between concurrent requests. Existing WAL mode and busy_timeout supports high concurrent read/write operations without locking. No implementation for IPv6 yet. --- metis/cmd/daemon.go | 11 +- metis/cmd/daemonoptions.go | 8 +- metis/daemon/daemon.go | 40 -- metis/daemon/daemon_configurations.go | 24 - metis/daemon/daemon_test.go | 21 - metis/go.mod | 2 +- metis/ipam/store.go | 174 ------ metis/ipam/store_test.go | 285 --------- metis/{ipam => pkg}/consts.go | 7 +- metis/pkg/daemon/daemon.go | 87 +++ metis/pkg/daemon/daemon_server.go | 220 +++++++ metis/pkg/daemon/daemon_server_test.go | 395 ++++++++++++ metis/pkg/daemon/daemon_test.go | 73 +++ metis/{ipam => pkg/store}/schema.sql | 0 metis/pkg/store/store.go | 528 ++++++++++++++++ metis/pkg/store/store_test.go | 799 +++++++++++++++++++++++++ 16 files changed, 2123 insertions(+), 551 deletions(-) delete mode 100644 metis/daemon/daemon.go delete mode 100644 metis/daemon/daemon_configurations.go delete mode 100644 metis/daemon/daemon_test.go delete mode 100644 metis/ipam/store.go delete mode 100644 metis/ipam/store_test.go rename metis/{ipam => pkg}/consts.go (80%) create mode 100644 metis/pkg/daemon/daemon.go create mode 100644 metis/pkg/daemon/daemon_server.go create mode 100644 metis/pkg/daemon/daemon_server_test.go create mode 100644 metis/pkg/daemon/daemon_test.go rename metis/{ipam => pkg/store}/schema.sql (100%) create mode 100644 metis/pkg/store/store.go create mode 100644 metis/pkg/store/store_test.go diff --git a/metis/cmd/daemon.go b/metis/cmd/daemon.go index 686e10dc71..151430d399 100644 --- a/metis/cmd/daemon.go +++ b/metis/cmd/daemon.go @@ -17,12 +17,15 @@ limitations under the License. package main import ( + "context" "os" + "os/signal" + "syscall" "github.com/spf13/cobra" cliflag "k8s.io/component-base/cli/flag" "k8s.io/klog/v2" - "k8s.io/metis/daemon" + "k8s.io/metis/pkg/daemon" ) func newDaemonCommand() *cobra.Command { @@ -42,7 +45,11 @@ func newDaemonCommand() *cobra.Command { var cfg daemon.Config _ = opts.ApplyTo(&cfg) d := daemon.NewDaemon(cfg) - if err := d.Run(); err != nil { + + ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) + defer stop() + + if err := d.Run(ctx); err != nil { klog.ErrorS(err, "Daemon failed to run") os.Exit(1) } diff --git a/metis/cmd/daemonoptions.go b/metis/cmd/daemonoptions.go index 181c36fa87..62437a6e85 100644 --- a/metis/cmd/daemonoptions.go +++ b/metis/cmd/daemonoptions.go @@ -20,7 +20,8 @@ import ( "time" cliflag "k8s.io/component-base/cli/flag" - "k8s.io/metis/daemon" + "k8s.io/metis/pkg" + "k8s.io/metis/pkg/daemon" ) // DaemonOptions holds the metis daemon options. @@ -36,9 +37,10 @@ func (o *DaemonOptions) AddFlags() cliflag.NamedFlagSets { } fs := fss.FlagSet("daemon") - // We apply default values directly within Flags for now, or assume they are pre-initialized fs.DurationVar(&o.MonitorInterval, "monitor-interval", 5*time.Second, "Monitor interval (e.g., 5s, 1m)") fs.DurationVar(&o.ReleaseCooldown, "release-cooldown", 1*time.Minute, "Release cooldown duration (e.g., 5m)") + fs.StringVar(&o.DBPath, "db-path", pkg.DefaultDBPath, "Path to the SQLite database file") + fs.StringVar(&o.SocketPath, "socket-path", pkg.DefaultSockPath, "Path to the Unix domain socket") return fss } @@ -51,6 +53,8 @@ func (o *DaemonOptions) ApplyTo(cfg *daemon.Config) error { cfg.MonitorInterval = o.MonitorInterval cfg.ReleaseCooldown = o.ReleaseCooldown + cfg.DBPath = o.DBPath + cfg.SocketPath = o.SocketPath return nil } diff --git a/metis/daemon/daemon.go b/metis/daemon/daemon.go deleted file mode 100644 index 8797cb8579..0000000000 --- a/metis/daemon/daemon.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 2026 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. -*/ -package daemon - -import ( - "fmt" - - "k8s.io/klog/v2" -) - -// Daemon represents the metis daemon process. -type Daemon struct { - Config Config -} - -// NewDaemon creates a new Daemon instance with the given configuration. -func NewDaemon(cfg Config) *Daemon { - return &Daemon{ - Config: cfg, - } -} - -// Run starts the daemon process. -func (d *Daemon) Run() error { - klog.InfoS("metis daemon has started successfully", "config", fmt.Sprintf("%+v", d.Config)) - return nil -} diff --git a/metis/daemon/daemon_configurations.go b/metis/daemon/daemon_configurations.go deleted file mode 100644 index 541f20b861..0000000000 --- a/metis/daemon/daemon_configurations.go +++ /dev/null @@ -1,24 +0,0 @@ -/* -Copyright 2026 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. -*/ -package daemon - -import "time" - -// Config contains the configuration parameters for the daemon. -type Config struct { - MonitorInterval time.Duration - ReleaseCooldown time.Duration -} diff --git a/metis/daemon/daemon_test.go b/metis/daemon/daemon_test.go deleted file mode 100644 index 20a5284ad3..0000000000 --- a/metis/daemon/daemon_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package daemon - -import ( - "testing" - "time" -) - -func TestDaemon_Run(t *testing.T) { - cfg := Config{ - MonitorInterval: 5 * time.Second, - ReleaseCooldown: 1 * time.Minute, - } - - d := NewDaemon(cfg) - - // Since Run() just logs and returns nil currently, it shouldn't error. - err := d.Run() - if err != nil { - t.Fatalf("expected no error from Run(), got: %v", err) - } -} diff --git a/metis/go.mod b/metis/go.mod index 3cf7419d6a..3e3e306199 100644 --- a/metis/go.mod +++ b/metis/go.mod @@ -11,6 +11,7 @@ require ( github.com/spf13/pflag v1.0.10 google.golang.org/grpc v1.79.3 google.golang.org/protobuf v1.36.10 + k8s.io/apimachinery v0.35.1 k8s.io/component-base v0.35.1 k8s.io/klog/v2 v2.140.0 ) @@ -42,7 +43,6 @@ require ( golang.org/x/text v0.34.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - k8s.io/apimachinery v0.35.1 // indirect k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect diff --git a/metis/ipam/store.go b/metis/ipam/store.go deleted file mode 100644 index c3f4316a1c..0000000000 --- a/metis/ipam/store.go +++ /dev/null @@ -1,174 +0,0 @@ -/* -Copyright 2026 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. -*/ - -package ipam - -import ( - "database/sql" - _ "embed" - "fmt" - "os" - "path/filepath" - - "github.com/go-logr/logr" - _ "github.com/mattn/go-sqlite3" // SQLite driver -) - -//go:embed schema.sql -var schemaSQL string - -const ( - // dbSchemaVersion tracks the SQLite schema version to allow safe local - // migrations and prevent state corruption across daemon restarts. - dbSchemaVersion = 1 - maxOpenConns = 10 - maxIdleConns = 10 -) - -// Store manages database operations for IPAM. -type Store struct { - db *sql.DB - log logr.Logger -} - -// NewStore creates a new Store instance and initializes the database. -func NewStore(log logr.Logger, dbPath string) (*Store, error) { - if dbPath == "" { - return nil, fmt.Errorf("dbPath cannot be empty: an absolute path must be explicitly provided") - } - - log.Info("Opening or creating database", "path", dbPath) - - if err := os.MkdirAll(filepath.Dir(dbPath), 0755); err != nil { - return nil, fmt.Errorf("failed to create db directory: %w", err) - } - - // SQLite is configured directly through the DSN string. This approach - // guarantees every new connection spawned by the sql.DB pool inherits these - // exact configurations natively. - dsn := dbPath + - // Enables Write-Ahead Logging (WAL) mode. This significantly improves - // concurrency by allowing multiple readers to access the database - // simultaneously without blocking a writer, which is critical for burst - // requests. - // See: https://www.sqlite.org/pragma.html#pragma_journal_mode - "?_journal_mode=WAL" + - // Enforces foreign key constraints. SQLite ignores these by default. - // This is required to ensure ON DELETE CASCADE functions correctly on the - // ip_addresses table when a draining CIDR block is officially removed. - // See: https://www.sqlite.org/pragma.html#pragma_foreign_keys - "&_foreign_keys=on" + - // Sets the busy timeout to 5000 milliseconds. If the database is locked - // by another transaction, this tells the SQLite driver to wait for up - // to 5 seconds before giving up and returning a locked error. - // See: https://www.sqlite.org/pragma.html#pragma_busy_timeout - "&_busy_timeout=5000" + - // Instructs the Go driver to send "BEGIN IMMEDIATE" instead of standard - // "BEGIN" when starting a transaction. This grabs a write lock instantly, - // preventing deadlocks when concurrent requests try to upgrade their - // read locks to write locks simultaneously. Note: This is a go-sqlite3 - // driver feature, not a native SQLite PRAGMA. - // See: https://github.com/mattn/go-sqlite3#connection-string - "&_txlock=immediate" + - // Maps to PRAGMA synchronous = NORMAL. In WAL mode, this is the optimal - // setting for high-concurrency daemons. It prevents database corruption - // during power loss or hard crashes while offering much faster write - // performance than FULL mode, sacrificing only a few milliseconds of - // un-checkpointed durability. - // See: https://www.sqlite.org/pragma.html#pragma_synchronous - "&_synchronous=1" - - db, err := sql.Open("sqlite3", dsn) - if err != nil { - return nil, fmt.Errorf("failed to open database: %w", err) - } - - db.SetMaxOpenConns(maxOpenConns) - db.SetMaxIdleConns(maxIdleConns) - // Sets the maximum amount of time a connection may be reused to infinity - // (0). This guarantees the single connection never expires. - db.SetConnMaxLifetime(0) - - store := &Store{ - db: db, - log: log, - } - - // Only a single process enters this execution block at a time. - if err := store.initSchema(); err != nil { - db.Close() - return nil, fmt.Errorf("failed to initialize schema: %w", err) - } - - log.Info("Initialized or updated database schema", "path", dbPath) - - return store, nil -} - -// initSchema creates the necessary tables if they don't exist. -func (s *Store) initSchema() error { - var currentVersion int - err := s.db.QueryRow("PRAGMA user_version").Scan(¤tVersion) - if err != nil { - return fmt.Errorf("failed to check schema version: %w", err) - } - - if currentVersion == dbSchemaVersion { - s.log.V(4).Info("Database schema already initialized", "version", currentVersion) - return nil - } - - s.log.Info("Initializing DB schema", "currentVersion", currentVersion, "expectedVersion", dbSchemaVersion) - - // 1. Begin an atomic transaction - tx, err := s.db.Begin() - if err != nil { - return fmt.Errorf("failed to begin transaction: %w", err) - } - // Safe to defer; Rollback does nothing if Commit() is successful - defer tx.Rollback() - - // 2. Execute the embedded schema.sql file - if _, err := tx.Exec(schemaSQL); err != nil { - return fmt.Errorf("failed to execute schema.sql: %w", err) - } - - // 3. Set User Version - setVersion := fmt.Sprintf("PRAGMA user_version = %d;", dbSchemaVersion) - if _, err := tx.Exec(setVersion); err != nil { - return fmt.Errorf("failed to set user_version: %w", err) - } - - // 4. Commit everything atomically - if err := tx.Commit(); err != nil { - return fmt.Errorf("failed to commit schema transaction: %w", err) - } - - s.log.Info("Database schema initialized or updated successfully") - return nil -} - -// Close safely closes the database connection and releases any file locks. -// This should be called during the daemon's graceful shutdown sequence. -func (s *Store) Close() error { - s.log.Info("Closing IPAM database connection") - - if err := s.db.Close(); err != nil { - return fmt.Errorf("failed to close database connection: %w", err) - } - - return nil -} diff --git a/metis/ipam/store_test.go b/metis/ipam/store_test.go deleted file mode 100644 index c6382e432e..0000000000 --- a/metis/ipam/store_test.go +++ /dev/null @@ -1,285 +0,0 @@ -/* -Copyright 2026 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. -*/ - -package ipam - -import ( - "context" - "database/sql" - "fmt" - "path/filepath" - "sync" - "testing" - "time" - - "github.com/go-logr/logr" - _ "github.com/mattn/go-sqlite3" // SQLite driver -) - -// TestNewStore_SuccessAndClose verifies that a new Store can be created, -// the schema is successfully initialized, and the database closes cleanly. -func TestNewStore_SuccessAndClose(t *testing.T) { - tmpDir := t.TempDir() - dbPath := filepath.Join(tmpDir, "test_ipam.db") - logger := logr.Discard() - - store, err := NewStore(logger, dbPath) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - if store == nil { - t.Fatal("Expected a valid Store instance, got nil") - } - - // Verify tables were actually created. - var tableName string - err = store.db.QueryRow("SELECT name FROM sqlite_master WHERE type='table' AND name='cidr_blocks';").Scan(&tableName) - if err != nil || tableName != "cidr_blocks" { - t.Errorf("Expected table 'cidr_blocks' to exist, got error: %v", err) - } - - // Verify the database connection is alive. - if err := store.db.Ping(); err != nil { - t.Errorf("Database ping failed: %v", err) - } - - if err := store.Close(); err != nil { - t.Errorf("Store.Close() failed: %v", err) - } -} - -// TestNewStore_Idempotency verifies idempotency by ensuring a second -// initialization safely skips schema creation. By intentionally dropping an -// index after the first run, the test deterministically proves that the second -// execution short-circuits and leaves the index uncreated. -func TestNewStore_Idempotency(t *testing.T) { - tmpDir := t.TempDir() - dbPath := filepath.Join(tmpDir, "idempotency_test.db") - logger := logr.Discard() - - // Initial creation sets up the full schema and user_version = 1. - store1, err := NewStore(logger, dbPath) - if err != nil { - t.Fatalf("First NewStore call failed: %v", err) - } - if err := store1.Close(); err != nil { - t.Fatalf("Failed to close first store: %v", err) - } - - // Sabotage the schema slightly to prove the bypass works. Manually connect - // and drop an index that initSchema would normally create. - db, err := sql.Open("sqlite3", dbPath) - if err != nil { - t.Fatalf("Failed to open DB for manual intervention: %v", err) - } - if _, err := db.Exec("DROP INDEX idx_ip_idempotency;"); err != nil { - t.Fatalf("Failed to manually drop index: %v", err) - } - db.Close() - - // If the short-circuit works, it will see user_version=1 and return early, - // meaning it will NOT execute the CREATE statements to fix the missing index. - store2, err := NewStore(logger, dbPath) - if err != nil { - t.Fatalf("Second NewStore call failed: %v", err) - } - defer store2.Close() - - // Verify the index is still missing. - var name string - query := "SELECT name FROM sqlite_master WHERE type='index' AND name='idx_ip_idempotency';" - err = store2.db.QueryRow(query).Scan(&name) - - if err == nil { - // If err is nil, it means the query found the index, which means the - // schema block executed and recreated it. - t.Errorf("Expected index 'idx_ip_idempotency' to be missing, but it was recreated. Short-circuit failed.") - } else if err != sql.ErrNoRows { - // If an error other than ErrNoRows occurs, the query failed unexpectedly. - t.Fatalf("Unexpected error querying sqlite_master: %v", err) - } -} - -// TestNewStore_SchemaVerification rigorously checks the sqlite_master table -// to ensure all expected tables, indexes, and triggers were successfully -// created during initialization. -func TestNewStore_SchemaVerification(t *testing.T) { - tmpDir := t.TempDir() - dbPath := filepath.Join(tmpDir, "schema_test.db") - logger := logr.Discard() - - store, err := NewStore(logger, dbPath) - if err != nil { - t.Fatalf("NewStore failed: %v", err) - } - defer store.Close() - - // Define the expected schema components. - expectedTables := []string{"cidr_blocks", "ip_addresses"} - expectedIndexes := []string{"idx_available_ips", "idx_ip_idempotency"} - expectedTriggers := []string{"update_cidr_blocks_updated_at", "update_ip_addresses_updated_at"} - - // Verify Tables. - for _, table := range expectedTables { - var name string - query := "SELECT name FROM sqlite_master WHERE type='table' AND name=?;" - if err := store.db.QueryRow(query, table).Scan(&name); err != nil { - t.Errorf("Schema verification failed: expected table '%s' not found: %v", table, err) - } - } - - // Verify Indexes. - for _, index := range expectedIndexes { - var name string - query := "SELECT name FROM sqlite_master WHERE type='index' AND name=?;" - if err := store.db.QueryRow(query, index).Scan(&name); err != nil { - t.Errorf("Schema verification failed: expected index '%s' not found: %v", index, err) - } - } - - // Verify Triggers. - for _, trigger := range expectedTriggers { - var name string - query := "SELECT name FROM sqlite_master WHERE type='trigger' AND name=?;" - if err := store.db.QueryRow(query, trigger).Scan(&name); err != nil { - t.Errorf("Schema verification failed: expected trigger '%s' not found: %v", trigger, err) - } - } -} - -// TestStore_Concurrency verifies that the SQLite connection pool and -// transaction locks (_txlock=immediate, MaxOpenConns=10) can successfully -// handle high bursts of concurrent requests without throwing SQLITE_BUSY -// errors. It achieves maximum contention by spawning multiple goroutines and -// using a broadcast channel as a "starting gun" to release them at the exact -// same logical moment. -func TestStore_Concurrency(t *testing.T) { - dbPath := filepath.Join(t.TempDir(), "ipam-concurrency.db") - s, err := NewStore(logr.Discard(), dbPath) - if err != nil { - t.Fatalf("Failed to initialize store: %v", err) - } - defer s.Close() - - var wg sync.WaitGroup - numGoroutines := 10 - - // Create the Starting Line channel. - startLine := make(chan struct{}) - - // Simulate 10 concurrent gRPC requests hitting the database. - for i := 0; i < numGoroutines; i++ { - wg.Add(1) - go func(id int) { - defer wg.Done() - - // Block this goroutine until the starting gun fires. - <-startLine - - // Simulate an Insert. - cidr := fmt.Sprintf("10.0.%d.0/24", id) - insertQuery := `INSERT INTO cidr_blocks (cidr, network, ip_family, total_ips, allocated_ips, state) - VALUES (?, 'test-network', 'ipv4', 256, 0, 'Ready')` - - _, err := s.db.Exec(insertQuery, cidr) - if err != nil { - t.Errorf("Goroutine %d failed to insert: %v", id, err) - return - } - - // Simulate a Read. - var state string - readQuery := `SELECT state FROM cidr_blocks WHERE cidr = ?` - err = s.db.QueryRow(readQuery, cidr).Scan(&state) - if err != nil { - t.Errorf("Goroutine %d failed to read: %v", id, err) - return - } - }(i) - } - - // Fire the starting gun! - // Closing the channel instantly releases all 10 blocked goroutines at the exact same time. - close(startLine) - - // Wait for all goroutines to finish. - wg.Wait() -} - -// TestStore_MaxOpenConns_Limit verifies that the connection pool can fan out -// to the configured maxOpenConns limit. It proves this by holding -// (maxOpenConns - 1) read connections hostage and ensuring the final allowed -// concurrent query can still execute successfully without hitting a pool bottleneck. -func TestStore_MaxOpenConns_Limit(t *testing.T) { - dbPath := filepath.Join(t.TempDir(), "ipam-pool-limit.db") - s, err := NewStore(logr.Discard(), dbPath) - if err != nil { - t.Fatalf("Failed to initialize store: %v", err) - } - defer s.Close() - - // Dynamically scale the test based on the Store's configuration - hostageCount := s.db.Stats().MaxOpenConnections - 1 - connAcquired := make(chan struct{}, hostageCount) - releaseHostages := make(chan struct{}) - var wg sync.WaitGroup - - // 1. Take (maxOpenConns - 1) connections hostage using unclosed read queries - for i := range hostageCount { - wg.Add(1) - go func(id int) { - defer wg.Done() - - rows, err := s.db.Query(`SELECT state FROM cidr_blocks`) - if err != nil { - t.Errorf("Goroutine %d failed to execute read query: %v", id, err) - return - } - defer rows.Close() - - connAcquired <- struct{}{} - <-releaseHostages - }(i) - } - - // Wait for all hostage connections to be checked out of the pool. - // We use a 1-second timeout to prevent the test from hanging indefinitely - // if the connection pool is configured smaller than hostageCount. - timeout := time.After(1 * time.Second) - for i := 0; i < hostageCount; i++ { - select { - case <-connAcquired: - // Connection successfully acquired - case <-timeout: - t.Fatalf("Test timed out waiting to acquire %d connections. MaxOpenConns is likely configured lower than the expected limit.", hostageCount) - } - } - - // 2. Execute the final allowed query to reach maxOpenConns - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) - defer cancel() - - var state string - err = s.db.QueryRowContext(ctx, `SELECT state FROM cidr_blocks LIMIT 1`).Scan(&state) - - if err != nil && err != sql.ErrNoRows { - t.Fatalf("Final concurrent query failed (pool limit reached prematurely): %v", err) - } - - // 3. Clean up - close(releaseHostages) - wg.Wait() -} diff --git a/metis/ipam/consts.go b/metis/pkg/consts.go similarity index 80% rename from metis/ipam/consts.go rename to metis/pkg/consts.go index 64a7c53f4d..c643d0ff2a 100644 --- a/metis/ipam/consts.go +++ b/metis/pkg/consts.go @@ -14,6 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -package ipam +package pkg -const DefaultDBPath = "/var/lib/cni/metis/metis.sqlite" +const ( + DefaultDBPath = "/var/lib/cni/metis/metis.sqlite" + DefaultSockPath = "/var/lib/cni/metis/metis-adaptive-ipam.sock" +) diff --git a/metis/pkg/daemon/daemon.go b/metis/pkg/daemon/daemon.go new file mode 100644 index 0000000000..6263184ca8 --- /dev/null +++ b/metis/pkg/daemon/daemon.go @@ -0,0 +1,87 @@ +/* +Copyright 2026 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. +*/ + +package daemon + +import ( + "context" + "fmt" + "time" + + "k8s.io/klog/v2" + "k8s.io/metis/pkg" + "k8s.io/metis/pkg/store" +) + +// Config contains the configuration parameters for the daemon. +type Config struct { + MonitorInterval time.Duration + ReleaseCooldown time.Duration + DBPath string + SocketPath string +} + +// Daemon represents the metis daemon process. +type Daemon struct { + Config Config +} + +// NewDaemon creates a new Daemon instance with the given configuration. +func NewDaemon(cfg Config) *Daemon { + return &Daemon{ + Config: cfg, + } +} + +// Run starts the daemon process and listens for gRPC requests on a domain socket. +func (d *Daemon) Run(ctx context.Context) error { + // Initialize logr.Logger here at the entry point using klog.Background(). We use klog at the + // entry point to configure the concrete logging backend and flags. We pass the logr interface + // to sub-components to decouple them from the implementation, improve testability, and + // preserve the "metis.daemon" name context across all logs. + logger := klog.Background().WithName("metis").WithName("daemon") // klog/v2 provides a logr.Logger + logger.Info("metis daemon is starting", "config", fmt.Sprintf("%+v", d.Config)) + + dbPath := d.Config.DBPath + if dbPath == "" { + dbPath = pkg.DefaultDBPath + } + + storeInstance, err := store.NewStore(ctx, logger, dbPath) + if err != nil { + return fmt.Errorf("failed to initialize sqlite store: %w", err) + } + defer storeInstance.Close() + + server := newAdaptiveIpamServer(logger, storeInstance, d.Config.SocketPath, d.Config.ReleaseCooldown, store.DefaultBusyTimeout) + + errCh := make(chan error, 1) + go func() { + errCh <- server.start() + }() + + select { + case err := <-errCh: + if err != nil { + return fmt.Errorf("server failed: %w", err) + } + case <-ctx.Done(): + logger.Info("Context cancelled, shutting down daemon") + server.stop() + } + + return nil +} diff --git a/metis/pkg/daemon/daemon_server.go b/metis/pkg/daemon/daemon_server.go new file mode 100644 index 0000000000..8669c6c3b0 --- /dev/null +++ b/metis/pkg/daemon/daemon_server.go @@ -0,0 +1,220 @@ +/* +Copyright 2026 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. +*/ + +package daemon + +import ( + "context" + "errors" + "fmt" + "net" + "os" + "time" + + "github.com/go-logr/logr" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/metis/api/adaptiveipam/v1" + "k8s.io/metis/pkg" + "k8s.io/metis/pkg/store" +) + +// TODO: Measure the store allocation query time and update the interval appropriately. +const defaultPollInterval = 50 * time.Millisecond + +type adaptiveIpamServer struct { + adaptiveipam.UnimplementedAdaptiveIpamServer + store *store.Store + sockPath string + releaseCooldown time.Duration + busyTimeout time.Duration + grpcServer *grpc.Server + logger logr.Logger +} + +func newAdaptiveIpamServer(logger logr.Logger, storeInstance *store.Store, socketPath string, releaseCooldown time.Duration, busyTimeout time.Duration) *adaptiveIpamServer { + server := &adaptiveIpamServer{ + store: storeInstance, + sockPath: socketPath, + releaseCooldown: releaseCooldown, + busyTimeout: busyTimeout, + logger: logger, + } + + return server +} + +func (s *adaptiveIpamServer) AllocatePodIP(ctx context.Context, req *adaptiveipam.AllocatePodIPRequest) (*adaptiveipam.AllocatePodIPResponse, error) { + s.logger.Info("AllocatePodIP request received", + "network", req.Network, + "podName", req.PodName, + "podNamespace", req.PodNamespace, + "ipv4Config", fmt.Sprintf("%+v", req.Ipv4Config), + "ipv6Config", fmt.Sprintf("%+v", req.Ipv6Config)) + + if req.Ipv4Config == nil && req.Ipv6Config == nil { + err := status.Errorf(codes.InvalidArgument, "both ipv4_config and ipv6_config are missing for pod %s/%s", req.PodNamespace, req.PodName) + s.logger.Error(err, "AllocatePodIP validation failed", "podName", req.PodName, "podNamespace", req.PodNamespace) + return nil, err + } + + var ipv4Alloc *adaptiveipam.PodIP + var err error + if req.Ipv4Config != nil { + ipv4Alloc, err = s.allocateIPv4(ctx, req) + if err != nil { + return nil, err + } + } + + if req.Ipv6Config != nil { + return nil, status.Error(codes.Unimplemented, "IPv6 allocation is not implemented yet") + } + + return &adaptiveipam.AllocatePodIPResponse{ + Ipv4: ipv4Alloc, + }, nil +} + +func (s *adaptiveIpamServer) allocateIPv4(ctx context.Context, req *adaptiveipam.AllocatePodIPRequest) (*adaptiveipam.PodIP, error) { + config := req.Ipv4Config + network := req.Network + + if err := s.MaybeAddInitialPodCidr(ctx, network, config.InitialPodCidr); err != nil { + return nil, err + } + + var ip, cidr string + var lastErr error + timeout := s.busyTimeout + if timeout == 0 { + timeout = store.DefaultBusyTimeout + } + + // The total timeout is set to align with the SQLite busy_timeout configured in the DSN. + // PollUntilContextTimeout creates a derived context with this timeout, but also respects + // the parent gRPC context (ctx) cancellation. + err := wait.PollUntilContextTimeout(ctx, defaultPollInterval, timeout, true, func(ctx context.Context) (bool, error) { + ip, cidr, lastErr = s.store.AllocateIPv4(ctx, network, config.InterfaceName, config.ContainerId) + if lastErr == nil { + return true, nil // Success + } + if errors.Is(lastErr, store.ErrNoAvailableIPs) { + return true, lastErr // Stop immediately on non-retryable error + } + if ctx.Err() != nil { + return true, ctx.Err() // Stop immediately if context is done + } + s.logger.V(4).Info("Retrying AllocateIPv4 due to transient error", "err", lastErr, "network", network) + return false, nil // Retry + }) + + if err != nil { + if (errors.Is(err, wait.ErrWaitTimeout) || errors.Is(err, context.DeadlineExceeded)) && lastErr != nil { + err = lastErr // Use last error if timed out + } + s.logger.Error(err, "failed to allocate ipv4", "network", network, "podName", req.PodName, "podNamespace", req.PodNamespace) + + if errors.Is(err, store.ErrNoAvailableIPs) { + return nil, status.Errorf(codes.ResourceExhausted, "failed to allocate ipv4 for pod %s/%s: %v", req.PodNamespace, req.PodName, err) + } + // TODO: Refine status code to return a more specific code based on the error type instead of a fallback Unavailable. + return nil, status.Errorf(codes.Unavailable, "failed to allocate ipv4 for pod %s/%s: %v", req.PodNamespace, req.PodName, err) + } + + return &adaptiveipam.PodIP{ + IpAddress: ip, + Cidr: cidr, + }, nil +} + +func (s *adaptiveIpamServer) MaybeAddInitialPodCidr(ctx context.Context, network string, initialPodCidr string) error { + if initialPodCidr == "" { + return nil + } + + exists, err := s.store.GetCIDRBlockByCIDR(ctx, initialPodCidr) + if err != nil { + s.logger.Error(err, "failed to check if initial cidr block exists", "network", network, "cidr", initialPodCidr) + return status.Errorf(codes.Unavailable, "failed to check if initial cidr block %s exists for network %s: %v", initialPodCidr, network, err) + } + if !exists { + if err := s.store.AddCIDR(ctx, network, initialPodCidr); err != nil { + if errors.Is(err, store.ErrCidrAlreadyExists) { + s.logger.Info("Initial CIDR block already added by another thread", "network", network, "cidr", initialPodCidr) + } else { + s.logger.Error(err, "failed to add initial cidr block", "network", network, "cidr", initialPodCidr) + return status.Errorf(codes.Unavailable, "failed to add initial cidr block %s for network %s: %v", initialPodCidr, network, err) + } + } + } + return nil +} + +func (s *adaptiveIpamServer) DeallocatePodIP(ctx context.Context, req *adaptiveipam.DeallocatePodIPRequest) (*adaptiveipam.DeallocatePodIPResponse, error) { + s.logger.Info("DeallocatePodIP request received", + "network", req.Network, + "containerID", req.ContainerId, + "interfaceName", req.InterfaceName, + "podName", req.PodName, + "podNamespace", req.PodNamespace) + + count, err := s.store.ReleaseIPByOwner(ctx, req.Network, req.ContainerId, req.InterfaceName, s.releaseCooldown) + if err != nil { + s.logger.Error(err, "failed to deallocate ips", "network", req.Network, "podName", req.PodName, "podNamespace", req.PodNamespace) + return nil, status.Errorf(codes.Unavailable, "failed to deallocate ips for pod %s/%s: %v", req.PodNamespace, req.PodName, err) + } + + if count == 0 { + s.logger.Info("No IP addresses were released (likely already deallocated or didn't exist)", "network", req.Network, "podName", req.PodName, "podNamespace", req.PodNamespace) + } else { + s.logger.Info("Successfully deallocated ips", "network", req.Network, "podName", req.PodName, "podNamespace", req.PodNamespace, "count", count) + } + + return &adaptiveipam.DeallocatePodIPResponse{}, nil +} + +func (s *adaptiveIpamServer) start() error { + sockPath := s.sockPath + if sockPath == "" { + sockPath = pkg.DefaultSockPath + } + + if err := os.Remove(sockPath); err != nil && !os.IsNotExist(err) { + return fmt.Errorf("failed to remove existing socket: %w", err) + } + + listener, err := net.Listen("unix", sockPath) + if err != nil { + return fmt.Errorf("failed to listen on uds %s: %w", sockPath, err) + } + defer listener.Close() + + s.grpcServer = grpc.NewServer() + adaptiveipam.RegisterAdaptiveIpamServer(s.grpcServer, s) + + s.logger.Info("gRPC server is listening", "socket", sockPath) + return s.grpcServer.Serve(listener) +} + +func (s *adaptiveIpamServer) stop() { + if s.grpcServer != nil { + s.logger.Info("Stopping gRPC server gracefully") + s.grpcServer.GracefulStop() + } +} diff --git a/metis/pkg/daemon/daemon_server_test.go b/metis/pkg/daemon/daemon_server_test.go new file mode 100644 index 0000000000..b1da241910 --- /dev/null +++ b/metis/pkg/daemon/daemon_server_test.go @@ -0,0 +1,395 @@ +/* +Copyright 2026 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. +*/ + +package daemon + +import ( + "context" + "fmt" + "net" + "path/filepath" + "strings" + "sync" + "testing" + "time" + + "github.com/go-logr/logr" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/status" + "k8s.io/klog/v2" + "k8s.io/metis/api/adaptiveipam/v1" + "k8s.io/metis/pkg/store" +) + +func TestAdaptiveIpamServer_withGrpcClient(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + sockPath := filepath.Join(tempDir, "metis_test_client_integration.sock") + dbPath := filepath.Join(tempDir, "metis_client_integration.sqlite") + + s, err := store.NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + defer s.Close() + + server := &adaptiveIpamServer{store: s, sockPath: sockPath} + + // 1. Start server in background + errCh := make(chan error, 1) + go func() { + errCh <- server.start() + }() + + // Wait for socket to appear + time.Sleep(100 * time.Millisecond) + + // 2. Dial using gRPC client + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + + conn, err := grpc.DialContext(ctx, sockPath, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) { + return net.Dial("unix", addr) + })) + if err != nil { + t.Fatalf("Failed to dial UDS %s: %v", sockPath, err) + } + defer conn.Close() + + client := adaptiveipam.NewAdaptiveIpamClient(conn) + + // 3. Prepare data and call + network := "integration-network" + cidr := "10.0.1.0/24" + req := &adaptiveipam.AllocatePodIPRequest{ + Network: network, + PodName: "test-pod", + PodNamespace: "default", + Ipv4Config: &adaptiveipam.IPConfig{ + InterfaceName: "eth0", + ContainerId: "test-container-integration", + InitialPodCidr: cidr, + }, + } + + resp, err := client.AllocatePodIP(ctx, req) + if err != nil { + t.Fatalf("gRPC Client AllocatePodIP failed: %v", err) + } + + if resp.Ipv4 == nil || resp.Ipv4.IpAddress == "" { + t.Errorf("Expected valid IP address from gRPC client, got response: %v", resp) + } +} + +func TestAdaptiveIpamServer_AllocatePodIP(t *testing.T) { + logger := klog.Background() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "metis_server_test.sqlite") + + storeInstance, err := store.NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("Failed to create store: %v", err) + } + defer storeInstance.Close() + + server := &adaptiveIpamServer{store: storeInstance} + + network := "test-network" + cidr := "10.0.1.0/24" + + req := &adaptiveipam.AllocatePodIPRequest{ + Network: network, + PodName: "test-pod", + PodNamespace: "default", + Ipv4Config: &adaptiveipam.IPConfig{ + InterfaceName: "eth0", + ContainerId: "test-container", + InitialPodCidr: cidr, + }, + } + + resp, err := server.AllocatePodIP(context.Background(), req) + if err != nil { + t.Fatalf("AllocatePodIP failed: %v", err) + } + + if resp.Ipv4 == nil { + t.Fatal("Expected Ipv4 allocation, got nil") + } + + if resp.Ipv4.IpAddress == "" { + t.Fatal("Expected IP address, got empty string") + } +} + +func TestAdaptiveIpamServer_AllocatePodIP_Concurrency(t *testing.T) { + logger := klog.Background() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "metis_server_concurrency_test.sqlite") + + storeInstance, err := store.NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("Failed to create store: %v", err) + } + defer storeInstance.Close() + + server := &adaptiveIpamServer{store: storeInstance} + + network := "test-network" + cidr := "10.0.1.0/24" + + numGoroutines := 10 + var wg sync.WaitGroup + wg.Add(numGoroutines) + + ips := make([]string, numGoroutines) + errs := make([]error, numGoroutines) + + for i := 0; i < numGoroutines; i++ { + go func(index int) { + defer wg.Done() + req := &adaptiveipam.AllocatePodIPRequest{ + Network: network, + PodName: fmt.Sprintf("test-pod-%d", index), + PodNamespace: "default", + Ipv4Config: &adaptiveipam.IPConfig{ + InterfaceName: "eth0", + ContainerId: fmt.Sprintf("test-container-%d", index/2), + InitialPodCidr: cidr, + }, + } + resp, err := server.AllocatePodIP(context.Background(), req) + if err != nil { + errs[index] = err + return + } + if resp.Ipv4 != nil { + ips[index] = resp.Ipv4.IpAddress + } + }(i) + } + + wg.Wait() + + for i, err := range errs { + if err != nil { + t.Errorf("Goroutine %d failed: %v", i, err) + } + } + + for i, ip := range ips { + if ip == "" { + t.Errorf("Goroutine %d returned empty IP", i) + } + } + + for i := 0; i < numGoroutines; i += 2 { + if ips[i] != "" && ips[i] != ips[i+1] { + t.Errorf("Idempotency check failed for pair %d and %d: expected same IP, got %s and %s", i, i+1, ips[i], ips[i+1]) + } + } + + uniqueIpMap := make(map[string]bool) + for _, ip := range ips { + if ip != "" { + uniqueIpMap[ip] = true + } + } + if len(uniqueIpMap) != numGoroutines/2 { + t.Errorf("Expected %d unique IPs, got %d (ips: %v)", numGoroutines/2, len(uniqueIpMap), ips) + } + +} + +func TestAdaptiveIpamServer_DeallocatePodIP(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "metis_daemon_test_release.sqlite") + + s, err := store.NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore returned unexpected error: %v", err) + } + defer s.Close() + + server := &adaptiveIpamServer{store: s, sockPath: "", releaseCooldown: 1 * time.Minute} + + network := "gke-pod-network" + cidr := "10.0.1.0/24" + containerID := "test-container-release" + interfaceName := "eth0" + podName := "test-pod" + podNamespace := "default" + + // 1. Allocate first + reqAlloc := &adaptiveipam.AllocatePodIPRequest{ + Network: network, + PodName: podName, + PodNamespace: podNamespace, + Ipv4Config: &adaptiveipam.IPConfig{ + InterfaceName: interfaceName, + ContainerId: containerID, + InitialPodCidr: cidr, + }, + } + + allocResp, err := server.AllocatePodIP(context.Background(), reqAlloc) + if err != nil { + t.Fatalf("AllocatePodIP failed in deallocate test setup: %v", err) + } + + if allocResp.Ipv4 == nil || allocResp.Ipv4.IpAddress == "" { + t.Fatalf("AllocatePodIP response empty") + } + + // 2. Deallocate + reqDealloc := &adaptiveipam.DeallocatePodIPRequest{ + Network: network, + InterfaceName: interfaceName, + ContainerId: containerID, + PodName: podName, + PodNamespace: podNamespace, + } + + deallocResp, err := server.DeallocatePodIP(context.Background(), reqDealloc) + if err != nil { + t.Fatalf("DeallocatePodIP failed: %v", err) + } + + if deallocResp == nil { + t.Errorf("DeallocatePodIP returned nil response") + } + + // 3. Verify via store + var isAlloc bool + err = s.DB().QueryRow("SELECT is_allocated FROM ip_addresses WHERE address = ?", allocResp.Ipv4.IpAddress).Scan(&isAlloc) + if err != nil { + t.Fatalf("Failed to query DB for IP status: %v", err) + } + if isAlloc { + t.Errorf("Expected IP to be unallocated") + } +} + +func TestAdaptiveIpamServer_AllocatePodIP_RetryOnDBError(t *testing.T) { + logger := klog.Background() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "metis_server_retry_test.sqlite") + + storeInstance, err := store.NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("Failed to create store: %v", err) + } + + server := &adaptiveIpamServer{store: storeInstance, busyTimeout: 500 * time.Millisecond} + + network := "test-network" + cidr := "10.0.1.0/24" + + if err := storeInstance.AddCIDR(context.Background(), network, cidr); err != nil { + t.Fatalf("Failed to add CIDR: %v", err) + } + + req := &adaptiveipam.AllocatePodIPRequest{ + Network: network, + PodName: "test-pod", + PodNamespace: "default", + Ipv4Config: &adaptiveipam.IPConfig{ + InterfaceName: "eth0", + ContainerId: "test-container", + }, + } + + // Close the DB to simulate transient error + storeInstance.Close() + + startTime := time.Now() + _, err = server.AllocatePodIP(context.Background(), req) + duration := time.Since(startTime) + + if err == nil { + t.Fatal("Expected error after closing DB, got nil") + } + + // Expect it to have retried, so duration should be at least 300ms + if duration < 300*time.Millisecond { + t.Errorf("Expected test to take at least 300ms due to retries, took %v", duration) + } + + st, ok := status.FromError(err) + if !ok { + t.Fatalf("Expected gRPC status error, got: %v", err) + } + if st.Code() != codes.Unavailable { + t.Errorf("Expected status code Unavailable, got %v", st.Code()) + } + if !strings.Contains(st.Message(), "database is closed") { + t.Errorf("Expected error message to contain 'database is closed', got: %v", st.Message()) + } +} + +func TestAdaptiveIpamServer_AllocatePodIP_NoRetryOnExhaustion(t *testing.T) { + logger := klog.Background() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "metis_server_exhaust_test.sqlite") + + storeInstance, err := store.NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("Failed to create store: %v", err) + } + defer storeInstance.Close() + + server := &adaptiveIpamServer{store: storeInstance} + + network := "test-network" + + req := &adaptiveipam.AllocatePodIPRequest{ + Network: network, + PodName: "test-pod", + PodNamespace: "default", + Ipv4Config: &adaptiveipam.IPConfig{ + InterfaceName: "eth0", + ContainerId: "test-container", + }, + } + + startTime := time.Now() + _, err = server.AllocatePodIP(context.Background(), req) + duration := time.Since(startTime) + + if err == nil { + t.Fatal("Expected error for exhausted store, got nil") + } + + // Expect it to fail fast, so duration should be small (much less than 100ms backoff) + if duration >= 100*time.Millisecond { + t.Errorf("Expected test to fail fast, but took %v", duration) + } + + st, ok := status.FromError(err) + if !ok { + t.Fatalf("Expected gRPC status error, got: %v", err) + } + if st.Code() != codes.ResourceExhausted { + t.Errorf("Expected status code ResourceExhausted, got %v", st.Code()) + } + if !strings.Contains(st.Message(), store.ErrNoAvailableIPs.Error()) { + t.Errorf("Expected status message to contain '%v', got: %s", store.ErrNoAvailableIPs, st.Message()) + } +} diff --git a/metis/pkg/daemon/daemon_test.go b/metis/pkg/daemon/daemon_test.go new file mode 100644 index 0000000000..ffe6844cf1 --- /dev/null +++ b/metis/pkg/daemon/daemon_test.go @@ -0,0 +1,73 @@ +/* +Copyright 2026 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. +*/ + +package daemon + +import ( + "context" + "os" + "path/filepath" + "testing" + "time" +) + +func TestDaemon_Run(t *testing.T) { + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "metis_daemon_test.sqlite") + sockPath := filepath.Join(tempDir, "metis_test.sock") + + cfg := Config{ + MonitorInterval: 5 * time.Second, + ReleaseCooldown: 1 * time.Minute, + DBPath: dbPath, + SocketPath: sockPath, + } + + d := NewDaemon(cfg) + + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() // Clean up after test + + errCh := make(chan error, 1) + go func() { + errCh <- d.Run(ctx) + }() + + // Wait for server to start and create socket + time.Sleep(500 * time.Millisecond) + + if _, err := os.Stat(sockPath); os.IsNotExist(err) { + t.Errorf("Expected socket to be created at %s, but doesn't exist", sockPath) + } + + if _, err := os.Stat(dbPath); os.IsNotExist(err) { + t.Errorf("Expected database to be created at %s, but doesn't exist", dbPath) + } + + // Trigger exit path! + cancel() + + select { + case err := <-errCh: + if err != nil { + t.Errorf("Daemon exited with error: %v", err) + } + case <-time.After(2 * time.Second): + t.Fatalf("Daemon failed to shut down within timeout") + } + + // If select completes without timing out, Run() exited, meaning `defer storeInstance.Close()` was executed! +} diff --git a/metis/ipam/schema.sql b/metis/pkg/store/schema.sql similarity index 100% rename from metis/ipam/schema.sql rename to metis/pkg/store/schema.sql diff --git a/metis/pkg/store/store.go b/metis/pkg/store/store.go new file mode 100644 index 0000000000..702b81b717 --- /dev/null +++ b/metis/pkg/store/store.go @@ -0,0 +1,528 @@ +/* +Copyright 2026 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. +*/ + +package store + +import ( + "context" + "database/sql" + _ "embed" + "errors" + "fmt" + "net" + "os" + "path/filepath" + "time" + + "github.com/go-logr/logr" + "github.com/mattn/go-sqlite3" // SQLite driver +) + +//go:embed schema.sql +var schemaSQL string + +const ( + // dbSchemaVersion tracks the SQLite schema version to allow safe local + // migrations and prevent state corruption across daemon restarts. + dbSchemaVersion = 1 + maxOpenConns = 10 + maxIdleConns = 10 + // DefaultBusyTimeout is the default timeout for SQLite busy handler. + DefaultBusyTimeout = 5000 * time.Millisecond +) + +var ( + // ErrCidrAlreadyExists is returned when a CIDR block already exists in the store. + ErrCidrAlreadyExists = errors.New("cidr block already exists") + + // ErrNoAvailableIPs is returned when no available IPs can be found in any CIDR block. + ErrNoAvailableIPs = errors.New("no available IPs in store") +) + +// Store manages database operations for IPAM. +type Store struct { + db *sql.DB + log logr.Logger +} + +// NewStore creates a new Store instance and initializes the database. +func NewStore(ctx context.Context, log logr.Logger, dbPath string) (*Store, error) { + if dbPath == "" { + return nil, fmt.Errorf("dbPath cannot be empty: an absolute path must be explicitly provided") + } + + log.Info("Opening or creating database", "path", dbPath) + + if err := os.MkdirAll(filepath.Dir(dbPath), 0755); err != nil { + return nil, fmt.Errorf("failed to create db directory: %w", err) + } + + // SQLite is configured directly through the DSN string. This approach + // guarantees every new connection spawned by the sql.DB pool inherits these + // exact configurations natively. + dsn := dbPath + + // Enables Write-Ahead Logging (WAL) mode. This significantly improves + // concurrency by allowing multiple readers to access the database + // simultaneously without blocking a writer, which is critical for burst + // requests. + // See: https://www.sqlite.org/pragma.html#pragma_journal_mode + "?_journal_mode=WAL" + + // Enforces foreign key constraints. SQLite ignores these by default. + // This is required to ensure ON DELETE CASCADE functions correctly on the + // ip_addresses table when a draining CIDR block is officially removed. + // See: https://www.sqlite.org/pragma.html#pragma_foreign_keys + "&_foreign_keys=on" + + // Sets the busy timeout. If the database is locked + // by another transaction, this tells the SQLite driver to wait for up + // to this duration before giving up and returning a locked error. + // See: https://www.sqlite.org/pragma.html#pragma_busy_timeout + fmt.Sprintf("&_busy_timeout=%d", DefaultBusyTimeout.Milliseconds()) + + // Instructs the Go driver to send "BEGIN IMMEDIATE" instead of standard + // "BEGIN" when starting a transaction. This grabs a write lock instantly, + // preventing deadlocks when concurrent requests try to upgrade their + // read locks to write locks simultaneously. Note: This is a go-sqlite3 + // driver feature, not a native SQLite PRAGMA. + // See: https://github.com/mattn/go-sqlite3#connection-string + "&_txlock=immediate" + + // Maps to PRAGMA synchronous = NORMAL. In WAL mode, this is the optimal + // setting for high-concurrency daemons. It prevents database corruption + // during power loss or hard crashes while offering much faster write + // performance than FULL mode, sacrificing only a few milliseconds of + // un-checkpointed durability. + // See: https://www.sqlite.org/pragma.html#pragma_synchronous + "&_synchronous=1" + + db, err := sql.Open("sqlite3", dsn) + if err != nil { + return nil, fmt.Errorf("failed to open database: %w", err) + } + + db.SetMaxOpenConns(maxOpenConns) + db.SetMaxIdleConns(maxIdleConns) + // Sets the maximum amount of time a connection may be reused to infinity + // (0). This guarantees the single connection never expires. + db.SetConnMaxLifetime(0) + + store := &Store{ + db: db, + log: log, + } + + // Only a single process enters this execution block at a time. + if err := store.initSchema(ctx); err != nil { + db.Close() + return nil, fmt.Errorf("failed to initialize schema: %w", err) + } + + log.Info("Initialized or updated database schema", "path", dbPath) + + return store, nil +} + +// initSchema creates the necessary tables if they don't exist. +func (s *Store) initSchema(ctx context.Context) error { + var currentVersion int + err := s.db.QueryRowContext(ctx, "PRAGMA user_version").Scan(¤tVersion) + if err != nil { + return fmt.Errorf("failed to check schema version: %w", err) + } + + if currentVersion == dbSchemaVersion { + s.log.V(4).Info("Database schema already initialized", "version", currentVersion) + return nil + } + + s.log.Info("Initializing DB schema", "currentVersion", currentVersion, "expectedVersion", dbSchemaVersion) + + // 1. Begin an atomic transaction + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return fmt.Errorf("failed to begin transaction: %w", err) + } + // Safe to defer; Rollback does nothing if Commit() is successful + defer tx.Rollback() + + // 2. Execute the embedded schema.sql file + if _, err := tx.ExecContext(ctx, schemaSQL); err != nil { + return fmt.Errorf("failed to execute schema.sql: %w", err) + } + + // 3. Set User Version + setVersion := fmt.Sprintf("PRAGMA user_version = %d;", dbSchemaVersion) + if _, err := tx.ExecContext(ctx, setVersion); err != nil { + return fmt.Errorf("failed to set user_version: %w", err) + } + + // 4. Commit everything atomically + if err := tx.Commit(); err != nil { + return fmt.Errorf("failed to commit schema transaction: %w", err) + } + + s.log.Info("Database schema initialized or updated successfully") + return nil +} + +// Close safely closes the database connection and releases any file locks. +// This should be called during the daemon's graceful shutdown sequence. +func (s *Store) Close() error { + s.log.Info("Closing IPAM database connection") + + if err := s.db.Close(); err != nil { + return fmt.Errorf("failed to close database connection: %w", err) + } + + return nil +} + +// DB returns the underlying sql.DB connection for direct queries. +func (s *Store) DB() *sql.DB { + return s.db +} + +// allocateIPv4Tx is a helper that executes the IP allocation within an existing transaction. +// It returns sql.ErrNoRows if the CIDR block is full or not found, allowing the caller to try another block. +func (s *Store) allocateIPv4Tx(ctx context.Context, tx *sql.Tx, cidrBlockID int64, interfaceName, containerID string) (string, string, error) { + // 1. Fetch CIDR range for the given ID and verify it is not full + var cidrRange string + err := tx.QueryRowContext(ctx, ` + SELECT cidr FROM cidr_blocks + WHERE id = ? AND ip_family = 'ipv4' AND total_ips > allocated_ips AND state = 'Ready' + `, cidrBlockID).Scan(&cidrRange) + + if err != nil { + if err == sql.ErrNoRows { + return "", "", sql.ErrNoRows + } + return "", "", fmt.Errorf("failed to query cidr_block: %w", err) + } + + // 2. Find the first available entry and mark it as allocated + var address string + err = tx.QueryRowContext(ctx, ` + UPDATE ip_addresses + SET is_allocated = TRUE, container_id = ?, interface_name = ?, allocated_at = CURRENT_TIMESTAMP + WHERE id = ( + SELECT id FROM ip_addresses + WHERE cidr_block_id = ? AND is_allocated = FALSE AND (release_at IS NULL OR release_at <= CURRENT_TIMESTAMP) + ORDER BY id ASC + LIMIT 1 + ) + RETURNING address + `, containerID, interfaceName, cidrBlockID).Scan(&address) + + if err != nil { + if err == sql.ErrNoRows { + return "", "", sql.ErrNoRows + } + return "", "", fmt.Errorf("failed to allocate ip: %w", err) + } + + // Also increment allocated_ips in cidr_blocks to keep it in sync + _, err = tx.ExecContext(ctx, ` + UPDATE cidr_blocks + SET allocated_ips = allocated_ips + 1 + WHERE id = ? + `, cidrBlockID) + + if err != nil { + return "", "", fmt.Errorf("failed to update allocated_ips in cidr_blocks: %w", err) + } + + return address, cidrRange, nil +} + +// tryAllocateIPv4 attempts to allocate an IP in a specific CIDR block. +// It returns sql.ErrNoRows if the block is full, allowing the caller to continue. +func (s *Store) tryAllocateIPv4(ctx context.Context, cidrBlockID int64, containerID, interfaceName string) (string, string, error) { + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return "", "", fmt.Errorf("failed to begin transaction: %w", err) + } + defer tx.Rollback() + + var address, cidrRange string + err = tx.QueryRowContext(ctx, ` + SELECT i.address, c.cidr + FROM ip_addresses i + JOIN cidr_blocks c ON i.cidr_block_id = c.id + WHERE i.container_id = ? AND i.interface_name = ? AND i.is_allocated = TRUE AND c.ip_family = 'ipv4' + LIMIT 1 + `, containerID, interfaceName).Scan(&address, &cidrRange) + + if err == nil { + s.log.Info("Idempotency check hit (slow path), returning existing allocation", "containerID", containerID, "interfaceName", interfaceName, "address", address, "cidr", cidrRange) + return address, cidrRange, nil + } + if err != sql.ErrNoRows { + return "", "", fmt.Errorf("failed during slow-path idempotency check: %w", err) + } + + ip, cidr, err := s.allocateIPv4Tx(ctx, tx, cidrBlockID, interfaceName, containerID) + if err != nil { + return "", "", err // Propagates sql.ErrNoRows + } + + if err := tx.Commit(); err != nil { + return "", "", fmt.Errorf("failed to commit transaction: %w", err) + } + + return ip, cidr, nil +} + +// AllocateIPv4 finds the first available IP from Ready CIDR blocks for a given network and allocates it. +// It also performs an idempotency check to see if the container already has an IP allocated. +func (s *Store) AllocateIPv4(ctx context.Context, network, interfaceName, containerID string) (string, string, error) { + // 1. Idempotency check (Fast Path - outside write transaction) + var address string + var cidrRange string + err := s.db.QueryRowContext(ctx, ` + SELECT i.address, c.cidr + FROM ip_addresses i + JOIN cidr_blocks c ON i.cidr_block_id = c.id + WHERE i.container_id = ? AND i.interface_name = ? AND i.is_allocated = TRUE AND c.ip_family = 'ipv4' + LIMIT 1 + `, containerID, interfaceName).Scan(&address, &cidrRange) + + if err == nil { + s.log.Info("Idempotency check hit (fast path), returning existing allocation", "containerID", containerID, "interfaceName", interfaceName, "address", address, "cidr", cidrRange) + return address, cidrRange, nil + } + if err != sql.ErrNoRows { + return "", "", fmt.Errorf("failed during fast-path idempotency check: %w", err) + } + + // 2. Query available CIDRs (Outside write transaction) + rows, err := s.db.QueryContext(ctx, ` + SELECT id FROM cidr_blocks + WHERE network = ? AND ip_family = 'ipv4' AND total_ips > allocated_ips AND state = 'Ready' + `, network) + if err != nil { + return "", "", fmt.Errorf("failed to query available cidr blocks: %w", err) + } + defer rows.Close() + + var cidrBlockIDs []int64 + for rows.Next() { + var id int64 + if err := rows.Scan(&id); err != nil { + return "", "", fmt.Errorf("failed to scan cidr block id: %w", err) + } + cidrBlockIDs = append(cidrBlockIDs, id) + } + + if len(cidrBlockIDs) == 0 { + return "", "", fmt.Errorf("%w: no available cidr blocks found for network %s", ErrNoAvailableIPs, network) + } + + // 3. Loop and try to allocate with short transactions + for _, cidrBlockID := range cidrBlockIDs { + ip, cidr, err := s.tryAllocateIPv4(ctx, cidrBlockID, containerID, interfaceName) + if err == nil { + return ip, cidr, nil + } + if err == sql.ErrNoRows { + s.log.V(4).Info("No available IPs in cidr block, tried next one", "cidrBlockID", cidrBlockID) + continue + } + return "", "", fmt.Errorf("failed to allocate ipv4 in cidr block %d: %w", cidrBlockID, err) + } + + return "", "", fmt.Errorf("%w: failed to allocate ipv4 in any cidr block for network %s", ErrNoAvailableIPs, network) +} + +// GetCIDRBlockByCIDR checks if a CIDR block already exists in the database. +func (s *Store) GetCIDRBlockByCIDR(ctx context.Context, cidr string) (bool, error) { + var id int64 + err := s.db.QueryRowContext(ctx, ` + SELECT id FROM cidr_blocks WHERE cidr = ? LIMIT 1 + `, cidr).Scan(&id) + + if err == nil { + return true, nil + } + if err == sql.ErrNoRows { + return false, nil + } + return false, fmt.Errorf("failed to query cidr_blocks: %w", err) +} + +// AddCIDR parses the CIDR, determines family, and inserts it + its constituent IP addresses into the store. +// The first two IPs and the last IP are automatically marked as allocated. +func (s *Store) AddCIDR(ctx context.Context, network, cidr string) error { + ip, ipnet, err := net.ParseCIDR(cidr) + if err != nil { + return fmt.Errorf("failed to parse cidr %s: %w", cidr, err) + } + + ipFamily := "ipv4" + if ip.To4() == nil { + ipFamily = "ipv6" + } + + // Generate the list of all IPs in this CIDR range + var ips []string + for curr := ipnet.IP.Mask(ipnet.Mask); ipnet.Contains(curr); curr = incIP(curr) { + ips = append(ips, curr.String()) + } + + if len(ips) == 0 { + return fmt.Errorf("cidr range is empty: %s", cidr) + } + + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return fmt.Errorf("failed to begin transaction: %w", err) + } + defer tx.Rollback() + + // 1. Insert into cidr_blocks + res, err := tx.ExecContext(ctx, ` + INSERT INTO cidr_blocks (cidr, network, ip_family, total_ips, allocated_ips, state) + VALUES (?, ?, ?, ?, ?, 'Ready') + `, cidr, network, ipFamily, len(ips), 0) // We will update allocated_ips later after insertions + + if err != nil { + if sqliteErr, ok := err.(sqlite3.Error); ok { + if sqliteErr.ExtendedCode == sqlite3.ErrConstraintUnique { + return fmt.Errorf("%w: %v", ErrCidrAlreadyExists, err) + } + } + return fmt.Errorf("failed to insert cidr_block: %w", err) + } + + cidrBlockID, err := res.LastInsertId() + if err != nil { + return fmt.Errorf("failed to get last inserted id: %w", err) + } + + // 2. Insert IP addresses and determine allocation status + var allocatedCount int + stmt, err := tx.PrepareContext(ctx, ` + INSERT INTO ip_addresses (cidr_block_id, address, is_allocated, container_id, interface_name) + VALUES (?, ?, ?, '', '') + `) + if err != nil { + return fmt.Errorf("failed to prepare insert statement: %w", err) + } + defer stmt.Close() + + for idx, addr := range ips { + isAllocated := false + // For small CIDRs (smaller than /30, i.e., /31 and /32), we do not reserve + // the first two and the last IPs. The IPs returned will still be routable + // by the underlying infrastructure. + if len(ips) >= 4 && (idx == 0 || idx == 1 || idx == len(ips)-1) { + isAllocated = true + allocatedCount++ + } + + _, err = stmt.ExecContext(ctx, cidrBlockID, addr, isAllocated) + if err != nil { + return fmt.Errorf("failed to insert ip_address %s: %w", addr, err) + } + } + + // 3. Update allocated_ips to reflect the defaults we just reserved + _, err = tx.ExecContext(ctx, ` + UPDATE cidr_blocks SET allocated_ips = ? WHERE id = ? + `, allocatedCount, cidrBlockID) + if err != nil { + return fmt.Errorf("failed to update allocated_ips: %w", err) + } + + if err := tx.Commit(); err != nil { + return fmt.Errorf("failed to commit transaction: %w", err) + } + + s.log.Info("Successfully added CIDR and its IPs to store", "cidr", cidr, "network", network, "totalIPs", len(ips), "reservedIPs", allocatedCount) + return nil +} + +// incIP increments an IP address. +func incIP(ip net.IP) net.IP { + newIP := make(net.IP, len(ip)) + copy(newIP, ip) + for i := len(newIP) - 1; i >= 0; i-- { + newIP[i]++ + if newIP[i] > 0 { + break + } + } + return newIP +} + +// ReleaseIPByOwner updates all IP addresses matching the network, container id and interface name to be is_allocated = FALSE, and sets release_at timestamp to be now + releaseCooldown. It also decrements allocated_ips count in cidr_blocks. +func (s *Store) ReleaseIPByOwner(ctx context.Context, network, containerID, interfaceName string, releaseCooldown time.Duration) (int, error) { + tx, err := s.db.BeginTx(ctx, nil) + if err != nil { + return 0, fmt.Errorf("failed to begin transaction: %w", err) + } + defer tx.Rollback() + + releaseAt := time.Now().Add(releaseCooldown) + + rows, err := tx.QueryContext(ctx, ` + SELECT i.id, i.cidr_block_id + FROM ip_addresses i + JOIN cidr_blocks c ON i.cidr_block_id = c.id + WHERE c.network = ? AND i.container_id = ? AND i.interface_name = ? AND i.is_allocated = TRUE + `, network, containerID, interfaceName) + + if err != nil { + return 0, fmt.Errorf("failed to query matching IP owners: %w", err) + } + defer rows.Close() + + type release struct { + id int64 + cidrBlockID int64 + } + var releases []release + + for rows.Next() { + var r release + if err := rows.Scan(&r.id, &r.cidrBlockID); err != nil { + return 0, fmt.Errorf("failed to scan affected IP details: %w", err) + } + releases = append(releases, r) + } + + for _, r := range releases { + _, err = tx.ExecContext(ctx, ` + UPDATE ip_addresses + SET is_allocated = FALSE, release_at = ? + WHERE id = ? + `, releaseAt, r.id) + if err != nil { + return 0, fmt.Errorf("failed to release IP %d: %w", r.id, err) + } + + _, err = tx.ExecContext(ctx, ` + UPDATE cidr_blocks + SET allocated_ips = allocated_ips - 1 + WHERE id = ? + `, r.cidrBlockID) + if err != nil { + return 0, fmt.Errorf("failed to update cidr_block %d count: %w", r.cidrBlockID, err) + } + } + + if err := tx.Commit(); err != nil { + return 0, fmt.Errorf("failed to commit release transaction: %w", err) + } + + return len(releases), nil +} diff --git a/metis/pkg/store/store_test.go b/metis/pkg/store/store_test.go new file mode 100644 index 0000000000..6008828ac5 --- /dev/null +++ b/metis/pkg/store/store_test.go @@ -0,0 +1,799 @@ +/* +Copyright 2026 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. +*/ + +package store + +import ( + "context" + "database/sql" + "errors" + "fmt" + "path/filepath" + "sync" + "testing" + "time" + + "github.com/go-logr/logr" + _ "github.com/mattn/go-sqlite3" // SQLite driver +) + +// TestNewStore_SuccessAndClose verifies that a new Store can be created, +// the schema is successfully initialized, and the database closes cleanly. +func TestNewStore_SuccessAndClose(t *testing.T) { + tmpDir := t.TempDir() + dbPath := filepath.Join(tmpDir, "test_ipam.db") + logger := logr.Discard() + + store, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + if store == nil { + t.Fatal("Expected a valid Store instance, got nil") + } + + // Verify tables were actually created. + var tableName string + err = store.db.QueryRow("SELECT name FROM sqlite_master WHERE type='table' AND name='cidr_blocks';").Scan(&tableName) + if err != nil || tableName != "cidr_blocks" { + t.Errorf("Expected table 'cidr_blocks' to exist, got error: %v", err) + } + + // Verify the database connection is alive. + if err := store.db.Ping(); err != nil { + t.Errorf("Database ping failed: %v", err) + } + + if err := store.Close(); err != nil { + t.Errorf("Store.Close() failed: %v", err) + } +} + +// TestNewStore_Idempotency verifies idempotency by ensuring a second +// initialization safely skips schema creation. By intentionally dropping an +// index after the first run, the test deterministically proves that the second +// execution short-circuits and leaves the index uncreated. +func TestNewStore_Idempotency(t *testing.T) { + tmpDir := t.TempDir() + dbPath := filepath.Join(tmpDir, "idempotency_test.db") + logger := logr.Discard() + + // Initial creation sets up the full schema and user_version = 1. + store1, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("First NewStore call failed: %v", err) + } + if err := store1.Close(); err != nil { + t.Fatalf("Failed to close first store: %v", err) + } + + // Sabotage the schema slightly to prove the bypass works. Manually connect + // and drop an index that initSchema would normally create. + db, err := sql.Open("sqlite3", dbPath) + if err != nil { + t.Fatalf("Failed to open DB for manual intervention: %v", err) + } + if _, err := db.Exec("DROP INDEX idx_ip_idempotency;"); err != nil { + t.Fatalf("Failed to manually drop index: %v", err) + } + db.Close() + + // If the short-circuit works, it will see user_version=1 and return early, + // meaning it will NOT execute the CREATE statements to fix the missing index. + store2, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("Second NewStore call failed: %v", err) + } + defer store2.Close() + + // Verify the index is still missing. + var name string + query := "SELECT name FROM sqlite_master WHERE type='index' AND name='idx_ip_idempotency';" + err = store2.db.QueryRow(query).Scan(&name) + + if err == nil { + // If err is nil, it means the query found the index, which means the + // schema block executed and recreated it. + t.Errorf("Expected index 'idx_ip_idempotency' to be missing, but it was recreated. Short-circuit failed.") + } else if err != sql.ErrNoRows { + // If an error other than ErrNoRows occurs, the query failed unexpectedly. + t.Fatalf("Unexpected error querying sqlite_master: %v", err) + } +} + +// TestNewStore_SchemaVerification rigorously checks the sqlite_master table +// to ensure all expected tables, indexes, and triggers were successfully +// created during initialization. +func TestNewStore_SchemaVerification(t *testing.T) { + tmpDir := t.TempDir() + dbPath := filepath.Join(tmpDir, "schema_test.db") + logger := logr.Discard() + + store, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + defer store.Close() + + // Define the expected schema components. + expectedTables := []string{"cidr_blocks", "ip_addresses"} + expectedIndexes := []string{"idx_available_ips", "idx_ip_idempotency"} + expectedTriggers := []string{"update_cidr_blocks_updated_at", "update_ip_addresses_updated_at"} + + // Verify Tables. + for _, table := range expectedTables { + var name string + query := "SELECT name FROM sqlite_master WHERE type='table' AND name=?;" + if err := store.db.QueryRow(query, table).Scan(&name); err != nil { + t.Errorf("Schema verification failed: expected table '%s' not found: %v", table, err) + } + } + + // Verify Indexes. + for _, index := range expectedIndexes { + var name string + query := "SELECT name FROM sqlite_master WHERE type='index' AND name=?;" + if err := store.db.QueryRow(query, index).Scan(&name); err != nil { + t.Errorf("Schema verification failed: expected index '%s' not found: %v", index, err) + } + } + + // Verify Triggers. + for _, trigger := range expectedTriggers { + var name string + query := "SELECT name FROM sqlite_master WHERE type='trigger' AND name=?;" + if err := store.db.QueryRow(query, trigger).Scan(&name); err != nil { + t.Errorf("Schema verification failed: expected trigger '%s' not found: %v", trigger, err) + } + } +} + +// TestStore_Concurrency verifies that the SQLite connection pool and +// transaction locks (_txlock=immediate, MaxOpenConns=10) can successfully +// handle high bursts of concurrent requests without throwing SQLITE_BUSY +// errors. It achieves maximum contention by spawning multiple goroutines and +// using a broadcast channel as a "starting gun" to release them at the exact +// same logical moment. +func TestStore_Concurrency(t *testing.T) { + dbPath := filepath.Join(t.TempDir(), "ipam-concurrency.db") + s, err := NewStore(context.Background(), logr.Discard(), dbPath) + if err != nil { + t.Fatalf("Failed to initialize store: %v", err) + } + defer s.Close() + + var wg sync.WaitGroup + numGoroutines := 10 + + // Create the Starting Line channel. + startLine := make(chan struct{}) + + // Simulate 10 concurrent gRPC requests hitting the database. + for i := 0; i < numGoroutines; i++ { + wg.Add(1) + go func(id int) { + defer wg.Done() + + // Block this goroutine until the starting gun fires. + <-startLine + + // Simulate an Insert. + cidr := fmt.Sprintf("10.0.%d.0/24", id) + insertQuery := `INSERT INTO cidr_blocks (cidr, network, ip_family, total_ips, allocated_ips, state) + VALUES (?, 'test-network', 'ipv4', 256, 0, 'Ready')` + + _, err := s.db.Exec(insertQuery, cidr) + if err != nil { + t.Errorf("Goroutine %d failed to insert: %v", id, err) + return + } + + // Simulate a Read. + var state string + readQuery := `SELECT state FROM cidr_blocks WHERE cidr = ?` + err = s.db.QueryRow(readQuery, cidr).Scan(&state) + if err != nil { + t.Errorf("Goroutine %d failed to read: %v", id, err) + return + } + }(i) + } + + // Fire the starting gun! + // Closing the channel instantly releases all 10 blocked goroutines at the exact same time. + close(startLine) + + // Wait for all goroutines to finish. + wg.Wait() +} + +// TestStore_MaxOpenConns_Limit verifies that the connection pool can fan out +// to the configured maxOpenConns limit. It proves this by holding +// (maxOpenConns - 1) read connections hostage and ensuring the final allowed +// concurrent query can still execute successfully without hitting a pool bottleneck. +func TestStore_MaxOpenConns_Limit(t *testing.T) { + dbPath := filepath.Join(t.TempDir(), "ipam-pool-limit.db") + s, err := NewStore(context.Background(), logr.Discard(), dbPath) + if err != nil { + t.Fatalf("Failed to initialize store: %v", err) + } + defer s.Close() + + // Dynamically scale the test based on the Store's configuration + hostageCount := s.db.Stats().MaxOpenConnections - 1 + connAcquired := make(chan struct{}, hostageCount) + releaseHostages := make(chan struct{}) + var wg sync.WaitGroup + + // 1. Take (maxOpenConns - 1) connections hostage using unclosed read queries + for i := range hostageCount { + wg.Add(1) + go func(id int) { + defer wg.Done() + + rows, err := s.db.Query(`SELECT state FROM cidr_blocks`) + if err != nil { + t.Errorf("Goroutine %d failed to execute read query: %v", id, err) + return + } + defer rows.Close() + + connAcquired <- struct{}{} + <-releaseHostages + }(i) + } + + // Wait for all hostage connections to be checked out of the pool. + // We use a 1-second timeout to prevent the test from hanging indefinitely + // if the connection pool is configured smaller than hostageCount. + timeout := time.After(1 * time.Second) + for i := 0; i < hostageCount; i++ { + select { + case <-connAcquired: + // Connection successfully acquired + case <-timeout: + t.Fatalf("Test timed out waiting to acquire %d connections. MaxOpenConns is likely configured lower than the expected limit.", hostageCount) + } + } + + // 2. Execute the final allowed query to reach maxOpenConns + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + defer cancel() + + var state string + err = s.db.QueryRowContext(ctx, `SELECT state FROM cidr_blocks LIMIT 1`).Scan(&state) + + if err != nil && err != sql.ErrNoRows { + t.Fatalf("Final concurrent query failed (pool limit reached prematurely): %v", err) + } + + // 3. Clean up + close(releaseHostages) + wg.Wait() +} + +func TestStore_AddCIDR(t *testing.T) { + logger := logr.Discard() // Use discard logger to avoid klog dependency in tests + + // Use testing.T.TempDir() which is standard in modern Go and cleans up automatically! + tempDir := t.TempDir() + + dbPath := filepath.Join(tempDir, "metis.sqlite") + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore returned unexpected error: %v", err) + } + defer s.Close() + + network := "gke-pod-network-addcidr" + cidr := "10.0.1.0/29" // 8 IPs: 10.0.1.0 to 10.0.1.7 + + err = s.AddCIDR(context.Background(), network, cidr) + if err != nil { + t.Fatalf("AddCIDR failed: %v", err) + } + + // 1. Verify cidr_block table insertion + var totalIPs, allocatedIPs int + var state string + err = s.db.QueryRow(`SELECT total_ips, allocated_ips, state FROM cidr_blocks WHERE cidr = ?`, cidr).Scan(&totalIPs, &allocatedIPs, &state) + if err != nil { + t.Fatalf("Failed to query inserted cidr_block: %v", err) + } + + if totalIPs != 8 { + t.Errorf("Expected total_ips 8, got %d", totalIPs) + } + if allocatedIPs != 3 { + t.Errorf("Expected allocated_ips 3 (first two and last one reserved), got %d", allocatedIPs) + } + if state != "Ready" { + t.Errorf("Expected state Ready, got %s", state) + } + + // 2. Verify ip_addresses table insertion and allocations + rows, err := s.db.Query(`SELECT address, is_allocated FROM ip_addresses WHERE cidr_block_id = (SELECT id FROM cidr_blocks WHERE cidr = ?) ORDER BY address`, cidr) + if err != nil { + t.Fatalf("Failed to query inserted ip_addresses: %v", err) + } + defer rows.Close() + + var addresses []string + var allocations []bool + for rows.Next() { + var addr string + var isAlloc bool + if err := rows.Scan(&addr, &isAlloc); err != nil { + t.Fatalf("Failed to scan ip_address: %v", err) + } + addresses = append(addresses, addr) + allocations = append(allocations, isAlloc) + } + + expectedAddrs := []string{ + "10.0.1.0", "10.0.1.1", "10.0.1.2", "10.0.1.3", + "10.0.1.4", "10.0.1.5", "10.0.1.6", "10.0.1.7", + } + expectedAllocs := []bool{ + true, true, false, false, + false, false, false, true, + } + + if len(addresses) != len(expectedAddrs) { + t.Fatalf("Expected %d addresses, got %d", len(expectedAddrs), len(addresses)) + } + + for i := range expectedAddrs { + if addresses[i] != expectedAddrs[i] { + t.Errorf("[%d] Expected address %s, got %s", i, expectedAddrs[i], addresses[i]) + } + if allocations[i] != expectedAllocs[i] { + t.Errorf("[%d] Expected allocation %v for address %s, got %v", i, expectedAllocs[i], addresses[i], allocations[i]) + } + } +} + +func TestStore_AddCIDR_Small(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + + dbPath := filepath.Join(tempDir, "metis_small.sqlite") + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore returned unexpected error: %v", err) + } + defer s.Close() + + // Test /31 (2 IPs) + network31 := "gke-pod-network-31" + cidr31 := "10.0.2.0/31" // 2 IPs: 10.0.2.0, 10.0.2.1 + + err = s.AddCIDR(context.Background(), network31, cidr31) + if err != nil { + t.Fatalf("AddCIDR failed for /31: %v", err) + } + + var allocatedIPs31 int + err = s.db.QueryRow(`SELECT allocated_ips FROM cidr_blocks WHERE cidr = ?`, cidr31).Scan(&allocatedIPs31) + if err != nil { + t.Fatalf("Failed to query inserted cidr_block for /31: %v", err) + } + if allocatedIPs31 != 0 { + t.Errorf("Expected allocated_ips 0 for /31, got %d", allocatedIPs31) + } + + // Test /32 (1 IP) + network32 := "gke-pod-network-32" + cidr32 := "10.0.3.0/32" // 1 IP: 10.0.3.0 + + err = s.AddCIDR(context.Background(), network32, cidr32) + if err != nil { + t.Fatalf("AddCIDR failed for /32: %v", err) + } + + var allocatedIPs32 int + err = s.db.QueryRow(`SELECT allocated_ips FROM cidr_blocks WHERE cidr = ?`, cidr32).Scan(&allocatedIPs32) + if err != nil { + t.Fatalf("Failed to query inserted cidr_block for /32: %v", err) + } + if allocatedIPs32 != 0 { + t.Errorf("Expected allocated_ips 0 for /32, got %d", allocatedIPs32) + } +} + +func TestStore_AllocateIPv4_SingleCIDR(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + + dbPath := filepath.Join(tempDir, "metis_allocate_network_single.sqlite") + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore returned unexpected error: %v", err) + } + defer s.Close() + + network := "gke-pod-network-allocate" + cidr := "10.0.2.0/29" // 8 IPs: .0 to .7. Reserved: .0, .1, .7. Available: .2, .3, .4, .5, .6. + + // Test Case 1: Error - No CIDR blocks found (DB empty) + _, _, err = s.AllocateIPv4(context.Background(), network, "eth0", "container-1") + if err == nil { + t.Error("Expected error for no CIDR blocks, got nil") + } else if !errors.Is(err, ErrNoAvailableIPs) { + t.Errorf("Expected ErrNoAvailableIPs, got %v", err) + } + + // Add the CIDR + if err := s.AddCIDR(context.Background(), network, cidr); err != nil { + t.Fatalf("AddCIDR failed: %v", err) + } + + // Test Case 2: Happy path - First allocation + ip1, cidrRange1, err := s.AllocateIPv4(context.Background(), network, "eth0", "container-1") + if err != nil { + t.Fatalf("First allocation failed: %v", err) + } + if ip1 != "10.0.2.2" { + t.Errorf("Expected IP 10.0.2.2, got %s", ip1) + } + if cidrRange1 != cidr { + t.Errorf("Expected CIDR range %s, got %s", cidr, cidrRange1) + } + + // Verify DB state for first allocation + var isAlloc bool + var containerID, interfaceName string + err = s.db.QueryRow(`SELECT is_allocated, container_id, interface_name FROM ip_addresses WHERE address = '10.0.2.2'`).Scan(&isAlloc, &containerID, &interfaceName) + if err != nil { + t.Fatalf("Failed to query DB for IP status: %v", err) + } + if !isAlloc { + t.Error("Expected IP 10.0.2.2 to be marked as allocated") + } + if containerID != "container-1" || interfaceName != "eth0" { + t.Errorf("Expected container-1/eth0, got %s/%s", containerID, interfaceName) + } + + // Test Case 3: Happy path - Second allocation + ip2, _, err := s.AllocateIPv4(context.Background(), network, "eth0", "container-2") + if err != nil { + t.Fatalf("Second allocation failed: %v", err) + } + if ip2 != "10.0.2.3" { + t.Errorf("Expected IP 10.0.2.3, got %s", ip2) + } + + // Test Case 4: Exhaust allocation + // We had 5 available IPs: .2, .3, .4, .5, .6. + // We already allocated .2 and .3. + // Let's allocate .4, .5, .6. + for i := 4; i <= 6; i++ { + expectedIP := fmt.Sprintf("10.0.2.%d", i) + ip, _, err := s.AllocateIPv4(context.Background(), network, "eth0", fmt.Sprintf("container-%d", i)) + if err != nil { + t.Fatalf("Allocation failed for %s: %v", expectedIP, err) + } + if ip != expectedIP { + t.Errorf("Expected IP %s, got %s", expectedIP, ip) + } + } + + // Now it should be exhausted. Next allocation should fail. + ipEx, _, err := s.AllocateIPv4(context.Background(), network, "eth0", "container-exhaust") + if err == nil { + t.Errorf("Expected error for exhausted CIDR, got nil. Returned IP: %s", ipEx) + } else if !errors.Is(err, ErrNoAvailableIPs) { + t.Errorf("Expected ErrNoAvailableIPs, got %v", err) + } + + // Test Case 5: Error - No available IP address found (desync) + newNetwork := "gke-pod-network-2" + newCIDR := "10.0.3.0/29" + if err := s.AddCIDR(context.Background(), newNetwork, newCIDR); err != nil { + t.Fatalf("Failed to add new CIDR: %v", err) + } + + var newCidrBlockID int64 + err = s.db.QueryRow("SELECT id FROM cidr_blocks WHERE cidr = ?", newCIDR).Scan(&newCidrBlockID) + if err != nil { + t.Fatalf("Failed to get cidr_block_id: %v", err) + } + + // Manually mark all IPs as allocated in `ip_addresses` to simulate desync + _, err = s.db.Exec(`UPDATE ip_addresses SET is_allocated = TRUE WHERE cidr_block_id = ?`, newCidrBlockID) + if err != nil { + t.Fatalf("Failed to manually corrupt DB: %v", err) + } + + ipDesync, _, err := s.AllocateIPv4(context.Background(), newNetwork, "eth0", "container-desync") + if err == nil { + t.Errorf("Expected error due to IP address desync, got nil. Returned IP: %s", ipDesync) + } else if !errors.Is(err, ErrNoAvailableIPs) { + t.Errorf("Expected ErrNoAvailableIPs, got %v", err) + } +} + +func TestStore_ReleaseIPByOwner(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "metis_release_test.sqlite") + + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + defer s.Close() + + network := "test-network" + cidr := "10.0.1.0/24" + + if err := s.AddCIDR(context.Background(), network, cidr); err != nil { + t.Fatalf("AddCIDR failed: %v", err) + } + + var cidrBlockID int64 + err = s.db.QueryRow("SELECT id FROM cidr_blocks WHERE cidr = ?", cidr).Scan(&cidrBlockID) + if err != nil { + t.Fatalf("Failed to query cidr_block_id: %v", err) + } + + containerID := "test-container" + interfaceName := "eth0" + + ip, _, err := s.AllocateIPv4(context.Background(), network, interfaceName, containerID) + if err != nil { + t.Fatalf("AllocateIPv4 failed: %v", err) + } + + var allocatedIPs int + err = s.db.QueryRow("SELECT allocated_ips FROM cidr_blocks WHERE id = ?", cidrBlockID).Scan(&allocatedIPs) + if err != nil { + t.Fatalf("QueryRow failed: %v", err) + } + if allocatedIPs != 4 { // 3 reserved + 1 allocated + t.Errorf("Expected 4 allocated IPs, got %d", allocatedIPs) + } + + cooloff := 1 * time.Minute + count, err := s.ReleaseIPByOwner(context.Background(), network, containerID, interfaceName, cooloff) + if err != nil { + t.Fatalf("ReleaseIPByOwner failed: %v", err) + } + if count != 1 { + t.Errorf("Expected 1 IP to be released, got %d", count) + } + + err = s.db.QueryRow("SELECT allocated_ips FROM cidr_blocks WHERE id = ?", cidrBlockID).Scan(&allocatedIPs) + if err != nil { + t.Fatalf("QueryRow failed after release: %v", err) + } + if allocatedIPs != 3 { // Back to 3! + t.Errorf("Expected 3 allocated IPs after release, got %d", allocatedIPs) + } + + var isAlloc bool + var releaseAt sql.NullTime + err = s.db.QueryRow("SELECT is_allocated, release_at FROM ip_addresses WHERE address = ?", ip).Scan(&isAlloc, &releaseAt) + if err != nil { + t.Fatalf("QueryRow failed for IP status: %v", err) + } + if isAlloc { + t.Error("Expected IP to be unallocated") + } + if !releaseAt.Valid { + t.Error("Expected release_at to be valid") + } +} + +func TestStore_AllocateIPv4_FallbackAndCooldown(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "fallback_test.sqlite") + + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + defer s.Close() + + network := "test-network" + cidr1 := "10.0.1.0/29" // 5 available addresses (.2 to .6) + + if err := s.AddCIDR(context.Background(), network, cidr1); err != nil { + t.Fatalf("AddCIDR failed: %v", err) + } + + // 1. Allocate 5 IPs to exhaust the first CIDR + for i := 1; i <= 5; i++ { + _, _, err := s.AllocateIPv4(context.Background(), network, "eth0", fmt.Sprintf("container-%d", i)) + if err != nil { + t.Fatalf("Failed to allocate container-%d: %v", i, err) + } + } + + // 2. Attempting to allocate another should FAIL because the first CIDR is full + _, _, err = s.AllocateIPv4(context.Background(), network, "eth0", "container-6") + if err == nil { + t.Error("Expected AllocateIPv4 to fail when first CIDR is full, got nil") + } + + // 3. Add a second CIDR block + cidr2 := "10.0.2.0/29" + if err := s.AddCIDR(context.Background(), network, cidr2); err != nil { + t.Fatalf("Failed to add second CIDR block: %v", err) + } + + // 4. Try allocating again, it should succeed by falling back to the second CIDR + ip, cidr, err := s.AllocateIPv4(context.Background(), network, "eth0", "container-7") + if err != nil { + t.Fatalf("AllocateIPv4 failed after adding second CIDR: %v", err) + } + + if ip != "10.0.2.2" { // First available in second CIDR + t.Errorf("Expected IP 10.0.2.2 from second CIDR, got %s", ip) + } + if cidr != cidr2 { + t.Errorf("Expected CIDR %s, got %s", cidr2, cidr) + } + + // 5. Release one IP with cooldown + _, err = s.ReleaseIPByOwner(context.Background(), network, "container-1", "eth0", 1*time.Hour) + if err != nil { + t.Fatalf("ReleaseIPByOwner failed: %v", err) + } + + // 6. Try to re-allocate for a NEW container. It should NOT pick the released IP (since it's in cooldown). + // It should pick the next available in the second CIDR (since first CIDR is full except for the cooled-down one). + ipNew, _, err := s.AllocateIPv4(context.Background(), network, "eth0", "container-new") + if err != nil { + t.Fatalf("AllocateIPv4 failed after release with cooldown: %v", err) + } + + if ipNew == "10.0.1.2" { + t.Errorf("Expected different IP from 10.0.1.2 which should be in release cooldown") + } +} + +func TestStore_AllocateIPv4_Idempotency_Concurrency(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "idempotency_concurrency_test.sqlite") + + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + defer s.Close() + + network := "test-network" + cidr := "10.0.1.0/24" + + if err := s.AddCIDR(context.Background(), network, cidr); err != nil { + t.Fatalf("AddCIDR failed: %v", err) + } + + containerID := "test-concurrent-container" + interfaceName := "eth0" + + const numGoroutines = 10 + var wg sync.WaitGroup + ips := make([]string, numGoroutines) + errs := make([]error, numGoroutines) + + for i := 0; i < numGoroutines; i++ { + wg.Add(1) + go func(idx int) { + defer wg.Done() + addr, _, err := s.AllocateIPv4(context.Background(), network, interfaceName, containerID) + ips[idx] = addr + errs[idx] = err + }(i) + } + + wg.Wait() + + var firstIP string + for i := 0; i < numGoroutines; i++ { + if errs[i] != nil { + t.Errorf("Goroutine %d failed: %v", i, errs[i]) + } + if ips[i] == "" { + t.Errorf("Goroutine %d returned empty IP", i) + } else { + if firstIP == "" { + firstIP = ips[i] + } else if ips[i] != firstIP { + t.Errorf("Goroutine %d got different IP: %s, want %s", i, ips[i], firstIP) + } + } + } + + // Double check the DB to ensure only 1 row was created + var count int + err = s.DB().QueryRow("SELECT COUNT(*) FROM ip_addresses WHERE container_id = ? AND interface_name = ?", containerID, interfaceName).Scan(&count) + if err != nil { + t.Fatalf("Failed to query DB for count: %v", err) + } + if count != 1 { + t.Errorf("Expected exactly 1 row for container %s, got %d", containerID, count) + } +} + +func TestStore_AllocateIPv4_Concurrency_DifferentContainers(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + dbPath := filepath.Join(tempDir, "concurrency_diff_containers.sqlite") + + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore failed: %v", err) + } + defer s.Close() + + network := "test-network" + cidr := "10.0.1.0/24" // 253 available IPs + + if err := s.AddCIDR(context.Background(), network, cidr); err != nil { + t.Fatalf("AddCIDR failed: %v", err) + } + + const numGoroutines = 50 // High contention + var wg sync.WaitGroup + ips := make([]string, numGoroutines) + errs := make([]error, numGoroutines) + + for i := 0; i < numGoroutines; i++ { + wg.Add(1) + go func(idx int) { + defer wg.Done() + addr, _, err := s.AllocateIPv4(context.Background(), network, "eth0", fmt.Sprintf("container-%d", idx)) + ips[idx] = addr + errs[idx] = err + }(i) + } + + wg.Wait() + + // Verify all succeeded and IPs are unique + uniqueIPs := make(map[string]bool) + for i := 0; i < numGoroutines; i++ { + if errs[i] != nil { + t.Errorf("Goroutine %d failed: %v", i, errs[i]) + } + if ips[i] == "" { + t.Errorf("Goroutine %d returned empty IP", i) + } else { + if uniqueIPs[ips[i]] { + t.Errorf("Duplicate IP allocated: %s", ips[i]) + } + uniqueIPs[ips[i]] = true + } + } + + if len(uniqueIPs) != numGoroutines { + t.Errorf("Expected %d unique IPs, got %d", numGoroutines, len(uniqueIPs)) + } + + // Verify DB stats + var count int + err = s.DB().QueryRow("SELECT COUNT(*) FROM ip_addresses WHERE is_allocated = TRUE AND container_id LIKE 'container-%'").Scan(&count) + if err != nil { + t.Fatalf("Failed to query DB for count: %v", err) + } + if count != numGoroutines { + t.Errorf("Expected %d allocated rows in DB, got %d", numGoroutines, count) + } +} From bebcf172d484f72e75b1034f7c9baf9dd394eb50 Mon Sep 17 00:00:00 2001 From: Arvind Bright Date: Fri, 17 Apr 2026 13:39:03 -0700 Subject: [PATCH 20/78] Refine update-proto.sh to check version before downloading (#1069) --- tools/update-proto.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tools/update-proto.sh b/tools/update-proto.sh index 2b915ecbb3..5f513e373c 100755 --- a/tools/update-proto.sh +++ b/tools/update-proto.sh @@ -33,10 +33,21 @@ TOOLS_BIN="${_TMP_DIR}/bin" mkdir -p "${TOOLS_BIN}" export PATH="${TOOLS_BIN}:${PATH}" -# Install protoc if not present -if ! command -v protoc &> /dev/null; then - echo "protoc not found, installing locally..." - PROTOC_VERSION="34.1" +# Install protoc if not present or version mismatches +PROTOC_VERSION="34.1" +need_install=true +if command -v protoc &> /dev/null; then + curr_version=$(protoc --version | awk '{print $2}') + if [[ "$curr_version" == "$PROTOC_VERSION" ]]; then + need_install=false + echo "Found protoc version $curr_version, skipping installation." + else + echo "Found protoc version $curr_version, but want $PROTOC_VERSION." + fi +fi + +if $need_install; then + echo "Installing protoc locally..." PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-x86_64.zip" PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" @@ -56,14 +67,11 @@ if ! command -v protoc &> /dev/null; then rm -rf "${TMP_PROTOC_DIR}" fi -# Install protoc-gen-go and protoc-gen-go-grpc if not present -if ! command -v protoc-gen-go &> /dev/null || ! command -v protoc-gen-go-grpc &> /dev/null; then - echo "protoc-gen-go/grpc not found, installing..." + echo "Installing protoc-gen-go/grpc..." export GOBIN="${TOOLS_BIN}" go install google.golang.org/protobuf/cmd/protoc-gen-go@latest go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest -fi # Find all proto files outside of vendor and temporary/artifact directories proto_files=$(find . -name "*.proto" -not -path "./vendor/*" -not -path "./_*" ) From bd69ea4c07b64d0a3e4370c77069c4dceaaf4f57 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Mon, 20 Apr 2026 11:43:52 -0700 Subject: [PATCH 21/78] fix: use commit SHA instead of tags for actions (#1066) * fix: use commit SHA instead of tags for actions I think k8s repos started to enforce using commit SHA (which makes sense from security perspective) because the workflow is currently failing with `The action actions/checkout@v4 is not allowed in kubernetes/cloud-provider-gcp because all actions must be pinned to a full-length commit SHA.` Also update dependabot to handle github actions. * fix: use commit SHA for actions/setup-go --- .github/dependabot.yml | 9 +++++++++ .github/workflows/auto-tag.yml | 2 +- .github/workflows/dependabot-sync.yml | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 4dbec43eed..db4a922e91 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,14 @@ version: 2 updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "sunday" + labels: + - "ok-to-test" + - 'area/dependency' + - 'release-note-none' - package-ecosystem: gomod directories: - "/" diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index d127e76857..e4d2e2fe54 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -12,7 +12,7 @@ jobs: contents: write steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: fetch-depth: 0 # Fetch all history and tags diff --git a/.github/workflows/dependabot-sync.yml b/.github/workflows/dependabot-sync.yml index ecbac61f08..a8ae841a8a 100644 --- a/.github/workflows/dependabot-sync.yml +++ b/.github/workflows/dependabot-sync.yml @@ -15,12 +15,12 @@ jobs: if: github.actor == 'dependabot[bot]' steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: ref: ${{ github.event.pull_request.head.ref }} - name: Setup Go - uses: actions/setup-go@v5 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c with: go-version-file: 'go.work' From 83d76f9013cfe6715f9bf4daa02a3a9e711da536 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Mon, 20 Apr 2026 11:44:00 -0700 Subject: [PATCH 22/78] Move update-golang script under tools (#1068) --- {dev/tools => tools}/update-golang | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {dev/tools => tools}/update-golang (100%) diff --git a/dev/tools/update-golang b/tools/update-golang similarity index 100% rename from dev/tools/update-golang rename to tools/update-golang From 97e1609c4a0a9e898f93cdb8203430befbd396a0 Mon Sep 17 00:00:00 2001 From: Marcus Alder Date: Wed, 22 Apr 2026 13:18:43 -0700 Subject: [PATCH 23/78] Add GCP CCM quickstart for kOps (#1027) --- README.md | 4 ++- docs/kops-quickstart.md | 69 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 docs/kops-quickstart.md diff --git a/README.md b/README.md index 1ce32dc39f..86ce437d6d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,9 @@ This repository implements the [cloud provider](https://github.com/kubernetes/cloud-provider) interface for [Google Cloud Platform (GCP)](https://cloud.google.com/). It provides components for Kubernetes clusters running on GCP and is maintained primarily by the Kubernetes team at Google. -To see all available commands in this repository, run `make help`. +To get started with the GCP CCM, see the **[kOps Quickstart](docs/kops-quickstart.md)**. + +For local development, use `make help` to see all available commands. ## Components diff --git a/docs/kops-quickstart.md b/docs/kops-quickstart.md new file mode 100644 index 0000000000..81b0e307da --- /dev/null +++ b/docs/kops-quickstart.md @@ -0,0 +1,69 @@ +# GCP CCM with kOps Quickstart + +This guide provides a quickstart for building and deploying the GCP Cloud Controller Manager (CCM) to a self-managed Kubernetes cluster provisioned with kOps. + +## Prerequisites + +A Google Cloud Platform project with billing enabled. + +## Deployment + +The `make kops-up` target is an end-to-end workflow that automatically: +- Provisions a Kubernetes cluster using kOps. +- Builds the CCM image locally. +- Pushes the image to your Artifact Registry. +- Deploys the CCM (along with required RBAC) to the cluster. + +Run the following commands to get started: + +```sh +# Enable required GCP APIs +gcloud services enable compute.googleapis.com +gcloud services enable artifactregistry.googleapis.com + +# Set environment variables +export GCP_PROJECT=$(gcloud config get-value project) +export GCP_LOCATION=us-central1 +export GCP_ZONES=${GCP_LOCATION}-a +export KOPS_CLUSTER_NAME=kops.k8s.local +export KOPS_STATE_STORE=gs://${GCP_PROJECT}-kops-state + +# Create the state store bucket if it doesn't already exist +gcloud storage buckets create ${KOPS_STATE_STORE} --location=${GCP_LOCATION} || true + +# Run the cluster creation target, may take several minutes +make kops-up +``` + +## Verification + +To verify that the Cloud Controller Manager is running successfully: + +1. **Check the Pod Status**: Verify the pod is `Running` in the `kube-system` namespace. +```sh +kubectl get pods -n kube-system -l component=cloud-controller-manager +``` + +2. **Check Pod Logs**: Look for any errors or access and authentication issues with the GCP API. +```sh +kubectl logs -n kube-system -l component=cloud-controller-manager +``` + +3. **Check Node Initialization**: The CCM should remove the `node.cloudprovider.kubernetes.io/uninitialized` taint once it successfully fetches the node's properties from the GCP API. +```sh +# Ensure no nodes have the uninitialized taint, output should be empty. +kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints | grep uninitialized +``` + +4. **Verify ProviderID**: Check if your nodes are correctly populated with GCP-specific data (e.g., `ProviderID` in the format `gce://...`). +```sh +kubectl describe nodes | grep "ProviderID:" +``` + +## Teardown + +To tear down the cluster and clean up resources: + +```sh +make kops-down +``` From 2a7e7be73b676aae30a7aaa39fad2185c2aa47bd Mon Sep 17 00:00:00 2001 From: Yuan Gao <272339838+ygao-g@users.noreply.github.com> Date: Thu, 23 Apr 2026 18:22:48 +0000 Subject: [PATCH 24/78] Add GitHub Release workflow and config, and pin Actions to SHAs (#1079) --- .github/release.yml | 15 +++++++++++++++ .github/workflows/release.yml | 24 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000000..9b8e61c654 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,15 @@ +changelog: + exclude: + labels: + - ignore-for-release + authors: + - dependabot[bot] + categories: + - title: Features + labels: + - feature + - enhancement + - title: Bug Fixes + labels: + - bug + - fix diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..5e53fd6e09 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Create GitHub Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + fetch-depth: 0 # Important for generating release notes + + - name: Create Draft Release + uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2 + with: + draft: true + generate_release_notes: true From c191271e3a136c2ae1f9223753fb20ab134daf79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 23:16:52 +0530 Subject: [PATCH 25/78] chore(deps): bump softprops/action-gh-release from 2.6.2 to 3.0.0 (#1087) Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.6.2 to 3.0.0. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/3bb12739c298aeb8a4eeaf626c5b8d85266b0e65...b4309332981a82ec1c5618f44dd2e27cc8bfbfda) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-version: 3.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e53fd6e09..c5157d3aaa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 0 # Important for generating release notes - name: Create Draft Release - uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2 + uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 with: draft: true generate_release_notes: true From 61d9a0af3b12867fd7ed4c57a906d69231ff069b Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Mon, 27 Apr 2026 15:00:51 -0700 Subject: [PATCH 26/78] feat: Bump k8s clients to 1.36.0 and go to 1.26.0 (#1089) * Update vendor dependencies * Fix argument mismatch in NewCloudNodeController call * Update module files and versions * Fix format specifier in gce_instances.go * Update Go version to 1.26.0 in Dockerfiles to match go.mod * fix(e2e): replace undefined e2enode.FirstAddress with CollectAddresses --- Dockerfile | 2 +- .../gketenantcontrollermanager.go | 1 + ginko-test-package-version.env | 2 +- go.mod | 141 +- go.sum | 199 +- go.work | 52 +- metis/Dockerfile | 2 +- metis/go.mod | 25 +- metis/go.sum | 47 +- providers/gce/gce_instances.go | 2 +- providers/go.mod | 36 +- providers/go.sum | 78 +- test/e2e/firewall.go | 6 +- test/e2e/go.mod | 98 +- test/e2e/go.sum | 201 +- tools/version.sh | 2 +- .../github.com/cenkalti/backoff/v4/context.go | 62 - .../cenkalti/backoff/v4/exponential.go | 216 - .../github.com/cenkalti/backoff/v4/retry.go | 146 - .../github.com/cenkalti/backoff/v4/tries.go | 38 - .../cenkalti/backoff/{v4 => v5}/.gitignore | 0 .../cenkalti/backoff/v5/CHANGELOG.md | 29 + .../cenkalti/backoff/{v4 => v5}/LICENSE | 0 .../cenkalti/backoff/{v4 => v5}/README.md | 15 +- .../cenkalti/backoff/{v4 => v5}/backoff.go | 14 +- .../github.com/cenkalti/backoff/v5/error.go | 46 + .../cenkalti/backoff/v5/exponential.go | 118 + .../github.com/cenkalti/backoff/v5/retry.go | 139 + .../cenkalti/backoff/{v4 => v5}/ticker.go | 18 +- .../cenkalti/backoff/{v4 => v5}/timer.go | 2 +- .../go-systemd/v22/daemon/sdnotify_other.go | 22 + .../go-systemd/v22/daemon/sdnotify_unix.go | 36 + .../coreos/go-systemd/v22/daemon/watchdog.go | 7 +- .../coreos/go-systemd/v22/journal/journal.go | 2 +- .../go-systemd/v22/journal/journal_unix.go | 10 +- .../emicklei/go-restful/v3/.travis.yml | 13 - .../emicklei/go-restful/v3/CHANGES.md | 4 + .../emicklei/go-restful/v3/README.md | 1 + .../emicklei/go-restful/v3/curly.go | 50 +- .../emicklei/go-restful/v3/custom_verb.go | 34 +- .../github.com/emicklei/go-restful/v3/doc.go | 42 +- vendor/github.com/google/btree/README.md | 10 - .../github.com/google/btree/btree_generic.go | 1083 -- .../google/pprof/profile/profile.go | 2 +- .../github.com/google/pprof/profile/proto.go | 19 +- .../providers/prometheus}/LICENSE | 0 .../providers/prometheus/client_metrics.go | 117 + .../providers/prometheus/client_options.go | 77 + .../providers/prometheus/constants.go | 23 + .../providers/prometheus/doc.go | 8 + .../providers/prometheus/options.go | 152 + .../providers/prometheus/reporter.go | 139 + .../providers/prometheus/server_metrics.go | 163 + .../providers/prometheus/server_options.go | 56 + .../go-grpc-middleware/v2/COPYRIGHT | 2 + .../go-grpc-middleware/v2/LICENSE | 201 + .../v2/interceptors/callmeta.go | 67 + .../v2/interceptors/client.go | 80 + .../go-grpc-middleware/v2/interceptors/doc.go | 12 + .../v2/interceptors/reporter.go | 73 + .../v2/interceptors/server.go | 65 + .../go-grpc-prometheus/.gitignore | 201 - .../go-grpc-prometheus/.travis.yml | 25 - .../go-grpc-prometheus/CHANGELOG.md | 24 - .../go-grpc-prometheus/README.md | 247 - .../go-grpc-prometheus/client.go | 39 - .../go-grpc-prometheus/client_metrics.go | 170 - .../go-grpc-prometheus/client_reporter.go | 46 - .../go-grpc-prometheus/makefile | 16 - .../go-grpc-prometheus/metric_options.go | 41 - .../go-grpc-prometheus/server.go | 48 - .../go-grpc-prometheus/server_metrics.go | 185 - .../go-grpc-prometheus/server_reporter.go | 46 - .../grpc-ecosystem/go-grpc-prometheus/util.go | 50 - .../options/openapiv2.pb.go | 26 +- .../options/openapiv2.proto | 3 + .../options/openapiv2_protoopaque.pb.go | 24 +- .../grpc-gateway/v2/runtime/BUILD.bazel | 1 + .../grpc-gateway/v2/runtime/context.go | 6 +- .../grpc-gateway/v2/runtime/marshal_jsonpb.go | 6 +- .../grpc-gateway/v2/runtime/mux.go | 16 +- vendor/github.com/moby/spdystream/NOTICE | 12 + .../github.com/moby/spdystream/connection.go | 11 +- .../spdystream/spdy}/LICENSE | 22 +- .../github.com/moby/spdystream/spdy/PATENTS | 22 + .../moby/spdystream/spdy/dictionary.go | 16 - .../moby/spdystream/spdy/options.go | 25 + .../github.com/moby/spdystream/spdy/read.go | 58 +- .../github.com/moby/spdystream/spdy/types.go | 49 +- .../github.com/moby/spdystream/spdy/write.go | 81 +- .../mxk/go-flowrate/flowrate/flowrate.go | 267 - .../github.com/mxk/go-flowrate/flowrate/io.go | 133 - .../mxk/go-flowrate/flowrate/util.go | 67 - vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md | 38 + vendor/github.com/onsi/ginkgo/v2/README.md | 4 +- vendor/github.com/onsi/ginkgo/v2/core_dsl.go | 23 +- .../onsi/ginkgo/v2/decorator_dsl.go | 21 + .../onsi/ginkgo/v2/ginkgo/command/command.go | 6 +- .../onsi/ginkgo/v2/ginkgo/internal/run.go | 15 +- .../onsi/ginkgo/v2/ginkgo/run/run_command.go | 2 +- .../onsi/ginkgo/v2/internal/focus.go | 21 +- .../onsi/ginkgo/v2/internal/group.go | 35 +- .../onsi/ginkgo/v2/internal/node.go | 111 +- .../ginkgo/v2/internal/reporters/gojson.go | 47 +- .../onsi/ginkgo/v2/internal/suite.go | 28 +- .../internal/testingtproxy/testing_t_proxy.go | 7 +- .../ginkgo/v2/reporters/default_reporter.go | 27 +- .../onsi/ginkgo/v2/reporters/junit_report.go | 20 + .../ginkgo/v2/reporters/teamcity_report.go | 8 + .../github.com/onsi/ginkgo/v2/types/errors.go | 9 + .../onsi/ginkgo/v2/types/semver_filter.go | 91 +- .../github.com/onsi/ginkgo/v2/types/types.go | 159 +- .../onsi/ginkgo/v2/types/version.go | 2 +- vendor/github.com/onsi/gomega/CHANGELOG.md | 10 + vendor/github.com/onsi/gomega/gomega_dsl.go | 2 +- vendor/github.com/onsi/gomega/matchers.go | 18 + .../matchers/match_error_strictly_matcher.go | 39 + .../prometheus/common/expfmt/decode.go | 14 +- .../prometheus/common/expfmt/expfmt.go | 1 + .../prometheus/common/expfmt/fuzz.go | 1 - .../common/expfmt/openmetrics_create.go | 59 +- .../prometheus/common/expfmt/text_create.go | 58 +- .../prometheus/common/expfmt/text_parse.go | 102 +- .../prometheus/procfs/.golangci.yml | 28 +- vendor/github.com/prometheus/procfs/Makefile | 2 +- .../prometheus/procfs/Makefile.common | 17 +- vendor/github.com/prometheus/procfs/arp.go | 9 +- .../github.com/prometheus/procfs/buddyinfo.go | 10 +- .../github.com/prometheus/procfs/cmdline.go | 2 +- .../github.com/prometheus/procfs/cpuinfo.go | 2 +- .../prometheus/procfs/cpuinfo_armx.go | 2 +- .../prometheus/procfs/cpuinfo_loong64.go | 2 +- .../prometheus/procfs/cpuinfo_mipsx.go | 2 +- .../prometheus/procfs/cpuinfo_others.go | 2 +- .../prometheus/procfs/cpuinfo_ppcx.go | 2 +- .../prometheus/procfs/cpuinfo_riscvx.go | 2 +- .../prometheus/procfs/cpuinfo_s390x.go | 2 +- .../prometheus/procfs/cpuinfo_x86.go | 2 +- vendor/github.com/prometheus/procfs/crypto.go | 2 +- vendor/github.com/prometheus/procfs/doc.go | 2 +- vendor/github.com/prometheus/procfs/fs.go | 2 +- .../prometheus/procfs/fs_statfs_notype.go | 2 +- .../prometheus/procfs/fs_statfs_type.go | 2 +- .../github.com/prometheus/procfs/fscache.go | 9 +- .../prometheus/procfs/internal/fs/fs.go | 2 +- .../prometheus/procfs/internal/util/parse.go | 2 +- .../procfs/internal/util/readfile.go | 2 +- .../procfs/internal/util/sysreadfile.go | 2 +- .../internal/util/sysreadfile_compat.go | 2 +- .../procfs/internal/util/valueparser.go | 2 +- vendor/github.com/prometheus/procfs/ipvs.go | 2 +- .../prometheus/procfs/kernel_hung.go | 45 + .../prometheus/procfs/kernel_random.go | 2 +- .../github.com/prometheus/procfs/loadavg.go | 2 +- vendor/github.com/prometheus/procfs/mdstat.go | 121 +- .../github.com/prometheus/procfs/meminfo.go | 35 +- .../github.com/prometheus/procfs/mountinfo.go | 23 +- .../prometheus/procfs/mountstats.go | 4 +- .../prometheus/procfs/net_conntrackstat.go | 2 +- .../github.com/prometheus/procfs/net_dev.go | 2 +- .../prometheus/procfs/net_dev_snmp6.go | 7 +- .../prometheus/procfs/net_ip_socket.go | 2 +- .../prometheus/procfs/net_protocols.go | 4 +- .../github.com/prometheus/procfs/net_route.go | 2 +- .../prometheus/procfs/net_sockstat.go | 5 +- .../prometheus/procfs/net_softnet.go | 2 +- .../github.com/prometheus/procfs/net_tcp.go | 2 +- .../prometheus/procfs/net_tls_stat.go | 2 +- .../github.com/prometheus/procfs/net_udp.go | 2 +- .../github.com/prometheus/procfs/net_unix.go | 2 +- .../prometheus/procfs/net_wireless.go | 2 +- .../github.com/prometheus/procfs/net_xfrm.go | 2 +- .../github.com/prometheus/procfs/netstat.go | 2 +- .../prometheus/procfs/nfnetlink_queue.go | 85 + vendor/github.com/prometheus/procfs/proc.go | 4 +- .../prometheus/procfs/proc_cgroup.go | 2 +- .../prometheus/procfs/proc_cgroups.go | 8 +- .../prometheus/procfs/proc_environ.go | 2 +- .../prometheus/procfs/proc_fdinfo.go | 13 +- .../prometheus/procfs/proc_interrupts.go | 2 +- .../github.com/prometheus/procfs/proc_io.go | 2 +- .../prometheus/procfs/proc_limits.go | 7 +- .../github.com/prometheus/procfs/proc_maps.go | 2 +- .../prometheus/procfs/proc_netstat.go | 2 +- .../github.com/prometheus/procfs/proc_ns.go | 2 +- .../github.com/prometheus/procfs/proc_psi.go | 2 +- .../prometheus/procfs/proc_smaps.go | 2 +- .../github.com/prometheus/procfs/proc_snmp.go | 2 +- .../prometheus/procfs/proc_snmp6.go | 2 +- .../github.com/prometheus/procfs/proc_stat.go | 14 +- .../prometheus/procfs/proc_statm.go | 116 + .../prometheus/procfs/proc_status.go | 9 +- .../github.com/prometheus/procfs/proc_sys.go | 2 +- .../github.com/prometheus/procfs/schedstat.go | 2 +- vendor/github.com/prometheus/procfs/slab.go | 2 +- .../github.com/prometheus/procfs/softirqs.go | 2 +- vendor/github.com/prometheus/procfs/stat.go | 5 +- vendor/github.com/prometheus/procfs/swaps.go | 2 +- vendor/github.com/prometheus/procfs/thread.go | 2 +- vendor/github.com/prometheus/procfs/vm.go | 2 +- .../github.com/prometheus/procfs/zoneinfo.go | 8 +- vendor/github.com/spf13/cobra/.golangci.yml | 7 + vendor/github.com/spf13/cobra/command.go | 12 +- .../go.etcd.io/etcd/api/v3/version/version.go | 2 +- .../google.golang.org/grpc/otelgrpc/LICENSE | 30 + .../google.golang.org/grpc/otelgrpc/config.go | 297 +- .../grpc/otelgrpc/interceptor.go | 501 +- .../grpc/otelgrpc/internal/parse.go | 19 +- .../grpc/otelgrpc/metadata_supplier.go | 51 +- .../grpc/otelgrpc/semconv.go | 41 - .../grpc/otelgrpc/stats_handler.go | 272 +- .../grpc/otelgrpc/version.go | 12 +- .../instrumentation/net/http/otelhttp/LICENSE | 30 + .../net/http/otelhttp/client.go | 50 - .../net/http/otelhttp/common.go | 2 +- .../net/http/otelhttp/config.go | 24 +- .../instrumentation/net/http/otelhttp/doc.go | 3 +- .../net/http/otelhttp/handler.go | 25 +- .../http/otelhttp/internal/semconv/client.go | 287 + .../net/http/otelhttp/internal/semconv/env.go | 323 - .../net/http/otelhttp/internal/semconv/gen.go | 11 +- .../otelhttp/internal/semconv/httpconv.go | 573 -- .../http/otelhttp/internal/semconv/server.go | 403 + .../http/otelhttp/internal/semconv/util.go | 6 +- .../http/otelhttp/internal/semconv/v1.20.0.go | 273 - .../http/otelhttp/internal/semconvutil/gen.go | 10 - .../otelhttp/internal/semconvutil/httpconv.go | 594 -- .../otelhttp/internal/semconvutil/netconv.go | 214 - .../net/http/otelhttp/transport.go | 93 +- .../net/http/otelhttp/version.go | 5 +- .../otel/exporters/otlp/otlptrace/LICENSE | 30 + .../otel/exporters/otlp/otlptrace/exporter.go | 2 +- .../internal/tracetransform/attribute.go | 5 +- .../tracetransform/instrumentation.go | 3 +- .../internal/tracetransform/resource.go | 3 +- .../otlptrace/internal/tracetransform/span.go | 22 +- .../otlp/otlptrace/otlptracegrpc/LICENSE | 30 + .../otlp/otlptrace/otlptracegrpc/client.go | 47 +- .../otlptracegrpc/internal/counter/counter.go | 31 + .../internal/envconfig/envconfig.go | 4 +- .../otlptrace/otlptracegrpc/internal/gen.go | 10 + .../otlptracegrpc/internal/observ/doc.go | 6 + .../internal/observ/instrumentation.go | 342 + .../otlptracegrpc/internal/observ/target.go | 143 + .../internal/otlpconfig/envconfig.go | 14 +- .../internal/otlpconfig/options.go | 21 +- .../internal/otlpconfig/optiontypes.go | 2 +- .../otlptracegrpc/internal/otlpconfig/tls.go | 2 +- .../otlptracegrpc/internal/partialsuccess.go | 13 +- .../otlptracegrpc/internal/retry/retry.go | 35 +- .../otlptracegrpc/internal/version.go | 8 + .../otlptracegrpc/internal/x/README.md | 36 + .../otlptracegrpc/internal/x/observ.go | 22 + .../otlptrace/otlptracegrpc/internal/x/x.go | 58 + .../otlp/otlptrace/otlptracegrpc/options.go | 5 +- .../otel/exporters/otlp/otlptrace/version.go | 2 +- .../otel/semconv/v1.20.0/README.md | 3 - .../otel/semconv/v1.20.0/attribute_group.go | 1198 --- .../otel/semconv/v1.20.0/doc.go | 9 - .../otel/semconv/v1.20.0/event.go | 188 - .../otel/semconv/v1.20.0/exception.go | 9 - .../otel/semconv/v1.20.0/http.go | 10 - .../otel/semconv/v1.20.0/resource.go | 2060 ---- .../otel/semconv/v1.20.0/schema.go | 9 - .../otel/semconv/v1.20.0/trace.go | 2599 ----- .../otel/semconv/v1.26.0/README.md | 3 - .../otel/semconv/v1.26.0/attribute_group.go | 8996 ----------------- .../otel/semconv/v1.26.0/doc.go | 9 - .../otel/semconv/v1.26.0/exception.go | 9 - .../otel/semconv/v1.26.0/metric.go | 1307 --- .../otel/semconv/v1.26.0/schema.go | 9 - .../otel/semconv/v1.39.0/httpconv/metric.go | 1733 ++++ .../otel/semconv/v1.39.0/rpcconv/metric.go | 1131 +++ .../proto/otlp/common/v1/common.pb.go | 23 +- .../proto/otlp/resource/v1/resource.pb.go | 3 +- .../proto/otlp/trace/v1/trace.pb.go | 36 +- vendor/go.uber.org/zap/.golangci.yml | 2 +- vendor/go.uber.org/zap/CHANGELOG.md | 10 + vendor/go.uber.org/zap/CODE_OF_CONDUCT.md | 4 +- vendor/go.uber.org/zap/LICENSE | 2 +- vendor/go.uber.org/zap/Makefile | 2 +- vendor/go.uber.org/zap/field.go | 10 + vendor/go.uber.org/zap/http_handler.go | 2 +- vendor/go.uber.org/zap/logger.go | 6 +- vendor/go.uber.org/zap/options.go | 6 +- vendor/go.uber.org/zap/sink.go | 2 +- .../zap/zapcore/buffered_write_syncer.go | 23 +- .../zap/zapcore/console_encoder.go | 2 +- vendor/go.uber.org/zap/zapcore/entry.go | 14 +- vendor/go.uber.org/zap/zapcore/lazy_with.go | 35 +- vendor/go.uber.org/zap/zapcore/level.go | 14 +- .../x/exp/constraints/constraints.go | 50 - vendor/golang.org/x/exp/slices/cmp.go | 44 - vendor/golang.org/x/exp/slices/slices.go | 447 +- vendor/golang.org/x/exp/slices/sort.go | 162 +- .../golang.org/x/exp/slices/zsortanyfunc.go | 479 - .../golang.org/x/exp/slices/zsortordered.go | 481 - vendor/golang.org/x/net/context/context.go | 118 - vendor/golang.org/x/time/rate/rate.go | 19 +- vendor/golang.org/x/time/rate/sometimes.go | 4 +- .../grpc/reflection/README.md | 18 + .../grpc/reflection/adapt.go | 57 + .../grpc_reflection_v1/reflection.pb.go | 777 ++ .../grpc_reflection_v1/reflection_grpc.pb.go | 138 + .../grpc_reflection_v1alpha/reflection.pb.go | 847 ++ .../reflection_grpc.pb.go | 135 + .../grpc/reflection/internal/internal.go | 436 + .../grpc/reflection/serverreflection.go | 160 + .../encoding/protodelim/protodelim.go | 9 +- .../protobuf/encoding/protojson/decode.go | 12 + .../encoding/protojson/well_known_types.go | 5 +- .../protobuf/encoding/prototext/decode.go | 18 + .../protobuf/internal/descfmt/stringer.go | 269 +- .../protobuf/internal/encoding/tag/tag.go | 11 +- .../protobuf/internal/encoding/text/decode.go | 115 +- .../protobuf/internal/filedesc/desc.go | 1 + .../protobuf/internal/filedesc/desc_lazy.go | 22 - .../protobuf/internal/genid/descriptor_gen.go | 1 + .../protobuf/internal/impl/codec_map.go | 6 + .../protobuf/internal/impl/decode.go | 3 +- .../protobuf/internal/impl/validate.go | 26 + .../protobuf/internal/version/version.go | 4 +- .../protobuf/proto/decode.go | 10 +- .../protobuf/reflect/protodesc/desc.go | 11 +- .../protobuf/reflect/protodesc/desc_init.go | 1 + .../protobuf/reflect/protodesc/editions.go | 4 +- .../types/descriptorpb/descriptor.pb.go | 13 +- .../types/known/timestamppb/timestamp.pb.go | 13 +- .../k8s.io/api/admission/v1/generated.proto | 7 + .../admission/v1/generated.protomessage.pb.go | 28 - vendor/k8s.io/api/admission/v1/types.go | 7 + .../api/admission/v1beta1/generated.proto | 7 + vendor/k8s.io/api/admission/v1beta1/types.go | 7 + .../admissionregistration/v1/generated.pb.go | 4760 ++++++--- .../admissionregistration/v1/generated.proto | 450 +- .../v1/generated.protomessage.pb.go | 76 - .../api/admissionregistration/v1/register.go | 4 + .../api/admissionregistration/v1/types.go | 478 +- .../v1/types_swagger_doc_generated.go | 239 +- .../v1/zz_generated.deepcopy.go | 252 + .../v1/zz_generated.model_name.go | 45 + .../v1/zz_generated.prerelease-lifecycle.go | 24 + .../v1alpha1/generated.proto | 89 +- .../v1alpha1/generated.protomessage.pb.go | 74 - .../admissionregistration/v1alpha1/types.go | 85 +- .../v1alpha1/types_swagger_doc_generated.go | 80 +- .../v1beta1/generated.proto | 155 +- .../v1beta1/generated.protomessage.pb.go | 90 - .../admissionregistration/v1beta1/types.go | 159 +- .../v1beta1/types_swagger_doc_generated.go | 148 +- .../zz_generated.prerelease-lifecycle.go | 24 + .../api/apidiscovery/v2/generated.proto | 2 +- .../v2/generated.protomessage.pb.go | 32 - vendor/k8s.io/api/apidiscovery/v2/types.go | 2 +- .../api/apidiscovery/v2beta1/generated.proto | 2 +- .../v2beta1/generated.protomessage.pb.go | 32 - .../k8s.io/api/apidiscovery/v2beta1/types.go | 2 +- .../v1alpha1/generated.proto | 41 +- .../v1alpha1/generated.protomessage.pb.go | 34 - .../api/apiserverinternal/v1alpha1/types.go | 41 +- .../v1alpha1/types_swagger_doc_generated.go | 32 +- .../api/apps/v1/generated.protomessage.pb.go | 82 - .../k8s.io/api/apps/v1beta1/generated.proto | 4 +- .../apps/v1beta1/generated.protomessage.pb.go | 68 - vendor/k8s.io/api/apps/v1beta1/types.go | 6 +- .../k8s.io/api/apps/v1beta2/generated.proto | 4 +- .../apps/v1beta2/generated.protomessage.pb.go | 88 - vendor/k8s.io/api/apps/v1beta2/types.go | 6 +- .../api/authentication/v1/generated.proto | 64 +- .../v1/generated.protomessage.pb.go | 44 - vendor/k8s.io/api/authentication/v1/types.go | 64 +- .../v1/types_swagger_doc_generated.go | 56 +- .../authentication/v1alpha1/generated.proto | 7 +- .../v1alpha1/generated.protomessage.pb.go | 26 - .../api/authentication/v1alpha1/types.go | 7 +- .../v1alpha1/types_swagger_doc_generated.go | 6 +- .../authentication/v1beta1/generated.proto | 36 +- .../v1beta1/generated.protomessage.pb.go | 36 - .../api/authentication/v1beta1/types.go | 36 +- .../v1beta1/types_swagger_doc_generated.go | 32 +- .../api/authorization/v1/generated.proto | 96 +- .../v1/generated.protomessage.pb.go | 54 - vendor/k8s.io/api/authorization/v1/types.go | 96 +- .../v1/types_swagger_doc_generated.go | 92 +- .../api/authorization/v1beta1/generated.proto | 96 +- .../v1beta1/generated.protomessage.pb.go | 50 - .../k8s.io/api/authorization/v1beta1/types.go | 96 +- .../v1beta1/types_swagger_doc_generated.go | 92 +- .../k8s.io/api/autoscaling/v1/generated.proto | 12 +- .../v1/generated.protomessage.pb.go | 64 - vendor/k8s.io/api/autoscaling/v1/types.go | 16 +- .../k8s.io/api/autoscaling/v2/generated.proto | 8 +- .../v2/generated.protomessage.pb.go | 70 - vendor/k8s.io/api/autoscaling/v2/types.go | 10 +- .../api/autoscaling/v2beta1/generated.pb.go | 5106 ---------- .../api/autoscaling/v2beta1/generated.proto | 474 - .../v2beta1/generated.protomessage.pb.go | 58 - .../k8s.io/api/autoscaling/v2beta1/types.go | 486 - .../v2beta1/types_swagger_doc_generated.go | 247 - .../v2beta1/zz_generated.deepcopy.go | 525 - .../v2beta1/zz_generated.model_name.go | 112 - .../zz_generated.prerelease-lifecycle.go | 74 - .../api/autoscaling/v2beta2/generated.pb.go | 5817 ----------- .../api/autoscaling/v2beta2/generated.proto | 493 - .../v2beta2/generated.protomessage.pb.go | 70 - .../k8s.io/api/autoscaling/v2beta2/types.go | 578 -- .../v2beta2/types_swagger_doc_generated.go | 297 - .../v2beta2/zz_generated.deepcopy.go | 610 -- .../v2beta2/zz_generated.model_name.go | 142 - .../zz_generated.prerelease-lifecycle.go | 68 - vendor/k8s.io/api/batch/v1/generated.proto | 4 +- .../api/batch/v1/generated.protomessage.pb.go | 56 - vendor/k8s.io/api/batch/v1/types.go | 4 +- .../k8s.io/api/batch/v1beta1/generated.proto | 4 +- .../v1beta1/generated.protomessage.pb.go | 32 - vendor/k8s.io/api/batch/v1beta1/types.go | 4 +- .../api/certificates/v1/generated.proto | 16 +- .../v1/generated.protomessage.pb.go | 34 - vendor/k8s.io/api/certificates/v1/types.go | 16 +- .../v1alpha1/generated.protomessage.pb.go | 28 - .../api/certificates/v1beta1/generated.pb.go | 46 + .../api/certificates/v1beta1/generated.proto | 60 +- .../v1beta1/generated.protomessage.pb.go | 48 - .../k8s.io/api/certificates/v1beta1/types.go | 62 +- .../v1beta1/types_swagger_doc_generated.go | 5 +- .../v1beta1/zz_generated.deepcopy.go | 5 + .../zz_generated.prerelease-lifecycle.go | 8 +- .../api/coordination/v1alpha2/generated.proto | 2 +- .../v1alpha2/generated.protomessage.pb.go | 28 - .../k8s.io/api/coordination/v1alpha2/types.go | 2 +- .../api/coordination/v1beta1/generated.proto | 2 +- .../v1beta1/generated.protomessage.pb.go | 34 - .../k8s.io/api/coordination/v1beta1/types.go | 2 +- vendor/k8s.io/api/core/v1/generated.pb.go | 1697 +++- vendor/k8s.io/api/core/v1/generated.proto | 179 +- .../api/core/v1/generated.protomessage.pb.go | 498 - vendor/k8s.io/api/core/v1/types.go | 189 +- .../core/v1/types_swagger_doc_generated.go | 114 +- .../api/core/v1/zz_generated.deepcopy.go | 132 +- .../api/core/v1/zz_generated.model_name.go | 25 +- .../k8s.io/api/discovery/v1/generated.proto | 8 + .../discovery/v1/generated.protomessage.pb.go | 38 - vendor/k8s.io/api/discovery/v1/types.go | 9 + .../api/discovery/v1beta1/generated.proto | 7 + .../v1beta1/generated.protomessage.pb.go | 38 - vendor/k8s.io/api/discovery/v1beta1/types.go | 9 + .../events/v1/generated.protomessage.pb.go | 28 - .../api/extensions/v1beta1/generated.proto | 11 +- .../v1beta1/generated.protomessage.pb.go | 112 - vendor/k8s.io/api/extensions/v1beta1/types.go | 13 +- .../v1beta1/zz_generated.validations.go | 193 +- .../k8s.io/api/flowcontrol/v1/generated.proto | 13 + .../v1/generated.protomessage.pb.go | 68 - vendor/k8s.io/api/flowcontrol/v1/types.go | 13 + .../api/flowcontrol/v1beta1/generated.proto | 13 + .../v1beta1/generated.protomessage.pb.go | 68 - .../k8s.io/api/flowcontrol/v1beta1/types.go | 13 + .../api/flowcontrol/v1beta2/generated.proto | 13 + .../v1beta2/generated.protomessage.pb.go | 68 - .../k8s.io/api/flowcontrol/v1beta2/types.go | 13 + .../api/flowcontrol/v1beta3/generated.proto | 13 + .../v1beta3/generated.protomessage.pb.go | 68 - .../k8s.io/api/flowcontrol/v1beta3/types.go | 13 + .../api/imagepolicy/v1alpha1/generated.proto | 2 + .../v1alpha1/generated.protomessage.pb.go | 30 - .../k8s.io/api/imagepolicy/v1alpha1/types.go | 2 + .../k8s.io/api/networking/v1/generated.proto | 18 +- .../v1/generated.protomessage.pb.go | 92 - vendor/k8s.io/api/networking/v1/types.go | 18 +- .../api/networking/v1beta1/generated.proto | 11 +- .../v1beta1/generated.protomessage.pb.go | 72 - vendor/k8s.io/api/networking/v1beta1/types.go | 11 +- vendor/k8s.io/api/node/v1/generated.proto | 4 + .../api/node/v1/generated.protomessage.pb.go | 30 - vendor/k8s.io/api/node/v1/types.go | 4 + .../k8s.io/api/node/v1alpha1/generated.proto | 5 + .../v1alpha1/generated.protomessage.pb.go | 32 - vendor/k8s.io/api/node/v1alpha1/types.go | 5 + .../k8s.io/api/node/v1beta1/generated.proto | 4 + .../node/v1beta1/generated.protomessage.pb.go | 30 - vendor/k8s.io/api/node/v1beta1/types.go | 4 + vendor/k8s.io/api/policy/v1/generated.proto | 4 + .../policy/v1/generated.protomessage.pb.go | 32 - vendor/k8s.io/api/policy/v1/types.go | 4 + .../k8s.io/api/policy/v1beta1/generated.proto | 4 + .../v1beta1/generated.protomessage.pb.go | 32 - vendor/k8s.io/api/policy/v1beta1/types.go | 4 + vendor/k8s.io/api/rbac/v1/generated.proto | 15 +- .../api/rbac/v1/generated.protomessage.pb.go | 46 - vendor/k8s.io/api/rbac/v1/types.go | 15 +- .../k8s.io/api/rbac/v1alpha1/generated.proto | 15 +- .../v1alpha1/generated.protomessage.pb.go | 46 - vendor/k8s.io/api/rbac/v1alpha1/types.go | 15 +- .../k8s.io/api/rbac/v1beta1/generated.proto | 15 +- .../rbac/v1beta1/generated.protomessage.pb.go | 46 - vendor/k8s.io/api/rbac/v1beta1/types.go | 15 +- vendor/k8s.io/api/resource/v1/generated.pb.go | 641 ++ vendor/k8s.io/api/resource/v1/generated.proto | 405 +- .../resource/v1/generated.protomessage.pb.go | 108 - vendor/k8s.io/api/resource/v1/types.go | 450 +- .../v1/types_swagger_doc_generated.go | 89 +- .../api/resource/v1/zz_generated.deepcopy.go | 53 + .../resource/v1/zz_generated.model_name.go | 5 + .../api/resource/v1alpha3/generated.pb.go | 1762 +++- .../api/resource/v1alpha3/generated.proto | 220 +- .../v1alpha3/generated.protomessage.pb.go | 38 - .../k8s.io/api/resource/v1alpha3/register.go | 2 + vendor/k8s.io/api/resource/v1alpha3/types.go | 244 +- .../v1alpha3/types_swagger_doc_generated.go | 63 +- .../v1alpha3/zz_generated.deepcopy.go | 177 + .../v1alpha3/zz_generated.model_name.go | 25 + .../zz_generated.prerelease-lifecycle.go | 36 + .../api/resource/v1beta1/generated.pb.go | 641 ++ .../api/resource/v1beta1/generated.proto | 384 +- .../v1beta1/generated.protomessage.pb.go | 108 - vendor/k8s.io/api/resource/v1beta1/types.go | 411 +- .../v1beta1/types_swagger_doc_generated.go | 75 +- .../resource/v1beta1/zz_generated.deepcopy.go | 53 + .../v1beta1/zz_generated.model_name.go | 5 + .../api/resource/v1beta2/generated.pb.go | 2038 +++- .../api/resource/v1beta2/generated.proto | 496 +- .../v1beta2/generated.protomessage.pb.go | 108 - .../k8s.io/api/resource/v1beta2/register.go | 2 + vendor/k8s.io/api/resource/v1beta2/types.go | 564 +- .../v1beta2/types_swagger_doc_generated.go | 128 +- .../resource/v1beta2/zz_generated.deepcopy.go | 190 + .../v1beta2/zz_generated.model_name.go | 30 + .../zz_generated.prerelease-lifecycle.go | 36 + .../k8s.io/api/scheduling/v1/generated.proto | 1 + .../v1/generated.protomessage.pb.go | 26 - vendor/k8s.io/api/scheduling/v1/types.go | 1 + .../api/scheduling/v1alpha1/generated.pb.go | 2010 ---- .../api/scheduling/v1alpha1/generated.proto | 190 - .../v1alpha1/generated.protomessage.pb.go | 42 - .../k8s.io/api/scheduling/v1alpha1/types.go | 201 - .../v1alpha1/types_swagger_doc_generated.go | 131 - .../v1alpha1/zz_generated.deepcopy.go | 270 - .../v1alpha1/zz_generated.model_name.go | 72 - .../scheduling/{v1alpha1 => v1alpha2}/doc.go | 6 +- .../api/scheduling/v1alpha2/generated.pb.go | 3828 +++++++ .../api/scheduling/v1alpha2/generated.proto | 550 + .../{v1alpha1 => v1alpha2}/register.go | 13 +- .../k8s.io/api/scheduling/v1alpha2/types.go | 601 ++ .../v1alpha2/types_swagger_doc_generated.go | 217 + .../v1alpha2/zz_generated.deepcopy.go | 484 + .../v1alpha2/zz_generated.model_name.go | 112 + .../api/scheduling/v1beta1/generated.proto | 1 + .../v1beta1/generated.protomessage.pb.go | 26 - vendor/k8s.io/api/scheduling/v1beta1/types.go | 1 + vendor/k8s.io/api/storage/v1/generated.pb.go | 35 + vendor/k8s.io/api/storage/v1/generated.proto | 40 +- .../storage/v1/generated.protomessage.pb.go | 64 - vendor/k8s.io/api/storage/v1/types.go | 41 +- .../storage/v1/types_swagger_doc_generated.go | 5 +- .../api/storage/v1/zz_generated.deepcopy.go | 5 + .../api/storage/v1alpha1/generated.proto | 6 + .../v1alpha1/generated.protomessage.pb.go | 42 - vendor/k8s.io/api/storage/v1alpha1/types.go | 7 + .../api/storage/v1beta1/generated.pb.go | 35 + .../api/storage/v1beta1/generated.proto | 36 +- .../v1beta1/generated.protomessage.pb.go | 64 - vendor/k8s.io/api/storage/v1beta1/types.go | 37 +- .../v1beta1/types_swagger_doc_generated.go | 1 + .../storage/v1beta1/zz_generated.deepcopy.go | 5 + .../v1beta1/generated.protomessage.pb.go | 30 - .../v1/generated.protomessage.pb.go | 76 - .../pkg/apis/apiextensions/v1/types.go | 3 + .../v1beta1/generated.protomessage.pb.go | 74 - .../v1/customresourcecolumndefinition.go | 98 + .../v1/customresourceconversion.go | 59 + .../v1/customresourcedefinition.go | 249 + .../v1/customresourcedefinitioncondition.go | 100 + .../v1/customresourcedefinitionnames.go | 104 + .../v1/customresourcedefinitionspec.go | 115 + .../v1/customresourcedefinitionstatus.go | 85 + .../v1/customresourcedefinitionversion.go | 143 + .../v1/customresourcesubresources.go | 59 + .../v1/customresourcesubresourcescale.go | 77 + .../v1/customresourcevalidation.go | 42 + .../apiextensions/v1/externaldocumentation.go | 50 + .../apiextensions/v1/jsonschemaprops.go | 554 + .../apiextensions/v1/selectablefield.go | 49 + .../apiextensions/v1/servicereference.go | 76 + .../apiextensions/v1/validationrule.go | 196 + .../apiextensions/v1/webhookclientconfig.go | 92 + .../apiextensions/v1/webhookconversion.go | 59 + .../v1beta1/customresourcecolumndefinition.go | 98 + .../v1beta1/customresourceconversion.go | 78 + .../v1beta1/customresourcedefinition.go | 250 + .../customresourcedefinitioncondition.go | 100 + .../v1beta1/customresourcedefinitionnames.go | 104 + .../v1beta1/customresourcedefinitionspec.go | 193 + .../v1beta1/customresourcedefinitionstatus.go | 85 + .../customresourcedefinitionversion.go | 148 + .../v1beta1/customresourcesubresources.go | 59 + .../v1beta1/customresourcesubresourcescale.go | 77 + .../v1beta1/customresourcevalidation.go | 42 + .../v1beta1/externaldocumentation.go | 50 + .../apiextensions/v1beta1/jsonschemaprops.go | 554 + .../apiextensions/v1beta1/selectablefield.go | 49 + .../apiextensions/v1beta1/servicereference.go | 76 + .../apiextensions/v1beta1/validationrule.go | 196 + .../v1beta1/webhookclientconfig.go | 92 + .../client/clientset/clientset/clientset.go | 133 + .../client/clientset/clientset/scheme}/doc.go | 4 +- .../clientset/clientset/scheme/register.go | 58 + .../apiextensions/v1/apiextensions_client.go} | 42 +- .../v1/customresourcedefinition.go | 77 + .../clientset/typed/apiextensions/v1}/doc.go | 2 +- .../apiextensions/v1}/generated_expansion.go | 4 +- .../v1beta1/apiextensions_client.go} | 42 +- .../v1beta1/customresourcedefinition.go | 79 + .../typed/apiextensions/v1beta1}/doc.go | 2 +- .../v1beta1}/generated_expansion.go | 4 +- .../pkg/features/kube_features.go | 1 + .../apimachinery/pkg/api/equality/semantic.go | 3 + .../api/resource/generated.protomessage.pb.go | 26 - .../pkg/api/validate/content/errors.go | 6 + .../pkg/api/validate/content/path.go | 63 + .../pkg/api/validate/discriminator.go | 71 + .../apimachinery/pkg/api/validate/limits.go | 85 +- .../apimachinery/pkg/api/validate/strfmt.go | 17 + .../apimachinery/pkg/api/validate/union.go | 19 +- .../pkg/api/validation/path/name.go | 68 - .../apis/meta/internalversion/conversion.go} | 21 +- .../pkg/apis/meta/internalversion/types.go | 5 + .../zz_generated.conversion.go | 16 +- .../apimachinery/pkg/apis/meta/v1/fieldsv1.go | 170 + .../pkg/apis/meta/v1/fieldsv1_byte.go | 105 + .../pkg/apis/meta/v1/fieldsv1_string.go | 113 + .../pkg/apis/meta/v1/generated.pb.go | 353 +- .../pkg/apis/meta/v1/generated.proto | 56 + .../apis/meta/v1/generated.protomessage.pb.go | 112 - .../apimachinery/pkg/apis/meta/v1/helpers.go | 27 +- .../apimachinery/pkg/apis/meta/v1/meta.go | 9 + .../pkg/apis/meta/v1/micro_time_fuzz.go | 1 - .../pkg/apis/meta/v1/time_fuzz.go | 1 - .../apimachinery/pkg/apis/meta/v1/types.go | 73 +- .../meta/v1/types_swagger_doc_generated.go | 19 +- .../apis/meta/v1/zz_generated.conversion.go | 7 + .../pkg/apis/meta/v1/zz_generated.deepcopy.go | 45 +- .../apis/meta/v1/zz_generated.model_name.go | 5 + .../meta/v1beta1/generated.protomessage.pb.go | 24 - .../pkg/runtime/generated.protomessage.pb.go | 28 - .../schema/generated.protomessage.pb.go | 22 - .../serializer/cbor/internal/modes/decode.go | 18 +- .../pkg/runtime/serializer/cbor/raw.go | 4 +- .../apimachinery/pkg/sharding/accessor.go | 50 + .../pkg/sharding/hash.go} | 22 +- .../apimachinery/pkg/sharding/selector.go | 137 + .../k8s.io/apimachinery/pkg/sharding/types.go | 32 + .../k8s.io/apimachinery/pkg/util/diff/diff.go | 5 +- .../apimachinery/pkg/util/diff/legacy_diff.go | 2 +- .../apimachinery/pkg/util/httpstream/doc.go | 5 +- .../pkg/util/httpstream/spdy/doc.go | 20 + .../pkg/util/httpstream/spdy/spdy.go | 236 + .../util/intstr/generated.protomessage.pb.go | 24 - .../pkg/util/intstr/instr_fuzz.go | 1 - .../pkg/util/managedfields/extract.go | 3 +- .../pkg/util/managedfields/internal/fields.go | 7 +- .../apimachinery/pkg/util/mergepatch/util.go | 2 +- .../k8s.io/apimachinery/pkg/util/net/http.go | 5 + .../apimachinery/pkg/util/net/interface.go | 112 +- .../apimachinery/pkg/util/proxy/dial.go | 122 - .../apimachinery/pkg/util/proxy/transport.go | 272 - .../pkg/util/proxy/upgradeaware.go | 558 - .../apimachinery/pkg/util/runtime/runtime.go | 33 +- .../pkg/util/strategicpatch/patch.go | 8 +- .../util/validation/field/error_matcher.go | 40 +- .../pkg/util/validation/field/errors.go | 232 +- .../apimachinery/pkg/util/validation/ip.go | 4 +- .../third_party/forked/golang/netutil/addr.go | 28 - .../forked/golang/reflect/deep_equal.go | 4 +- .../k8s.io/apiserver/pkg/admission/config.go | 2 +- .../k8s.io/apiserver/pkg/admission/handler.go | 4 +- .../pkg/admission/initializer/apiserver_id.go | 43 + .../pkg/admission/initializer/interfaces.go | 39 + .../pkg/admission/plugin/cel/composition.go | 128 +- .../pkg/admission/plugin/manifest/loader.go | 120 + .../plugin/manifest/metrics/metrics.go | 161 + .../admission/plugin/manifest/validation.go | 74 + .../plugin/namespace/lifecycle/admission.go | 8 +- .../policy/config/apis/policyconfig/doc.go | 20 + .../config/apis/policyconfig}/register.go | 31 +- .../policy/config/apis/policyconfig/types.go | 63 + .../policy/config/apis/policyconfig/v1/doc.go | 21 + .../config/apis/policyconfig/v1}/register.go | 9 +- .../config/apis/policyconfig/v1/types.go | 53 + .../v1/zz_generated.conversion.go | 98 + .../policyconfig/v1/zz_generated.deepcopy.go | 76 + .../policyconfig/zz_generated.deepcopy.go | 76 + .../admission/plugin/policy/config/config.go | 97 + .../policy/generic/composite_policy_source.go | 119 + .../admission/plugin/policy/generic/plugin.go | 192 +- .../policy/generic/policy_test_context.go | 4 +- .../policy/internal/generic/controller.go | 36 +- .../plugin/policy/manifest/source/source.go | 192 + .../plugin/policy/mutating/accessor.go | 42 +- .../plugin/policy/mutating/compilation.go | 29 +- .../plugin/policy/mutating/dispatcher.go | 8 +- .../plugin/policy/mutating/plugin.go | 76 +- .../plugin/policy/validating/interface.go | 2 + .../plugin/policy/validating/plugin.go | 63 +- .../plugin/policy/validating/typechecking.go | 33 +- .../plugin/policy/validating/validator.go | 21 +- .../config/apis/webhookadmission/types.go | 10 + .../config/apis/webhookadmission/v1/types.go | 10 + .../v1/zz_generated.conversion.go | 2 + .../apis/webhookadmission/v1alpha1/doc.go | 23 - .../v1alpha1/zz_generated.conversion.go | 68 - .../plugin/webhook/config/kubeconfig.go | 57 +- .../generic/composite_webhook_source.go | 99 + .../plugin/webhook/generic/webhook.go | 158 +- .../plugin/webhook/manifest/loader/loader.go | 220 + .../plugin/webhook/manifest/source/source.go | 218 + .../plugin/webhook/mutating/plugin.go | 19 +- .../webhook/mutating/reinvocationcontext.go | 10 +- .../plugin/webhook/validating/plugin.go | 18 + .../apiserver/pkg/apis/apiserver/types.go | 4 + .../pkg/apis/apiserver/v1alpha1/types.go | 4 + .../v1alpha1/zz_generated.conversion.go | 2 + .../pkg/apis/apiserver/v1beta1/types.go | 4 + .../v1beta1/zz_generated.conversion.go | 2 + .../apis/apiserver/validation/validation.go | 10 +- .../k8s.io/apiserver/pkg/apis/audit/types.go | 1 + .../pkg/apis/audit/v1/generated.proto | 1 + .../audit/v1/generated.protomessage.pb.go | 38 - .../apiserver/pkg/apis/audit/v1/types.go | 1 + .../pkg/apis/audit/validation/validation.go | 2 +- .../apiserver/pkg/audit/policy/checker.go | 2 +- vendor/k8s.io/apiserver/pkg/audit/union.go | 1 - .../headerrequest/requestheader_controller.go | 2 +- .../request/websocket/protocol.go | 2 +- .../k8s.io/apiserver/pkg/cel/library/cidr.go | 36 +- .../apiserver/pkg/cel/library/format.go | 72 +- vendor/k8s.io/apiserver/pkg/cel/library/ip.go | 48 +- .../apiserver/pkg/cel/library/quantity.go | 36 +- .../apiserver/pkg/cel/openapi/adaptor.go | 3 - .../pkg/cel/openapi/resolver/refs.go | 8 +- .../endpoints/discovery/aggregated/handler.go | 10 +- .../apiserver/pkg/endpoints/filters/audit.go | 3 +- .../endpoints/filters/impersonation/cache.go | 66 +- .../constrained_impersonation.go | 73 +- .../filters/impersonation/metrics/metrics.go | 99 + .../pkg/endpoints/handlers/delete.go | 2 +- .../apiserver/pkg/endpoints/handlers/get.go | 245 +- .../pkg/endpoints/handlers/metrics/OWNERS | 3 +- .../handlers/responsewriters/writers.go | 2 +- .../apiserver/pkg/endpoints/handlers/watch.go | 65 +- .../apiserver/pkg/endpoints/metrics/OWNERS | 3 +- .../pkg/endpoints/metrics/metrics.go | 15 +- .../pkg/endpoints/request/requestinfo.go | 4 +- .../pkg/endpoints/request/webhook_duration.go | 17 + .../apiserver/pkg/features/kube_features.go | 79 +- .../apiserver/pkg/quota/v1/resources.go | 6 +- .../pkg/registry/generic/registry/store.go | 32 +- .../apiserver/pkg/registry/rest/create.go | 11 +- .../apiserver/pkg/registry/rest/update.go | 3 +- .../apiserver/pkg/registry/rest/validate.go | 206 +- vendor/k8s.io/apiserver/pkg/server/config.go | 21 + .../configmap_cafile_content.go | 2 +- .../dynamic_cafile_content.go | 2 +- .../dynamic_serving_content.go | 2 +- .../server/egressselector/egress_selector.go | 1 + .../pkg/server/flagz/api/v1alpha1/doc.go | 2 +- .../pkg/server/flagz/api/v1beta1}/doc.go | 9 +- .../pkg/server/flagz/api/v1beta1}/register.go | 35 +- .../flagz/api/v1beta1}/types.go | 26 +- .../api/v1beta1}/zz_generated.deepcopy.go | 20 +- .../api/v1beta1/zz_generated.model_name.go} | 15 +- .../apiserver/pkg/server/flagz/flagz.go | 180 +- .../pkg/server/flagz/negotiate/negotiation.go | 27 +- .../apiserver/pkg/server/genericapiserver.go | 15 +- vendor/k8s.io/apiserver/pkg/server/hooks.go | 3 +- .../apiserver/pkg/server/options/admission.go | 2 +- .../pkg/server/options/api_enablement.go | 38 +- .../apiserver/pkg/server/options/audit.go | 12 +- .../server/options/encryptionconfig/config.go | 10 - .../encryptionconfig/controller/controller.go | 6 +- .../pkg/server/options/recommended.go | 2 +- .../apiserver/pkg/server/options/serving.go | 25 + .../pkg/server/options/serving_unix.go | 1 - .../pkg/server/options/serving_windows.go | 1 - .../server/options/serving_with_loopback.go | 60 +- .../pkg/server/resourceconfig/helpers.go | 19 +- .../apiserver/pkg/server/routes/metrics.go | 2 + .../apiserver/pkg/server/routes/openapi.go | 111 +- .../apiserver/pkg/server/secure_serving.go | 3 + .../apiserver/pkg/server/signal_posix.go | 1 - .../pkg/server/statusz/api/v1alpha1/doc.go | 2 +- .../pkg/server/statusz/api/v1beta1}/doc.go | 9 +- .../server/statusz/api/v1beta1/register.go | 47 + .../pkg/server/statusz/api/v1beta1/types.go | 50 + .../api/v1beta1/zz_generated.deepcopy.go | 58 + .../api/v1beta1/zz_generated.model_name.go} | 15 +- .../server/statusz/negotiate/negotiation.go | 29 +- .../apiserver/pkg/server/statusz/statusz.go | 195 +- .../pkg/server/statusz/textserializer.go | 6 +- .../k8s.io/apiserver/pkg/sharding/parser.go | 217 + vendor/k8s.io/apiserver/pkg/storage/OWNERS | 2 + .../pkg/storage/cacher/cache_watcher.go | 6 +- .../apiserver/pkg/storage/cacher/cacher.go | 59 +- .../apiserver/pkg/storage/cacher/delegator.go | 67 +- .../pkg/storage/cacher/metrics/metrics.go | 49 +- .../storage/cacher/progress/watch_progress.go | 2 +- .../pkg/storage/cacher/{ => store}/store.go | 32 +- .../storage/cacher/{ => store}/store_btree.go | 76 +- .../pkg/storage/cacher/watch_cache.go | 39 +- .../storage/cacher/watch_cache_interval.go | 9 +- .../pkg/storage/etcd3/metrics/metrics.go | 19 +- .../apiserver/pkg/storage/etcd3/store.go | 8 +- .../apiserver/pkg/storage/etcd3/watcher.go | 11 +- .../feature/feature_support_checker.go | 2 +- .../pkg/storage/selection_predicate.go | 35 + .../storage/storagebackend/factory/etcd3.go | 17 +- vendor/k8s.io/apiserver/pkg/storage/util.go | 6 +- .../value/encrypt/envelope/grpc_service.go | 2 +- .../value/encrypt/envelope/kmsv2/envelope.go | 1 - .../encrypt/envelope/kmsv2/grpc_service.go | 2 +- .../pkg/util/filesystem/watchuntil.go | 149 + .../pkg/util/peerproxy/metrics/metrics.go | 58 +- .../pkg/util/proxy/metrics/metrics.go | 101 + .../plugin/pkg/authorizer/webhook/webhook.go | 27 +- .../v1/applyconfiguration.go | 81 + .../v1/expressionwarning.go | 4 +- .../admissionregistration/v1/jsonpatch.go | 105 + .../v1/matchcondition.go | 4 +- .../v1/matchresources.go | 8 +- .../v1/mutatingadmissionpolicy.go | 274 + .../v1/mutatingadmissionpolicybinding.go | 284 + .../v1/mutatingadmissionpolicybindingspec.go | 75 + .../v1/mutatingadmissionpolicyspec.go | 172 + .../v1/mutatingwebhook.go | 20 +- .../v1/mutatingwebhookconfiguration.go | 4 +- .../admissionregistration/v1/mutation.go | 72 + .../v1/namedrulewithoperations.go | 2 +- .../admissionregistration/v1/paramkind.go | 4 +- .../admissionregistration/v1/paramref.go | 2 +- .../admissionregistration/v1/rule.go | 6 +- .../v1/rulewithoperations.go | 2 +- .../v1/servicereference.go | 8 +- .../admissionregistration/v1/typechecking.go | 2 +- .../v1/validatingadmissionpolicy.go | 6 +- .../v1/validatingadmissionpolicybinding.go | 4 +- .../validatingadmissionpolicybindingspec.go | 4 +- .../v1/validatingadmissionpolicyspec.go | 10 +- .../v1/validatingadmissionpolicystatus.go | 6 +- .../v1/validatingwebhook.go | 20 +- .../v1/validatingwebhookconfiguration.go | 4 +- .../admissionregistration/v1/validation.go | 6 +- .../admissionregistration/v1/variable.go | 4 +- .../v1/webhookclientconfig.go | 6 +- .../v1alpha1/expressionwarning.go | 4 +- .../v1alpha1/matchcondition.go | 4 +- .../v1alpha1/matchresources.go | 8 +- .../v1alpha1/mutatingadmissionpolicy.go | 4 +- .../mutatingadmissionpolicybinding.go | 4 +- .../v1alpha1/namedrulewithoperations.go | 2 +- .../v1alpha1/paramkind.go | 4 +- .../v1alpha1/paramref.go | 4 +- .../v1alpha1/typechecking.go | 2 +- .../v1alpha1/validatingadmissionpolicy.go | 6 +- .../validatingadmissionpolicybinding.go | 4 +- .../validatingadmissionpolicybindingspec.go | 4 +- .../v1alpha1/validatingadmissionpolicyspec.go | 10 +- .../validatingadmissionpolicystatus.go | 6 +- .../v1alpha1/validation.go | 6 +- .../v1alpha1/variable.go | 4 +- .../v1beta1/expressionwarning.go | 4 +- .../v1beta1/matchcondition.go | 4 +- .../v1beta1/matchresources.go | 8 +- .../v1beta1/mutatingadmissionpolicy.go | 4 +- .../v1beta1/mutatingadmissionpolicybinding.go | 4 +- .../v1beta1/mutatingwebhook.go | 20 +- .../v1beta1/mutatingwebhookconfiguration.go | 4 +- .../v1beta1/namedrulewithoperations.go | 2 +- .../v1beta1/paramkind.go | 4 +- .../admissionregistration/v1beta1/paramref.go | 2 +- .../v1beta1/servicereference.go | 10 +- .../v1beta1/typechecking.go | 2 +- .../v1beta1/validatingadmissionpolicy.go | 6 +- .../validatingadmissionpolicybinding.go | 4 +- .../validatingadmissionpolicybindingspec.go | 4 +- .../v1beta1/validatingadmissionpolicyspec.go | 10 +- .../validatingadmissionpolicystatus.go | 6 +- .../v1beta1/validatingwebhook.go | 20 +- .../v1beta1/validatingwebhookconfiguration.go | 4 +- .../v1beta1/validation.go | 6 +- .../admissionregistration/v1beta1/variable.go | 4 +- .../v1beta1/webhookclientconfig.go | 6 +- .../v1alpha1/serverstorageversion.go | 7 +- .../v1alpha1/storageversion.go | 5 +- .../v1alpha1/storageversioncondition.go | 12 +- .../v1alpha1/storageversionstatus.go | 9 +- .../v2beta1/containerresourcemetricsource.go | 87 - .../v2beta1/containerresourcemetricstatus.go | 88 - .../v2beta1/crossversionobjectreference.go | 62 - .../v2beta1/externalmetricsource.go | 83 - .../v2beta1/externalmetricstatus.go | 80 - .../horizontalpodautoscalercondition.go | 91 - .../v2beta1/horizontalpodautoscalerspec.go | 89 - .../v2beta1/horizontalpodautoscalerstatus.go | 110 - .../autoscaling/v2beta1/metricspec.go | 113 - .../autoscaling/v2beta1/metricstatus.go | 112 - .../autoscaling/v2beta1/objectmetricsource.go | 91 - .../autoscaling/v2beta1/objectmetricstatus.go | 91 - .../autoscaling/v2beta1/podsmetricsource.go | 73 - .../autoscaling/v2beta1/podsmetricstatus.go | 71 - .../v2beta1/resourcemetricsource.go | 77 - .../v2beta1/resourcemetricstatus.go | 78 - .../v2beta2/containerresourcemetricsource.go | 72 - .../v2beta2/containerresourcemetricstatus.go | 70 - .../v2beta2/crossversionobjectreference.go | 62 - .../v2beta2/externalmetricsource.go | 54 - .../v2beta2/externalmetricstatus.go | 53 - .../horizontalpodautoscalerbehavior.go | 60 - .../horizontalpodautoscalercondition.go | 91 - .../v2beta2/horizontalpodautoscalerspec.go | 102 - .../v2beta2/horizontalpodautoscalerstatus.go | 110 - .../autoscaling/v2beta2/hpascalingpolicy.go | 68 - .../autoscaling/v2beta2/hpascalingrules.go | 83 - .../autoscaling/v2beta2/metricidentifier.go | 58 - .../autoscaling/v2beta2/metricspec.go | 113 - .../autoscaling/v2beta2/metricstatus.go | 112 - .../autoscaling/v2beta2/metrictarget.go | 81 - .../autoscaling/v2beta2/metricvaluestatus.go | 69 - .../autoscaling/v2beta2/objectmetricsource.go | 62 - .../autoscaling/v2beta2/objectmetricstatus.go | 62 - .../autoscaling/v2beta2/podsmetricsource.go | 55 - .../autoscaling/v2beta2/podsmetricstatus.go | 53 - .../v2beta2/resourcemetricsource.go | 62 - .../v2beta2/resourcemetricstatus.go | 60 - .../v1beta1/podcertificaterequestspec.go | 48 +- .../core/v1/imagevolumestatus.go | 44 + .../v1/nodeallocatableresourceclaimstatus.go | 75 + .../core/v1/persistentvolumesource.go | 3 +- .../core/v1/podcondition.go | 1 - .../core/v1/podresourceclaim.go | 18 + .../core/v1/podresourceclaimstatus.go | 13 +- .../core/v1/podschedulinggroup.go | 46 + .../applyconfigurations/core/v1/podspec.go | 28 +- .../applyconfigurations/core/v1/podstatus.go | 19 + .../core/v1/resourcehealth.go | 11 + .../core/v1/securitycontext.go | 1 - .../core/v1/volumemountstatus.go | 11 + .../core/v1/volumesource.go | 5 +- .../core/v1/volumestatus.go | 43 + .../core/v1/workloadreference.go | 74 - .../applyconfigurations/internal/internal.go | 1498 ++- .../resource/v1/allocationresult.go | 2 +- .../resource/v1/celdeviceselector.go | 8 + .../applyconfigurations/resource/v1/device.go | 35 +- .../resource/v1/deviceattribute.go | 56 + .../resource/v1/deviceclass.go | 3 - .../resource/v1/deviceclassspec.go | 2 +- .../resource/v1/deviceconstraint.go | 10 + .../v1/devicerequestallocationresult.go | 9 +- .../resource/v1/devicesubrequest.go | 2 +- .../resource/v1/devicetaint.go | 11 +- .../resource/v1/exactdevicerequest.go | 5 +- .../resource/v1/networkdevicedata.go | 4 +- .../v1/nodeallocatableresourcemapping.go | 84 + .../resource/v1/resourceclaim.go | 3 - .../resource/v1/resourceclaimtemplate.go | 3 - .../resource/v1/resourceslice.go | 3 - .../resource/v1alpha3/devicetaint.go | 11 +- .../resource/v1alpha3/poolstatus.go | 152 + .../v1alpha3/resourcepoolstatusrequest.go} | 165 +- .../v1alpha3/resourcepoolstatusrequestspec.go | 73 + .../resourcepoolstatusrequeststatus.go | 87 + .../resource/v1beta1/allocationresult.go | 2 +- .../resource/v1beta1/basicdevice.go | 35 +- .../resource/v1beta1/celdeviceselector.go | 8 + .../resource/v1beta1/deviceattribute.go | 56 + .../resource/v1beta1/deviceclassspec.go | 2 +- .../resource/v1beta1/deviceconstraint.go | 10 + .../resource/v1beta1/devicerequest.go | 2 +- .../v1beta1/devicerequestallocationresult.go | 6 +- .../resource/v1beta1/devicesubrequest.go | 2 +- .../resource/v1beta1/devicetaint.go | 11 +- .../resource/v1beta1/networkdevicedata.go | 4 +- .../v1beta1/nodeallocatableresourcemapping.go | 84 + .../resource/v1beta2/allocationresult.go | 2 +- .../resource/v1beta2/celdeviceselector.go | 8 + .../resource/v1beta2/device.go | 35 +- .../resource/v1beta2/deviceattribute.go | 56 + .../resource/v1beta2/deviceclassspec.go | 2 +- .../resource/v1beta2/deviceconstraint.go | 10 + .../v1beta2/devicerequestallocationresult.go | 6 +- .../resource/v1beta2/devicesubrequest.go | 2 +- .../resource/v1beta2/devicetaint.go | 11 +- .../v1beta2/devicetaintrule.go} | 128 +- .../resource/v1beta2/devicetaintrulespec.go | 55 + .../resource/v1beta2/devicetaintrulestatus.go | 70 + .../resource/v1beta2/devicetaintselector.go | 76 + .../resource/v1beta2/exactdevicerequest.go | 2 +- .../resource/v1beta2/networkdevicedata.go | 4 +- .../v1beta2/nodeallocatableresourcemapping.go | 84 + .../scheduling/v1alpha1/podgroup.go | 53 - .../gangschedulingpolicy.go | 2 +- .../v1alpha2/podgroup.go} | 126 +- .../v1alpha2/podgroupresourceclaim.go | 89 + .../v1alpha2/podgroupresourceclaimstatus.go | 59 + .../v1alpha2/podgroupschedulingconstraints.go | 48 + .../podgroupschedulingpolicy.go} | 23 +- .../scheduling/v1alpha2/podgroupspec.go | 145 + .../scheduling/v1alpha2/podgroupstatus.go | 81 + .../scheduling/v1alpha2/podgrouptemplate.go | 136 + .../v1alpha2/podgrouptemplatereference.go | 44 + .../scheduling/v1alpha2/topologyconstraint.go | 45 + .../typedlocalobjectreference.go | 2 +- .../{v1alpha1 => v1alpha2}/workload.go | 19 +- .../workloadpodgrouptemplatereference.go | 52 + .../{v1alpha1 => v1alpha2}/workloadspec.go | 20 +- .../storage/v1/csidriverspec.go | 28 +- .../storage/v1/volumeerror.go | 2 +- .../storage/v1beta1/csidriverspec.go | 26 + .../client-go/applyconfigurations/utils.go | 184 +- .../k8s.io/client-go/dynamic/fake/simple.go | 6 +- vendor/k8s.io/client-go/features/envvar.go | 35 +- vendor/k8s.io/client-go/features/features.go | 6 +- .../client-go/features/known_features.go | 40 + .../admissionregistration/v1/interface.go | 14 + .../v1/mutatingadmissionpolicy.go | 115 + .../v1/mutatingadmissionpolicybinding.go | 115 + .../v1/mutatingwebhookconfiguration.go | 48 +- .../v1/validatingadmissionpolicy.go | 48 +- .../v1/validatingadmissionpolicybinding.go | 48 +- .../v1/validatingwebhookconfiguration.go | 48 +- .../v1alpha1/mutatingadmissionpolicy.go | 48 +- .../mutatingadmissionpolicybinding.go | 48 +- .../v1alpha1/validatingadmissionpolicy.go | 48 +- .../validatingadmissionpolicybinding.go | 48 +- .../v1beta1/mutatingadmissionpolicy.go | 48 +- .../v1beta1/mutatingadmissionpolicybinding.go | 48 +- .../v1beta1/mutatingwebhookconfiguration.go | 48 +- .../v1beta1/validatingadmissionpolicy.go | 48 +- .../validatingadmissionpolicybinding.go | 48 +- .../v1beta1/validatingwebhookconfiguration.go | 48 +- .../v1alpha1/storageversion.go | 48 +- .../informers/apps/v1/controllerrevision.go | 48 +- .../client-go/informers/apps/v1/daemonset.go | 48 +- .../client-go/informers/apps/v1/deployment.go | 48 +- .../client-go/informers/apps/v1/replicaset.go | 48 +- .../informers/apps/v1/statefulset.go | 48 +- .../apps/v1beta1/controllerrevision.go | 48 +- .../informers/apps/v1beta1/deployment.go | 48 +- .../informers/apps/v1beta1/statefulset.go | 48 +- .../apps/v1beta2/controllerrevision.go | 48 +- .../informers/apps/v1beta2/daemonset.go | 48 +- .../informers/apps/v1beta2/deployment.go | 48 +- .../informers/apps/v1beta2/replicaset.go | 48 +- .../informers/apps/v1beta2/statefulset.go | 48 +- .../informers/autoscaling/interface.go | 16 - .../autoscaling/v1/horizontalpodautoscaler.go | 48 +- .../autoscaling/v2/horizontalpodautoscaler.go | 48 +- .../v2beta1/horizontalpodautoscaler.go | 102 - .../autoscaling/v2beta1/interface.go | 45 - .../v2beta2/horizontalpodautoscaler.go | 102 - .../autoscaling/v2beta2/interface.go | 45 - .../client-go/informers/batch/v1/cronjob.go | 48 +- .../client-go/informers/batch/v1/job.go | 48 +- .../informers/batch/v1beta1/cronjob.go | 48 +- .../v1/certificatesigningrequest.go | 48 +- .../v1alpha1/clustertrustbundle.go | 48 +- .../v1beta1/certificatesigningrequest.go | 48 +- .../v1beta1/clustertrustbundle.go | 48 +- .../v1beta1/podcertificaterequest.go | 48 +- .../informers/coordination/v1/lease.go | 48 +- .../coordination/v1alpha2/leasecandidate.go | 48 +- .../informers/coordination/v1beta1/lease.go | 48 +- .../coordination/v1beta1/leasecandidate.go | 48 +- .../informers/core/v1/componentstatus.go | 48 +- .../client-go/informers/core/v1/configmap.go | 48 +- .../client-go/informers/core/v1/endpoints.go | 48 +- .../client-go/informers/core/v1/event.go | 48 +- .../client-go/informers/core/v1/limitrange.go | 48 +- .../client-go/informers/core/v1/namespace.go | 48 +- .../client-go/informers/core/v1/node.go | 48 +- .../informers/core/v1/persistentvolume.go | 48 +- .../core/v1/persistentvolumeclaim.go | 48 +- .../k8s.io/client-go/informers/core/v1/pod.go | 48 +- .../informers/core/v1/podtemplate.go | 48 +- .../core/v1/replicationcontroller.go | 48 +- .../informers/core/v1/resourcequota.go | 48 +- .../client-go/informers/core/v1/secret.go | 48 +- .../client-go/informers/core/v1/service.go | 48 +- .../informers/core/v1/serviceaccount.go | 48 +- .../informers/discovery/v1/endpointslice.go | 48 +- .../discovery/v1beta1/endpointslice.go | 48 +- .../client-go/informers/events/v1/event.go | 48 +- .../informers/events/v1beta1/event.go | 48 +- .../informers/extensions/v1beta1/daemonset.go | 48 +- .../extensions/v1beta1/deployment.go | 48 +- .../informers/extensions/v1beta1/ingress.go | 48 +- .../extensions/v1beta1/networkpolicy.go | 48 +- .../extensions/v1beta1/replicaset.go | 48 +- vendor/k8s.io/client-go/informers/factory.go | 110 +- .../informers/flowcontrol/v1/flowschema.go | 48 +- .../v1/prioritylevelconfiguration.go | 48 +- .../flowcontrol/v1beta1/flowschema.go | 48 +- .../v1beta1/prioritylevelconfiguration.go | 48 +- .../flowcontrol/v1beta2/flowschema.go | 48 +- .../v1beta2/prioritylevelconfiguration.go | 48 +- .../flowcontrol/v1beta3/flowschema.go | 48 +- .../v1beta3/prioritylevelconfiguration.go | 48 +- vendor/k8s.io/client-go/informers/generic.go | 30 +- .../internalinterfaces/factory_interfaces.go | 19 + .../informers/networking/v1/ingress.go | 48 +- .../informers/networking/v1/ingressclass.go | 48 +- .../informers/networking/v1/ipaddress.go | 48 +- .../informers/networking/v1/networkpolicy.go | 48 +- .../informers/networking/v1/servicecidr.go | 48 +- .../informers/networking/v1beta1/ingress.go | 48 +- .../networking/v1beta1/ingressclass.go | 48 +- .../informers/networking/v1beta1/ipaddress.go | 48 +- .../networking/v1beta1/servicecidr.go | 48 +- .../informers/node/v1/runtimeclass.go | 48 +- .../informers/node/v1alpha1/runtimeclass.go | 48 +- .../informers/node/v1beta1/runtimeclass.go | 48 +- .../policy/v1/poddisruptionbudget.go | 48 +- .../policy/v1beta1/poddisruptionbudget.go | 48 +- .../informers/rbac/v1/clusterrole.go | 48 +- .../informers/rbac/v1/clusterrolebinding.go | 48 +- .../client-go/informers/rbac/v1/role.go | 48 +- .../informers/rbac/v1/rolebinding.go | 48 +- .../informers/rbac/v1alpha1/clusterrole.go | 48 +- .../rbac/v1alpha1/clusterrolebinding.go | 48 +- .../client-go/informers/rbac/v1alpha1/role.go | 48 +- .../informers/rbac/v1alpha1/rolebinding.go | 48 +- .../informers/rbac/v1beta1/clusterrole.go | 48 +- .../rbac/v1beta1/clusterrolebinding.go | 48 +- .../client-go/informers/rbac/v1beta1/role.go | 48 +- .../informers/rbac/v1beta1/rolebinding.go | 48 +- .../informers/resource/v1/deviceclass.go | 48 +- .../informers/resource/v1/resourceclaim.go | 48 +- .../resource/v1/resourceclaimtemplate.go | 48 +- .../informers/resource/v1/resourceslice.go | 48 +- .../resource/v1alpha3/devicetaintrule.go | 48 +- .../informers/resource/v1alpha3/interface.go | 7 + .../v1alpha3/resourcepoolstatusrequest.go | 115 + .../informers/resource/v1beta1/deviceclass.go | 48 +- .../resource/v1beta1/resourceclaim.go | 48 +- .../resource/v1beta1/resourceclaimtemplate.go | 48 +- .../resource/v1beta1/resourceslice.go | 48 +- .../informers/resource/v1beta2/deviceclass.go | 48 +- .../resource/v1beta2/devicetaintrule.go | 115 + .../informers/resource/v1beta2/interface.go | 7 + .../resource/v1beta2/resourceclaim.go | 48 +- .../resource/v1beta2/resourceclaimtemplate.go | 48 +- .../resource/v1beta2/resourceslice.go | 48 +- .../informers/scheduling/interface.go | 12 +- .../informers/scheduling/v1/priorityclass.go | 48 +- .../scheduling/v1alpha1/priorityclass.go | 101 - .../informers/scheduling/v1alpha1/workload.go | 102 - .../{v1alpha1 => v1alpha2}/interface.go | 12 +- .../informers/scheduling/v1alpha2/podgroup.go | 116 + .../informers/scheduling/v1alpha2/workload.go | 116 + .../scheduling/v1beta1/priorityclass.go | 48 +- .../informers/storage/v1/csidriver.go | 48 +- .../client-go/informers/storage/v1/csinode.go | 48 +- .../storage/v1/csistoragecapacity.go | 48 +- .../informers/storage/v1/storageclass.go | 48 +- .../informers/storage/v1/volumeattachment.go | 48 +- .../storage/v1/volumeattributesclass.go | 48 +- .../storage/v1alpha1/csistoragecapacity.go | 48 +- .../storage/v1alpha1/volumeattachment.go | 48 +- .../storage/v1alpha1/volumeattributesclass.go | 48 +- .../informers/storage/v1beta1/csidriver.go | 48 +- .../informers/storage/v1beta1/csinode.go | 48 +- .../storage/v1beta1/csistoragecapacity.go | 48 +- .../informers/storage/v1beta1/storageclass.go | 48 +- .../storage/v1beta1/volumeattachment.go | 48 +- .../storage/v1beta1/volumeattributesclass.go | 48 +- .../v1beta1/storageversionmigration.go | 48 +- .../k8s.io/client-go/kubernetes/clientset.go | 42 +- .../kubernetes/fake/clientset_generated.go | 34 +- .../client-go/kubernetes/fake/register.go | 8 +- .../client-go/kubernetes/scheme/register.go | 8 +- .../v1/admissionregistration_client.go | 10 + .../fake/fake_admissionregistration_client.go | 8 + .../v1/fake/fake_mutatingadmissionpolicy.go | 53 + .../fake_mutatingadmissionpolicybinding.go | 53 + .../v1/generated_expansion.go | 4 + .../v1/mutatingadmissionpolicy.go | 75 + .../v1/mutatingadmissionpolicybinding.go | 75 + .../v2beta1/fake/fake_autoscaling_client.go | 40 - .../fake/fake_horizontalpodautoscaler.go | 53 - .../v2beta1/horizontalpodautoscaler.go | 79 - .../v2beta2/fake/fake_autoscaling_client.go | 40 - .../fake/fake_horizontalpodautoscaler.go | 53 - .../v2beta2/horizontalpodautoscaler.go | 79 - .../typed/core/v1/fake/fake_pod_expansion.go | 21 +- .../v1alpha3/fake/fake_resource_client.go | 4 + .../fake/fake_resourcepoolstatusrequest.go | 53 + .../resource/v1alpha3/generated_expansion.go | 2 + .../resource/v1alpha3/resource_client.go | 5 + .../v1alpha3/resourcepoolstatusrequest.go | 79 + .../typed/resource/v1beta2/devicetaintrule.go | 75 + .../v1beta2/fake/fake_devicetaintrule.go | 53 + .../v1beta2/fake/fake_resource_client.go | 4 + .../resource/v1beta2/generated_expansion.go | 2 + .../typed/resource/v1beta2/resource_client.go | 5 + .../typed/scheduling/v1alpha1/fake/doc.go | 20 - .../v1alpha1/fake/fake_priorityclass.go | 53 - .../scheduling/v1alpha1/fake/fake_workload.go | 51 - .../scheduling/v1alpha1/priorityclass.go | 71 - .../scheduling/{v1alpha1 => v1alpha2}/doc.go | 2 +- .../v1alpha2}/fake/doc.go | 0 .../scheduling/v1alpha2/fake/fake_podgroup.go | 51 + .../fake/fake_scheduling_client.go | 12 +- .../scheduling/v1alpha2/fake/fake_workload.go | 51 + .../generated_expansion.go | 4 +- .../typed/scheduling/v1alpha2/podgroup.go | 75 + .../scheduling_client.go | 42 +- .../{v1alpha1 => v1alpha2}/workload.go | 30 +- .../v1/expansion_generated.go | 8 + .../v1/mutatingadmissionpolicy.go | 48 + .../v1/mutatingadmissionpolicybinding.go | 48 + .../v2beta1/expansion_generated.go | 27 - .../v2beta1/horizontalpodautoscaler.go | 70 - .../v2beta2/expansion_generated.go | 27 - .../v2beta2/horizontalpodautoscaler.go | 70 - .../resource/v1alpha3/expansion_generated.go | 4 + .../v1alpha3/resourcepoolstatusrequest.go | 48 + .../v1beta2/devicetaintrule.go} | 30 +- .../resource/v1beta2/expansion_generated.go | 4 + .../expansion_generated.go | 12 +- .../listers/scheduling/v1alpha2/podgroup.go | 70 + .../{v1alpha1 => v1alpha2}/workload.go | 18 +- .../metadata/metadatainformer/informer.go | 12 +- .../plugin/pkg/client/auth/exec/exec.go | 20 +- vendor/k8s.io/client-go/testing/doc.go | 70 + vendor/k8s.io/client-go/testing/fixture.go | 122 +- vendor/k8s.io/client-go/tools/cache/OWNERS | 1 + .../client-go/tools/cache/controller.go | 171 +- .../client-go/tools/cache/delta_fifo.go | 95 +- .../tools/cache/event_handler_name.go | 121 + .../client-go/tools/cache/expiration_cache.go | 12 +- vendor/k8s.io/client-go/tools/cache/fifo.go | 79 +- .../client-go/tools/cache/fifo_metrics.go | 122 + .../k8s.io/client-go/tools/cache/identity.go | 217 + .../k8s.io/client-go/tools/cache/reflector.go | 199 +- .../tools/cache/reflector_metrics.go | 6 + .../client-go/tools/cache/shared_informer.go | 350 +- vendor/k8s.io/client-go/tools/cache/store.go | 54 +- .../tools/cache/synctrack/synctrack.go | 132 +- .../client-go/tools/cache/the_real_fifo.go | 459 +- .../tools/cache/thread_safe_store.go | 128 +- .../client-go/tools/clientcmd/api/types.go | 6 +- .../tools/clientcmd/client_config.go | 2 + .../client-go/tools/clientcmd/config.go | 1 + .../client-go/tools/clientcmd/loader.go | 2 + .../tools/clientcmd/merged_client_builder.go | 2 + .../tools/leaderelection/leaderelection.go | 42 +- .../tools/leaderelection/leasecandidate.go | 21 +- .../leaderelection/resourcelock/leaselock.go | 2 +- .../k8s.io/client-go/tools/metrics/metrics.go | 78 +- .../tools/portforward/fallback_dialer.go | 31 + .../tools/portforward/portforward.go | 98 + .../tools/portforward/tunneling_dialer.go | 65 +- vendor/k8s.io/client-go/tools/record/event.go | 5 +- .../tools/remotecommand/errorstream.go | 5 +- .../client-go/tools/remotecommand/fallback.go | 2 +- .../tools/remotecommand/remotecommand.go | 5 +- .../client-go/tools/remotecommand/spdy.go | 9 +- .../client-go/tools/remotecommand/v1.go | 12 +- .../client-go/tools/remotecommand/v2.go | 35 +- .../client-go/tools/remotecommand/v3.go | 21 +- .../client-go/tools/remotecommand/v4.go | 17 +- .../client-go/tools/remotecommand/v5.go | 6 +- .../tools/remotecommand/websocket.go | 57 +- .../client-go/tools/watch/retrywatcher.go | 2 +- .../k8s.io/client-go/transport/ca_rotation.go | 154 + vendor/k8s.io/client-go/transport/cache.go | 153 +- vendor/k8s.io/client-go/transport/config.go | 3 +- .../client-go/transport/round_trippers.go | 2 +- .../k8s.io/client-go/transport/spdy/spdy.go | 214 +- .../k8s.io/client-go/transport/transport.go | 25 +- .../transport/websocket/roundtripper.go | 4 +- .../client-go/util/watchlist/watch_list.go | 3 + vendor/k8s.io/cloud-provider/OWNERS | 10 +- .../cloud-provider/app/controllermanager.go | 19 +- vendor/k8s.io/cloud-provider/app/core.go | 1 + .../controllers/node/config/types.go | 4 + .../controllers/node/config/v1alpha1/types.go | 4 + .../v1alpha1/zz_generated.conversion.go | 2 + .../controllers/node/node_controller.go | 7 +- .../controllers/route/metrics.go | 46 + .../controllers/route/route_controller.go | 11 +- .../cloud-provider/options/nodecontroller.go | 12 + .../k8s.io/cloud-provider/options/options.go | 4 +- .../k8s.io/cloud-provider/options/webhook.go | 89 +- .../fake/generator_fake_for_clientset.go | 10 +- .../cmd/deepcopy-gen/args/args.go | 3 - .../cmd/deepcopy-gen/generators/deepcopy.go | 16 +- .../cmd/informer-gen/generators/factory.go | 171 +- .../generators/factoryinterface.go | 21 + .../cmd/informer-gen/generators/informer.go | 58 +- .../cmd/informer-gen/generators/types.go | 9 + .../component-base/cli/flag/curves_flag.go | 50 + vendor/k8s.io/component-base/configz/OWNERS | 4 - .../k8s.io/component-base/configz/configz.go | 41 +- .../featuregate/feature_gate.go | 108 +- .../logs/api/v1/options_no_slog.go | 1 - .../logs/api/v1/options_slog.go | 1 - vendor/k8s.io/component-base/metrics/OWNERS | 3 +- .../component-base/metrics/api/v1/config.go | 127 + .../component-base/metrics/api/v1/doc.go | 34 + .../component-base/metrics/api/v1/types.go | 39 + .../metrics/api/v1/zz_generated.deepcopy.go | 50 + vendor/k8s.io/component-base/metrics/desc.go | 2 +- .../metrics/features/kube_features.go | 26 +- .../component-base/metrics/histogram.go | 23 +- .../metrics/internal/nativehistograms.go | 57 + .../k8s.io/component-base/metrics/metric.go | 4 +- .../k8s.io/component-base/metrics/options.go | 257 +- vendor/k8s.io/component-base/metrics/opts.go | 82 +- .../metrics/processstarttime_others.go | 1 - .../metrics/processstarttime_windows.go | 1 - .../prometheus/clientgo/fifo/metrics.go | 139 + .../metrics/prometheus/clientgo/metrics.go | 1 + .../metrics/prometheus/controllers/metrics.go | 2 +- .../metrics/prometheus/restclient/metrics.go | 84 +- .../metrics/prometheus/version/metrics.go | 2 +- .../metrics/prometheus/workqueue/metrics.go | 14 +- .../k8s.io/component-base/metrics/registry.go | 73 +- .../metrics/testutil/metrics.go | 5 + .../metrics/testutil/testutil.go | 73 + .../k8s.io/component-base/metrics/version.go | 2 +- vendor/k8s.io/component-base/version/base.go | 2 +- .../zpages/features/kube_features.go | 3 + .../component-helpers/resource/helpers.go | 12 + .../pkg/features/kube_features.go | 8 + vendor/k8s.io/klog/v2/ktesting/options.go | 132 + vendor/k8s.io/klog/v2/ktesting/setup.go | 38 + .../k8s.io/klog/v2/ktesting/testinglogger.go | 407 + .../config/v1alpha1/types.go | 11 + .../config/v1alpha1/zz_generated.deepcopy.go | 17 + .../v1alpha1/zz_generated.model_name.go | 5 + .../kube-openapi/pkg/validation/spec/ref.go | 50 - vendor/k8s.io/kubectl/pkg/scale/scale.go | 31 +- .../names/controller_names.go | 2 + .../kubernetes/pkg/api/service/warnings.go | 5 + .../kubernetes/pkg/api/v1/resource/helpers.go | 209 + .../pkg/apis/autoscaling/annotations.go | 8 +- .../kubernetes/pkg/apis/autoscaling/types.go | 2 + .../kubernetes/pkg/apis/certificates/types.go | 44 +- .../certificates/zz_generated.deepcopy.go | 5 + .../pkg/apis/core/helper/helpers.go | 3 + .../k8s.io/kubernetes/pkg/apis/core/types.go | 172 +- .../apis/core/v1/zz_generated.conversion.go | 168 +- .../apis/core/v1/zz_generated.validations.go | 40 +- .../pkg/apis/core/validation/validation.go | 240 +- .../pkg/apis/core/zz_generated.deepcopy.go | 132 +- .../pkg/controller/controller_utils.go | 14 +- .../kubernetes/pkg/features/kube_features.go | 467 +- .../pkg/scheduler/apis/config/types.go | 12 +- .../apis/config/zz_generated.deepcopy.go | 2 + .../k8s.io/kubernetes/pkg/util/hash/hash.go | 2 +- .../test/e2e/framework/framework.go | 116 +- .../test/e2e/framework/ginkgologger.go | 2 +- .../test/e2e/framework/ginkgowrapper.go | 166 +- .../e2e/framework/kubectl/kubectl_utils.go | 2 +- .../test/e2e/framework/network/utils.go | 19 +- .../test/e2e/framework/node/node_killer.go | 94 - .../test/e2e/framework/node/resource.go | 71 +- .../e2e/framework/node/util_sampledevice.go | 57 + .../kubernetes/test/e2e/framework/pod/dial.go | 8 +- .../test/e2e/framework/pod/exec_util.go | 23 +- .../test/e2e/framework/pod/output/output.go | 1 - .../test/e2e/framework/pod/pod_client.go | 22 +- .../test/e2e/framework/service/jig.go | 22 +- .../test/e2e/framework/service/resource.go | 55 +- .../kubernetes/test/e2e/framework/ssh/ssh.go | 24 +- .../test/e2e/framework/test_context.go | 38 +- .../test/e2e/testing-manifests/dra/OWNERS | 1 + .../dra/dra-test-driver-proxy.yaml | 2 +- .../kubectl/agnhost-primary-pod.yaml | 4 +- .../statefulset/etcd/statefulset.yaml | 2 +- .../backup-client-rbac.yaml | 47 + ...orage.k8s.io_snapshotmetadataservices.yaml | 76 + .../external-snapshot-metadata/rbac.yaml | 42 + .../run_snapshot_metadata_e2e.sh | 325 + .../csi-hostpath-plugin.yaml | 16 +- .../storage-csi/gce-pd/controller_ss.yaml | 6 +- .../storage-csi/gce-pd/node_ds.yaml | 2 +- .../hostpath/csi-hostpath-plugin.yaml | 37 +- .../hostpath/csi-hostpath-testing.yaml | 2 +- .../mock/csi-mock-driver-attacher.yaml | 2 +- .../mock/csi-mock-driver-resizer.yaml | 2 +- .../mock/csi-mock-driver-snapshotter.yaml | 2 +- .../storage-csi/mock/csi-mock-driver.yaml | 6 +- .../storage-csi/mock/csi-mock-proxy.yaml | 6 +- vendor/k8s.io/kubernetes/test/utils/audit.go | 36 +- .../kubernetes/test/utils/density_utils.go | 4 +- .../kubernetes/test/utils/deployment.go | 2 +- .../kubernetes/test/utils/image/manifest.go | 44 +- .../kubernetes/test/utils/ktesting/assert.go | 349 + .../test/utils/ktesting/clientcontext.go | 53 + .../test/utils/ktesting/contexthelper.go | 105 + .../kubernetes/test/utils/ktesting/doc.go | 32 + .../test/utils/ktesting/errorcontext.go | 245 + .../utils/ktesting/initoption/initoption.go | 40 + .../test/utils/ktesting/internal/config.go} | 10 +- .../test/utils/ktesting/klogcontext.go} | 23 +- .../test/utils/ktesting/ktesting.go | 55 + .../kubernetes/test/utils/ktesting/signals.go | 236 + .../test/utils/ktesting/signals_non_win.go} | 22 +- .../test/utils/ktesting/signals_win.go | 27 + .../test/utils/ktesting/stepcontext.go | 77 + .../test/utils/ktesting/tcontext.go | 595 ++ .../test/utils/ktesting/withcontext.go | 73 + .../k8s.io/kubernetes/test/utils/runners.go | 6 +- .../kubernetes/test/utils/update_resources.go | 2 +- .../v1alpha1/generated.protomessage.pb.go | 32 - .../v1beta1/generated.protomessage.pb.go | 32 - .../pod-security-admission/policy/registry.go | 6 +- .../google/btree => k8s.io/streaming}/LICENSE | 0 vendor/k8s.io/streaming/pkg/httpstream/doc.go | 19 + .../streaming/pkg/httpstream/httpstream.go | 201 + .../pkg}/httpstream/spdy/connection.go | 4 +- .../pkg}/httpstream/spdy/roundtripper.go | 255 +- .../pkg}/httpstream/spdy/upgrade.go | 8 +- .../pkg}/httpstream/wsstream/conn.go | 44 +- .../pkg}/httpstream/wsstream/doc.go | 0 .../pkg}/httpstream/wsstream/stream.go | 28 +- .../k8s.io/streaming/pkg/runtime/runtime.go | 62 + vendor/k8s.io/utils/buffer/ring_fixed.go | 120 + .../k8s.io/utils/clock/testing/fake_clock.go | 12 +- .../pkg/util => utils}/dump/dump.go | 0 vendor/k8s.io/utils/exec/exec.go | 16 + vendor/k8s.io/utils/exec/fixup_go119.go | 40 - vendor/k8s.io/utils/strings/slices/slices.go | 51 +- .../utils/third_party/forked/golang/LICENSE | 27 + .../utils/third_party/forked/golang/PATENTS | 22 + .../third_party/forked/golang/btree/LICENSE | 202 + .../third_party/forked/golang/btree/README.md | 7 + .../third_party/forked/golang}/btree/btree.go | 481 +- vendor/modules.txt | 309 +- .../proto/client/client.pb.go | 1 - .../v6/schema/elements.go | 47 +- .../structured-merge-diff/v6/typed/remove.go | 65 +- .../v6/value/reflectcache.go | 4 + 1444 files changed, 66868 insertions(+), 64998 deletions(-) delete mode 100644 vendor/github.com/cenkalti/backoff/v4/context.go delete mode 100644 vendor/github.com/cenkalti/backoff/v4/exponential.go delete mode 100644 vendor/github.com/cenkalti/backoff/v4/retry.go delete mode 100644 vendor/github.com/cenkalti/backoff/v4/tries.go rename vendor/github.com/cenkalti/backoff/{v4 => v5}/.gitignore (100%) create mode 100644 vendor/github.com/cenkalti/backoff/v5/CHANGELOG.md rename vendor/github.com/cenkalti/backoff/{v4 => v5}/LICENSE (100%) rename vendor/github.com/cenkalti/backoff/{v4 => v5}/README.md (64%) rename vendor/github.com/cenkalti/backoff/{v4 => v5}/backoff.go (87%) create mode 100644 vendor/github.com/cenkalti/backoff/v5/error.go create mode 100644 vendor/github.com/cenkalti/backoff/v5/exponential.go create mode 100644 vendor/github.com/cenkalti/backoff/v5/retry.go rename vendor/github.com/cenkalti/backoff/{v4 => v5}/ticker.go (80%) rename vendor/github.com/cenkalti/backoff/{v4 => v5}/timer.go (96%) create mode 100644 vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_other.go create mode 100644 vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_unix.go delete mode 100644 vendor/github.com/emicklei/go-restful/v3/.travis.yml delete mode 100644 vendor/github.com/google/btree/README.md delete mode 100644 vendor/github.com/google/btree/btree_generic.go rename vendor/github.com/grpc-ecosystem/{go-grpc-prometheus => go-grpc-middleware/providers/prometheus}/LICENSE (100%) create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_metrics.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_options.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/constants.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/doc.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/options.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/reporter.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_metrics.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_options.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/COPYRIGHT create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/LICENSE create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/callmeta.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/client.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/doc.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/reporter.go create mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/server.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.gitignore delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.travis.yml delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/CHANGELOG.md delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/README.md delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_metrics.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_reporter.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/makefile delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/metric_options.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_metrics.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_reporter.go delete mode 100644 vendor/github.com/grpc-ecosystem/go-grpc-prometheus/util.go rename vendor/github.com/{mxk/go-flowrate => moby/spdystream/spdy}/LICENSE (59%) create mode 100644 vendor/github.com/moby/spdystream/spdy/PATENTS create mode 100644 vendor/github.com/moby/spdystream/spdy/options.go delete mode 100644 vendor/github.com/mxk/go-flowrate/flowrate/flowrate.go delete mode 100644 vendor/github.com/mxk/go-flowrate/flowrate/io.go delete mode 100644 vendor/github.com/mxk/go-flowrate/flowrate/util.go create mode 100644 vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go create mode 100644 vendor/github.com/prometheus/procfs/kernel_hung.go create mode 100644 vendor/github.com/prometheus/procfs/nfnetlink_queue.go create mode 100644 vendor/github.com/prometheus/procfs/proc_statm.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go create mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/client.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/httpconv.go create mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go delete mode 100644 vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter/counter.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/doc.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/target.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/README.md create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/observ.go create mode 100644 vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/x.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go delete mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go create mode 100644 vendor/go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv/metric.go delete mode 100644 vendor/golang.org/x/exp/constraints/constraints.go delete mode 100644 vendor/golang.org/x/exp/slices/cmp.go delete mode 100644 vendor/golang.org/x/exp/slices/zsortanyfunc.go delete mode 100644 vendor/golang.org/x/exp/slices/zsortordered.go delete mode 100644 vendor/golang.org/x/net/context/context.go create mode 100644 vendor/google.golang.org/grpc/reflection/README.md create mode 100644 vendor/google.golang.org/grpc/reflection/adapt.go create mode 100644 vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go create mode 100644 vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go create mode 100644 vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go create mode 100644 vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go create mode 100644 vendor/google.golang.org/grpc/reflection/internal/internal.go create mode 100644 vendor/google.golang.org/grpc/reflection/serverreflection.go delete mode 100644 vendor/k8s.io/api/admission/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/apidiscovery/v2/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/apidiscovery/v2beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/apps/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/apps/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/apps/v1beta2/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/authentication/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/authentication/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/authentication/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/authorization/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/authorization/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/generated.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/generated.proto delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/types.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.model_name.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/generated.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/generated.proto delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/types.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.model_name.go delete mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.prerelease-lifecycle.go delete mode 100644 vendor/k8s.io/api/batch/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/batch/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/certificates/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/certificates/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/certificates/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/coordination/v1alpha2/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/coordination/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/core/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/discovery/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/discovery/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/events/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/extensions/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/flowcontrol/v1beta3/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/imagepolicy/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/networking/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/networking/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/node/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/node/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/node/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/policy/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/policy/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/rbac/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/rbac/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/rbac/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/resource/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/resource/v1alpha3/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/resource/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/resource/v1beta2/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/scheduling/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/generated.proto delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/types.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go delete mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.model_name.go rename vendor/k8s.io/api/scheduling/{v1alpha1 => v1alpha2}/doc.go (84%) create mode 100644 vendor/k8s.io/api/scheduling/v1alpha2/generated.pb.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha2/generated.proto rename vendor/k8s.io/api/scheduling/{v1alpha1 => v1alpha2}/register.go (90%) create mode 100644 vendor/k8s.io/api/scheduling/v1alpha2/types.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha2/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.model_name.go delete mode 100644 vendor/k8s.io/api/scheduling/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/storage/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/storage/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/storage/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/api/storagemigration/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/generated.protomessage.pb.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcecolumndefinition.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourceconversion.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitioncondition.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionnames.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionspec.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionstatus.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionversion.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresources.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresourcescale.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcevalidation.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/externaldocumentation.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/jsonschemaprops.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/selectablefield.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/servicereference.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/validationrule.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookclientconfig.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookconversion.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcecolumndefinition.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourceconversion.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitioncondition.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionnames.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionspec.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionstatus.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionversion.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresources.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresourcescale.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcevalidation.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/externaldocumentation.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/jsonschemaprops.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/selectablefield.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/servicereference.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/validationrule.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/webhookclientconfig.go create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go rename vendor/k8s.io/{client-go/kubernetes/typed/autoscaling/v2beta2/fake => apiextensions-apiserver/pkg/client/clientset/clientset/scheme}/doc.go (86%) create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme/register.go rename vendor/k8s.io/{client-go/kubernetes/typed/autoscaling/v2beta1/autoscaling_client.go => apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/apiextensions_client.go} (59%) create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/customresourcedefinition.go rename vendor/k8s.io/{client-go/kubernetes/typed/autoscaling/v2beta2 => apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1}/doc.go (97%) rename vendor/k8s.io/{client-go/kubernetes/typed/autoscaling/v2beta1 => apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1}/generated_expansion.go (90%) rename vendor/k8s.io/{client-go/kubernetes/typed/autoscaling/v2beta2/autoscaling_client.go => apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/apiextensions_client.go} (57%) create mode 100644 vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/customresourcedefinition.go rename vendor/k8s.io/{client-go/kubernetes/typed/autoscaling/v2beta1 => apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1}/doc.go (97%) rename vendor/k8s.io/{client-go/kubernetes/typed/autoscaling/v2beta2 => apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1}/generated_expansion.go (90%) delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/generated.protomessage.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/validate/content/path.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/api/validation/path/name.go rename vendor/k8s.io/{apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.defaults.go => apimachinery/pkg/apis/meta/internalversion/conversion.go} (53%) create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_byte.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_string.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.protomessage.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/sharding/accessor.go rename vendor/k8s.io/{api/coordination/v1/generated.protomessage.pb.go => apimachinery/pkg/sharding/hash.go} (66%) create mode 100644 vendor/k8s.io/apimachinery/pkg/sharding/selector.go create mode 100644 vendor/k8s.io/apimachinery/pkg/sharding/types.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/spdy.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/proxy/dial.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/proxy/transport.go delete mode 100644 vendor/k8s.io/apimachinery/pkg/util/proxy/upgradeaware.go delete mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/netutil/addr.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/initializer/apiserver_id.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/loader.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/metrics/metrics.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/validation.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/doc.go rename vendor/k8s.io/{api/autoscaling/v2beta2 => apiserver/pkg/admission/plugin/policy/config/apis/policyconfig}/register.go (69%) create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/types.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/doc.go rename vendor/k8s.io/apiserver/pkg/admission/plugin/{webhook/config/apis/webhookadmission/v1alpha1 => policy/config/apis/policyconfig/v1}/register.go (91%) create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.conversion.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/config.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/composite_policy_source.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/policy/manifest/source/source.go delete mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/doc.go delete mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.conversion.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/composite_webhook_source.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/loader/loader.go create mode 100644 vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source/source.go delete mode 100644 vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.protomessage.pb.go create mode 100644 vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/metrics/metrics.go rename vendor/k8s.io/{api/autoscaling/v2beta2 => apiserver/pkg/server/flagz/api/v1beta1}/doc.go (73%) rename vendor/k8s.io/{api/autoscaling/v2beta1 => apiserver/pkg/server/flagz/api/v1beta1}/register.go (53%) rename vendor/k8s.io/apiserver/pkg/{admission/plugin/webhook/config/apis/webhookadmission/v1alpha1 => server/flagz/api/v1beta1}/types.go (52%) rename vendor/k8s.io/apiserver/pkg/{admission/plugin/webhook/config/apis/webhookadmission/v1alpha1 => server/flagz/api/v1beta1}/zz_generated.deepcopy.go (75%) rename vendor/k8s.io/{api/events/v1beta1/generated.protomessage.pb.go => apiserver/pkg/server/flagz/api/v1beta1/zz_generated.model_name.go} (67%) rename vendor/k8s.io/{api/autoscaling/v2beta1 => apiserver/pkg/server/statusz/api/v1beta1}/doc.go (73%) create mode 100644 vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/register.go create mode 100644 vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go create mode 100644 vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/zz_generated.deepcopy.go rename vendor/k8s.io/{api/admission/v1beta1/generated.protomessage.pb.go => apiserver/pkg/server/statusz/api/v1beta1/zz_generated.model_name.go} (66%) create mode 100644 vendor/k8s.io/apiserver/pkg/sharding/parser.go rename vendor/k8s.io/apiserver/pkg/storage/cacher/{ => store}/store.go (92%) rename vendor/k8s.io/apiserver/pkg/storage/cacher/{ => store}/store_btree.go (86%) create mode 100644 vendor/k8s.io/apiserver/pkg/util/filesystem/watchuntil.go create mode 100644 vendor/k8s.io/apiserver/pkg/util/proxy/metrics/metrics.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/applyconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/jsonpatch.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybindingspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicyspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutation.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/crossversionobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalercondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/crossversionobjectreference.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerbehavior.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalercondition.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingpolicy.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingrules.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricidentifier.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricspec.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metrictarget.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricvaluestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricstatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricsource.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/imagevolumestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podschedulinggroup.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumestatus.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/workloadreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresourcemapping.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go rename vendor/k8s.io/client-go/applyconfigurations/{scheduling/v1alpha1/priorityclass.go => resource/v1alpha3/resourcepoolstatusrequest.go} (57%) create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequeststatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresourcemapping.go rename vendor/k8s.io/client-go/applyconfigurations/{autoscaling/v2beta1/horizontalpodautoscaler.go => resource/v1beta2/devicetaintrule.go} (60%) create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresourcemapping.go delete mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/podgroup.go rename vendor/k8s.io/client-go/applyconfigurations/scheduling/{v1alpha1 => v1alpha2}/gangschedulingpolicy.go (99%) rename vendor/k8s.io/client-go/applyconfigurations/{autoscaling/v2beta2/horizontalpodautoscaler.go => scheduling/v1alpha2/podgroup.go} (61%) create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaim.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaimstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingconstraints.go rename vendor/k8s.io/client-go/applyconfigurations/scheduling/{v1alpha1/podgrouppolicy.go => v1alpha2/podgroupschedulingpolicy.go} (60%) create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplate.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplatereference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/topologyconstraint.go rename vendor/k8s.io/client-go/applyconfigurations/scheduling/{v1alpha1 => v1alpha2}/typedlocalobjectreference.go (99%) rename vendor/k8s.io/client-go/applyconfigurations/scheduling/{v1alpha1 => v1alpha2}/workload.go (95%) create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadpodgrouptemplatereference.go rename vendor/k8s.io/client-go/applyconfigurations/scheduling/{v1alpha1 => v1alpha2}/workloadspec.go (75%) create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go create mode 100644 vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go delete mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go delete mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go create mode 100644 vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go create mode 100644 vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go delete mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go delete mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1alpha1/workload.go rename vendor/k8s.io/client-go/informers/scheduling/{v1alpha1 => v1alpha2}/interface.go (82%) create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1alpha2/podgroup.go create mode 100644 vendor/k8s.io/client-go/informers/scheduling/v1alpha2/workload.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicy.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicybinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicy.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicybinding.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_autoscaling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_autoscaling_client.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resourcepoolstatusrequest.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resourcepoolstatusrequest.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/devicetaintrule.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_devicetaintrule.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/doc.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_priorityclass.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_workload.go delete mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/priorityclass.go rename vendor/k8s.io/client-go/kubernetes/typed/scheduling/{v1alpha1 => v1alpha2}/doc.go (97%) rename vendor/k8s.io/client-go/kubernetes/typed/{autoscaling/v2beta1 => scheduling/v1alpha2}/fake/doc.go (100%) create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go rename vendor/k8s.io/client-go/kubernetes/typed/scheduling/{v1alpha1 => v1alpha2}/fake/fake_scheduling_client.go (70%) create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go rename vendor/k8s.io/client-go/kubernetes/typed/scheduling/{v1alpha1 => v1alpha2}/generated_expansion.go (91%) create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go rename vendor/k8s.io/client-go/kubernetes/typed/scheduling/{v1alpha1 => v1alpha2}/scheduling_client.go (67%) rename vendor/k8s.io/client-go/kubernetes/typed/scheduling/{v1alpha1 => v1alpha2}/workload.go (60%) create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicy.go create mode 100644 vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicybinding.go delete mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go delete mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go delete mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go delete mode 100644 vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/listers/resource/v1alpha3/resourcepoolstatusrequest.go rename vendor/k8s.io/client-go/listers/{scheduling/v1alpha1/priorityclass.go => resource/v1beta2/devicetaintrule.go} (50%) rename vendor/k8s.io/client-go/listers/scheduling/{v1alpha1 => v1alpha2}/expansion_generated.go (75%) create mode 100644 vendor/k8s.io/client-go/listers/scheduling/v1alpha2/podgroup.go rename vendor/k8s.io/client-go/listers/scheduling/{v1alpha1 => v1alpha2}/workload.go (80%) create mode 100644 vendor/k8s.io/client-go/testing/doc.go create mode 100644 vendor/k8s.io/client-go/tools/cache/event_handler_name.go create mode 100644 vendor/k8s.io/client-go/tools/cache/fifo_metrics.go create mode 100644 vendor/k8s.io/client-go/tools/cache/identity.go create mode 100644 vendor/k8s.io/client-go/transport/ca_rotation.go create mode 100644 vendor/k8s.io/cloud-provider/controllers/route/metrics.go create mode 100644 vendor/k8s.io/component-base/cli/flag/curves_flag.go create mode 100644 vendor/k8s.io/component-base/metrics/api/v1/config.go create mode 100644 vendor/k8s.io/component-base/metrics/api/v1/doc.go create mode 100644 vendor/k8s.io/component-base/metrics/api/v1/types.go create mode 100644 vendor/k8s.io/component-base/metrics/api/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/component-base/metrics/internal/nativehistograms.go create mode 100644 vendor/k8s.io/component-base/metrics/prometheus/clientgo/fifo/metrics.go create mode 100644 vendor/k8s.io/klog/v2/ktesting/options.go create mode 100644 vendor/k8s.io/klog/v2/ktesting/setup.go create mode 100644 vendor/k8s.io/klog/v2/ktesting/testinglogger.go create mode 100644 vendor/k8s.io/kubernetes/pkg/api/v1/resource/helpers.go delete mode 100644 vendor/k8s.io/kubernetes/test/e2e/framework/node/node_killer.go create mode 100644 vendor/k8s.io/kubernetes/test/e2e/framework/node/util_sampledevice.go create mode 100644 vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/backup-client-rbac.yaml create mode 100644 vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/cbt.storage.k8s.io_snapshotmetadataservices.yaml create mode 100644 vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/rbac.yaml create mode 100644 vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/run_snapshot_metadata_e2e.sh create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/assert.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/clientcontext.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/contexthelper.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/doc.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/errorcontext.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/initoption/initoption.go rename vendor/k8s.io/{apimachinery/pkg/util/proxy/doc.go => kubernetes/test/utils/ktesting/internal/config.go} (81%) rename vendor/k8s.io/{apimachinery/pkg/util/diff/cmp.go => kubernetes/test/utils/ktesting/klogcontext.go} (59%) create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/ktesting.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/signals.go rename vendor/k8s.io/{utils/exec/fixup_go118.go => kubernetes/test/utils/ktesting/signals_non_win.go} (66%) create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/signals_win.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/stepcontext.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/tcontext.go create mode 100644 vendor/k8s.io/kubernetes/test/utils/ktesting/withcontext.go delete mode 100644 vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.protomessage.pb.go delete mode 100644 vendor/k8s.io/metrics/pkg/apis/metrics/v1beta1/generated.protomessage.pb.go rename vendor/{github.com/google/btree => k8s.io/streaming}/LICENSE (100%) create mode 100644 vendor/k8s.io/streaming/pkg/httpstream/doc.go create mode 100644 vendor/k8s.io/streaming/pkg/httpstream/httpstream.go rename vendor/k8s.io/{apimachinery/pkg/util => streaming/pkg}/httpstream/spdy/connection.go (97%) rename vendor/k8s.io/{apimachinery/pkg/util => streaming/pkg}/httpstream/spdy/roundtripper.go (65%) rename vendor/k8s.io/{apimachinery/pkg/util => streaming/pkg}/httpstream/spdy/upgrade.go (93%) rename vendor/k8s.io/{apimachinery/pkg/util => streaming/pkg}/httpstream/wsstream/conn.go (88%) rename vendor/k8s.io/{apimachinery/pkg/util => streaming/pkg}/httpstream/wsstream/doc.go (100%) rename vendor/k8s.io/{apimachinery/pkg/util => streaming/pkg}/httpstream/wsstream/stream.go (81%) create mode 100644 vendor/k8s.io/streaming/pkg/runtime/runtime.go create mode 100644 vendor/k8s.io/utils/buffer/ring_fixed.go rename vendor/k8s.io/{apimachinery/pkg/util => utils}/dump/dump.go (100%) delete mode 100644 vendor/k8s.io/utils/exec/fixup_go119.go create mode 100644 vendor/k8s.io/utils/third_party/forked/golang/LICENSE create mode 100644 vendor/k8s.io/utils/third_party/forked/golang/PATENTS create mode 100644 vendor/k8s.io/utils/third_party/forked/golang/btree/LICENSE create mode 100644 vendor/k8s.io/utils/third_party/forked/golang/btree/README.md rename vendor/{github.com/google => k8s.io/utils/third_party/forked/golang}/btree/btree.go (66%) diff --git a/Dockerfile b/Dockerfile index 12575bafcf..637200ee75 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} golang:1.25.8 AS builder +FROM --platform=${BUILDPLATFORM} golang:1.26.0 AS builder # golang envs ARG TARGETARCH diff --git a/cmd/cloud-controller-manager/gketenantcontrollermanager.go b/cmd/cloud-controller-manager/gketenantcontrollermanager.go index f46bf716d6..a4cf4cb699 100644 --- a/cmd/cloud-controller-manager/gketenantcontrollermanager.go +++ b/cmd/cloud-controller-manager/gketenantcontrollermanager.go @@ -110,6 +110,7 @@ func startGKETenantControllerManager(mgrCfg gkeTenantControllerManagerConfig) (c cfg.Cloud, mgrCfg.completedConfig.ComponentConfig.NodeStatusUpdateFrequency.Duration, mgrCfg.completedConfig.ComponentConfig.NodeController.ConcurrentNodeSyncs, + mgrCfg.completedConfig.ComponentConfig.NodeController.ConcurrentNodeStatusUpdates, ) if err != nil { return err diff --git a/ginko-test-package-version.env b/ginko-test-package-version.env index e8d43fec33..1ff1dd5d86 100644 --- a/ginko-test-package-version.env +++ b/ginko-test-package-version.env @@ -1 +1 @@ -v1.35.1 +v1.36.0 diff --git a/go.mod b/go.mod index 2cf46f4509..9047acc1de 100644 --- a/go.mod +++ b/go.mod @@ -1,33 +1,31 @@ module k8s.io/cloud-provider-gcp -go 1.25.0 - -toolchain go1.25.8 +go 1.26.0 require ( github.com/evanphx/json-patch v5.9.0+incompatible github.com/google/go-cmp v0.7.0 github.com/prometheus/client_golang v1.23.2 // indirect - github.com/spf13/cobra v1.10.0 + github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.11.1 golang.org/x/oauth2 v0.34.0 google.golang.org/api v0.199.0 gopkg.in/gcfg.v1 v1.2.3 gopkg.in/warnings.v0 v0.1.2 // indirect - k8s.io/api v0.35.1 - k8s.io/apimachinery v0.35.1 - k8s.io/apiserver v0.35.1 - k8s.io/client-go v0.35.1 - k8s.io/code-generator v0.35.1 - k8s.io/component-base v0.35.1 - k8s.io/component-helpers v0.35.1 - k8s.io/controller-manager v0.35.1 + k8s.io/api v0.36.0 + k8s.io/apimachinery v0.36.0 + k8s.io/apiserver v0.36.0 + k8s.io/client-go v0.36.0 + k8s.io/code-generator v0.36.0 + k8s.io/component-base v0.36.0 + k8s.io/component-helpers v0.36.0 + k8s.io/controller-manager v0.36.0 k8s.io/klog/v2 v2.140.0 - k8s.io/kube-controller-manager v0.35.1 - k8s.io/kubelet v0.35.1 - k8s.io/metrics v0.35.1 - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 + k8s.io/kube-controller-manager v0.36.0 + k8s.io/kubelet v0.36.0 + k8s.io/metrics v0.36.0 + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 sigs.k8s.io/controller-tools v0.17.2 ) @@ -36,9 +34,9 @@ require ( github.com/GoogleCloudPlatform/gke-networking-api v0.2.1-0.20260327205951-1d0cb5d74c02 github.com/hashicorp/go-multierror v1.1.1 github.com/natefinch/atomic v1.0.1 - k8s.io/cloud-provider v0.35.1 + k8s.io/cloud-provider v0.36.0 k8s.io/cloud-provider-gcp/providers v0.0.0-00010101000000-000000000000 - k8s.io/kubernetes v1.35.1 + k8s.io/kubernetes v1.36.0 ) require ( @@ -47,26 +45,29 @@ require ( cloud.google.com/go/auth/oauth2adapt v0.2.4 // indirect cloud.google.com/go/compute/metadata v0.9.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect - github.com/google/btree v1.1.3 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/x448/float16 v0.8.4 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect - golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect + k8s.io/streaming v0.36.0 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect sigs.k8s.io/controller-runtime v0.14.7 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect ) require ( @@ -75,12 +76,11 @@ require ( github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-semver v0.3.1 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/fatih/color v1.18.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -96,8 +96,7 @@ require ( github.com/google/cel-go v0.26.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/gax-go/v2 v2.13.0 // indirect - github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -108,28 +107,28 @@ require ( 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/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/onsi/gomega v1.38.3 + github.com/onsi/gomega v1.39.1 github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/common v0.67.5 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect - go.etcd.io/etcd/api/v3 v3.6.5 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.6.5 // indirect - go.etcd.io/etcd/client/v3 v3.6.5 // indirect + go.etcd.io/etcd/api/v3 v3.6.8 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.6.8 // indirect + go.etcd.io/etcd/client/v3 v3.6.8 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect go.opentelemetry.io/otel v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect go.opentelemetry.io/otel/metric v1.41.0 // indirect go.opentelemetry.io/otel/sdk v1.41.0 // indirect go.opentelemetry.io/otel/trace v1.41.0 // indirect - go.opentelemetry.io/proto/otlp v1.7.1 // indirect + go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect + go.uber.org/zap v1.27.1 // indirect golang.org/x/crypto v0.48.0 // indirect golang.org/x/mod v0.32.0 // indirect golang.org/x/net v0.49.0 // indirect @@ -137,47 +136,47 @@ require ( golang.org/x/sys v0.41.0 // indirect golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect - golang.org/x/time v0.10.0 // indirect + golang.org/x/time v0.14.0 // indirect golang.org/x/tools v0.41.0 // indirect google.golang.org/grpc v1.79.3 // indirect - google.golang.org/protobuf v1.36.10 // indirect + google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.35.1 // indirect - k8s.io/kms v0.35.1 // indirect - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect + k8s.io/apiextensions-apiserver v0.36.0 // indirect + k8s.io/kms v0.36.0 // indirect + k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) replace ( - k8s.io/api => k8s.io/api v0.35.1 - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.35.1 - k8s.io/apimachinery => k8s.io/apimachinery v0.35.1 - k8s.io/apiserver => k8s.io/apiserver v0.35.1 - k8s.io/cli-runtime => k8s.io/cli-runtime v0.35.1 - k8s.io/client-go => k8s.io/client-go v0.35.1 - k8s.io/cloud-provider => k8s.io/cloud-provider v0.35.1 + k8s.io/api => k8s.io/api v0.36.0 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.36.0 + k8s.io/apimachinery => k8s.io/apimachinery v0.36.0 + k8s.io/apiserver => k8s.io/apiserver v0.36.0 + k8s.io/cli-runtime => k8s.io/cli-runtime v0.36.0 + k8s.io/client-go => k8s.io/client-go v0.36.0 + k8s.io/cloud-provider => k8s.io/cloud-provider v0.36.0 k8s.io/cloud-provider-gcp/providers => ./providers - k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.35.1 - k8s.io/code-generator => k8s.io/code-generator v0.35.1 - k8s.io/component-base => k8s.io/component-base v0.35.1 - k8s.io/component-helpers => k8s.io/component-helpers v0.35.1 - k8s.io/controller-manager => k8s.io/controller-manager v0.35.1 - k8s.io/cri-api => k8s.io/cri-api v0.35.1 - k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.35.1 - k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.35.1 - k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.35.1 - k8s.io/kube-proxy => k8s.io/kube-proxy v0.35.1 - k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.35.1 - k8s.io/kubectl => k8s.io/kubectl v0.35.1 - k8s.io/kubelet => k8s.io/kubelet v0.35.1 - k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.35.1 - k8s.io/metrics => k8s.io/metrics v0.35.1 - k8s.io/mount-utils => k8s.io/mount-utils v0.35.1 - k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.35.1 - k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.35.1 + k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.36.0 + k8s.io/code-generator => k8s.io/code-generator v0.36.0 + k8s.io/component-base => k8s.io/component-base v0.36.0 + k8s.io/component-helpers => k8s.io/component-helpers v0.36.0 + k8s.io/controller-manager => k8s.io/controller-manager v0.36.0 + k8s.io/cri-api => k8s.io/cri-api v0.36.0 + k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.36.0 + k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.36.0 + k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.36.0 + k8s.io/kube-proxy => k8s.io/kube-proxy v0.36.0 + k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.36.0 + k8s.io/kubectl => k8s.io/kubectl v0.36.0 + k8s.io/kubelet => k8s.io/kubelet v0.36.0 + k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.36.0 + k8s.io/metrics => k8s.io/metrics v0.36.0 + k8s.io/mount-utils => k8s.io/mount-utils v0.36.0 + k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.36.0 + k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.36.0 ) diff --git a/go.sum b/go.sum index 3f90f1522c..20cecf0677 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -35,8 +35,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= +github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= @@ -46,8 +46,8 @@ github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= -github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes= +github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -79,11 +79,10 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/gobuffalo/flect v1.0.3 h1:xeWBM2nui+qnVvNM4S3foBhCAL2XgPU+a7FdpelbTq4= github.com/gobuffalo/flect v1.0.3/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= +github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -115,8 +114,8 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 h1:z2ogiKUYzX5Is6zr/vP9vJGqPwcdqsWjOt+V8J7+bTc= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -128,14 +127,12 @@ github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDP github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 h1:qnpSQwGEnkcRpTqNOIR6bJbR0gAorgP9CSALpRcKoAA= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1/go.mod h1:lXGCsh6c22WGtjr+qGHj1otzZpV/1kwTMAqkwZsnWRU= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0 h1:FbSCl+KggFl+Ocym490i/EyXF4lPgLoUtcSWquBM0Rs= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0/go.mod h1:qOchhhIlmRcqk/O9uCo/puJlyo07YINaIqdZfZG3Jkc= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= @@ -181,10 +178,10 @@ github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns= -github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM= -github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= +github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI= +github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= +github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28= +github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -195,10 +192,10 @@ github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UH github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -206,9 +203,9 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/spf13/cobra v1.10.0 h1:a5/WeUlSDCvV5a45ljW2ZFtV0bTDpkfSAj3uqB6Sc+0= -github.com/spf13/cobra v1.10.0/go.mod h1:9dhySC7dnTtEiqzmqfkLj47BslqLCUPMXjG2lj/NgoE= -github.com/spf13/pflag v1.0.8/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= @@ -234,32 +231,32 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= -go.etcd.io/etcd/api/v3 v3.6.5 h1:pMMc42276sgR1j1raO/Qv3QI9Af/AuyQUW6CBAWuntA= -go.etcd.io/etcd/api/v3 v3.6.5/go.mod h1:ob0/oWA/UQQlT1BmaEkWQzI0sJ1M0Et0mMpaABxguOQ= -go.etcd.io/etcd/client/pkg/v3 v3.6.5 h1:Duz9fAzIZFhYWgRjp/FgNq2gO1jId9Yae/rLn3RrBP8= -go.etcd.io/etcd/client/pkg/v3 v3.6.5/go.mod h1:8Wx3eGRPiy0qOFMZT/hfvdos+DjEaPxdIDiCDUv/FQk= -go.etcd.io/etcd/client/v3 v3.6.5 h1:yRwZNFBx/35VKHTcLDeO7XVLbCBFbPi+XV4OC3QJf2U= -go.etcd.io/etcd/client/v3 v3.6.5/go.mod h1:ZqwG/7TAFZ0BJ0jXRPoJjKQJtbFo/9NIY8uoFFKcCyo= -go.etcd.io/etcd/pkg/v3 v3.6.5 h1:byxWB4AqIKI4SBmquZUG1WGtvMfMaorXFoCcFbVeoxM= -go.etcd.io/etcd/pkg/v3 v3.6.5/go.mod h1:uqrXrzmMIJDEy5j00bCqhVLzR5jEJIwDp5wTlLwPGOU= -go.etcd.io/etcd/server/v3 v3.6.5 h1:4RbUb1Bd4y1WkBHmuF+cZII83JNQMuNXzyjwigQ06y0= -go.etcd.io/etcd/server/v3 v3.6.5/go.mod h1:PLuhyVXz8WWRhzXDsl3A3zv/+aK9e4A9lpQkqawIaH0= +go.etcd.io/etcd/api/v3 v3.6.8 h1:gqb1VN92TAI6G2FiBvWcqKtHiIjr4SU2GdXxTwyexbM= +go.etcd.io/etcd/api/v3 v3.6.8/go.mod h1:qyQj1HZPUV3B5cbAL8scG62+fyz5dSxxu0w8pn28N6Q= +go.etcd.io/etcd/client/pkg/v3 v3.6.8 h1:Qs/5C0LNFiqXxYf2GU8MVjYUEXJ6sZaYOz0zEqQgy50= +go.etcd.io/etcd/client/pkg/v3 v3.6.8/go.mod h1:GsiTRUZE2318PggZkAo6sWb6l8JLVrnckTNfbG8PWtw= +go.etcd.io/etcd/client/v3 v3.6.8 h1:B3G76t1UykqAOrbio7s/EPatixQDkQBevN8/mwiplrY= +go.etcd.io/etcd/client/v3 v3.6.8/go.mod h1:MVG4BpSIuumPi+ELF7wYtySETmoTWBHVcDoHdVupwt8= +go.etcd.io/etcd/pkg/v3 v3.6.8 h1:Xe+LIL974spy8b4nEx3H0KMr1ofq3r0kh6FbU3aw4es= +go.etcd.io/etcd/pkg/v3 v3.6.8/go.mod h1:TRibVNe+FqJIe1abOAA1PsuQ4wqO87ZaOoprg09Tn8c= +go.etcd.io/etcd/server/v3 v3.6.8 h1:U2strdSEy1U8qcSzRIdkYpvOPtBy/9i/IfaaCI9flZ4= +go.etcd.io/etcd/server/v3 v3.6.8/go.mod h1:88dCtwUnSirkUoJbflQxxWXqtBSZa6lSG0Kuej+dois= go.etcd.io/raft/v3 v3.6.0 h1:5NtvbDVYpnfZWcIHgGRk9DyzkBIXOi8j+DDp1IcnUWQ= go.etcd.io/raft/v3 v3.6.0/go.mod h1:nLvLevg6+xrVtHUmVaTcTz603gQPHfh7kUAwV6YpfGo= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 h1:XmiuHzgJt067+a6kwyAzkhXooYVv3/TOw9cM2VfJgUM= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0/go.mod h1:KDgtbWKTQs4bM+VPUr6WlL9m/WXcmkCcBlIzqxPGzmI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c= go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 h1:m639+BofXTvcY1q8CGs4ItwQarYtJPOWmVobfM1HpVI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0/go.mod h1:LjReUci/F4BUyv+y4dwnq3h/26iNOeC3wAIqgvTIZVo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 h1:DvJDOPmSWQHWywQS6lKL+pb8s3gBLOZUtw4N+mavW1I= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0/go.mod h1:EtekO9DEJb4/jRyN4v4Qjc2yA7AtfCBuz2FynRUWTXs= go.opentelemetry.io/otel/metric v1.41.0 h1:rFnDcs4gRzBcsO9tS8LCpgR0dxg4aaxWlJxCno7JlTQ= go.opentelemetry.io/otel/metric v1.41.0/go.mod h1:xPvCwd9pU0VN8tPZYzDZV/BMj9CM9vs00GuBjeKhJps= go.opentelemetry.io/otel/sdk v1.41.0 h1:YPIEXKmiAwkGl3Gu1huk1aYWwtpRLeskpV+wPisxBp8= @@ -268,14 +265,14 @@ go.opentelemetry.io/otel/sdk/metric v1.41.0 h1:siZQIYBAUd1rlIWQT2uCxWJxcCO7q3Tri go.opentelemetry.io/otel/sdk/metric v1.41.0/go.mod h1:HNBuSvT7ROaGtGI50ArdRLUnvRTRGniSUZbxiWxSO8Y= go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= -go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= -go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= @@ -286,8 +283,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo= -golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -331,8 +328,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4= -golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -360,10 +357,10 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409/go.mod h1:fl8J1IvUjCilwZzQowmw2b7HQB2eAuYBabMXzWurF+I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -380,8 +377,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -404,46 +401,48 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.35.1 h1:0PO/1FhlK/EQNVK5+txc4FuhQibV25VLSdLMmGpDE/Q= -k8s.io/api v0.35.1/go.mod h1:28uR9xlXWml9eT0uaGo6y71xK86JBELShLy4wR1XtxM= -k8s.io/apiextensions-apiserver v0.35.1 h1:p5vvALkknlOcAqARwjS20kJffgzHqwyQRM8vHLwgU7w= -k8s.io/apiextensions-apiserver v0.35.1/go.mod h1:2CN4fe1GZ3HMe4wBr25qXyJnJyZaquy4nNlNmb3R7AQ= -k8s.io/apimachinery v0.35.1 h1:yxO6gV555P1YV0SANtnTjXYfiivaTPvCTKX6w6qdDsU= -k8s.io/apimachinery v0.35.1/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/apiserver v0.35.1 h1:potxdhhTL4i6AYAa2QCwtlhtB1eCdWQFvJV6fXgJzxs= -k8s.io/apiserver v0.35.1/go.mod h1:BiL6Dd3A2I/0lBnteXfWmCFobHM39vt5+hJQd7Lbpi4= -k8s.io/client-go v0.35.1 h1:+eSfZHwuo/I19PaSxqumjqZ9l5XiTEKbIaJ+j1wLcLM= -k8s.io/client-go v0.35.1/go.mod h1:1p1KxDt3a0ruRfc/pG4qT/3oHmUj1AhSHEcxNSGg+OA= -k8s.io/cloud-provider v0.35.1 h1:ToV1sqvKzoLJp6H+NuGt3bvTCOOY0L1MZzHAHU0/bRs= -k8s.io/cloud-provider v0.35.1/go.mod h1:zGF/i9YuBODKxj7szGMMIz4DRnjsDy5mg2JU+XbbULA= -k8s.io/code-generator v0.35.1 h1:yLKR2la7Z9cWT5qmk67ayx8xXLM4RRKQMnC8YPvTWRI= -k8s.io/code-generator v0.35.1/go.mod h1:F2Fhm7aA69tC/VkMXLDokdovltXEF026Tb9yfQXQWKg= -k8s.io/component-base v0.35.1 h1:XgvpRf4srp037QWfGBLFsYMUQJkE5yMa94UsJU7pmcE= -k8s.io/component-base v0.35.1/go.mod h1:HI/6jXlwkiOL5zL9bqA3en1Ygv60F03oEpnuU1G56Bs= -k8s.io/component-helpers v0.35.1 h1:vwQ/cAfnVwaPeSXTu4DdK3d3n11Lugc5vMb6EV809ZY= -k8s.io/component-helpers v0.35.1/go.mod h1:HQqMwUk68Yyxgj92dJ+J1w/qbx9M0QR0eZ680m/o+Rk= -k8s.io/controller-manager v0.35.1 h1:AKMrGk8sCDa0WtLh+8yfcKck3r/AVw60FOmpak/4fB0= -k8s.io/controller-manager v0.35.1/go.mod h1:ifoFum/gxonT7duRuSrNQxU7bctlStGMXraZP5xbaso= +k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80= +k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34= +k8s.io/apiextensions-apiserver v0.36.0 h1:Wt7E8J+VBCbj4FjiBfDTK/neXDDjyJVJc7xfuOHImZ0= +k8s.io/apiextensions-apiserver v0.36.0/go.mod h1:kGDjH0msuiIB3tgsYRV0kS9GqpMYMUsQ3GHv7TApyug= +k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= +k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= +k8s.io/apiserver v0.36.0 h1:Jg5OFAENUACByUCg15CmhZAYrr5ZyJ+jodyA1mHl3YE= +k8s.io/apiserver v0.36.0/go.mod h1:mHvwdHf+qKEm+1/hYm756SV+oREOKSPnsjagOpx6Vho= +k8s.io/client-go v0.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c= +k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y= +k8s.io/cloud-provider v0.36.0 h1:PtiHsId1lBJixCbl5T+gUzbgOYAPschYj8tEAxxe0Ts= +k8s.io/cloud-provider v0.36.0/go.mod h1:y/3sksoC0taJZR0PcAAYUqVyD6Jzu2X0lD4yCEPXPuI= +k8s.io/code-generator v0.36.0 h1:XWAkrhnArm0VWMmSFO7kyB+wE2LROwep7hEH0GPGkqA= +k8s.io/code-generator v0.36.0/go.mod h1:Tr2UhfBRdlyRoadfob9aPCmmGe8PUs5XPK9MEJ2nx+w= +k8s.io/component-base v0.36.0 h1:hFjEktssxiJhrK1zfybkH4kJOi8iZuF+mIDCqS5+jRo= +k8s.io/component-base v0.36.0/go.mod h1:JZvIfcNHk+uck+8LhJzhSBtydWXaZNQwX2OdL+Mnwsk= +k8s.io/component-helpers v0.36.0 h1:KznLAOD7oPxjaeheW4SOQijz9UtMO8Nvp89+lR8FYks= +k8s.io/component-helpers v0.36.0/go.mod h1:BqZG+01Z97KR8GN9Stb8SiRmtn/EpZogriuQtpMCsLg= +k8s.io/controller-manager v0.36.0 h1:SQoi2QplC2mI7v+rRRVeHtlQcGJVdz8qE86AN+uIT34= +k8s.io/controller-manager v0.36.0/go.mod h1:rrUnt0k8dWeeA8acpBE1kakFwetMJfjfgJuFtWRk54U= k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b h1:gMplByicHV/TJBizHd9aVEsTYoJBnnUAT5MHlTkbjhQ= k8s.io/gengo/v2 v2.0.0-20250922181213-ec3ebc5fd46b/go.mod h1:CgujABENc3KuTrcsdpGmrrASjtQsWCT7R99mEV4U/fM= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kms v0.35.1 h1:kjv2r9g1mY7uL+l1RhyAZvWVZIA/4qIfBHXyjFGLRhU= -k8s.io/kms v0.35.1/go.mod h1:VT+4ekZAdrZDMgShK37vvlyHUVhwI9t/9tvh0AyCWmQ= -k8s.io/kube-controller-manager v0.35.1 h1:tA2RimRDlwyWjKpCax2KJqlatQfAb3p3su4kBzHJG/M= -k8s.io/kube-controller-manager v0.35.1/go.mod h1:feGzY0Z3Z/Cg1raXv6IPzf4VM8fCjEohfa6goaghx8k= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/kubelet v0.35.1 h1:8hOxcPmV50p0N24ScAki8cnYPZlrOpjieLk93zOvZMA= -k8s.io/kubelet v0.35.1/go.mod h1:yJqkfRRPd56bD1Dp8nOof2AsdSKkdPnkfryNibQZk/8= -k8s.io/kubernetes v1.35.1 h1:qmjXSCDPnOuXPuJb5pv+eLzpXhhlD09Jid1pG/OvFU8= -k8s.io/kubernetes v1.35.1/go.mod h1:AaPpCpiS8oAqRbEwpY5r3RitLpwpVp5lVXKFkJril58= -k8s.io/metrics v0.35.1 h1:MUcrUcWlq81XiripkydzCGsY9zQawDXfP9IICNNcVVw= -k8s.io/metrics v0.35.1/go.mod h1:9x7xWOAOiWzHA0vaqLgSE4PXF3vyT5ts5XIbx8OSjiI= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +k8s.io/kms v0.36.0 h1:DPy0VDWi6hCgFMgzV5cNuSDrIROMRcJpTZ1GnB+D368= +k8s.io/kms v0.36.0/go.mod h1:g91diTD9h0oJCCHkTb00krlF+Qm5HTnkWLi9Q/TpRoc= +k8s.io/kube-controller-manager v0.36.0 h1:jWBq6oZ7+NzQBX2Z7IhFuZtQX2GHo9DltdwTcFflK6s= +k8s.io/kube-controller-manager v0.36.0/go.mod h1:FtMkvZsu2oQeS9t/qp8Cx+CddYUCcM4L/OX4FTm+6JQ= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hkbPJgdATINPMAxaynU2Ovg= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +k8s.io/kubelet v0.36.0 h1:zWeevZeGl80DInNU6WUo13yWmgbEajkRaBFqeKqkweA= +k8s.io/kubelet v0.36.0/go.mod h1:PLROV2RwWJkSbAkdZ8HeJWsbsjEEEMlhRIEzAwGeU9c= +k8s.io/kubernetes v1.36.0 h1:JKaAkgSzI4+ZvNWrNJg56jAkUaOiqgBaJstmi6ycyoU= +k8s.io/kubernetes v1.36.0/go.mod h1:MLdeJ3qw2CWH9BFml5GvptxQVQckz54fJOZ/WuixpFE= +k8s.io/metrics v0.36.0 h1:VF41Mv9ZWKKQ4jEiJ0n3Tp6jdyO+oM6dbKcJn6Y/DVg= +k8s.io/metrics v0.36.0/go.mod h1:FY1dgPJZqnSfnOYbVdBEdRNUdy0n1nUCU6yxSMUrVG4= +k8s.io/streaming v0.36.0 h1:agnTxU+NFulUrtYzXUGKO3ndEa8jKwht1Kwn9nu9x+4= +k8s.io/streaming v0.36.0/go.mod h1:z6fV3D+NVkoeqRMtWwlUZK6U17SY/LqNzOxWL6GyR/s= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/controller-runtime v0.14.7 h1:Vrnm2vk9ZFlRkXATHz0W0wXcqNl7kPat8q2JyxVy0Q8= sigs.k8s.io/controller-runtime v0.14.7/go.mod h1:ErTs3SJCOujNUnTz4AS+uh8hp6DHMo1gj6fFndJT1X8= sigs.k8s.io/controller-tools v0.17.2 h1:jNFOKps8WnaRKZU2R+4vRCHnXyJanVmXBWqkuUPFyFg= @@ -452,7 +451,7 @@ sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5E sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/go.work b/go.work index d3f1f63493..2d7bc363f4 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.25.0 +go 1.26.0 use ( . @@ -8,29 +8,29 @@ use ( ) replace ( - k8s.io/api => k8s.io/api v0.35.1 - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.35.1 - k8s.io/apimachinery => k8s.io/apimachinery v0.35.1 - k8s.io/apiserver => k8s.io/apiserver v0.35.1 - k8s.io/cli-runtime => k8s.io/cli-runtime v0.35.1 - k8s.io/client-go => k8s.io/client-go v0.35.1 - k8s.io/cloud-provider => k8s.io/cloud-provider v0.35.1 - k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.35.1 - k8s.io/code-generator => k8s.io/code-generator v0.35.1 - k8s.io/component-base => k8s.io/component-base v0.35.1 - k8s.io/component-helpers => k8s.io/component-helpers v0.35.1 - k8s.io/controller-manager => k8s.io/controller-manager v0.35.1 - k8s.io/cri-api => k8s.io/cri-api v0.35.1 - k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.35.1 - k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.35.1 - k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.35.1 - k8s.io/kube-proxy => k8s.io/kube-proxy v0.35.1 - k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.35.1 - k8s.io/kubectl => k8s.io/kubectl v0.35.1 - k8s.io/kubelet => k8s.io/kubelet v0.35.1 - k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.35.1 - k8s.io/metrics => k8s.io/metrics v0.35.1 - k8s.io/mount-utils => k8s.io/mount-utils v0.35.1 - k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.35.1 - k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.35.1 + k8s.io/api => k8s.io/api v0.36.0 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.36.0 + k8s.io/apimachinery => k8s.io/apimachinery v0.36.0 + k8s.io/apiserver => k8s.io/apiserver v0.36.0 + k8s.io/cli-runtime => k8s.io/cli-runtime v0.36.0 + k8s.io/client-go => k8s.io/client-go v0.36.0 + k8s.io/cloud-provider => k8s.io/cloud-provider v0.36.0 + k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.36.0 + k8s.io/code-generator => k8s.io/code-generator v0.36.0 + k8s.io/component-base => k8s.io/component-base v0.36.0 + k8s.io/component-helpers => k8s.io/component-helpers v0.36.0 + k8s.io/controller-manager => k8s.io/controller-manager v0.36.0 + k8s.io/cri-api => k8s.io/cri-api v0.36.0 + k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.36.0 + k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.36.0 + k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.36.0 + k8s.io/kube-proxy => k8s.io/kube-proxy v0.36.0 + k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.36.0 + k8s.io/kubectl => k8s.io/kubectl v0.36.0 + k8s.io/kubelet => k8s.io/kubelet v0.36.0 + k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.36.0 + k8s.io/metrics => k8s.io/metrics v0.36.0 + k8s.io/mount-utils => k8s.io/mount-utils v0.36.0 + k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.36.0 + k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.36.0 ) diff --git a/metis/Dockerfile b/metis/Dockerfile index 575d8db053..2d7042cf1f 100644 --- a/metis/Dockerfile +++ b/metis/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=${BUILDPLATFORM} golang:1.25.8 AS builder +FROM --platform=${BUILDPLATFORM} golang:1.26.0 AS builder # Install cross-compilers for amd64 and arm64 RUN apt-get update && apt-get install -y \ diff --git a/metis/go.mod b/metis/go.mod index 3e3e306199..57901f7b5e 100644 --- a/metis/go.mod +++ b/metis/go.mod @@ -1,18 +1,16 @@ module k8s.io/metis -go 1.25.0 - -toolchain go1.25.8 +go 1.26.0 require ( github.com/go-logr/logr v1.4.3 github.com/mattn/go-sqlite3 v1.14.37 - github.com/spf13/cobra v1.10.0 + github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 google.golang.org/grpc v1.79.3 - google.golang.org/protobuf v1.36.10 - k8s.io/apimachinery v0.35.1 - k8s.io/component-base v0.35.1 + google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af + k8s.io/apimachinery v0.36.0 + k8s.io/component-base v0.36.0 k8s.io/klog/v2 v2.140.0 ) @@ -22,7 +20,6 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect - github.com/google/go-cmp v0.7.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -31,8 +28,8 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/common v0.67.5 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/x448/float16 v0.8.4 // indirect go.opentelemetry.io/otel v1.41.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.41.0 // indirect @@ -41,11 +38,11 @@ require ( golang.org/x/net v0.49.0 // indirect golang.org/x/sys v0.41.0 // indirect golang.org/x/text v0.34.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect + k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect ) diff --git a/metis/go.sum b/metis/go.sum index 22d76d1c65..c2a0b78feb 100644 --- a/metis/go.sum +++ b/metis/go.sum @@ -53,16 +53,16 @@ github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/spf13/cobra v1.10.0 h1:a5/WeUlSDCvV5a45ljW2ZFtV0bTDpkfSAj3uqB6Sc+0= -github.com/spf13/cobra v1.10.0/go.mod h1:9dhySC7dnTtEiqzmqfkLj47BslqLCUPMXjG2lj/NgoE= -github.com/spf13/pflag v1.0.8/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -87,10 +87,11 @@ go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o= golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8= golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= @@ -99,12 +100,12 @@ golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -112,21 +113,21 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/apimachinery v0.35.1 h1:yxO6gV555P1YV0SANtnTjXYfiivaTPvCTKX6w6qdDsU= -k8s.io/apimachinery v0.35.1/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/component-base v0.35.1 h1:XgvpRf4srp037QWfGBLFsYMUQJkE5yMa94UsJU7pmcE= -k8s.io/component-base v0.35.1/go.mod h1:HI/6jXlwkiOL5zL9bqA3en1Ygv60F03oEpnuU1G56Bs= +k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= +k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= +k8s.io/component-base v0.36.0 h1:hFjEktssxiJhrK1zfybkH4kJOi8iZuF+mIDCqS5+jRo= +k8s.io/component-base v0.36.0/go.mod h1:JZvIfcNHk+uck+8LhJzhSBtydWXaZNQwX2OdL+Mnwsk= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hkbPJgdATINPMAxaynU2Ovg= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/providers/gce/gce_instances.go b/providers/gce/gce_instances.go index edb46018ec..9d707e1aab 100644 --- a/providers/gce/gce_instances.go +++ b/providers/gce/gce_instances.go @@ -286,7 +286,7 @@ func (g *Cloud) InstanceShutdown(ctx context.Context, node *v1.Node) (bool, erro func (g *Cloud) nodeAddressesFromInstance(instance *compute.Instance) ([]v1.NodeAddress, error) { if len(instance.NetworkInterfaces) < 1 { - return nil, fmt.Errorf("could not find network interfaces for instanceID %q", instance.Id) + return nil, fmt.Errorf("could not find network interfaces for instanceID %d", instance.Id) } nodeAddresses := []v1.NodeAddress{} for _, nic := range instance.NetworkInterfaces { diff --git a/providers/go.mod b/providers/go.mod index 9f33c770d9..33424b7749 100644 --- a/providers/go.mod +++ b/providers/go.mod @@ -1,8 +1,6 @@ module k8s.io/cloud-provider-gcp/providers -go 1.25.0 - -toolchain go1.25.8 +go 1.26.0 require ( github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 @@ -12,17 +10,17 @@ require ( google.golang.org/api v0.199.0 gopkg.in/gcfg.v1 v1.2.3 gopkg.in/warnings.v0 v0.1.2 // indirect - k8s.io/api v0.35.1 - k8s.io/apimachinery v0.35.1 - k8s.io/client-go v0.35.1 - k8s.io/component-base v0.35.1 + k8s.io/api v0.36.0 + k8s.io/apimachinery v0.36.0 + k8s.io/client-go v0.36.0 + k8s.io/component-base v0.36.0 k8s.io/klog/v2 v2.140.0 - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 ) require ( cloud.google.com/go/compute/metadata v0.9.0 - k8s.io/cloud-provider v0.35.1 + k8s.io/cloud-provider v0.36.0 ) require ( @@ -32,7 +30,7 @@ require ( github.com/blang/semver/v4 v4.0.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/go-logr/logr v1.4.3 // indirect @@ -42,7 +40,6 @@ require ( github.com/go-openapi/swag v0.23.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/gnostic-models v0.7.0 // indirect - github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect @@ -54,17 +51,16 @@ require ( 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/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/onsi/gomega v1.38.3 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/common v0.67.5 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/x448/float16 v0.8.4 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect go.opentelemetry.io/otel v1.41.0 // indirect go.opentelemetry.io/otel/metric v1.41.0 // indirect go.opentelemetry.io/otel/sdk v1.41.0 // indirect @@ -77,16 +73,16 @@ require ( golang.org/x/sys v0.41.0 // indirect golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect - golang.org/x/time v0.10.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + golang.org/x/time v0.14.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect google.golang.org/grpc v1.79.3 // indirect - google.golang.org/protobuf v1.36.10 // indirect + google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect + k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) diff --git a/providers/go.sum b/providers/go.sum index d297c47546..1dc922c05b 100644 --- a/providers/go.sum +++ b/providers/go.sum @@ -8,8 +8,6 @@ cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCB github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= -github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= -github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= @@ -23,8 +21,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= -github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes= +github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -44,8 +42,6 @@ github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= -github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= -github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -73,8 +69,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -106,10 +100,6 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns= -github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM= -github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -118,10 +108,10 @@ github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UH github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= @@ -143,8 +133,8 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c= go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE= go.opentelemetry.io/otel/metric v1.41.0 h1:rFnDcs4gRzBcsO9tS8LCpgR0dxg4aaxWlJxCno7JlTQ= @@ -169,8 +159,6 @@ golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c= -golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -199,15 +187,13 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4= -golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.41.0 h1:a9b8iMweWG+S0OBnlU36rzLp20z1Rp10w+IY2czHTQc= -golang.org/x/tools v0.41.0/go.mod h1:XSY6eDqxVNiYgezAVqqCeihT4j1U2CCsqvH3WhQpnlg= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= @@ -219,10 +205,10 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 h1:BulPr26Jqjnd4eYDVe+YvyR7Yc2vJGkO5/0UxD0/jZU= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409/go.mod h1:fl8J1IvUjCilwZzQowmw2b7HQB2eAuYBabMXzWurF+I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -239,8 +225,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -257,27 +243,27 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.35.1 h1:0PO/1FhlK/EQNVK5+txc4FuhQibV25VLSdLMmGpDE/Q= -k8s.io/api v0.35.1/go.mod h1:28uR9xlXWml9eT0uaGo6y71xK86JBELShLy4wR1XtxM= -k8s.io/apimachinery v0.35.1 h1:yxO6gV555P1YV0SANtnTjXYfiivaTPvCTKX6w6qdDsU= -k8s.io/apimachinery v0.35.1/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/client-go v0.35.1 h1:+eSfZHwuo/I19PaSxqumjqZ9l5XiTEKbIaJ+j1wLcLM= -k8s.io/client-go v0.35.1/go.mod h1:1p1KxDt3a0ruRfc/pG4qT/3oHmUj1AhSHEcxNSGg+OA= -k8s.io/cloud-provider v0.35.1 h1:ToV1sqvKzoLJp6H+NuGt3bvTCOOY0L1MZzHAHU0/bRs= -k8s.io/cloud-provider v0.35.1/go.mod h1:zGF/i9YuBODKxj7szGMMIz4DRnjsDy5mg2JU+XbbULA= -k8s.io/component-base v0.35.1 h1:XgvpRf4srp037QWfGBLFsYMUQJkE5yMa94UsJU7pmcE= -k8s.io/component-base v0.35.1/go.mod h1:HI/6jXlwkiOL5zL9bqA3en1Ygv60F03oEpnuU1G56Bs= +k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80= +k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34= +k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= +k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= +k8s.io/client-go v0.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c= +k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y= +k8s.io/cloud-provider v0.36.0 h1:PtiHsId1lBJixCbl5T+gUzbgOYAPschYj8tEAxxe0Ts= +k8s.io/cloud-provider v0.36.0/go.mod h1:y/3sksoC0taJZR0PcAAYUqVyD6Jzu2X0lD4yCEPXPuI= +k8s.io/component-base v0.36.0 h1:hFjEktssxiJhrK1zfybkH4kJOi8iZuF+mIDCqS5+jRo= +k8s.io/component-base v0.36.0/go.mod h1:JZvIfcNHk+uck+8LhJzhSBtydWXaZNQwX2OdL+Mnwsk= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hkbPJgdATINPMAxaynU2Ovg= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/test/e2e/firewall.go b/test/e2e/firewall.go index 6b88682f08..28adda2595 100644 --- a/test/e2e/firewall.go +++ b/test/e2e/firewall.go @@ -48,7 +48,11 @@ var _ = Describe("[cloud-provider-gcp-e2e] Firewall Rules", func() { framework.ExpectNoError(err) By("Checking well known ports on master and nodes are not exposed externally") - nodeAddr := e2enode.FirstAddress(nodes, v1.NodeExternalIP) + nodeExternalIPs := e2enode.CollectAddresses(nodes, v1.NodeExternalIP) + nodeAddr := "" + if len(nodeExternalIPs) > 0 { + nodeAddr = nodeExternalIPs[0] + } if nodeAddr != "" { assertNotReachableHTTPTimeout(nodeAddr, "/", ports.KubeletPort, firewallTestTCPTimeout, false) assertNotReachableHTTPTimeout(nodeAddr, "/", ports.KubeletReadOnlyPort, firewallTestTCPTimeout, false) diff --git a/test/e2e/go.mod b/test/e2e/go.mod index 1fe0e8d1b0..22743858d7 100644 --- a/test/e2e/go.mod +++ b/test/e2e/go.mod @@ -1,21 +1,19 @@ module k8s.io/cloud-provider-gcp/test/e2e -go 1.25.0 - -toolchain go1.25.8 +go 1.26.0 require ( github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 - github.com/onsi/ginkgo/v2 v2.27.2 - github.com/onsi/gomega v1.38.3 + github.com/onsi/ginkgo/v2 v2.28.1 + github.com/onsi/gomega v1.39.1 google.golang.org/api v0.199.0 - k8s.io/api v0.35.1 - k8s.io/apimachinery v0.35.1 - k8s.io/client-go v0.35.1 - k8s.io/cloud-provider v0.35.1 + k8s.io/api v0.36.0 + k8s.io/apimachinery v0.36.0 + k8s.io/client-go v0.36.0 + k8s.io/cloud-provider v0.36.0 k8s.io/cloud-provider-gcp/providers v0.0.0-00010101000000-000000000000 - k8s.io/kubernetes v1.35.1 - k8s.io/pod-security-admission v0.35.1 + k8s.io/kubernetes v1.36.0 + k8s.io/pod-security-admission v0.36.0 ) require ( @@ -28,13 +26,13 @@ require ( github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-semver v0.3.1 // indirect - github.com/coreos/go-systemd/v22 v22.5.0 // indirect + github.com/coreos/go-systemd/v22 v22.7.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/distribution/reference v0.6.0 // indirect - github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fxamacker/cbor/v2 v2.9.0 // indirect @@ -47,59 +45,58 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect - github.com/google/btree v1.1.3 // indirect github.com/google/cel-go v0.26.0 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect + github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect - github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/mailru/easyjson v0.9.0 // indirect - github.com/moby/spdystream v0.5.0 // indirect + github.com/moby/spdystream v0.5.1 // 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/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.23.2 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.66.1 // indirect - github.com/prometheus/procfs v0.16.1 // indirect + github.com/prometheus/common v0.67.5 // indirect + github.com/prometheus/procfs v0.19.2 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect - github.com/spf13/cobra v1.10.0 // indirect + github.com/spf13/cobra v1.10.2 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/x448/float16 v0.8.4 // indirect - go.etcd.io/etcd/api/v3 v3.6.5 // indirect - go.etcd.io/etcd/client/pkg/v3 v3.6.5 // indirect - go.etcd.io/etcd/client/v3 v3.6.5 // indirect + go.etcd.io/etcd/api/v3 v3.6.8 // indirect + go.etcd.io/etcd/client/pkg/v3 v3.6.8 // indirect + go.etcd.io/etcd/client/v3 v3.6.8 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/auto/sdk v1.2.1 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect go.opentelemetry.io/otel v1.41.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 // indirect go.opentelemetry.io/otel/metric v1.41.0 // indirect go.opentelemetry.io/otel/sdk v1.41.0 // indirect go.opentelemetry.io/otel/trace v1.41.0 // indirect - go.opentelemetry.io/proto/otlp v1.7.1 // indirect + go.opentelemetry.io/proto/otlp v1.9.0 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.0 // indirect + go.uber.org/zap v1.27.1 // indirect go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.48.0 // indirect - golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect + golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 // indirect golang.org/x/mod v0.32.0 // indirect golang.org/x/net v0.49.0 // indirect golang.org/x/oauth2 v0.34.0 // indirect @@ -107,38 +104,39 @@ require ( golang.org/x/sys v0.41.0 // indirect golang.org/x/term v0.40.0 // indirect golang.org/x/text v0.34.0 // indirect - golang.org/x/time v0.10.0 // indirect + golang.org/x/time v0.14.0 // indirect golang.org/x/tools v0.41.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 // indirect google.golang.org/grpc v1.79.3 // indirect - google.golang.org/protobuf v1.36.10 // indirect + google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af // indirect gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/gcfg.v1 v1.2.3 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.35.1 // indirect - k8s.io/apiserver v0.35.1 // indirect - k8s.io/component-base v0.35.1 // indirect - k8s.io/component-helpers v0.35.1 // indirect - k8s.io/controller-manager v0.35.1 // indirect + k8s.io/apiextensions-apiserver v0.36.0 // indirect + k8s.io/apiserver v0.36.0 // indirect + k8s.io/component-base v0.36.0 // indirect + k8s.io/component-helpers v0.36.0 // indirect + k8s.io/controller-manager v0.36.0 // indirect k8s.io/klog/v2 v2.140.0 // indirect - k8s.io/kms v0.35.1 // indirect - k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect + k8s.io/kms v0.36.0 // indirect + k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a // indirect k8s.io/kubectl v0.0.0 // indirect - k8s.io/kubelet v0.35.1 // indirect - k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect + k8s.io/kubelet v0.36.0 // indirect + k8s.io/streaming v0.36.0 // indirect + k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 // indirect sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect - sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.2 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) replace ( - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.35.1 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.36.0 k8s.io/cloud-provider-gcp/providers => ../../providers - k8s.io/kubectl => k8s.io/kubectl v0.35.1 + k8s.io/kubectl => k8s.io/kubectl v0.36.0 ) diff --git a/test/e2e/go.sum b/test/e2e/go.sum index f9c052a1f1..efdaf02f55 100644 --- a/test/e2e/go.sum +++ b/test/e2e/go.sum @@ -22,8 +22,8 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -31,8 +31,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec= -github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= -github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA= +github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -42,8 +42,8 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfr github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= -github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes= +github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -77,11 +77,10 @@ github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1v github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw= github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= -github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= +github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= @@ -113,8 +112,8 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 h1:EEHtgt9IwisQ2AZ4pIsMjahcegHh6rmhqxzIRQIyepY= -github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6/go.mod h1:I6V7YzU0XDpsHqbsyrghnFZLO1gwK6NPTNvmetQIk9U= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 h1:z2ogiKUYzX5Is6zr/vP9vJGqPwcdqsWjOt+V8J7+bTc= +github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -126,14 +125,12 @@ github.com/googleapis/gax-go/v2 v2.13.0 h1:yitjD5f7jQHhyDsnhKEBU52NdvvdSeGzlAnDP github.com/googleapis/gax-go/v2 v2.13.0/go.mod h1:Z/fvTZXF8/uw7Xu5GuslPw+bplx6SS338j1Is2S+B7A= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 h1:qnpSQwGEnkcRpTqNOIR6bJbR0gAorgP9CSALpRcKoAA= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1/go.mod h1:lXGCsh6c22WGtjr+qGHj1otzZpV/1kwTMAqkwZsnWRU= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0 h1:FbSCl+KggFl+Ocym490i/EyXF4lPgLoUtcSWquBM0Rs= -github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.0/go.mod h1:qOchhhIlmRcqk/O9uCo/puJlyo07YINaIqdZfZG3Jkc= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 h1:X5VWvz21y3gzm9Nw/kaUeku/1+uBhcekkmy4IkffJww= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 h1:QGLs/O40yoNK9vmy4rhUGBVyMf1lISBGtXRpsu/Qu/o= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0/go.mod h1:hM2alZsMUni80N33RBe6J0e423LB+odMj7d3EMP9l20= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 h1:B+8ClL/kCQkRiU82d9xajRPKYMrB7E0MbtzWVi1K4ns= +github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3/go.mod h1:NbCUVmiS4foBGBHOYlCT25+YmGpJ32dZPi75pGEUpj4= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 h1:X+2YciYSxvMQK0UZ7sg45ZVabVZBeBuvMkmuI2V3Fak= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7/go.mod h1:lW34nIZuQ8UDPdkon5fmfp2l3+ZkQ2me/+oecHYLOII= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jonboulle/clockwork v0.5.0 h1:Hyh9A8u51kptdkR+cqRpT1EebBwTn1oK9YfGYbdFz6I= @@ -160,8 +157,8 @@ github.com/maruel/natural v1.1.1 h1:Hja7XhhmvEFhcByqDoHz9QZbkWey+COd9xWfCfn1ioo= github.com/maruel/natural v1.1.1/go.mod h1:v+Rfd79xlw1AgVBjbO0BEQmptqb5HvL/k9GRHB7ZKEg= github.com/mfridman/tparse v0.18.0 h1:wh6dzOKaIwkUGyKgOntDW4liXSo37qg5AXbIhkMV3vE= github.com/mfridman/tparse v0.18.0/go.mod h1:gEvqZTuCgEhPbYk/2lS3Kcxg1GmTxxU7kTC8DvP0i/A= -github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU= -github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= +github.com/moby/spdystream v0.5.1 h1:9sNYeYZUcci9R6/w7KDaFWEWeV4LStVG78Mpyq/Zm/Y= +github.com/moby/spdystream v0.5.1/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -170,12 +167,10 @@ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFd github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/onsi/ginkgo/v2 v2.27.2 h1:LzwLj0b89qtIy6SSASkzlNvX6WktqurSHwkk2ipF/Ns= -github.com/onsi/ginkgo/v2 v2.27.2/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.38.3 h1:eTX+W6dobAYfFeGC2PV6RwXRu/MyT+cQguijutvkpSM= -github.com/onsi/gomega v1.38.3/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= +github.com/onsi/ginkgo/v2 v2.28.1 h1:S4hj+HbZp40fNKuLUQOYLDgZLwNUVn19N3Atb98NCyI= +github.com/onsi/ginkgo/v2 v2.28.1/go.mod h1:CLtbVInNckU3/+gC8LzkGUb9oF+e8W8TdUsxPwvdOgE= +github.com/onsi/gomega v1.39.1 h1:1IJLAad4zjPn2PsnhH70V4DKRFlrCzGBNrNaru+Vf28= +github.com/onsi/gomega v1.39.1/go.mod h1:hL6yVALoTOxeWudERyfppUcZXjMwIMLnuSfruD2lcfg= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -186,10 +181,10 @@ github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UH github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= -github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= -github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= -github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTUGI4= +github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= +github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws= +github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -199,9 +194,9 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= -github.com/spf13/cobra v1.10.0 h1:a5/WeUlSDCvV5a45ljW2ZFtV0bTDpkfSAj3uqB6Sc+0= -github.com/spf13/cobra v1.10.0/go.mod h1:9dhySC7dnTtEiqzmqfkLj47BslqLCUPMXjG2lj/NgoE= -github.com/spf13/pflag v1.0.8/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= @@ -235,32 +230,32 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo= go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E= -go.etcd.io/etcd/api/v3 v3.6.5 h1:pMMc42276sgR1j1raO/Qv3QI9Af/AuyQUW6CBAWuntA= -go.etcd.io/etcd/api/v3 v3.6.5/go.mod h1:ob0/oWA/UQQlT1BmaEkWQzI0sJ1M0Et0mMpaABxguOQ= -go.etcd.io/etcd/client/pkg/v3 v3.6.5 h1:Duz9fAzIZFhYWgRjp/FgNq2gO1jId9Yae/rLn3RrBP8= -go.etcd.io/etcd/client/pkg/v3 v3.6.5/go.mod h1:8Wx3eGRPiy0qOFMZT/hfvdos+DjEaPxdIDiCDUv/FQk= -go.etcd.io/etcd/client/v3 v3.6.5 h1:yRwZNFBx/35VKHTcLDeO7XVLbCBFbPi+XV4OC3QJf2U= -go.etcd.io/etcd/client/v3 v3.6.5/go.mod h1:ZqwG/7TAFZ0BJ0jXRPoJjKQJtbFo/9NIY8uoFFKcCyo= -go.etcd.io/etcd/pkg/v3 v3.6.5 h1:byxWB4AqIKI4SBmquZUG1WGtvMfMaorXFoCcFbVeoxM= -go.etcd.io/etcd/pkg/v3 v3.6.5/go.mod h1:uqrXrzmMIJDEy5j00bCqhVLzR5jEJIwDp5wTlLwPGOU= -go.etcd.io/etcd/server/v3 v3.6.5 h1:4RbUb1Bd4y1WkBHmuF+cZII83JNQMuNXzyjwigQ06y0= -go.etcd.io/etcd/server/v3 v3.6.5/go.mod h1:PLuhyVXz8WWRhzXDsl3A3zv/+aK9e4A9lpQkqawIaH0= +go.etcd.io/etcd/api/v3 v3.6.8 h1:gqb1VN92TAI6G2FiBvWcqKtHiIjr4SU2GdXxTwyexbM= +go.etcd.io/etcd/api/v3 v3.6.8/go.mod h1:qyQj1HZPUV3B5cbAL8scG62+fyz5dSxxu0w8pn28N6Q= +go.etcd.io/etcd/client/pkg/v3 v3.6.8 h1:Qs/5C0LNFiqXxYf2GU8MVjYUEXJ6sZaYOz0zEqQgy50= +go.etcd.io/etcd/client/pkg/v3 v3.6.8/go.mod h1:GsiTRUZE2318PggZkAo6sWb6l8JLVrnckTNfbG8PWtw= +go.etcd.io/etcd/client/v3 v3.6.8 h1:B3G76t1UykqAOrbio7s/EPatixQDkQBevN8/mwiplrY= +go.etcd.io/etcd/client/v3 v3.6.8/go.mod h1:MVG4BpSIuumPi+ELF7wYtySETmoTWBHVcDoHdVupwt8= +go.etcd.io/etcd/pkg/v3 v3.6.8 h1:Xe+LIL974spy8b4nEx3H0KMr1ofq3r0kh6FbU3aw4es= +go.etcd.io/etcd/pkg/v3 v3.6.8/go.mod h1:TRibVNe+FqJIe1abOAA1PsuQ4wqO87ZaOoprg09Tn8c= +go.etcd.io/etcd/server/v3 v3.6.8 h1:U2strdSEy1U8qcSzRIdkYpvOPtBy/9i/IfaaCI9flZ4= +go.etcd.io/etcd/server/v3 v3.6.8/go.mod h1:88dCtwUnSirkUoJbflQxxWXqtBSZa6lSG0Kuej+dois= go.etcd.io/raft/v3 v3.6.0 h1:5NtvbDVYpnfZWcIHgGRk9DyzkBIXOi8j+DDp1IcnUWQ= go.etcd.io/raft/v3 v3.6.0/go.mod h1:nLvLevg6+xrVtHUmVaTcTz603gQPHfh7kUAwV6YpfGo= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 h1:x7wzEgXfnzJcHDwStJT+mxOz4etr2EcexjqhBvmoakw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0/go.mod h1:rg+RlpR5dKwaS95IyyZqj5Wd4E13lk/msnTS0Xl9lJM= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 h1:XmiuHzgJt067+a6kwyAzkhXooYVv3/TOw9cM2VfJgUM= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0/go.mod h1:KDgtbWKTQs4bM+VPUr6WlL9m/WXcmkCcBlIzqxPGzmI= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 h1:7iP2uCb7sGddAr30RRS6xjKy7AZ2JtTOPA3oolgVSw8= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0/go.mod h1:c7hN3ddxs/z6q9xwvfLPk+UHlWRQyaeR1LdgfL/66l0= go.opentelemetry.io/otel v1.41.0 h1:YlEwVsGAlCvczDILpUXpIpPSL/VPugt7zHThEMLce1c= go.opentelemetry.io/otel v1.41.0/go.mod h1:Yt4UwgEKeT05QbLwbyHXEwhnjxNO6D8L5PQP51/46dE= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0fikVry1IsiUnXjf7QFvoNN3Xw= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 h1:m639+BofXTvcY1q8CGs4ItwQarYtJPOWmVobfM1HpVI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0/go.mod h1:LjReUci/F4BUyv+y4dwnq3h/26iNOeC3wAIqgvTIZVo= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 h1:QKdN8ly8zEMrByybbQgv8cWBcdAarwmIPZ6FThrWXJs= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0/go.mod h1:bTdK1nhqF76qiPoCCdyFIV+N/sRHYXYCTQc+3VCi3MI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 h1:DvJDOPmSWQHWywQS6lKL+pb8s3gBLOZUtw4N+mavW1I= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0/go.mod h1:EtekO9DEJb4/jRyN4v4Qjc2yA7AtfCBuz2FynRUWTXs= go.opentelemetry.io/otel/metric v1.41.0 h1:rFnDcs4gRzBcsO9tS8LCpgR0dxg4aaxWlJxCno7JlTQ= go.opentelemetry.io/otel/metric v1.41.0/go.mod h1:xPvCwd9pU0VN8tPZYzDZV/BMj9CM9vs00GuBjeKhJps= go.opentelemetry.io/otel/sdk v1.41.0 h1:YPIEXKmiAwkGl3Gu1huk1aYWwtpRLeskpV+wPisxBp8= @@ -269,14 +264,14 @@ go.opentelemetry.io/otel/sdk/metric v1.41.0 h1:siZQIYBAUd1rlIWQT2uCxWJxcCO7q3Tri go.opentelemetry.io/otel/sdk/metric v1.41.0/go.mod h1:HNBuSvT7ROaGtGI50ArdRLUnvRTRGniSUZbxiWxSO8Y= go.opentelemetry.io/otel/trace v1.41.0 h1:Vbk2co6bhj8L59ZJ6/xFTskY+tGAbOnCtQGVVa9TIN0= go.opentelemetry.io/otel/trace v1.41.0/go.mod h1:U1NU4ULCoxeDKc09yCWdWe+3QoyweJcISEVa1RBzOis= -go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4= -go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= +go.opentelemetry.io/proto/otlp v1.9.0 h1:l706jCMITVouPOqEnii2fIAuO3IVGBRPV5ICjceRb/A= +go.opentelemetry.io/proto/otlp v1.9.0/go.mod h1:xE+Cx5E/eEHw+ISFkwPLwCZefwVjY+pqKg1qcK03+/4= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= -go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= +go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= @@ -287,8 +282,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts= golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo= -golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 h1:fQsdNF2N+/YewlRZiricy4P1iimyPKZ/xwniHj8Q2a0= +golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93/go.mod h1:EPRbTFwzwjXj9NpYyyrvenVh9Y+GFeEvMNh7Xuz7xgU= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -329,8 +324,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= -golang.org/x/time v0.10.0 h1:3usCWA8tQn0L8+hFJQNgzpWbd89begxN66o1Ojdn5L4= -golang.org/x/time v0.10.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI= +golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -354,10 +349,10 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls= -google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww= -google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 h1:merA0rdPeUV3YIIfHHcH4qBkiQAc1nfCKSI7lB4cV2M= +google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409/go.mod h1:fl8J1IvUjCilwZzQowmw2b7HQB2eAuYBabMXzWurF+I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 h1:H86B94AW+VfJWDqFeEbBPhEtHzJwJfTbgE2lZa54ZAQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -374,8 +369,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE= -google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af h1:+5/Sw3GsDNlEmu7TfklWKPdQ0Ykja5VEmq2i817+jbI= +google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -394,47 +389,49 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.35.1 h1:0PO/1FhlK/EQNVK5+txc4FuhQibV25VLSdLMmGpDE/Q= -k8s.io/api v0.35.1/go.mod h1:28uR9xlXWml9eT0uaGo6y71xK86JBELShLy4wR1XtxM= -k8s.io/apiextensions-apiserver v0.35.1 h1:p5vvALkknlOcAqARwjS20kJffgzHqwyQRM8vHLwgU7w= -k8s.io/apiextensions-apiserver v0.35.1/go.mod h1:2CN4fe1GZ3HMe4wBr25qXyJnJyZaquy4nNlNmb3R7AQ= -k8s.io/apimachinery v0.35.1 h1:yxO6gV555P1YV0SANtnTjXYfiivaTPvCTKX6w6qdDsU= -k8s.io/apimachinery v0.35.1/go.mod h1:jQCgFZFR1F4Ik7hvr2g84RTJSZegBc8yHgFWKn//hns= -k8s.io/apiserver v0.35.1 h1:potxdhhTL4i6AYAa2QCwtlhtB1eCdWQFvJV6fXgJzxs= -k8s.io/apiserver v0.35.1/go.mod h1:BiL6Dd3A2I/0lBnteXfWmCFobHM39vt5+hJQd7Lbpi4= -k8s.io/client-go v0.35.1 h1:+eSfZHwuo/I19PaSxqumjqZ9l5XiTEKbIaJ+j1wLcLM= -k8s.io/client-go v0.35.1/go.mod h1:1p1KxDt3a0ruRfc/pG4qT/3oHmUj1AhSHEcxNSGg+OA= -k8s.io/cloud-provider v0.35.1 h1:ToV1sqvKzoLJp6H+NuGt3bvTCOOY0L1MZzHAHU0/bRs= -k8s.io/cloud-provider v0.35.1/go.mod h1:zGF/i9YuBODKxj7szGMMIz4DRnjsDy5mg2JU+XbbULA= -k8s.io/component-base v0.35.1 h1:XgvpRf4srp037QWfGBLFsYMUQJkE5yMa94UsJU7pmcE= -k8s.io/component-base v0.35.1/go.mod h1:HI/6jXlwkiOL5zL9bqA3en1Ygv60F03oEpnuU1G56Bs= -k8s.io/component-helpers v0.35.1 h1:vwQ/cAfnVwaPeSXTu4DdK3d3n11Lugc5vMb6EV809ZY= -k8s.io/component-helpers v0.35.1/go.mod h1:HQqMwUk68Yyxgj92dJ+J1w/qbx9M0QR0eZ680m/o+Rk= -k8s.io/controller-manager v0.35.1 h1:AKMrGk8sCDa0WtLh+8yfcKck3r/AVw60FOmpak/4fB0= -k8s.io/controller-manager v0.35.1/go.mod h1:ifoFum/gxonT7duRuSrNQxU7bctlStGMXraZP5xbaso= +k8s.io/api v0.36.0 h1:SgqDhZzHdOtMk40xVSvCXkP9ME0H05hPM3p9AB1kL80= +k8s.io/api v0.36.0/go.mod h1:m1LVrGPNYax5NBHdO+QuAedXyuzTt4RryI/qnmNvs34= +k8s.io/apiextensions-apiserver v0.36.0 h1:Wt7E8J+VBCbj4FjiBfDTK/neXDDjyJVJc7xfuOHImZ0= +k8s.io/apiextensions-apiserver v0.36.0/go.mod h1:kGDjH0msuiIB3tgsYRV0kS9GqpMYMUsQ3GHv7TApyug= +k8s.io/apimachinery v0.36.0 h1:jZyPzhd5Z+3h9vJLt0z9XdzW9VzNzWAUw+P1xZ9PXtQ= +k8s.io/apimachinery v0.36.0/go.mod h1:FklypaRJt6n5wUIwWXIP6GJlIpUizTgfo1T/As+Tyxc= +k8s.io/apiserver v0.36.0 h1:Jg5OFAENUACByUCg15CmhZAYrr5ZyJ+jodyA1mHl3YE= +k8s.io/apiserver v0.36.0/go.mod h1:mHvwdHf+qKEm+1/hYm756SV+oREOKSPnsjagOpx6Vho= +k8s.io/client-go v0.36.0 h1:pOYi7C4RHChYjMiHpZSpSbIM6ZxVbRXBy7CuiIwqA3c= +k8s.io/client-go v0.36.0/go.mod h1:ZKKcpwF0aLYfkHFCjillCKaTK/yBkEDHTDXCFY6AS9Y= +k8s.io/cloud-provider v0.36.0 h1:PtiHsId1lBJixCbl5T+gUzbgOYAPschYj8tEAxxe0Ts= +k8s.io/cloud-provider v0.36.0/go.mod h1:y/3sksoC0taJZR0PcAAYUqVyD6Jzu2X0lD4yCEPXPuI= +k8s.io/component-base v0.36.0 h1:hFjEktssxiJhrK1zfybkH4kJOi8iZuF+mIDCqS5+jRo= +k8s.io/component-base v0.36.0/go.mod h1:JZvIfcNHk+uck+8LhJzhSBtydWXaZNQwX2OdL+Mnwsk= +k8s.io/component-helpers v0.36.0 h1:KznLAOD7oPxjaeheW4SOQijz9UtMO8Nvp89+lR8FYks= +k8s.io/component-helpers v0.36.0/go.mod h1:BqZG+01Z97KR8GN9Stb8SiRmtn/EpZogriuQtpMCsLg= +k8s.io/controller-manager v0.36.0 h1:SQoi2QplC2mI7v+rRRVeHtlQcGJVdz8qE86AN+uIT34= +k8s.io/controller-manager v0.36.0/go.mod h1:rrUnt0k8dWeeA8acpBE1kakFwetMJfjfgJuFtWRk54U= k8s.io/klog/v2 v2.140.0 h1:Tf+J3AH7xnUzZyVVXhTgGhEKnFqye14aadWv7bzXdzc= k8s.io/klog/v2 v2.140.0/go.mod h1:o+/RWfJ6PwpnFn7OyAG3QnO47BFsymfEfrz6XyYSSp0= -k8s.io/kms v0.35.1 h1:kjv2r9g1mY7uL+l1RhyAZvWVZIA/4qIfBHXyjFGLRhU= -k8s.io/kms v0.35.1/go.mod h1:VT+4ekZAdrZDMgShK37vvlyHUVhwI9t/9tvh0AyCWmQ= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= -k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= -k8s.io/kubectl v0.35.1 h1:zP3Er8C5i1dcAFUMh9Eva0kVvZHptXIn/+8NtRWMxwg= -k8s.io/kubectl v0.35.1/go.mod h1:cQ2uAPs5IO/kx8R5s5J3Ihv3VCYwrx0obCXum0CvnXo= -k8s.io/kubelet v0.35.1 h1:8hOxcPmV50p0N24ScAki8cnYPZlrOpjieLk93zOvZMA= -k8s.io/kubelet v0.35.1/go.mod h1:yJqkfRRPd56bD1Dp8nOof2AsdSKkdPnkfryNibQZk/8= -k8s.io/kubernetes v1.35.1 h1:qmjXSCDPnOuXPuJb5pv+eLzpXhhlD09Jid1pG/OvFU8= -k8s.io/kubernetes v1.35.1/go.mod h1:AaPpCpiS8oAqRbEwpY5r3RitLpwpVp5lVXKFkJril58= -k8s.io/pod-security-admission v0.35.1 h1:Ra7QA/mTXVabzzgQAe36trllpQdGSvwuq9pdnXsIqoI= -k8s.io/pod-security-admission v0.35.1/go.mod h1:J2OnqW+rNItdl6XZeySa4m2nDqrZ+nBpk1Mr6Vf9M/U= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzkbzn+gDM4X9T4Ck= -k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +k8s.io/kms v0.36.0 h1:DPy0VDWi6hCgFMgzV5cNuSDrIROMRcJpTZ1GnB+D368= +k8s.io/kms v0.36.0/go.mod h1:g91diTD9h0oJCCHkTb00krlF+Qm5HTnkWLi9Q/TpRoc= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a h1:xCeOEAOoGYl2jnJoHkC3hkbPJgdATINPMAxaynU2Ovg= +k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a/go.mod h1:uGBT7iTA6c6MvqUvSXIaYZo9ukscABYi2btjhvgKGZ0= +k8s.io/kubectl v0.36.0 h1:hEGr8NvIm2Wjqs2Xy48Uzmvo6lpHdGKlLyMvau2gTms= +k8s.io/kubectl v0.36.0/go.mod h1:iDe8aV5BEi45W8k+5n71I2pJ/nwE0PHDu+/2cejzYoo= +k8s.io/kubelet v0.36.0 h1:zWeevZeGl80DInNU6WUo13yWmgbEajkRaBFqeKqkweA= +k8s.io/kubelet v0.36.0/go.mod h1:PLROV2RwWJkSbAkdZ8HeJWsbsjEEEMlhRIEzAwGeU9c= +k8s.io/kubernetes v1.36.0 h1:JKaAkgSzI4+ZvNWrNJg56jAkUaOiqgBaJstmi6ycyoU= +k8s.io/kubernetes v1.36.0/go.mod h1:MLdeJ3qw2CWH9BFml5GvptxQVQckz54fJOZ/WuixpFE= +k8s.io/pod-security-admission v0.36.0 h1:YgVsB5KFiUtZfHgcLf/GPGGR9KgoXN4/loadBLCRvhY= +k8s.io/pod-security-admission v0.36.0/go.mod h1:Brj/48uHTUApss1AaehnCw0dgI1Pxk/RAOo1oSNLqhI= +k8s.io/streaming v0.36.0 h1:agnTxU+NFulUrtYzXUGKO3ndEa8jKwht1Kwn9nu9x+4= +k8s.io/streaming v0.36.0/go.mod h1:z6fV3D+NVkoeqRMtWwlUZK6U17SY/LqNzOxWL6GyR/s= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 h1:AZYQSJemyQB5eRxqcPky+/7EdBj0xi3g0ZcxxJ7vbWU= +k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2/go.mod h1:xDxuJ0whA3d0I4mf/C4ppKHxXynQ+fxnkmQH0vTHnuk= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 h1:hSfpvjjTQXQY2Fol2CS0QHMNs/WI1MOSGzCm1KhM5ec= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= -sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2 h1:kwVWMx5yS1CrnFWA/2QHyRVJ8jM6dBA80uLmm0wJkk8= +sigs.k8s.io/structured-merge-diff/v6 v6.3.2/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/tools/version.sh b/tools/version.sh index dfd299c838..82f50ce561 100755 --- a/tools/version.sh +++ b/tools/version.sh @@ -62,7 +62,7 @@ get_version_vars() { # Use git describe to find the version based on tags. #if [[ -n ${KUBE_GIT_VERSION-} ]] || KUBE_GIT_VERSION=$("${git[@]}" describe --tags --match='v*' --abbrev=14 "${KUBE_GIT_COMMIT}^{commit}" 2>/dev/null); then - if [[ -n ${KUBE_GIT_VERSION-} ]] || KUBE_GIT_VERSION=$(echo "v1.35.1+${KUBE_GIT_COMMIT}"); then + if [[ -n ${KUBE_GIT_VERSION-} ]] || KUBE_GIT_VERSION=$(echo "v1.36.0+${KUBE_GIT_COMMIT}"); then # This translates the "git describe" to an actual semver.org # compatible semantic version that looks something like this: # v1.1.0-alpha.0.6+84c76d1142ea4d diff --git a/vendor/github.com/cenkalti/backoff/v4/context.go b/vendor/github.com/cenkalti/backoff/v4/context.go deleted file mode 100644 index 48482330eb..0000000000 --- a/vendor/github.com/cenkalti/backoff/v4/context.go +++ /dev/null @@ -1,62 +0,0 @@ -package backoff - -import ( - "context" - "time" -) - -// BackOffContext is a backoff policy that stops retrying after the context -// is canceled. -type BackOffContext interface { // nolint: golint - BackOff - Context() context.Context -} - -type backOffContext struct { - BackOff - ctx context.Context -} - -// WithContext returns a BackOffContext with context ctx -// -// ctx must not be nil -func WithContext(b BackOff, ctx context.Context) BackOffContext { // nolint: golint - if ctx == nil { - panic("nil context") - } - - if b, ok := b.(*backOffContext); ok { - return &backOffContext{ - BackOff: b.BackOff, - ctx: ctx, - } - } - - return &backOffContext{ - BackOff: b, - ctx: ctx, - } -} - -func getContext(b BackOff) context.Context { - if cb, ok := b.(BackOffContext); ok { - return cb.Context() - } - if tb, ok := b.(*backOffTries); ok { - return getContext(tb.delegate) - } - return context.Background() -} - -func (b *backOffContext) Context() context.Context { - return b.ctx -} - -func (b *backOffContext) NextBackOff() time.Duration { - select { - case <-b.ctx.Done(): - return Stop - default: - return b.BackOff.NextBackOff() - } -} diff --git a/vendor/github.com/cenkalti/backoff/v4/exponential.go b/vendor/github.com/cenkalti/backoff/v4/exponential.go deleted file mode 100644 index aac99f196a..0000000000 --- a/vendor/github.com/cenkalti/backoff/v4/exponential.go +++ /dev/null @@ -1,216 +0,0 @@ -package backoff - -import ( - "math/rand" - "time" -) - -/* -ExponentialBackOff is a backoff implementation that increases the backoff -period for each retry attempt using a randomization function that grows exponentially. - -NextBackOff() is calculated using the following formula: - - randomized interval = - RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor]) - -In other words NextBackOff() will range between the randomization factor -percentage below and above the retry interval. - -For example, given the following parameters: - - RetryInterval = 2 - RandomizationFactor = 0.5 - Multiplier = 2 - -the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, -multiplied by the exponential, that is, between 2 and 6 seconds. - -Note: MaxInterval caps the RetryInterval and not the randomized interval. - -If the time elapsed since an ExponentialBackOff instance is created goes past the -MaxElapsedTime, then the method NextBackOff() starts returning backoff.Stop. - -The elapsed time can be reset by calling Reset(). - -Example: Given the following default arguments, for 10 tries the sequence will be, -and assuming we go over the MaxElapsedTime on the 10th try: - - Request # RetryInterval (seconds) Randomized Interval (seconds) - - 1 0.5 [0.25, 0.75] - 2 0.75 [0.375, 1.125] - 3 1.125 [0.562, 1.687] - 4 1.687 [0.8435, 2.53] - 5 2.53 [1.265, 3.795] - 6 3.795 [1.897, 5.692] - 7 5.692 [2.846, 8.538] - 8 8.538 [4.269, 12.807] - 9 12.807 [6.403, 19.210] - 10 19.210 backoff.Stop - -Note: Implementation is not thread-safe. -*/ -type ExponentialBackOff struct { - InitialInterval time.Duration - RandomizationFactor float64 - Multiplier float64 - MaxInterval time.Duration - // After MaxElapsedTime the ExponentialBackOff returns Stop. - // It never stops if MaxElapsedTime == 0. - MaxElapsedTime time.Duration - Stop time.Duration - Clock Clock - - currentInterval time.Duration - startTime time.Time -} - -// Clock is an interface that returns current time for BackOff. -type Clock interface { - Now() time.Time -} - -// ExponentialBackOffOpts is a function type used to configure ExponentialBackOff options. -type ExponentialBackOffOpts func(*ExponentialBackOff) - -// Default values for ExponentialBackOff. -const ( - DefaultInitialInterval = 500 * time.Millisecond - DefaultRandomizationFactor = 0.5 - DefaultMultiplier = 1.5 - DefaultMaxInterval = 60 * time.Second - DefaultMaxElapsedTime = 15 * time.Minute -) - -// NewExponentialBackOff creates an instance of ExponentialBackOff using default values. -func NewExponentialBackOff(opts ...ExponentialBackOffOpts) *ExponentialBackOff { - b := &ExponentialBackOff{ - InitialInterval: DefaultInitialInterval, - RandomizationFactor: DefaultRandomizationFactor, - Multiplier: DefaultMultiplier, - MaxInterval: DefaultMaxInterval, - MaxElapsedTime: DefaultMaxElapsedTime, - Stop: Stop, - Clock: SystemClock, - } - for _, fn := range opts { - fn(b) - } - b.Reset() - return b -} - -// WithInitialInterval sets the initial interval between retries. -func WithInitialInterval(duration time.Duration) ExponentialBackOffOpts { - return func(ebo *ExponentialBackOff) { - ebo.InitialInterval = duration - } -} - -// WithRandomizationFactor sets the randomization factor to add jitter to intervals. -func WithRandomizationFactor(randomizationFactor float64) ExponentialBackOffOpts { - return func(ebo *ExponentialBackOff) { - ebo.RandomizationFactor = randomizationFactor - } -} - -// WithMultiplier sets the multiplier for increasing the interval after each retry. -func WithMultiplier(multiplier float64) ExponentialBackOffOpts { - return func(ebo *ExponentialBackOff) { - ebo.Multiplier = multiplier - } -} - -// WithMaxInterval sets the maximum interval between retries. -func WithMaxInterval(duration time.Duration) ExponentialBackOffOpts { - return func(ebo *ExponentialBackOff) { - ebo.MaxInterval = duration - } -} - -// WithMaxElapsedTime sets the maximum total time for retries. -func WithMaxElapsedTime(duration time.Duration) ExponentialBackOffOpts { - return func(ebo *ExponentialBackOff) { - ebo.MaxElapsedTime = duration - } -} - -// WithRetryStopDuration sets the duration after which retries should stop. -func WithRetryStopDuration(duration time.Duration) ExponentialBackOffOpts { - return func(ebo *ExponentialBackOff) { - ebo.Stop = duration - } -} - -// WithClockProvider sets the clock used to measure time. -func WithClockProvider(clock Clock) ExponentialBackOffOpts { - return func(ebo *ExponentialBackOff) { - ebo.Clock = clock - } -} - -type systemClock struct{} - -func (t systemClock) Now() time.Time { - return time.Now() -} - -// SystemClock implements Clock interface that uses time.Now(). -var SystemClock = systemClock{} - -// Reset the interval back to the initial retry interval and restarts the timer. -// Reset must be called before using b. -func (b *ExponentialBackOff) Reset() { - b.currentInterval = b.InitialInterval - b.startTime = b.Clock.Now() -} - -// NextBackOff calculates the next backoff interval using the formula: -// Randomized interval = RetryInterval * (1 ± RandomizationFactor) -func (b *ExponentialBackOff) NextBackOff() time.Duration { - // Make sure we have not gone over the maximum elapsed time. - elapsed := b.GetElapsedTime() - next := getRandomValueFromInterval(b.RandomizationFactor, rand.Float64(), b.currentInterval) - b.incrementCurrentInterval() - if b.MaxElapsedTime != 0 && elapsed+next > b.MaxElapsedTime { - return b.Stop - } - return next -} - -// GetElapsedTime returns the elapsed time since an ExponentialBackOff instance -// is created and is reset when Reset() is called. -// -// The elapsed time is computed using time.Now().UnixNano(). It is -// safe to call even while the backoff policy is used by a running -// ticker. -func (b *ExponentialBackOff) GetElapsedTime() time.Duration { - return b.Clock.Now().Sub(b.startTime) -} - -// Increments the current interval by multiplying it with the multiplier. -func (b *ExponentialBackOff) incrementCurrentInterval() { - // Check for overflow, if overflow is detected set the current interval to the max interval. - if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier { - b.currentInterval = b.MaxInterval - } else { - b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier) - } -} - -// Returns a random value from the following interval: -// [currentInterval - randomizationFactor * currentInterval, currentInterval + randomizationFactor * currentInterval]. -func getRandomValueFromInterval(randomizationFactor, random float64, currentInterval time.Duration) time.Duration { - if randomizationFactor == 0 { - return currentInterval // make sure no randomness is used when randomizationFactor is 0. - } - var delta = randomizationFactor * float64(currentInterval) - var minInterval = float64(currentInterval) - delta - var maxInterval = float64(currentInterval) + delta - - // Get a random value from the range [minInterval, maxInterval]. - // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then - // we want a 33% chance for selecting either 1, 2 or 3. - return time.Duration(minInterval + (random * (maxInterval - minInterval + 1))) -} diff --git a/vendor/github.com/cenkalti/backoff/v4/retry.go b/vendor/github.com/cenkalti/backoff/v4/retry.go deleted file mode 100644 index b9c0c51cd7..0000000000 --- a/vendor/github.com/cenkalti/backoff/v4/retry.go +++ /dev/null @@ -1,146 +0,0 @@ -package backoff - -import ( - "errors" - "time" -) - -// An OperationWithData is executing by RetryWithData() or RetryNotifyWithData(). -// The operation will be retried using a backoff policy if it returns an error. -type OperationWithData[T any] func() (T, error) - -// An Operation is executing by Retry() or RetryNotify(). -// The operation will be retried using a backoff policy if it returns an error. -type Operation func() error - -func (o Operation) withEmptyData() OperationWithData[struct{}] { - return func() (struct{}, error) { - return struct{}{}, o() - } -} - -// Notify is a notify-on-error function. It receives an operation error and -// backoff delay if the operation failed (with an error). -// -// NOTE that if the backoff policy stated to stop retrying, -// the notify function isn't called. -type Notify func(error, time.Duration) - -// Retry the operation o until it does not return error or BackOff stops. -// o is guaranteed to be run at least once. -// -// If o returns a *PermanentError, the operation is not retried, and the -// wrapped error is returned. -// -// Retry sleeps the goroutine for the duration returned by BackOff after a -// failed operation returns. -func Retry(o Operation, b BackOff) error { - return RetryNotify(o, b, nil) -} - -// RetryWithData is like Retry but returns data in the response too. -func RetryWithData[T any](o OperationWithData[T], b BackOff) (T, error) { - return RetryNotifyWithData(o, b, nil) -} - -// RetryNotify calls notify function with the error and wait duration -// for each failed attempt before sleep. -func RetryNotify(operation Operation, b BackOff, notify Notify) error { - return RetryNotifyWithTimer(operation, b, notify, nil) -} - -// RetryNotifyWithData is like RetryNotify but returns data in the response too. -func RetryNotifyWithData[T any](operation OperationWithData[T], b BackOff, notify Notify) (T, error) { - return doRetryNotify(operation, b, notify, nil) -} - -// RetryNotifyWithTimer calls notify function with the error and wait duration using the given Timer -// for each failed attempt before sleep. -// A default timer that uses system timer is used when nil is passed. -func RetryNotifyWithTimer(operation Operation, b BackOff, notify Notify, t Timer) error { - _, err := doRetryNotify(operation.withEmptyData(), b, notify, t) - return err -} - -// RetryNotifyWithTimerAndData is like RetryNotifyWithTimer but returns data in the response too. -func RetryNotifyWithTimerAndData[T any](operation OperationWithData[T], b BackOff, notify Notify, t Timer) (T, error) { - return doRetryNotify(operation, b, notify, t) -} - -func doRetryNotify[T any](operation OperationWithData[T], b BackOff, notify Notify, t Timer) (T, error) { - var ( - err error - next time.Duration - res T - ) - if t == nil { - t = &defaultTimer{} - } - - defer func() { - t.Stop() - }() - - ctx := getContext(b) - - b.Reset() - for { - res, err = operation() - if err == nil { - return res, nil - } - - var permanent *PermanentError - if errors.As(err, &permanent) { - return res, permanent.Err - } - - if next = b.NextBackOff(); next == Stop { - if cerr := ctx.Err(); cerr != nil { - return res, cerr - } - - return res, err - } - - if notify != nil { - notify(err, next) - } - - t.Start(next) - - select { - case <-ctx.Done(): - return res, ctx.Err() - case <-t.C(): - } - } -} - -// PermanentError signals that the operation should not be retried. -type PermanentError struct { - Err error -} - -func (e *PermanentError) Error() string { - return e.Err.Error() -} - -func (e *PermanentError) Unwrap() error { - return e.Err -} - -func (e *PermanentError) Is(target error) bool { - _, ok := target.(*PermanentError) - return ok -} - -// Permanent wraps the given err in a *PermanentError. -func Permanent(err error) error { - if err == nil { - return nil - } - return &PermanentError{ - Err: err, - } -} diff --git a/vendor/github.com/cenkalti/backoff/v4/tries.go b/vendor/github.com/cenkalti/backoff/v4/tries.go deleted file mode 100644 index 28d58ca37c..0000000000 --- a/vendor/github.com/cenkalti/backoff/v4/tries.go +++ /dev/null @@ -1,38 +0,0 @@ -package backoff - -import "time" - -/* -WithMaxRetries creates a wrapper around another BackOff, which will -return Stop if NextBackOff() has been called too many times since -the last time Reset() was called - -Note: Implementation is not thread-safe. -*/ -func WithMaxRetries(b BackOff, max uint64) BackOff { - return &backOffTries{delegate: b, maxTries: max} -} - -type backOffTries struct { - delegate BackOff - maxTries uint64 - numTries uint64 -} - -func (b *backOffTries) NextBackOff() time.Duration { - if b.maxTries == 0 { - return Stop - } - if b.maxTries > 0 { - if b.maxTries <= b.numTries { - return Stop - } - b.numTries++ - } - return b.delegate.NextBackOff() -} - -func (b *backOffTries) Reset() { - b.numTries = 0 - b.delegate.Reset() -} diff --git a/vendor/github.com/cenkalti/backoff/v4/.gitignore b/vendor/github.com/cenkalti/backoff/v5/.gitignore similarity index 100% rename from vendor/github.com/cenkalti/backoff/v4/.gitignore rename to vendor/github.com/cenkalti/backoff/v5/.gitignore diff --git a/vendor/github.com/cenkalti/backoff/v5/CHANGELOG.md b/vendor/github.com/cenkalti/backoff/v5/CHANGELOG.md new file mode 100644 index 0000000000..658c37436d --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/CHANGELOG.md @@ -0,0 +1,29 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [5.0.0] - 2024-12-19 + +### Added + +- RetryAfterError can be returned from an operation to indicate how long to wait before the next retry. + +### Changed + +- Retry function now accepts additional options for specifying max number of tries and max elapsed time. +- Retry function now accepts a context.Context. +- Operation function signature changed to return result (any type) and error. + +### Removed + +- RetryNotify* and RetryWithData functions. Only single Retry function remains. +- Optional arguments from ExponentialBackoff constructor. +- Clock and Timer interfaces. + +### Fixed + +- The original error is returned from Retry if there's a PermanentError. (#144) +- The Retry function respects the wrapped PermanentError. (#140) diff --git a/vendor/github.com/cenkalti/backoff/v4/LICENSE b/vendor/github.com/cenkalti/backoff/v5/LICENSE similarity index 100% rename from vendor/github.com/cenkalti/backoff/v4/LICENSE rename to vendor/github.com/cenkalti/backoff/v5/LICENSE diff --git a/vendor/github.com/cenkalti/backoff/v4/README.md b/vendor/github.com/cenkalti/backoff/v5/README.md similarity index 64% rename from vendor/github.com/cenkalti/backoff/v4/README.md rename to vendor/github.com/cenkalti/backoff/v5/README.md index 9433004a28..4611b1d170 100644 --- a/vendor/github.com/cenkalti/backoff/v4/README.md +++ b/vendor/github.com/cenkalti/backoff/v5/README.md @@ -1,4 +1,4 @@ -# Exponential Backoff [![GoDoc][godoc image]][godoc] [![Coverage Status][coveralls image]][coveralls] +# Exponential Backoff [![GoDoc][godoc image]][godoc] This is a Go port of the exponential backoff algorithm from [Google's HTTP Client Library for Java][google-http-java-client]. @@ -9,9 +9,11 @@ The retries exponentially increase and stop increasing when a certain threshold ## Usage -Import path is `github.com/cenkalti/backoff/v4`. Please note the version part at the end. +Import path is `github.com/cenkalti/backoff/v5`. Please note the version part at the end. -Use https://pkg.go.dev/github.com/cenkalti/backoff/v4 to view the documentation. +For most cases, use `Retry` function. See [example_test.go][example] for an example. + +If you have specific needs, copy `Retry` function (from [retry.go][retry-src]) into your code and modify it as needed. ## Contributing @@ -19,12 +21,11 @@ Use https://pkg.go.dev/github.com/cenkalti/backoff/v4 to view the documentation. * Please don't send a PR without opening an issue and discussing it first. * If proposed change is not a common use case, I will probably not accept it. -[godoc]: https://pkg.go.dev/github.com/cenkalti/backoff/v4 +[godoc]: https://pkg.go.dev/github.com/cenkalti/backoff/v5 [godoc image]: https://godoc.org/github.com/cenkalti/backoff?status.png -[coveralls]: https://coveralls.io/github/cenkalti/backoff?branch=master -[coveralls image]: https://coveralls.io/repos/github/cenkalti/backoff/badge.svg?branch=master [google-http-java-client]: https://github.com/google/google-http-java-client/blob/da1aa993e90285ec18579f1553339b00e19b3ab5/google-http-client/src/main/java/com/google/api/client/util/ExponentialBackOff.java [exponential backoff wiki]: http://en.wikipedia.org/wiki/Exponential_backoff -[advanced example]: https://pkg.go.dev/github.com/cenkalti/backoff/v4?tab=doc#pkg-examples +[retry-src]: https://github.com/cenkalti/backoff/blob/v5/retry.go +[example]: https://github.com/cenkalti/backoff/blob/v5/example_test.go diff --git a/vendor/github.com/cenkalti/backoff/v4/backoff.go b/vendor/github.com/cenkalti/backoff/v5/backoff.go similarity index 87% rename from vendor/github.com/cenkalti/backoff/v4/backoff.go rename to vendor/github.com/cenkalti/backoff/v5/backoff.go index 3676ee405d..dd2b24ca73 100644 --- a/vendor/github.com/cenkalti/backoff/v4/backoff.go +++ b/vendor/github.com/cenkalti/backoff/v5/backoff.go @@ -15,16 +15,16 @@ import "time" // BackOff is a backoff policy for retrying an operation. type BackOff interface { // NextBackOff returns the duration to wait before retrying the operation, - // or backoff. Stop to indicate that no more retries should be made. + // backoff.Stop to indicate that no more retries should be made. // // Example usage: // - // duration := backoff.NextBackOff(); - // if (duration == backoff.Stop) { - // // Do not retry operation. - // } else { - // // Sleep for duration and retry operation. - // } + // duration := backoff.NextBackOff() + // if duration == backoff.Stop { + // // Do not retry operation. + // } else { + // // Sleep for duration and retry operation. + // } // NextBackOff() time.Duration diff --git a/vendor/github.com/cenkalti/backoff/v5/error.go b/vendor/github.com/cenkalti/backoff/v5/error.go new file mode 100644 index 0000000000..beb2b38a23 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/error.go @@ -0,0 +1,46 @@ +package backoff + +import ( + "fmt" + "time" +) + +// PermanentError signals that the operation should not be retried. +type PermanentError struct { + Err error +} + +// Permanent wraps the given err in a *PermanentError. +func Permanent(err error) error { + if err == nil { + return nil + } + return &PermanentError{ + Err: err, + } +} + +// Error returns a string representation of the Permanent error. +func (e *PermanentError) Error() string { + return e.Err.Error() +} + +// Unwrap returns the wrapped error. +func (e *PermanentError) Unwrap() error { + return e.Err +} + +// RetryAfterError signals that the operation should be retried after the given duration. +type RetryAfterError struct { + Duration time.Duration +} + +// RetryAfter returns a RetryAfter error that specifies how long to wait before retrying. +func RetryAfter(seconds int) error { + return &RetryAfterError{Duration: time.Duration(seconds) * time.Second} +} + +// Error returns a string representation of the RetryAfter error. +func (e *RetryAfterError) Error() string { + return fmt.Sprintf("retry after %s", e.Duration) +} diff --git a/vendor/github.com/cenkalti/backoff/v5/exponential.go b/vendor/github.com/cenkalti/backoff/v5/exponential.go new file mode 100644 index 0000000000..79d425e874 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/exponential.go @@ -0,0 +1,118 @@ +package backoff + +import ( + "math/rand/v2" + "time" +) + +/* +ExponentialBackOff is a backoff implementation that increases the backoff +period for each retry attempt using a randomization function that grows exponentially. + +NextBackOff() is calculated using the following formula: + + randomized interval = + RetryInterval * (random value in range [1 - RandomizationFactor, 1 + RandomizationFactor]) + +In other words NextBackOff() will range between the randomization factor +percentage below and above the retry interval. + +For example, given the following parameters: + + RetryInterval = 2 + RandomizationFactor = 0.5 + Multiplier = 2 + +the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, +multiplied by the exponential, that is, between 2 and 6 seconds. + +Note: MaxInterval caps the RetryInterval and not the randomized interval. + +Example: Given the following default arguments, for 9 tries the sequence will be: + + Request # RetryInterval (seconds) Randomized Interval (seconds) + + 1 0.5 [0.25, 0.75] + 2 0.75 [0.375, 1.125] + 3 1.125 [0.562, 1.687] + 4 1.687 [0.8435, 2.53] + 5 2.53 [1.265, 3.795] + 6 3.795 [1.897, 5.692] + 7 5.692 [2.846, 8.538] + 8 8.538 [4.269, 12.807] + 9 12.807 [6.403, 19.210] + +Note: Implementation is not thread-safe. +*/ +type ExponentialBackOff struct { + InitialInterval time.Duration + RandomizationFactor float64 + Multiplier float64 + MaxInterval time.Duration + + currentInterval time.Duration +} + +// Default values for ExponentialBackOff. +const ( + DefaultInitialInterval = 500 * time.Millisecond + DefaultRandomizationFactor = 0.5 + DefaultMultiplier = 1.5 + DefaultMaxInterval = 60 * time.Second +) + +// NewExponentialBackOff creates an instance of ExponentialBackOff using default values. +func NewExponentialBackOff() *ExponentialBackOff { + return &ExponentialBackOff{ + InitialInterval: DefaultInitialInterval, + RandomizationFactor: DefaultRandomizationFactor, + Multiplier: DefaultMultiplier, + MaxInterval: DefaultMaxInterval, + } +} + +// Reset the interval back to the initial retry interval and restarts the timer. +// Reset must be called before using b. +func (b *ExponentialBackOff) Reset() { + b.currentInterval = b.InitialInterval +} + +// NextBackOff calculates the next backoff interval using the formula: +// +// Randomized interval = RetryInterval * (1 ± RandomizationFactor) +func (b *ExponentialBackOff) NextBackOff() time.Duration { + if b.currentInterval == 0 { + b.currentInterval = b.InitialInterval + } + + next := getRandomValueFromInterval(b.RandomizationFactor, rand.Float64(), b.currentInterval) + b.incrementCurrentInterval() + return next +} + +// Increments the current interval by multiplying it with the multiplier. +func (b *ExponentialBackOff) incrementCurrentInterval() { + // Check for overflow, if overflow is detected set the current interval to the max interval. + if float64(b.currentInterval) >= float64(b.MaxInterval)/b.Multiplier { + b.currentInterval = b.MaxInterval + } else { + b.currentInterval = time.Duration(float64(b.currentInterval) * b.Multiplier) + } +} + +// Returns a random value from the following interval: +// +// [currentInterval - randomizationFactor * currentInterval, currentInterval + randomizationFactor * currentInterval]. +func getRandomValueFromInterval(randomizationFactor, random float64, currentInterval time.Duration) time.Duration { + if randomizationFactor == 0 { + return currentInterval // make sure no randomness is used when randomizationFactor is 0. + } + var delta = randomizationFactor * float64(currentInterval) + var minInterval = float64(currentInterval) - delta + var maxInterval = float64(currentInterval) + delta + + // Get a random value from the range [minInterval, maxInterval]. + // The formula used below has a +1 because if the minInterval is 1 and the maxInterval is 3 then + // we want a 33% chance for selecting either 1, 2 or 3. + return time.Duration(minInterval + (random * (maxInterval - minInterval + 1))) +} diff --git a/vendor/github.com/cenkalti/backoff/v5/retry.go b/vendor/github.com/cenkalti/backoff/v5/retry.go new file mode 100644 index 0000000000..32a7f98834 --- /dev/null +++ b/vendor/github.com/cenkalti/backoff/v5/retry.go @@ -0,0 +1,139 @@ +package backoff + +import ( + "context" + "errors" + "time" +) + +// DefaultMaxElapsedTime sets a default limit for the total retry duration. +const DefaultMaxElapsedTime = 15 * time.Minute + +// Operation is a function that attempts an operation and may be retried. +type Operation[T any] func() (T, error) + +// Notify is a function called on operation error with the error and backoff duration. +type Notify func(error, time.Duration) + +// retryOptions holds configuration settings for the retry mechanism. +type retryOptions struct { + BackOff BackOff // Strategy for calculating backoff periods. + Timer timer // Timer to manage retry delays. + Notify Notify // Optional function to notify on each retry error. + MaxTries uint // Maximum number of retry attempts. + MaxElapsedTime time.Duration // Maximum total time for all retries. +} + +type RetryOption func(*retryOptions) + +// WithBackOff configures a custom backoff strategy. +func WithBackOff(b BackOff) RetryOption { + return func(args *retryOptions) { + args.BackOff = b + } +} + +// withTimer sets a custom timer for managing delays between retries. +func withTimer(t timer) RetryOption { + return func(args *retryOptions) { + args.Timer = t + } +} + +// WithNotify sets a notification function to handle retry errors. +func WithNotify(n Notify) RetryOption { + return func(args *retryOptions) { + args.Notify = n + } +} + +// WithMaxTries limits the number of all attempts. +func WithMaxTries(n uint) RetryOption { + return func(args *retryOptions) { + args.MaxTries = n + } +} + +// WithMaxElapsedTime limits the total duration for retry attempts. +func WithMaxElapsedTime(d time.Duration) RetryOption { + return func(args *retryOptions) { + args.MaxElapsedTime = d + } +} + +// Retry attempts the operation until success, a permanent error, or backoff completion. +// It ensures the operation is executed at least once. +// +// Returns the operation result or error if retries are exhausted or context is cancelled. +func Retry[T any](ctx context.Context, operation Operation[T], opts ...RetryOption) (T, error) { + // Initialize default retry options. + args := &retryOptions{ + BackOff: NewExponentialBackOff(), + Timer: &defaultTimer{}, + MaxElapsedTime: DefaultMaxElapsedTime, + } + + // Apply user-provided options to the default settings. + for _, opt := range opts { + opt(args) + } + + defer args.Timer.Stop() + + startedAt := time.Now() + args.BackOff.Reset() + for numTries := uint(1); ; numTries++ { + // Execute the operation. + res, err := operation() + if err == nil { + return res, nil + } + + // Stop retrying if maximum tries exceeded. + if args.MaxTries > 0 && numTries >= args.MaxTries { + return res, err + } + + // Handle permanent errors without retrying. + var permanent *PermanentError + if errors.As(err, &permanent) { + return res, permanent.Unwrap() + } + + // Stop retrying if context is cancelled. + if cerr := context.Cause(ctx); cerr != nil { + return res, cerr + } + + // Calculate next backoff duration. + next := args.BackOff.NextBackOff() + if next == Stop { + return res, err + } + + // Reset backoff if RetryAfterError is encountered. + var retryAfter *RetryAfterError + if errors.As(err, &retryAfter) { + next = retryAfter.Duration + args.BackOff.Reset() + } + + // Stop retrying if maximum elapsed time exceeded. + if args.MaxElapsedTime > 0 && time.Since(startedAt)+next > args.MaxElapsedTime { + return res, err + } + + // Notify on error if a notifier function is provided. + if args.Notify != nil { + args.Notify(err, next) + } + + // Wait for the next backoff period or context cancellation. + args.Timer.Start(next) + select { + case <-args.Timer.C(): + case <-ctx.Done(): + return res, context.Cause(ctx) + } + } +} diff --git a/vendor/github.com/cenkalti/backoff/v4/ticker.go b/vendor/github.com/cenkalti/backoff/v5/ticker.go similarity index 80% rename from vendor/github.com/cenkalti/backoff/v4/ticker.go rename to vendor/github.com/cenkalti/backoff/v5/ticker.go index df9d68bce5..f0d4b2ae72 100644 --- a/vendor/github.com/cenkalti/backoff/v4/ticker.go +++ b/vendor/github.com/cenkalti/backoff/v5/ticker.go @@ -1,7 +1,6 @@ package backoff import ( - "context" "sync" "time" ) @@ -14,8 +13,7 @@ type Ticker struct { C <-chan time.Time c chan time.Time b BackOff - ctx context.Context - timer Timer + timer timer stop chan struct{} stopOnce sync.Once } @@ -27,22 +25,12 @@ type Ticker struct { // provided backoff policy (notably calling NextBackOff or Reset) // while the ticker is running. func NewTicker(b BackOff) *Ticker { - return NewTickerWithTimer(b, &defaultTimer{}) -} - -// NewTickerWithTimer returns a new Ticker with a custom timer. -// A default timer that uses system timer is used when nil is passed. -func NewTickerWithTimer(b BackOff, timer Timer) *Ticker { - if timer == nil { - timer = &defaultTimer{} - } c := make(chan time.Time) t := &Ticker{ C: c, c: c, b: b, - ctx: getContext(b), - timer: timer, + timer: &defaultTimer{}, stop: make(chan struct{}), } t.b.Reset() @@ -73,8 +61,6 @@ func (t *Ticker) run() { case <-t.stop: t.c = nil // Prevent future ticks from being sent to the channel. return - case <-t.ctx.Done(): - return } } } diff --git a/vendor/github.com/cenkalti/backoff/v4/timer.go b/vendor/github.com/cenkalti/backoff/v5/timer.go similarity index 96% rename from vendor/github.com/cenkalti/backoff/v4/timer.go rename to vendor/github.com/cenkalti/backoff/v5/timer.go index 8120d0213c..a895309747 100644 --- a/vendor/github.com/cenkalti/backoff/v4/timer.go +++ b/vendor/github.com/cenkalti/backoff/v5/timer.go @@ -2,7 +2,7 @@ package backoff import "time" -type Timer interface { +type timer interface { Start(duration time.Duration) Stop() C() <-chan time.Time diff --git a/vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_other.go b/vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_other.go new file mode 100644 index 0000000000..d6309495d4 --- /dev/null +++ b/vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_other.go @@ -0,0 +1,22 @@ +// Copyright 2025 +// +// 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. + +//go:build !unix + +package daemon + +// SdNotifyMonotonicUsec returns the empty string on unsupported platforms. +func SdNotifyMonotonicUsec() string { + return "" +} diff --git a/vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_unix.go b/vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_unix.go new file mode 100644 index 0000000000..bdbe6b0c28 --- /dev/null +++ b/vendor/github.com/coreos/go-systemd/v22/daemon/sdnotify_unix.go @@ -0,0 +1,36 @@ +// Copyright 2025 +// +// 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. + +//go:build unix + +package daemon + +import ( + "strconv" + + "golang.org/x/sys/unix" +) + +// SdNotifyMonotonicUsec returns a MONOTONIC_USEC=... assignment for the current time +// with a trailing newline included. This is typically used with [SdNotifyReloading]. +// +// If the monotonic clock is not available on the system, the empty string is returned. +func SdNotifyMonotonicUsec() string { + var ts unix.Timespec + if err := unix.ClockGettime(unix.CLOCK_MONOTONIC, &ts); err != nil { + // Monotonic clock is not available on this system. + return "" + } + return "MONOTONIC_USEC=" + strconv.FormatInt(ts.Nano()/1000, 10) + "\n" +} diff --git a/vendor/github.com/coreos/go-systemd/v22/daemon/watchdog.go b/vendor/github.com/coreos/go-systemd/v22/daemon/watchdog.go index 25d9c1aa93..a93314d0ab 100644 --- a/vendor/github.com/coreos/go-systemd/v22/daemon/watchdog.go +++ b/vendor/github.com/coreos/go-systemd/v22/daemon/watchdog.go @@ -15,6 +15,7 @@ package daemon import ( + "errors" "fmt" "os" "strconv" @@ -51,10 +52,10 @@ func SdWatchdogEnabled(unsetEnvironment bool) (time.Duration, error) { } s, err := strconv.Atoi(wusec) if err != nil { - return 0, fmt.Errorf("error converting WATCHDOG_USEC: %s", err) + return 0, fmt.Errorf("error converting WATCHDOG_USEC: %w", err) } if s <= 0 { - return 0, fmt.Errorf("error WATCHDOG_USEC must be a positive number") + return 0, errors.New("error WATCHDOG_USEC must be a positive number") } interval := time.Duration(s) * time.Microsecond @@ -63,7 +64,7 @@ func SdWatchdogEnabled(unsetEnvironment bool) (time.Duration, error) { } p, err := strconv.Atoi(wpid) if err != nil { - return 0, fmt.Errorf("error converting WATCHDOG_PID: %s", err) + return 0, fmt.Errorf("error converting WATCHDOG_PID: %w", err) } if os.Getpid() != p { return 0, nil diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal.go index ac24c7767d..16c4e47751 100644 --- a/vendor/github.com/coreos/go-systemd/v22/journal/journal.go +++ b/vendor/github.com/coreos/go-systemd/v22/journal/journal.go @@ -41,6 +41,6 @@ const ( ) // Print prints a message to the local systemd journal using Send(). -func Print(priority Priority, format string, a ...interface{}) error { +func Print(priority Priority, format string, a ...any) error { return Send(fmt.Sprintf(format, a...), priority, nil) } diff --git a/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go b/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go index c5b23a8196..55cb9eb26a 100644 --- a/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go +++ b/vendor/github.com/coreos/go-systemd/v22/journal/journal_unix.go @@ -13,7 +13,6 @@ // limitations under the License. //go:build !windows -// +build !windows // Package journal provides write bindings to the local systemd journal. // It is implemented in pure Go and connects to the journal directly over its @@ -31,7 +30,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net" "os" "strconv" @@ -108,7 +106,7 @@ func fdIsJournalStream(fd int) (bool, error) { var expectedStat syscall.Stat_t _, err := fmt.Sscanf(journalStream, "%d:%d", &expectedStat.Dev, &expectedStat.Ino) if err != nil { - return false, fmt.Errorf("failed to parse JOURNAL_STREAM=%q: %v", journalStream, err) + return false, fmt.Errorf("failed to parse JOURNAL_STREAM=%q: %w", journalStream, err) } var stat syscall.Stat_t @@ -194,7 +192,7 @@ func appendVariable(w io.Writer, name, value string) { * - the data, followed by a newline */ fmt.Fprintln(w, name) - binary.Write(w, binary.LittleEndian, uint64(len(value))) + _ = binary.Write(w, binary.LittleEndian, uint64(len(value))) fmt.Fprintln(w, value) } else { /* just write the variable and value all on one line */ @@ -214,7 +212,7 @@ func validVarName(name string) error { } for _, c := range name { - if !(('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_') { + if ('A' > c || c > 'Z') && ('0' > c || c > '9') && c != '_' { return errors.New("Variable name contains invalid characters") } } @@ -239,7 +237,7 @@ func isSocketSpaceError(err error) bool { // tempFd creates a temporary, unlinked file under `/dev/shm`. func tempFd() (*os.File, error) { - file, err := ioutil.TempFile("/dev/shm/", "journal.XXXXX") + file, err := os.CreateTemp("/dev/shm/", "journal.XXXXX") if err != nil { return nil, err } diff --git a/vendor/github.com/emicklei/go-restful/v3/.travis.yml b/vendor/github.com/emicklei/go-restful/v3/.travis.yml deleted file mode 100644 index 3a0bf5ff1b..0000000000 --- a/vendor/github.com/emicklei/go-restful/v3/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go - -go: - - 1.x - -before_install: - - go test -v - -script: - - go test -race -coverprofile=coverage.txt -covermode=atomic - -after_success: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md index 6f24dfff56..4fcd920abe 100644 --- a/vendor/github.com/emicklei/go-restful/v3/CHANGES.md +++ b/vendor/github.com/emicklei/go-restful/v3/CHANGES.md @@ -1,5 +1,9 @@ # Change history of go-restful +## [v3.13.0] - 2025-08-14 + +- optimize performance of path matching in CurlyRouter ( thanks @wenhuang, Wen Huang) + ## [v3.12.2] - 2025-02-21 - allow empty payloads in post,put,patch, issue #580 ( thanks @liggitt, Jordan Liggitt) diff --git a/vendor/github.com/emicklei/go-restful/v3/README.md b/vendor/github.com/emicklei/go-restful/v3/README.md index 3fb40d1980..50a79ab692 100644 --- a/vendor/github.com/emicklei/go-restful/v3/README.md +++ b/vendor/github.com/emicklei/go-restful/v3/README.md @@ -84,6 +84,7 @@ func (u UserResource) findUser(request *restful.Request, response *restful.Respo - Configurable (trace) logging - Customizable gzip/deflate readers and writers using CompressorProvider registration - Inject your own http.Handler using the `HttpMiddlewareHandlerToFilter` function +- Added `SetPathTokenCacheEnabled` and `SetCustomVerbCacheEnabled` to disable regexp caching (default=true) ## How to customize There are several hooks to customize the behavior of the go-restful package. diff --git a/vendor/github.com/emicklei/go-restful/v3/curly.go b/vendor/github.com/emicklei/go-restful/v3/curly.go index 6fd2bcd5a1..eec43bfd06 100644 --- a/vendor/github.com/emicklei/go-restful/v3/curly.go +++ b/vendor/github.com/emicklei/go-restful/v3/curly.go @@ -9,11 +9,35 @@ import ( "regexp" "sort" "strings" + "sync" ) // CurlyRouter expects Routes with paths that contain zero or more parameters in curly brackets. type CurlyRouter struct{} +var ( + regexCache sync.Map // Cache for compiled regex patterns + pathTokenCacheEnabled = true // Enable/disable path token regex caching +) + +// SetPathTokenCacheEnabled enables or disables path token regex caching for CurlyRouter. +// When disabled, regex patterns will be compiled on every request. +// When enabled (default), compiled regex patterns are cached for better performance. +func SetPathTokenCacheEnabled(enabled bool) { + pathTokenCacheEnabled = enabled +} + +// getCachedRegexp retrieves a compiled regex from the cache if found and valid. +// Returns the regex and true if found and valid, nil and false otherwise. +func getCachedRegexp(cache *sync.Map, pattern string) (*regexp.Regexp, bool) { + if cached, found := cache.Load(pattern); found { + if regex, ok := cached.(*regexp.Regexp); ok { + return regex, true + } + } + return nil, false +} + // SelectRoute is part of the Router interface and returns the best match // for the WebService and its Route for the given Request. func (c CurlyRouter) SelectRoute( @@ -113,8 +137,28 @@ func (c CurlyRouter) regularMatchesPathToken(routeToken string, colon int, reque } return true, true } - matched, err := regexp.MatchString(regPart, requestToken) - return (matched && err == nil), false + + // Check cache first (if enabled) + if pathTokenCacheEnabled { + if regex, found := getCachedRegexp(®exCache, regPart); found { + matched := regex.MatchString(requestToken) + return matched, false + } + } + + // Compile the regex + regex, err := regexp.Compile(regPart) + if err != nil { + return false, false + } + + // Cache the regex (if enabled) + if pathTokenCacheEnabled { + regexCache.Store(regPart, regex) + } + + matched := regex.MatchString(requestToken) + return matched, false } var jsr311Router = RouterJSR311{} @@ -168,7 +212,7 @@ func (c CurlyRouter) computeWebserviceScore(requestTokens []string, routeTokens if matchesToken { score++ // extra score for regex match } - } + } } else { // not a parameter if eachRequestToken != eachRouteToken { diff --git a/vendor/github.com/emicklei/go-restful/v3/custom_verb.go b/vendor/github.com/emicklei/go-restful/v3/custom_verb.go index bfc17efde8..0b98eeb091 100644 --- a/vendor/github.com/emicklei/go-restful/v3/custom_verb.go +++ b/vendor/github.com/emicklei/go-restful/v3/custom_verb.go @@ -1,14 +1,28 @@ package restful +// Copyright 2025 Ernest Micklei. All rights reserved. +// Use of this source code is governed by a license +// that can be found in the LICENSE file. + import ( "fmt" "regexp" + "sync" ) var ( - customVerbReg = regexp.MustCompile(":([A-Za-z]+)$") + customVerbReg = regexp.MustCompile(":([A-Za-z]+)$") + customVerbCache sync.Map // Cache for compiled custom verb regexes + customVerbCacheEnabled = true // Enable/disable custom verb regex caching ) +// SetCustomVerbCacheEnabled enables or disables custom verb regex caching. +// When disabled, custom verb regex patterns will be compiled on every request. +// When enabled (default), compiled custom verb regex patterns are cached for better performance. +func SetCustomVerbCacheEnabled(enabled bool) { + customVerbCacheEnabled = enabled +} + func hasCustomVerb(routeToken string) bool { return customVerbReg.MatchString(routeToken) } @@ -20,7 +34,23 @@ func isMatchCustomVerb(routeToken string, pathToken string) bool { } customVerb := rs[1] - specificVerbReg := regexp.MustCompile(fmt.Sprintf(":%s$", customVerb)) + regexPattern := fmt.Sprintf(":%s$", customVerb) + + // Check cache first (if enabled) + if customVerbCacheEnabled { + if specificVerbReg, found := getCachedRegexp(&customVerbCache, regexPattern); found { + return specificVerbReg.MatchString(pathToken) + } + } + + // Compile the regex + specificVerbReg := regexp.MustCompile(regexPattern) + + // Cache the regex (if enabled) + if customVerbCacheEnabled { + customVerbCache.Store(regexPattern, specificVerbReg) + } + return specificVerbReg.MatchString(pathToken) } diff --git a/vendor/github.com/emicklei/go-restful/v3/doc.go b/vendor/github.com/emicklei/go-restful/v3/doc.go index 69b13057d0..80809225b8 100644 --- a/vendor/github.com/emicklei/go-restful/v3/doc.go +++ b/vendor/github.com/emicklei/go-restful/v3/doc.go @@ -1,7 +1,7 @@ /* Package restful , a lean package for creating REST-style WebServices without magic. -WebServices and Routes +### WebServices and Routes A WebService has a collection of Route objects that dispatch incoming Http Requests to a function calls. Typically, a WebService has a root path (e.g. /users) and defines common MIME types for its routes. @@ -30,14 +30,14 @@ The (*Request, *Response) arguments provide functions for reading information fr See the example https://github.com/emicklei/go-restful/blob/v3/examples/user-resource/restful-user-resource.go with a full implementation. -Regular expression matching Routes +### Regular expression matching Routes A Route parameter can be specified using the format "uri/{var[:regexp]}" or the special version "uri/{var:*}" for matching the tail of the path. For example, /persons/{name:[A-Z][A-Z]} can be used to restrict values for the parameter "name" to only contain capital alphabetic characters. Regular expressions must use the standard Go syntax as described in the regexp package. (https://code.google.com/p/re2/wiki/Syntax) This feature requires the use of a CurlyRouter. -Containers +### Containers A Container holds a collection of WebServices, Filters and a http.ServeMux for multiplexing http requests. Using the statements "restful.Add(...) and restful.Filter(...)" will register WebServices and Filters to the Default Container. @@ -47,7 +47,7 @@ You can create your own Container and create a new http.Server for that particul container := restful.NewContainer() server := &http.Server{Addr: ":8081", Handler: container} -Filters +### Filters A filter dynamically intercepts requests and responses to transform or use the information contained in the requests or responses. You can use filters to perform generic logging, measurement, authentication, redirect, set response headers etc. @@ -60,22 +60,21 @@ Use the following statement to pass the request,response pair to the next filter chain.ProcessFilter(req, resp) -Container Filters +### Container Filters These are processed before any registered WebService. // install a (global) filter for the default container (processed before any webservice) restful.Filter(globalLogging) -WebService Filters +### WebService Filters These are processed before any Route of a WebService. // install a webservice filter (processed before any route) ws.Filter(webserviceLogging).Filter(measureTime) - -Route Filters +### Route Filters These are processed before calling the function associated with the Route. @@ -84,7 +83,7 @@ These are processed before calling the function associated with the Route. See the example https://github.com/emicklei/go-restful/blob/v3/examples/filters/restful-filters.go with full implementations. -Response Encoding +### Response Encoding Two encodings are supported: gzip and deflate. To enable this for all responses: @@ -95,20 +94,20 @@ Alternatively, you can create a Filter that performs the encoding and install it See the example https://github.com/emicklei/go-restful/blob/v3/examples/encoding/restful-encoding-filter.go -OPTIONS support +### OPTIONS support By installing a pre-defined container filter, your Webservice(s) can respond to the OPTIONS Http request. Filter(OPTIONSFilter()) -CORS +### CORS By installing the filter of a CrossOriginResourceSharing (CORS), your WebService(s) can handle CORS requests. cors := CrossOriginResourceSharing{ExposeHeaders: []string{"X-My-Header"}, CookiesAllowed: false, Container: DefaultContainer} Filter(cors.Filter) -Error Handling +### Error Handling Unexpected things happen. If a request cannot be processed because of a failure, your service needs to tell via the response what happened and why. For this reason HTTP status codes exist and it is important to use the correct code in every exceptional situation. @@ -137,11 +136,11 @@ The request does not have or has an unknown Accept Header set for this operation The request does not have or has an unknown Content-Type Header set for this operation. -ServiceError +### ServiceError In addition to setting the correct (error) Http status code, you can choose to write a ServiceError message on the response. -Performance options +### Performance options This package has several options that affect the performance of your service. It is important to understand them and how you can change it. @@ -156,30 +155,27 @@ Default value is true If content encoding is enabled then the default strategy for getting new gzip/zlib writers and readers is to use a sync.Pool. Because writers are expensive structures, performance is even more improved when using a preloaded cache. You can also inject your own implementation. -Trouble shooting +### Trouble shooting This package has the means to produce detail logging of the complete Http request matching process and filter invocation. Enabling this feature requires you to set an implementation of restful.StdLogger (e.g. log.Logger) instance such as: restful.TraceLogger(log.New(os.Stdout, "[restful] ", log.LstdFlags|log.Lshortfile)) -Logging +### Logging The restful.SetLogger() method allows you to override the logger used by the package. By default restful uses the standard library `log` package and logs to stdout. Different logging packages are supported as long as they conform to `StdLogger` interface defined in the `log` sub-package, writing an adapter for your preferred package is simple. -Resources +### Resources -[project]: https://github.com/emicklei/go-restful +(c) 2012-2025, http://ernestmicklei.com. MIT License +[project]: https://github.com/emicklei/go-restful [examples]: https://github.com/emicklei/go-restful/blob/master/examples - -[design]: http://ernestmicklei.com/2012/11/11/go-restful-api-design/ - +[design]: http://ernestmicklei.com/2012/11/11/go-restful-api-design/ [showcases]: https://github.com/emicklei/mora, https://github.com/emicklei/landskape - -(c) 2012-2015, http://ernestmicklei.com. MIT License */ package restful diff --git a/vendor/github.com/google/btree/README.md b/vendor/github.com/google/btree/README.md deleted file mode 100644 index eab5dbf7ba..0000000000 --- a/vendor/github.com/google/btree/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# BTree implementation for Go - -This package provides an in-memory B-Tree implementation for Go, useful as -an ordered, mutable data structure. - -The API is based off of the wonderful -http://godoc.org/github.com/petar/GoLLRB/llrb, and is meant to allow btree to -act as a drop-in replacement for gollrb trees. - -See http://godoc.org/github.com/google/btree for documentation. diff --git a/vendor/github.com/google/btree/btree_generic.go b/vendor/github.com/google/btree/btree_generic.go deleted file mode 100644 index e44a0f4880..0000000000 --- a/vendor/github.com/google/btree/btree_generic.go +++ /dev/null @@ -1,1083 +0,0 @@ -// Copyright 2014-2022 Google Inc. -// -// 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. - -//go:build go1.18 -// +build go1.18 - -// In Go 1.18 and beyond, a BTreeG generic is created, and BTree is a specific -// instantiation of that generic for the Item interface, with a backwards- -// compatible API. Before go1.18, generics are not supported, -// and BTree is just an implementation based around the Item interface. - -// Package btree implements in-memory B-Trees of arbitrary degree. -// -// btree implements an in-memory B-Tree for use as an ordered data structure. -// It is not meant for persistent storage solutions. -// -// It has a flatter structure than an equivalent red-black or other binary tree, -// which in some cases yields better memory usage and/or performance. -// See some discussion on the matter here: -// http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html -// Note, though, that this project is in no way related to the C++ B-Tree -// implementation written about there. -// -// Within this tree, each node contains a slice of items and a (possibly nil) -// slice of children. For basic numeric values or raw structs, this can cause -// efficiency differences when compared to equivalent C++ template code that -// stores values in arrays within the node: -// * Due to the overhead of storing values as interfaces (each -// value needs to be stored as the value itself, then 2 words for the -// interface pointing to that value and its type), resulting in higher -// memory use. -// * Since interfaces can point to values anywhere in memory, values are -// most likely not stored in contiguous blocks, resulting in a higher -// number of cache misses. -// These issues don't tend to matter, though, when working with strings or other -// heap-allocated structures, since C++-equivalent structures also must store -// pointers and also distribute their values across the heap. -// -// This implementation is designed to be a drop-in replacement to gollrb.LLRB -// trees, (http://github.com/petar/gollrb), an excellent and probably the most -// widely used ordered tree implementation in the Go ecosystem currently. -// Its functions, therefore, exactly mirror those of -// llrb.LLRB where possible. Unlike gollrb, though, we currently don't -// support storing multiple equivalent values. -// -// There are two implementations; those suffixed with 'G' are generics, usable -// for any type, and require a passed-in "less" function to define their ordering. -// Those without this prefix are specific to the 'Item' interface, and use -// its 'Less' function for ordering. -package btree - -import ( - "fmt" - "io" - "sort" - "strings" - "sync" -) - -// Item represents a single object in the tree. -type Item interface { - // Less tests whether the current item is less than the given argument. - // - // This must provide a strict weak ordering. - // If !a.Less(b) && !b.Less(a), we treat this to mean a == b (i.e. we can only - // hold one of either a or b in the tree). - Less(than Item) bool -} - -const ( - DefaultFreeListSize = 32 -) - -// FreeListG represents a free list of btree nodes. By default each -// BTree has its own FreeList, but multiple BTrees can share the same -// FreeList, in particular when they're created with Clone. -// Two Btrees using the same freelist are safe for concurrent write access. -type FreeListG[T any] struct { - mu sync.Mutex - freelist []*node[T] -} - -// NewFreeListG creates a new free list. -// size is the maximum size of the returned free list. -func NewFreeListG[T any](size int) *FreeListG[T] { - return &FreeListG[T]{freelist: make([]*node[T], 0, size)} -} - -func (f *FreeListG[T]) newNode() (n *node[T]) { - f.mu.Lock() - index := len(f.freelist) - 1 - if index < 0 { - f.mu.Unlock() - return new(node[T]) - } - n = f.freelist[index] - f.freelist[index] = nil - f.freelist = f.freelist[:index] - f.mu.Unlock() - return -} - -func (f *FreeListG[T]) freeNode(n *node[T]) (out bool) { - f.mu.Lock() - if len(f.freelist) < cap(f.freelist) { - f.freelist = append(f.freelist, n) - out = true - } - f.mu.Unlock() - return -} - -// ItemIteratorG allows callers of {A/De}scend* to iterate in-order over portions of -// the tree. When this function returns false, iteration will stop and the -// associated Ascend* function will immediately return. -type ItemIteratorG[T any] func(item T) bool - -// Ordered represents the set of types for which the '<' operator work. -type Ordered interface { - ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~float32 | ~float64 | ~string -} - -// Less[T] returns a default LessFunc that uses the '<' operator for types that support it. -func Less[T Ordered]() LessFunc[T] { - return func(a, b T) bool { return a < b } -} - -// NewOrderedG creates a new B-Tree for ordered types. -func NewOrderedG[T Ordered](degree int) *BTreeG[T] { - return NewG[T](degree, Less[T]()) -} - -// NewG creates a new B-Tree with the given degree. -// -// NewG(2), for example, will create a 2-3-4 tree (each node contains 1-3 items -// and 2-4 children). -// -// The passed-in LessFunc determines how objects of type T are ordered. -func NewG[T any](degree int, less LessFunc[T]) *BTreeG[T] { - return NewWithFreeListG(degree, less, NewFreeListG[T](DefaultFreeListSize)) -} - -// NewWithFreeListG creates a new B-Tree that uses the given node free list. -func NewWithFreeListG[T any](degree int, less LessFunc[T], f *FreeListG[T]) *BTreeG[T] { - if degree <= 1 { - panic("bad degree") - } - return &BTreeG[T]{ - degree: degree, - cow: ©OnWriteContext[T]{freelist: f, less: less}, - } -} - -// items stores items in a node. -type items[T any] []T - -// insertAt inserts a value into the given index, pushing all subsequent values -// forward. -func (s *items[T]) insertAt(index int, item T) { - var zero T - *s = append(*s, zero) - if index < len(*s) { - copy((*s)[index+1:], (*s)[index:]) - } - (*s)[index] = item -} - -// removeAt removes a value at a given index, pulling all subsequent values -// back. -func (s *items[T]) removeAt(index int) T { - item := (*s)[index] - copy((*s)[index:], (*s)[index+1:]) - var zero T - (*s)[len(*s)-1] = zero - *s = (*s)[:len(*s)-1] - return item -} - -// pop removes and returns the last element in the list. -func (s *items[T]) pop() (out T) { - index := len(*s) - 1 - out = (*s)[index] - var zero T - (*s)[index] = zero - *s = (*s)[:index] - return -} - -// truncate truncates this instance at index so that it contains only the -// first index items. index must be less than or equal to length. -func (s *items[T]) truncate(index int) { - var toClear items[T] - *s, toClear = (*s)[:index], (*s)[index:] - var zero T - for i := 0; i < len(toClear); i++ { - toClear[i] = zero - } -} - -// find returns the index where the given item should be inserted into this -// list. 'found' is true if the item already exists in the list at the given -// index. -func (s items[T]) find(item T, less func(T, T) bool) (index int, found bool) { - i := sort.Search(len(s), func(i int) bool { - return less(item, s[i]) - }) - if i > 0 && !less(s[i-1], item) { - return i - 1, true - } - return i, false -} - -// node is an internal node in a tree. -// -// It must at all times maintain the invariant that either -// * len(children) == 0, len(items) unconstrained -// * len(children) == len(items) + 1 -type node[T any] struct { - items items[T] - children items[*node[T]] - cow *copyOnWriteContext[T] -} - -func (n *node[T]) mutableFor(cow *copyOnWriteContext[T]) *node[T] { - if n.cow == cow { - return n - } - out := cow.newNode() - if cap(out.items) >= len(n.items) { - out.items = out.items[:len(n.items)] - } else { - out.items = make(items[T], len(n.items), cap(n.items)) - } - copy(out.items, n.items) - // Copy children - if cap(out.children) >= len(n.children) { - out.children = out.children[:len(n.children)] - } else { - out.children = make(items[*node[T]], len(n.children), cap(n.children)) - } - copy(out.children, n.children) - return out -} - -func (n *node[T]) mutableChild(i int) *node[T] { - c := n.children[i].mutableFor(n.cow) - n.children[i] = c - return c -} - -// split splits the given node at the given index. The current node shrinks, -// and this function returns the item that existed at that index and a new node -// containing all items/children after it. -func (n *node[T]) split(i int) (T, *node[T]) { - item := n.items[i] - next := n.cow.newNode() - next.items = append(next.items, n.items[i+1:]...) - n.items.truncate(i) - if len(n.children) > 0 { - next.children = append(next.children, n.children[i+1:]...) - n.children.truncate(i + 1) - } - return item, next -} - -// maybeSplitChild checks if a child should be split, and if so splits it. -// Returns whether or not a split occurred. -func (n *node[T]) maybeSplitChild(i, maxItems int) bool { - if len(n.children[i].items) < maxItems { - return false - } - first := n.mutableChild(i) - item, second := first.split(maxItems / 2) - n.items.insertAt(i, item) - n.children.insertAt(i+1, second) - return true -} - -// insert inserts an item into the subtree rooted at this node, making sure -// no nodes in the subtree exceed maxItems items. Should an equivalent item be -// be found/replaced by insert, it will be returned. -func (n *node[T]) insert(item T, maxItems int) (_ T, _ bool) { - i, found := n.items.find(item, n.cow.less) - if found { - out := n.items[i] - n.items[i] = item - return out, true - } - if len(n.children) == 0 { - n.items.insertAt(i, item) - return - } - if n.maybeSplitChild(i, maxItems) { - inTree := n.items[i] - switch { - case n.cow.less(item, inTree): - // no change, we want first split node - case n.cow.less(inTree, item): - i++ // we want second split node - default: - out := n.items[i] - n.items[i] = item - return out, true - } - } - return n.mutableChild(i).insert(item, maxItems) -} - -// get finds the given key in the subtree and returns it. -func (n *node[T]) get(key T) (_ T, _ bool) { - i, found := n.items.find(key, n.cow.less) - if found { - return n.items[i], true - } else if len(n.children) > 0 { - return n.children[i].get(key) - } - return -} - -// min returns the first item in the subtree. -func min[T any](n *node[T]) (_ T, found bool) { - if n == nil { - return - } - for len(n.children) > 0 { - n = n.children[0] - } - if len(n.items) == 0 { - return - } - return n.items[0], true -} - -// max returns the last item in the subtree. -func max[T any](n *node[T]) (_ T, found bool) { - if n == nil { - return - } - for len(n.children) > 0 { - n = n.children[len(n.children)-1] - } - if len(n.items) == 0 { - return - } - return n.items[len(n.items)-1], true -} - -// toRemove details what item to remove in a node.remove call. -type toRemove int - -const ( - removeItem toRemove = iota // removes the given item - removeMin // removes smallest item in the subtree - removeMax // removes largest item in the subtree -) - -// remove removes an item from the subtree rooted at this node. -func (n *node[T]) remove(item T, minItems int, typ toRemove) (_ T, _ bool) { - var i int - var found bool - switch typ { - case removeMax: - if len(n.children) == 0 { - return n.items.pop(), true - } - i = len(n.items) - case removeMin: - if len(n.children) == 0 { - return n.items.removeAt(0), true - } - i = 0 - case removeItem: - i, found = n.items.find(item, n.cow.less) - if len(n.children) == 0 { - if found { - return n.items.removeAt(i), true - } - return - } - default: - panic("invalid type") - } - // If we get to here, we have children. - if len(n.children[i].items) <= minItems { - return n.growChildAndRemove(i, item, minItems, typ) - } - child := n.mutableChild(i) - // Either we had enough items to begin with, or we've done some - // merging/stealing, because we've got enough now and we're ready to return - // stuff. - if found { - // The item exists at index 'i', and the child we've selected can give us a - // predecessor, since if we've gotten here it's got > minItems items in it. - out := n.items[i] - // We use our special-case 'remove' call with typ=maxItem to pull the - // predecessor of item i (the rightmost leaf of our immediate left child) - // and set it into where we pulled the item from. - var zero T - n.items[i], _ = child.remove(zero, minItems, removeMax) - return out, true - } - // Final recursive call. Once we're here, we know that the item isn't in this - // node and that the child is big enough to remove from. - return child.remove(item, minItems, typ) -} - -// growChildAndRemove grows child 'i' to make sure it's possible to remove an -// item from it while keeping it at minItems, then calls remove to actually -// remove it. -// -// Most documentation says we have to do two sets of special casing: -// 1) item is in this node -// 2) item is in child -// In both cases, we need to handle the two subcases: -// A) node has enough values that it can spare one -// B) node doesn't have enough values -// For the latter, we have to check: -// a) left sibling has node to spare -// b) right sibling has node to spare -// c) we must merge -// To simplify our code here, we handle cases #1 and #2 the same: -// If a node doesn't have enough items, we make sure it does (using a,b,c). -// We then simply redo our remove call, and the second time (regardless of -// whether we're in case 1 or 2), we'll have enough items and can guarantee -// that we hit case A. -func (n *node[T]) growChildAndRemove(i int, item T, minItems int, typ toRemove) (T, bool) { - if i > 0 && len(n.children[i-1].items) > minItems { - // Steal from left child - child := n.mutableChild(i) - stealFrom := n.mutableChild(i - 1) - stolenItem := stealFrom.items.pop() - child.items.insertAt(0, n.items[i-1]) - n.items[i-1] = stolenItem - if len(stealFrom.children) > 0 { - child.children.insertAt(0, stealFrom.children.pop()) - } - } else if i < len(n.items) && len(n.children[i+1].items) > minItems { - // steal from right child - child := n.mutableChild(i) - stealFrom := n.mutableChild(i + 1) - stolenItem := stealFrom.items.removeAt(0) - child.items = append(child.items, n.items[i]) - n.items[i] = stolenItem - if len(stealFrom.children) > 0 { - child.children = append(child.children, stealFrom.children.removeAt(0)) - } - } else { - if i >= len(n.items) { - i-- - } - child := n.mutableChild(i) - // merge with right child - mergeItem := n.items.removeAt(i) - mergeChild := n.children.removeAt(i + 1) - child.items = append(child.items, mergeItem) - child.items = append(child.items, mergeChild.items...) - child.children = append(child.children, mergeChild.children...) - n.cow.freeNode(mergeChild) - } - return n.remove(item, minItems, typ) -} - -type direction int - -const ( - descend = direction(-1) - ascend = direction(+1) -) - -type optionalItem[T any] struct { - item T - valid bool -} - -func optional[T any](item T) optionalItem[T] { - return optionalItem[T]{item: item, valid: true} -} -func empty[T any]() optionalItem[T] { - return optionalItem[T]{} -} - -// iterate provides a simple method for iterating over elements in the tree. -// -// When ascending, the 'start' should be less than 'stop' and when descending, -// the 'start' should be greater than 'stop'. Setting 'includeStart' to true -// will force the iterator to include the first item when it equals 'start', -// thus creating a "greaterOrEqual" or "lessThanEqual" rather than just a -// "greaterThan" or "lessThan" queries. -func (n *node[T]) iterate(dir direction, start, stop optionalItem[T], includeStart bool, hit bool, iter ItemIteratorG[T]) (bool, bool) { - var ok, found bool - var index int - switch dir { - case ascend: - if start.valid { - index, _ = n.items.find(start.item, n.cow.less) - } - for i := index; i < len(n.items); i++ { - if len(n.children) > 0 { - if hit, ok = n.children[i].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - if !includeStart && !hit && start.valid && !n.cow.less(start.item, n.items[i]) { - hit = true - continue - } - hit = true - if stop.valid && !n.cow.less(n.items[i], stop.item) { - return hit, false - } - if !iter(n.items[i]) { - return hit, false - } - } - if len(n.children) > 0 { - if hit, ok = n.children[len(n.children)-1].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - case descend: - if start.valid { - index, found = n.items.find(start.item, n.cow.less) - if !found { - index = index - 1 - } - } else { - index = len(n.items) - 1 - } - for i := index; i >= 0; i-- { - if start.valid && !n.cow.less(n.items[i], start.item) { - if !includeStart || hit || n.cow.less(start.item, n.items[i]) { - continue - } - } - if len(n.children) > 0 { - if hit, ok = n.children[i+1].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - if stop.valid && !n.cow.less(stop.item, n.items[i]) { - return hit, false // continue - } - hit = true - if !iter(n.items[i]) { - return hit, false - } - } - if len(n.children) > 0 { - if hit, ok = n.children[0].iterate(dir, start, stop, includeStart, hit, iter); !ok { - return hit, false - } - } - } - return hit, true -} - -// print is used for testing/debugging purposes. -func (n *node[T]) print(w io.Writer, level int) { - fmt.Fprintf(w, "%sNODE:%v\n", strings.Repeat(" ", level), n.items) - for _, c := range n.children { - c.print(w, level+1) - } -} - -// BTreeG is a generic implementation of a B-Tree. -// -// BTreeG stores items of type T in an ordered structure, allowing easy insertion, -// removal, and iteration. -// -// Write operations are not safe for concurrent mutation by multiple -// goroutines, but Read operations are. -type BTreeG[T any] struct { - degree int - length int - root *node[T] - cow *copyOnWriteContext[T] -} - -// LessFunc[T] determines how to order a type 'T'. It should implement a strict -// ordering, and should return true if within that ordering, 'a' < 'b'. -type LessFunc[T any] func(a, b T) bool - -// copyOnWriteContext pointers determine node ownership... a tree with a write -// context equivalent to a node's write context is allowed to modify that node. -// A tree whose write context does not match a node's is not allowed to modify -// it, and must create a new, writable copy (IE: it's a Clone). -// -// When doing any write operation, we maintain the invariant that the current -// node's context is equal to the context of the tree that requested the write. -// We do this by, before we descend into any node, creating a copy with the -// correct context if the contexts don't match. -// -// Since the node we're currently visiting on any write has the requesting -// tree's context, that node is modifiable in place. Children of that node may -// not share context, but before we descend into them, we'll make a mutable -// copy. -type copyOnWriteContext[T any] struct { - freelist *FreeListG[T] - less LessFunc[T] -} - -// Clone clones the btree, lazily. Clone should not be called concurrently, -// but the original tree (t) and the new tree (t2) can be used concurrently -// once the Clone call completes. -// -// The internal tree structure of b is marked read-only and shared between t and -// t2. Writes to both t and t2 use copy-on-write logic, creating new nodes -// whenever one of b's original nodes would have been modified. Read operations -// should have no performance degredation. Write operations for both t and t2 -// will initially experience minor slow-downs caused by additional allocs and -// copies due to the aforementioned copy-on-write logic, but should converge to -// the original performance characteristics of the original tree. -func (t *BTreeG[T]) Clone() (t2 *BTreeG[T]) { - // Create two entirely new copy-on-write contexts. - // This operation effectively creates three trees: - // the original, shared nodes (old b.cow) - // the new b.cow nodes - // the new out.cow nodes - cow1, cow2 := *t.cow, *t.cow - out := *t - t.cow = &cow1 - out.cow = &cow2 - return &out -} - -// maxItems returns the max number of items to allow per node. -func (t *BTreeG[T]) maxItems() int { - return t.degree*2 - 1 -} - -// minItems returns the min number of items to allow per node (ignored for the -// root node). -func (t *BTreeG[T]) minItems() int { - return t.degree - 1 -} - -func (c *copyOnWriteContext[T]) newNode() (n *node[T]) { - n = c.freelist.newNode() - n.cow = c - return -} - -type freeType int - -const ( - ftFreelistFull freeType = iota // node was freed (available for GC, not stored in freelist) - ftStored // node was stored in the freelist for later use - ftNotOwned // node was ignored by COW, since it's owned by another one -) - -// freeNode frees a node within a given COW context, if it's owned by that -// context. It returns what happened to the node (see freeType const -// documentation). -func (c *copyOnWriteContext[T]) freeNode(n *node[T]) freeType { - if n.cow == c { - // clear to allow GC - n.items.truncate(0) - n.children.truncate(0) - n.cow = nil - if c.freelist.freeNode(n) { - return ftStored - } else { - return ftFreelistFull - } - } else { - return ftNotOwned - } -} - -// ReplaceOrInsert adds the given item to the tree. If an item in the tree -// already equals the given one, it is removed from the tree and returned, -// and the second return value is true. Otherwise, (zeroValue, false) -// -// nil cannot be added to the tree (will panic). -func (t *BTreeG[T]) ReplaceOrInsert(item T) (_ T, _ bool) { - if t.root == nil { - t.root = t.cow.newNode() - t.root.items = append(t.root.items, item) - t.length++ - return - } else { - t.root = t.root.mutableFor(t.cow) - if len(t.root.items) >= t.maxItems() { - item2, second := t.root.split(t.maxItems() / 2) - oldroot := t.root - t.root = t.cow.newNode() - t.root.items = append(t.root.items, item2) - t.root.children = append(t.root.children, oldroot, second) - } - } - out, outb := t.root.insert(item, t.maxItems()) - if !outb { - t.length++ - } - return out, outb -} - -// Delete removes an item equal to the passed in item from the tree, returning -// it. If no such item exists, returns (zeroValue, false). -func (t *BTreeG[T]) Delete(item T) (T, bool) { - return t.deleteItem(item, removeItem) -} - -// DeleteMin removes the smallest item in the tree and returns it. -// If no such item exists, returns (zeroValue, false). -func (t *BTreeG[T]) DeleteMin() (T, bool) { - var zero T - return t.deleteItem(zero, removeMin) -} - -// DeleteMax removes the largest item in the tree and returns it. -// If no such item exists, returns (zeroValue, false). -func (t *BTreeG[T]) DeleteMax() (T, bool) { - var zero T - return t.deleteItem(zero, removeMax) -} - -func (t *BTreeG[T]) deleteItem(item T, typ toRemove) (_ T, _ bool) { - if t.root == nil || len(t.root.items) == 0 { - return - } - t.root = t.root.mutableFor(t.cow) - out, outb := t.root.remove(item, t.minItems(), typ) - if len(t.root.items) == 0 && len(t.root.children) > 0 { - oldroot := t.root - t.root = t.root.children[0] - t.cow.freeNode(oldroot) - } - if outb { - t.length-- - } - return out, outb -} - -// AscendRange calls the iterator for every value in the tree within the range -// [greaterOrEqual, lessThan), until iterator returns false. -func (t *BTreeG[T]) AscendRange(greaterOrEqual, lessThan T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, optional[T](greaterOrEqual), optional[T](lessThan), true, false, iterator) -} - -// AscendLessThan calls the iterator for every value in the tree within the range -// [first, pivot), until iterator returns false. -func (t *BTreeG[T]) AscendLessThan(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, empty[T](), optional(pivot), false, false, iterator) -} - -// AscendGreaterOrEqual calls the iterator for every value in the tree within -// the range [pivot, last], until iterator returns false. -func (t *BTreeG[T]) AscendGreaterOrEqual(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, optional[T](pivot), empty[T](), true, false, iterator) -} - -// Ascend calls the iterator for every value in the tree within the range -// [first, last], until iterator returns false. -func (t *BTreeG[T]) Ascend(iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(ascend, empty[T](), empty[T](), false, false, iterator) -} - -// DescendRange calls the iterator for every value in the tree within the range -// [lessOrEqual, greaterThan), until iterator returns false. -func (t *BTreeG[T]) DescendRange(lessOrEqual, greaterThan T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, optional[T](lessOrEqual), optional[T](greaterThan), true, false, iterator) -} - -// DescendLessOrEqual calls the iterator for every value in the tree within the range -// [pivot, first], until iterator returns false. -func (t *BTreeG[T]) DescendLessOrEqual(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, optional[T](pivot), empty[T](), true, false, iterator) -} - -// DescendGreaterThan calls the iterator for every value in the tree within -// the range [last, pivot), until iterator returns false. -func (t *BTreeG[T]) DescendGreaterThan(pivot T, iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, empty[T](), optional[T](pivot), false, false, iterator) -} - -// Descend calls the iterator for every value in the tree within the range -// [last, first], until iterator returns false. -func (t *BTreeG[T]) Descend(iterator ItemIteratorG[T]) { - if t.root == nil { - return - } - t.root.iterate(descend, empty[T](), empty[T](), false, false, iterator) -} - -// Get looks for the key item in the tree, returning it. It returns -// (zeroValue, false) if unable to find that item. -func (t *BTreeG[T]) Get(key T) (_ T, _ bool) { - if t.root == nil { - return - } - return t.root.get(key) -} - -// Min returns the smallest item in the tree, or (zeroValue, false) if the tree is empty. -func (t *BTreeG[T]) Min() (_ T, _ bool) { - return min(t.root) -} - -// Max returns the largest item in the tree, or (zeroValue, false) if the tree is empty. -func (t *BTreeG[T]) Max() (_ T, _ bool) { - return max(t.root) -} - -// Has returns true if the given key is in the tree. -func (t *BTreeG[T]) Has(key T) bool { - _, ok := t.Get(key) - return ok -} - -// Len returns the number of items currently in the tree. -func (t *BTreeG[T]) Len() int { - return t.length -} - -// Clear removes all items from the btree. If addNodesToFreelist is true, -// t's nodes are added to its freelist as part of this call, until the freelist -// is full. Otherwise, the root node is simply dereferenced and the subtree -// left to Go's normal GC processes. -// -// This can be much faster -// than calling Delete on all elements, because that requires finding/removing -// each element in the tree and updating the tree accordingly. It also is -// somewhat faster than creating a new tree to replace the old one, because -// nodes from the old tree are reclaimed into the freelist for use by the new -// one, instead of being lost to the garbage collector. -// -// This call takes: -// O(1): when addNodesToFreelist is false, this is a single operation. -// O(1): when the freelist is already full, it breaks out immediately -// O(freelist size): when the freelist is empty and the nodes are all owned -// by this tree, nodes are added to the freelist until full. -// O(tree size): when all nodes are owned by another tree, all nodes are -// iterated over looking for nodes to add to the freelist, and due to -// ownership, none are. -func (t *BTreeG[T]) Clear(addNodesToFreelist bool) { - if t.root != nil && addNodesToFreelist { - t.root.reset(t.cow) - } - t.root, t.length = nil, 0 -} - -// reset returns a subtree to the freelist. It breaks out immediately if the -// freelist is full, since the only benefit of iterating is to fill that -// freelist up. Returns true if parent reset call should continue. -func (n *node[T]) reset(c *copyOnWriteContext[T]) bool { - for _, child := range n.children { - if !child.reset(c) { - return false - } - } - return c.freeNode(n) != ftFreelistFull -} - -// Int implements the Item interface for integers. -type Int int - -// Less returns true if int(a) < int(b). -func (a Int) Less(b Item) bool { - return a < b.(Int) -} - -// BTree is an implementation of a B-Tree. -// -// BTree stores Item instances in an ordered structure, allowing easy insertion, -// removal, and iteration. -// -// Write operations are not safe for concurrent mutation by multiple -// goroutines, but Read operations are. -type BTree BTreeG[Item] - -var itemLess LessFunc[Item] = func(a, b Item) bool { - return a.Less(b) -} - -// New creates a new B-Tree with the given degree. -// -// New(2), for example, will create a 2-3-4 tree (each node contains 1-3 items -// and 2-4 children). -func New(degree int) *BTree { - return (*BTree)(NewG[Item](degree, itemLess)) -} - -// FreeList represents a free list of btree nodes. By default each -// BTree has its own FreeList, but multiple BTrees can share the same -// FreeList. -// Two Btrees using the same freelist are safe for concurrent write access. -type FreeList FreeListG[Item] - -// NewFreeList creates a new free list. -// size is the maximum size of the returned free list. -func NewFreeList(size int) *FreeList { - return (*FreeList)(NewFreeListG[Item](size)) -} - -// NewWithFreeList creates a new B-Tree that uses the given node free list. -func NewWithFreeList(degree int, f *FreeList) *BTree { - return (*BTree)(NewWithFreeListG[Item](degree, itemLess, (*FreeListG[Item])(f))) -} - -// ItemIterator allows callers of Ascend* to iterate in-order over portions of -// the tree. When this function returns false, iteration will stop and the -// associated Ascend* function will immediately return. -type ItemIterator ItemIteratorG[Item] - -// Clone clones the btree, lazily. Clone should not be called concurrently, -// but the original tree (t) and the new tree (t2) can be used concurrently -// once the Clone call completes. -// -// The internal tree structure of b is marked read-only and shared between t and -// t2. Writes to both t and t2 use copy-on-write logic, creating new nodes -// whenever one of b's original nodes would have been modified. Read operations -// should have no performance degredation. Write operations for both t and t2 -// will initially experience minor slow-downs caused by additional allocs and -// copies due to the aforementioned copy-on-write logic, but should converge to -// the original performance characteristics of the original tree. -func (t *BTree) Clone() (t2 *BTree) { - return (*BTree)((*BTreeG[Item])(t).Clone()) -} - -// Delete removes an item equal to the passed in item from the tree, returning -// it. If no such item exists, returns nil. -func (t *BTree) Delete(item Item) Item { - i, _ := (*BTreeG[Item])(t).Delete(item) - return i -} - -// DeleteMax removes the largest item in the tree and returns it. -// If no such item exists, returns nil. -func (t *BTree) DeleteMax() Item { - i, _ := (*BTreeG[Item])(t).DeleteMax() - return i -} - -// DeleteMin removes the smallest item in the tree and returns it. -// If no such item exists, returns nil. -func (t *BTree) DeleteMin() Item { - i, _ := (*BTreeG[Item])(t).DeleteMin() - return i -} - -// Get looks for the key item in the tree, returning it. It returns nil if -// unable to find that item. -func (t *BTree) Get(key Item) Item { - i, _ := (*BTreeG[Item])(t).Get(key) - return i -} - -// Max returns the largest item in the tree, or nil if the tree is empty. -func (t *BTree) Max() Item { - i, _ := (*BTreeG[Item])(t).Max() - return i -} - -// Min returns the smallest item in the tree, or nil if the tree is empty. -func (t *BTree) Min() Item { - i, _ := (*BTreeG[Item])(t).Min() - return i -} - -// Has returns true if the given key is in the tree. -func (t *BTree) Has(key Item) bool { - return (*BTreeG[Item])(t).Has(key) -} - -// ReplaceOrInsert adds the given item to the tree. If an item in the tree -// already equals the given one, it is removed from the tree and returned. -// Otherwise, nil is returned. -// -// nil cannot be added to the tree (will panic). -func (t *BTree) ReplaceOrInsert(item Item) Item { - i, _ := (*BTreeG[Item])(t).ReplaceOrInsert(item) - return i -} - -// AscendRange calls the iterator for every value in the tree within the range -// [greaterOrEqual, lessThan), until iterator returns false. -func (t *BTree) AscendRange(greaterOrEqual, lessThan Item, iterator ItemIterator) { - (*BTreeG[Item])(t).AscendRange(greaterOrEqual, lessThan, (ItemIteratorG[Item])(iterator)) -} - -// AscendLessThan calls the iterator for every value in the tree within the range -// [first, pivot), until iterator returns false. -func (t *BTree) AscendLessThan(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).AscendLessThan(pivot, (ItemIteratorG[Item])(iterator)) -} - -// AscendGreaterOrEqual calls the iterator for every value in the tree within -// the range [pivot, last], until iterator returns false. -func (t *BTree) AscendGreaterOrEqual(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).AscendGreaterOrEqual(pivot, (ItemIteratorG[Item])(iterator)) -} - -// Ascend calls the iterator for every value in the tree within the range -// [first, last], until iterator returns false. -func (t *BTree) Ascend(iterator ItemIterator) { - (*BTreeG[Item])(t).Ascend((ItemIteratorG[Item])(iterator)) -} - -// DescendRange calls the iterator for every value in the tree within the range -// [lessOrEqual, greaterThan), until iterator returns false. -func (t *BTree) DescendRange(lessOrEqual, greaterThan Item, iterator ItemIterator) { - (*BTreeG[Item])(t).DescendRange(lessOrEqual, greaterThan, (ItemIteratorG[Item])(iterator)) -} - -// DescendLessOrEqual calls the iterator for every value in the tree within the range -// [pivot, first], until iterator returns false. -func (t *BTree) DescendLessOrEqual(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).DescendLessOrEqual(pivot, (ItemIteratorG[Item])(iterator)) -} - -// DescendGreaterThan calls the iterator for every value in the tree within -// the range [last, pivot), until iterator returns false. -func (t *BTree) DescendGreaterThan(pivot Item, iterator ItemIterator) { - (*BTreeG[Item])(t).DescendGreaterThan(pivot, (ItemIteratorG[Item])(iterator)) -} - -// Descend calls the iterator for every value in the tree within the range -// [last, first], until iterator returns false. -func (t *BTree) Descend(iterator ItemIterator) { - (*BTreeG[Item])(t).Descend((ItemIteratorG[Item])(iterator)) -} - -// Len returns the number of items currently in the tree. -func (t *BTree) Len() int { - return (*BTreeG[Item])(t).Len() -} - -// Clear removes all items from the btree. If addNodesToFreelist is true, -// t's nodes are added to its freelist as part of this call, until the freelist -// is full. Otherwise, the root node is simply dereferenced and the subtree -// left to Go's normal GC processes. -// -// This can be much faster -// than calling Delete on all elements, because that requires finding/removing -// each element in the tree and updating the tree accordingly. It also is -// somewhat faster than creating a new tree to replace the old one, because -// nodes from the old tree are reclaimed into the freelist for use by the new -// one, instead of being lost to the garbage collector. -// -// This call takes: -// O(1): when addNodesToFreelist is false, this is a single operation. -// O(1): when the freelist is already full, it breaks out immediately -// O(freelist size): when the freelist is empty and the nodes are all owned -// by this tree, nodes are added to the freelist until full. -// O(tree size): when all nodes are owned by another tree, all nodes are -// iterated over looking for nodes to add to the freelist, and due to -// ownership, none are. -func (t *BTree) Clear(addNodesToFreelist bool) { - (*BTreeG[Item])(t).Clear(addNodesToFreelist) -} diff --git a/vendor/github.com/google/pprof/profile/profile.go b/vendor/github.com/google/pprof/profile/profile.go index 43f561d445..18df65a8df 100644 --- a/vendor/github.com/google/pprof/profile/profile.go +++ b/vendor/github.com/google/pprof/profile/profile.go @@ -278,7 +278,7 @@ func (p *Profile) massageMappings() { // Use heuristics to identify main binary and move it to the top of the list of mappings for i, m := range p.Mapping { - file := strings.TrimSpace(strings.Replace(m.File, "(deleted)", "", -1)) + file := strings.TrimSpace(strings.ReplaceAll(m.File, "(deleted)", "")) if len(file) == 0 { continue } diff --git a/vendor/github.com/google/pprof/profile/proto.go b/vendor/github.com/google/pprof/profile/proto.go index a15696ba16..31bf6bca63 100644 --- a/vendor/github.com/google/pprof/profile/proto.go +++ b/vendor/github.com/google/pprof/profile/proto.go @@ -36,6 +36,7 @@ package profile import ( "errors" "fmt" + "slices" ) type buffer struct { @@ -187,6 +188,16 @@ func le32(p []byte) uint32 { return uint32(p[0]) | uint32(p[1])<<8 | uint32(p[2])<<16 | uint32(p[3])<<24 } +func peekNumVarints(data []byte) (numVarints int) { + for ; len(data) > 0; numVarints++ { + var err error + if _, data, err = decodeVarint(data); err != nil { + break + } + } + return numVarints +} + func decodeVarint(data []byte) (uint64, []byte, error) { var u uint64 for i := 0; ; i++ { @@ -286,6 +297,9 @@ func decodeInt64(b *buffer, x *int64) error { func decodeInt64s(b *buffer, x *[]int64) error { if b.typ == 2 { // Packed encoding + dataLen := peekNumVarints(b.data) + *x = slices.Grow(*x, dataLen) + data := b.data for len(data) > 0 { var u uint64 @@ -316,8 +330,11 @@ func decodeUint64(b *buffer, x *uint64) error { func decodeUint64s(b *buffer, x *[]uint64) error { if b.typ == 2 { - data := b.data // Packed encoding + dataLen := peekNumVarints(b.data) + *x = slices.Grow(*x, dataLen) + + data := b.data for len(data) > 0 { var u uint64 var err error diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/LICENSE b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/LICENSE similarity index 100% rename from vendor/github.com/grpc-ecosystem/go-grpc-prometheus/LICENSE rename to vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/LICENSE diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_metrics.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_metrics.go new file mode 100644 index 0000000000..5c8ba20765 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_metrics.go @@ -0,0 +1,117 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package prometheus + +import ( + "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors" + "github.com/prometheus/client_golang/prometheus" + "google.golang.org/grpc" +) + +// ClientMetrics represents a collection of metrics to be registered on a +// Prometheus metrics registry for a gRPC client. +type ClientMetrics struct { + clientStartedCounter *prometheus.CounterVec + clientHandledCounter *prometheus.CounterVec + clientStreamMsgReceived *prometheus.CounterVec + clientStreamMsgSent *prometheus.CounterVec + + // clientHandledHistogram can be nil + clientHandledHistogram *prometheus.HistogramVec + // clientStreamRecvHistogram can be nil + clientStreamRecvHistogram *prometheus.HistogramVec + // clientStreamSendHistogram can be nil + clientStreamSendHistogram *prometheus.HistogramVec +} + +// NewClientMetrics returns a new ClientMetrics object. +// NOTE: Remember to register ClientMetrics object using prometheus registry +// e.g. prometheus.MustRegister(myClientMetrics). +func NewClientMetrics(opts ...ClientMetricsOption) *ClientMetrics { + var config clientMetricsConfig + config.apply(opts) + return &ClientMetrics{ + clientStartedCounter: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_client_started_total", + Help: "Total number of RPCs started on the client.", + }), []string{"grpc_type", "grpc_service", "grpc_method"}), + + clientHandledCounter: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_client_handled_total", + Help: "Total number of RPCs completed by the client, regardless of success or failure.", + }), []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"}), + + clientStreamMsgReceived: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_client_msg_received_total", + Help: "Total number of RPC stream messages received by the client.", + }), []string{"grpc_type", "grpc_service", "grpc_method"}), + + clientStreamMsgSent: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_client_msg_sent_total", + Help: "Total number of gRPC stream messages sent by the client.", + }), []string{"grpc_type", "grpc_service", "grpc_method"}), + + clientHandledHistogram: config.clientHandledHistogram, + clientStreamRecvHistogram: config.clientStreamRecvHistogram, + clientStreamSendHistogram: config.clientStreamSendHistogram, + } +} + +// Describe sends the super-set of all possible descriptors of metrics +// collected by this Collector to the provided channel and returns once +// the last descriptor has been sent. +func (m *ClientMetrics) Describe(ch chan<- *prometheus.Desc) { + m.clientStartedCounter.Describe(ch) + m.clientHandledCounter.Describe(ch) + m.clientStreamMsgReceived.Describe(ch) + m.clientStreamMsgSent.Describe(ch) + if m.clientHandledHistogram != nil { + m.clientHandledHistogram.Describe(ch) + } + if m.clientStreamRecvHistogram != nil { + m.clientStreamRecvHistogram.Describe(ch) + } + if m.clientStreamSendHistogram != nil { + m.clientStreamSendHistogram.Describe(ch) + } +} + +// Collect is called by the Prometheus registry when collecting +// metrics. The implementation sends each collected metric via the +// provided channel and returns once the last metric has been sent. +func (m *ClientMetrics) Collect(ch chan<- prometheus.Metric) { + m.clientStartedCounter.Collect(ch) + m.clientHandledCounter.Collect(ch) + m.clientStreamMsgReceived.Collect(ch) + m.clientStreamMsgSent.Collect(ch) + if m.clientHandledHistogram != nil { + m.clientHandledHistogram.Collect(ch) + } + if m.clientStreamRecvHistogram != nil { + m.clientStreamRecvHistogram.Collect(ch) + } + if m.clientStreamSendHistogram != nil { + m.clientStreamSendHistogram.Collect(ch) + } +} + +// UnaryClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Unary RPCs. +func (m *ClientMetrics) UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor { + return interceptors.UnaryClientInterceptor(&reportable{ + opts: opts, + clientMetrics: m, + }) +} + +// StreamClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Streaming RPCs. +func (m *ClientMetrics) StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { + return interceptors.StreamClientInterceptor(&reportable{ + opts: opts, + clientMetrics: m, + }) +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_options.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_options.go new file mode 100644 index 0000000000..c2671679c6 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/client_options.go @@ -0,0 +1,77 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package prometheus + +import ( + "github.com/prometheus/client_golang/prometheus" +) + +type clientMetricsConfig struct { + counterOpts counterOptions + // clientHandledHistogram can be nil. + clientHandledHistogram *prometheus.HistogramVec + // clientStreamRecvHistogram can be nil. + clientStreamRecvHistogram *prometheus.HistogramVec + // clientStreamSendHistogram can be nil. + clientStreamSendHistogram *prometheus.HistogramVec +} + +type ClientMetricsOption func(*clientMetricsConfig) + +func (c *clientMetricsConfig) apply(opts []ClientMetricsOption) { + for _, o := range opts { + o(c) + } +} + +func WithClientCounterOptions(opts ...CounterOption) ClientMetricsOption { + return func(o *clientMetricsConfig) { + o.counterOpts = opts + } +} + +// WithClientHandlingTimeHistogram turns on recording of handling time of RPCs. +// Histogram metrics can be very expensive for Prometheus to retain and query. +func WithClientHandlingTimeHistogram(opts ...HistogramOption) ClientMetricsOption { + return func(o *clientMetricsConfig) { + o.clientHandledHistogram = prometheus.NewHistogramVec( + histogramOptions(opts).apply(prometheus.HistogramOpts{ + Name: "grpc_client_handling_seconds", + Help: "Histogram of response latency (seconds) of the gRPC until it is finished by the application.", + Buckets: prometheus.DefBuckets, + }), + []string{"grpc_type", "grpc_service", "grpc_method"}, + ) + } +} + +// WithClientStreamRecvHistogram turns on recording of single message receive time of streaming RPCs. +// Histogram metrics can be very expensive for Prometheus to retain and query. +func WithClientStreamRecvHistogram(opts ...HistogramOption) ClientMetricsOption { + return func(o *clientMetricsConfig) { + o.clientStreamRecvHistogram = prometheus.NewHistogramVec( + histogramOptions(opts).apply(prometheus.HistogramOpts{ + Name: "grpc_client_msg_recv_handling_seconds", + Help: "Histogram of response latency (seconds) of the gRPC single message receive.", + Buckets: prometheus.DefBuckets, + }), + []string{"grpc_type", "grpc_service", "grpc_method"}, + ) + } +} + +// WithClientStreamSendHistogram turns on recording of single message send time of streaming RPCs. +// Histogram metrics can be very expensive for Prometheus to retain and query. +func WithClientStreamSendHistogram(opts ...HistogramOption) ClientMetricsOption { + return func(o *clientMetricsConfig) { + o.clientStreamSendHistogram = prometheus.NewHistogramVec( + histogramOptions(opts).apply(prometheus.HistogramOpts{ + Name: "grpc_client_msg_send_handling_seconds", + Help: "Histogram of response latency (seconds) of the gRPC single message send.", + Buckets: prometheus.DefBuckets, + }), + []string{"grpc_type", "grpc_service", "grpc_method"}, + ) + } +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/constants.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/constants.go new file mode 100644 index 0000000000..5c36923f7e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/constants.go @@ -0,0 +1,23 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package prometheus + +type grpcType string + +// grpcType describes all types of grpc connection. +const ( + Unary grpcType = "unary" + ClientStream grpcType = "client_stream" + ServerStream grpcType = "server_stream" + BidiStream grpcType = "bidi_stream" +) + +// Kind describes whether interceptor is a client or server type. +type Kind string + +// Enum for Client and Server Kind. +const ( + KindClient Kind = "client" + KindServer Kind = "server" +) diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/doc.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/doc.go new file mode 100644 index 0000000000..b62f17efb7 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/doc.go @@ -0,0 +1,8 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +/* +Package prometheus provides a standalone interceptor for metrics. It's next iteration of deprecated https://github.com/grpc-ecosystem/go-grpc-prometheus. +See https://github.com/grpc-ecosystem/go-grpc-middleware/tree/main/examples for example. +*/ +package prometheus diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/options.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/options.go new file mode 100644 index 0000000000..2047b5fe41 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/options.go @@ -0,0 +1,152 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package prometheus + +import ( + "github.com/prometheus/client_golang/prometheus" + "google.golang.org/grpc" + "google.golang.org/grpc/status" +) + +// FromError returns a grpc status. If the error code is neither a valid grpc status nor a context error, codes.Unknown +// will be set. +func FromError(err error) *status.Status { + s, ok := status.FromError(err) + // Mirror what the grpc server itself does, i.e. also convert context errors to status + if !ok { + s = status.FromContextError(err) + } + return s +} + +// A CounterOption lets you add options to Counter metrics using With* funcs. +type CounterOption func(*prometheus.CounterOpts) + +type counterOptions []CounterOption + +func (co counterOptions) apply(o prometheus.CounterOpts) prometheus.CounterOpts { + for _, f := range co { + f(&o) + } + return o +} + +// WithConstLabels allows you to add ConstLabels to Counter metrics. +func WithConstLabels(labels prometheus.Labels) CounterOption { + return func(o *prometheus.CounterOpts) { + o.ConstLabels = labels + } +} + +// WithSubsystem allows you to add a Subsystem to Counter metrics. +func WithSubsystem(subsystem string) CounterOption { + return func(o *prometheus.CounterOpts) { + o.Subsystem = subsystem + } +} + +// WithNamespace allows you to add a Namespace to Counter metrics. +func WithNamespace(namespace string) CounterOption { + return func(o *prometheus.CounterOpts) { + o.Namespace = namespace + } +} + +// A HistogramOption lets you add options to Histogram metrics using With* +// funcs. +type HistogramOption func(*prometheus.HistogramOpts) + +type histogramOptions []HistogramOption + +func (ho histogramOptions) apply(o prometheus.HistogramOpts) prometheus.HistogramOpts { + for _, f := range ho { + f(&o) + } + return o +} + +// WithHistogramBuckets allows you to specify custom bucket ranges for histograms if EnableHandlingTimeHistogram is on. +func WithHistogramBuckets(buckets []float64) HistogramOption { + return func(o *prometheus.HistogramOpts) { o.Buckets = buckets } +} + +// WithHistogramOpts allows you to specify HistogramOpts but makes sure the correct name and label is used. +// This function is helpful when specifying more than just the buckets, like using NativeHistograms. +func WithHistogramOpts(opts *prometheus.HistogramOpts) HistogramOption { + // TODO: This isn't ideal either if new fields are added to prometheus.HistogramOpts. + // Maybe we can change the interface to accept arbitrary HistogramOpts and + // only make sure to overwrite the necessary fields (name, labels). + return func(o *prometheus.HistogramOpts) { + o.Buckets = opts.Buckets + o.NativeHistogramBucketFactor = opts.NativeHistogramBucketFactor + o.NativeHistogramZeroThreshold = opts.NativeHistogramZeroThreshold + o.NativeHistogramMaxBucketNumber = opts.NativeHistogramMaxBucketNumber + o.NativeHistogramMinResetDuration = opts.NativeHistogramMinResetDuration + o.NativeHistogramMaxZeroThreshold = opts.NativeHistogramMaxZeroThreshold + } +} + +// WithHistogramConstLabels allows you to add custom ConstLabels to +// histograms metrics. +func WithHistogramConstLabels(labels prometheus.Labels) HistogramOption { + return func(o *prometheus.HistogramOpts) { + o.ConstLabels = labels + } +} + +// WithHistogramSubsystem allows you to add a Subsystem to histograms metrics. +func WithHistogramSubsystem(subsystem string) HistogramOption { + return func(o *prometheus.HistogramOpts) { + o.Subsystem = subsystem + } +} + +// WithHistogramNamespace allows you to add a Namespace to histograms metrics. +func WithHistogramNamespace(namespace string) HistogramOption { + return func(o *prometheus.HistogramOpts) { + o.Namespace = namespace + } +} + +func typeFromMethodInfo(mInfo *grpc.MethodInfo) grpcType { + if !mInfo.IsClientStream && !mInfo.IsServerStream { + return Unary + } + if mInfo.IsClientStream && !mInfo.IsServerStream { + return ClientStream + } + if !mInfo.IsClientStream && mInfo.IsServerStream { + return ServerStream + } + return BidiStream +} + +// An Option lets you add options to prometheus interceptors using With* funcs. +type Option func(*config) + +type config struct { + exemplarFn exemplarFromCtxFn + labelsFn labelsFromCtxFn +} + +func (c *config) apply(opts []Option) { + for _, o := range opts { + o(c) + } +} + +// WithExemplarFromContext sets function that will be used to deduce exemplar for all counter and histogram metrics. +func WithExemplarFromContext(exemplarFn exemplarFromCtxFn) Option { + return func(o *config) { + o.exemplarFn = exemplarFn + } +} + +// WithLabelsFromContext sets function that will be used to extract labels from context for metrics. +// This should be used in conjunction with WithContextLabels to define which labels to extract. +func WithLabelsFromContext(labelsFn labelsFromCtxFn) Option { + return func(o *config) { + o.labelsFn = labelsFn + } +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/reporter.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/reporter.go new file mode 100644 index 0000000000..268beb3e61 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/reporter.go @@ -0,0 +1,139 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package prometheus + +import ( + "context" + "time" + + "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors" + "github.com/prometheus/client_golang/prometheus" +) + +type reporter struct { + clientMetrics *ClientMetrics + serverMetrics *ServerMetrics + typ interceptors.GRPCType + service, method string + kind Kind + exemplar prometheus.Labels + contextLabels []string +} + +func (r *reporter) PostCall(err error, rpcDuration time.Duration) { + // get status code from error + status := FromError(err) + code := status.Code() + + // perform handling of metrics from code + switch r.kind { + case KindServer: + baseLabels := []string{string(r.typ), r.service, r.method, code.String()} + allLabels := append(baseLabels, r.contextLabels...) + r.incrementWithExemplar(r.serverMetrics.serverHandledCounter, allLabels...) + if r.serverMetrics.serverHandledHistogram != nil { + histLabels := []string{string(r.typ), r.service, r.method} + allHistLabels := append(histLabels, r.contextLabels...) + r.observeWithExemplar(r.serverMetrics.serverHandledHistogram, rpcDuration.Seconds(), allHistLabels...) + } + + case KindClient: + r.incrementWithExemplar(r.clientMetrics.clientHandledCounter, string(r.typ), r.service, r.method, code.String()) + if r.clientMetrics.clientHandledHistogram != nil { + r.observeWithExemplar(r.clientMetrics.clientHandledHistogram, rpcDuration.Seconds(), string(r.typ), r.service, r.method) + } + } +} + +func (r *reporter) PostMsgSend(_ any, _ error, sendDuration time.Duration) { + switch r.kind { + case KindServer: + baseLabels := []string{string(r.typ), r.service, r.method} + allLabels := append(baseLabels, r.contextLabels...) + r.incrementWithExemplar(r.serverMetrics.serverStreamMsgSent, allLabels...) + case KindClient: + r.incrementWithExemplar(r.clientMetrics.clientStreamMsgSent, string(r.typ), r.service, r.method) + if r.clientMetrics.clientStreamSendHistogram != nil { + r.observeWithExemplar(r.clientMetrics.clientStreamSendHistogram, sendDuration.Seconds(), string(r.typ), r.service, r.method) + } + } +} + +func (r *reporter) PostMsgReceive(_ any, _ error, recvDuration time.Duration) { + switch r.kind { + case KindServer: + baseLabels := []string{string(r.typ), r.service, r.method} + allLabels := append(baseLabels, r.contextLabels...) + r.incrementWithExemplar(r.serverMetrics.serverStreamMsgReceived, allLabels...) + case KindClient: + r.incrementWithExemplar(r.clientMetrics.clientStreamMsgReceived, string(r.typ), r.service, r.method) + if r.clientMetrics.clientStreamRecvHistogram != nil { + r.observeWithExemplar(r.clientMetrics.clientStreamRecvHistogram, recvDuration.Seconds(), string(r.typ), r.service, r.method) + } + } +} + +type reportable struct { + clientMetrics *ClientMetrics + serverMetrics *ServerMetrics + + opts []Option +} + +func (rep *reportable) ServerReporter(ctx context.Context, meta interceptors.CallMeta) (interceptors.Reporter, context.Context) { + return rep.reporter(ctx, rep.serverMetrics, nil, meta, KindServer) +} + +func (rep *reportable) ClientReporter(ctx context.Context, meta interceptors.CallMeta) (interceptors.Reporter, context.Context) { + return rep.reporter(ctx, nil, rep.clientMetrics, meta, KindClient) +} + +func (rep *reportable) reporter(ctx context.Context, sm *ServerMetrics, cm *ClientMetrics, meta interceptors.CallMeta, kind Kind) (interceptors.Reporter, context.Context) { + var c config + c.apply(rep.opts) + r := &reporter{ + clientMetrics: cm, + serverMetrics: sm, + typ: meta.Typ, + service: meta.Service, + method: meta.Method, + kind: kind, + } + if c.exemplarFn != nil { + r.exemplar = c.exemplarFn(ctx) + } + + // Extract context labels if labelsFn is configured and we're on server side + if c.labelsFn != nil && kind == KindServer && sm != nil { + contextLabelMap := c.labelsFn(ctx) + // Extract context label values in the order defined by the server metrics + r.contextLabels = make([]string, len(sm.contextLabelNames)) + for i, labelName := range sm.contextLabelNames { + if value, exists := contextLabelMap[labelName]; exists { + r.contextLabels[i] = value + } else { + // Use empty string if label not found in context + r.contextLabels[i] = "" + } + } + } + + switch kind { + case KindClient: + r.incrementWithExemplar(r.clientMetrics.clientStartedCounter, string(r.typ), r.service, r.method) + case KindServer: + baseLabels := []string{string(r.typ), r.service, r.method} + allLabels := append(baseLabels, r.contextLabels...) + r.incrementWithExemplar(r.serverMetrics.serverStartedCounter, allLabels...) + } + return r, ctx +} + +func (r *reporter) incrementWithExemplar(c *prometheus.CounterVec, lvals ...string) { + c.WithLabelValues(lvals...).(prometheus.ExemplarAdder).AddWithExemplar(1, r.exemplar) +} + +func (r *reporter) observeWithExemplar(h *prometheus.HistogramVec, value float64, lvals ...string) { + h.WithLabelValues(lvals...).(prometheus.ExemplarObserver).ObserveWithExemplar(value, r.exemplar) +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_metrics.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_metrics.go new file mode 100644 index 0000000000..358d574caf --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_metrics.go @@ -0,0 +1,163 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package prometheus + +import ( + "github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors" + "github.com/prometheus/client_golang/prometheus" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" +) + +// ServerMetrics represents a collection of metrics to be registered on a +// Prometheus metrics registry for a gRPC server. +type ServerMetrics struct { + serverStartedCounter *prometheus.CounterVec + serverHandledCounter *prometheus.CounterVec + serverStreamMsgReceived *prometheus.CounterVec + serverStreamMsgSent *prometheus.CounterVec + // serverHandledHistogram can be nil. + serverHandledHistogram *prometheus.HistogramVec + // contextLabelNames stores the names of context labels + contextLabelNames []string +} + +// NewServerMetrics returns a new ServerMetrics object that has server interceptor methods. +// NOTE: Remember to register ServerMetrics object by using prometheus registry +// e.g. prometheus.MustRegister(myServerMetrics). +func NewServerMetrics(opts ...ServerMetricsOption) *ServerMetrics { + var config serverMetricsConfig + config.apply(opts) + + // Build label names by combining default labels with context labels + defaultLabels := []string{"grpc_type", "grpc_service", "grpc_method"} + defaultLabelsWithCode := []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"} + + startedLabels := append(defaultLabels, config.contextLabels...) + handledLabels := append(defaultLabelsWithCode, config.contextLabels...) + streamLabels := append(defaultLabels, config.contextLabels...) + + // Create histogram if enabled + var serverHandledHistogram *prometheus.HistogramVec + if config.enableHistogram { + histogramLabels := append(defaultLabels, config.contextLabels...) + serverHandledHistogram = prometheus.NewHistogramVec( + histogramOptions(config.histogramOpts).apply(prometheus.HistogramOpts{ + Name: "grpc_server_handling_seconds", + Help: "Histogram of response latency (seconds) of gRPC that had been application-level handled by the server.", + Buckets: prometheus.DefBuckets, + }), + histogramLabels, + ) + } + + return &ServerMetrics{ + serverStartedCounter: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_server_started_total", + Help: "Total number of RPCs started on the server.", + }), startedLabels), + serverHandledCounter: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_server_handled_total", + Help: "Total number of RPCs completed on the server, regardless of success or failure.", + }), handledLabels), + serverStreamMsgReceived: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_server_msg_received_total", + Help: "Total number of RPC stream messages received on the server.", + }), streamLabels), + serverStreamMsgSent: prometheus.NewCounterVec( + config.counterOpts.apply(prometheus.CounterOpts{ + Name: "grpc_server_msg_sent_total", + Help: "Total number of gRPC stream messages sent by the server.", + }), streamLabels), + serverHandledHistogram: serverHandledHistogram, + contextLabelNames: config.contextLabels, + } +} + +// Describe sends the super-set of all possible descriptors of metrics +// collected by this Collector to the provided channel and returns once +// the last descriptor has been sent. +func (m *ServerMetrics) Describe(ch chan<- *prometheus.Desc) { + m.serverStartedCounter.Describe(ch) + m.serverHandledCounter.Describe(ch) + m.serverStreamMsgReceived.Describe(ch) + m.serverStreamMsgSent.Describe(ch) + if m.serverHandledHistogram != nil { + m.serverHandledHistogram.Describe(ch) + } +} + +// Collect is called by the Prometheus registry when collecting +// metrics. The implementation sends each collected metric via the +// provided channel and returns once the last metric has been sent. +func (m *ServerMetrics) Collect(ch chan<- prometheus.Metric) { + m.serverStartedCounter.Collect(ch) + m.serverHandledCounter.Collect(ch) + m.serverStreamMsgReceived.Collect(ch) + m.serverStreamMsgSent.Collect(ch) + if m.serverHandledHistogram != nil { + m.serverHandledHistogram.Collect(ch) + } +} + +// InitializeMetrics initializes all metrics, with their appropriate null +// value, for all gRPC methods registered on a gRPC server. This is useful, to +// ensure that all metrics exist when collecting and querying. +// NOTE: This might add significant cardinality and might not be needed in future version of Prometheus (created timestamp). +func (m *ServerMetrics) InitializeMetrics(server reflection.ServiceInfoProvider) { + serviceInfo := server.GetServiceInfo() + for serviceName, info := range serviceInfo { + for _, mInfo := range info.Methods { + m.preRegisterMethod(serviceName, &mInfo) + } + } +} + +// preRegisterMethod is invoked on Register of a Server, allowing all gRPC services labels to be pre-populated. +func (m *ServerMetrics) preRegisterMethod(serviceName string, mInfo *grpc.MethodInfo) { + methodName := mInfo.Name + methodType := string(typeFromMethodInfo(mInfo)) + + // Create empty context label values for pre-registration + contextLabels := make([]string, len(m.contextLabelNames)) + for i := range contextLabels { + contextLabels[i] = "" + } + + // Build complete label value arrays + startedLabels := append([]string{methodType, serviceName, methodName}, contextLabels...) + handledLabels := append([]string{methodType, serviceName, methodName}, contextLabels...) + streamLabels := append([]string{methodType, serviceName, methodName}, contextLabels...) + + // These are just references (no increments), as just referencing will create the labels but not set values. + _, _ = m.serverStartedCounter.GetMetricWithLabelValues(startedLabels...) + _, _ = m.serverStreamMsgReceived.GetMetricWithLabelValues(streamLabels...) + _, _ = m.serverStreamMsgSent.GetMetricWithLabelValues(streamLabels...) + if m.serverHandledHistogram != nil { + _, _ = m.serverHandledHistogram.GetMetricWithLabelValues(streamLabels...) + } + for _, code := range interceptors.AllCodes { + handledLabelsWithCode := append(handledLabels, code.String()) + _, _ = m.serverHandledCounter.GetMetricWithLabelValues(handledLabelsWithCode...) + } +} + +// UnaryServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Unary RPCs. +func (m *ServerMetrics) UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { + return interceptors.UnaryServerInterceptor(&reportable{ + opts: opts, + serverMetrics: m, + }) +} + +// StreamServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Streaming RPCs. +func (m *ServerMetrics) StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { + return interceptors.StreamServerInterceptor(&reportable{ + opts: opts, + serverMetrics: m, + }) +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_options.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_options.go new file mode 100644 index 0000000000..14340637d1 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus/server_options.go @@ -0,0 +1,56 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package prometheus + +import ( + "context" + + "github.com/prometheus/client_golang/prometheus" +) + +type exemplarFromCtxFn func(ctx context.Context) prometheus.Labels +type labelsFromCtxFn func(metadata context.Context) prometheus.Labels + +type serverMetricsConfig struct { + counterOpts counterOptions + // histogramOpts stores the options for creating the histogram with dynamic labels + histogramOpts histogramOptions + // enableHistogram indicates whether histogram should be created + enableHistogram bool + // contextLabels defines the names of dynamic labels to be extracted from context + contextLabels []string +} + +type ServerMetricsOption func(*serverMetricsConfig) + +func (c *serverMetricsConfig) apply(opts []ServerMetricsOption) { + for _, o := range opts { + o(c) + } +} + +// WithServerCounterOptions sets counter options. +func WithServerCounterOptions(opts ...CounterOption) ServerMetricsOption { + return func(o *serverMetricsConfig) { + o.counterOpts = opts + } +} + +// WithServerHandlingTimeHistogram turns on recording of handling time of RPCs. +// Histogram metrics can be very expensive for Prometheus to retain and query. +func WithServerHandlingTimeHistogram(opts ...HistogramOption) ServerMetricsOption { + return func(o *serverMetricsConfig) { + o.histogramOpts = opts + o.enableHistogram = true + } +} + +// WithContextLabels configures the server metrics to include dynamic labels extracted from context. +// The provided label names will be added to all server metrics as dynamic labels. +// Use WithLabelsFromContext in the interceptor options to specify how to extract these labels from context. +func WithContextLabels(labelNames ...string) ServerMetricsOption { + return func(o *serverMetricsConfig) { + o.contextLabels = labelNames + } +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/COPYRIGHT b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/COPYRIGHT new file mode 100644 index 0000000000..3b13627cdb --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/COPYRIGHT @@ -0,0 +1,2 @@ +Copyright (c) The go-grpc-middleware Authors. +Licensed under the Apache License 2.0. diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/LICENSE b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/LICENSE new file mode 100644 index 0000000000..b2b065037f --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. \ No newline at end of file diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/callmeta.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/callmeta.go new file mode 100644 index 0000000000..df3f5d11a8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/callmeta.go @@ -0,0 +1,67 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package interceptors + +import ( + "fmt" + "strings" + + "google.golang.org/grpc" +) + +func splitFullMethodName(fullMethod string) (string, string) { + fullMethod = strings.TrimPrefix(fullMethod, "/") // remove leading slash + if i := strings.Index(fullMethod, "/"); i >= 0 { + return fullMethod[:i], fullMethod[i+1:] + } + return "unknown", "unknown" +} + +type CallMeta struct { + ReqOrNil any + Typ GRPCType + Service string + Method string + IsClient bool +} + +func NewClientCallMeta(fullMethod string, streamDesc *grpc.StreamDesc, reqOrNil any) CallMeta { + c := CallMeta{IsClient: true, ReqOrNil: reqOrNil, Typ: Unary} + if streamDesc != nil { + c.Typ = clientStreamType(streamDesc) + } + c.Service, c.Method = splitFullMethodName(fullMethod) + return c +} + +func NewServerCallMeta(fullMethod string, streamInfo *grpc.StreamServerInfo, reqOrNil any) CallMeta { + c := CallMeta{IsClient: false, ReqOrNil: reqOrNil, Typ: Unary} + if streamInfo != nil { + c.Typ = serverStreamType(streamInfo) + } + c.Service, c.Method = splitFullMethodName(fullMethod) + return c +} + +func (c CallMeta) FullMethod() string { + return fmt.Sprintf("/%s/%s", c.Service, c.Method) +} + +func clientStreamType(desc *grpc.StreamDesc) GRPCType { + if desc.ClientStreams && !desc.ServerStreams { + return ClientStream + } else if !desc.ClientStreams && desc.ServerStreams { + return ServerStream + } + return BidiStream +} + +func serverStreamType(info *grpc.StreamServerInfo) GRPCType { + if info.IsClientStream && !info.IsServerStream { + return ClientStream + } else if !info.IsClientStream && info.IsServerStream { + return ServerStream + } + return BidiStream +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/client.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/client.go new file mode 100644 index 0000000000..7b4460e21e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/client.go @@ -0,0 +1,80 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +// Go gRPC Middleware monitoring interceptors for client-side gRPC. + +package interceptors + +import ( + "context" + "errors" + "io" + "time" + + "google.golang.org/grpc" +) + +// UnaryClientInterceptor is a gRPC client-side interceptor that provides reporting for Unary RPCs. +func UnaryClientInterceptor(reportable ClientReportable) grpc.UnaryClientInterceptor { + return func(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { + r := newReport(NewClientCallMeta(method, nil, req)) + reporter, newCtx := reportable.ClientReporter(ctx, r.callMeta) + + reporter.PostMsgSend(req, nil, time.Since(r.startTime)) + err := invoker(newCtx, method, req, reply, cc, opts...) + reporter.PostMsgReceive(reply, err, time.Since(r.startTime)) + reporter.PostCall(err, time.Since(r.startTime)) + return err + } +} + +// StreamClientInterceptor is a gRPC client-side interceptor that provides reporting for Stream RPCs. +func StreamClientInterceptor(reportable ClientReportable) grpc.StreamClientInterceptor { + return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { + r := newReport(NewClientCallMeta(method, desc, nil)) + reporter, newCtx := reportable.ClientReporter(ctx, r.callMeta) + + clientStream, err := streamer(newCtx, desc, cc, method, opts...) + if err != nil { + reporter.PostCall(err, time.Since(r.startTime)) + return nil, err + } + return &monitoredClientStream{ClientStream: clientStream, startTime: r.startTime, hasServerStream: desc.ServerStreams, reporter: reporter}, nil + } +} + +// monitoredClientStream wraps grpc.ClientStream allowing each Sent/Recv of message to report. +type monitoredClientStream struct { + grpc.ClientStream + + startTime time.Time + hasServerStream bool + reporter Reporter +} + +func (s *monitoredClientStream) SendMsg(m any) error { + start := time.Now() + err := s.ClientStream.SendMsg(m) + s.reporter.PostMsgSend(m, err, time.Since(start)) + return err +} + +func (s *monitoredClientStream) RecvMsg(m any) error { + start := time.Now() + err := s.ClientStream.RecvMsg(m) + s.reporter.PostMsgReceive(m, err, time.Since(start)) + + if s.hasServerStream { + if err == nil { + return nil + } + var postErr error + if !errors.Is(err, io.EOF) { + postErr = err + } + s.reporter.PostCall(postErr, time.Since(s.startTime)) + } else { + s.reporter.PostCall(err, time.Since(s.startTime)) + } + return err +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/doc.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/doc.go new file mode 100644 index 0000000000..2608b9a4f8 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/doc.go @@ -0,0 +1,12 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +// +/* +interceptor is an internal package used by higher level middlewares. It allows injecting custom code in various +places of the gRPC lifecycle. + +This particular package is intended for use by other middleware, metric, logging or otherwise. +This allows code to be shared between different implementations. +*/ +package interceptors diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/reporter.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/reporter.go new file mode 100644 index 0000000000..c1731962a0 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/reporter.go @@ -0,0 +1,73 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +package interceptors + +import ( + "context" + "time" + + "google.golang.org/grpc/codes" +) + +type GRPCType string + +const ( + Unary GRPCType = "unary" + ClientStream GRPCType = "client_stream" + ServerStream GRPCType = "server_stream" + BidiStream GRPCType = "bidi_stream" +) + +var AllCodes = []codes.Code{ + codes.OK, codes.Canceled, codes.Unknown, codes.InvalidArgument, codes.DeadlineExceeded, codes.NotFound, + codes.AlreadyExists, codes.PermissionDenied, codes.Unauthenticated, codes.ResourceExhausted, + codes.FailedPrecondition, codes.Aborted, codes.OutOfRange, codes.Unimplemented, codes.Internal, + codes.Unavailable, codes.DataLoss, +} + +type ClientReportable interface { + ClientReporter(context.Context, CallMeta) (Reporter, context.Context) +} + +type ServerReportable interface { + ServerReporter(context.Context, CallMeta) (Reporter, context.Context) +} + +// CommonReportableFunc helper allows an easy way to implement reporter with common client and server logic. +type CommonReportableFunc func(ctx context.Context, c CallMeta) (Reporter, context.Context) + +func (f CommonReportableFunc) ClientReporter(ctx context.Context, c CallMeta) (Reporter, context.Context) { + return f(ctx, c) +} + +func (f CommonReportableFunc) ServerReporter(ctx context.Context, c CallMeta) (Reporter, context.Context) { + return f(ctx, c) +} + +type Reporter interface { + PostCall(err error, rpcDuration time.Duration) + PostMsgSend(reqProto any, err error, sendDuration time.Duration) + PostMsgReceive(replyProto any, err error, recvDuration time.Duration) +} + +var _ Reporter = NoopReporter{} + +type NoopReporter struct{} + +func (NoopReporter) PostCall(error, time.Duration) {} +func (NoopReporter) PostMsgSend(any, error, time.Duration) {} +func (NoopReporter) PostMsgReceive(any, error, time.Duration) {} + +type report struct { + callMeta CallMeta + startTime time.Time +} + +func newReport(callMeta CallMeta) report { + r := report{ + startTime: time.Now(), + callMeta: callMeta, + } + return r +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/server.go b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/server.go new file mode 100644 index 0000000000..0484109069 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors/server.go @@ -0,0 +1,65 @@ +// Copyright (c) The go-grpc-middleware Authors. +// Licensed under the Apache License 2.0. + +// Go gRPC Middleware monitoring interceptors for server-side gRPC. + +package interceptors + +import ( + "context" + "time" + + "google.golang.org/grpc" +) + +// UnaryServerInterceptor is a gRPC server-side interceptor that provides reporting for Unary RPCs. +func UnaryServerInterceptor(reportable ServerReportable) grpc.UnaryServerInterceptor { + return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) { + r := newReport(NewServerCallMeta(info.FullMethod, nil, req)) + reporter, newCtx := reportable.ServerReporter(ctx, r.callMeta) + + reporter.PostMsgReceive(req, nil, time.Since(r.startTime)) + resp, err := handler(newCtx, req) + reporter.PostMsgSend(resp, err, time.Since(r.startTime)) + + reporter.PostCall(err, time.Since(r.startTime)) + return resp, err + } +} + +// StreamServerInterceptor is a gRPC server-side interceptor that provides reporting for Streaming RPCs. +func StreamServerInterceptor(reportable ServerReportable) grpc.StreamServerInterceptor { + return func(srv any, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { + r := newReport(NewServerCallMeta(info.FullMethod, info, nil)) + reporter, newCtx := reportable.ServerReporter(ss.Context(), r.callMeta) + err := handler(srv, &monitoredServerStream{ServerStream: ss, newCtx: newCtx, reporter: reporter}) + reporter.PostCall(err, time.Since(r.startTime)) + return err + } +} + +// monitoredStream wraps grpc.ServerStream allowing each Sent/Recv of message to report. +type monitoredServerStream struct { + grpc.ServerStream + + newCtx context.Context + reporter Reporter +} + +func (s *monitoredServerStream) Context() context.Context { + return s.newCtx +} + +func (s *monitoredServerStream) SendMsg(m any) error { + start := time.Now() + err := s.ServerStream.SendMsg(m) + s.reporter.PostMsgSend(m, err, time.Since(start)) + return err +} + +func (s *monitoredServerStream) RecvMsg(m any) error { + start := time.Now() + err := s.ServerStream.RecvMsg(m) + s.reporter.PostMsgReceive(m, err, time.Since(start)) + return err +} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.gitignore b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.gitignore deleted file mode 100644 index 2233cff9d1..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.gitignore +++ /dev/null @@ -1,201 +0,0 @@ -#vendor -vendor/ - -# Created by .ignore support plugin (hsz.mobi) -coverage.txt -### Go template -# Compiled Object files, Static and Dynamic libs (Shared Objects) -*.o -*.a -*.so - -# Folders -_obj -_test - -# Architecture specific extensions/prefixes -*.[568vq] -[568vq].out - -*.cgo1.go -*.cgo2.c -_cgo_defun.c -_cgo_gotypes.go -_cgo_export.* - -_testmain.go - -*.exe -*.test -*.prof -### Windows template -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk -### Kate template -# Swap Files # -.*.kate-swp -.swp.* -### SublimeText template -# cache files for sublime text -*.tmlanguage.cache -*.tmPreferences.cache -*.stTheme.cache - -# workspace files are user-specific -*.sublime-workspace - -# project files should be checked into the repository, unless a significant -# proportion of contributors will probably not be using SublimeText -# *.sublime-project - -# sftp configuration file -sftp-config.json -### Linux template -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* -### JetBrains template -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea -.idea/tasks.xml -.idea/dictionaries -.idea/vcs.xml -.idea/jsLibraryMappings.xml - -# Sensitive or high-churn files: -.idea/dataSources.ids -.idea/dataSources.xml -.idea/dataSources.local.xml -.idea/sqlDataSources.xml -.idea/dynamic.xml -.idea/uiDesigner.xml - -# Gradle: -.idea/gradle.xml -.idea/libraries - -# Mongo Explorer plugin: -.idea/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ -/out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties -### Xcode template -# Xcode -# -# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore - -## Build generated -build/ -DerivedData/ - -## Various settings -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint -### Eclipse template - -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath -.recommenders - -# Eclipse Core -.project - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - -# JDT-specific (Eclipse Java Development Tools) -.classpath - -# Java annotation processor (APT) -.factorypath - -# PDT-specific (PHP Development Tools) -.buildpath - -# sbteclipse plugin -.target - -# Tern plugin -.tern-project - -# TeXlipse plugin -.texlipse - -# STS (Spring Tool Suite) -.springBeans - -# Code Recommenders -.recommenders/ - diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.travis.yml b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.travis.yml deleted file mode 100644 index 2a845b96ae..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -sudo: false -language: go -# * github.com/grpc/grpc-go still supports go1.6 -# - When we drop support for go1.6 we can remove golang.org/x/net/context -# below as it is part of the Go std library since go1.7 -# * github.com/prometheus/client_golang already requires at least go1.7 since -# September 2017 -go: - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - - master - -install: - - go get github.com/prometheus/client_golang/prometheus - - go get google.golang.org/grpc - - go get golang.org/x/net/context - - go get github.com/stretchr/testify -script: - - make test - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/CHANGELOG.md b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/CHANGELOG.md deleted file mode 100644 index 19a8059e1b..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/CHANGELOG.md +++ /dev/null @@ -1,24 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [1.2.0](https://github.com/grpc-ecosystem/go-grpc-prometheus/releases/tag/v1.2.0) - 2018-06-04 - -### Added - -* Provide metrics object as `prometheus.Collector`, for conventional metric registration. -* Support non-default/global Prometheus registry. -* Allow configuring counters with `prometheus.CounterOpts`. - -### Changed - -* Remove usage of deprecated `grpc.Code()`. -* Remove usage of deprecated `grpc.Errorf` and replace with `status.Errorf`. - ---- - -This changelog was started with version `v1.2.0`, for earlier versions refer to the respective [GitHub releases](https://github.com/grpc-ecosystem/go-grpc-prometheus/releases). diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/README.md deleted file mode 100644 index 499c583553..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/README.md +++ /dev/null @@ -1,247 +0,0 @@ -# Go gRPC Interceptors for Prometheus monitoring - -[![Travis Build](https://travis-ci.org/grpc-ecosystem/go-grpc-prometheus.svg)](https://travis-ci.org/grpc-ecosystem/go-grpc-prometheus) -[![Go Report Card](https://goreportcard.com/badge/github.com/grpc-ecosystem/go-grpc-prometheus)](http://goreportcard.com/report/grpc-ecosystem/go-grpc-prometheus) -[![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/grpc-ecosystem/go-grpc-prometheus) -[![SourceGraph](https://sourcegraph.com/github.com/grpc-ecosystem/go-grpc-prometheus/-/badge.svg)](https://sourcegraph.com/github.com/grpc-ecosystem/go-grpc-prometheus/?badge) -[![codecov](https://codecov.io/gh/grpc-ecosystem/go-grpc-prometheus/branch/master/graph/badge.svg)](https://codecov.io/gh/grpc-ecosystem/go-grpc-prometheus) -[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) - -[Prometheus](https://prometheus.io/) monitoring for your [gRPC Go](https://github.com/grpc/grpc-go) servers and clients. - -A sister implementation for [gRPC Java](https://github.com/grpc/grpc-java) (same metrics, same semantics) is in [grpc-ecosystem/java-grpc-prometheus](https://github.com/grpc-ecosystem/java-grpc-prometheus). - -## Interceptors - -[gRPC Go](https://github.com/grpc/grpc-go) recently acquired support for Interceptors, i.e. middleware that is executed -by a gRPC Server before the request is passed onto the user's application logic. It is a perfect way to implement -common patterns: auth, logging and... monitoring. - -To use Interceptors in chains, please see [`go-grpc-middleware`](https://github.com/mwitkow/go-grpc-middleware). - -## Usage - -There are two types of interceptors: client-side and server-side. This package provides monitoring Interceptors for both. - -### Server-side - -```go -import "github.com/grpc-ecosystem/go-grpc-prometheus" -... - // Initialize your gRPC server's interceptor. - myServer := grpc.NewServer( - grpc.StreamInterceptor(grpc_prometheus.StreamServerInterceptor), - grpc.UnaryInterceptor(grpc_prometheus.UnaryServerInterceptor), - ) - // Register your gRPC service implementations. - myservice.RegisterMyServiceServer(s.server, &myServiceImpl{}) - // After all your registrations, make sure all of the Prometheus metrics are initialized. - grpc_prometheus.Register(myServer) - // Register Prometheus metrics handler. - http.Handle("/metrics", promhttp.Handler()) -... -``` - -### Client-side - -```go -import "github.com/grpc-ecosystem/go-grpc-prometheus" -... - clientConn, err = grpc.Dial( - address, - grpc.WithUnaryInterceptor(grpc_prometheus.UnaryClientInterceptor), - grpc.WithStreamInterceptor(grpc_prometheus.StreamClientInterceptor) - ) - client = pb_testproto.NewTestServiceClient(clientConn) - resp, err := client.PingEmpty(s.ctx, &myservice.Request{Msg: "hello"}) -... -``` - -# Metrics - -## Labels - -All server-side metrics start with `grpc_server` as Prometheus subsystem name. All client-side metrics start with `grpc_client`. Both of them have mirror-concepts. Similarly all methods -contain the same rich labels: - - * `grpc_service` - the [gRPC service](http://www.grpc.io/docs/#defining-a-service) name, which is the combination of protobuf `package` and - the `grpc_service` section name. E.g. for `package = mwitkow.testproto` and - `service TestService` the label will be `grpc_service="mwitkow.testproto.TestService"` - * `grpc_method` - the name of the method called on the gRPC service. E.g. - `grpc_method="Ping"` - * `grpc_type` - the gRPC [type of request](http://www.grpc.io/docs/guides/concepts.html#rpc-life-cycle). - Differentiating between the two is important especially for latency measurements. - - - `unary` is single request, single response RPC - - `client_stream` is a multi-request, single response RPC - - `server_stream` is a single request, multi-response RPC - - `bidi_stream` is a multi-request, multi-response RPC - - -Additionally for completed RPCs, the following labels are used: - - * `grpc_code` - the human-readable [gRPC status code](https://github.com/grpc/grpc-go/blob/master/codes/codes.go). - The list of all statuses is to long, but here are some common ones: - - - `OK` - means the RPC was successful - - `IllegalArgument` - RPC contained bad values - - `Internal` - server-side error not disclosed to the clients - -## Counters - -The counters and their up to date documentation is in [server_reporter.go](server_reporter.go) and [client_reporter.go](client_reporter.go) -the respective Prometheus handler (usually `/metrics`). - -For the purpose of this documentation we will only discuss `grpc_server` metrics. The `grpc_client` ones contain mirror concepts. - -For simplicity, let's assume we're tracking a single server-side RPC call of [`mwitkow.testproto.TestService`](examples/testproto/test.proto), -calling the method `PingList`. The call succeeds and returns 20 messages in the stream. - -First, immediately after the server receives the call it will increment the -`grpc_server_started_total` and start the handling time clock (if histograms are enabled). - -```jsoniq -grpc_server_started_total{grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 1 -``` - -Then the user logic gets invoked. It receives one message from the client containing the request -(it's a `server_stream`): - -```jsoniq -grpc_server_msg_received_total{grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 1 -``` - -The user logic may return an error, or send multiple messages back to the client. In this case, on -each of the 20 messages sent back, a counter will be incremented: - -```jsoniq -grpc_server_msg_sent_total{grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 20 -``` - -After the call completes, its status (`OK` or other [gRPC status code](https://github.com/grpc/grpc-go/blob/master/codes/codes.go)) -and the relevant call labels increment the `grpc_server_handled_total` counter. - -```jsoniq -grpc_server_handled_total{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 1 -``` - -## Histograms - -[Prometheus histograms](https://prometheus.io/docs/concepts/metric_types/#histogram) are a great way -to measure latency distributions of your RPCs. However, since it is bad practice to have metrics -of [high cardinality](https://prometheus.io/docs/practices/instrumentation/#do-not-overuse-labels) -the latency monitoring metrics are disabled by default. To enable them please call the following -in your server initialization code: - -```jsoniq -grpc_prometheus.EnableHandlingTimeHistogram() -``` - -After the call completes, its handling time will be recorded in a [Prometheus histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) -variable `grpc_server_handling_seconds`. The histogram variable contains three sub-metrics: - - * `grpc_server_handling_seconds_count` - the count of all completed RPCs by status and method - * `grpc_server_handling_seconds_sum` - cumulative time of RPCs by status and method, useful for - calculating average handling times - * `grpc_server_handling_seconds_bucket` - contains the counts of RPCs by status and method in respective - handling-time buckets. These buckets can be used by Prometheus to estimate SLAs (see [here](https://prometheus.io/docs/practices/histograms/)) - -The counter values will look as follows: - -```jsoniq -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="0.005"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="0.01"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="0.025"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="0.05"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="0.1"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="0.25"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="0.5"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="1"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="2.5"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="5"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="10"} 1 -grpc_server_handling_seconds_bucket{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream",le="+Inf"} 1 -grpc_server_handling_seconds_sum{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 0.0003866430000000001 -grpc_server_handling_seconds_count{grpc_code="OK",grpc_method="PingList",grpc_service="mwitkow.testproto.TestService",grpc_type="server_stream"} 1 -``` - - -## Useful query examples - -Prometheus philosophy is to provide raw metrics to the monitoring system, and -let the aggregations be handled there. The verbosity of above metrics make it possible to have that -flexibility. Here's a couple of useful monitoring queries: - - -### request inbound rate -```jsoniq -sum(rate(grpc_server_started_total{job="foo"}[1m])) by (grpc_service) -``` -For `job="foo"` (common label to differentiate between Prometheus monitoring targets), calculate the -rate of requests per second (1 minute window) for each gRPC `grpc_service` that the job has. Please note -how the `grpc_method` is being omitted here: all methods of a given gRPC service will be summed together. - -### unary request error rate -```jsoniq -sum(rate(grpc_server_handled_total{job="foo",grpc_type="unary",grpc_code!="OK"}[1m])) by (grpc_service) -``` -For `job="foo"`, calculate the per-`grpc_service` rate of `unary` (1:1) RPCs that failed, i.e. the -ones that didn't finish with `OK` code. - -### unary request error percentage -```jsoniq -sum(rate(grpc_server_handled_total{job="foo",grpc_type="unary",grpc_code!="OK"}[1m])) by (grpc_service) - / -sum(rate(grpc_server_started_total{job="foo",grpc_type="unary"}[1m])) by (grpc_service) - * 100.0 -``` -For `job="foo"`, calculate the percentage of failed requests by service. It's easy to notice that -this is a combination of the two above examples. This is an example of a query you would like to -[alert on](https://prometheus.io/docs/alerting/rules/) in your system for SLA violations, e.g. -"no more than 1% requests should fail". - -### average response stream size -```jsoniq -sum(rate(grpc_server_msg_sent_total{job="foo",grpc_type="server_stream"}[10m])) by (grpc_service) - / -sum(rate(grpc_server_started_total{job="foo",grpc_type="server_stream"}[10m])) by (grpc_service) -``` -For `job="foo"` what is the `grpc_service`-wide `10m` average of messages returned for all ` -server_stream` RPCs. This allows you to track the stream sizes returned by your system, e.g. allows -you to track when clients started to send "wide" queries that ret -Note the divisor is the number of started RPCs, in order to account for in-flight requests. - -### 99%-tile latency of unary requests -```jsoniq -histogram_quantile(0.99, - sum(rate(grpc_server_handling_seconds_bucket{job="foo",grpc_type="unary"}[5m])) by (grpc_service,le) -) -``` -For `job="foo"`, returns an 99%-tile [quantile estimation](https://prometheus.io/docs/practices/histograms/#quantiles) -of the handling time of RPCs per service. Please note the `5m` rate, this means that the quantile -estimation will take samples in a rolling `5m` window. When combined with other quantiles -(e.g. 50%, 90%), this query gives you tremendous insight into the responsiveness of your system -(e.g. impact of caching). - -### percentage of slow unary queries (>250ms) -```jsoniq -100.0 - ( -sum(rate(grpc_server_handling_seconds_bucket{job="foo",grpc_type="unary",le="0.25"}[5m])) by (grpc_service) - / -sum(rate(grpc_server_handling_seconds_count{job="foo",grpc_type="unary"}[5m])) by (grpc_service) -) * 100.0 -``` -For `job="foo"` calculate the by-`grpc_service` fraction of slow requests that took longer than `0.25` -seconds. This query is relatively complex, since the Prometheus aggregations use `le` (less or equal) -buckets, meaning that counting "fast" requests fractions is easier. However, simple maths helps. -This is an example of a query you would like to alert on in your system for SLA violations, -e.g. "less than 1% of requests are slower than 250ms". - - -## Status - -This code has been used since August 2015 as the basis for monitoring of *production* gRPC micro services at [Improbable](https://improbable.io). - -## License - -`go-grpc-prometheus` is released under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details. diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client.go deleted file mode 100644 index 751a4c72d7..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 Michal Witkowski. All Rights Reserved. -// See LICENSE for licensing terms. - -// gRPC Prometheus monitoring interceptors for client-side gRPC. - -package grpc_prometheus - -import ( - prom "github.com/prometheus/client_golang/prometheus" -) - -var ( - // DefaultClientMetrics is the default instance of ClientMetrics. It is - // intended to be used in conjunction the default Prometheus metrics - // registry. - DefaultClientMetrics = NewClientMetrics() - - // UnaryClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Unary RPCs. - UnaryClientInterceptor = DefaultClientMetrics.UnaryClientInterceptor() - - // StreamClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Streaming RPCs. - StreamClientInterceptor = DefaultClientMetrics.StreamClientInterceptor() -) - -func init() { - prom.MustRegister(DefaultClientMetrics.clientStartedCounter) - prom.MustRegister(DefaultClientMetrics.clientHandledCounter) - prom.MustRegister(DefaultClientMetrics.clientStreamMsgReceived) - prom.MustRegister(DefaultClientMetrics.clientStreamMsgSent) -} - -// EnableClientHandlingTimeHistogram turns on recording of handling time of -// RPCs. Histogram metrics can be very expensive for Prometheus to retain and -// query. This function acts on the DefaultClientMetrics variable and the -// default Prometheus metrics registry. -func EnableClientHandlingTimeHistogram(opts ...HistogramOption) { - DefaultClientMetrics.EnableClientHandlingTimeHistogram(opts...) - prom.Register(DefaultClientMetrics.clientHandledHistogram) -} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_metrics.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_metrics.go deleted file mode 100644 index 9b476f9832..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_metrics.go +++ /dev/null @@ -1,170 +0,0 @@ -package grpc_prometheus - -import ( - "io" - - prom "github.com/prometheus/client_golang/prometheus" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// ClientMetrics represents a collection of metrics to be registered on a -// Prometheus metrics registry for a gRPC client. -type ClientMetrics struct { - clientStartedCounter *prom.CounterVec - clientHandledCounter *prom.CounterVec - clientStreamMsgReceived *prom.CounterVec - clientStreamMsgSent *prom.CounterVec - clientHandledHistogramEnabled bool - clientHandledHistogramOpts prom.HistogramOpts - clientHandledHistogram *prom.HistogramVec -} - -// NewClientMetrics returns a ClientMetrics object. Use a new instance of -// ClientMetrics when not using the default Prometheus metrics registry, for -// example when wanting to control which metrics are added to a registry as -// opposed to automatically adding metrics via init functions. -func NewClientMetrics(counterOpts ...CounterOption) *ClientMetrics { - opts := counterOptions(counterOpts) - return &ClientMetrics{ - clientStartedCounter: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_client_started_total", - Help: "Total number of RPCs started on the client.", - }), []string{"grpc_type", "grpc_service", "grpc_method"}), - - clientHandledCounter: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_client_handled_total", - Help: "Total number of RPCs completed by the client, regardless of success or failure.", - }), []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"}), - - clientStreamMsgReceived: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_client_msg_received_total", - Help: "Total number of RPC stream messages received by the client.", - }), []string{"grpc_type", "grpc_service", "grpc_method"}), - - clientStreamMsgSent: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_client_msg_sent_total", - Help: "Total number of gRPC stream messages sent by the client.", - }), []string{"grpc_type", "grpc_service", "grpc_method"}), - - clientHandledHistogramEnabled: false, - clientHandledHistogramOpts: prom.HistogramOpts{ - Name: "grpc_client_handling_seconds", - Help: "Histogram of response latency (seconds) of the gRPC until it is finished by the application.", - Buckets: prom.DefBuckets, - }, - clientHandledHistogram: nil, - } -} - -// Describe sends the super-set of all possible descriptors of metrics -// collected by this Collector to the provided channel and returns once -// the last descriptor has been sent. -func (m *ClientMetrics) Describe(ch chan<- *prom.Desc) { - m.clientStartedCounter.Describe(ch) - m.clientHandledCounter.Describe(ch) - m.clientStreamMsgReceived.Describe(ch) - m.clientStreamMsgSent.Describe(ch) - if m.clientHandledHistogramEnabled { - m.clientHandledHistogram.Describe(ch) - } -} - -// Collect is called by the Prometheus registry when collecting -// metrics. The implementation sends each collected metric via the -// provided channel and returns once the last metric has been sent. -func (m *ClientMetrics) Collect(ch chan<- prom.Metric) { - m.clientStartedCounter.Collect(ch) - m.clientHandledCounter.Collect(ch) - m.clientStreamMsgReceived.Collect(ch) - m.clientStreamMsgSent.Collect(ch) - if m.clientHandledHistogramEnabled { - m.clientHandledHistogram.Collect(ch) - } -} - -// EnableClientHandlingTimeHistogram turns on recording of handling time of RPCs. -// Histogram metrics can be very expensive for Prometheus to retain and query. -func (m *ClientMetrics) EnableClientHandlingTimeHistogram(opts ...HistogramOption) { - for _, o := range opts { - o(&m.clientHandledHistogramOpts) - } - if !m.clientHandledHistogramEnabled { - m.clientHandledHistogram = prom.NewHistogramVec( - m.clientHandledHistogramOpts, - []string{"grpc_type", "grpc_service", "grpc_method"}, - ) - } - m.clientHandledHistogramEnabled = true -} - -// UnaryClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Unary RPCs. -func (m *ClientMetrics) UnaryClientInterceptor() func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { - monitor := newClientReporter(m, Unary, method) - monitor.SentMessage() - err := invoker(ctx, method, req, reply, cc, opts...) - if err != nil { - monitor.ReceivedMessage() - } - st, _ := status.FromError(err) - monitor.Handled(st.Code()) - return err - } -} - -// StreamClientInterceptor is a gRPC client-side interceptor that provides Prometheus monitoring for Streaming RPCs. -func (m *ClientMetrics) StreamClientInterceptor() func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { - return func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) { - monitor := newClientReporter(m, clientStreamType(desc), method) - clientStream, err := streamer(ctx, desc, cc, method, opts...) - if err != nil { - st, _ := status.FromError(err) - monitor.Handled(st.Code()) - return nil, err - } - return &monitoredClientStream{clientStream, monitor}, nil - } -} - -func clientStreamType(desc *grpc.StreamDesc) grpcType { - if desc.ClientStreams && !desc.ServerStreams { - return ClientStream - } else if !desc.ClientStreams && desc.ServerStreams { - return ServerStream - } - return BidiStream -} - -// monitoredClientStream wraps grpc.ClientStream allowing each Sent/Recv of message to increment counters. -type monitoredClientStream struct { - grpc.ClientStream - monitor *clientReporter -} - -func (s *monitoredClientStream) SendMsg(m interface{}) error { - err := s.ClientStream.SendMsg(m) - if err == nil { - s.monitor.SentMessage() - } - return err -} - -func (s *monitoredClientStream) RecvMsg(m interface{}) error { - err := s.ClientStream.RecvMsg(m) - if err == nil { - s.monitor.ReceivedMessage() - } else if err == io.EOF { - s.monitor.Handled(codes.OK) - } else { - st, _ := status.FromError(err) - s.monitor.Handled(st.Code()) - } - return err -} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_reporter.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_reporter.go deleted file mode 100644 index cbf1532299..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/client_reporter.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016 Michal Witkowski. All Rights Reserved. -// See LICENSE for licensing terms. - -package grpc_prometheus - -import ( - "time" - - "google.golang.org/grpc/codes" -) - -type clientReporter struct { - metrics *ClientMetrics - rpcType grpcType - serviceName string - methodName string - startTime time.Time -} - -func newClientReporter(m *ClientMetrics, rpcType grpcType, fullMethod string) *clientReporter { - r := &clientReporter{ - metrics: m, - rpcType: rpcType, - } - if r.metrics.clientHandledHistogramEnabled { - r.startTime = time.Now() - } - r.serviceName, r.methodName = splitMethodName(fullMethod) - r.metrics.clientStartedCounter.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Inc() - return r -} - -func (r *clientReporter) ReceivedMessage() { - r.metrics.clientStreamMsgReceived.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Inc() -} - -func (r *clientReporter) SentMessage() { - r.metrics.clientStreamMsgSent.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Inc() -} - -func (r *clientReporter) Handled(code codes.Code) { - r.metrics.clientHandledCounter.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName, code.String()).Inc() - if r.metrics.clientHandledHistogramEnabled { - r.metrics.clientHandledHistogram.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Observe(time.Since(r.startTime).Seconds()) - } -} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/makefile b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/makefile deleted file mode 100644 index 74c0842230..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/makefile +++ /dev/null @@ -1,16 +0,0 @@ -SHELL="/bin/bash" - -GOFILES_NOVENDOR = $(shell go list ./... | grep -v /vendor/) - -all: vet fmt test - -fmt: - go fmt $(GOFILES_NOVENDOR) - -vet: - go vet $(GOFILES_NOVENDOR) - -test: vet - ./scripts/test_all.sh - -.PHONY: all vet test diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/metric_options.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/metric_options.go deleted file mode 100644 index 9d51aec981..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/metric_options.go +++ /dev/null @@ -1,41 +0,0 @@ -package grpc_prometheus - -import ( - prom "github.com/prometheus/client_golang/prometheus" -) - -// A CounterOption lets you add options to Counter metrics using With* funcs. -type CounterOption func(*prom.CounterOpts) - -type counterOptions []CounterOption - -func (co counterOptions) apply(o prom.CounterOpts) prom.CounterOpts { - for _, f := range co { - f(&o) - } - return o -} - -// WithConstLabels allows you to add ConstLabels to Counter metrics. -func WithConstLabels(labels prom.Labels) CounterOption { - return func(o *prom.CounterOpts) { - o.ConstLabels = labels - } -} - -// A HistogramOption lets you add options to Histogram metrics using With* -// funcs. -type HistogramOption func(*prom.HistogramOpts) - -// WithHistogramBuckets allows you to specify custom bucket ranges for histograms if EnableHandlingTimeHistogram is on. -func WithHistogramBuckets(buckets []float64) HistogramOption { - return func(o *prom.HistogramOpts) { o.Buckets = buckets } -} - -// WithHistogramConstLabels allows you to add custom ConstLabels to -// histograms metrics. -func WithHistogramConstLabels(labels prom.Labels) HistogramOption { - return func(o *prom.HistogramOpts) { - o.ConstLabels = labels - } -} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server.go deleted file mode 100644 index 322f99046f..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016 Michal Witkowski. All Rights Reserved. -// See LICENSE for licensing terms. - -// gRPC Prometheus monitoring interceptors for server-side gRPC. - -package grpc_prometheus - -import ( - prom "github.com/prometheus/client_golang/prometheus" - "google.golang.org/grpc" -) - -var ( - // DefaultServerMetrics is the default instance of ServerMetrics. It is - // intended to be used in conjunction the default Prometheus metrics - // registry. - DefaultServerMetrics = NewServerMetrics() - - // UnaryServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Unary RPCs. - UnaryServerInterceptor = DefaultServerMetrics.UnaryServerInterceptor() - - // StreamServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Streaming RPCs. - StreamServerInterceptor = DefaultServerMetrics.StreamServerInterceptor() -) - -func init() { - prom.MustRegister(DefaultServerMetrics.serverStartedCounter) - prom.MustRegister(DefaultServerMetrics.serverHandledCounter) - prom.MustRegister(DefaultServerMetrics.serverStreamMsgReceived) - prom.MustRegister(DefaultServerMetrics.serverStreamMsgSent) -} - -// Register takes a gRPC server and pre-initializes all counters to 0. This -// allows for easier monitoring in Prometheus (no missing metrics), and should -// be called *after* all services have been registered with the server. This -// function acts on the DefaultServerMetrics variable. -func Register(server *grpc.Server) { - DefaultServerMetrics.InitializeMetrics(server) -} - -// EnableHandlingTimeHistogram turns on recording of handling time -// of RPCs. Histogram metrics can be very expensive for Prometheus -// to retain and query. This function acts on the DefaultServerMetrics -// variable and the default Prometheus metrics registry. -func EnableHandlingTimeHistogram(opts ...HistogramOption) { - DefaultServerMetrics.EnableHandlingTimeHistogram(opts...) - prom.Register(DefaultServerMetrics.serverHandledHistogram) -} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_metrics.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_metrics.go deleted file mode 100644 index 5b1467e7aa..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_metrics.go +++ /dev/null @@ -1,185 +0,0 @@ -package grpc_prometheus - -import ( - prom "github.com/prometheus/client_golang/prometheus" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/status" -) - -// ServerMetrics represents a collection of metrics to be registered on a -// Prometheus metrics registry for a gRPC server. -type ServerMetrics struct { - serverStartedCounter *prom.CounterVec - serverHandledCounter *prom.CounterVec - serverStreamMsgReceived *prom.CounterVec - serverStreamMsgSent *prom.CounterVec - serverHandledHistogramEnabled bool - serverHandledHistogramOpts prom.HistogramOpts - serverHandledHistogram *prom.HistogramVec -} - -// NewServerMetrics returns a ServerMetrics object. Use a new instance of -// ServerMetrics when not using the default Prometheus metrics registry, for -// example when wanting to control which metrics are added to a registry as -// opposed to automatically adding metrics via init functions. -func NewServerMetrics(counterOpts ...CounterOption) *ServerMetrics { - opts := counterOptions(counterOpts) - return &ServerMetrics{ - serverStartedCounter: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_server_started_total", - Help: "Total number of RPCs started on the server.", - }), []string{"grpc_type", "grpc_service", "grpc_method"}), - serverHandledCounter: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_server_handled_total", - Help: "Total number of RPCs completed on the server, regardless of success or failure.", - }), []string{"grpc_type", "grpc_service", "grpc_method", "grpc_code"}), - serverStreamMsgReceived: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_server_msg_received_total", - Help: "Total number of RPC stream messages received on the server.", - }), []string{"grpc_type", "grpc_service", "grpc_method"}), - serverStreamMsgSent: prom.NewCounterVec( - opts.apply(prom.CounterOpts{ - Name: "grpc_server_msg_sent_total", - Help: "Total number of gRPC stream messages sent by the server.", - }), []string{"grpc_type", "grpc_service", "grpc_method"}), - serverHandledHistogramEnabled: false, - serverHandledHistogramOpts: prom.HistogramOpts{ - Name: "grpc_server_handling_seconds", - Help: "Histogram of response latency (seconds) of gRPC that had been application-level handled by the server.", - Buckets: prom.DefBuckets, - }, - serverHandledHistogram: nil, - } -} - -// EnableHandlingTimeHistogram enables histograms being registered when -// registering the ServerMetrics on a Prometheus registry. Histograms can be -// expensive on Prometheus servers. It takes options to configure histogram -// options such as the defined buckets. -func (m *ServerMetrics) EnableHandlingTimeHistogram(opts ...HistogramOption) { - for _, o := range opts { - o(&m.serverHandledHistogramOpts) - } - if !m.serverHandledHistogramEnabled { - m.serverHandledHistogram = prom.NewHistogramVec( - m.serverHandledHistogramOpts, - []string{"grpc_type", "grpc_service", "grpc_method"}, - ) - } - m.serverHandledHistogramEnabled = true -} - -// Describe sends the super-set of all possible descriptors of metrics -// collected by this Collector to the provided channel and returns once -// the last descriptor has been sent. -func (m *ServerMetrics) Describe(ch chan<- *prom.Desc) { - m.serverStartedCounter.Describe(ch) - m.serverHandledCounter.Describe(ch) - m.serverStreamMsgReceived.Describe(ch) - m.serverStreamMsgSent.Describe(ch) - if m.serverHandledHistogramEnabled { - m.serverHandledHistogram.Describe(ch) - } -} - -// Collect is called by the Prometheus registry when collecting -// metrics. The implementation sends each collected metric via the -// provided channel and returns once the last metric has been sent. -func (m *ServerMetrics) Collect(ch chan<- prom.Metric) { - m.serverStartedCounter.Collect(ch) - m.serverHandledCounter.Collect(ch) - m.serverStreamMsgReceived.Collect(ch) - m.serverStreamMsgSent.Collect(ch) - if m.serverHandledHistogramEnabled { - m.serverHandledHistogram.Collect(ch) - } -} - -// UnaryServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Unary RPCs. -func (m *ServerMetrics) UnaryServerInterceptor() func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) { - monitor := newServerReporter(m, Unary, info.FullMethod) - monitor.ReceivedMessage() - resp, err := handler(ctx, req) - st, _ := status.FromError(err) - monitor.Handled(st.Code()) - if err == nil { - monitor.SentMessage() - } - return resp, err - } -} - -// StreamServerInterceptor is a gRPC server-side interceptor that provides Prometheus monitoring for Streaming RPCs. -func (m *ServerMetrics) StreamServerInterceptor() func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - return func(srv interface{}, ss grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error { - monitor := newServerReporter(m, streamRPCType(info), info.FullMethod) - err := handler(srv, &monitoredServerStream{ss, monitor}) - st, _ := status.FromError(err) - monitor.Handled(st.Code()) - return err - } -} - -// InitializeMetrics initializes all metrics, with their appropriate null -// value, for all gRPC methods registered on a gRPC server. This is useful, to -// ensure that all metrics exist when collecting and querying. -func (m *ServerMetrics) InitializeMetrics(server *grpc.Server) { - serviceInfo := server.GetServiceInfo() - for serviceName, info := range serviceInfo { - for _, mInfo := range info.Methods { - preRegisterMethod(m, serviceName, &mInfo) - } - } -} - -func streamRPCType(info *grpc.StreamServerInfo) grpcType { - if info.IsClientStream && !info.IsServerStream { - return ClientStream - } else if !info.IsClientStream && info.IsServerStream { - return ServerStream - } - return BidiStream -} - -// monitoredStream wraps grpc.ServerStream allowing each Sent/Recv of message to increment counters. -type monitoredServerStream struct { - grpc.ServerStream - monitor *serverReporter -} - -func (s *monitoredServerStream) SendMsg(m interface{}) error { - err := s.ServerStream.SendMsg(m) - if err == nil { - s.monitor.SentMessage() - } - return err -} - -func (s *monitoredServerStream) RecvMsg(m interface{}) error { - err := s.ServerStream.RecvMsg(m) - if err == nil { - s.monitor.ReceivedMessage() - } - return err -} - -// preRegisterMethod is invoked on Register of a Server, allowing all gRPC services labels to be pre-populated. -func preRegisterMethod(metrics *ServerMetrics, serviceName string, mInfo *grpc.MethodInfo) { - methodName := mInfo.Name - methodType := string(typeFromMethodInfo(mInfo)) - // These are just references (no increments), as just referencing will create the labels but not set values. - metrics.serverStartedCounter.GetMetricWithLabelValues(methodType, serviceName, methodName) - metrics.serverStreamMsgReceived.GetMetricWithLabelValues(methodType, serviceName, methodName) - metrics.serverStreamMsgSent.GetMetricWithLabelValues(methodType, serviceName, methodName) - if metrics.serverHandledHistogramEnabled { - metrics.serverHandledHistogram.GetMetricWithLabelValues(methodType, serviceName, methodName) - } - for _, code := range allCodes { - metrics.serverHandledCounter.GetMetricWithLabelValues(methodType, serviceName, methodName, code.String()) - } -} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_reporter.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_reporter.go deleted file mode 100644 index aa9db5401a..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/server_reporter.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016 Michal Witkowski. All Rights Reserved. -// See LICENSE for licensing terms. - -package grpc_prometheus - -import ( - "time" - - "google.golang.org/grpc/codes" -) - -type serverReporter struct { - metrics *ServerMetrics - rpcType grpcType - serviceName string - methodName string - startTime time.Time -} - -func newServerReporter(m *ServerMetrics, rpcType grpcType, fullMethod string) *serverReporter { - r := &serverReporter{ - metrics: m, - rpcType: rpcType, - } - if r.metrics.serverHandledHistogramEnabled { - r.startTime = time.Now() - } - r.serviceName, r.methodName = splitMethodName(fullMethod) - r.metrics.serverStartedCounter.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Inc() - return r -} - -func (r *serverReporter) ReceivedMessage() { - r.metrics.serverStreamMsgReceived.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Inc() -} - -func (r *serverReporter) SentMessage() { - r.metrics.serverStreamMsgSent.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Inc() -} - -func (r *serverReporter) Handled(code codes.Code) { - r.metrics.serverHandledCounter.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName, code.String()).Inc() - if r.metrics.serverHandledHistogramEnabled { - r.metrics.serverHandledHistogram.WithLabelValues(string(r.rpcType), r.serviceName, r.methodName).Observe(time.Since(r.startTime).Seconds()) - } -} diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/util.go b/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/util.go deleted file mode 100644 index 7987de35f4..0000000000 --- a/vendor/github.com/grpc-ecosystem/go-grpc-prometheus/util.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2016 Michal Witkowski. All Rights Reserved. -// See LICENSE for licensing terms. - -package grpc_prometheus - -import ( - "strings" - - "google.golang.org/grpc" - "google.golang.org/grpc/codes" -) - -type grpcType string - -const ( - Unary grpcType = "unary" - ClientStream grpcType = "client_stream" - ServerStream grpcType = "server_stream" - BidiStream grpcType = "bidi_stream" -) - -var ( - allCodes = []codes.Code{ - codes.OK, codes.Canceled, codes.Unknown, codes.InvalidArgument, codes.DeadlineExceeded, codes.NotFound, - codes.AlreadyExists, codes.PermissionDenied, codes.Unauthenticated, codes.ResourceExhausted, - codes.FailedPrecondition, codes.Aborted, codes.OutOfRange, codes.Unimplemented, codes.Internal, - codes.Unavailable, codes.DataLoss, - } -) - -func splitMethodName(fullMethodName string) (string, string) { - fullMethodName = strings.TrimPrefix(fullMethodName, "/") // remove leading slash - if i := strings.Index(fullMethodName, "/"); i >= 0 { - return fullMethodName[:i], fullMethodName[i+1:] - } - return "unknown", "unknown" -} - -func typeFromMethodInfo(mInfo *grpc.MethodInfo) grpcType { - if !mInfo.IsClientStream && !mInfo.IsServerStream { - return Unary - } - if mInfo.IsClientStream && !mInfo.IsServerStream { - return ClientStream - } - if !mInfo.IsClientStream && mInfo.IsServerStream { - return ServerStream - } - return BidiStream -} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.pb.go index 3a34e664e0..5121dce386 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.pb.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.pb.go @@ -3476,6 +3476,9 @@ type JSONSchema_FieldConfiguration struct { // parameter. Use this to avoid having auto generated path parameter names // for overlapping paths. PathParamName string `protobuf:"bytes,47,opt,name=path_param_name,json=pathParamName,proto3" json:"path_param_name,omitempty"` + // Declares this field to be deprecated. Allows for the generated OpenAPI + // parameter to be marked as deprecated without affecting the proto field. + Deprecated bool `protobuf:"varint,49,opt,name=deprecated,proto3" json:"deprecated,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -3512,10 +3515,21 @@ func (x *JSONSchema_FieldConfiguration) GetPathParamName() string { return "" } +func (x *JSONSchema_FieldConfiguration) GetDeprecated() bool { + if x != nil { + return x.Deprecated + } + return false +} + func (x *JSONSchema_FieldConfiguration) SetPathParamName(v string) { x.PathParamName = v } +func (x *JSONSchema_FieldConfiguration) SetDeprecated(v bool) { + x.Deprecated = v +} + type JSONSchema_FieldConfiguration_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. @@ -3524,6 +3538,9 @@ type JSONSchema_FieldConfiguration_builder struct { // parameter. Use this to avoid having auto generated path parameter names // for overlapping paths. PathParamName string + // Declares this field to be deprecated. Allows for the generated OpenAPI + // parameter to be marked as deprecated without affecting the proto field. + Deprecated bool } func (b0 JSONSchema_FieldConfiguration_builder) Build() *JSONSchema_FieldConfiguration { @@ -3531,6 +3548,7 @@ func (b0 JSONSchema_FieldConfiguration_builder) Build() *JSONSchema_FieldConfigu b, x := &b0, m0 _, _ = b, x x.PathParamName = b.PathParamName + x.Deprecated = b.Deprecated return m0 } @@ -3904,7 +3922,7 @@ var file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc = []byte{ 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd7, + 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf7, 0x0a, 0x0a, 0x0a, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, @@ -3968,11 +3986,13 @@ var file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc = []byte{ 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3c, 0x0a, 0x12, + 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x5c, 0x0a, 0x12, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x74, - 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, + 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x31, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto index 5313f0818a..444a5687a5 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2.proto @@ -612,6 +612,9 @@ message JSONSchema { // parameter. Use this to avoid having auto generated path parameter names // for overlapping paths. string path_param_name = 47; + // Declares this field to be deprecated. Allows for the generated OpenAPI + // parameter to be marked as deprecated without affecting the proto field. + bool deprecated = 49; } // Custom properties that start with "x-" such as "x-foo" used to describe // extra functionality that is not covered by the standard OpenAPI Specification. diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2_protoopaque.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2_protoopaque.pb.go index 1f0e0c2691..5316ed6192 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2_protoopaque.pb.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options/openapiv2_protoopaque.pb.go @@ -3268,6 +3268,7 @@ func (b0 Scopes_builder) Build() *Scopes { type JSONSchema_FieldConfiguration struct { state protoimpl.MessageState `protogen:"opaque.v1"` xxx_hidden_PathParamName string `protobuf:"bytes,47,opt,name=path_param_name,json=pathParamName,proto3" json:"path_param_name,omitempty"` + xxx_hidden_Deprecated bool `protobuf:"varint,49,opt,name=deprecated,proto3" json:"deprecated,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -3304,10 +3305,21 @@ func (x *JSONSchema_FieldConfiguration) GetPathParamName() string { return "" } +func (x *JSONSchema_FieldConfiguration) GetDeprecated() bool { + if x != nil { + return x.xxx_hidden_Deprecated + } + return false +} + func (x *JSONSchema_FieldConfiguration) SetPathParamName(v string) { x.xxx_hidden_PathParamName = v } +func (x *JSONSchema_FieldConfiguration) SetDeprecated(v bool) { + x.xxx_hidden_Deprecated = v +} + type JSONSchema_FieldConfiguration_builder struct { _ [0]func() // Prevents comparability and use of unkeyed literals for the builder. @@ -3316,6 +3328,9 @@ type JSONSchema_FieldConfiguration_builder struct { // parameter. Use this to avoid having auto generated path parameter names // for overlapping paths. PathParamName string + // Declares this field to be deprecated. Allows for the generated OpenAPI + // parameter to be marked as deprecated without affecting the proto field. + Deprecated bool } func (b0 JSONSchema_FieldConfiguration_builder) Build() *JSONSchema_FieldConfiguration { @@ -3323,6 +3338,7 @@ func (b0 JSONSchema_FieldConfiguration_builder) Build() *JSONSchema_FieldConfigu b, x := &b0, m0 _, _ = b, x x.xxx_hidden_PathParamName = b.PathParamName + x.xxx_hidden_Deprecated = b.Deprecated return m0 } @@ -3696,7 +3712,7 @@ var file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc = []byte{ 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x56, 0x61, - 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd7, + 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf7, 0x0a, 0x0a, 0x0a, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x65, 0x66, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x65, 0x66, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, @@ -3760,11 +3776,13 @@ var file_protoc_gen_openapiv2_options_openapiv2_proto_rawDesc = []byte{ 0x67, 0x65, 0x6e, 0x5f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x3c, 0x0a, 0x12, + 0x52, 0x0a, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x5c, 0x0a, 0x12, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x2f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x61, 0x74, - 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, + 0x68, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, + 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x31, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, + 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x1a, 0x55, 0x0a, 0x0f, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel index a65d88eb86..04b4bebf3d 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel @@ -27,6 +27,7 @@ go_library( "//internal/httprule", "//utilities", "@org_golang_google_genproto_googleapis_api//httpbody", + "@org_golang_google_grpc//:grpc", "@org_golang_google_grpc//codes", "@org_golang_google_grpc//grpclog", "@org_golang_google_grpc//health/grpc_health_v1", diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go index 2f2b342431..00b2228a1d 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go @@ -201,13 +201,13 @@ func annotateContext(ctx context.Context, mux *ServeMux, req *http.Request, rpcM if timeout != 0 { ctx, _ = context.WithTimeout(ctx, timeout) } - if len(pairs) == 0 { - return ctx, nil, nil - } md := metadata.Pairs(pairs...) for _, mda := range mux.metadataAnnotators { md = metadata.Join(md, mda(ctx, req)) } + if len(md) == 0 { + return ctx, nil, nil + } return ctx, md, nil } diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go index 8376d1e0ef..3d07063007 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go @@ -66,7 +66,7 @@ func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { var ( // protoMessageType is stored to prevent constant lookup of the same type at runtime. - protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem() + protoMessageType = reflect.TypeFor[proto.Message]() ) // marshalNonProto marshals a non-message field of a protobuf message. @@ -325,9 +325,9 @@ type protoEnum interface { EnumDescriptor() ([]byte, []int) } -var typeProtoEnum = reflect.TypeOf((*protoEnum)(nil)).Elem() +var typeProtoEnum = reflect.TypeFor[protoEnum]() -var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem() +var typeProtoMessage = reflect.TypeFor[proto.Message]() // Delimiter for newline encoded JSON streams. func (j *JSONPb) Delimiter() []byte { diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go index 19255ec441..3eb1616717 100644 --- a/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule" + "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/health/grpc_health_v1" @@ -281,12 +282,19 @@ func WithHealthEndpointAt(healthCheckClient grpc_health_v1.HealthClient, endpoin http.MethodGet, endpointPath, func(w http.ResponseWriter, r *http.Request, _ map[string]string, ) { _, outboundMarshaler := MarshalerForRequest(s, r) + annotatedContext, err := AnnotateContext(r.Context(), s, r, grpc_health_v1.Health_Check_FullMethodName, WithHTTPPathPattern(endpointPath)) + if err != nil { + s.errorHandler(r.Context(), s, outboundMarshaler, w, r, err) + return + } - resp, err := healthCheckClient.Check(r.Context(), &grpc_health_v1.HealthCheckRequest{ + var md ServerMetadata + resp, err := healthCheckClient.Check(annotatedContext, &grpc_health_v1.HealthCheckRequest{ Service: r.URL.Query().Get("service"), - }) + }, grpc.Header(&md.HeaderMD), grpc.Trailer(&md.TrailerMD)) + annotatedContext = NewServerMetadataContext(annotatedContext, md) if err != nil { - s.errorHandler(r.Context(), s, outboundMarshaler, w, r, err) + s.errorHandler(annotatedContext, s, outboundMarshaler, w, r, err) return } @@ -300,7 +308,7 @@ func WithHealthEndpointAt(healthCheckClient grpc_health_v1.HealthClient, endpoin err = status.Error(codes.NotFound, resp.String()) } - s.errorHandler(r.Context(), s, outboundMarshaler, w, r, err) + s.errorHandler(annotatedContext, s, outboundMarshaler, w, r, err) return } diff --git a/vendor/github.com/moby/spdystream/NOTICE b/vendor/github.com/moby/spdystream/NOTICE index b9b11c9ab7..24e2e2aa32 100644 --- a/vendor/github.com/moby/spdystream/NOTICE +++ b/vendor/github.com/moby/spdystream/NOTICE @@ -3,3 +3,15 @@ Copyright 2014-2021 Docker Inc. This product includes software developed at Docker Inc. (https://www.docker.com/). + +SPDY implementation (spdy/) + +The spdy directory contains code derived from the Go project (golang.org/x/net). + +Copyright 2009-2013 The Go Authors. +Licensed under the BSD 3-Clause License. + +Modifications Copyright 2014-2021 Docker Inc. + +The BSD license text and Go patent grant are included in +spdy/LICENSE and spdy/PATENTS. diff --git a/vendor/github.com/moby/spdystream/connection.go b/vendor/github.com/moby/spdystream/connection.go index 1394d0ad4c..69ce4777ea 100644 --- a/vendor/github.com/moby/spdystream/connection.go +++ b/vendor/github.com/moby/spdystream/connection.go @@ -224,7 +224,13 @@ type Connection struct { // NewConnection creates a new spdy connection from an existing // network connection. func NewConnection(conn net.Conn, server bool) (*Connection, error) { - framer, framerErr := spdy.NewFramer(conn, conn) + return NewConnectionWithOptions(conn, server) +} + +// NewConnectionWithOptions creates a new spdy connection and applies frame +// parsing limits via options. +func NewConnectionWithOptions(conn net.Conn, server bool, opts ...spdy.FramerOption) (*Connection, error) { + framer, framerErr := spdy.NewFramerWithOptions(conn, conn, opts...) if framerErr != nil { return nil, framerErr } @@ -350,6 +356,9 @@ Loop: } else { debugMessage("(%p) EOF received", s) } + if spdyErr, ok := err.(*spdy.Error); ok && spdyErr.Err == spdy.InvalidControlFrame { + _ = s.conn.Close() + } break } var priority uint8 diff --git a/vendor/github.com/mxk/go-flowrate/LICENSE b/vendor/github.com/moby/spdystream/spdy/LICENSE similarity index 59% rename from vendor/github.com/mxk/go-flowrate/LICENSE rename to vendor/github.com/moby/spdystream/spdy/LICENSE index e9f9f628ba..6a66aea5ea 100644 --- a/vendor/github.com/mxk/go-flowrate/LICENSE +++ b/vendor/github.com/moby/spdystream/spdy/LICENSE @@ -1,20 +1,18 @@ -Copyright (c) 2014 The Go-FlowRate Authors. All rights reserved. +Copyright (c) 2009 The Go Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the - distribution. - - * Neither the name of the go-flowrate project nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT diff --git a/vendor/github.com/moby/spdystream/spdy/PATENTS b/vendor/github.com/moby/spdystream/spdy/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/github.com/moby/spdystream/spdy/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/github.com/moby/spdystream/spdy/dictionary.go b/vendor/github.com/moby/spdystream/spdy/dictionary.go index 392232f174..5a5ff0e14c 100644 --- a/vendor/github.com/moby/spdystream/spdy/dictionary.go +++ b/vendor/github.com/moby/spdystream/spdy/dictionary.go @@ -1,19 +1,3 @@ -/* - Copyright 2014-2021 Docker Inc. - - 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. -*/ - // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. diff --git a/vendor/github.com/moby/spdystream/spdy/options.go b/vendor/github.com/moby/spdystream/spdy/options.go new file mode 100644 index 0000000000..ec03e0b9a9 --- /dev/null +++ b/vendor/github.com/moby/spdystream/spdy/options.go @@ -0,0 +1,25 @@ +package spdy + +// FramerOption allows callers to customize frame parsing limits. +type FramerOption func(*Framer) + +// WithMaxControlFramePayloadSize sets the control-frame payload limit. +func WithMaxControlFramePayloadSize(size uint32) FramerOption { + return func(f *Framer) { + f.maxFrameLength = size + } +} + +// WithMaxHeaderFieldSize sets the per-header name/value size limit. +func WithMaxHeaderFieldSize(size uint32) FramerOption { + return func(f *Framer) { + f.maxHeaderFieldSize = size + } +} + +// WithMaxHeaderCount sets the maximum number of headers in a frame. +func WithMaxHeaderCount(count uint32) FramerOption { + return func(f *Framer) { + f.maxHeaderCount = count + } +} diff --git a/vendor/github.com/moby/spdystream/spdy/read.go b/vendor/github.com/moby/spdystream/spdy/read.go index 75ea045b8e..2abb69433d 100644 --- a/vendor/github.com/moby/spdystream/spdy/read.go +++ b/vendor/github.com/moby/spdystream/spdy/read.go @@ -1,19 +1,3 @@ -/* - Copyright 2014-2021 Docker Inc. - - 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. -*/ - // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -24,6 +8,7 @@ import ( "compress/zlib" "encoding/binary" "io" + "io/ioutil" "net/http" "strings" ) @@ -59,6 +44,11 @@ func (frame *SettingsFrame) read(h ControlFrameHeader, f *Framer) error { if err := binary.Read(f.r, binary.BigEndian, &numSettings); err != nil { return err } + // Each setting is 8 bytes (4-byte id + 4-byte value). + // Payload is 4 bytes for numSettings + numSettings*8. + if h.length < 4 || numSettings > (h.length-4)/8 { + return &Error{InvalidControlFrame, 0} + } frame.FlagIdValues = make([]SettingsFlagIdValue, numSettings) for i := uint32(0); i < numSettings; i++ { if err := binary.Read(f.r, binary.BigEndian, &frame.FlagIdValues[i].Id); err != nil { @@ -177,8 +167,19 @@ func (f *Framer) parseControlFrame(version uint16, frameType ControlFrameType) ( if err := binary.Read(f.r, binary.BigEndian, &length); err != nil { return nil, err } + maxControlFramePayload := uint32(MaxDataLength) + if f.maxFrameLength > 0 { + maxControlFramePayload = f.maxFrameLength + } + flags := ControlFlags((length & 0xff000000) >> 24) length &= 0xffffff + if length > maxControlFramePayload { + if _, err := io.CopyN(ioutil.Discard, f.r, int64(length)); err != nil { + return nil, err + } + return nil, &Error{InvalidControlFrame, 0} + } header := ControlFrameHeader{version, frameType, flags, length} cframe, err := newControlFrame(frameType) if err != nil { @@ -190,11 +191,22 @@ func (f *Framer) parseControlFrame(version uint16, frameType ControlFrameType) ( return cframe, nil } -func parseHeaderValueBlock(r io.Reader, streamId StreamId) (http.Header, error) { +func (f *Framer) parseHeaderValueBlock(r io.Reader, streamId StreamId) (http.Header, error) { var numHeaders uint32 if err := binary.Read(r, binary.BigEndian, &numHeaders); err != nil { return nil, err } + maxHeaders := defaultMaxHeaderCount + if f.maxHeaderCount > 0 { + maxHeaders = f.maxHeaderCount + } + if numHeaders > maxHeaders { + return nil, &Error{InvalidControlFrame, streamId} + } + maxFieldSize := defaultMaxHeaderFieldSize + if f.maxHeaderFieldSize > 0 { + maxFieldSize = f.maxHeaderFieldSize + } var e error h := make(http.Header, int(numHeaders)) for i := 0; i < int(numHeaders); i++ { @@ -202,6 +214,9 @@ func parseHeaderValueBlock(r io.Reader, streamId StreamId) (http.Header, error) if err := binary.Read(r, binary.BigEndian, &length); err != nil { return nil, err } + if length > maxFieldSize { + return nil, &Error{InvalidControlFrame, streamId} + } nameBytes := make([]byte, length) if _, err := io.ReadFull(r, nameBytes); err != nil { return nil, err @@ -217,6 +232,9 @@ func parseHeaderValueBlock(r io.Reader, streamId StreamId) (http.Header, error) if err := binary.Read(r, binary.BigEndian, &length); err != nil { return nil, err } + if length > maxFieldSize { + return nil, &Error{InvalidControlFrame, streamId} + } value := make([]byte, length) if _, err := io.ReadFull(r, value); err != nil { return nil, err @@ -256,7 +274,7 @@ func (f *Framer) readSynStreamFrame(h ControlFrameHeader, frame *SynStreamFrame) } reader = f.headerDecompressor } - frame.Headers, err = parseHeaderValueBlock(reader, frame.StreamId) + frame.Headers, err = f.parseHeaderValueBlock(reader, frame.StreamId) if !f.headerCompressionDisabled && (err == io.EOF && f.headerReader.N == 0 || f.headerReader.N != 0) { err = &Error{WrongCompressedPayloadSize, 0} } @@ -288,7 +306,7 @@ func (f *Framer) readSynReplyFrame(h ControlFrameHeader, frame *SynReplyFrame) e } reader = f.headerDecompressor } - frame.Headers, err = parseHeaderValueBlock(reader, frame.StreamId) + frame.Headers, err = f.parseHeaderValueBlock(reader, frame.StreamId) if !f.headerCompressionDisabled && (err == io.EOF && f.headerReader.N == 0 || f.headerReader.N != 0) { err = &Error{WrongCompressedPayloadSize, 0} } @@ -320,7 +338,7 @@ func (f *Framer) readHeadersFrame(h ControlFrameHeader, frame *HeadersFrame) err } reader = f.headerDecompressor } - frame.Headers, err = parseHeaderValueBlock(reader, frame.StreamId) + frame.Headers, err = f.parseHeaderValueBlock(reader, frame.StreamId) if !f.headerCompressionDisabled && (err == io.EOF && f.headerReader.N == 0 || f.headerReader.N != 0) { err = &Error{WrongCompressedPayloadSize, 0} } diff --git a/vendor/github.com/moby/spdystream/spdy/types.go b/vendor/github.com/moby/spdystream/spdy/types.go index a254a43ab9..a5528618ca 100644 --- a/vendor/github.com/moby/spdystream/spdy/types.go +++ b/vendor/github.com/moby/spdystream/spdy/types.go @@ -1,23 +1,9 @@ -/* - Copyright 2014-2021 Docker Inc. - - 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. -*/ - // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// Modifications Copyright 2014-2021 Docker Inc. + // Package spdy implements the SPDY protocol (currently SPDY/3), described in // http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3. package spdy @@ -63,8 +49,20 @@ const ( ) // MaxDataLength is the maximum number of bytes that can be stored in one frame. +// +// SPDY frame headers encode the payload length using a 24-bit field, +// so the maximum representable size for both data and control frames +// is 2^24-1 bytes. +// +// See the SPDY/3 specification, "Frame Format": +// https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1/ const MaxDataLength = 1<<24 - 1 +const ( + defaultMaxHeaderFieldSize uint32 = 1 << 20 + defaultMaxHeaderCount uint32 = 1000 +) + // headerValueSepator separates multiple header values. const headerValueSeparator = "\x00" @@ -269,6 +267,10 @@ type Framer struct { r io.Reader headerReader io.LimitedReader headerDecompressor io.ReadCloser + + maxFrameLength uint32 // overrides the default frame payload length limit. + maxHeaderFieldSize uint32 // overrides the default per-header name/value length limit. + maxHeaderCount uint32 // overrides the default header count limit. } // NewFramer allocates a new Framer for a given SPDY connection, represented by @@ -276,6 +278,16 @@ type Framer struct { // from/to the Reader and Writer, so the caller should pass in an appropriately // buffered implementation to optimize performance. func NewFramer(w io.Writer, r io.Reader) (*Framer, error) { + return newFramer(w, r) +} + +// NewFramerWithOptions allocates a new Framer for a given SPDY connection and +// applies frame parsing limits via options. +func NewFramerWithOptions(w io.Writer, r io.Reader, opts ...FramerOption) (*Framer, error) { + return newFramer(w, r, opts...) +} + +func newFramer(w io.Writer, r io.Reader, opts ...FramerOption) (*Framer, error) { compressBuf := new(bytes.Buffer) compressor, err := zlib.NewWriterLevelDict(compressBuf, zlib.BestCompression, []byte(headerDictionary)) if err != nil { @@ -287,5 +299,10 @@ func NewFramer(w io.Writer, r io.Reader) (*Framer, error) { headerCompressor: compressor, r: r, } + for _, opt := range opts { + if opt != nil { + opt(framer) + } + } return framer, nil } diff --git a/vendor/github.com/moby/spdystream/spdy/write.go b/vendor/github.com/moby/spdystream/spdy/write.go index ab6d91f3b8..75084d35d9 100644 --- a/vendor/github.com/moby/spdystream/spdy/write.go +++ b/vendor/github.com/moby/spdystream/spdy/write.go @@ -1,19 +1,3 @@ -/* - Copyright 2014-2021 Docker Inc. - - 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. -*/ - // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -23,6 +7,7 @@ package spdy import ( "encoding/binary" "io" + "math" "net/http" "strings" ) @@ -63,13 +48,21 @@ func (frame *RstStreamFrame) write(f *Framer) (err error) { func (frame *SettingsFrame) write(f *Framer) (err error) { frame.CFHeader.version = Version frame.CFHeader.frameType = TypeSettings - frame.CFHeader.length = uint32(len(frame.FlagIdValues)*8 + 4) + payloadLen := len(frame.FlagIdValues)*8 + 4 + if payloadLen > MaxDataLength { + return &Error{InvalidControlFrame, 0} + } + frame.CFHeader.length = uint32(payloadLen) // Serialize frame to Writer. if err = writeControlFrameHeader(f.w, frame.CFHeader); err != nil { return } - if err = binary.Write(f.w, binary.BigEndian, uint32(len(frame.FlagIdValues))); err != nil { + n := len(frame.FlagIdValues) + if uint64(n) > math.MaxUint32 { + return &Error{InvalidControlFrame, 0} + } + if err = binary.Write(f.w, binary.BigEndian, uint32(n)); err != nil { return } for _, flagIdValue := range frame.FlagIdValues { @@ -170,29 +163,41 @@ func writeControlFrameHeader(w io.Writer, h ControlFrameHeader) error { func writeHeaderValueBlock(w io.Writer, h http.Header) (n int, err error) { n = 0 - if err = binary.Write(w, binary.BigEndian, uint32(len(h))); err != nil { + numHeaders := len(h) + if numHeaders > math.MaxInt32 { + return n, &Error{InvalidControlFrame, 0} + } + if err = binary.Write(w, binary.BigEndian, uint32(numHeaders)); err != nil { return } - n += 2 + n += 4 for name, values := range h { - if err = binary.Write(w, binary.BigEndian, uint32(len(name))); err != nil { + nameLen := len(name) + if nameLen > math.MaxInt32 { + return n, &Error{InvalidControlFrame, 0} + } + if err = binary.Write(w, binary.BigEndian, uint32(nameLen)); err != nil { return } - n += 2 + n += 4 name = strings.ToLower(name) if _, err = io.WriteString(w, name); err != nil { return } - n += len(name) + n += nameLen v := strings.Join(values, headerValueSeparator) - if err = binary.Write(w, binary.BigEndian, uint32(len(v))); err != nil { + vLen := len(v) + if vLen > math.MaxInt32 { + return n, &Error{InvalidControlFrame, 0} + } + if err = binary.Write(w, binary.BigEndian, uint32(vLen)); err != nil { return } - n += 2 + n += 4 if _, err = io.WriteString(w, v); err != nil { return } - n += len(v) + n += vLen } return } @@ -216,7 +221,11 @@ func (f *Framer) writeSynStreamFrame(frame *SynStreamFrame) (err error) { // Set ControlFrameHeader. frame.CFHeader.version = Version frame.CFHeader.frameType = TypeSynStream - frame.CFHeader.length = uint32(len(f.headerBuf.Bytes()) + 10) + hLen := len(f.headerBuf.Bytes()) + 10 + if hLen > MaxDataLength { + return &Error{InvalidControlFrame, 0} + } + frame.CFHeader.length = uint32(hLen) // Serialize frame to Writer. if err = writeControlFrameHeader(f.w, frame.CFHeader); err != nil { @@ -260,7 +269,11 @@ func (f *Framer) writeSynReplyFrame(frame *SynReplyFrame) (err error) { // Set ControlFrameHeader. frame.CFHeader.version = Version frame.CFHeader.frameType = TypeSynReply - frame.CFHeader.length = uint32(len(f.headerBuf.Bytes()) + 4) + hLen := len(f.headerBuf.Bytes()) + 4 + if hLen > MaxDataLength { + return &Error{InvalidControlFrame, 0} + } + frame.CFHeader.length = uint32(hLen) // Serialize frame to Writer. if err = writeControlFrameHeader(f.w, frame.CFHeader); err != nil { @@ -295,7 +308,11 @@ func (f *Framer) writeHeadersFrame(frame *HeadersFrame) (err error) { // Set ControlFrameHeader. frame.CFHeader.version = Version frame.CFHeader.frameType = TypeHeaders - frame.CFHeader.length = uint32(len(f.headerBuf.Bytes()) + 4) + hLen := len(f.headerBuf.Bytes()) + 4 + if hLen > MaxDataLength { + return &Error{InvalidControlFrame, 0} + } + frame.CFHeader.length = uint32(hLen) // Serialize frame to Writer. if err = writeControlFrameHeader(f.w, frame.CFHeader); err != nil { @@ -323,7 +340,11 @@ func (f *Framer) writeDataFrame(frame *DataFrame) (err error) { if err = binary.Write(f.w, binary.BigEndian, frame.StreamId); err != nil { return } - flagsAndLength := uint32(frame.Flags)<<24 | uint32(len(frame.Data)) + dLen := len(frame.Data) + if dLen > MaxDataLength { + return &Error{InvalidDataFrame, frame.StreamId} + } + flagsAndLength := uint32(frame.Flags)<<24 | uint32(dLen) if err = binary.Write(f.w, binary.BigEndian, flagsAndLength); err != nil { return } diff --git a/vendor/github.com/mxk/go-flowrate/flowrate/flowrate.go b/vendor/github.com/mxk/go-flowrate/flowrate/flowrate.go deleted file mode 100644 index 1b727721e1..0000000000 --- a/vendor/github.com/mxk/go-flowrate/flowrate/flowrate.go +++ /dev/null @@ -1,267 +0,0 @@ -// -// Written by Maxim Khitrov (November 2012) -// - -// Package flowrate provides the tools for monitoring and limiting the flow rate -// of an arbitrary data stream. -package flowrate - -import ( - "math" - "sync" - "time" -) - -// Monitor monitors and limits the transfer rate of a data stream. -type Monitor struct { - mu sync.Mutex // Mutex guarding access to all internal fields - active bool // Flag indicating an active transfer - start time.Duration // Transfer start time (clock() value) - bytes int64 // Total number of bytes transferred - samples int64 // Total number of samples taken - - rSample float64 // Most recent transfer rate sample (bytes per second) - rEMA float64 // Exponential moving average of rSample - rPeak float64 // Peak transfer rate (max of all rSamples) - rWindow float64 // rEMA window (seconds) - - sBytes int64 // Number of bytes transferred since sLast - sLast time.Duration // Most recent sample time (stop time when inactive) - sRate time.Duration // Sampling rate - - tBytes int64 // Number of bytes expected in the current transfer - tLast time.Duration // Time of the most recent transfer of at least 1 byte -} - -// New creates a new flow control monitor. Instantaneous transfer rate is -// measured and updated for each sampleRate interval. windowSize determines the -// weight of each sample in the exponential moving average (EMA) calculation. -// The exact formulas are: -// -// sampleTime = currentTime - prevSampleTime -// sampleRate = byteCount / sampleTime -// weight = 1 - exp(-sampleTime/windowSize) -// newRate = weight*sampleRate + (1-weight)*oldRate -// -// The default values for sampleRate and windowSize (if <= 0) are 100ms and 1s, -// respectively. -func New(sampleRate, windowSize time.Duration) *Monitor { - if sampleRate = clockRound(sampleRate); sampleRate <= 0 { - sampleRate = 5 * clockRate - } - if windowSize <= 0 { - windowSize = 1 * time.Second - } - now := clock() - return &Monitor{ - active: true, - start: now, - rWindow: windowSize.Seconds(), - sLast: now, - sRate: sampleRate, - tLast: now, - } -} - -// Update records the transfer of n bytes and returns n. It should be called -// after each Read/Write operation, even if n is 0. -func (m *Monitor) Update(n int) int { - m.mu.Lock() - m.update(n) - m.mu.Unlock() - return n -} - -// IO is a convenience method intended to wrap io.Reader and io.Writer method -// execution. It calls m.Update(n) and then returns (n, err) unmodified. -func (m *Monitor) IO(n int, err error) (int, error) { - return m.Update(n), err -} - -// Done marks the transfer as finished and prevents any further updates or -// limiting. Instantaneous and current transfer rates drop to 0. Update, IO, and -// Limit methods become NOOPs. It returns the total number of bytes transferred. -func (m *Monitor) Done() int64 { - m.mu.Lock() - if now := m.update(0); m.sBytes > 0 { - m.reset(now) - } - m.active = false - m.tLast = 0 - n := m.bytes - m.mu.Unlock() - return n -} - -// timeRemLimit is the maximum Status.TimeRem value. -const timeRemLimit = 999*time.Hour + 59*time.Minute + 59*time.Second - -// Status represents the current Monitor status. All transfer rates are in bytes -// per second rounded to the nearest byte. -type Status struct { - Active bool // Flag indicating an active transfer - Start time.Time // Transfer start time - Duration time.Duration // Time period covered by the statistics - Idle time.Duration // Time since the last transfer of at least 1 byte - Bytes int64 // Total number of bytes transferred - Samples int64 // Total number of samples taken - InstRate int64 // Instantaneous transfer rate - CurRate int64 // Current transfer rate (EMA of InstRate) - AvgRate int64 // Average transfer rate (Bytes / Duration) - PeakRate int64 // Maximum instantaneous transfer rate - BytesRem int64 // Number of bytes remaining in the transfer - TimeRem time.Duration // Estimated time to completion - Progress Percent // Overall transfer progress -} - -// Status returns current transfer status information. The returned value -// becomes static after a call to Done. -func (m *Monitor) Status() Status { - m.mu.Lock() - now := m.update(0) - s := Status{ - Active: m.active, - Start: clockToTime(m.start), - Duration: m.sLast - m.start, - Idle: now - m.tLast, - Bytes: m.bytes, - Samples: m.samples, - PeakRate: round(m.rPeak), - BytesRem: m.tBytes - m.bytes, - Progress: percentOf(float64(m.bytes), float64(m.tBytes)), - } - if s.BytesRem < 0 { - s.BytesRem = 0 - } - if s.Duration > 0 { - rAvg := float64(s.Bytes) / s.Duration.Seconds() - s.AvgRate = round(rAvg) - if s.Active { - s.InstRate = round(m.rSample) - s.CurRate = round(m.rEMA) - if s.BytesRem > 0 { - if tRate := 0.8*m.rEMA + 0.2*rAvg; tRate > 0 { - ns := float64(s.BytesRem) / tRate * 1e9 - if ns > float64(timeRemLimit) { - ns = float64(timeRemLimit) - } - s.TimeRem = clockRound(time.Duration(ns)) - } - } - } - } - m.mu.Unlock() - return s -} - -// Limit restricts the instantaneous (per-sample) data flow to rate bytes per -// second. It returns the maximum number of bytes (0 <= n <= want) that may be -// transferred immediately without exceeding the limit. If block == true, the -// call blocks until n > 0. want is returned unmodified if want < 1, rate < 1, -// or the transfer is inactive (after a call to Done). -// -// At least one byte is always allowed to be transferred in any given sampling -// period. Thus, if the sampling rate is 100ms, the lowest achievable flow rate -// is 10 bytes per second. -// -// For usage examples, see the implementation of Reader and Writer in io.go. -func (m *Monitor) Limit(want int, rate int64, block bool) (n int) { - if want < 1 || rate < 1 { - return want - } - m.mu.Lock() - - // Determine the maximum number of bytes that can be sent in one sample - limit := round(float64(rate) * m.sRate.Seconds()) - if limit <= 0 { - limit = 1 - } - - // If block == true, wait until m.sBytes < limit - if now := m.update(0); block { - for m.sBytes >= limit && m.active { - now = m.waitNextSample(now) - } - } - - // Make limit <= want (unlimited if the transfer is no longer active) - if limit -= m.sBytes; limit > int64(want) || !m.active { - limit = int64(want) - } - m.mu.Unlock() - - if limit < 0 { - limit = 0 - } - return int(limit) -} - -// SetTransferSize specifies the total size of the data transfer, which allows -// the Monitor to calculate the overall progress and time to completion. -func (m *Monitor) SetTransferSize(bytes int64) { - if bytes < 0 { - bytes = 0 - } - m.mu.Lock() - m.tBytes = bytes - m.mu.Unlock() -} - -// update accumulates the transferred byte count for the current sample until -// clock() - m.sLast >= m.sRate. The monitor status is updated once the current -// sample is done. -func (m *Monitor) update(n int) (now time.Duration) { - if !m.active { - return - } - if now = clock(); n > 0 { - m.tLast = now - } - m.sBytes += int64(n) - if sTime := now - m.sLast; sTime >= m.sRate { - t := sTime.Seconds() - if m.rSample = float64(m.sBytes) / t; m.rSample > m.rPeak { - m.rPeak = m.rSample - } - - // Exponential moving average using a method similar to *nix load - // average calculation. Longer sampling periods carry greater weight. - if m.samples > 0 { - w := math.Exp(-t / m.rWindow) - m.rEMA = m.rSample + w*(m.rEMA-m.rSample) - } else { - m.rEMA = m.rSample - } - m.reset(now) - } - return -} - -// reset clears the current sample state in preparation for the next sample. -func (m *Monitor) reset(sampleTime time.Duration) { - m.bytes += m.sBytes - m.samples++ - m.sBytes = 0 - m.sLast = sampleTime -} - -// waitNextSample sleeps for the remainder of the current sample. The lock is -// released and reacquired during the actual sleep period, so it's possible for -// the transfer to be inactive when this method returns. -func (m *Monitor) waitNextSample(now time.Duration) time.Duration { - const minWait = 5 * time.Millisecond - current := m.sLast - - // sleep until the last sample time changes (ideally, just one iteration) - for m.sLast == current && m.active { - d := current + m.sRate - now - m.mu.Unlock() - if d < minWait { - d = minWait - } - time.Sleep(d) - m.mu.Lock() - now = m.update(0) - } - return now -} diff --git a/vendor/github.com/mxk/go-flowrate/flowrate/io.go b/vendor/github.com/mxk/go-flowrate/flowrate/io.go deleted file mode 100644 index fbe0909725..0000000000 --- a/vendor/github.com/mxk/go-flowrate/flowrate/io.go +++ /dev/null @@ -1,133 +0,0 @@ -// -// Written by Maxim Khitrov (November 2012) -// - -package flowrate - -import ( - "errors" - "io" -) - -// ErrLimit is returned by the Writer when a non-blocking write is short due to -// the transfer rate limit. -var ErrLimit = errors.New("flowrate: flow rate limit exceeded") - -// Limiter is implemented by the Reader and Writer to provide a consistent -// interface for monitoring and controlling data transfer. -type Limiter interface { - Done() int64 - Status() Status - SetTransferSize(bytes int64) - SetLimit(new int64) (old int64) - SetBlocking(new bool) (old bool) -} - -// Reader implements io.ReadCloser with a restriction on the rate of data -// transfer. -type Reader struct { - io.Reader // Data source - *Monitor // Flow control monitor - - limit int64 // Rate limit in bytes per second (unlimited when <= 0) - block bool // What to do when no new bytes can be read due to the limit -} - -// NewReader restricts all Read operations on r to limit bytes per second. -func NewReader(r io.Reader, limit int64) *Reader { - return &Reader{r, New(0, 0), limit, true} -} - -// Read reads up to len(p) bytes into p without exceeding the current transfer -// rate limit. It returns (0, nil) immediately if r is non-blocking and no new -// bytes can be read at this time. -func (r *Reader) Read(p []byte) (n int, err error) { - p = p[:r.Limit(len(p), r.limit, r.block)] - if len(p) > 0 { - n, err = r.IO(r.Reader.Read(p)) - } - return -} - -// SetLimit changes the transfer rate limit to new bytes per second and returns -// the previous setting. -func (r *Reader) SetLimit(new int64) (old int64) { - old, r.limit = r.limit, new - return -} - -// SetBlocking changes the blocking behavior and returns the previous setting. A -// Read call on a non-blocking reader returns immediately if no additional bytes -// may be read at this time due to the rate limit. -func (r *Reader) SetBlocking(new bool) (old bool) { - old, r.block = r.block, new - return -} - -// Close closes the underlying reader if it implements the io.Closer interface. -func (r *Reader) Close() error { - defer r.Done() - if c, ok := r.Reader.(io.Closer); ok { - return c.Close() - } - return nil -} - -// Writer implements io.WriteCloser with a restriction on the rate of data -// transfer. -type Writer struct { - io.Writer // Data destination - *Monitor // Flow control monitor - - limit int64 // Rate limit in bytes per second (unlimited when <= 0) - block bool // What to do when no new bytes can be written due to the limit -} - -// NewWriter restricts all Write operations on w to limit bytes per second. The -// transfer rate and the default blocking behavior (true) can be changed -// directly on the returned *Writer. -func NewWriter(w io.Writer, limit int64) *Writer { - return &Writer{w, New(0, 0), limit, true} -} - -// Write writes len(p) bytes from p to the underlying data stream without -// exceeding the current transfer rate limit. It returns (n, ErrLimit) if w is -// non-blocking and no additional bytes can be written at this time. -func (w *Writer) Write(p []byte) (n int, err error) { - var c int - for len(p) > 0 && err == nil { - s := p[:w.Limit(len(p), w.limit, w.block)] - if len(s) > 0 { - c, err = w.IO(w.Writer.Write(s)) - } else { - return n, ErrLimit - } - p = p[c:] - n += c - } - return -} - -// SetLimit changes the transfer rate limit to new bytes per second and returns -// the previous setting. -func (w *Writer) SetLimit(new int64) (old int64) { - old, w.limit = w.limit, new - return -} - -// SetBlocking changes the blocking behavior and returns the previous setting. A -// Write call on a non-blocking writer returns as soon as no additional bytes -// may be written at this time due to the rate limit. -func (w *Writer) SetBlocking(new bool) (old bool) { - old, w.block = w.block, new - return -} - -// Close closes the underlying writer if it implements the io.Closer interface. -func (w *Writer) Close() error { - defer w.Done() - if c, ok := w.Writer.(io.Closer); ok { - return c.Close() - } - return nil -} diff --git a/vendor/github.com/mxk/go-flowrate/flowrate/util.go b/vendor/github.com/mxk/go-flowrate/flowrate/util.go deleted file mode 100644 index 4caac583fc..0000000000 --- a/vendor/github.com/mxk/go-flowrate/flowrate/util.go +++ /dev/null @@ -1,67 +0,0 @@ -// -// Written by Maxim Khitrov (November 2012) -// - -package flowrate - -import ( - "math" - "strconv" - "time" -) - -// clockRate is the resolution and precision of clock(). -const clockRate = 20 * time.Millisecond - -// czero is the process start time rounded down to the nearest clockRate -// increment. -var czero = time.Duration(time.Now().UnixNano()) / clockRate * clockRate - -// clock returns a low resolution timestamp relative to the process start time. -func clock() time.Duration { - return time.Duration(time.Now().UnixNano())/clockRate*clockRate - czero -} - -// clockToTime converts a clock() timestamp to an absolute time.Time value. -func clockToTime(c time.Duration) time.Time { - return time.Unix(0, int64(czero+c)) -} - -// clockRound returns d rounded to the nearest clockRate increment. -func clockRound(d time.Duration) time.Duration { - return (d + clockRate>>1) / clockRate * clockRate -} - -// round returns x rounded to the nearest int64 (non-negative values only). -func round(x float64) int64 { - if _, frac := math.Modf(x); frac >= 0.5 { - return int64(math.Ceil(x)) - } - return int64(math.Floor(x)) -} - -// Percent represents a percentage in increments of 1/1000th of a percent. -type Percent uint32 - -// percentOf calculates what percent of the total is x. -func percentOf(x, total float64) Percent { - if x < 0 || total <= 0 { - return 0 - } else if p := round(x / total * 1e5); p <= math.MaxUint32 { - return Percent(p) - } - return Percent(math.MaxUint32) -} - -func (p Percent) Float() float64 { - return float64(p) * 1e-3 -} - -func (p Percent) String() string { - var buf [12]byte - b := strconv.AppendUint(buf[:0], uint64(p)/1000, 10) - n := len(b) - b = strconv.AppendUint(b, 1000+uint64(p)%1000, 10) - b[n] = '.' - return string(append(b, '%')) -} diff --git a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md index 0921794114..70050f35d1 100644 --- a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md @@ -1,3 +1,41 @@ +## 2.28.1 + +Update all dependencies. This auto-updated the required version of Go to 1.24, consistent with the fact that Go 1.23 has been out of support for almost six months. + +## 2.28.0 + +Ginkgo's SemVer filter now supports filtering multiple components by SemVer version: + +```go +It("should work in a specific version range (1.0.0, 2.0.0) and third-party dependency redis in [8.0.0, ~)", SemVerConstraint(">= 3.2.0"), ComponentSemVerConstraint("redis", ">= 8.0.0") func() { + // This test will only run when version is between 1.0.0 (exclusive) and 2.0.0 (exclusive) and redis version is >= 8.0.0 +}) +``` + +can be filtered in or out with an invocation like: + +```bash +ginkgo --sem-ver-filter="2.1.1, redis=8.2.0" +``` + +Huge thanks to @Icarus9913 for working on this! + +## 2.27.5 + +### Fixes +Don't make a new formatter for each GinkgoT(); that's just silly and uses precious memory + +## 2.27.4 + +### Fixes +- CurrentTreeConstructionNodeReport: fix for nested container nodes [59bc751] + +## 2.27.3 + +### Fixes +report exit result in case of failure [1c9f356] +fix data race [ece19c8] + ## 2.27.2 ### Fixes diff --git a/vendor/github.com/onsi/ginkgo/v2/README.md b/vendor/github.com/onsi/ginkgo/v2/README.md index 7b7ab9e39c..b4c3ce0ad2 100644 --- a/vendor/github.com/onsi/ginkgo/v2/README.md +++ b/vendor/github.com/onsi/ginkgo/v2/README.md @@ -119,7 +119,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) Sponsors commit to a [sponsorship](https://github.com/sponsors/onsi) for a year. If you're an organization that makes use of Ginkgo please consider becoming a sponsor!

Browser testing via - - + +

diff --git a/vendor/github.com/onsi/ginkgo/v2/core_dsl.go b/vendor/github.com/onsi/ginkgo/v2/core_dsl.go index 7e165e4738..1c5a39a1f5 100644 --- a/vendor/github.com/onsi/ginkgo/v2/core_dsl.go +++ b/vendor/github.com/onsi/ginkgo/v2/core_dsl.go @@ -20,6 +20,7 @@ import ( "io" "os" "path/filepath" + "slices" "strings" "github.com/go-logr/logr" @@ -268,7 +269,7 @@ func RunSpecs(t GinkgoTestingT, description string, args ...any) bool { } defer global.PopClone() - suiteLabels, suiteSemVerConstraints, suiteAroundNodes := extractSuiteConfiguration(args) + suiteLabels, suiteSemVerConstraints, suiteComponentSemVerConstraints, suiteAroundNodes := extractSuiteConfiguration(args) var reporter reporters.Reporter if suiteConfig.ParallelTotal == 1 { @@ -311,7 +312,7 @@ func RunSpecs(t GinkgoTestingT, description string, args ...any) bool { suitePath, err = filepath.Abs(suitePath) exitIfErr(err) - passed, hasFocusedTests := global.Suite.Run(description, suiteLabels, suiteSemVerConstraints, suiteAroundNodes, suitePath, global.Failer, reporter, writer, outputInterceptor, interrupt_handler.NewInterruptHandler(client), client, internal.RegisterForProgressSignal, suiteConfig) + passed, hasFocusedTests := global.Suite.Run(description, suiteLabels, suiteSemVerConstraints, suiteComponentSemVerConstraints, suiteAroundNodes, suitePath, global.Failer, reporter, writer, outputInterceptor, interrupt_handler.NewInterruptHandler(client), client, internal.RegisterForProgressSignal, suiteConfig) outputInterceptor.Shutdown() flagSet.ValidateDeprecations(deprecationTracker) @@ -330,9 +331,10 @@ func RunSpecs(t GinkgoTestingT, description string, args ...any) bool { return passed } -func extractSuiteConfiguration(args []any) (Labels, SemVerConstraints, types.AroundNodes) { +func extractSuiteConfiguration(args []any) (Labels, SemVerConstraints, ComponentSemVerConstraints, types.AroundNodes) { suiteLabels := Labels{} suiteSemVerConstraints := SemVerConstraints{} + suiteComponentSemVerConstraints := ComponentSemVerConstraints{} aroundNodes := types.AroundNodes{} configErrors := []error{} for _, arg := range args { @@ -345,6 +347,11 @@ func extractSuiteConfiguration(args []any) (Labels, SemVerConstraints, types.Aro suiteLabels = append(suiteLabels, arg...) case SemVerConstraints: suiteSemVerConstraints = append(suiteSemVerConstraints, arg...) + case ComponentSemVerConstraints: + for component, constraints := range arg { + suiteComponentSemVerConstraints[component] = append(suiteComponentSemVerConstraints[component], constraints...) + suiteComponentSemVerConstraints[component] = slices.Compact(suiteComponentSemVerConstraints[component]) + } case types.AroundNodeDecorator: aroundNodes = append(aroundNodes, arg) default: @@ -355,14 +362,14 @@ func extractSuiteConfiguration(args []any) (Labels, SemVerConstraints, types.Aro configErrors = types.VetConfig(flagSet, suiteConfig, reporterConfig) if len(configErrors) > 0 { - fmt.Fprintf(formatter.ColorableStdErr, formatter.F("{{red}}Ginkgo detected configuration issues:{{/}}\n")) + fmt.Fprint(formatter.ColorableStdErr, formatter.F("{{red}}Ginkgo detected configuration issues:{{/}}\n")) for _, err := range configErrors { - fmt.Fprintf(formatter.ColorableStdErr, err.Error()) + fmt.Fprint(formatter.ColorableStdErr, err.Error()) } os.Exit(1) } - return suiteLabels, suiteSemVerConstraints, aroundNodes + return suiteLabels, suiteSemVerConstraints, suiteComponentSemVerConstraints, aroundNodes } func getwd() (string, error) { @@ -385,7 +392,7 @@ func PreviewSpecs(description string, args ...any) Report { } defer global.PopClone() - suiteLabels, suiteSemVerConstraints, suiteAroundNodes := extractSuiteConfiguration(args) + suiteLabels, suiteSemVerConstraints, suiteComponentSemVerConstraints, suiteAroundNodes := extractSuiteConfiguration(args) priorDryRun, priorParallelTotal, priorParallelProcess := suiteConfig.DryRun, suiteConfig.ParallelTotal, suiteConfig.ParallelProcess suiteConfig.DryRun, suiteConfig.ParallelTotal, suiteConfig.ParallelProcess = true, 1, 1 defer func() { @@ -403,7 +410,7 @@ func PreviewSpecs(description string, args ...any) Report { suitePath, err = filepath.Abs(suitePath) exitIfErr(err) - global.Suite.Run(description, suiteLabels, suiteSemVerConstraints, suiteAroundNodes, suitePath, global.Failer, reporter, writer, outputInterceptor, interrupt_handler.NewInterruptHandler(client), client, internal.RegisterForProgressSignal, suiteConfig) + global.Suite.Run(description, suiteLabels, suiteSemVerConstraints, suiteComponentSemVerConstraints, suiteAroundNodes, suitePath, global.Failer, reporter, writer, outputInterceptor, interrupt_handler.NewInterruptHandler(client), client, internal.RegisterForProgressSignal, suiteConfig) return global.Suite.GetPreviewReport() } diff --git a/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go b/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go index e331d7cf8c..ce1d71cec8 100644 --- a/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go +++ b/vendor/github.com/onsi/ginkgo/v2/decorator_dsl.go @@ -117,6 +117,27 @@ You can learn more here: https://onsi.github.io/ginkgo/#spec-semantic-version-fi */ type SemVerConstraints = internal.SemVerConstraints +/* +ComponentSemVerConstraint decorates specs with ComponentSemVerConstraints. Multiple components semantic version constraints can be passed to ComponentSemVerConstraint and the component can't be empy, also the version strings must follow the semantic version constraint rules. +ComponentSemVerConstraints can be applied to container and subject nodes, but not setup nodes. You can provide multiple ComponentSemVerConstraints to a given node and a spec's component semantic version constraints is the union of all component semantic version constraints in its node hierarchy. + +You can learn more here: https://onsi.github.io/ginkgo/#spec-semantic-version-filtering +You can learn more about decorators here: https://onsi.github.io/ginkgo/#decorator-reference +*/ +func ComponentSemVerConstraint(component string, semVerConstraints ...string) ComponentSemVerConstraints { + componentSemVerConstraints := ComponentSemVerConstraints{ + component: semVerConstraints, + } + + return componentSemVerConstraints +} + +/* +ComponentSemVerConstraints are the type for spec ComponentSemVerConstraint decorators. Use ComponentSemVerConstraint(...) to construct ComponentSemVerConstraints. +You can learn more here: https://onsi.github.io/ginkgo/#spec-semantic-version-filtering +*/ +type ComponentSemVerConstraints = internal.ComponentSemVerConstraints + /* PollProgressAfter allows you to override the configured value for --poll-progress-after for a particular node. diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/command.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/command.go index 79b83a3af1..a30a2ecc92 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/command.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/command/command.go @@ -22,11 +22,11 @@ type Command struct { func (c Command) Run(args []string, additionalArgs []string) { args, err := c.Flags.Parse(args) if err != nil { - AbortWithUsage(err.Error()) + AbortWithUsage("%s", err.Error()) } for _, arg := range args { if len(arg) > 1 && strings.HasPrefix(arg, "-") { - AbortWith(types.GinkgoErrors.FlagAfterPositionalParameter().Error()) + AbortWith("%s", types.GinkgoErrors.FlagAfterPositionalParameter().Error()) } } c.Command(args, additionalArgs) @@ -49,6 +49,6 @@ func (c Command) EmitUsage(writer io.Writer) { } flagUsage := c.Flags.Usage() if flagUsage != "" { - fmt.Fprintf(writer, formatter.F(flagUsage)) + fmt.Fprint(writer, formatter.F(flagUsage)) } } diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go index 30d8096cd6..68830d9ae2 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/internal/run.go @@ -9,6 +9,7 @@ import ( "path/filepath" "regexp" "strings" + "sync/atomic" "syscall" "time" @@ -159,12 +160,15 @@ func runSerial(suite TestSuite, ginkgoConfig types.SuiteConfig, reporterConfig t func runParallel(suite TestSuite, ginkgoConfig types.SuiteConfig, reporterConfig types.ReporterConfig, cliConfig types.CLIConfig, goFlagsConfig types.GoFlagsConfig, additionalArgs []string) TestSuite { type procResult struct { + proc int + exitResult string passed bool hasProgrammaticFocus bool } numProcs := cliConfig.ComputedProcs() procOutput := make([]*bytes.Buffer, numProcs) + procExitResult := make([]string, numProcs) coverProfiles := []string{} blockProfiles := []string{} @@ -224,16 +228,20 @@ func runParallel(suite TestSuite, ginkgoConfig types.SuiteConfig, reporterConfig args = append(args, additionalArgs...) cmd, buf := buildAndStartCommand(suite, args, false) + var exited atomic.Bool procOutput[proc-1] = buf - server.RegisterAlive(proc, func() bool { return cmd.ProcessState == nil || !cmd.ProcessState.Exited() }) + server.RegisterAlive(proc, func() bool { return !exited.Load() }) go func() { cmd.Wait() exitStatus := cmd.ProcessState.Sys().(syscall.WaitStatus).ExitStatus() procResults <- procResult{ + proc: proc, + exitResult: cmd.ProcessState.String(), passed: (exitStatus == 0) || (exitStatus == types.GINKGO_FOCUS_EXIT_CODE), hasProgrammaticFocus: exitStatus == types.GINKGO_FOCUS_EXIT_CODE, } + exited.Store(true) }() } @@ -242,6 +250,7 @@ func runParallel(suite TestSuite, ginkgoConfig types.SuiteConfig, reporterConfig result := <-procResults passed = passed && result.passed suite.HasProgrammaticFocus = suite.HasProgrammaticFocus || result.hasProgrammaticFocus + procExitResult[result.proc-1] = result.exitResult } if passed { suite.State = TestSuiteStatePassed @@ -259,8 +268,10 @@ func runParallel(suite TestSuite, ginkgoConfig types.SuiteConfig, reporterConfig fmt.Fprint(formatter.ColorableStdErr, formatter.Fiw(0, formatter.COLS, "This occurs if a parallel process exits before it reports its results to the Ginkgo CLI. The CLI will now print out all the stdout/stderr output it's collected from the running processes. However you may not see anything useful in these logs because the individual test processes usually intercept output to stdout/stderr in order to capture it in the spec reports.\n\nYou may want to try rerunning your test suite with {{light-gray}}--output-interceptor-mode=none{{/}} to see additional output here and debug your suite.\n")) fmt.Fprintln(formatter.ColorableStdErr, " ") for proc := 1; proc <= cliConfig.ComputedProcs(); proc++ { - fmt.Fprintf(formatter.ColorableStdErr, formatter.F("{{bold}}Output from proc %d:{{/}}\n", proc)) + fmt.Fprint(formatter.ColorableStdErr, formatter.F("{{bold}}Output from proc %d:{{/}}\n", proc)) fmt.Fprintln(os.Stderr, formatter.Fi(1, "%s", procOutput[proc-1].String())) + fmt.Fprint(formatter.ColorableStdErr, formatter.F("{{bold}}Exit result of proc %d:{{/}}\n", proc)) + fmt.Fprintln(os.Stderr, formatter.Fi(1, "%s\n", procExitResult[proc-1])) } fmt.Fprintf(os.Stderr, "** End **") } diff --git a/vendor/github.com/onsi/ginkgo/v2/ginkgo/run/run_command.go b/vendor/github.com/onsi/ginkgo/v2/ginkgo/run/run_command.go index 03875b9796..c5091e6de8 100644 --- a/vendor/github.com/onsi/ginkgo/v2/ginkgo/run/run_command.go +++ b/vendor/github.com/onsi/ginkgo/v2/ginkgo/run/run_command.go @@ -33,7 +33,7 @@ func BuildRunCommand() command.Command { Usage: "ginkgo run -- ", ShortDoc: "Run the tests in the passed in (or the package in the current directory if left blank)", Documentation: "Any arguments after -- will be passed to the test.", - DocLink: "running-tests", + DocLink: "running-specs", Command: func(args []string, additionalArgs []string) { var errors []error cliConfig, goFlagsConfig, errors = types.VetAndInitializeCLIAndGoConfig(cliConfig, goFlagsConfig) diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/focus.go b/vendor/github.com/onsi/ginkgo/v2/internal/focus.go index a39daf5a60..498e707dbf 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/focus.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/focus.go @@ -56,7 +56,7 @@ This function sets the `Skip` property on specs by applying Ginkgo's focus polic *Note:* specs with pending nodes are Skipped when created by NewSpec. */ -func ApplyFocusToSpecs(specs Specs, description string, suiteLabels Labels, suiteSemVerConstraints SemVerConstraints, suiteConfig types.SuiteConfig) (Specs, bool) { +func ApplyFocusToSpecs(specs Specs, description string, suiteLabels Labels, suiteSemVerConstraints SemVerConstraints, suiteComponentSemVerConstraints ComponentSemVerConstraints, suiteConfig types.SuiteConfig) (Specs, bool) { focusString := strings.Join(suiteConfig.FocusStrings, "|") skipString := strings.Join(suiteConfig.SkipStrings, "|") @@ -87,7 +87,24 @@ func ApplyFocusToSpecs(specs Specs, description string, suiteLabels Labels, suit if suiteConfig.SemVerFilter != "" { semVerFilter, _ := types.ParseSemVerFilter(suiteConfig.SemVerFilter) skipChecks = append(skipChecks, func(spec Spec) bool { - return !semVerFilter(UnionOfSemVerConstraints(suiteSemVerConstraints, spec.Nodes.UnionOfSemVerConstraints())) + noRun := false + + // non-component-specific constraints + constraints := UnionOfSemVerConstraints(suiteSemVerConstraints, spec.Nodes.UnionOfSemVerConstraints()) + if len(constraints) != 0 && semVerFilter("", constraints) == false { + noRun = true + } + + // component-specific constraints + componentConstraints := UnionOfComponentSemVerConstraints(suiteComponentSemVerConstraints, spec.Nodes.UnionOfComponentSemVerConstraints()) + for component, constraints := range componentConstraints { + if semVerFilter(component, constraints) == false { + noRun = true + break + } + } + + return noRun }) } diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/group.go b/vendor/github.com/onsi/ginkgo/v2/internal/group.go index cc794903e7..5e66113343 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/group.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/group.go @@ -113,22 +113,24 @@ func newGroup(suite *Suite) *group { // initialReportForSpec constructs a new SpecReport right before running the spec. func (g *group) initialReportForSpec(spec Spec) types.SpecReport { return types.SpecReport{ - ContainerHierarchyTexts: spec.Nodes.WithType(types.NodeTypeContainer).Texts(), - ContainerHierarchyLocations: spec.Nodes.WithType(types.NodeTypeContainer).CodeLocations(), - ContainerHierarchyLabels: spec.Nodes.WithType(types.NodeTypeContainer).Labels(), - ContainerHierarchySemVerConstraints: spec.Nodes.WithType(types.NodeTypeContainer).SemVerConstraints(), - LeafNodeLocation: spec.FirstNodeWithType(types.NodeTypeIt).CodeLocation, - LeafNodeType: types.NodeTypeIt, - LeafNodeText: spec.FirstNodeWithType(types.NodeTypeIt).Text, - LeafNodeLabels: []string(spec.FirstNodeWithType(types.NodeTypeIt).Labels), - LeafNodeSemVerConstraints: []string(spec.FirstNodeWithType(types.NodeTypeIt).SemVerConstraints), - ParallelProcess: g.suite.config.ParallelProcess, - RunningInParallel: g.suite.isRunningInParallel(), - IsSerial: spec.Nodes.HasNodeMarkedSerial(), - IsInOrderedContainer: !spec.Nodes.FirstNodeMarkedOrdered().IsZero(), - MaxFlakeAttempts: spec.Nodes.GetMaxFlakeAttempts(), - MaxMustPassRepeatedly: spec.Nodes.GetMaxMustPassRepeatedly(), - SpecPriority: spec.Nodes.GetSpecPriority(), + ContainerHierarchyTexts: spec.Nodes.WithType(types.NodeTypeContainer).Texts(), + ContainerHierarchyLocations: spec.Nodes.WithType(types.NodeTypeContainer).CodeLocations(), + ContainerHierarchyLabels: spec.Nodes.WithType(types.NodeTypeContainer).Labels(), + ContainerHierarchySemVerConstraints: spec.Nodes.WithType(types.NodeTypeContainer).SemVerConstraints(), + ContainerHierarchyComponentSemVerConstraints: spec.Nodes.WithType(types.NodeTypeContainer).ComponentSemVerConstraints(), + LeafNodeLocation: spec.FirstNodeWithType(types.NodeTypeIt).CodeLocation, + LeafNodeType: types.NodeTypeIt, + LeafNodeText: spec.FirstNodeWithType(types.NodeTypeIt).Text, + LeafNodeLabels: []string(spec.FirstNodeWithType(types.NodeTypeIt).Labels), + LeafNodeSemVerConstraints: []string(spec.FirstNodeWithType(types.NodeTypeIt).SemVerConstraints), + LeafNodeComponentSemVerConstraints: map[string][]string(spec.FirstNodeWithType(types.NodeTypeIt).ComponentSemVerConstraints), + ParallelProcess: g.suite.config.ParallelProcess, + RunningInParallel: g.suite.isRunningInParallel(), + IsSerial: spec.Nodes.HasNodeMarkedSerial(), + IsInOrderedContainer: !spec.Nodes.FirstNodeMarkedOrdered().IsZero(), + MaxFlakeAttempts: spec.Nodes.GetMaxFlakeAttempts(), + MaxMustPassRepeatedly: spec.Nodes.GetMaxMustPassRepeatedly(), + SpecPriority: spec.Nodes.GetSpecPriority(), } } @@ -152,6 +154,7 @@ func addNodeToReportForNode(report *types.ConstructionNodeReport, node *TreeNode report.ContainerHierarchyLocations = append(report.ContainerHierarchyLocations, node.Node.CodeLocation) report.ContainerHierarchyLabels = append(report.ContainerHierarchyLabels, node.Node.Labels) report.ContainerHierarchySemVerConstraints = append(report.ContainerHierarchySemVerConstraints, node.Node.SemVerConstraints) + report.ContainerHierarchyComponentSemVerConstraints = append(report.ContainerHierarchyComponentSemVerConstraints, node.Node.ComponentSemVerConstraints) if node.Node.MarkedSerial { report.IsSerial = true } diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/node.go b/vendor/github.com/onsi/ginkgo/v2/internal/node.go index 2bccec2dbf..b0c8de8d69 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/node.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/node.go @@ -57,6 +57,7 @@ type Node struct { MustPassRepeatedly int Labels Labels SemVerConstraints SemVerConstraints + ComponentSemVerConstraints ComponentSemVerConstraints PollProgressAfter time.Duration PollProgressInterval time.Duration NodeTimeout time.Duration @@ -106,7 +107,24 @@ func (l Labels) MatchesLabelFilter(query string) bool { type SemVerConstraints []string func (svc SemVerConstraints) MatchesSemVerFilter(version string) bool { - return types.MustParseSemVerFilter(version)(svc) + return types.MustParseSemVerFilter(version)("", svc) +} + +type ComponentSemVerConstraints map[string][]string + +func (csvc ComponentSemVerConstraints) MatchesSemVerFilter(component, version string) bool { + for comp, constraints := range csvc { + if comp != component { + continue + } + + input := version + if len(component) > 0 { + input = fmt.Sprintf("%s=%s", component, version) + } + return types.MustParseSemVerFilter(input)(component, constraints) + } + return false } func unionOf[S ~[]E, E comparable](slices ...S) S { @@ -131,6 +149,16 @@ func UnionOfSemVerConstraints(semVerConstraints ...SemVerConstraints) SemVerCons return unionOf(semVerConstraints...) } +func UnionOfComponentSemVerConstraints(componentSemVerConstraintsSlice ...ComponentSemVerConstraints) ComponentSemVerConstraints { + unionComponentSemVerConstraints := ComponentSemVerConstraints{} + for _, componentSemVerConstraints := range componentSemVerConstraintsSlice { + for component, constraints := range componentSemVerConstraints { + unionComponentSemVerConstraints[component] = unionOf(unionComponentSemVerConstraints[component], constraints) + } + } + return unionComponentSemVerConstraints +} + func PartitionDecorations(args ...any) ([]any, []any) { decorations := []any{} remainingArgs := []any{} @@ -174,6 +202,8 @@ func isDecoration(arg any) bool { return true case t == reflect.TypeOf(SemVerConstraints{}): return true + case t == reflect.TypeOf(ComponentSemVerConstraints{}): + return true case t == reflect.TypeOf(PollProgressInterval(0)): return true case t == reflect.TypeOf(PollProgressAfter(0)): @@ -214,16 +244,17 @@ var specContextType = reflect.TypeOf(new(SpecContext)).Elem() func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeType, text string, args ...any) (Node, []error) { baseOffset := 2 node := Node{ - ID: UniqueNodeID(), - NodeType: nodeType, - Text: text, - Labels: Labels{}, - SemVerConstraints: SemVerConstraints{}, - CodeLocation: types.NewCodeLocation(baseOffset), - NestingLevel: -1, - PollProgressAfter: -1, - PollProgressInterval: -1, - GracePeriod: -1, + ID: UniqueNodeID(), + NodeType: nodeType, + Text: text, + Labels: Labels{}, + SemVerConstraints: SemVerConstraints{}, + ComponentSemVerConstraints: ComponentSemVerConstraints{}, + CodeLocation: types.NewCodeLocation(baseOffset), + NestingLevel: -1, + PollProgressAfter: -1, + PollProgressInterval: -1, + GracePeriod: -1, } errors := []error{} @@ -360,6 +391,36 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy appendError(err) } } + case t == reflect.TypeOf(ComponentSemVerConstraints{}): + if !nodeType.Is(types.NodeTypesForContainerAndIt) { + appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "ComponentSemVerConstraint")) + } + for component, semVerConstraints := range arg.(ComponentSemVerConstraints) { + // while using ComponentSemVerConstraints, we should not allow empty component names. + // you should use SemVerConstraints for that. + hasErr := false + if len(component) == 0 { + appendError(types.GinkgoErrors.InvalidEmptyComponentForSemVerConstraint(node.CodeLocation)) + hasErr = true + } + for _, semVerConstraint := range semVerConstraints { + _, err := types.ValidateAndCleanupSemVerConstraint(semVerConstraint, node.CodeLocation) + if err != nil { + appendError(err) + hasErr = true + } + } + + if !hasErr { + // merge constraints if the component already exists + constraints := slices.Clone(semVerConstraints) + if existingConstraints, exists := node.ComponentSemVerConstraints[component]; exists { + constraints = UnionOfSemVerConstraints([]string(existingConstraints), constraints) + } + + node.ComponentSemVerConstraints[component] = slices.Clone(constraints) + } + } case t.Kind() == reflect.Func: if nodeType.Is(types.NodeTypeContainer) { if node.Body != nil { @@ -899,6 +960,34 @@ func (n Nodes) UnionOfSemVerConstraints() []string { return out } +func (n Nodes) ComponentSemVerConstraints() []map[string][]string { + out := make([]map[string][]string, len(n)) + for i := range n { + if n[i].ComponentSemVerConstraints == nil { + out[i] = map[string][]string{} + } else { + out[i] = map[string][]string(n[i].ComponentSemVerConstraints) + } + } + return out +} + +func (n Nodes) UnionOfComponentSemVerConstraints() map[string][]string { + out := map[string][]string{} + seen := map[string]bool{} + for i := range n { + for component := range n[i].ComponentSemVerConstraints { + if !seen[component] { + seen[component] = true + out[component] = n[i].ComponentSemVerConstraints[component] + } else { + out[component] = UnionOfSemVerConstraints(out[component], n[i].ComponentSemVerConstraints[component]) + } + } + } + return out +} + func (n Nodes) CodeLocations() []types.CodeLocation { out := make([]types.CodeLocation, len(n)) for i := range n { diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/reporters/gojson.go b/vendor/github.com/onsi/ginkgo/v2/internal/reporters/gojson.go index 8b7a9ceabf..751543ea78 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/reporters/gojson.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/reporters/gojson.go @@ -83,7 +83,7 @@ func goJSONActionFromSpecState(state types.SpecState) GoJSONAction { type gojsonReport struct { o types.Report // Extra calculated fields - goPkg string + goPkg string elapsed float64 } @@ -109,8 +109,8 @@ type gojsonSpecReport struct { o types.SpecReport // extra calculated fields testName string - elapsed float64 - action GoJSONAction + elapsed float64 + action GoJSONAction } func newSpecReport(in types.SpecReport) *gojsonSpecReport { @@ -141,18 +141,31 @@ func suitePathToPkg(dir string) (string, error) { } func createTestName(spec types.SpecReport) string { - name := fmt.Sprintf("[%s]", spec.LeafNodeType) - if spec.FullText() != "" { - name = name + " " + spec.FullText() - } - labels := spec.Labels() - if len(labels) > 0 { - name = name + " [" + strings.Join(labels, ", ") + "]" - } - semVerConstraints := spec.SemVerConstraints() - if len(semVerConstraints) > 0 { - name = name + " [" + strings.Join(semVerConstraints, ", ") + "]" - } - name = strings.TrimSpace(name) - return name + name := fmt.Sprintf("[%s]", spec.LeafNodeType) + if spec.FullText() != "" { + name = name + " " + spec.FullText() + } + labels := spec.Labels() + if len(labels) > 0 { + name = name + " [" + strings.Join(labels, ", ") + "]" + } + semVerConstraints := spec.SemVerConstraints() + if len(semVerConstraints) > 0 { + name = name + " [" + strings.Join(semVerConstraints, ", ") + "]" + } + componentSemVerConstraints := spec.ComponentSemVerConstraints() + if len(componentSemVerConstraints) > 0 { + name = name + " [" + formatComponentSemVerConstraintsToString(componentSemVerConstraints) + "]" + } + name = strings.TrimSpace(name) + return name +} + +func formatComponentSemVerConstraintsToString(componentSemVerConstraints map[string][]string) string { + var tmpStr string + for component, semVerConstraints := range componentSemVerConstraints { + tmpStr = tmpStr + fmt.Sprintf("%s: %s, ", component, semVerConstraints) + } + tmpStr = strings.TrimSuffix(tmpStr, ", ") + return tmpStr } diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go index ef76cd099e..57c1cffe71 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go @@ -108,13 +108,13 @@ func (suite *Suite) BuildTree() error { return nil } -func (suite *Suite) Run(description string, suiteLabels Labels, suiteSemVerConstraints SemVerConstraints, suiteAroundNodes types.AroundNodes, suitePath string, failer *Failer, reporter reporters.Reporter, writer WriterInterface, outputInterceptor OutputInterceptor, interruptHandler interrupt_handler.InterruptHandlerInterface, client parallel_support.Client, progressSignalRegistrar ProgressSignalRegistrar, suiteConfig types.SuiteConfig) (bool, bool) { +func (suite *Suite) Run(description string, suiteLabels Labels, suiteSemVerConstraints SemVerConstraints, suiteComponentSemVerConstraints ComponentSemVerConstraints, suiteAroundNodes types.AroundNodes, suitePath string, failer *Failer, reporter reporters.Reporter, writer WriterInterface, outputInterceptor OutputInterceptor, interruptHandler interrupt_handler.InterruptHandlerInterface, client parallel_support.Client, progressSignalRegistrar ProgressSignalRegistrar, suiteConfig types.SuiteConfig) (bool, bool) { if suite.phase != PhaseBuildTree { panic("cannot run before building the tree = call suite.BuildTree() first") } ApplyNestedFocusPolicyToTree(suite.tree) specs := GenerateSpecsFromTreeRoot(suite.tree) - specs, hasProgrammaticFocus := ApplyFocusToSpecs(specs, description, suiteLabels, suiteSemVerConstraints, suiteConfig) + specs, hasProgrammaticFocus := ApplyFocusToSpecs(specs, description, suiteLabels, suiteSemVerConstraints, suiteComponentSemVerConstraints, suiteConfig) specs = ComputeAroundNodes(specs) suite.phase = PhaseRun @@ -133,7 +133,7 @@ func (suite *Suite) Run(description string, suiteLabels Labels, suiteSemVerConst cancelProgressHandler := progressSignalRegistrar(suite.handleProgressSignal) - success := suite.runSpecs(description, suiteLabels, suiteSemVerConstraints, suitePath, hasProgrammaticFocus, specs) + success := suite.runSpecs(description, suiteLabels, suiteSemVerConstraints, suiteComponentSemVerConstraints, suitePath, hasProgrammaticFocus, specs) cancelProgressHandler() @@ -208,9 +208,12 @@ func (suite *Suite) PushNode(node Node) error { // Ensure that code running in the body of the container node // has access to information about the current container node(s). + // The current one (nil in top-level container nodes, non-nil in an + // embedded container node) gets restored when the node is done. + oldConstructionNodeReport := suite.currentConstructionNodeReport suite.currentConstructionNodeReport = constructionNodeReportForTreeNode(suite.tree) defer func() { - suite.currentConstructionNodeReport = nil + suite.currentConstructionNodeReport = oldConstructionNodeReport }() node.Body(nil) @@ -453,16 +456,17 @@ func (suite *Suite) processCurrentSpecReport() { } } -func (suite *Suite) runSpecs(description string, suiteLabels Labels, suiteSemVerConstraints SemVerConstraints, suitePath string, hasProgrammaticFocus bool, specs Specs) bool { +func (suite *Suite) runSpecs(description string, suiteLabels Labels, suiteSemVerConstraints SemVerConstraints, suiteComponentSemVerConstraints ComponentSemVerConstraints, suitePath string, hasProgrammaticFocus bool, specs Specs) bool { numSpecsThatWillBeRun := specs.CountWithoutSkip() suite.report = types.Report{ - SuitePath: suitePath, - SuiteDescription: description, - SuiteLabels: suiteLabels, - SuiteSemVerConstraints: suiteSemVerConstraints, - SuiteConfig: suite.config, - SuiteHasProgrammaticFocus: hasProgrammaticFocus, + SuitePath: suitePath, + SuiteDescription: description, + SuiteLabels: suiteLabels, + SuiteSemVerConstraints: suiteSemVerConstraints, + SuiteComponentSemVerConstraints: suiteComponentSemVerConstraints, + SuiteConfig: suite.config, + SuiteHasProgrammaticFocus: hasProgrammaticFocus, PreRunStats: types.PreRunStats{ TotalSpecs: len(specs), SpecsThatWillRun: numSpecsThatWillBeRun, @@ -1039,7 +1043,7 @@ func (suite *Suite) runNode(node Node, specDeadline time.Time, text string) (typ } progressReport = progressReport.WithoutOtherGoroutines() - sc.cancel(fmt.Errorf(interruptStatus.Message())) + sc.cancel(fmt.Errorf("%s", interruptStatus.Message())) if interruptStatus.Level == interrupt_handler.InterruptLevelBailOut { if interruptStatus.ShouldIncludeProgressReport() { diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go index 9806e315a6..5704f0fdf9 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go @@ -27,6 +27,11 @@ type ginkgoWriterInterface interface { type ginkgoRecoverFunc func() type attachProgressReporterFunc func(func() string) func() +var formatters = map[bool]formatter.Formatter{ + true: formatter.NewWithNoColorBool(true), + false: formatter.NewWithNoColorBool(false), +} + func New(writer ginkgoWriterInterface, fail failFunc, skip skipFunc, cleanup cleanupFunc, report reportFunc, addReportEntry addReportEntryFunc, ginkgoRecover ginkgoRecoverFunc, attachProgressReporter attachProgressReporterFunc, randomSeed int64, parallelProcess int, parallelTotal int, noColor bool, offset int) *ginkgoTestingTProxy { return &ginkgoTestingTProxy{ fail: fail, @@ -41,7 +46,7 @@ func New(writer ginkgoWriterInterface, fail failFunc, skip skipFunc, cleanup cle randomSeed: randomSeed, parallelProcess: parallelProcess, parallelTotal: parallelTotal, - f: formatter.NewWithNoColorBool(noColor), + f: formatters[noColor], //minimize allocations by reusing formatters } } diff --git a/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go b/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go index 026d9cf9b3..ef66b22898 100644 --- a/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go +++ b/vendor/github.com/onsi/ginkgo/v2/reporters/default_reporter.go @@ -75,6 +75,9 @@ func (r *DefaultReporter) SuiteWillBegin(report types.Report) { if len(report.SuiteSemVerConstraints) > 0 { r.emit(r.f("{{coral}}[%s]{{/}} ", strings.Join(report.SuiteSemVerConstraints, ", "))) } + if len(report.SuiteComponentSemVerConstraints) > 0 { + r.emit(r.f("{{coral}}[Components: %s]{{/}} ", formatComponentSemVerConstraintsToString(report.SuiteComponentSemVerConstraints))) + } r.emit(r.f("- %d/%d specs ", report.PreRunStats.SpecsThatWillRun, report.PreRunStats.TotalSpecs)) if report.SuiteConfig.ParallelTotal > 1 { r.emit(r.f("- %d procs ", report.SuiteConfig.ParallelTotal)) @@ -97,6 +100,13 @@ func (r *DefaultReporter) SuiteWillBegin(report types.Report) { bannerWidth = len(semVerConstraints) + 2 } } + if len(report.SuiteComponentSemVerConstraints) > 0 { + componentSemVerConstraints := formatComponentSemVerConstraintsToString(report.SuiteComponentSemVerConstraints) + r.emitBlock(r.f("{{coral}}[Components: %s]{{/}} ", componentSemVerConstraints)) + if len(componentSemVerConstraints)+2 > bannerWidth { + bannerWidth = len(componentSemVerConstraints) + 2 + } + } r.emitBlock(strings.Repeat("=", bannerWidth)) out := r.f("Random Seed: {{bold}}%d{{/}}", report.SuiteConfig.RandomSeed) @@ -725,8 +735,12 @@ func (r *DefaultReporter) cycleJoin(elements []string, joiner string) string { } func (r *DefaultReporter) codeLocationBlock(report types.SpecReport, highlightColor string, veryVerbose bool, usePreciseFailureLocation bool) string { - texts, locations, labels, semVerConstraints := []string{}, []types.CodeLocation{}, [][]string{}, [][]string{} - texts, locations, labels, semVerConstraints = append(texts, report.ContainerHierarchyTexts...), append(locations, report.ContainerHierarchyLocations...), append(labels, report.ContainerHierarchyLabels...), append(semVerConstraints, report.ContainerHierarchySemVerConstraints...) + texts, locations, labels, semVerConstraints, componentSemVerConstraints := []string{}, []types.CodeLocation{}, [][]string{}, [][]string{}, []map[string][]string{} + texts = append(texts, report.ContainerHierarchyTexts...) + locations = append(locations, report.ContainerHierarchyLocations...) + labels = append(labels, report.ContainerHierarchyLabels...) + semVerConstraints = append(semVerConstraints, report.ContainerHierarchySemVerConstraints...) + componentSemVerConstraints = append(componentSemVerConstraints, report.ContainerHierarchyComponentSemVerConstraints...) if report.LeafNodeType.Is(types.NodeTypesForSuiteLevelNodes) { texts = append(texts, r.f("[%s] %s", report.LeafNodeType, report.LeafNodeText)) @@ -735,6 +749,7 @@ func (r *DefaultReporter) codeLocationBlock(report types.SpecReport, highlightCo } labels = append(labels, report.LeafNodeLabels) semVerConstraints = append(semVerConstraints, report.LeafNodeSemVerConstraints) + componentSemVerConstraints = append(componentSemVerConstraints, report.LeafNodeComponentSemVerConstraints) locations = append(locations, report.LeafNodeLocation) failureLocation := report.Failure.FailureNodeLocation @@ -749,6 +764,7 @@ func (r *DefaultReporter) codeLocationBlock(report types.SpecReport, highlightCo locations = append([]types.CodeLocation{failureLocation}, locations...) labels = append([][]string{{}}, labels...) semVerConstraints = append([][]string{{}}, semVerConstraints...) + componentSemVerConstraints = append([]map[string][]string{{}}, componentSemVerConstraints...) highlightIndex = 0 case types.FailureNodeInContainer: i := report.Failure.FailureNodeContainerIndex @@ -779,6 +795,9 @@ func (r *DefaultReporter) codeLocationBlock(report types.SpecReport, highlightCo if len(semVerConstraints[i]) > 0 { out += r.f(" {{coral}}[%s]{{/}}", strings.Join(semVerConstraints[i], ", ")) } + if len(componentSemVerConstraints[i]) > 0 { + out += r.f(" {{coral}}[%s]{{/}}", formatComponentSemVerConstraintsToString(componentSemVerConstraints[i])) + } out += "\n" out += r.fi(uint(i), "{{gray}}%s{{/}}\n", locations[i]) } @@ -806,6 +825,10 @@ func (r *DefaultReporter) codeLocationBlock(report types.SpecReport, highlightCo if len(flattenedSemVerConstraints) > 0 { out += r.f(" {{coral}}[%s]{{/}}", strings.Join(flattenedSemVerConstraints, ", ")) } + flattenedComponentSemVerConstraints := report.ComponentSemVerConstraints() + if len(flattenedComponentSemVerConstraints) > 0 { + out += r.f(" {{coral}}[%s]{{/}}", formatComponentSemVerConstraintsToString(flattenedComponentSemVerConstraints)) + } out += "\n" if usePreciseFailureLocation { out += r.f("{{gray}}%s{{/}}", failureLocation) diff --git a/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go b/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go index 828f893fb8..d4720ee949 100644 --- a/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go +++ b/vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go @@ -13,9 +13,11 @@ package reporters import ( "encoding/xml" "fmt" + "maps" "os" "path" "regexp" + "slices" "strings" "github.com/onsi/ginkgo/v2/config" @@ -39,6 +41,9 @@ type JunitReportConfig struct { // Enable OmitSpecSemVerConstraints to prevent semantic version constraints from appearing in the spec name OmitSpecSemVerConstraints bool + // Enable OmitSpecComponentSemVerConstraints to prevent component semantic version constraints from appearing in the spec name + OmitSpecComponentSemVerConstraints bool + // Enable OmitLeafNodeType to prevent the spec leaf node type from appearing in the spec name OmitLeafNodeType bool @@ -173,6 +178,7 @@ func GenerateJUnitReportWithConfig(report types.Report, dst string, config Junit {"SpecialSuiteFailureReason", strings.Join(report.SpecialSuiteFailureReasons, ",")}, {"SuiteLabels", fmt.Sprintf("[%s]", strings.Join(report.SuiteLabels, ","))}, {"SuiteSemVerConstraints", fmt.Sprintf("[%s]", strings.Join(report.SuiteSemVerConstraints, ","))}, + {"SuiteComponentSemVerConstraints", fmt.Sprintf("[%s]", formatComponentSemVerConstraintsToString(report.SuiteComponentSemVerConstraints))}, {"RandomSeed", fmt.Sprintf("%d", report.SuiteConfig.RandomSeed)}, {"RandomizeAllSpecs", fmt.Sprintf("%t", report.SuiteConfig.RandomizeAllSpecs)}, {"LabelFilter", report.SuiteConfig.LabelFilter}, @@ -216,6 +222,10 @@ func GenerateJUnitReportWithConfig(report types.Report, dst string, config Junit if len(semVerConstraints) > 0 && !config.OmitSpecSemVerConstraints { name = name + " [" + strings.Join(semVerConstraints, ", ") + "]" } + componentSemVerConstraints := spec.ComponentSemVerConstraints() + if len(componentSemVerConstraints) > 0 && !config.OmitSpecComponentSemVerConstraints { + name = name + " [" + formatComponentSemVerConstraintsToString(componentSemVerConstraints) + "]" + } name = strings.TrimSpace(name) test := JUnitTestCase{ @@ -387,6 +397,16 @@ func systemOutForUnstructuredReporters(spec types.SpecReport) string { return spec.CapturedStdOutErr } +func formatComponentSemVerConstraintsToString(componentSemVerConstraints map[string][]string) string { + var tmpStr string + for _, key := range slices.Sorted(maps.Keys(componentSemVerConstraints)) { + tmpStr = tmpStr + fmt.Sprintf("%s: %s, ", key, componentSemVerConstraints[key]) + } + + tmpStr = strings.TrimSuffix(tmpStr, ", ") + return tmpStr +} + // Deprecated JUnitReporter (so folks can still compile their suites) type JUnitReporter struct{} diff --git a/vendor/github.com/onsi/ginkgo/v2/reporters/teamcity_report.go b/vendor/github.com/onsi/ginkgo/v2/reporters/teamcity_report.go index 55e1d1f4f7..ed3e3a2bb9 100644 --- a/vendor/github.com/onsi/ginkgo/v2/reporters/teamcity_report.go +++ b/vendor/github.com/onsi/ginkgo/v2/reporters/teamcity_report.go @@ -39,12 +39,16 @@ func GenerateTeamcityReport(report types.Report, dst string) error { name := report.SuiteDescription labels := report.SuiteLabels semVerConstraints := report.SuiteSemVerConstraints + componentSemVerConstraints := report.SuiteComponentSemVerConstraints if len(labels) > 0 { name = name + " [" + strings.Join(labels, ", ") + "]" } if len(semVerConstraints) > 0 { name = name + " [" + strings.Join(semVerConstraints, ", ") + "]" } + if len(componentSemVerConstraints) > 0 { + name = name + " [" + formatComponentSemVerConstraintsToString(componentSemVerConstraints) + "]" + } fmt.Fprintf(f, "##teamcity[testSuiteStarted name='%s']\n", tcEscape(name)) for _, spec := range report.SpecReports { name := fmt.Sprintf("[%s]", spec.LeafNodeType) @@ -59,6 +63,10 @@ func GenerateTeamcityReport(report types.Report, dst string) error { if len(semVerConstraints) > 0 { name = name + " [" + strings.Join(semVerConstraints, ", ") + "]" } + componentSemVerConstraints := spec.ComponentSemVerConstraints() + if len(componentSemVerConstraints) > 0 { + name = name + " [" + formatComponentSemVerConstraintsToString(componentSemVerConstraints) + "]" + } name = tcEscape(name) fmt.Fprintf(f, "##teamcity[testStarted name='%s']\n", name) diff --git a/vendor/github.com/onsi/ginkgo/v2/types/errors.go b/vendor/github.com/onsi/ginkgo/v2/types/errors.go index 59313238cf..623e54b66e 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/errors.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/errors.go @@ -450,6 +450,15 @@ func (g ginkgoErrors) InvalidEmptySemVerConstraint(cl CodeLocation) error { } } +func (g ginkgoErrors) InvalidEmptyComponentForSemVerConstraint(cl CodeLocation) error { + return GinkgoError{ + Heading: "Invalid Empty Component for ComponentSemVerConstraint", + Message: "ComponentSemVerConstraint requires a non-empty component name", + CodeLocation: cl, + DocLink: "spec-semantic-version-filtering", + } +} + /* Table errors */ func (g ginkgoErrors) MultipleEntryBodyFunctionsForTable(cl CodeLocation) error { return GinkgoError{ diff --git a/vendor/github.com/onsi/ginkgo/v2/types/semver_filter.go b/vendor/github.com/onsi/ginkgo/v2/types/semver_filter.go index 3fc2ed144b..71778078da 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/semver_filter.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/semver_filter.go @@ -2,11 +2,12 @@ package types import ( "fmt" + "strings" "github.com/Masterminds/semver/v3" ) -type SemVerFilter func([]string) bool +type SemVerFilter func(component string, constraints []string) bool func MustParseSemVerFilter(input string) SemVerFilter { filter, err := ParseSemVerFilter(input) @@ -16,30 +17,90 @@ func MustParseSemVerFilter(input string) SemVerFilter { return filter } -func ParseSemVerFilter(filterVersion string) (SemVerFilter, error) { - if filterVersion == "" { - return func(_ []string) bool { return true }, nil +// ParseSemVerFilter parses non-component and component-specific semantic version filter string. +// The filter string can contain multiple non-component and component-specific versions separated by commas. +// Each component-specific version is in the format "component=version". +// If a version is specified without a component, it applies to non-component-specific constraints. +func ParseSemVerFilter(componentFilterVersions string) (SemVerFilter, error) { + if componentFilterVersions == "" { + return func(_ string, _ []string) bool { return true }, nil } - targetVersion, err := semver.NewVersion(filterVersion) - if err != nil { - return nil, fmt.Errorf("invalid filter version: %w", err) + result := map[string]*semver.Version{} + parts := strings.Split(componentFilterVersions, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if len(part) == 0 { + continue + } + if strings.Contains(part, "=") { + // validate component-specific version string + invalidPart, invalidErr := false, fmt.Errorf("invalid component filter version: %s", part) + subParts := strings.Split(part, "=") + if len(subParts) != 2 { + invalidPart = true + } + component := strings.TrimSpace(subParts[0]) + versionStr := strings.TrimSpace(subParts[1]) + if len(component) == 0 || len(versionStr) == 0 { + invalidPart = true + } + if invalidPart { + return nil, invalidErr + } + + // validate semver + v, err := semver.NewVersion(versionStr) + if err != nil { + return nil, fmt.Errorf("invalid component filter version: %s, error: %w", part, err) + } + result[component] = v + } else { + v, err := semver.NewVersion(part) + if err != nil { + return nil, fmt.Errorf("invalid filter version: %s, error: %w", part, err) + } + result[""] = v + } } - return func(constraints []string) bool { + return func(component string, constraints []string) bool { // unconstrained specs always run - if len(constraints) == 0 { + if len(component) == 0 && len(constraints) == 0 { return true } - for _, constraintStr := range constraints { - constraint, err := semver.NewConstraint(constraintStr) - if err != nil { - return false + // check non-component specific version constraints + if len(component) == 0 && len(constraints) != 0 { + v := result[""] + if v != nil { + for _, constraintStr := range constraints { + constraint, err := semver.NewConstraint(constraintStr) + if err != nil { + return false + } + + if !constraint.Check(v) { + return false + } + } } + } + + // check component-specific version constraints + if len(component) != 0 && len(constraints) != 0 { + v := result[component] + if v != nil { + for _, constraintStr := range constraints { + constraint, err := semver.NewConstraint(constraintStr) + if err != nil { + return false + } - if !constraint.Check(targetVersion) { - return false + if !constraint.Check(v) { + return false + } + } } } diff --git a/vendor/github.com/onsi/ginkgo/v2/types/types.go b/vendor/github.com/onsi/ginkgo/v2/types/types.go index 9981a0dd68..2401505120 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/types.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/types.go @@ -38,6 +38,10 @@ type ConstructionNodeReport struct { // all Describe/Context/When containers in this spec's hierarchy ContainerHierarchySemVerConstraints [][]string + // ContainerHierarchyComponentSemVerConstraints is a slice containing the component-specific semVerConstraints of + // all Describe/Context/When containers in this spec's hierarchy + ContainerHierarchyComponentSemVerConstraints []map[string][]string + // IsSerial captures whether the any container has the Serial decorator IsSerial bool @@ -85,6 +89,9 @@ type Report struct { //SuiteSemVerConstraints captures any semVerConstraints attached to the suite by the DSL's RunSpecs() function SuiteSemVerConstraints []string + //SuiteComponentSemVerConstraints captures any component-specific semVerConstraints attached to the suite by the DSL's RunSpecs() function + SuiteComponentSemVerConstraints map[string][]string + //SuiteSucceeded captures the success or failure status of the test run //If true, the test run is considered successful. //If false, the test run is considered unsuccessful @@ -188,14 +195,19 @@ type SpecReport struct { // all Describe/Context/When containers in this spec's hierarchy ContainerHierarchySemVerConstraints [][]string + // ContainerHierarchyComponentSemVerConstraints is a slice containing the component-specific semVerConstraints of + // all Describe/Context/When containers in this spec's hierarchy + ContainerHierarchyComponentSemVerConstraints []map[string][]string + // LeafNodeType, LeafNodeLocation, LeafNodeLabels, LeafNodeSemVerConstraints and LeafNodeText capture the NodeType, CodeLocation, and text // of the Ginkgo node being tested (typically an NodeTypeIt node, though this can also be // one of the NodeTypesForSuiteLevelNodes node types) - LeafNodeType NodeType - LeafNodeLocation CodeLocation - LeafNodeLabels []string - LeafNodeSemVerConstraints []string - LeafNodeText string + LeafNodeType NodeType + LeafNodeLocation CodeLocation + LeafNodeLabels []string + LeafNodeSemVerConstraints []string + LeafNodeComponentSemVerConstraints map[string][]string + LeafNodeText string // Captures the Spec Priority SpecPriority int @@ -261,52 +273,54 @@ type SpecReport struct { func (report SpecReport) MarshalJSON() ([]byte, error) { //All this to avoid emitting an empty Failure struct in the JSON out := struct { - ContainerHierarchyTexts []string - ContainerHierarchyLocations []CodeLocation - ContainerHierarchyLabels [][]string - ContainerHierarchySemVerConstraints [][]string - LeafNodeType NodeType - LeafNodeLocation CodeLocation - LeafNodeLabels []string - LeafNodeSemVerConstraints []string - LeafNodeText string - State SpecState - StartTime time.Time - EndTime time.Time - RunTime time.Duration - ParallelProcess int - Failure *Failure `json:",omitempty"` - NumAttempts int - MaxFlakeAttempts int - MaxMustPassRepeatedly int - CapturedGinkgoWriterOutput string `json:",omitempty"` - CapturedStdOutErr string `json:",omitempty"` - ReportEntries ReportEntries `json:",omitempty"` - ProgressReports []ProgressReport `json:",omitempty"` - AdditionalFailures []AdditionalFailure `json:",omitempty"` - SpecEvents SpecEvents `json:",omitempty"` + ContainerHierarchyTexts []string + ContainerHierarchyLocations []CodeLocation + ContainerHierarchyLabels [][]string + ContainerHierarchySemVerConstraints [][]string + ContainerHierarchyComponentSemVerConstraints []map[string][]string + LeafNodeType NodeType + LeafNodeLocation CodeLocation + LeafNodeLabels []string + LeafNodeSemVerConstraints []string + LeafNodeText string + State SpecState + StartTime time.Time + EndTime time.Time + RunTime time.Duration + ParallelProcess int + Failure *Failure `json:",omitempty"` + NumAttempts int + MaxFlakeAttempts int + MaxMustPassRepeatedly int + CapturedGinkgoWriterOutput string `json:",omitempty"` + CapturedStdOutErr string `json:",omitempty"` + ReportEntries ReportEntries `json:",omitempty"` + ProgressReports []ProgressReport `json:",omitempty"` + AdditionalFailures []AdditionalFailure `json:",omitempty"` + SpecEvents SpecEvents `json:",omitempty"` }{ - ContainerHierarchyTexts: report.ContainerHierarchyTexts, - ContainerHierarchyLocations: report.ContainerHierarchyLocations, - ContainerHierarchyLabels: report.ContainerHierarchyLabels, - ContainerHierarchySemVerConstraints: report.ContainerHierarchySemVerConstraints, - LeafNodeType: report.LeafNodeType, - LeafNodeLocation: report.LeafNodeLocation, - LeafNodeLabels: report.LeafNodeLabels, - LeafNodeSemVerConstraints: report.LeafNodeSemVerConstraints, - LeafNodeText: report.LeafNodeText, - State: report.State, - StartTime: report.StartTime, - EndTime: report.EndTime, - RunTime: report.RunTime, - ParallelProcess: report.ParallelProcess, - Failure: nil, - ReportEntries: nil, - NumAttempts: report.NumAttempts, - MaxFlakeAttempts: report.MaxFlakeAttempts, - MaxMustPassRepeatedly: report.MaxMustPassRepeatedly, - CapturedGinkgoWriterOutput: report.CapturedGinkgoWriterOutput, - CapturedStdOutErr: report.CapturedStdOutErr, + ContainerHierarchyTexts: report.ContainerHierarchyTexts, + ContainerHierarchyLocations: report.ContainerHierarchyLocations, + ContainerHierarchyLabels: report.ContainerHierarchyLabels, + ContainerHierarchySemVerConstraints: report.ContainerHierarchySemVerConstraints, + ContainerHierarchyComponentSemVerConstraints: report.ContainerHierarchyComponentSemVerConstraints, + LeafNodeType: report.LeafNodeType, + LeafNodeLocation: report.LeafNodeLocation, + LeafNodeLabels: report.LeafNodeLabels, + LeafNodeSemVerConstraints: report.LeafNodeSemVerConstraints, + LeafNodeText: report.LeafNodeText, + State: report.State, + StartTime: report.StartTime, + EndTime: report.EndTime, + RunTime: report.RunTime, + ParallelProcess: report.ParallelProcess, + Failure: nil, + ReportEntries: nil, + NumAttempts: report.NumAttempts, + MaxFlakeAttempts: report.MaxFlakeAttempts, + MaxMustPassRepeatedly: report.MaxMustPassRepeatedly, + CapturedGinkgoWriterOutput: report.CapturedGinkgoWriterOutput, + CapturedStdOutErr: report.CapturedStdOutErr, } if !report.Failure.IsZero() { @@ -404,6 +418,34 @@ func (report SpecReport) SemVerConstraints() []string { return out } +// ComponentSemVerConstraints returns a deduped map of all the spec's component-specific SemVerConstraints. +func (report SpecReport) ComponentSemVerConstraints() map[string][]string { + out := map[string][]string{} + seen := map[string]bool{} + for _, compSemVerConstraints := range report.ContainerHierarchyComponentSemVerConstraints { + for component := range compSemVerConstraints { + if !seen[component] { + seen[component] = true + out[component] = compSemVerConstraints[component] + } else { + out[component] = append(out[component], compSemVerConstraints[component]...) + out[component] = slices.Compact(out[component]) + } + } + } + for component := range report.LeafNodeComponentSemVerConstraints { + if !seen[component] { + seen[component] = true + out[component] = report.LeafNodeComponentSemVerConstraints[component] + } else { + out[component] = append(out[component], report.LeafNodeComponentSemVerConstraints[component]...) + out[component] = slices.Compact(out[component]) + } + } + + return out +} + // MatchesLabelFilter returns true if the spec satisfies the passed in label filter query func (report SpecReport) MatchesLabelFilter(query string) (bool, error) { filter, err := ParseLabelFilter(query) @@ -419,7 +461,22 @@ func (report SpecReport) MatchesSemVerFilter(version string) (bool, error) { if err != nil { return false, err } - return filter(report.SemVerConstraints()), nil + + semVerConstraints := report.SemVerConstraints() + if len(semVerConstraints) != 0 && filter("", report.SemVerConstraints()) == false { + return false, nil + } + + componentSemVerConstraints := report.ComponentSemVerConstraints() + if len(componentSemVerConstraints) != 0 { + for component, constraints := range componentSemVerConstraints { + if filter(component, constraints) == false { + return false, nil + } + } + } + + return true, nil } // FileName() returns the name of the file containing the spec diff --git a/vendor/github.com/onsi/ginkgo/v2/types/version.go b/vendor/github.com/onsi/ginkgo/v2/types/version.go index b9c1ea9856..1df09be005 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/version.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/version.go @@ -1,3 +1,3 @@ package types -const VERSION = "2.27.2" +const VERSION = "2.28.1" diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index 64b33e8b7c..91e65521b4 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,13 @@ +## 1.39.1 + +Update all dependencies. This auto-updated the required version of Go to 1.24, consistent with the fact that Go 1.23 has been out of support for almost six months. + +## 1.39.0 + +### Features + +Add `MatchErrorStrictly` which only passes if `errors.Is(actual, expected)` returns true. `MatchError`, by contrast, will fallback to string comparison. + ## 1.38.3 ### Fixes diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index 55c0e895e2..87c70692bf 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.38.3" +const GOMEGA_VERSION = "1.39.1" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index 40ba15c5e7..16ca8f46dc 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -146,6 +146,24 @@ func MatchError(expected any, functionErrorDescription ...any) types.GomegaMatch } } +// MatchErrorStrictly succeeds iff actual is a non-nil error that matches the passed in +// expected error according to errors.Is(actual, expected). +// +// This behavior differs from MatchError where +// +// Expect(errors.New("some error")).To(MatchError(errors.New("some error"))) +// +// succeeds, but errors.Is would return false so: +// +// Expect(errors.New("some error")).To(MatchErrorStrictly(errors.New("some error"))) +// +// fails. +func MatchErrorStrictly(expected error) types.GomegaMatcher { + return &matchers.MatchErrorStrictlyMatcher{ + Expected: expected, + } +} + // BeClosed succeeds if actual is a closed channel. // It is an error to pass a non-channel to BeClosed, it is also an error to pass nil // diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go new file mode 100644 index 0000000000..63969b2663 --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go @@ -0,0 +1,39 @@ +package matchers + +import ( + "errors" + "fmt" + + "github.com/onsi/gomega/format" +) + +type MatchErrorStrictlyMatcher struct { + Expected error +} + +func (matcher *MatchErrorStrictlyMatcher) Match(actual any) (success bool, err error) { + + if isNil(matcher.Expected) { + return false, fmt.Errorf("Expected error is nil, use \"ToNot(HaveOccurred())\" to explicitly check for nil errors") + } + + if isNil(actual) { + return false, fmt.Errorf("Expected an error, got nil") + } + + if !isError(actual) { + return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) + } + + actualErr := actual.(error) + + return errors.Is(actualErr, matcher.Expected), nil +} + +func (matcher *MatchErrorStrictlyMatcher) FailureMessage(actual any) (message string) { + return format.Message(actual, "to match error", matcher.Expected) +} + +func (matcher *MatchErrorStrictlyMatcher) NegatedFailureMessage(actual any) (message string) { + return format.Message(actual, "not to match error", matcher.Expected) +} diff --git a/vendor/github.com/prometheus/common/expfmt/decode.go b/vendor/github.com/prometheus/common/expfmt/decode.go index 7b762370e2..8f8dc65d38 100644 --- a/vendor/github.com/prometheus/common/expfmt/decode.go +++ b/vendor/github.com/prometheus/common/expfmt/decode.go @@ -220,7 +220,7 @@ func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) return extractSummary(o, f), nil case dto.MetricType_UNTYPED: return extractUntyped(o, f), nil - case dto.MetricType_HISTOGRAM: + case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM: return extractHistogram(o, f), nil } return nil, fmt.Errorf("expfmt.extractSamples: unknown metric family type %v", f.GetType()) @@ -403,9 +403,13 @@ func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector { infSeen = true } + v := q.GetCumulativeCountFloat() + if v <= 0 { + v = float64(q.GetCumulativeCount()) + } samples = append(samples, &model.Sample{ Metric: model.Metric(lset), - Value: model.SampleValue(q.GetCumulativeCount()), + Value: model.SampleValue(v), Timestamp: timestamp, }) } @@ -428,9 +432,13 @@ func extractHistogram(o *DecodeOptions, f *dto.MetricFamily) model.Vector { } lset[model.MetricNameLabel] = model.LabelValue(f.GetName() + "_count") + v := m.Histogram.GetSampleCountFloat() + if v <= 0 { + v = float64(m.Histogram.GetSampleCount()) + } count := &model.Sample{ Metric: model.Metric(lset), - Value: model.SampleValue(m.Histogram.GetSampleCount()), + Value: model.SampleValue(v), Timestamp: timestamp, } samples = append(samples, count) diff --git a/vendor/github.com/prometheus/common/expfmt/expfmt.go b/vendor/github.com/prometheus/common/expfmt/expfmt.go index c34c7de432..4e4c13e724 100644 --- a/vendor/github.com/prometheus/common/expfmt/expfmt.go +++ b/vendor/github.com/prometheus/common/expfmt/expfmt.go @@ -45,6 +45,7 @@ const ( // The Content-Type values for the different wire protocols. Do not do direct // comparisons to these constants, instead use the comparison functions. + // // Deprecated: Use expfmt.NewFormat(expfmt.TypeUnknown) instead. FmtUnknown Format = `` // Deprecated: Use expfmt.NewFormat(expfmt.TypeTextPlain) instead. diff --git a/vendor/github.com/prometheus/common/expfmt/fuzz.go b/vendor/github.com/prometheus/common/expfmt/fuzz.go index 0290f6abc4..872c0c15b4 100644 --- a/vendor/github.com/prometheus/common/expfmt/fuzz.go +++ b/vendor/github.com/prometheus/common/expfmt/fuzz.go @@ -13,7 +13,6 @@ // Build only when actually fuzzing //go:build gofuzz -// +build gofuzz package expfmt diff --git a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go index 8dbf6d04ed..21b93bca36 100644 --- a/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go +++ b/vendor/github.com/prometheus/common/expfmt/openmetrics_create.go @@ -160,38 +160,38 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E n, err = w.WriteString("# HELP ") written += n if err != nil { - return + return written, err } n, err = writeName(w, compliantName) written += n if err != nil { - return + return written, err } err = w.WriteByte(' ') written++ if err != nil { - return + return written, err } n, err = writeEscapedString(w, *in.Help, true) written += n if err != nil { - return + return written, err } err = w.WriteByte('\n') written++ if err != nil { - return + return written, err } } n, err = w.WriteString("# TYPE ") written += n if err != nil { - return + return written, err } n, err = writeName(w, compliantName) written += n if err != nil { - return + return written, err } switch metricType { case dto.MetricType_COUNTER: @@ -208,39 +208,41 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E n, err = w.WriteString(" unknown\n") case dto.MetricType_HISTOGRAM: n, err = w.WriteString(" histogram\n") + case dto.MetricType_GAUGE_HISTOGRAM: + n, err = w.WriteString(" gaugehistogram\n") default: return written, fmt.Errorf("unknown metric type %s", metricType.String()) } written += n if err != nil { - return + return written, err } if toOM.withUnit && in.Unit != nil { n, err = w.WriteString("# UNIT ") written += n if err != nil { - return + return written, err } n, err = writeName(w, compliantName) written += n if err != nil { - return + return written, err } err = w.WriteByte(' ') written++ if err != nil { - return + return written, err } n, err = writeEscapedString(w, *in.Unit, true) written += n if err != nil { - return + return written, err } err = w.WriteByte('\n') written++ if err != nil { - return + return written, err } } @@ -304,7 +306,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E ) written += n if err != nil { - return + return written, err } } n, err = writeOpenMetricsSample( @@ -314,7 +316,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E ) written += n if err != nil { - return + return written, err } n, err = writeOpenMetricsSample( w, compliantName, "_count", metric, "", 0, @@ -325,7 +327,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E createdTsBytesWritten, err = writeOpenMetricsCreated(w, compliantName, "", metric, "", 0, metric.Summary.GetCreatedTimestamp()) n += createdTsBytesWritten } - case dto.MetricType_HISTOGRAM: + case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM: if metric.Histogram == nil { return written, fmt.Errorf( "expected histogram in metric %s %s", compliantName, metric, @@ -333,6 +335,12 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E } infSeen := false for _, b := range metric.Histogram.Bucket { + if b.GetCumulativeCountFloat() > 0 { + return written, fmt.Errorf( + "OpenMetrics v1.0 does not support float histogram %s %s", + compliantName, metric, + ) + } n, err = writeOpenMetricsSample( w, compliantName, "_bucket", metric, model.BucketLabel, b.GetUpperBound(), @@ -341,7 +349,7 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E ) written += n if err != nil { - return + return written, err } if math.IsInf(b.GetUpperBound(), +1) { infSeen = true @@ -354,9 +362,12 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E 0, metric.Histogram.GetSampleCount(), true, nil, ) + // We do not check for a float sample count here + // because we will check for it below (and error + // out if needed). written += n if err != nil { - return + return written, err } } n, err = writeOpenMetricsSample( @@ -366,7 +377,13 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E ) written += n if err != nil { - return + return written, err + } + if metric.Histogram.GetSampleCountFloat() > 0 { + return written, fmt.Errorf( + "OpenMetrics v1.0 does not support float histogram %s %s", + compliantName, metric, + ) } n, err = writeOpenMetricsSample( w, compliantName, "_count", metric, "", 0, @@ -384,10 +401,10 @@ func MetricFamilyToOpenMetrics(out io.Writer, in *dto.MetricFamily, options ...E } written += n if err != nil { - return + return written, err } } - return + return written, err } // FinalizeOpenMetrics writes the final `# EOF\n` line required by OpenMetrics. diff --git a/vendor/github.com/prometheus/common/expfmt/text_create.go b/vendor/github.com/prometheus/common/expfmt/text_create.go index c4e9c1bbc3..6b89781456 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_create.go +++ b/vendor/github.com/prometheus/common/expfmt/text_create.go @@ -108,38 +108,38 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e n, err = w.WriteString("# HELP ") written += n if err != nil { - return + return written, err } n, err = writeName(w, name) written += n if err != nil { - return + return written, err } err = w.WriteByte(' ') written++ if err != nil { - return + return written, err } n, err = writeEscapedString(w, *in.Help, false) written += n if err != nil { - return + return written, err } err = w.WriteByte('\n') written++ if err != nil { - return + return written, err } } n, err = w.WriteString("# TYPE ") written += n if err != nil { - return + return written, err } n, err = writeName(w, name) written += n if err != nil { - return + return written, err } metricType := in.GetType() switch metricType { @@ -151,14 +151,17 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e n, err = w.WriteString(" summary\n") case dto.MetricType_UNTYPED: n, err = w.WriteString(" untyped\n") - case dto.MetricType_HISTOGRAM: + case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM: + // The classic Prometheus text format has no notion of a gauge + // histogram. We render a gauge histogram in the same way as a + // regular histogram. n, err = w.WriteString(" histogram\n") default: return written, fmt.Errorf("unknown metric type %s", metricType.String()) } written += n if err != nil { - return + return written, err } // Finally the samples, one line for each. @@ -208,7 +211,7 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e ) written += n if err != nil { - return + return written, err } } n, err = writeSample( @@ -217,13 +220,13 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e ) written += n if err != nil { - return + return written, err } n, err = writeSample( w, name, "_count", metric, "", 0, float64(metric.Summary.GetSampleCount()), ) - case dto.MetricType_HISTOGRAM: + case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM: if metric.Histogram == nil { return written, fmt.Errorf( "expected histogram in metric %s %s", name, metric, @@ -231,28 +234,36 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e } infSeen := false for _, b := range metric.Histogram.Bucket { + v := b.GetCumulativeCountFloat() + if v == 0 { + v = float64(b.GetCumulativeCount()) + } n, err = writeSample( w, name, "_bucket", metric, model.BucketLabel, b.GetUpperBound(), - float64(b.GetCumulativeCount()), + v, ) written += n if err != nil { - return + return written, err } if math.IsInf(b.GetUpperBound(), +1) { infSeen = true } } if !infSeen { + v := metric.Histogram.GetSampleCountFloat() + if v == 0 { + v = float64(metric.Histogram.GetSampleCount()) + } n, err = writeSample( w, name, "_bucket", metric, model.BucketLabel, math.Inf(+1), - float64(metric.Histogram.GetSampleCount()), + v, ) written += n if err != nil { - return + return written, err } } n, err = writeSample( @@ -261,12 +272,13 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e ) written += n if err != nil { - return + return written, err } - n, err = writeSample( - w, name, "_count", metric, "", 0, - float64(metric.Histogram.GetSampleCount()), - ) + v := metric.Histogram.GetSampleCountFloat() + if v == 0 { + v = float64(metric.Histogram.GetSampleCount()) + } + n, err = writeSample(w, name, "_count", metric, "", 0, v) default: return written, fmt.Errorf( "unexpected type in metric %s %s", name, metric, @@ -274,10 +286,10 @@ func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err e } written += n if err != nil { - return + return written, err } } - return + return written, err } // writeSample writes a single sample in text format to w, given the metric diff --git a/vendor/github.com/prometheus/common/expfmt/text_parse.go b/vendor/github.com/prometheus/common/expfmt/text_parse.go index 8f2edde324..00c8841a10 100644 --- a/vendor/github.com/prometheus/common/expfmt/text_parse.go +++ b/vendor/github.com/prometheus/common/expfmt/text_parse.go @@ -48,8 +48,10 @@ func (e ParseError) Error() string { return fmt.Sprintf("text format parsing error in line %d: %s", e.Line, e.Msg) } -// TextParser is used to parse the simple and flat text-based exchange format. Its -// zero value is ready to use. +// TextParser is used to parse the simple and flat text-based exchange format. +// +// TextParser instances must be created with NewTextParser, the zero value of +// TextParser is invalid. type TextParser struct { metricFamiliesByName map[string]*dto.MetricFamily buf *bufio.Reader // Where the parsed input is read through. @@ -129,9 +131,44 @@ func (p *TextParser) TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricF if p.err != nil && errors.Is(p.err, io.EOF) { p.parseError("unexpected end of input stream") } + for _, histogramMetric := range p.histograms { + normalizeHistogram(histogramMetric.GetHistogram()) + } return p.metricFamiliesByName, p.err } +// normalizeHistogram makes sure that all the buckets and the count in each +// histogram is either completely float or completely integer. +func normalizeHistogram(histogram *dto.Histogram) { + if histogram == nil { + return + } + anyFloats := false + if histogram.GetSampleCountFloat() != 0 { + anyFloats = true + } else { + for _, b := range histogram.GetBucket() { + if b.GetCumulativeCountFloat() != 0 { + anyFloats = true + break + } + } + } + if !anyFloats { + return + } + if histogram.GetSampleCountFloat() == 0 { + histogram.SampleCountFloat = proto.Float64(float64(histogram.GetSampleCount())) + histogram.SampleCount = nil + } + for _, b := range histogram.GetBucket() { + if b.GetCumulativeCountFloat() == 0 { + b.CumulativeCountFloat = proto.Float64(float64(b.GetCumulativeCount())) + b.CumulativeCount = nil + } + } +} + func (p *TextParser) reset(in io.Reader) { p.metricFamiliesByName = map[string]*dto.MetricFamily{} p.currentLabelPairs = nil @@ -281,7 +318,9 @@ func (p *TextParser) readingLabels() stateFn { // Summaries/histograms are special. We have to reset the // currentLabels map, currentQuantile and currentBucket before starting to // read labels. - if p.currentMF.GetType() == dto.MetricType_SUMMARY || p.currentMF.GetType() == dto.MetricType_HISTOGRAM { + if p.currentMF.GetType() == dto.MetricType_SUMMARY || + p.currentMF.GetType() == dto.MetricType_HISTOGRAM || + p.currentMF.GetType() == dto.MetricType_GAUGE_HISTOGRAM { p.currentLabels = map[string]string{} p.currentLabels[string(model.MetricNameLabel)] = p.currentMF.GetName() p.currentQuantile = math.NaN() @@ -374,7 +413,9 @@ func (p *TextParser) startLabelName() stateFn { // Special summary/histogram treatment. Don't add 'quantile' and 'le' // labels to 'real' labels. if (p.currentMF.GetType() != dto.MetricType_SUMMARY || p.currentLabelPair.GetName() != model.QuantileLabel) && - (p.currentMF.GetType() != dto.MetricType_HISTOGRAM || p.currentLabelPair.GetName() != model.BucketLabel) { + ((p.currentMF.GetType() != dto.MetricType_HISTOGRAM && + p.currentMF.GetType() != dto.MetricType_GAUGE_HISTOGRAM) || + p.currentLabelPair.GetName() != model.BucketLabel) { p.currentLabelPairs = append(p.currentLabelPairs, p.currentLabelPair) } // Check for duplicate label names. @@ -425,7 +466,7 @@ func (p *TextParser) startLabelValue() stateFn { } } // Similar special treatment of histograms. - if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { + if p.currentMF.GetType() == dto.MetricType_HISTOGRAM || p.currentMF.GetType() == dto.MetricType_GAUGE_HISTOGRAM { if p.currentLabelPair.GetName() == model.BucketLabel { if p.currentBucket, p.err = parseFloat(p.currentLabelPair.GetValue()); p.err != nil { // Create a more helpful error message. @@ -476,7 +517,7 @@ func (p *TextParser) readingValue() stateFn { p.summaries[signature] = p.currentMetric p.currentMF.Metric = append(p.currentMF.Metric, p.currentMetric) } - case dto.MetricType_HISTOGRAM: + case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM: signature := model.LabelsToSignature(p.currentLabels) if histogram := p.histograms[signature]; histogram != nil { p.currentMetric = histogram @@ -522,24 +563,38 @@ func (p *TextParser) readingValue() stateFn { }, ) } - case dto.MetricType_HISTOGRAM: + case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM: // *sigh* if p.currentMetric.Histogram == nil { p.currentMetric.Histogram = &dto.Histogram{} } switch { case p.currentIsHistogramCount: - p.currentMetric.Histogram.SampleCount = proto.Uint64(uint64(value)) + if uintValue := uint64(value); value == float64(uintValue) { + p.currentMetric.Histogram.SampleCount = proto.Uint64(uintValue) + } else { + if value < 0 { + p.parseError(fmt.Sprintf("negative count for histogram %q", p.currentMF.GetName())) + return nil + } + p.currentMetric.Histogram.SampleCountFloat = proto.Float64(value) + } case p.currentIsHistogramSum: p.currentMetric.Histogram.SampleSum = proto.Float64(value) case !math.IsNaN(p.currentBucket): - p.currentMetric.Histogram.Bucket = append( - p.currentMetric.Histogram.Bucket, - &dto.Bucket{ - UpperBound: proto.Float64(p.currentBucket), - CumulativeCount: proto.Uint64(uint64(value)), - }, - ) + b := &dto.Bucket{ + UpperBound: proto.Float64(p.currentBucket), + } + if uintValue := uint64(value); value == float64(uintValue) { + b.CumulativeCount = proto.Uint64(uintValue) + } else { + if value < 0 { + p.parseError(fmt.Sprintf("negative bucket population for histogram %q", p.currentMF.GetName())) + return nil + } + b.CumulativeCountFloat = proto.Float64(value) + } + p.currentMetric.Histogram.Bucket = append(p.currentMetric.Histogram.Bucket, b) } default: p.err = fmt.Errorf("unexpected type for metric name %q", p.currentMF.GetName()) @@ -602,10 +657,18 @@ func (p *TextParser) readingType() stateFn { if p.readTokenUntilNewline(false); p.err != nil { return nil // Unexpected end of input. } - metricType, ok := dto.MetricType_value[strings.ToUpper(p.currentToken.String())] + typ := strings.ToUpper(p.currentToken.String()) // Tolerate any combination of upper and lower case. + metricType, ok := dto.MetricType_value[typ] // Tolerate "gauge_histogram" (not originally part of the text format). if !ok { - p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String())) - return nil + // We also want to tolerate "gaugehistogram" to mark a gauge + // histogram, because that string is used in OpenMetrics. Note, + // however, that gauge histograms do not officially exist in the + // classic text format. + if typ != "GAUGEHISTOGRAM" { + p.parseError(fmt.Sprintf("unknown metric type %q", p.currentToken.String())) + return nil + } + metricType = int32(dto.MetricType_GAUGE_HISTOGRAM) } p.currentMF.Type = dto.MetricType(metricType).Enum() return p.startOfLine @@ -855,7 +918,8 @@ func (p *TextParser) setOrCreateCurrentMF() { } histogramName := histogramMetricName(name) if p.currentMF = p.metricFamiliesByName[histogramName]; p.currentMF != nil { - if p.currentMF.GetType() == dto.MetricType_HISTOGRAM { + if p.currentMF.GetType() == dto.MetricType_HISTOGRAM || + p.currentMF.GetType() == dto.MetricType_GAUGE_HISTOGRAM { if isCount(name) { p.currentIsHistogramCount = true } diff --git a/vendor/github.com/prometheus/procfs/.golangci.yml b/vendor/github.com/prometheus/procfs/.golangci.yml index 3c3bf910fd..23ecd4505b 100644 --- a/vendor/github.com/prometheus/procfs/.golangci.yml +++ b/vendor/github.com/prometheus/procfs/.golangci.yml @@ -1,7 +1,9 @@ version: "2" linters: enable: + - errorlint - forbidigo + - gocritic - godot - misspell - revive @@ -11,6 +13,20 @@ linters: forbid: - pattern: ^fmt\.Print.*$ msg: Do not commit print statements. + gocritic: + enable-all: true + disabled-checks: + - commentFormatting + - commentedOutCode + - deferInLoop + - filepathJoin + - hugeParam + - importShadow + - paramTypeCombine + - rangeValCopy + - tooManyResultsChecker + - unnamedResult + - whyNoLint godot: exclude: # Ignore "See: URL". @@ -19,16 +35,12 @@ linters: misspell: locale: US exclusions: - generated: lax presets: - comments - common-false-positives - legacy - std-error-handling - paths: - - third_party$ - - builtin$ - - examples$ + warn-unused: true formatters: enable: - gofmt @@ -37,9 +49,3 @@ formatters: goimports: local-prefixes: - github.com/prometheus/procfs - exclusions: - generated: lax - paths: - - third_party$ - - builtin$ - - examples$ diff --git a/vendor/github.com/prometheus/procfs/Makefile b/vendor/github.com/prometheus/procfs/Makefile index 7edfe4d093..bce50a19c5 100644 --- a/vendor/github.com/prometheus/procfs/Makefile +++ b/vendor/github.com/prometheus/procfs/Makefile @@ -1,4 +1,4 @@ -# Copyright 2018 The Prometheus Authors +# Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/Makefile.common b/vendor/github.com/prometheus/procfs/Makefile.common index 0ed55c2ba2..6f61bec48f 100644 --- a/vendor/github.com/prometheus/procfs/Makefile.common +++ b/vendor/github.com/prometheus/procfs/Makefile.common @@ -33,7 +33,7 @@ GOHOSTOS ?= $(shell $(GO) env GOHOSTOS) GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH) GO_VERSION ?= $(shell $(GO) version) -GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))Error Parsing File +GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.') PROMU := $(FIRST_GOPATH)/bin/promu @@ -61,7 +61,8 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_ SKIP_GOLANGCI_LINT := GOLANGCI_LINT := GOLANGCI_LINT_OPTS ?= -GOLANGCI_LINT_VERSION ?= v2.0.2 +GOLANGCI_LINT_VERSION ?= v2.1.5 +GOLANGCI_FMT_OPTS ?= # golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64. # windows isn't included here because of the path separator being different. ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) @@ -138,7 +139,7 @@ common-deps: update-go-deps: @echo ">> updating Go dependencies" @for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \ - $(GO) get -d $$m; \ + $(GO) get $$m; \ done $(GO) mod tidy @@ -156,9 +157,13 @@ $(GOTEST_DIR): @mkdir -p $@ .PHONY: common-format -common-format: +common-format: $(GOLANGCI_LINT) @echo ">> formatting code" $(GO) fmt $(pkgs) +ifdef GOLANGCI_LINT + @echo ">> formatting code with golangci-lint" + $(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS) +endif .PHONY: common-vet common-vet: @@ -248,8 +253,8 @@ $(PROMU): cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu rm -r $(PROMU_TMP) -.PHONY: proto -proto: +.PHONY: common-proto +common-proto: @echo ">> generating code from proto files" @./scripts/genproto.sh diff --git a/vendor/github.com/prometheus/procfs/arp.go b/vendor/github.com/prometheus/procfs/arp.go index 2e53344151..716bdef109 100644 --- a/vendor/github.com/prometheus/procfs/arp.go +++ b/vendor/github.com/prometheus/procfs/arp.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 @@ -73,15 +73,16 @@ func parseARPEntries(data []byte) ([]ARPEntry, error) { columns := strings.Fields(line) width := len(columns) - if width == expectedHeaderWidth || width == 0 { + switch width { + case expectedHeaderWidth, 0: continue - } else if width == expectedDataWidth { + case expectedDataWidth: entry, err := parseARPEntry(columns) if err != nil { return []ARPEntry{}, fmt.Errorf("%w: Failed to parse ARP entry: %v: %w", ErrFileParse, entry, err) } entries = append(entries, entry) - } else { + default: return []ARPEntry{}, fmt.Errorf("%w: %d columns found, but expected %d: %w", ErrFileParse, width, expectedDataWidth, err) } diff --git a/vendor/github.com/prometheus/procfs/buddyinfo.go b/vendor/github.com/prometheus/procfs/buddyinfo.go index 8380750090..53243e6875 100644 --- a/vendor/github.com/prometheus/procfs/buddyinfo.go +++ b/vendor/github.com/prometheus/procfs/buddyinfo.go @@ -1,4 +1,4 @@ -// Copyright 2017 The Prometheus Authors +// Copyright The Prometheus 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 @@ -64,14 +64,12 @@ func parseBuddyInfo(r io.Reader) ([]BuddyInfo, error) { if bucketCount == -1 { bucketCount = arraySize - } else { - if bucketCount != arraySize { - return nil, fmt.Errorf("%w: mismatch in number of buddyinfo buckets, previous count %d, new count %d", ErrFileParse, bucketCount, arraySize) - } + } else if bucketCount != arraySize { + return nil, fmt.Errorf("%w: mismatch in number of buddyinfo buckets, previous count %d, new count %d", ErrFileParse, bucketCount, arraySize) } sizes := make([]float64, arraySize) - for i := 0; i < arraySize; i++ { + for i := range arraySize { sizes[i], err = strconv.ParseFloat(parts[i+4], 64) if err != nil { return nil, fmt.Errorf("%w: Invalid valid in buddyinfo: %f: %w", ErrFileParse, sizes[i], err) diff --git a/vendor/github.com/prometheus/procfs/cmdline.go b/vendor/github.com/prometheus/procfs/cmdline.go index bf4f3b48c0..4f1cac1f0a 100644 --- a/vendor/github.com/prometheus/procfs/cmdline.go +++ b/vendor/github.com/prometheus/procfs/cmdline.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go index f0950bb495..5fe6cecd3d 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_armx.go b/vendor/github.com/prometheus/procfs/cpuinfo_armx.go index 64cfd534c1..8f155551e5 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_armx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_armx.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go b/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go index d88442f0ed..e81a5db949 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_loong64.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go b/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go index c11207f3ab..4be2b1cc54 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_others.go b/vendor/github.com/prometheus/procfs/cpuinfo_others.go index a6b2b3127c..e713bae8df 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_others.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_others.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go b/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go index 003bc2ad4a..0825aa1a83 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go index 1c9b7313b6..496770b05f 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go b/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go index fa3686bc00..b3228ce3d8 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_s390x.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_x86.go b/vendor/github.com/prometheus/procfs/cpuinfo_x86.go index a0ef55562e..575eb022eb 100644 --- a/vendor/github.com/prometheus/procfs/cpuinfo_x86.go +++ b/vendor/github.com/prometheus/procfs/cpuinfo_x86.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/crypto.go b/vendor/github.com/prometheus/procfs/crypto.go index 5f2a37a78b..e4a5876eaf 100644 --- a/vendor/github.com/prometheus/procfs/crypto.go +++ b/vendor/github.com/prometheus/procfs/crypto.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/doc.go b/vendor/github.com/prometheus/procfs/doc.go index f9d961e441..26bfea071b 100644 --- a/vendor/github.com/prometheus/procfs/doc.go +++ b/vendor/github.com/prometheus/procfs/doc.go @@ -1,4 +1,4 @@ -// Copyright 2014 Prometheus Team +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/fs.go b/vendor/github.com/prometheus/procfs/fs.go index 9bdaccc7c8..8f27912a13 100644 --- a/vendor/github.com/prometheus/procfs/fs.go +++ b/vendor/github.com/prometheus/procfs/fs.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/fs_statfs_notype.go b/vendor/github.com/prometheus/procfs/fs_statfs_notype.go index 1b5bdbdf84..3c53023c54 100644 --- a/vendor/github.com/prometheus/procfs/fs_statfs_notype.go +++ b/vendor/github.com/prometheus/procfs/fs_statfs_notype.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/fs_statfs_type.go b/vendor/github.com/prometheus/procfs/fs_statfs_type.go index 80df79c319..80fce48478 100644 --- a/vendor/github.com/prometheus/procfs/fs_statfs_type.go +++ b/vendor/github.com/prometheus/procfs/fs_statfs_type.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/fscache.go b/vendor/github.com/prometheus/procfs/fscache.go index 7db8633077..9dde857073 100644 --- a/vendor/github.com/prometheus/procfs/fscache.go +++ b/vendor/github.com/prometheus/procfs/fscache.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 @@ -388,20 +388,21 @@ func parseFscacheinfo(r io.Reader) (*Fscacheinfo, error) { } } case "CacheOp:": - if strings.Split(fields[1], "=")[0] == "alo" { + switch strings.Split(fields[1], "=")[0] { + case "alo": err := setFSCacheFields(fields[1:], &m.CacheopAllocationsinProgress, &m.CacheopLookupObjectInProgress, &m.CacheopLookupCompleteInPorgress, &m.CacheopGrabObjectInProgress) if err != nil { return &m, err } - } else if strings.Split(fields[1], "=")[0] == "inv" { + case "inv": err := setFSCacheFields(fields[1:], &m.CacheopInvalidations, &m.CacheopUpdateObjectInProgress, &m.CacheopDropObjectInProgress, &m.CacheopPutObjectInProgress, &m.CacheopAttributeChangeInProgress, &m.CacheopSyncCacheInProgress) if err != nil { return &m, err } - } else { + default: err := setFSCacheFields(fields[1:], &m.CacheopReadOrAllocPageInProgress, &m.CacheopReadOrAllocPagesInProgress, &m.CacheopAllocatePageInProgress, &m.CacheopAllocatePagesInProgress, &m.CacheopWritePagesInProgress, &m.CacheopUncachePagesInProgress, &m.CacheopDissociatePagesInProgress) diff --git a/vendor/github.com/prometheus/procfs/internal/fs/fs.go b/vendor/github.com/prometheus/procfs/internal/fs/fs.go index 3a43e83915..e7ccad66b2 100644 --- a/vendor/github.com/prometheus/procfs/internal/fs/fs.go +++ b/vendor/github.com/prometheus/procfs/internal/fs/fs.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/internal/util/parse.go b/vendor/github.com/prometheus/procfs/internal/util/parse.go index 5a7d2df06a..30c5872019 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/parse.go +++ b/vendor/github.com/prometheus/procfs/internal/util/parse.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/internal/util/readfile.go b/vendor/github.com/prometheus/procfs/internal/util/readfile.go index 71b7a70ebd..0e41f71af1 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/readfile.go +++ b/vendor/github.com/prometheus/procfs/internal/util/readfile.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go index d5404a6d72..8318d8dfd5 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go +++ b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go index 1d86f5e63f..15bb096ee2 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go +++ b/vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/internal/util/valueparser.go b/vendor/github.com/prometheus/procfs/internal/util/valueparser.go index fe2355d3c6..e0ed671ea0 100644 --- a/vendor/github.com/prometheus/procfs/internal/util/valueparser.go +++ b/vendor/github.com/prometheus/procfs/internal/util/valueparser.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/ipvs.go b/vendor/github.com/prometheus/procfs/ipvs.go index bc3a20c932..5374da9fa8 100644 --- a/vendor/github.com/prometheus/procfs/ipvs.go +++ b/vendor/github.com/prometheus/procfs/ipvs.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/kernel_hung.go b/vendor/github.com/prometheus/procfs/kernel_hung.go new file mode 100644 index 0000000000..539c111514 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/kernel_hung.go @@ -0,0 +1,45 @@ +// Copyright The Prometheus 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. + +//go:build !windows +// +build !windows + +package procfs + +import ( + "os" + "strconv" + "strings" +) + +// KernelHung contains information about to the kernel's hung_task_detect_count number. +type KernelHung struct { + // Indicates the total number of tasks that have been detected as hung since the system boot. + // This file shows up if `CONFIG_DETECT_HUNG_TASK` is enabled. + HungTaskDetectCount *uint64 +} + +// KernelHung returns values from /proc/sys/kernel/hung_task_detect_count. +func (fs FS) KernelHung() (KernelHung, error) { + data, err := os.ReadFile(fs.proc.Path("sys", "kernel", "hung_task_detect_count")) + if err != nil { + return KernelHung{}, err + } + val, err := strconv.ParseUint(strings.TrimSpace(string(data)), 10, 64) + if err != nil { + return KernelHung{}, err + } + return KernelHung{ + HungTaskDetectCount: &val, + }, nil +} diff --git a/vendor/github.com/prometheus/procfs/kernel_random.go b/vendor/github.com/prometheus/procfs/kernel_random.go index db88566bdf..b66565a104 100644 --- a/vendor/github.com/prometheus/procfs/kernel_random.go +++ b/vendor/github.com/prometheus/procfs/kernel_random.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/loadavg.go b/vendor/github.com/prometheus/procfs/loadavg.go index 332e76c17f..c8c78a65ed 100644 --- a/vendor/github.com/prometheus/procfs/loadavg.go +++ b/vendor/github.com/prometheus/procfs/loadavg.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/mdstat.go b/vendor/github.com/prometheus/procfs/mdstat.go index 67a9d2b448..d66eeda82a 100644 --- a/vendor/github.com/prometheus/procfs/mdstat.go +++ b/vendor/github.com/prometheus/procfs/mdstat.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -27,13 +27,34 @@ var ( recoveryLinePctRE = regexp.MustCompile(`= (.+)%`) recoveryLineFinishRE = regexp.MustCompile(`finish=(.+)min`) recoveryLineSpeedRE = regexp.MustCompile(`speed=(.+)[A-Z]`) - componentDeviceRE = regexp.MustCompile(`(.*)\[\d+\]`) + componentDeviceRE = regexp.MustCompile(`(.*)\[(\d+)\](\([SF]+\))?`) + personalitiesPrefix = "Personalities : " ) +type MDStatComponent struct { + // Name of the component device. + Name string + // DescriptorIndex number of component device, e.g. the order in the superblock. + DescriptorIndex int32 + // Flags per Linux drivers/md/md.[ch] as of v6.12-rc1 + // Subset that are exposed in mdstat + WriteMostly bool + Journal bool + Faulty bool // "Faulty" is what kernel source uses for "(F)" + Spare bool + Replacement bool + // Some additional flags that are NOT exposed in procfs today; they may + // be available via sysfs. + // In_sync, Bitmap_sync, Blocked, WriteErrorSeen, FaultRecorded, + // BlockedBadBlocks, WantReplacement, Candidate, ... +} + // MDStat holds info parsed from /proc/mdstat. type MDStat struct { // Name of the device. Name string + // raid type of the device. + Type string // activity-state of the device. ActivityState string // Number of active disks. @@ -58,8 +79,8 @@ type MDStat struct { BlocksSyncedFinishTime float64 // current sync speed (in Kilobytes/sec) BlocksSyncedSpeed float64 - // Name of md component devices - Devices []string + // component devices + Devices []MDStatComponent } // MDStat parses an mdstat-file (/proc/mdstat) and returns a slice of @@ -80,28 +101,52 @@ func (fs FS) MDStat() ([]MDStat, error) { // parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of // structs containing the relevant info. func parseMDStat(mdStatData []byte) ([]MDStat, error) { + // TODO: + // - parse global hotspares from the "unused devices" line. mdStats := []MDStat{} lines := strings.Split(string(mdStatData), "\n") + knownRaidTypes := make(map[string]bool) for i, line := range lines { if strings.TrimSpace(line) == "" || line[0] == ' ' || - strings.HasPrefix(line, "Personalities") || strings.HasPrefix(line, "unused") { continue } + // Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] + if len(knownRaidTypes) == 0 && strings.HasPrefix(line, personalitiesPrefix) { + personalities := strings.Fields(line[len(personalitiesPrefix):]) + for _, word := range personalities { + word := word[1 : len(word)-1] + knownRaidTypes[word] = true + } + continue + } deviceFields := strings.Fields(line) if len(deviceFields) < 3 { return nil, fmt.Errorf("%w: Expected 3+ lines, got %q", ErrFileParse, line) } mdName := deviceFields[0] // mdx - state := deviceFields[2] // active or inactive + state := deviceFields[2] // active, inactive, broken + + mdType := "unknown" // raid1, raid5, etc. + var deviceStartIndex int + if len(deviceFields) > 3 { // mdType may be in the 3rd or 4th field + if isRaidType(deviceFields[3], knownRaidTypes) { + mdType = deviceFields[3] + deviceStartIndex = 4 + } else if len(deviceFields) > 4 && isRaidType(deviceFields[4], knownRaidTypes) { + // if the 3rd field is (...), the 4th field is the mdType + mdType = deviceFields[4] + deviceStartIndex = 5 + } + } if len(lines) <= i+3 { return nil, fmt.Errorf("%w: Too few lines for md device: %q", ErrFileParse, mdName) } - // Failed disks have the suffix (F) & Spare disks have the suffix (S). + // Failed (Faulty) disks have the suffix (F) & Spare disks have the suffix (S). fail := int64(strings.Count(line, "(F)")) spare := int64(strings.Count(line, "(S)")) active, total, down, size, err := evalStatusLine(lines[i], lines[i+1]) @@ -123,16 +168,20 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { finish := float64(0) pct := float64(0) recovering := strings.Contains(lines[syncLineIdx], "recovery") + reshaping := strings.Contains(lines[syncLineIdx], "reshape") resyncing := strings.Contains(lines[syncLineIdx], "resync") checking := strings.Contains(lines[syncLineIdx], "check") // Append recovery and resyncing state info. - if recovering || resyncing || checking { - if recovering { + if recovering || resyncing || checking || reshaping { + switch { + case recovering: state = "recovering" - } else if checking { + case reshaping: + state = "reshaping" + case checking: state = "checking" - } else { + default: state = "resyncing" } @@ -148,8 +197,14 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { } } + devices, err := evalComponentDevices(deviceFields[deviceStartIndex:]) + if err != nil { + return nil, fmt.Errorf("error parsing components in md device %q: %w", mdName, err) + } + mdStats = append(mdStats, MDStat{ Name: mdName, + Type: mdType, ActivityState: state, DisksActive: active, DisksFailed: fail, @@ -162,14 +217,24 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) { BlocksSyncedPct: pct, BlocksSyncedFinishTime: finish, BlocksSyncedSpeed: speed, - Devices: evalComponentDevices(deviceFields), + Devices: devices, }) } return mdStats, nil } +// check if a string's format is like the mdType +// Rule 1: mdType should not be like (...) +// Rule 2: mdType should not be like sda[0] +// . +func isRaidType(mdType string, knownRaidTypes map[string]bool) bool { + _, ok := knownRaidTypes[mdType] + return !strings.ContainsAny(mdType, "([") && ok +} + func evalStatusLine(deviceLine, statusLine string) (active, total, down, size int64, err error) { + // e.g. 523968 blocks super 1.2 [4/4] [UUUU] statusFields := strings.Fields(statusLine) if len(statusFields) < 1 { return 0, 0, 0, 0, fmt.Errorf("%w: Unexpected statusline %q: %w", ErrFileParse, statusLine, err) @@ -260,17 +325,29 @@ func evalRecoveryLine(recoveryLine string) (blocksSynced int64, blocksToBeSynced return blocksSynced, blocksToBeSynced, pct, finish, speed, nil } -func evalComponentDevices(deviceFields []string) []string { - mdComponentDevices := make([]string, 0) - if len(deviceFields) > 3 { - for _, field := range deviceFields[4:] { - match := componentDeviceRE.FindStringSubmatch(field) - if match == nil { - continue - } - mdComponentDevices = append(mdComponentDevices, match[1]) +func evalComponentDevices(deviceFields []string) ([]MDStatComponent, error) { + mdComponentDevices := make([]MDStatComponent, 0) + for _, field := range deviceFields { + match := componentDeviceRE.FindStringSubmatch(field) + if match == nil { + continue + } + descriptorIndex, err := strconv.ParseInt(match[2], 10, 32) + if err != nil { + return mdComponentDevices, fmt.Errorf("error parsing int from device %q: %w", match[2], err) } + mdComponentDevices = append(mdComponentDevices, MDStatComponent{ + Name: match[1], + DescriptorIndex: int32(descriptorIndex), + // match may contain one or more of these + // https://github.com/torvalds/linux/blob/7ec462100ef9142344ddbf86f2c3008b97acddbe/drivers/md/md.c#L8376-L8392 + Faulty: strings.Contains(match[3], "(F)"), + Spare: strings.Contains(match[3], "(S)"), + Journal: strings.Contains(match[3], "(J)"), + Replacement: strings.Contains(match[3], "(R)"), + WriteMostly: strings.Contains(match[3], "(W)"), + }) } - return mdComponentDevices + return mdComponentDevices, nil } diff --git a/vendor/github.com/prometheus/procfs/meminfo.go b/vendor/github.com/prometheus/procfs/meminfo.go index 4b2c4050a3..3420383187 100644 --- a/vendor/github.com/prometheus/procfs/meminfo.go +++ b/vendor/github.com/prometheus/procfs/meminfo.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 @@ -66,6 +66,10 @@ type Meminfo struct { // Memory which has been evicted from RAM, and is temporarily // on the disk SwapFree *uint64 + // Memory consumed by the zswap backend (compressed size) + Zswap *uint64 + // Amount of anonymous memory stored in zswap (original size) + Zswapped *uint64 // Memory which is waiting to get written back to the disk Dirty *uint64 // Memory which is actively being written back to the disk @@ -85,6 +89,8 @@ type Meminfo struct { // amount of memory dedicated to the lowest level of page // tables. PageTables *uint64 + // secondary page tables. + SecPageTables *uint64 // NFS pages sent to the server, but not yet committed to // stable storage NFSUnstable *uint64 @@ -129,15 +135,18 @@ type Meminfo struct { Percpu *uint64 HardwareCorrupted *uint64 AnonHugePages *uint64 + FileHugePages *uint64 ShmemHugePages *uint64 ShmemPmdMapped *uint64 CmaTotal *uint64 CmaFree *uint64 + Unaccepted *uint64 HugePagesTotal *uint64 HugePagesFree *uint64 HugePagesRsvd *uint64 HugePagesSurp *uint64 Hugepagesize *uint64 + Hugetlb *uint64 DirectMap4k *uint64 DirectMap2M *uint64 DirectMap1G *uint64 @@ -161,6 +170,8 @@ type Meminfo struct { MlockedBytes *uint64 SwapTotalBytes *uint64 SwapFreeBytes *uint64 + ZswapBytes *uint64 + ZswappedBytes *uint64 DirtyBytes *uint64 WritebackBytes *uint64 AnonPagesBytes *uint64 @@ -171,6 +182,7 @@ type Meminfo struct { SUnreclaimBytes *uint64 KernelStackBytes *uint64 PageTablesBytes *uint64 + SecPageTablesBytes *uint64 NFSUnstableBytes *uint64 BounceBytes *uint64 WritebackTmpBytes *uint64 @@ -182,11 +194,14 @@ type Meminfo struct { PercpuBytes *uint64 HardwareCorruptedBytes *uint64 AnonHugePagesBytes *uint64 + FileHugePagesBytes *uint64 ShmemHugePagesBytes *uint64 ShmemPmdMappedBytes *uint64 CmaTotalBytes *uint64 CmaFreeBytes *uint64 + UnacceptedBytes *uint64 HugepagesizeBytes *uint64 + HugetlbBytes *uint64 DirectMap4kBytes *uint64 DirectMap2MBytes *uint64 DirectMap1GBytes *uint64 @@ -287,6 +302,12 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "SwapFree:": m.SwapFree = &val m.SwapFreeBytes = &valBytes + case "Zswap:": + m.Zswap = &val + m.ZswapBytes = &valBytes + case "Zswapped:": + m.Zswapped = &val + m.ZswappedBytes = &valBytes case "Dirty:": m.Dirty = &val m.DirtyBytes = &valBytes @@ -317,6 +338,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "PageTables:": m.PageTables = &val m.PageTablesBytes = &valBytes + case "SecPageTables:": + m.SecPageTables = &val + m.SecPageTablesBytes = &valBytes case "NFS_Unstable:": m.NFSUnstable = &val m.NFSUnstableBytes = &valBytes @@ -350,6 +374,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "AnonHugePages:": m.AnonHugePages = &val m.AnonHugePagesBytes = &valBytes + case "FileHugePages:": + m.FileHugePages = &val + m.FileHugePagesBytes = &valBytes case "ShmemHugePages:": m.ShmemHugePages = &val m.ShmemHugePagesBytes = &valBytes @@ -362,6 +389,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "CmaFree:": m.CmaFree = &val m.CmaFreeBytes = &valBytes + case "Unaccepted:": + m.Unaccepted = &val + m.UnacceptedBytes = &valBytes case "HugePages_Total:": m.HugePagesTotal = &val case "HugePages_Free:": @@ -373,6 +403,9 @@ func parseMemInfo(r io.Reader) (*Meminfo, error) { case "Hugepagesize:": m.Hugepagesize = &val m.HugepagesizeBytes = &valBytes + case "Hugetlb:": + m.Hugetlb = &val + m.HugetlbBytes = &valBytes case "DirectMap4k:": m.DirectMap4k = &val m.DirectMap4kBytes = &valBytes diff --git a/vendor/github.com/prometheus/procfs/mountinfo.go b/vendor/github.com/prometheus/procfs/mountinfo.go index a704c5e735..9414a12f42 100644 --- a/vendor/github.com/prometheus/procfs/mountinfo.go +++ b/vendor/github.com/prometheus/procfs/mountinfo.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 @@ -147,8 +147,7 @@ func mountOptionsParseOptionalFields(o []string) (map[string]string, error) { // mountOptionsParser parses the mount options, superblock options. func mountOptionsParser(mountOptions string) map[string]string { opts := make(map[string]string) - options := strings.Split(mountOptions, ",") - for _, opt := range options { + for opt := range strings.SplitSeq(mountOptions, ",") { splitOption := strings.Split(opt, "=") if len(splitOption) < 2 { key := splitOption[0] @@ -178,3 +177,21 @@ func GetProcMounts(pid int) ([]*MountInfo, error) { } return parseMountInfo(data) } + +// GetMounts retrieves mountinfo information from `/proc/self/mountinfo`. +func (fs FS) GetMounts() ([]*MountInfo, error) { + data, err := util.ReadFileNoStat(fs.proc.Path("self/mountinfo")) + if err != nil { + return nil, err + } + return parseMountInfo(data) +} + +// GetProcMounts retrieves mountinfo information from a processes' `/proc//mountinfo`. +func (fs FS) GetProcMounts(pid int) ([]*MountInfo, error) { + data, err := util.ReadFileNoStat(fs.proc.Path(fmt.Sprintf("%d/mountinfo", pid))) + if err != nil { + return nil, err + } + return parseMountInfo(data) +} diff --git a/vendor/github.com/prometheus/procfs/mountstats.go b/vendor/github.com/prometheus/procfs/mountstats.go index 50caa73274..e503cb3a6c 100644 --- a/vendor/github.com/prometheus/procfs/mountstats.go +++ b/vendor/github.com/prometheus/procfs/mountstats.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -383,7 +383,7 @@ func parseMountStatsNFS(s *bufio.Scanner, statVersion string) (*MountStatsNFS, e if stats.Opts == nil { stats.Opts = map[string]string{} } - for _, opt := range strings.Split(ss[1], ",") { + for opt := range strings.SplitSeq(ss[1], ",") { split := strings.Split(opt, "=") if len(split) == 2 { stats.Opts[split[0]] = split[1] diff --git a/vendor/github.com/prometheus/procfs/net_conntrackstat.go b/vendor/github.com/prometheus/procfs/net_conntrackstat.go index 316df5fbb7..e9ca357079 100644 --- a/vendor/github.com/prometheus/procfs/net_conntrackstat.go +++ b/vendor/github.com/prometheus/procfs/net_conntrackstat.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_dev.go b/vendor/github.com/prometheus/procfs/net_dev.go index e66208aa05..7b3e1d61c9 100644 --- a/vendor/github.com/prometheus/procfs/net_dev.go +++ b/vendor/github.com/prometheus/procfs/net_dev.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_dev_snmp6.go b/vendor/github.com/prometheus/procfs/net_dev_snmp6.go index f50b38e352..2a0f60f29f 100644 --- a/vendor/github.com/prometheus/procfs/net_dev_snmp6.go +++ b/vendor/github.com/prometheus/procfs/net_dev_snmp6.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -18,6 +18,7 @@ import ( "errors" "io" "os" + "path/filepath" "strconv" "strings" ) @@ -56,7 +57,9 @@ func newNetDevSNMP6(dir string) (NetDevSNMP6, error) { } for _, iFaceFile := range ifaceFiles { - f, err := os.Open(dir + "/" + iFaceFile.Name()) + filePath := filepath.Join(dir, iFaceFile.Name()) + + f, err := os.Open(filePath) if err != nil { return netDevSNMP6, err } diff --git a/vendor/github.com/prometheus/procfs/net_ip_socket.go b/vendor/github.com/prometheus/procfs/net_ip_socket.go index 19e3378f72..9291f8cd4c 100644 --- a/vendor/github.com/prometheus/procfs/net_ip_socket.go +++ b/vendor/github.com/prometheus/procfs/net_ip_socket.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_protocols.go b/vendor/github.com/prometheus/procfs/net_protocols.go index 8d4b1ac05b..eaa996cbcf 100644 --- a/vendor/github.com/prometheus/procfs/net_protocols.go +++ b/vendor/github.com/prometheus/procfs/net_protocols.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 @@ -169,7 +169,7 @@ func (pc *NetProtocolCapabilities) parseCapabilities(capabilities []string) erro &pc.EnterMemoryPressure, } - for i := 0; i < len(capabilities); i++ { + for i := range capabilities { switch capabilities[i] { case "y": *capabilityFields[i] = true diff --git a/vendor/github.com/prometheus/procfs/net_route.go b/vendor/github.com/prometheus/procfs/net_route.go index deb7029fe1..fa3812d9d0 100644 --- a/vendor/github.com/prometheus/procfs/net_route.go +++ b/vendor/github.com/prometheus/procfs/net_route.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_sockstat.go b/vendor/github.com/prometheus/procfs/net_sockstat.go index fae62b13d9..8b221ebfff 100644 --- a/vendor/github.com/prometheus/procfs/net_sockstat.go +++ b/vendor/github.com/prometheus/procfs/net_sockstat.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 @@ -139,9 +139,6 @@ func parseSockstatKVs(kvs []string) (map[string]int, error) { func parseSockstatProtocol(kvs map[string]int) NetSockstatProtocol { var nsp NetSockstatProtocol for k, v := range kvs { - // Capture the range variable to ensure we get unique pointers for - // each of the optional fields. - v := v switch k { case "inuse": nsp.InUse = v diff --git a/vendor/github.com/prometheus/procfs/net_softnet.go b/vendor/github.com/prometheus/procfs/net_softnet.go index 71c8059f4d..4a2dfa18fd 100644 --- a/vendor/github.com/prometheus/procfs/net_softnet.go +++ b/vendor/github.com/prometheus/procfs/net_softnet.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_tcp.go b/vendor/github.com/prometheus/procfs/net_tcp.go index 0396d72015..610ea78e56 100644 --- a/vendor/github.com/prometheus/procfs/net_tcp.go +++ b/vendor/github.com/prometheus/procfs/net_tcp.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_tls_stat.go b/vendor/github.com/prometheus/procfs/net_tls_stat.go index 13994c1782..b1b3f6a6a2 100644 --- a/vendor/github.com/prometheus/procfs/net_tls_stat.go +++ b/vendor/github.com/prometheus/procfs/net_tls_stat.go @@ -1,4 +1,4 @@ -// Copyright 2023 Prometheus Team +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_udp.go b/vendor/github.com/prometheus/procfs/net_udp.go index 9ac3daf2d4..8a32779102 100644 --- a/vendor/github.com/prometheus/procfs/net_udp.go +++ b/vendor/github.com/prometheus/procfs/net_udp.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_unix.go b/vendor/github.com/prometheus/procfs/net_unix.go index d7e0cacb4c..e4d6359236 100644 --- a/vendor/github.com/prometheus/procfs/net_unix.go +++ b/vendor/github.com/prometheus/procfs/net_unix.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_wireless.go b/vendor/github.com/prometheus/procfs/net_wireless.go index 7c597bc870..69d0794451 100644 --- a/vendor/github.com/prometheus/procfs/net_wireless.go +++ b/vendor/github.com/prometheus/procfs/net_wireless.go @@ -1,4 +1,4 @@ -// Copyright 2023 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/net_xfrm.go b/vendor/github.com/prometheus/procfs/net_xfrm.go index 932ef20468..5a9f497d19 100644 --- a/vendor/github.com/prometheus/procfs/net_xfrm.go +++ b/vendor/github.com/prometheus/procfs/net_xfrm.go @@ -1,4 +1,4 @@ -// Copyright 2017 Prometheus Team +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/netstat.go b/vendor/github.com/prometheus/procfs/netstat.go index 742dff453b..dbdae47392 100644 --- a/vendor/github.com/prometheus/procfs/netstat.go +++ b/vendor/github.com/prometheus/procfs/netstat.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/nfnetlink_queue.go b/vendor/github.com/prometheus/procfs/nfnetlink_queue.go new file mode 100644 index 0000000000..b0a73b11e9 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/nfnetlink_queue.go @@ -0,0 +1,85 @@ +// Copyright The Prometheus 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. + +package procfs + +import ( + "bufio" + "bytes" + "fmt" + + "github.com/prometheus/procfs/internal/util" +) + +const nfNetLinkQueueFormat = "%d %d %d %d %d %d %d %d %d" + +// NFNetLinkQueue contains general information about netfilter queues found in /proc/net/netfilter/nfnetlink_queue. +type NFNetLinkQueue struct { + // id of the queue + QueueID uint + // pid of process handling the queue + PeerPID uint + // number of packets waiting for a decision + QueueTotal uint + // indicate how userspace receive packets + CopyMode uint + // size of copy + CopyRange uint + // number of items dropped by the kernel because too many packets were waiting a decision. + // It queue_total is superior to queue_max_len (1024 per default) the packets are dropped. + QueueDropped uint + // number of packets dropped by userspace (due to kernel send failure on the netlink socket) + QueueUserDropped uint + // sequence number of packets queued. It gives a correct approximation of the number of queued packets. + SequenceID uint + // internal value (number of entity using the queue) + Use uint +} + +// NFNetLinkQueue returns information about current state of netfilter queues. +func (fs FS) NFNetLinkQueue() ([]NFNetLinkQueue, error) { + data, err := util.ReadFileNoStat(fs.proc.Path("net/netfilter/nfnetlink_queue")) + if err != nil { + return nil, err + } + + queue := []NFNetLinkQueue{} + if len(data) == 0 { + return queue, nil + } + + scanner := bufio.NewScanner(bytes.NewReader(data)) + for scanner.Scan() { + line := scanner.Text() + nFNetLinkQueue, err := parseNFNetLinkQueueLine(line) + if err != nil { + return nil, err + } + queue = append(queue, *nFNetLinkQueue) + } + return queue, nil +} + +// parseNFNetLinkQueueLine parses each line of the /proc/net/netfilter/nfnetlink_queue file. +func parseNFNetLinkQueueLine(line string) (*NFNetLinkQueue, error) { + nFNetLinkQueue := NFNetLinkQueue{} + _, err := fmt.Sscanf( + line, nfNetLinkQueueFormat, + &nFNetLinkQueue.QueueID, &nFNetLinkQueue.PeerPID, &nFNetLinkQueue.QueueTotal, &nFNetLinkQueue.CopyMode, + &nFNetLinkQueue.CopyRange, &nFNetLinkQueue.QueueDropped, &nFNetLinkQueue.QueueUserDropped, &nFNetLinkQueue.SequenceID, &nFNetLinkQueue.Use, + ) + if err != nil { + return nil, err + } + return &nFNetLinkQueue, nil +} diff --git a/vendor/github.com/prometheus/procfs/proc.go b/vendor/github.com/prometheus/procfs/proc.go index 368187fa88..39c14aa55e 100644 --- a/vendor/github.com/prometheus/procfs/proc.go +++ b/vendor/github.com/prometheus/procfs/proc.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -49,7 +49,7 @@ func (p Procs) Less(i, j int) bool { return p[i].PID < p[j].PID } // Self returns a process for the current process read via /proc/self. func Self() (Proc, error) { fs, err := NewFS(DefaultMountPoint) - if err != nil || errors.Unwrap(err) == ErrMountPoint { + if err != nil || errors.Is(err, ErrMountPoint) { return Proc{}, err } return fs.Self() diff --git a/vendor/github.com/prometheus/procfs/proc_cgroup.go b/vendor/github.com/prometheus/procfs/proc_cgroup.go index 4a64347c03..535c08d6fc 100644 --- a/vendor/github.com/prometheus/procfs/proc_cgroup.go +++ b/vendor/github.com/prometheus/procfs/proc_cgroup.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_cgroups.go b/vendor/github.com/prometheus/procfs/proc_cgroups.go index 5dd4938999..0b275c3b1f 100644 --- a/vendor/github.com/prometheus/procfs/proc_cgroups.go +++ b/vendor/github.com/prometheus/procfs/proc_cgroups.go @@ -1,4 +1,4 @@ -// Copyright 2021 The Prometheus Authors +// Copyright The Prometheus 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 @@ -40,13 +40,13 @@ type CgroupSummary struct { // parseCgroupSummary parses each line of the /proc/cgroup file // Line format is `subsys_name hierarchy num_cgroups enabled`. -func parseCgroupSummaryString(CgroupSummaryStr string) (*CgroupSummary, error) { +func parseCgroupSummaryString(cgroupSummaryStr string) (*CgroupSummary, error) { var err error - fields := strings.Fields(CgroupSummaryStr) + fields := strings.Fields(cgroupSummaryStr) // require at least 4 fields if len(fields) < 4 { - return nil, fmt.Errorf("%w: 4+ fields required, found %d fields in cgroup info string: %s", ErrFileParse, len(fields), CgroupSummaryStr) + return nil, fmt.Errorf("%w: 4+ fields required, found %d fields in cgroup info string: %s", ErrFileParse, len(fields), cgroupSummaryStr) } CgroupSummary := &CgroupSummary{ diff --git a/vendor/github.com/prometheus/procfs/proc_environ.go b/vendor/github.com/prometheus/procfs/proc_environ.go index 57a89895d6..5b941de047 100644 --- a/vendor/github.com/prometheus/procfs/proc_environ.go +++ b/vendor/github.com/prometheus/procfs/proc_environ.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_fdinfo.go b/vendor/github.com/prometheus/procfs/proc_fdinfo.go index fa761b3529..fa57761dbe 100644 --- a/vendor/github.com/prometheus/procfs/proc_fdinfo.go +++ b/vendor/github.com/prometheus/procfs/proc_fdinfo.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 @@ -60,15 +60,16 @@ func (p Proc) FDInfo(fd string) (*ProcFDInfo, error) { scanner := bufio.NewScanner(bytes.NewReader(data)) for scanner.Scan() { text = scanner.Text() - if rPos.MatchString(text) { + switch { + case rPos.MatchString(text): pos = rPos.FindStringSubmatch(text)[1] - } else if rFlags.MatchString(text) { + case rFlags.MatchString(text): flags = rFlags.FindStringSubmatch(text)[1] - } else if rMntID.MatchString(text) { + case rMntID.MatchString(text): mntid = rMntID.FindStringSubmatch(text)[1] - } else if rIno.MatchString(text) { + case rIno.MatchString(text): ino = rIno.FindStringSubmatch(text)[1] - } else if rInotify.MatchString(text) { + case rInotify.MatchString(text): newInotify, err := parseInotifyInfo(text) if err != nil { return nil, err diff --git a/vendor/github.com/prometheus/procfs/proc_interrupts.go b/vendor/github.com/prometheus/procfs/proc_interrupts.go index 86b4b45246..b942c50723 100644 --- a/vendor/github.com/prometheus/procfs/proc_interrupts.go +++ b/vendor/github.com/prometheus/procfs/proc_interrupts.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_io.go b/vendor/github.com/prometheus/procfs/proc_io.go index d15b66ddb6..dd8086ba2e 100644 --- a/vendor/github.com/prometheus/procfs/proc_io.go +++ b/vendor/github.com/prometheus/procfs/proc_io.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_limits.go b/vendor/github.com/prometheus/procfs/proc_limits.go index 9530b14bc6..4b7d337847 100644 --- a/vendor/github.com/prometheus/procfs/proc_limits.go +++ b/vendor/github.com/prometheus/procfs/proc_limits.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -19,6 +19,7 @@ import ( "os" "regexp" "strconv" + "strings" ) // ProcLimits represents the soft limits for each of the process's resource @@ -74,7 +75,7 @@ const ( ) var ( - limitsMatch = regexp.MustCompile(`(Max \w+\s{0,1}?\w*\s{0,1}\w*)\s{2,}(\w+)\s+(\w+)`) + limitsMatch = regexp.MustCompile(`(Max \w+\s??\w*\s?\w*)\s{2,}(\w+)\s+(\w+)`) ) // NewLimits returns the current soft limits of the process. @@ -106,7 +107,7 @@ func (p Proc) Limits() (ProcLimits, error) { return ProcLimits{}, fmt.Errorf("%w: couldn't parse %q line %q", ErrFileParse, f.Name(), s.Text()) } - switch fields[1] { + switch strings.TrimSpace(fields[1]) { case "Max cpu time": l.CPUTime, err = parseUint(fields[2]) case "Max file size": diff --git a/vendor/github.com/prometheus/procfs/proc_maps.go b/vendor/github.com/prometheus/procfs/proc_maps.go index 7e75c286b5..cc519f92f9 100644 --- a/vendor/github.com/prometheus/procfs/proc_maps.go +++ b/vendor/github.com/prometheus/procfs/proc_maps.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_netstat.go b/vendor/github.com/prometheus/procfs/proc_netstat.go index 4248c1716e..7f94cc8914 100644 --- a/vendor/github.com/prometheus/procfs/proc_netstat.go +++ b/vendor/github.com/prometheus/procfs/proc_netstat.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_ns.go b/vendor/github.com/prometheus/procfs/proc_ns.go index 0f8f847f95..5fc0eb9e2f 100644 --- a/vendor/github.com/prometheus/procfs/proc_ns.go +++ b/vendor/github.com/prometheus/procfs/proc_ns.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_psi.go b/vendor/github.com/prometheus/procfs/proc_psi.go index ccd35f153a..cc2c5de873 100644 --- a/vendor/github.com/prometheus/procfs/proc_psi.go +++ b/vendor/github.com/prometheus/procfs/proc_psi.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_smaps.go b/vendor/github.com/prometheus/procfs/proc_smaps.go index 9a297afcf8..3e48afd1d3 100644 --- a/vendor/github.com/prometheus/procfs/proc_smaps.go +++ b/vendor/github.com/prometheus/procfs/proc_smaps.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_snmp.go b/vendor/github.com/prometheus/procfs/proc_snmp.go index 4bdc90b07e..8d9a9bcd67 100644 --- a/vendor/github.com/prometheus/procfs/proc_snmp.go +++ b/vendor/github.com/prometheus/procfs/proc_snmp.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_snmp6.go b/vendor/github.com/prometheus/procfs/proc_snmp6.go index fb7fd3995b..841fef4649 100644 --- a/vendor/github.com/prometheus/procfs/proc_snmp6.go +++ b/vendor/github.com/prometheus/procfs/proc_snmp6.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/proc_stat.go b/vendor/github.com/prometheus/procfs/proc_stat.go index 06a8d931c9..02e3f9e316 100644 --- a/vendor/github.com/prometheus/procfs/proc_stat.go +++ b/vendor/github.com/prometheus/procfs/proc_stat.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -101,6 +101,12 @@ type ProcStat struct { RSS int // Soft limit in bytes on the rss of the process. RSSLimit uint64 + // The address above which program text can run. + StartCode uint64 + // The address below which program text can run. + EndCode uint64 + // The address of the start (i.e., bottom) of the stack. + StartStack uint64 // CPU number last executed on. Processor uint // Real-time scheduling priority, a number in the range 1 to 99 for processes @@ -177,9 +183,9 @@ func (p Proc) Stat() (ProcStat, error) { &s.VSize, &s.RSS, &s.RSSLimit, - &ignoreUint64, - &ignoreUint64, - &ignoreUint64, + &s.StartCode, + &s.EndCode, + &s.StartStack, &ignoreUint64, &ignoreUint64, &ignoreUint64, diff --git a/vendor/github.com/prometheus/procfs/proc_statm.go b/vendor/github.com/prometheus/procfs/proc_statm.go new file mode 100644 index 0000000000..b0a9360167 --- /dev/null +++ b/vendor/github.com/prometheus/procfs/proc_statm.go @@ -0,0 +1,116 @@ +// Copyright The Prometheus 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. + +package procfs + +import ( + "os" + "strconv" + "strings" + + "github.com/prometheus/procfs/internal/util" +) + +// - https://man7.org/linux/man-pages/man5/proc_pid_statm.5.html + +// ProcStatm Provides memory usage information for a process, measured in memory pages. +// Read from /proc/[pid]/statm. +type ProcStatm struct { + // The process ID. + PID int + // total program size (same as VmSize in status) + Size uint64 + // resident set size (same as VmRSS in status) + Resident uint64 + // number of resident shared pages (i.e., backed by a file) + Shared uint64 + // text (code) + Text uint64 + // library (unused since Linux 2.6; always 0) + Lib uint64 + // data + stack + Data uint64 + // dirty pages (unused since Linux 2.6; always 0) + Dt uint64 +} + +// NewStatm returns the current status information of the process. +// Deprecated: Use p.Statm() instead. +func (p Proc) NewStatm() (ProcStatm, error) { + return p.Statm() +} + +// Statm returns the current memory usage information of the process. +func (p Proc) Statm() (ProcStatm, error) { + data, err := util.ReadFileNoStat(p.path("statm")) + if err != nil { + return ProcStatm{}, err + } + + statmSlice, err := parseStatm(data) + if err != nil { + return ProcStatm{}, err + } + + procStatm := ProcStatm{ + PID: p.PID, + Size: statmSlice[0], + Resident: statmSlice[1], + Shared: statmSlice[2], + Text: statmSlice[3], + Lib: statmSlice[4], + Data: statmSlice[5], + Dt: statmSlice[6], + } + + return procStatm, nil +} + +// parseStatm return /proc/[pid]/statm data to uint64 slice. +func parseStatm(data []byte) ([]uint64, error) { + var statmSlice []uint64 + statmItems := strings.Fields(string(data)) + for i := range statmItems { + statmItem, err := strconv.ParseUint(statmItems[i], 10, 64) + if err != nil { + return nil, err + } + statmSlice = append(statmSlice, statmItem) + } + return statmSlice, nil +} + +// SizeBytes returns the process of total program size in bytes. +func (s ProcStatm) SizeBytes() uint64 { + return s.Size * uint64(os.Getpagesize()) +} + +// ResidentBytes returns the process of resident set size in bytes. +func (s ProcStatm) ResidentBytes() uint64 { + return s.Resident * uint64(os.Getpagesize()) +} + +// SHRBytes returns the process of share memory size in bytes. +func (s ProcStatm) SHRBytes() uint64 { + return s.Shared * uint64(os.Getpagesize()) +} + +// TextBytes returns the process of text (code) size in bytes. +func (s ProcStatm) TextBytes() uint64 { + return s.Text * uint64(os.Getpagesize()) +} + +// DataBytes returns the process of data + stack size in bytes. +func (s ProcStatm) DataBytes() uint64 { + return s.Data * uint64(os.Getpagesize()) +} diff --git a/vendor/github.com/prometheus/procfs/proc_status.go b/vendor/github.com/prometheus/procfs/proc_status.go index dd8aa56885..1ed2bced41 100644 --- a/vendor/github.com/prometheus/procfs/proc_status.go +++ b/vendor/github.com/prometheus/procfs/proc_status.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -16,7 +16,7 @@ package procfs import ( "bytes" "math/bits" - "sort" + "slices" "strconv" "strings" @@ -94,8 +94,7 @@ func (p Proc) NewStatus() (ProcStatus, error) { s := ProcStatus{PID: p.PID} - lines := strings.Split(string(data), "\n") - for _, line := range lines { + for line := range strings.SplitSeq(string(data), "\n") { if !bytes.Contains([]byte(line), []byte(":")) { continue } @@ -222,7 +221,7 @@ func calcCpusAllowedList(cpuString string) []uint64 { } - sort.Slice(g, func(i, j int) bool { return g[i] < g[j] }) + slices.Sort(g) return g } diff --git a/vendor/github.com/prometheus/procfs/proc_sys.go b/vendor/github.com/prometheus/procfs/proc_sys.go index 3810d1ac99..52658a4d52 100644 --- a/vendor/github.com/prometheus/procfs/proc_sys.go +++ b/vendor/github.com/prometheus/procfs/proc_sys.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/schedstat.go b/vendor/github.com/prometheus/procfs/schedstat.go index 5f7f32dc83..fafd8dff74 100644 --- a/vendor/github.com/prometheus/procfs/schedstat.go +++ b/vendor/github.com/prometheus/procfs/schedstat.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/slab.go b/vendor/github.com/prometheus/procfs/slab.go index 8611c90177..32a04678ad 100644 --- a/vendor/github.com/prometheus/procfs/slab.go +++ b/vendor/github.com/prometheus/procfs/slab.go @@ -1,4 +1,4 @@ -// Copyright 2020 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/softirqs.go b/vendor/github.com/prometheus/procfs/softirqs.go index 403e6ae708..47b73a7297 100644 --- a/vendor/github.com/prometheus/procfs/softirqs.go +++ b/vendor/github.com/prometheus/procfs/softirqs.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/stat.go b/vendor/github.com/prometheus/procfs/stat.go index e36b41c18a..593ad0f62f 100644 --- a/vendor/github.com/prometheus/procfs/stat.go +++ b/vendor/github.com/prometheus/procfs/stat.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Prometheus Authors +// Copyright The Prometheus 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 @@ -16,6 +16,7 @@ package procfs import ( "bufio" "bytes" + "errors" "fmt" "io" "strconv" @@ -92,7 +93,7 @@ func parseCPUStat(line string) (CPUStat, int64, error) { &cpuStat.Iowait, &cpuStat.IRQ, &cpuStat.SoftIRQ, &cpuStat.Steal, &cpuStat.Guest, &cpuStat.GuestNice) - if err != nil && err != io.EOF { + if err != nil && !errors.Is(err, io.EOF) { return CPUStat{}, -1, fmt.Errorf("%w: couldn't parse %q (cpu): %w", ErrFileParse, line, err) } if count == 0 { diff --git a/vendor/github.com/prometheus/procfs/swaps.go b/vendor/github.com/prometheus/procfs/swaps.go index 65fec834bf..ee17bf4888 100644 --- a/vendor/github.com/prometheus/procfs/swaps.go +++ b/vendor/github.com/prometheus/procfs/swaps.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/thread.go b/vendor/github.com/prometheus/procfs/thread.go index 80e0e947be..0cfbb54184 100644 --- a/vendor/github.com/prometheus/procfs/thread.go +++ b/vendor/github.com/prometheus/procfs/thread.go @@ -1,4 +1,4 @@ -// Copyright 2022 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/vm.go b/vendor/github.com/prometheus/procfs/vm.go index 51c49d89e8..2a8d763909 100644 --- a/vendor/github.com/prometheus/procfs/vm.go +++ b/vendor/github.com/prometheus/procfs/vm.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 diff --git a/vendor/github.com/prometheus/procfs/zoneinfo.go b/vendor/github.com/prometheus/procfs/zoneinfo.go index e54d94b090..806e171147 100644 --- a/vendor/github.com/prometheus/procfs/zoneinfo.go +++ b/vendor/github.com/prometheus/procfs/zoneinfo.go @@ -1,4 +1,4 @@ -// Copyright 2019 The Prometheus Authors +// Copyright The Prometheus 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 @@ -88,11 +88,9 @@ func parseZoneinfo(zoneinfoData []byte) ([]Zoneinfo, error) { zoneinfo := []Zoneinfo{} - zoneinfoBlocks := bytes.Split(zoneinfoData, []byte("\nNode")) - for _, block := range zoneinfoBlocks { + for block := range bytes.SplitSeq(zoneinfoData, []byte("\nNode")) { var zoneinfoElement Zoneinfo - lines := strings.Split(string(block), "\n") - for _, line := range lines { + for line := range strings.SplitSeq(string(block), "\n") { if nodeZone := nodeZoneRE.FindStringSubmatch(line); nodeZone != nil { zoneinfoElement.Node = nodeZone[1] diff --git a/vendor/github.com/spf13/cobra/.golangci.yml b/vendor/github.com/spf13/cobra/.golangci.yml index 6acf8ab1ea..104dc24407 100644 --- a/vendor/github.com/spf13/cobra/.golangci.yml +++ b/vendor/github.com/spf13/cobra/.golangci.yml @@ -57,3 +57,10 @@ linters: - common-false-positives - legacy - std-error-handling + settings: + govet: + # Disable buildtag check to allow dual build tag syntax (both //go:build and // +build). + # This is necessary for Go 1.15 compatibility since //go:build was introduced in Go 1.17. + # This can be removed once Cobra requires Go 1.17 or higher. + disable: + - buildtag diff --git a/vendor/github.com/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go index 78088db69c..c05fed45ae 100644 --- a/vendor/github.com/spf13/cobra/command.go +++ b/vendor/github.com/spf13/cobra/command.go @@ -557,7 +557,7 @@ func (c *Command) FlagErrorFunc() (f func(*Command, error) error) { } } -var minUsagePadding = 25 +const minUsagePadding = 25 // UsagePadding return padding for the usage. func (c *Command) UsagePadding() int { @@ -567,7 +567,7 @@ func (c *Command) UsagePadding() int { return c.parent.commandsMaxUseLen } -var minCommandPathPadding = 11 +const minCommandPathPadding = 11 // CommandPathPadding return padding for the command path. func (c *Command) CommandPathPadding() int { @@ -577,7 +577,7 @@ func (c *Command) CommandPathPadding() int { return c.parent.commandsMaxCommandPathLen } -var minNamePadding = 11 +const minNamePadding = 11 // NamePadding returns padding for the name. func (c *Command) NamePadding() int { @@ -1939,7 +1939,7 @@ type tmplFunc struct { fn func(io.Writer, interface{}) error } -var defaultUsageTemplate = `Usage:{{if .Runnable}} +const defaultUsageTemplate = `Usage:{{if .Runnable}} {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}} {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}} @@ -2039,7 +2039,7 @@ func defaultUsageFunc(w io.Writer, in interface{}) error { return nil } -var defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}} +const defaultHelpTemplate = `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}} {{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}` @@ -2061,7 +2061,7 @@ func defaultHelpFunc(w io.Writer, in interface{}) error { return nil } -var defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}} +const defaultVersionTemplate = `{{with .DisplayName}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}} ` // defaultVersionFunc is equivalent to executing defaultVersionTemplate. The two should be changed in sync. diff --git a/vendor/go.etcd.io/etcd/api/v3/version/version.go b/vendor/go.etcd.io/etcd/api/v3/version/version.go index 9e7bc64c17..cd0b63ea67 100644 --- a/vendor/go.etcd.io/etcd/api/v3/version/version.go +++ b/vendor/go.etcd.io/etcd/api/v3/version/version.go @@ -26,7 +26,7 @@ import ( var ( // MinClusterVersion is the min cluster version this etcd binary is compatible with. MinClusterVersion = "3.0.0" - Version = "3.6.5" + Version = "3.6.8" APIVersion = "unknown" // Git SHA Value will be set during build diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/LICENSE b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/LICENSE index 261eeb9e9f..f1aee0f110 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/LICENSE +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/LICENSE @@ -199,3 +199,33 @@ 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. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go index 9e87fb4bb1..0018e2d45f 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/config.go @@ -4,23 +4,18 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" import ( - "google.golang.org/grpc/stats" + "context" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" + "google.golang.org/grpc/stats" ) -const ( - // ScopeName is the instrumentation scope name. - ScopeName = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - // GRPCStatusCodeKey is convention for numeric status code of a gRPC request. - GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") -) +// ScopeName is the instrumentation scope name. +const ScopeName = "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" // InterceptorFilter is a predicate used to determine whether a given request in // interceptor info should be instrumented. A InterceptorFilter must return true if @@ -36,26 +31,21 @@ type Filter func(*stats.RPCTagInfo) bool // config is a group of options for this instrumentation. type config struct { - Filter Filter - InterceptorFilter InterceptorFilter - Propagators propagation.TextMapPropagator - TracerProvider trace.TracerProvider - MeterProvider metric.MeterProvider - SpanStartOptions []trace.SpanStartOption - SpanAttributes []attribute.KeyValue - MetricAttributes []attribute.KeyValue + Filter Filter + InterceptorFilter InterceptorFilter + Propagators propagation.TextMapPropagator + TracerProvider trace.TracerProvider + MeterProvider metric.MeterProvider + SpanStartOptions []trace.SpanStartOption + SpanAttributes []attribute.KeyValue + MetricAttributes []attribute.KeyValue + MetricAttributesFn func(ctx context.Context) []attribute.KeyValue + + PublicEndpoint bool + PublicEndpointFn func(ctx context.Context, info *stats.RPCTagInfo) bool ReceivedEvent bool SentEvent bool - - tracer trace.Tracer - meter metric.Meter - - rpcDuration metric.Float64Histogram - rpcInBytes metric.Int64Histogram - rpcOutBytes metric.Int64Histogram - rpcInMessages metric.Int64Histogram - rpcOutMessages metric.Int64Histogram } // Option applies an option value for a config. @@ -63,8 +53,14 @@ type Option interface { apply(*config) } +type optionFunc func(*config) + +func (f optionFunc) apply(c *config) { + f(c) +} + // newConfig returns a config configured with all the passed Options. -func newConfig(opts []Option, role string) *config { +func newConfig(opts []Option) *config { c := &config{ Propagators: otel.GetTextMapPropagator(), TracerProvider: otel.GetTracerProvider(), @@ -73,162 +69,77 @@ func newConfig(opts []Option, role string) *config { for _, o := range opts { o.apply(c) } - - c.tracer = c.TracerProvider.Tracer( - ScopeName, - trace.WithInstrumentationVersion(SemVersion()), - ) - - c.meter = c.MeterProvider.Meter( - ScopeName, - metric.WithInstrumentationVersion(Version()), - metric.WithSchemaURL(semconv.SchemaURL), - ) - - var err error - c.rpcDuration, err = c.meter.Float64Histogram("rpc."+role+".duration", - metric.WithDescription("Measures the duration of inbound RPC."), - metric.WithUnit("ms")) - if err != nil { - otel.Handle(err) - if c.rpcDuration == nil { - c.rpcDuration = noop.Float64Histogram{} - } - } - - rpcRequestSize, err := c.meter.Int64Histogram("rpc."+role+".request.size", - metric.WithDescription("Measures size of RPC request messages (uncompressed)."), - metric.WithUnit("By")) - if err != nil { - otel.Handle(err) - if rpcRequestSize == nil { - rpcRequestSize = noop.Int64Histogram{} - } - } - - rpcResponseSize, err := c.meter.Int64Histogram("rpc."+role+".response.size", - metric.WithDescription("Measures size of RPC response messages (uncompressed)."), - metric.WithUnit("By")) - if err != nil { - otel.Handle(err) - if rpcResponseSize == nil { - rpcResponseSize = noop.Int64Histogram{} - } - } - - rpcRequestsPerRPC, err := c.meter.Int64Histogram("rpc."+role+".requests_per_rpc", - metric.WithDescription("Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs."), - metric.WithUnit("{count}")) - if err != nil { - otel.Handle(err) - if rpcRequestsPerRPC == nil { - rpcRequestsPerRPC = noop.Int64Histogram{} - } - } - - rpcResponsesPerRPC, err := c.meter.Int64Histogram("rpc."+role+".responses_per_rpc", - metric.WithDescription("Measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs."), - metric.WithUnit("{count}")) - if err != nil { - otel.Handle(err) - if rpcResponsesPerRPC == nil { - rpcResponsesPerRPC = noop.Int64Histogram{} - } - } - - switch role { - case "client": - c.rpcInBytes = rpcResponseSize - c.rpcInMessages = rpcResponsesPerRPC - c.rpcOutBytes = rpcRequestSize - c.rpcOutMessages = rpcRequestsPerRPC - case "server": - c.rpcInBytes = rpcRequestSize - c.rpcInMessages = rpcRequestsPerRPC - c.rpcOutBytes = rpcResponseSize - c.rpcOutMessages = rpcResponsesPerRPC - default: - c.rpcInBytes = noop.Int64Histogram{} - c.rpcInMessages = noop.Int64Histogram{} - c.rpcOutBytes = noop.Int64Histogram{} - c.rpcOutMessages = noop.Int64Histogram{} - } - return c } -type propagatorsOption struct{ p propagation.TextMapPropagator } +// WithPublicEndpoint configures the Handler to link the span with an incoming +// span context. If this option is not provided, then the association is a child +// association instead of a link. +func WithPublicEndpoint() Option { + return optionFunc(func(c *config) { + c.PublicEndpoint = true + }) +} -func (o propagatorsOption) apply(c *config) { - if o.p != nil { - c.Propagators = o.p - } +// WithPublicEndpointFn runs with every request, and allows conditionally +// configuring the Handler to link the span with an incoming span context. If +// this option is not provided or returns false, then the association is a +// child association instead of a link. +// Note: WithPublicEndpoint takes precedence over WithPublicEndpointFn. +func WithPublicEndpointFn(fn func(context.Context, *stats.RPCTagInfo) bool) Option { + return optionFunc(func(c *config) { + c.PublicEndpointFn = fn + }) } // WithPropagators returns an Option to use the Propagators when extracting // and injecting trace context from requests. func WithPropagators(p propagation.TextMapPropagator) Option { - return propagatorsOption{p: p} -} - -type tracerProviderOption struct{ tp trace.TracerProvider } - -func (o tracerProviderOption) apply(c *config) { - if o.tp != nil { - c.TracerProvider = o.tp - } + return optionFunc(func(c *config) { + if p != nil { + c.Propagators = p + } + }) } // WithInterceptorFilter returns an Option to use the request filter. // // Deprecated: Use stats handlers instead. func WithInterceptorFilter(f InterceptorFilter) Option { - return interceptorFilterOption{f: f} -} - -type interceptorFilterOption struct { - f InterceptorFilter -} - -func (o interceptorFilterOption) apply(c *config) { - if o.f != nil { - c.InterceptorFilter = o.f - } + return optionFunc(func(c *config) { + if f != nil { + c.InterceptorFilter = f + } + }) } // WithFilter returns an Option to use the request filter. func WithFilter(f Filter) Option { - return filterOption{f: f} -} - -type filterOption struct { - f Filter -} - -func (o filterOption) apply(c *config) { - if o.f != nil { - c.Filter = o.f - } + return optionFunc(func(c *config) { + if f != nil { + c.Filter = f + } + }) } // WithTracerProvider returns an Option to use the TracerProvider when // creating a Tracer. func WithTracerProvider(tp trace.TracerProvider) Option { - return tracerProviderOption{tp: tp} -} - -type meterProviderOption struct{ mp metric.MeterProvider } - -func (o meterProviderOption) apply(c *config) { - if o.mp != nil { - c.MeterProvider = o.mp - } + return optionFunc(func(c *config) { + if tp != nil { + c.TracerProvider = tp + } + }) } // WithMeterProvider returns an Option to use the MeterProvider when // creating a Meter. If this option is not provide the global MeterProvider will be used. func WithMeterProvider(mp metric.MeterProvider) Option { - return meterProviderOption{mp: mp} + return optionFunc(func(c *config) { + if mp != nil { + c.MeterProvider = mp + } + }) } // Event type that can be recorded, see WithMessageEvents. @@ -240,21 +151,6 @@ const ( SentEvents ) -type messageEventsProviderOption struct { - events []Event -} - -func (m messageEventsProviderOption) apply(c *config) { - for _, e := range m.events { - switch e { - case ReceivedEvents: - c.ReceivedEvent = true - case SentEvents: - c.SentEvent = true - } - } -} - // WithMessageEvents configures the Handler to record the specified events // (span.AddEvent) on spans. By default only summary attributes are added at the // end of the request. @@ -263,43 +159,54 @@ func (m messageEventsProviderOption) apply(c *config) { // - ReceivedEvents: Record the number of bytes read after every gRPC read operation. // - SentEvents: Record the number of bytes written after every gRPC write operation. func WithMessageEvents(events ...Event) Option { - return messageEventsProviderOption{events: events} -} - -type spanStartOption struct{ opts []trace.SpanStartOption } - -func (o spanStartOption) apply(c *config) { - c.SpanStartOptions = append(c.SpanStartOptions, o.opts...) + return optionFunc(func(c *config) { + for _, e := range events { + switch e { + case ReceivedEvents: + c.ReceivedEvent = true + case SentEvents: + c.SentEvent = true + } + } + }) } // WithSpanOptions configures an additional set of // trace.SpanOptions, which are applied to each new span. +// +// Deprecated: It is only used by the deprecated interceptor, and is unused by [NewClientHandler] and [NewServerHandler]. func WithSpanOptions(opts ...trace.SpanStartOption) Option { - return spanStartOption{opts} -} - -type spanAttributesOption struct{ a []attribute.KeyValue } - -func (o spanAttributesOption) apply(c *config) { - if o.a != nil { - c.SpanAttributes = o.a - } + return optionFunc(func(c *config) { + c.SpanStartOptions = append(c.SpanStartOptions, opts...) + }) } // WithSpanAttributes returns an Option to add custom attributes to the spans. func WithSpanAttributes(a ...attribute.KeyValue) Option { - return spanAttributesOption{a: a} -} - -type metricAttributesOption struct{ a []attribute.KeyValue } - -func (o metricAttributesOption) apply(c *config) { - if o.a != nil { - c.MetricAttributes = o.a - } + return optionFunc(func(c *config) { + if a != nil { + c.SpanAttributes = a + } + }) } // WithMetricAttributes returns an Option to add custom attributes to the metrics. func WithMetricAttributes(a ...attribute.KeyValue) Option { - return metricAttributesOption{a: a} + return optionFunc(func(c *config) { + if a != nil { + c.MetricAttributes = append(c.MetricAttributes, a...) + } + }) +} + +// WithMetricAttributesFn returns an Option to add dynamic custom attributes to the handler's metrics. +// The function is called once per RPC and the returned attributes are applied to all metrics recorded by this handler. +// +// The context parameter is the standard gRPC request context and provides access to request-scoped data. +func WithMetricAttributesFn(fn func(ctx context.Context) []attribute.KeyValue) Option { + return optionFunc(func(c *config) { + if fn != nil { + c.MetricAttributesFn = fn + } + }) } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go index 7d5ed05808..24053927ca 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/interceptor.go @@ -4,506 +4,33 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" // gRPC tracing middleware -// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/semantic_conventions/rpc.md +// https://opentelemetry.io/docs/specs/semconv/rpc/ import ( - "context" - "errors" - "io" "net" "strconv" - "time" - "google.golang.org/grpc" - grpc_codes "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/status" - "google.golang.org/protobuf/proto" - - "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/metric" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" - "go.opentelemetry.io/otel/trace" -) - -type messageType attribute.KeyValue - -// Event adds an event of the messageType to the span associated with the -// passed context with a message id. -func (m messageType) Event(ctx context.Context, id int, _ interface{}) { - span := trace.SpanFromContext(ctx) - if !span.IsRecording() { - return - } - span.AddEvent("message", trace.WithAttributes( - attribute.KeyValue(m), - RPCMessageIDKey.Int(id), - )) -} - -var ( - messageSent = messageType(RPCMessageTypeSent) - messageReceived = messageType(RPCMessageTypeReceived) + semconv "go.opentelemetry.io/otel/semconv/v1.39.0" + grpc_codes "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) -// UnaryClientInterceptor returns a grpc.UnaryClientInterceptor suitable -// for use in a grpc.NewClient call. -// -// Deprecated: Use [NewClientHandler] instead. -func UnaryClientInterceptor(opts ...Option) grpc.UnaryClientInterceptor { - cfg := newConfig(opts, "client") - tracer := cfg.TracerProvider.Tracer( - ScopeName, - trace.WithInstrumentationVersion(Version()), - ) - - return func( - ctx context.Context, - method string, - req, reply interface{}, - cc *grpc.ClientConn, - invoker grpc.UnaryInvoker, - callOpts ...grpc.CallOption, - ) error { - i := &InterceptorInfo{ - Method: method, - Type: UnaryClient, - } - if cfg.InterceptorFilter != nil && !cfg.InterceptorFilter(i) { - return invoker(ctx, method, req, reply, cc, callOpts...) - } - - name, attr, _ := telemetryAttributes(method, cc.Target()) - - startOpts := append([]trace.SpanStartOption{ - trace.WithSpanKind(trace.SpanKindClient), - trace.WithAttributes(attr...), - }, - cfg.SpanStartOptions..., - ) - - ctx, span := tracer.Start( - ctx, - name, - startOpts..., - ) - defer span.End() - - ctx = inject(ctx, cfg.Propagators) - - if cfg.SentEvent { - messageSent.Event(ctx, 1, req) - } - - err := invoker(ctx, method, req, reply, cc, callOpts...) - - if cfg.ReceivedEvent { - messageReceived.Event(ctx, 1, reply) - } - - if err != nil { - s, _ := status.FromError(err) - span.SetStatus(codes.Error, s.Message()) - span.SetAttributes(statusCodeAttr(s.Code())) - } else { - span.SetAttributes(statusCodeAttr(grpc_codes.OK)) - } - - return err - } -} - -// clientStream wraps around the embedded grpc.ClientStream, and intercepts the RecvMsg and -// SendMsg method call. -type clientStream struct { - grpc.ClientStream - desc *grpc.StreamDesc - - span trace.Span - - receivedEvent bool - sentEvent bool - - receivedMessageID int - sentMessageID int -} - -var _ = proto.Marshal - -func (w *clientStream) RecvMsg(m interface{}) error { - err := w.ClientStream.RecvMsg(m) - - if err == nil && !w.desc.ServerStreams { - w.endSpan(nil) - } else if errors.Is(err, io.EOF) { - w.endSpan(nil) - } else if err != nil { - w.endSpan(err) - } else { - w.receivedMessageID++ - - if w.receivedEvent { - messageReceived.Event(w.Context(), w.receivedMessageID, m) - } - } - - return err -} - -func (w *clientStream) SendMsg(m interface{}) error { - err := w.ClientStream.SendMsg(m) - - w.sentMessageID++ - - if w.sentEvent { - messageSent.Event(w.Context(), w.sentMessageID, m) - } - - if err != nil { - w.endSpan(err) - } - - return err -} - -func (w *clientStream) Header() (metadata.MD, error) { - md, err := w.ClientStream.Header() - if err != nil { - w.endSpan(err) - } - - return md, err -} - -func (w *clientStream) CloseSend() error { - err := w.ClientStream.CloseSend() - if err != nil { - w.endSpan(err) - } - - return err -} - -func wrapClientStream(s grpc.ClientStream, desc *grpc.StreamDesc, span trace.Span, cfg *config) *clientStream { - return &clientStream{ - ClientStream: s, - span: span, - desc: desc, - receivedEvent: cfg.ReceivedEvent, - sentEvent: cfg.SentEvent, - } -} - -func (w *clientStream) endSpan(err error) { - if err != nil { - s, _ := status.FromError(err) - w.span.SetStatus(codes.Error, s.Message()) - w.span.SetAttributes(statusCodeAttr(s.Code())) - } else { - w.span.SetAttributes(statusCodeAttr(grpc_codes.OK)) - } - - w.span.End() -} - -// StreamClientInterceptor returns a grpc.StreamClientInterceptor suitable -// for use in a grpc.NewClient call. -// -// Deprecated: Use [NewClientHandler] instead. -func StreamClientInterceptor(opts ...Option) grpc.StreamClientInterceptor { - cfg := newConfig(opts, "client") - tracer := cfg.TracerProvider.Tracer( - ScopeName, - trace.WithInstrumentationVersion(Version()), - ) - - return func( - ctx context.Context, - desc *grpc.StreamDesc, - cc *grpc.ClientConn, - method string, - streamer grpc.Streamer, - callOpts ...grpc.CallOption, - ) (grpc.ClientStream, error) { - i := &InterceptorInfo{ - Method: method, - Type: StreamClient, - } - if cfg.InterceptorFilter != nil && !cfg.InterceptorFilter(i) { - return streamer(ctx, desc, cc, method, callOpts...) - } - - name, attr, _ := telemetryAttributes(method, cc.Target()) - - startOpts := append([]trace.SpanStartOption{ - trace.WithSpanKind(trace.SpanKindClient), - trace.WithAttributes(attr...), - }, - cfg.SpanStartOptions..., - ) - - ctx, span := tracer.Start( - ctx, - name, - startOpts..., - ) - - ctx = inject(ctx, cfg.Propagators) - - s, err := streamer(ctx, desc, cc, method, callOpts...) - if err != nil { - grpcStatus, _ := status.FromError(err) - span.SetStatus(codes.Error, grpcStatus.Message()) - span.SetAttributes(statusCodeAttr(grpcStatus.Code())) - span.End() - return s, err - } - stream := wrapClientStream(s, desc, span, cfg) - return stream, nil - } -} - -// UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable -// for use in a grpc.NewServer call. -// -// Deprecated: Use [NewServerHandler] instead. -func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor { - cfg := newConfig(opts, "server") - tracer := cfg.TracerProvider.Tracer( - ScopeName, - trace.WithInstrumentationVersion(Version()), - ) - - return func( - ctx context.Context, - req interface{}, - info *grpc.UnaryServerInfo, - handler grpc.UnaryHandler, - ) (interface{}, error) { - i := &InterceptorInfo{ - UnaryServerInfo: info, - Type: UnaryServer, - } - if cfg.InterceptorFilter != nil && !cfg.InterceptorFilter(i) { - return handler(ctx, req) - } - - ctx = extract(ctx, cfg.Propagators) - name, attr, metricAttrs := telemetryAttributes(info.FullMethod, peerFromCtx(ctx)) - - startOpts := append([]trace.SpanStartOption{ - trace.WithSpanKind(trace.SpanKindServer), - trace.WithAttributes(attr...), - }, - cfg.SpanStartOptions..., - ) - - ctx, span := tracer.Start( - trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)), - name, - startOpts..., - ) - defer span.End() - - if cfg.ReceivedEvent { - messageReceived.Event(ctx, 1, req) - } - - before := time.Now() - - resp, err := handler(ctx, req) - - s, _ := status.FromError(err) - if err != nil { - statusCode, msg := serverStatus(s) - span.SetStatus(statusCode, msg) - if cfg.SentEvent { - messageSent.Event(ctx, 1, s.Proto()) - } - } else { - if cfg.SentEvent { - messageSent.Event(ctx, 1, resp) - } - } - grpcStatusCodeAttr := statusCodeAttr(s.Code()) - span.SetAttributes(grpcStatusCodeAttr) - - // Use floating point division here for higher precision (instead of Millisecond method). - elapsedTime := float64(time.Since(before)) / float64(time.Millisecond) - - metricAttrs = append(metricAttrs, grpcStatusCodeAttr) - cfg.rpcDuration.Record(ctx, elapsedTime, metric.WithAttributeSet(attribute.NewSet(metricAttrs...))) - - return resp, err - } -} - -// serverStream wraps around the embedded grpc.ServerStream, and intercepts the RecvMsg and -// SendMsg method call. -type serverStream struct { - grpc.ServerStream - ctx context.Context - - receivedMessageID int - sentMessageID int - - receivedEvent bool - sentEvent bool -} - -func (w *serverStream) Context() context.Context { - return w.ctx -} - -func (w *serverStream) RecvMsg(m interface{}) error { - err := w.ServerStream.RecvMsg(m) - - if err == nil { - w.receivedMessageID++ - if w.receivedEvent { - messageReceived.Event(w.Context(), w.receivedMessageID, m) - } - } - - return err -} - -func (w *serverStream) SendMsg(m interface{}) error { - err := w.ServerStream.SendMsg(m) - - w.sentMessageID++ - if w.sentEvent { - messageSent.Event(w.Context(), w.sentMessageID, m) - } - - return err -} - -func wrapServerStream(ctx context.Context, ss grpc.ServerStream, cfg *config) *serverStream { - return &serverStream{ - ServerStream: ss, - ctx: ctx, - receivedEvent: cfg.ReceivedEvent, - sentEvent: cfg.SentEvent, - } -} - -// StreamServerInterceptor returns a grpc.StreamServerInterceptor suitable -// for use in a grpc.NewServer call. -// -// Deprecated: Use [NewServerHandler] instead. -func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor { - cfg := newConfig(opts, "server") - tracer := cfg.TracerProvider.Tracer( - ScopeName, - trace.WithInstrumentationVersion(Version()), - ) - - return func( - srv interface{}, - ss grpc.ServerStream, - info *grpc.StreamServerInfo, - handler grpc.StreamHandler, - ) error { - ctx := ss.Context() - i := &InterceptorInfo{ - StreamServerInfo: info, - Type: StreamServer, - } - if cfg.InterceptorFilter != nil && !cfg.InterceptorFilter(i) { - return handler(srv, wrapServerStream(ctx, ss, cfg)) - } - - ctx = extract(ctx, cfg.Propagators) - name, attr, _ := telemetryAttributes(info.FullMethod, peerFromCtx(ctx)) - - startOpts := append([]trace.SpanStartOption{ - trace.WithSpanKind(trace.SpanKindServer), - trace.WithAttributes(attr...), - }, - cfg.SpanStartOptions..., - ) - - ctx, span := tracer.Start( - trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)), - name, - startOpts..., - ) - defer span.End() - - err := handler(srv, wrapServerStream(ctx, ss, cfg)) - if err != nil { - s, _ := status.FromError(err) - statusCode, msg := serverStatus(s) - span.SetStatus(statusCode, msg) - span.SetAttributes(statusCodeAttr(s.Code())) - } else { - span.SetAttributes(statusCodeAttr(grpc_codes.OK)) - } - - return err - } -} - -// telemetryAttributes returns a span name and span and metric attributes from -// the gRPC method and peer address. -func telemetryAttributes(fullMethod, peerAddress string) (string, []attribute.KeyValue, []attribute.KeyValue) { - name, methodAttrs := internal.ParseFullMethod(fullMethod) - peerAttrs := peerAttr(peerAddress) - - attrs := make([]attribute.KeyValue, 0, 1+len(methodAttrs)+len(peerAttrs)) - attrs = append(attrs, RPCSystemGRPC) - attrs = append(attrs, methodAttrs...) - metricAttrs := attrs[:1+len(methodAttrs)] - attrs = append(attrs, peerAttrs...) - return name, attrs, metricAttrs -} - -// peerAttr returns attributes about the peer address. -func peerAttr(addr string) []attribute.KeyValue { - host, p, err := net.SplitHostPort(addr) +// serverAddrAttrs returns the server address attributes for the hostport. +func serverAddrAttrs(hostport string) []attribute.KeyValue { + h, pStr, err := net.SplitHostPort(hostport) if err != nil { - return nil - } - - if host == "" { - host = "127.0.0.1" + // The server.address attribute is required. + return []attribute.KeyValue{semconv.ServerAddress(hostport)} } - port, err := strconv.Atoi(p) + p, err := strconv.Atoi(pStr) if err != nil { - return nil - } - - var attr []attribute.KeyValue - if ip := net.ParseIP(host); ip != nil { - attr = []attribute.KeyValue{ - semconv.NetSockPeerAddr(host), - semconv.NetSockPeerPort(port), - } - } else { - attr = []attribute.KeyValue{ - semconv.NetPeerName(host), - semconv.NetPeerPort(port), - } + return []attribute.KeyValue{semconv.ServerAddress(h)} } - - return attr -} - -// peerFromCtx returns a peer address from a context, if one exists. -func peerFromCtx(ctx context.Context) string { - p, ok := peer.FromContext(ctx) - if !ok { - return "" + return []attribute.KeyValue{ + semconv.ServerAddress(h), + semconv.ServerPort(p), } - return p.Addr.String() -} - -// statusCodeAttr returns status code attribute based on given gRPC code. -func statusCodeAttr(c grpc_codes.Code) attribute.KeyValue { - return GRPCStatusCodeKey.Int64(int64(c)) } // serverStatus returns a span status code and message for a given gRPC diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go index bef07b7a3c..2ab085031a 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal/parse.go @@ -1,13 +1,14 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +// Package internal provides internal functionality for the otelgrpc package. package internal // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal" import ( "strings" "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.39.0" ) // ParseFullMethod returns a span name following the OpenTelemetry semantic @@ -22,19 +23,5 @@ func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue) { return fullMethod, nil } name := fullMethod[1:] - pos := strings.LastIndex(name, "/") - if pos < 0 { - // Invalid format, does not follow `/package.service/method`. - return name, nil - } - service, method := name[:pos], name[pos+1:] - - var attrs []attribute.KeyValue - if service != "" { - attrs = append(attrs, semconv.RPCService(service)) - } - if method != "" { - attrs = append(attrs, semconv.RPCMethod(method)) - } - return name, attrs + return name, []attribute.KeyValue{semconv.RPCMethod(name)} } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go index 3aa37915df..4c62341d66 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/metadata_supplier.go @@ -6,21 +6,18 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.g import ( "context" - "google.golang.org/grpc/metadata" - - "go.opentelemetry.io/otel/baggage" "go.opentelemetry.io/otel/propagation" - "go.opentelemetry.io/otel/trace" + "google.golang.org/grpc/metadata" ) type metadataSupplier struct { - metadata *metadata.MD + metadata metadata.MD } // assert that metadataSupplier implements the TextMapCarrier interface. -var _ propagation.TextMapCarrier = &metadataSupplier{} +var _ propagation.TextMapCarrier = metadataSupplier{} -func (s *metadataSupplier) Get(key string) string { +func (s metadataSupplier) Get(key string) string { values := s.metadata.Get(key) if len(values) == 0 { return "" @@ -28,51 +25,27 @@ func (s *metadataSupplier) Get(key string) string { return values[0] } -func (s *metadataSupplier) Set(key string, value string) { +func (s metadataSupplier) Set(key, value string) { s.metadata.Set(key, value) } -func (s *metadataSupplier) Keys() []string { - out := make([]string, 0, len(*s.metadata)) - for key := range *s.metadata { +func (s metadataSupplier) Keys() []string { + out := make([]string, 0, len(s.metadata)) + for key := range s.metadata { out = append(out, key) } return out } -// Inject injects correlation context and span context into the gRPC -// metadata object. This function is meant to be used on outgoing -// requests. -// Deprecated: Unnecessary public func. -func Inject(ctx context.Context, md *metadata.MD, opts ...Option) { - c := newConfig(opts, "") - c.Propagators.Inject(ctx, &metadataSupplier{ - metadata: md, - }) -} - func inject(ctx context.Context, propagators propagation.TextMapPropagator) context.Context { md, ok := metadata.FromOutgoingContext(ctx) if !ok { md = metadata.MD{} } - propagators.Inject(ctx, &metadataSupplier{ - metadata: &md, - }) - return metadata.NewOutgoingContext(ctx, md) -} - -// Extract returns the correlation context and span context that -// another service encoded in the gRPC metadata object with Inject. -// This function is meant to be used on incoming requests. -// Deprecated: Unnecessary public func. -func Extract(ctx context.Context, md *metadata.MD, opts ...Option) (baggage.Baggage, trace.SpanContext) { - c := newConfig(opts, "") - ctx = c.Propagators.Extract(ctx, &metadataSupplier{ + propagators.Inject(ctx, metadataSupplier{ metadata: md, }) - - return baggage.FromContext(ctx), trace.SpanContextFromContext(ctx) + return metadata.NewOutgoingContext(ctx, md) } func extract(ctx context.Context, propagators propagation.TextMapPropagator) context.Context { @@ -81,7 +54,7 @@ func extract(ctx context.Context, propagators propagation.TextMapPropagator) con md = metadata.MD{} } - return propagators.Extract(ctx, &metadataSupplier{ - metadata: &md, + return propagators.Extract(ctx, metadataSupplier{ + metadata: md, }) } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go deleted file mode 100644 index 409c621b74..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/semconv.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - -import ( - "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" -) - -// Semantic conventions for attribute keys for gRPC. -const ( - // Name of message transmitted or received. - RPCNameKey = attribute.Key("name") - - // Type of message transmitted or received. - RPCMessageTypeKey = attribute.Key("message.type") - - // Identifier of message transmitted or received. - RPCMessageIDKey = attribute.Key("message.id") - - // The compressed size of the message transmitted or received in bytes. - RPCMessageCompressedSizeKey = attribute.Key("message.compressed_size") - - // The uncompressed size of the message transmitted or received in - // bytes. - RPCMessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") -) - -// Semantic conventions for common RPC attributes. -var ( - // Semantic convention for gRPC as the remoting system. - RPCSystemGRPC = semconv.RPCSystemGRPC - - // Semantic convention for a message named message. - RPCNameMessage = RPCNameKey.String("message") - - // Semantic conventions for RPC message types. - RPCMessageTypeSent = RPCMessageTypeKey.String("SENT") - RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED") -) diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go index 216127d6fb..0340ca7766 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/stats_handler.go @@ -8,16 +8,17 @@ import ( "sync/atomic" "time" - grpc_codes "google.golang.org/grpc/codes" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - + "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/metric" - semconv "go.opentelemetry.io/otel/semconv/v1.17.0" + semconv "go.opentelemetry.io/otel/semconv/v1.39.0" + "go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv" "go.opentelemetry.io/otel/trace" + grpc_codes "google.golang.org/grpc/codes" + "google.golang.org/grpc/peer" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/status" "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal" ) @@ -25,77 +26,168 @@ import ( type gRPCContextKey struct{} type gRPCContext struct { - inMessages int64 - outMessages int64 - metricAttrs []attribute.KeyValue - record bool + inMessages int64 + outMessages int64 + metricAttrs []attribute.KeyValue + metricAttrSet attribute.Set + record bool } type serverHandler struct { *config + + tracer trace.Tracer + + duration rpcconv.ServerCallDuration + inSize int64Hist + outSize int64Hist } // NewServerHandler creates a stats.Handler for a gRPC server. func NewServerHandler(opts ...Option) stats.Handler { - h := &serverHandler{ - config: newConfig(opts, "server"), + c := newConfig(opts) + h := &serverHandler{config: c} + + h.tracer = c.TracerProvider.Tracer( + ScopeName, + trace.WithInstrumentationVersion(Version), + ) + + meter := c.MeterProvider.Meter( + ScopeName, + metric.WithInstrumentationVersion(Version), + metric.WithSchemaURL(semconv.SchemaURL), + ) + + var err error + h.duration, err = rpcconv.NewServerCallDuration(meter) + if err != nil { + otel.Handle(err) + } + + h.inSize, err = rpcconv.NewServerRequestSize(meter) + if err != nil { + otel.Handle(err) + } + + h.outSize, err = rpcconv.NewServerResponseSize(meter) + if err != nil { + otel.Handle(err) } return h } // TagConn can attach some information to the given context. -func (h *serverHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context { +func (*serverHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context { return ctx } // HandleConn processes the Conn stats. -func (h *serverHandler) HandleConn(ctx context.Context, info stats.ConnStats) { +func (*serverHandler) HandleConn(context.Context, stats.ConnStats) { } // TagRPC can attach some information to the given context. func (h *serverHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { - ctx = extract(ctx, h.config.Propagators) + ctx = extract(ctx, h.Propagators) name, attrs := internal.ParseFullMethod(info.FullMethodName) - attrs = append(attrs, RPCSystemGRPC) + attrs = append(attrs, semconv.RPCSystemNameGRPC) record := true - if h.config.Filter != nil { - record = h.config.Filter(info) + if h.Filter != nil { + record = h.Filter(info) } if record { + // Make a new slice to avoid aliasing into the same attrs slice used by metrics. + spanAttributes := make([]attribute.KeyValue, 0, len(attrs)+len(h.SpanAttributes)) + spanAttributes = append(append(spanAttributes, attrs...), h.SpanAttributes...) + opts := []trace.SpanStartOption{ + trace.WithSpanKind(trace.SpanKindServer), + trace.WithAttributes(spanAttributes...), + } + if h.PublicEndpoint || (h.PublicEndpointFn != nil && h.PublicEndpointFn(ctx, info)) { + opts = append(opts, trace.WithNewRoot()) + // Linking incoming span context if any for public endpoint. + if s := trace.SpanContextFromContext(ctx); s.IsValid() && s.IsRemote() { + opts = append(opts, trace.WithLinks(trace.Link{SpanContext: s})) + } + } ctx, _ = h.tracer.Start( trace.ContextWithRemoteSpanContext(ctx, trace.SpanContextFromContext(ctx)), name, - trace.WithSpanKind(trace.SpanKindServer), - trace.WithAttributes(append(attrs, h.config.SpanAttributes...)...), + opts..., ) } gctx := gRPCContext{ - metricAttrs: append(attrs, h.config.MetricAttributes...), + metricAttrs: append(attrs, h.MetricAttributes...), record: record, } + if h.MetricAttributesFn != nil { + extraAttrs := h.MetricAttributesFn(ctx) + gctx.metricAttrs = append(gctx.metricAttrs, extraAttrs...) + } + + gctx.metricAttrSet = attribute.NewSet(gctx.metricAttrs...) + return context.WithValue(ctx, gRPCContextKey{}, &gctx) } // HandleRPC processes the RPC stats. func (h *serverHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { - isServer := true - h.handleRPC(ctx, rs, isServer) + h.handleRPC( + ctx, + rs, + h.duration.Inst(), + h.inSize, + h.outSize, + serverStatus, + ) } type clientHandler struct { *config + + tracer trace.Tracer + + duration rpcconv.ClientCallDuration + inSize int64Hist + outSize int64Hist } // NewClientHandler creates a stats.Handler for a gRPC client. func NewClientHandler(opts ...Option) stats.Handler { - h := &clientHandler{ - config: newConfig(opts, "client"), + c := newConfig(opts) + h := &clientHandler{config: c} + + h.tracer = c.TracerProvider.Tracer( + ScopeName, + trace.WithInstrumentationVersion(Version), + ) + + meter := c.MeterProvider.Meter( + ScopeName, + metric.WithInstrumentationVersion(Version), + metric.WithSchemaURL(semconv.SchemaURL), + ) + + var err error + h.duration, err = rpcconv.NewClientCallDuration(meter) + if err != nil { + otel.Handle(err) + } + + h.inSize, err = rpcconv.NewClientResponseSize(meter) + if err != nil { + otel.Handle(err) + } + + h.outSize, err = rpcconv.NewClientRequestSize(meter) + if err != nil { + otel.Handle(err) } return h @@ -104,117 +196,151 @@ func NewClientHandler(opts ...Option) stats.Handler { // TagRPC can attach some information to the given context. func (h *clientHandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { name, attrs := internal.ParseFullMethod(info.FullMethodName) - attrs = append(attrs, RPCSystemGRPC) + attrs = append(attrs, semconv.RPCSystemNameGRPC) record := true - if h.config.Filter != nil { - record = h.config.Filter(info) + if h.Filter != nil { + record = h.Filter(info) } if record { + // Make a new slice to avoid aliasing into the same attrs slice used by metrics. + spanAttributes := make([]attribute.KeyValue, 0, len(attrs)+len(h.SpanAttributes)) + spanAttributes = append(append(spanAttributes, attrs...), h.SpanAttributes...) ctx, _ = h.tracer.Start( ctx, name, trace.WithSpanKind(trace.SpanKindClient), - trace.WithAttributes(append(attrs, h.config.SpanAttributes...)...), + trace.WithAttributes(spanAttributes...), ) } gctx := gRPCContext{ - metricAttrs: append(attrs, h.config.MetricAttributes...), + metricAttrs: append(attrs, h.MetricAttributes...), record: record, } - return inject(context.WithValue(ctx, gRPCContextKey{}, &gctx), h.config.Propagators) + if h.MetricAttributesFn != nil { + extraAttrs := h.MetricAttributesFn(ctx) + gctx.metricAttrs = append(gctx.metricAttrs, extraAttrs...) + } + + gctx.metricAttrSet = attribute.NewSet(gctx.metricAttrs...) + + return inject(context.WithValue(ctx, gRPCContextKey{}, &gctx), h.Propagators) } // HandleRPC processes the RPC stats. func (h *clientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { - isServer := false - h.handleRPC(ctx, rs, isServer) + h.handleRPC( + ctx, + rs, + h.duration.Inst(), + h.inSize, + h.outSize, + func(s *status.Status) (codes.Code, string) { + return codes.Error, s.Message() + }, + ) } // TagConn can attach some information to the given context. -func (h *clientHandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context { +func (*clientHandler) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context { return ctx } // HandleConn processes the Conn stats. -func (h *clientHandler) HandleConn(context.Context, stats.ConnStats) { +func (*clientHandler) HandleConn(context.Context, stats.ConnStats) { // no-op } -func (c *config) handleRPC(ctx context.Context, rs stats.RPCStats, isServer bool) { // nolint: revive // isServer is not a control flag. - span := trace.SpanFromContext(ctx) - var metricAttrs []attribute.KeyValue - var messageId int64 +type int64Hist interface { + RecordSet(context.Context, int64, attribute.Set) +} +func (c *config) handleRPC( + ctx context.Context, + rs stats.RPCStats, + duration metric.Float64Histogram, + inSize, outSize int64Hist, + recordStatus func(*status.Status) (codes.Code, string), +) { gctx, _ := ctx.Value(gRPCContextKey{}).(*gRPCContext) - if gctx != nil { - if !gctx.record { - return - } - metricAttrs = make([]attribute.KeyValue, 0, len(gctx.metricAttrs)+1) - metricAttrs = append(metricAttrs, gctx.metricAttrs...) + if gctx != nil && !gctx.record { + return } + span := trace.SpanFromContext(ctx) + var messageId int64 + switch rs := rs.(type) { case *stats.Begin: case *stats.InPayload: if gctx != nil { messageId = atomic.AddInt64(&gctx.inMessages, 1) - c.rpcInBytes.Record(ctx, int64(rs.Length), metric.WithAttributeSet(attribute.NewSet(metricAttrs...))) + inSize.RecordSet(ctx, int64(rs.Length), gctx.metricAttrSet) } - if c.ReceivedEvent { + if c.ReceivedEvent && span.IsRecording() { span.AddEvent("message", trace.WithAttributes( - semconv.MessageTypeReceived, - semconv.MessageIDKey.Int64(messageId), - semconv.MessageCompressedSizeKey.Int(rs.CompressedLength), - semconv.MessageUncompressedSizeKey.Int(rs.Length), + semconv.RPCMessageTypeReceived, + semconv.RPCMessageIDKey.Int64(messageId), + semconv.RPCMessageCompressedSizeKey.Int(rs.CompressedLength), + semconv.RPCMessageUncompressedSizeKey.Int(rs.Length), ), ) } case *stats.OutPayload: if gctx != nil { messageId = atomic.AddInt64(&gctx.outMessages, 1) - c.rpcOutBytes.Record(ctx, int64(rs.Length), metric.WithAttributeSet(attribute.NewSet(metricAttrs...))) + outSize.RecordSet(ctx, int64(rs.Length), gctx.metricAttrSet) } - if c.SentEvent { + if c.SentEvent && span.IsRecording() { span.AddEvent("message", trace.WithAttributes( - semconv.MessageTypeSent, - semconv.MessageIDKey.Int64(messageId), - semconv.MessageCompressedSizeKey.Int(rs.CompressedLength), - semconv.MessageUncompressedSizeKey.Int(rs.Length), + semconv.RPCMessageTypeSent, + semconv.RPCMessageIDKey.Int64(messageId), + semconv.RPCMessageCompressedSizeKey.Int(rs.CompressedLength), + semconv.RPCMessageUncompressedSizeKey.Int(rs.Length), ), ) } case *stats.OutTrailer: case *stats.OutHeader: - if p, ok := peer.FromContext(ctx); ok { - span.SetAttributes(peerAttr(p.Addr.String())...) + if span.IsRecording() { + if p, ok := peer.FromContext(ctx); ok { + span.SetAttributes(serverAddrAttrs(p.Addr.String())...) + } } case *stats.End: var rpcStatusAttr attribute.KeyValue + var s *status.Status if rs.Error != nil { - s, _ := status.FromError(rs.Error) - if isServer { - statusCode, msg := serverStatus(s) - span.SetStatus(statusCode, msg) - } else { - span.SetStatus(codes.Error, s.Message()) - } - rpcStatusAttr = semconv.RPCGRPCStatusCodeKey.Int(int(s.Code())) + s, _ = status.FromError(rs.Error) + rpcStatusAttr = semconv.RPCResponseStatusCode(s.Code().String()) } else { - rpcStatusAttr = semconv.RPCGRPCStatusCodeKey.Int(int(grpc_codes.OK)) + rpcStatusAttr = semconv.RPCResponseStatusCode(grpc_codes.OK.String()) + } + if span.IsRecording() { + if s != nil { + c, m := recordStatus(s) + span.SetStatus(c, m) + } + span.SetAttributes(rpcStatusAttr) + span.End() } - span.SetAttributes(rpcStatusAttr) - span.End() + var metricAttrs []attribute.KeyValue + if gctx != nil { + // Don't use gctx.metricAttrSet here, because it requires passing + // multiple RecordOptions, which would call metric.mergeSets and + // allocate a new set for each Record call. + metricAttrs = make([]attribute.KeyValue, 0, len(gctx.metricAttrs)+1) + metricAttrs = append(metricAttrs, gctx.metricAttrs...) + } metricAttrs = append(metricAttrs, rpcStatusAttr) // Allocate vararg slice once. recordOpts := []metric.RecordOption{metric.WithAttributeSet(attribute.NewSet(metricAttrs...))} @@ -223,11 +349,7 @@ func (c *config) handleRPC(ctx context.Context, rs stats.RPCStats, isServer bool // Measure right before calling Record() to capture as much elapsed time as possible. elapsedTime := float64(rs.EndTime.Sub(rs.BeginTime)) / float64(time.Millisecond) - c.rpcDuration.Record(ctx, elapsedTime, recordOpts...) - if gctx != nil { - c.rpcInMessages.Record(ctx, atomic.LoadInt64(&gctx.inMessages), recordOpts...) - c.rpcOutMessages.Record(ctx, atomic.LoadInt64(&gctx.outMessages), recordOpts...) - } + duration.Record(ctx, elapsedTime, recordOpts...) default: return } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go index 442e8a838b..f9f963fdd9 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/version.go @@ -4,14 +4,4 @@ package otelgrpc // import "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" // Version is the current release version of the gRPC instrumentation. -func Version() string { - return "0.60.0" - // This string is updated by the pre_release.sh script during release -} - -// SemVersion is the semantic version to be supplied to tracer/meter creation. -// -// Deprecated: Use [Version] instead. -func SemVersion() string { - return Version() -} +const Version = "0.65.0" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE index 261eeb9e9f..f1aee0f110 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/LICENSE @@ -199,3 +199,33 @@ 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. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go deleted file mode 100644 index b25641c55d..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/client.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" - -import ( - "context" - "io" - "net/http" - "net/url" - "strings" -) - -// DefaultClient is the default Client and is used by Get, Head, Post and PostForm. -// Please be careful of initialization order - for example, if you change -// the global propagator, the DefaultClient might still be using the old one. -var DefaultClient = &http.Client{Transport: NewTransport(http.DefaultTransport)} - -// Get is a convenient replacement for http.Get that adds a span around the request. -func Get(ctx context.Context, targetURL string) (resp *http.Response, err error) { - req, err := http.NewRequestWithContext(ctx, http.MethodGet, targetURL, nil) - if err != nil { - return nil, err - } - return DefaultClient.Do(req) -} - -// Head is a convenient replacement for http.Head that adds a span around the request. -func Head(ctx context.Context, targetURL string) (resp *http.Response, err error) { - req, err := http.NewRequestWithContext(ctx, http.MethodHead, targetURL, nil) - if err != nil { - return nil, err - } - return DefaultClient.Do(req) -} - -// Post is a convenient replacement for http.Post that adds a span around the request. -func Post(ctx context.Context, targetURL, contentType string, body io.Reader) (resp *http.Response, err error) { - req, err := http.NewRequestWithContext(ctx, http.MethodPost, targetURL, body) - if err != nil { - return nil, err - } - req.Header.Set("Content-Type", contentType) - return DefaultClient.Do(req) -} - -// PostForm is a convenient replacement for http.PostForm that adds a span around the request. -func PostForm(ctx context.Context, targetURL string, data url.Values) (resp *http.Response, err error) { - return Post(ctx, targetURL, "application/x-www-form-urlencoded", strings.NewReader(data.Encode())) -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go index a83a026274..3ae0824344 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/common.go @@ -23,5 +23,5 @@ const ( type Filter func(*http.Request) bool func newTracer(tp trace.TracerProvider) trace.Tracer { - return tp.Tracer(ScopeName, trace.WithInstrumentationVersion(Version())) + return tp.Tracer(ScopeName, trace.WithInstrumentationVersion(Version)) } diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go index 6bd50d4c9b..f7338b7e52 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/config.go @@ -8,9 +8,8 @@ import ( "net/http" "net/http/httptrace" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" @@ -27,7 +26,6 @@ type config struct { Meter metric.Meter Propagators propagation.TextMapPropagator SpanStartOptions []trace.SpanStartOption - PublicEndpoint bool PublicEndpointFn func(*http.Request) bool ReadEvent bool WriteEvent bool @@ -68,7 +66,7 @@ func newConfig(opts ...Option) *config { c.Meter = c.MeterProvider.Meter( ScopeName, - metric.WithInstrumentationVersion(Version()), + metric.WithInstrumentationVersion(Version), ) return c @@ -94,20 +92,10 @@ func WithMeterProvider(provider metric.MeterProvider) Option { }) } -// WithPublicEndpoint configures the Handler to link the span with an incoming -// span context. If this option is not provided, then the association is a child -// association instead of a link. -func WithPublicEndpoint() Option { - return optionFunc(func(c *config) { - c.PublicEndpoint = true - }) -} - // WithPublicEndpointFn runs with every request, and allows conditionally // configuring the Handler to link the span with an incoming span context. If // this option is not provided or returns false, then the association is a // child association instead of a link. -// Note: WithPublicEndpoint takes precedence over WithPublicEndpointFn. func WithPublicEndpointFn(fn func(*http.Request) bool) Option { return optionFunc(func(c *config) { c.PublicEndpointFn = fn @@ -144,11 +132,13 @@ func WithFilter(f Filter) Option { }) } -type event int +// Event represents message event types for [WithMessageEvents]. +type Event int // Different types of events that can be recorded, see WithMessageEvents. const ( - ReadEvents event = iota + unspecifiedEvents Event = iota + ReadEvents WriteEvents ) @@ -161,7 +151,7 @@ const ( // using the ReadBytesKey // - WriteEvents: Record the number of bytes written after every http.ResponeWriter.Write // using the WriteBytesKey -func WithMessageEvents(events ...event) Option { +func WithMessageEvents(events ...Event) Option { return optionFunc(func(c *config) { for _, e := range events { switch e { diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go index 56b24b982a..1c9aa3ff42 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/doc.go @@ -2,6 +2,5 @@ // SPDX-License-Identifier: Apache-2.0 // Package otelhttp provides an http.Handler and functions that are intended -// to be used to add tracing by wrapping existing handlers (with Handler) and -// routes WithRouteTag. +// to be used to add tracing by wrapping existing handlers. package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go index 937f9b4e73..1ecd4be2dd 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/handler.go @@ -8,13 +8,13 @@ import ( "time" "github.com/felixge/httpsnoop" - - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" "go.opentelemetry.io/otel/trace" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" ) // middleware is an http middleware which wraps the next handler in a span. @@ -29,7 +29,6 @@ type middleware struct { writeEvent bool filters []Filter spanNameFormatter func(string, *http.Request) string - publicEndpoint bool publicEndpointFn func(*http.Request) bool metricAttributesFn func(*http.Request) []attribute.KeyValue @@ -77,7 +76,6 @@ func (h *middleware) configure(c *config) { h.writeEvent = c.WriteEvent h.filters = c.Filters h.spanNameFormatter = c.SpanNameFormatter - h.publicEndpoint = c.PublicEndpoint h.publicEndpointFn = c.PublicEndpointFn h.server = c.ServerName h.semconv = semconv.NewHTTPServer(c.Meter) @@ -102,7 +100,7 @@ func (h *middleware) serveHTTP(w http.ResponseWriter, r *http.Request, next http } opts = append(opts, h.spanStartOptions...) - if h.publicEndpoint || (h.publicEndpointFn != nil && h.publicEndpointFn(r.WithContext(ctx))) { + if h.publicEndpointFn != nil && h.publicEndpointFn(r.WithContext(ctx)) { opts = append(opts, trace.WithNewRoot()) // Linking incoming span context if any for public endpoint. if s := trace.SpanContextFromContext(ctx); s.IsValid() && s.IsRemote() { @@ -221,18 +219,3 @@ func (h *middleware) metricAttributesFromRequest(r *http.Request) []attribute.Ke } return attributeForRequest } - -// WithRouteTag annotates spans and metrics with the provided route name -// with HTTP route attribute. -func WithRouteTag(route string, h http.Handler) http.Handler { - attr := semconv.NewHTTPServer(nil).Route(route) - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - span := trace.SpanFromContext(r.Context()) - span.SetAttributes(attr) - - labeler, _ := LabelerFromContext(r.Context()) - labeler.Add(attr) - - h.ServeHTTP(w, r) - }) -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/client.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/client.go new file mode 100644 index 0000000000..29d6f508c1 --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/client.go @@ -0,0 +1,287 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconv/client.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv provides OpenTelemetry semantic convention types and +// functionality. +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "context" + "fmt" + "net/http" + "slices" + "strconv" + "strings" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/semconv/v1.39.0" + "go.opentelemetry.io/otel/semconv/v1.39.0/httpconv" +) + +type HTTPClient struct{ + requestBodySize httpconv.ClientRequestBodySize + requestDuration httpconv.ClientRequestDuration +} + +func NewHTTPClient(meter metric.Meter) HTTPClient { + client := HTTPClient{} + + var err error + client.requestBodySize, err = httpconv.NewClientRequestBodySize(meter) + handleErr(err) + + client.requestDuration, err = httpconv.NewClientRequestDuration( + meter, + metric.WithExplicitBucketBoundaries(0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10), + ) + handleErr(err) + + return client +} + +func (n HTTPClient) Status(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 400 { + return codes.Error, "" + } + return codes.Unset, "" +} + +// RequestTraceAttrs returns trace attributes for an HTTP request made by a client. +func (n HTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue { + /* + below attributes are returned: + - http.request.method + - http.request.method.original + - url.full + - server.address + - server.port + - network.protocol.name + - network.protocol.version + */ + numOfAttributes := 3 // URL, server address, proto, and method. + + var urlHost string + if req.URL != nil { + urlHost = req.URL.Host + } + var requestHost string + var requestPort int + for _, hostport := range []string{urlHost, req.Header.Get("Host")} { + requestHost, requestPort = SplitHostPort(hostport) + if requestHost != "" || requestPort > 0 { + break + } + } + + eligiblePort := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) + if eligiblePort > 0 { + numOfAttributes++ + } + useragent := req.UserAgent() + if useragent != "" { + numOfAttributes++ + } + + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" && protoName != "http" { + numOfAttributes++ + } + if protoVersion != "" { + numOfAttributes++ + } + + method, originalMethod := n.method(req.Method) + if originalMethod != (attribute.KeyValue{}) { + numOfAttributes++ + } + + attrs := make([]attribute.KeyValue, 0, numOfAttributes) + + attrs = append(attrs, method) + if originalMethod != (attribute.KeyValue{}) { + attrs = append(attrs, originalMethod) + } + + var u string + if req.URL != nil { + // Remove any username/password info that may be in the URL. + userinfo := req.URL.User + req.URL.User = nil + u = req.URL.String() + // Restore any username/password info that was removed. + req.URL.User = userinfo + } + attrs = append(attrs, semconv.URLFull(u)) + + attrs = append(attrs, semconv.ServerAddress(requestHost)) + if eligiblePort > 0 { + attrs = append(attrs, semconv.ServerPort(eligiblePort)) + } + + if protoName != "" && protoName != "http" { + attrs = append(attrs, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, semconv.NetworkProtocolVersion(protoVersion)) + } + + return attrs +} + +// ResponseTraceAttrs returns trace attributes for an HTTP response made by a client. +func (n HTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue { + /* + below attributes are returned: + - http.response.status_code + - error.type + */ + var count int + if resp.StatusCode > 0 { + count++ + } + + if isErrorStatusCode(resp.StatusCode) { + count++ + } + + attrs := make([]attribute.KeyValue, 0, count) + if resp.StatusCode > 0 { + attrs = append(attrs, semconv.HTTPResponseStatusCode(resp.StatusCode)) + } + + if isErrorStatusCode(resp.StatusCode) { + errorType := strconv.Itoa(resp.StatusCode) + attrs = append(attrs, semconv.ErrorTypeKey.String(errorType)) + } + return attrs +} + +func (n HTTPClient) method(method string) (attribute.KeyValue, attribute.KeyValue) { + if method == "" { + return semconv.HTTPRequestMethodGet, attribute.KeyValue{} + } + if attr, ok := methodLookup[method]; ok { + return attr, attribute.KeyValue{} + } + + orig := semconv.HTTPRequestMethodOriginal(method) + if attr, ok := methodLookup[strings.ToUpper(method)]; ok { + return attr, orig + } + return semconv.HTTPRequestMethodGet, orig +} + +func (n HTTPClient) MetricAttributes(req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { + num := len(additionalAttributes) + 2 + var h string + if req.URL != nil { + h = req.URL.Host + } + var requestHost string + var requestPort int + for _, hostport := range []string{h, req.Header.Get("Host")} { + requestHost, requestPort = SplitHostPort(hostport) + if requestHost != "" || requestPort > 0 { + break + } + } + + port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) + if port > 0 { + num++ + } + + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" { + num++ + } + if protoVersion != "" { + num++ + } + + if statusCode > 0 { + num++ + } + + attributes := slices.Grow(additionalAttributes, num) + attributes = append(attributes, + semconv.HTTPRequestMethodKey.String(standardizeHTTPMethod(req.Method)), + semconv.ServerAddress(requestHost), + n.scheme(req), + ) + + if port > 0 { + attributes = append(attributes, semconv.ServerPort(port)) + } + if protoName != "" { + attributes = append(attributes, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attributes = append(attributes, semconv.NetworkProtocolVersion(protoVersion)) + } + + if statusCode > 0 { + attributes = append(attributes, semconv.HTTPResponseStatusCode(statusCode)) + } + return attributes +} + +type MetricOpts struct { + measurement metric.MeasurementOption + addOptions metric.AddOption +} + +func (o MetricOpts) MeasurementOption() metric.MeasurementOption { + return o.measurement +} + +func (o MetricOpts) AddOptions() metric.AddOption { + return o.addOptions +} + +func (n HTTPClient) MetricOptions(ma MetricAttributes) map[string]MetricOpts { + opts := map[string]MetricOpts{} + + attributes := n.MetricAttributes(ma.Req, ma.StatusCode, ma.AdditionalAttributes) + set := metric.WithAttributeSet(attribute.NewSet(attributes...)) + opts["new"] = MetricOpts{ + measurement: set, + addOptions: set, + } + + return opts +} + +func (n HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts map[string]MetricOpts) { + n.requestBodySize.Inst().Record(ctx, md.RequestSize, opts["new"].MeasurementOption()) + n.requestDuration.Inst().Record(ctx, md.ElapsedTime/1000, opts["new"].MeasurementOption()) +} + +// TraceAttributes returns attributes for httptrace. +func (n HTTPClient) TraceAttributes(host string) []attribute.KeyValue { + return []attribute.KeyValue{ + semconv.ServerAddress(host), + } +} + +func (n HTTPClient) scheme(req *http.Request) attribute.KeyValue { + if req.URL != nil && req.URL.Scheme != "" { + return semconv.URLScheme(req.URL.Scheme) + } + if req.TLS != nil { + return semconv.URLScheme("https") + } + return semconv.URLScheme("http") +} + +func isErrorStatusCode(code int) bool { + return code >= 400 || code < 100 +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go deleted file mode 100644 index 7cb9693d98..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/env.go +++ /dev/null @@ -1,323 +0,0 @@ -// Code generated by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconv/env.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" - -import ( - "context" - "fmt" - "net/http" - "os" - "strings" - "sync" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - "go.opentelemetry.io/otel/metric" -) - -// OTelSemConvStabilityOptIn is an environment variable. -// That can be set to "http/dup" to keep getting the old HTTP semantic conventions. -const OTelSemConvStabilityOptIn = "OTEL_SEMCONV_STABILITY_OPT_IN" - -type ResponseTelemetry struct { - StatusCode int - ReadBytes int64 - ReadError error - WriteBytes int64 - WriteError error -} - -type HTTPServer struct { - duplicate bool - - // Old metrics - requestBytesCounter metric.Int64Counter - responseBytesCounter metric.Int64Counter - serverLatencyMeasure metric.Float64Histogram - - // New metrics - requestBodySizeHistogram metric.Int64Histogram - responseBodySizeHistogram metric.Int64Histogram - requestDurationHistogram metric.Float64Histogram -} - -// RequestTraceAttrs returns trace attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -func (s HTTPServer) RequestTraceAttrs(server string, req *http.Request, opts RequestTraceAttrsOpts) []attribute.KeyValue { - attrs := CurrentHTTPServer{}.RequestTraceAttrs(server, req, opts) - if s.duplicate { - return OldHTTPServer{}.RequestTraceAttrs(server, req, attrs) - } - return attrs -} - -func (s HTTPServer) NetworkTransportAttr(network string) []attribute.KeyValue { - if s.duplicate { - return []attribute.KeyValue{ - OldHTTPServer{}.NetworkTransportAttr(network), - CurrentHTTPServer{}.NetworkTransportAttr(network), - } - } - return []attribute.KeyValue{ - CurrentHTTPServer{}.NetworkTransportAttr(network), - } -} - -// ResponseTraceAttrs returns trace attributes for telemetry from an HTTP response. -// -// If any of the fields in the ResponseTelemetry are not set the attribute will be omitted. -func (s HTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue { - attrs := CurrentHTTPServer{}.ResponseTraceAttrs(resp) - if s.duplicate { - return OldHTTPServer{}.ResponseTraceAttrs(resp, attrs) - } - return attrs -} - -// Route returns the attribute for the route. -func (s HTTPServer) Route(route string) attribute.KeyValue { - return CurrentHTTPServer{}.Route(route) -} - -// Status returns a span status code and message for an HTTP status code -// value returned by a server. Status codes in the 400-499 range are not -// returned as errors. -func (s HTTPServer) Status(code int) (codes.Code, string) { - if code < 100 || code >= 600 { - return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) - } - if code >= 500 { - return codes.Error, "" - } - return codes.Unset, "" -} - -type ServerMetricData struct { - ServerName string - ResponseSize int64 - - MetricData - MetricAttributes -} - -type MetricAttributes struct { - Req *http.Request - StatusCode int - AdditionalAttributes []attribute.KeyValue -} - -type MetricData struct { - RequestSize int64 - - // The request duration, in milliseconds - ElapsedTime float64 -} - -var ( - metricAddOptionPool = &sync.Pool{ - New: func() interface{} { - return &[]metric.AddOption{} - }, - } - - metricRecordOptionPool = &sync.Pool{ - New: func() interface{} { - return &[]metric.RecordOption{} - }, - } -) - -func (s HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData) { - if s.requestDurationHistogram != nil && s.requestBodySizeHistogram != nil && s.responseBodySizeHistogram != nil { - attributes := CurrentHTTPServer{}.MetricAttributes(md.ServerName, md.Req, md.StatusCode, md.AdditionalAttributes) - o := metric.WithAttributeSet(attribute.NewSet(attributes...)) - recordOpts := metricRecordOptionPool.Get().(*[]metric.RecordOption) - *recordOpts = append(*recordOpts, o) - s.requestBodySizeHistogram.Record(ctx, md.RequestSize, *recordOpts...) - s.responseBodySizeHistogram.Record(ctx, md.ResponseSize, *recordOpts...) - s.requestDurationHistogram.Record(ctx, md.ElapsedTime/1000.0, o) - *recordOpts = (*recordOpts)[:0] - metricRecordOptionPool.Put(recordOpts) - } - - if s.duplicate && s.requestBytesCounter != nil && s.responseBytesCounter != nil && s.serverLatencyMeasure != nil { - attributes := OldHTTPServer{}.MetricAttributes(md.ServerName, md.Req, md.StatusCode, md.AdditionalAttributes) - o := metric.WithAttributeSet(attribute.NewSet(attributes...)) - addOpts := metricAddOptionPool.Get().(*[]metric.AddOption) - *addOpts = append(*addOpts, o) - s.requestBytesCounter.Add(ctx, md.RequestSize, *addOpts...) - s.responseBytesCounter.Add(ctx, md.ResponseSize, *addOpts...) - s.serverLatencyMeasure.Record(ctx, md.ElapsedTime, o) - *addOpts = (*addOpts)[:0] - metricAddOptionPool.Put(addOpts) - } -} - -// hasOptIn returns true if the comma-separated version string contains the -// exact optIn value. -func hasOptIn(version, optIn string) bool { - for _, v := range strings.Split(version, ",") { - if strings.TrimSpace(v) == optIn { - return true - } - } - return false -} - -func NewHTTPServer(meter metric.Meter) HTTPServer { - env := strings.ToLower(os.Getenv(OTelSemConvStabilityOptIn)) - duplicate := hasOptIn(env, "http/dup") - server := HTTPServer{ - duplicate: duplicate, - } - server.requestBodySizeHistogram, server.responseBodySizeHistogram, server.requestDurationHistogram = CurrentHTTPServer{}.createMeasures(meter) - if duplicate { - server.requestBytesCounter, server.responseBytesCounter, server.serverLatencyMeasure = OldHTTPServer{}.createMeasures(meter) - } - return server -} - -type HTTPClient struct { - duplicate bool - - // old metrics - requestBytesCounter metric.Int64Counter - responseBytesCounter metric.Int64Counter - latencyMeasure metric.Float64Histogram - - // new metrics - requestBodySize metric.Int64Histogram - requestDuration metric.Float64Histogram -} - -func NewHTTPClient(meter metric.Meter) HTTPClient { - env := strings.ToLower(os.Getenv(OTelSemConvStabilityOptIn)) - duplicate := hasOptIn(env, "http/dup") - client := HTTPClient{ - duplicate: duplicate, - } - client.requestBodySize, client.requestDuration = CurrentHTTPClient{}.createMeasures(meter) - if duplicate { - client.requestBytesCounter, client.responseBytesCounter, client.latencyMeasure = OldHTTPClient{}.createMeasures(meter) - } - - return client -} - -// RequestTraceAttrs returns attributes for an HTTP request made by a client. -func (c HTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue { - attrs := CurrentHTTPClient{}.RequestTraceAttrs(req) - if c.duplicate { - return OldHTTPClient{}.RequestTraceAttrs(req, attrs) - } - return attrs -} - -// ResponseTraceAttrs returns metric attributes for an HTTP request made by a client. -func (c HTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue { - attrs := CurrentHTTPClient{}.ResponseTraceAttrs(resp) - if c.duplicate { - return OldHTTPClient{}.ResponseTraceAttrs(resp, attrs) - } - return attrs -} - -func (c HTTPClient) Status(code int) (codes.Code, string) { - if code < 100 || code >= 600 { - return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) - } - if code >= 400 { - return codes.Error, "" - } - return codes.Unset, "" -} - -func (c HTTPClient) ErrorType(err error) attribute.KeyValue { - return CurrentHTTPClient{}.ErrorType(err) -} - -type MetricOpts struct { - measurement metric.MeasurementOption - addOptions metric.AddOption -} - -func (o MetricOpts) MeasurementOption() metric.MeasurementOption { - return o.measurement -} - -func (o MetricOpts) AddOptions() metric.AddOption { - return o.addOptions -} - -func (c HTTPClient) MetricOptions(ma MetricAttributes) map[string]MetricOpts { - opts := map[string]MetricOpts{} - - attributes := CurrentHTTPClient{}.MetricAttributes(ma.Req, ma.StatusCode, ma.AdditionalAttributes) - set := metric.WithAttributeSet(attribute.NewSet(attributes...)) - opts["new"] = MetricOpts{ - measurement: set, - addOptions: set, - } - - if c.duplicate { - attributes := OldHTTPClient{}.MetricAttributes(ma.Req, ma.StatusCode, ma.AdditionalAttributes) - set := metric.WithAttributeSet(attribute.NewSet(attributes...)) - opts["old"] = MetricOpts{ - measurement: set, - addOptions: set, - } - } - - return opts -} - -func (s HTTPClient) RecordMetrics(ctx context.Context, md MetricData, opts map[string]MetricOpts) { - if s.requestBodySize == nil || s.requestDuration == nil { - // This will happen if an HTTPClient{} is used instead of NewHTTPClient(). - return - } - - s.requestBodySize.Record(ctx, md.RequestSize, opts["new"].MeasurementOption()) - s.requestDuration.Record(ctx, md.ElapsedTime/1000, opts["new"].MeasurementOption()) - - if s.duplicate { - s.requestBytesCounter.Add(ctx, md.RequestSize, opts["old"].AddOptions()) - s.latencyMeasure.Record(ctx, md.ElapsedTime, opts["old"].MeasurementOption()) - } -} - -func (s HTTPClient) RecordResponseSize(ctx context.Context, responseData int64, opts map[string]MetricOpts) { - if s.responseBytesCounter == nil { - // This will happen if an HTTPClient{} is used instead of NewHTTPClient(). - return - } - - s.responseBytesCounter.Add(ctx, responseData, opts["old"].AddOptions()) -} - -func (s HTTPClient) TraceAttributes(host string) []attribute.KeyValue { - attrs := CurrentHTTPClient{}.TraceAttributes(host) - if s.duplicate { - return OldHTTPClient{}.TraceAttributes(host, attrs) - } - - return attrs -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go index f2cf8a152d..a8a0d58df3 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/gen.go @@ -5,10 +5,11 @@ package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/ // Generate semconv package: //go:generate gotmpl --body=../../../../../../internal/shared/semconv/bench_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=bench_test.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconv/env.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=env.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconv/env_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=env_test.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconv/httpconv.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=httpconv.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconv/httpconv_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=httpconv_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/common_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=common_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/server.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=server.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/server_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=server_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/client.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=client.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/client_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=client_test.go +//go:generate gotmpl --body=../../../../../../internal/shared/semconv/httpconvtest_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=httpconvtest_test.go //go:generate gotmpl --body=../../../../../../internal/shared/semconv/util.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=util.go //go:generate gotmpl --body=../../../../../../internal/shared/semconv/util_test.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=util_test.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconv/v1.20.0.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp\" }" --out=v1.20.0.go diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/httpconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/httpconv.go deleted file mode 100644 index 53976b0d5a..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/httpconv.go +++ /dev/null @@ -1,573 +0,0 @@ -// Code generated by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconv/httpconv.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package semconv provides OpenTelemetry semantic convention types and -// functionality. -package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" - -import ( - "fmt" - "net/http" - "reflect" - "slices" - "strconv" - "strings" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" - semconvNew "go.opentelemetry.io/otel/semconv/v1.26.0" -) - -type RequestTraceAttrsOpts struct { - // If set, this is used as value for the "http.client_ip" attribute. - HTTPClientIP string -} - -type CurrentHTTPServer struct{} - -// RequestTraceAttrs returns trace attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -func (n CurrentHTTPServer) RequestTraceAttrs(server string, req *http.Request, opts RequestTraceAttrsOpts) []attribute.KeyValue { - count := 3 // ServerAddress, Method, Scheme - - var host string - var p int - if server == "" { - host, p = SplitHostPort(req.Host) - } else { - // Prioritize the primary server name. - host, p = SplitHostPort(server) - if p < 0 { - _, p = SplitHostPort(req.Host) - } - } - - hostPort := requiredHTTPPort(req.TLS != nil, p) - if hostPort > 0 { - count++ - } - - method, methodOriginal := n.method(req.Method) - if methodOriginal != (attribute.KeyValue{}) { - count++ - } - - scheme := n.scheme(req.TLS != nil) - - peer, peerPort := SplitHostPort(req.RemoteAddr) - if peer != "" { - // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a - // file-path that would be interpreted with a sock family. - count++ - if peerPort > 0 { - count++ - } - } - - useragent := req.UserAgent() - if useragent != "" { - count++ - } - - // For client IP, use, in order: - // 1. The value passed in the options - // 2. The value in the X-Forwarded-For header - // 3. The peer address - clientIP := opts.HTTPClientIP - if clientIP == "" { - clientIP = serverClientIP(req.Header.Get("X-Forwarded-For")) - if clientIP == "" { - clientIP = peer - } - } - if clientIP != "" { - count++ - } - - if req.URL != nil && req.URL.Path != "" { - count++ - } - - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" && protoName != "http" { - count++ - } - if protoVersion != "" { - count++ - } - - route := httpRoute(req.Pattern) - if route != "" { - count++ - } - - attrs := make([]attribute.KeyValue, 0, count) - attrs = append(attrs, - semconvNew.ServerAddress(host), - method, - scheme, - ) - - if hostPort > 0 { - attrs = append(attrs, semconvNew.ServerPort(hostPort)) - } - if methodOriginal != (attribute.KeyValue{}) { - attrs = append(attrs, methodOriginal) - } - - if peer, peerPort := SplitHostPort(req.RemoteAddr); peer != "" { - // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a - // file-path that would be interpreted with a sock family. - attrs = append(attrs, semconvNew.NetworkPeerAddress(peer)) - if peerPort > 0 { - attrs = append(attrs, semconvNew.NetworkPeerPort(peerPort)) - } - } - - if useragent != "" { - attrs = append(attrs, semconvNew.UserAgentOriginal(useragent)) - } - - if clientIP != "" { - attrs = append(attrs, semconvNew.ClientAddress(clientIP)) - } - - if req.URL != nil && req.URL.Path != "" { - attrs = append(attrs, semconvNew.URLPath(req.URL.Path)) - } - - if protoName != "" && protoName != "http" { - attrs = append(attrs, semconvNew.NetworkProtocolName(protoName)) - } - if protoVersion != "" { - attrs = append(attrs, semconvNew.NetworkProtocolVersion(protoVersion)) - } - - if route != "" { - attrs = append(attrs, n.Route(route)) - } - - return attrs -} - -func (n CurrentHTTPServer) NetworkTransportAttr(network string) attribute.KeyValue { - switch network { - case "tcp", "tcp4", "tcp6": - return semconvNew.NetworkTransportTCP - case "udp", "udp4", "udp6": - return semconvNew.NetworkTransportUDP - case "unix", "unixgram", "unixpacket": - return semconvNew.NetworkTransportUnix - default: - return semconvNew.NetworkTransportPipe - } -} - -func (n CurrentHTTPServer) method(method string) (attribute.KeyValue, attribute.KeyValue) { - if method == "" { - return semconvNew.HTTPRequestMethodGet, attribute.KeyValue{} - } - if attr, ok := methodLookup[method]; ok { - return attr, attribute.KeyValue{} - } - - orig := semconvNew.HTTPRequestMethodOriginal(method) - if attr, ok := methodLookup[strings.ToUpper(method)]; ok { - return attr, orig - } - return semconvNew.HTTPRequestMethodGet, orig -} - -func (n CurrentHTTPServer) scheme(https bool) attribute.KeyValue { // nolint:revive - if https { - return semconvNew.URLScheme("https") - } - return semconvNew.URLScheme("http") -} - -// ResponseTraceAttrs returns trace attributes for telemetry from an HTTP -// response. -// -// If any of the fields in the ResponseTelemetry are not set the attribute will -// be omitted. -func (n CurrentHTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue { - var count int - - if resp.ReadBytes > 0 { - count++ - } - if resp.WriteBytes > 0 { - count++ - } - if resp.StatusCode > 0 { - count++ - } - - attributes := make([]attribute.KeyValue, 0, count) - - if resp.ReadBytes > 0 { - attributes = append(attributes, - semconvNew.HTTPRequestBodySize(int(resp.ReadBytes)), - ) - } - if resp.WriteBytes > 0 { - attributes = append(attributes, - semconvNew.HTTPResponseBodySize(int(resp.WriteBytes)), - ) - } - if resp.StatusCode > 0 { - attributes = append(attributes, - semconvNew.HTTPResponseStatusCode(resp.StatusCode), - ) - } - - return attributes -} - -// Route returns the attribute for the route. -func (n CurrentHTTPServer) Route(route string) attribute.KeyValue { - return semconvNew.HTTPRoute(route) -} - -func (n CurrentHTTPServer) createMeasures(meter metric.Meter) (metric.Int64Histogram, metric.Int64Histogram, metric.Float64Histogram) { - if meter == nil { - return noop.Int64Histogram{}, noop.Int64Histogram{}, noop.Float64Histogram{} - } - - var err error - requestBodySizeHistogram, err := meter.Int64Histogram( - semconvNew.HTTPServerRequestBodySizeName, - metric.WithUnit(semconvNew.HTTPServerRequestBodySizeUnit), - metric.WithDescription(semconvNew.HTTPServerRequestBodySizeDescription), - ) - handleErr(err) - - responseBodySizeHistogram, err := meter.Int64Histogram( - semconvNew.HTTPServerResponseBodySizeName, - metric.WithUnit(semconvNew.HTTPServerResponseBodySizeUnit), - metric.WithDescription(semconvNew.HTTPServerResponseBodySizeDescription), - ) - handleErr(err) - requestDurationHistogram, err := meter.Float64Histogram( - semconvNew.HTTPServerRequestDurationName, - metric.WithUnit(semconvNew.HTTPServerRequestDurationUnit), - metric.WithDescription(semconvNew.HTTPServerRequestDurationDescription), - metric.WithExplicitBucketBoundaries(0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10), - ) - handleErr(err) - - return requestBodySizeHistogram, responseBodySizeHistogram, requestDurationHistogram -} - -func (n CurrentHTTPServer) MetricAttributes(server string, req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { - num := len(additionalAttributes) + 3 - var host string - var p int - if server == "" { - host, p = SplitHostPort(req.Host) - } else { - // Prioritize the primary server name. - host, p = SplitHostPort(server) - if p < 0 { - _, p = SplitHostPort(req.Host) - } - } - hostPort := requiredHTTPPort(req.TLS != nil, p) - if hostPort > 0 { - num++ - } - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" { - num++ - } - if protoVersion != "" { - num++ - } - - if statusCode > 0 { - num++ - } - - attributes := slices.Grow(additionalAttributes, num) - attributes = append(attributes, - semconvNew.HTTPRequestMethodKey.String(standardizeHTTPMethod(req.Method)), - n.scheme(req.TLS != nil), - semconvNew.ServerAddress(host)) - - if hostPort > 0 { - attributes = append(attributes, semconvNew.ServerPort(hostPort)) - } - if protoName != "" { - attributes = append(attributes, semconvNew.NetworkProtocolName(protoName)) - } - if protoVersion != "" { - attributes = append(attributes, semconvNew.NetworkProtocolVersion(protoVersion)) - } - - if statusCode > 0 { - attributes = append(attributes, semconvNew.HTTPResponseStatusCode(statusCode)) - } - return attributes -} - -type CurrentHTTPClient struct{} - -// RequestTraceAttrs returns trace attributes for an HTTP request made by a client. -func (n CurrentHTTPClient) RequestTraceAttrs(req *http.Request) []attribute.KeyValue { - /* - below attributes are returned: - - http.request.method - - http.request.method.original - - url.full - - server.address - - server.port - - network.protocol.name - - network.protocol.version - */ - numOfAttributes := 3 // URL, server address, proto, and method. - - var urlHost string - if req.URL != nil { - urlHost = req.URL.Host - } - var requestHost string - var requestPort int - for _, hostport := range []string{urlHost, req.Header.Get("Host")} { - requestHost, requestPort = SplitHostPort(hostport) - if requestHost != "" || requestPort > 0 { - break - } - } - - eligiblePort := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) - if eligiblePort > 0 { - numOfAttributes++ - } - useragent := req.UserAgent() - if useragent != "" { - numOfAttributes++ - } - - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" && protoName != "http" { - numOfAttributes++ - } - if protoVersion != "" { - numOfAttributes++ - } - - method, originalMethod := n.method(req.Method) - if originalMethod != (attribute.KeyValue{}) { - numOfAttributes++ - } - - attrs := make([]attribute.KeyValue, 0, numOfAttributes) - - attrs = append(attrs, method) - if originalMethod != (attribute.KeyValue{}) { - attrs = append(attrs, originalMethod) - } - - var u string - if req.URL != nil { - // Remove any username/password info that may be in the URL. - userinfo := req.URL.User - req.URL.User = nil - u = req.URL.String() - // Restore any username/password info that was removed. - req.URL.User = userinfo - } - attrs = append(attrs, semconvNew.URLFull(u)) - - attrs = append(attrs, semconvNew.ServerAddress(requestHost)) - if eligiblePort > 0 { - attrs = append(attrs, semconvNew.ServerPort(eligiblePort)) - } - - if protoName != "" && protoName != "http" { - attrs = append(attrs, semconvNew.NetworkProtocolName(protoName)) - } - if protoVersion != "" { - attrs = append(attrs, semconvNew.NetworkProtocolVersion(protoVersion)) - } - - return attrs -} - -// ResponseTraceAttrs returns trace attributes for an HTTP response made by a client. -func (n CurrentHTTPClient) ResponseTraceAttrs(resp *http.Response) []attribute.KeyValue { - /* - below attributes are returned: - - http.response.status_code - - error.type - */ - var count int - if resp.StatusCode > 0 { - count++ - } - - if isErrorStatusCode(resp.StatusCode) { - count++ - } - - attrs := make([]attribute.KeyValue, 0, count) - if resp.StatusCode > 0 { - attrs = append(attrs, semconvNew.HTTPResponseStatusCode(resp.StatusCode)) - } - - if isErrorStatusCode(resp.StatusCode) { - errorType := strconv.Itoa(resp.StatusCode) - attrs = append(attrs, semconvNew.ErrorTypeKey.String(errorType)) - } - return attrs -} - -func (n CurrentHTTPClient) ErrorType(err error) attribute.KeyValue { - t := reflect.TypeOf(err) - var value string - if t.PkgPath() == "" && t.Name() == "" { - // Likely a builtin type. - value = t.String() - } else { - value = fmt.Sprintf("%s.%s", t.PkgPath(), t.Name()) - } - - if value == "" { - return semconvNew.ErrorTypeOther - } - - return semconvNew.ErrorTypeKey.String(value) -} - -func (n CurrentHTTPClient) method(method string) (attribute.KeyValue, attribute.KeyValue) { - if method == "" { - return semconvNew.HTTPRequestMethodGet, attribute.KeyValue{} - } - if attr, ok := methodLookup[method]; ok { - return attr, attribute.KeyValue{} - } - - orig := semconvNew.HTTPRequestMethodOriginal(method) - if attr, ok := methodLookup[strings.ToUpper(method)]; ok { - return attr, orig - } - return semconvNew.HTTPRequestMethodGet, orig -} - -func (n CurrentHTTPClient) createMeasures(meter metric.Meter) (metric.Int64Histogram, metric.Float64Histogram) { - if meter == nil { - return noop.Int64Histogram{}, noop.Float64Histogram{} - } - - var err error - requestBodySize, err := meter.Int64Histogram( - semconvNew.HTTPClientRequestBodySizeName, - metric.WithUnit(semconvNew.HTTPClientRequestBodySizeUnit), - metric.WithDescription(semconvNew.HTTPClientRequestBodySizeDescription), - ) - handleErr(err) - - requestDuration, err := meter.Float64Histogram( - semconvNew.HTTPClientRequestDurationName, - metric.WithUnit(semconvNew.HTTPClientRequestDurationUnit), - metric.WithDescription(semconvNew.HTTPClientRequestDurationDescription), - metric.WithExplicitBucketBoundaries(0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10), - ) - handleErr(err) - - return requestBodySize, requestDuration -} - -func (n CurrentHTTPClient) MetricAttributes(req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { - num := len(additionalAttributes) + 2 - var h string - if req.URL != nil { - h = req.URL.Host - } - var requestHost string - var requestPort int - for _, hostport := range []string{h, req.Header.Get("Host")} { - requestHost, requestPort = SplitHostPort(hostport) - if requestHost != "" || requestPort > 0 { - break - } - } - - port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) - if port > 0 { - num++ - } - - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" { - num++ - } - if protoVersion != "" { - num++ - } - - if statusCode > 0 { - num++ - } - - attributes := slices.Grow(additionalAttributes, num) - attributes = append(attributes, - semconvNew.HTTPRequestMethodKey.String(standardizeHTTPMethod(req.Method)), - semconvNew.ServerAddress(requestHost), - n.scheme(req), - ) - - if port > 0 { - attributes = append(attributes, semconvNew.ServerPort(port)) - } - if protoName != "" { - attributes = append(attributes, semconvNew.NetworkProtocolName(protoName)) - } - if protoVersion != "" { - attributes = append(attributes, semconvNew.NetworkProtocolVersion(protoVersion)) - } - - if statusCode > 0 { - attributes = append(attributes, semconvNew.HTTPResponseStatusCode(statusCode)) - } - return attributes -} - -// TraceAttributes returns attributes for httptrace. -func (n CurrentHTTPClient) TraceAttributes(host string) []attribute.KeyValue { - return []attribute.KeyValue{ - semconvNew.ServerAddress(host), - } -} - -func (n CurrentHTTPClient) scheme(req *http.Request) attribute.KeyValue { - if req.URL != nil && req.URL.Scheme != "" { - return semconvNew.URLScheme(req.URL.Scheme) - } - if req.TLS != nil { - return semconvNew.URLScheme("https") - } - return semconvNew.URLScheme("http") -} - -func isErrorStatusCode(code int) bool { - return code >= 400 || code < 100 -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go new file mode 100644 index 0000000000..e0e9ebc05d --- /dev/null +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/server.go @@ -0,0 +1,403 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/semconv/server.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package semconv provides OpenTelemetry semantic convention types and +// functionality. +package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" + +import ( + "context" + "fmt" + "net/http" + "slices" + "strings" + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/semconv/v1.39.0" + "go.opentelemetry.io/otel/semconv/v1.39.0/httpconv" +) + +type RequestTraceAttrsOpts struct { + // If set, this is used as value for the "http.client_ip" attribute. + HTTPClientIP string +} + +type ResponseTelemetry struct { + StatusCode int + ReadBytes int64 + ReadError error + WriteBytes int64 + WriteError error +} + +type HTTPServer struct{ + requestBodySizeHistogram httpconv.ServerRequestBodySize + responseBodySizeHistogram httpconv.ServerResponseBodySize + requestDurationHistogram httpconv.ServerRequestDuration +} + +func NewHTTPServer(meter metric.Meter) HTTPServer { + server := HTTPServer{} + + var err error + server.requestBodySizeHistogram, err = httpconv.NewServerRequestBodySize(meter) + handleErr(err) + + server.responseBodySizeHistogram, err = httpconv.NewServerResponseBodySize(meter) + handleErr(err) + + server.requestDurationHistogram, err = httpconv.NewServerRequestDuration( + meter, + metric.WithExplicitBucketBoundaries( + 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, + 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, + ), + ) + handleErr(err) + return server +} + +// Status returns a span status code and message for an HTTP status code +// value returned by a server. Status codes in the 400-499 range are not +// returned as errors. +func (n HTTPServer) Status(code int) (codes.Code, string) { + if code < 100 || code >= 600 { + return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) + } + if code >= 500 { + return codes.Error, "" + } + return codes.Unset, "" +} + +// RequestTraceAttrs returns trace attributes for an HTTP request received by a +// server. +// +// The server must be the primary server name if it is known. For example this +// would be the ServerName directive +// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache +// server, and the server_name directive +// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an +// nginx server. More generically, the primary server name would be the host +// header value that matches the default virtual host of an HTTP server. It +// should include the host identifier and if a port is used to route to the +// server that port identifier should be included as an appropriate port +// suffix. +// +// If the primary server name is not known, server should be an empty string. +// The req Host will be used to determine the server instead. +func (n HTTPServer) RequestTraceAttrs(server string, req *http.Request, opts RequestTraceAttrsOpts) []attribute.KeyValue { + count := 3 // ServerAddress, Method, Scheme + + var host string + var p int + if server == "" { + host, p = SplitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = SplitHostPort(server) + if p < 0 { + _, p = SplitHostPort(req.Host) + } + } + + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + count++ + } + + method, methodOriginal := n.method(req.Method) + if methodOriginal != (attribute.KeyValue{}) { + count++ + } + + scheme := n.scheme(req.TLS != nil) + + peer, peerPort := SplitHostPort(req.RemoteAddr) + if peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + count++ + if peerPort > 0 { + count++ + } + } + + useragent := req.UserAgent() + if useragent != "" { + count++ + } + + // For client IP, use, in order: + // 1. The value passed in the options + // 2. The value in the X-Forwarded-For header + // 3. The peer address + clientIP := opts.HTTPClientIP + if clientIP == "" { + clientIP = serverClientIP(req.Header.Get("X-Forwarded-For")) + if clientIP == "" { + clientIP = peer + } + } + if clientIP != "" { + count++ + } + + if req.URL != nil && req.URL.Path != "" { + count++ + } + + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" && protoName != "http" { + count++ + } + if protoVersion != "" { + count++ + } + + route := httpRoute(req.Pattern) + if route != "" { + count++ + } + + attrs := make([]attribute.KeyValue, 0, count) + attrs = append(attrs, + semconv.ServerAddress(host), + method, + scheme, + ) + + if hostPort > 0 { + attrs = append(attrs, semconv.ServerPort(hostPort)) + } + if methodOriginal != (attribute.KeyValue{}) { + attrs = append(attrs, methodOriginal) + } + + if peer, peerPort := SplitHostPort(req.RemoteAddr); peer != "" { + // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a + // file-path that would be interpreted with a sock family. + attrs = append(attrs, semconv.NetworkPeerAddress(peer)) + if peerPort > 0 { + attrs = append(attrs, semconv.NetworkPeerPort(peerPort)) + } + } + + if useragent != "" { + attrs = append(attrs, semconv.UserAgentOriginal(useragent)) + } + + if clientIP != "" { + attrs = append(attrs, semconv.ClientAddress(clientIP)) + } + + if req.URL != nil && req.URL.Path != "" { + attrs = append(attrs, semconv.URLPath(req.URL.Path)) + } + + if protoName != "" && protoName != "http" { + attrs = append(attrs, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attrs = append(attrs, semconv.NetworkProtocolVersion(protoVersion)) + } + + if route != "" { + attrs = append(attrs, n.Route(route)) + } + + return attrs +} + +func (s HTTPServer) NetworkTransportAttr(network string) []attribute.KeyValue { + attr := semconv.NetworkTransportPipe + switch network { + case "tcp", "tcp4", "tcp6": + attr = semconv.NetworkTransportTCP + case "udp", "udp4", "udp6": + attr = semconv.NetworkTransportUDP + case "unix", "unixgram", "unixpacket": + attr = semconv.NetworkTransportUnix + } + + return []attribute.KeyValue{attr} +} + +type ServerMetricData struct { + ServerName string + ResponseSize int64 + + MetricData + MetricAttributes +} + +type MetricAttributes struct { + Req *http.Request + StatusCode int + Route string + AdditionalAttributes []attribute.KeyValue +} + +type MetricData struct { + RequestSize int64 + + // The request duration, in milliseconds + ElapsedTime float64 +} + +var ( + metricAddOptionPool = &sync.Pool{ + New: func() any { + return &[]metric.AddOption{} + }, + } + + metricRecordOptionPool = &sync.Pool{ + New: func() any { + return &[]metric.RecordOption{} + }, + } +) + +func (n HTTPServer) RecordMetrics(ctx context.Context, md ServerMetricData) { + attributes := n.MetricAttributes(md.ServerName, md.Req, md.StatusCode, md.Route, md.AdditionalAttributes) + o := metric.WithAttributeSet(attribute.NewSet(attributes...)) + recordOpts := metricRecordOptionPool.Get().(*[]metric.RecordOption) + *recordOpts = append(*recordOpts, o) + n.requestBodySizeHistogram.Inst().Record(ctx, md.RequestSize, *recordOpts...) + n.responseBodySizeHistogram.Inst().Record(ctx, md.ResponseSize, *recordOpts...) + n.requestDurationHistogram.Inst().Record(ctx, md.ElapsedTime/1000.0, o) + *recordOpts = (*recordOpts)[:0] + metricRecordOptionPool.Put(recordOpts) +} + +func (n HTTPServer) method(method string) (attribute.KeyValue, attribute.KeyValue) { + if method == "" { + return semconv.HTTPRequestMethodGet, attribute.KeyValue{} + } + if attr, ok := methodLookup[method]; ok { + return attr, attribute.KeyValue{} + } + + orig := semconv.HTTPRequestMethodOriginal(method) + if attr, ok := methodLookup[strings.ToUpper(method)]; ok { + return attr, orig + } + return semconv.HTTPRequestMethodGet, orig +} + +func (n HTTPServer) scheme(https bool) attribute.KeyValue { //nolint:revive // ignore linter + if https { + return semconv.URLScheme("https") + } + return semconv.URLScheme("http") +} + +// ResponseTraceAttrs returns trace attributes for telemetry from an HTTP +// response. +// +// If any of the fields in the ResponseTelemetry are not set the attribute will +// be omitted. +func (n HTTPServer) ResponseTraceAttrs(resp ResponseTelemetry) []attribute.KeyValue { + var count int + + if resp.ReadBytes > 0 { + count++ + } + if resp.WriteBytes > 0 { + count++ + } + if resp.StatusCode > 0 { + count++ + } + + attributes := make([]attribute.KeyValue, 0, count) + + if resp.ReadBytes > 0 { + attributes = append(attributes, + semconv.HTTPRequestBodySize(int(resp.ReadBytes)), + ) + } + if resp.WriteBytes > 0 { + attributes = append(attributes, + semconv.HTTPResponseBodySize(int(resp.WriteBytes)), + ) + } + if resp.StatusCode > 0 { + attributes = append(attributes, + semconv.HTTPResponseStatusCode(resp.StatusCode), + ) + } + + return attributes +} + +// Route returns the attribute for the route. +func (n HTTPServer) Route(route string) attribute.KeyValue { + return semconv.HTTPRoute(route) +} + +func (n HTTPServer) MetricAttributes(server string, req *http.Request, statusCode int, route string, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { + num := len(additionalAttributes) + 3 + var host string + var p int + if server == "" { + host, p = SplitHostPort(req.Host) + } else { + // Prioritize the primary server name. + host, p = SplitHostPort(server) + if p < 0 { + _, p = SplitHostPort(req.Host) + } + } + hostPort := requiredHTTPPort(req.TLS != nil, p) + if hostPort > 0 { + num++ + } + protoName, protoVersion := netProtocol(req.Proto) + if protoName != "" { + num++ + } + if protoVersion != "" { + num++ + } + + if statusCode > 0 { + num++ + } + + if route != "" { + num++ + } + + attributes := slices.Grow(additionalAttributes, num) + attributes = append(attributes, + semconv.HTTPRequestMethodKey.String(standardizeHTTPMethod(req.Method)), + n.scheme(req.TLS != nil), + semconv.ServerAddress(host)) + + if hostPort > 0 { + attributes = append(attributes, semconv.ServerPort(hostPort)) + } + if protoName != "" { + attributes = append(attributes, semconv.NetworkProtocolName(protoName)) + } + if protoVersion != "" { + attributes = append(attributes, semconv.NetworkProtocolVersion(protoVersion)) + } + + if statusCode > 0 { + attributes = append(attributes, semconv.HTTPResponseStatusCode(statusCode)) + } + + if route != "" { + attributes = append(attributes, semconv.HTTPRoute(route)) + } + return attributes +} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go index bc1f7751db..131fda489b 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/util.go @@ -14,7 +14,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" - semconvNew "go.opentelemetry.io/otel/semconv/v1.26.0" + semconvNew "go.opentelemetry.io/otel/semconv/v1.39.0" ) // SplitHostPort splits a network address hostport of the form "host", @@ -53,10 +53,10 @@ func SplitHostPort(hostport string) (host string, port int) { if err != nil { return } - return host, int(p) // nolint: gosec // Byte size checked 16 above. + return host, int(p) //nolint:gosec // Byte size checked 16 above. } -func requiredHTTPPort(https bool, port int) int { // nolint:revive +func requiredHTTPPort(https bool, port int) int { //nolint:revive // ignore linter if https { if port > 0 && port != 443 { return port diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go deleted file mode 100644 index ba7fccf1ef..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv/v1.20.0.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconv/v120.0.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" - -import ( - "errors" - "io" - "net/http" - "slices" - - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/metric" - "go.opentelemetry.io/otel/metric/noop" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" -) - -type OldHTTPServer struct{} - -// RequestTraceAttrs returns trace attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -func (o OldHTTPServer) RequestTraceAttrs(server string, req *http.Request, attrs []attribute.KeyValue) []attribute.KeyValue { - return semconvutil.HTTPServerRequest(server, req, semconvutil.HTTPServerRequestOptions{}, attrs) -} - -func (o OldHTTPServer) NetworkTransportAttr(network string) attribute.KeyValue { - return semconvutil.NetTransport(network) -} - -// ResponseTraceAttrs returns trace attributes for telemetry from an HTTP response. -// -// If any of the fields in the ResponseTelemetry are not set the attribute will be omitted. -func (o OldHTTPServer) ResponseTraceAttrs(resp ResponseTelemetry, attributes []attribute.KeyValue) []attribute.KeyValue { - if resp.ReadBytes > 0 { - attributes = append(attributes, semconv.HTTPRequestContentLength(int(resp.ReadBytes))) - } - if resp.ReadError != nil && !errors.Is(resp.ReadError, io.EOF) { - // This is not in the semantic conventions, but is historically provided - attributes = append(attributes, attribute.String("http.read_error", resp.ReadError.Error())) - } - if resp.WriteBytes > 0 { - attributes = append(attributes, semconv.HTTPResponseContentLength(int(resp.WriteBytes))) - } - if resp.StatusCode > 0 { - attributes = append(attributes, semconv.HTTPStatusCode(resp.StatusCode)) - } - if resp.WriteError != nil && !errors.Is(resp.WriteError, io.EOF) { - // This is not in the semantic conventions, but is historically provided - attributes = append(attributes, attribute.String("http.write_error", resp.WriteError.Error())) - } - - return attributes -} - -// Route returns the attribute for the route. -func (o OldHTTPServer) Route(route string) attribute.KeyValue { - return semconv.HTTPRoute(route) -} - -// HTTPStatusCode returns the attribute for the HTTP status code. -// This is a temporary function needed by metrics. This will be removed when MetricsRequest is added. -func HTTPStatusCode(status int) attribute.KeyValue { - return semconv.HTTPStatusCode(status) -} - -// Server HTTP metrics. -const ( - serverRequestSize = "http.server.request.size" // Incoming request bytes total - serverResponseSize = "http.server.response.size" // Incoming response bytes total - serverDuration = "http.server.duration" // Incoming end to end duration, milliseconds -) - -func (h OldHTTPServer) createMeasures(meter metric.Meter) (metric.Int64Counter, metric.Int64Counter, metric.Float64Histogram) { - if meter == nil { - return noop.Int64Counter{}, noop.Int64Counter{}, noop.Float64Histogram{} - } - var err error - requestBytesCounter, err := meter.Int64Counter( - serverRequestSize, - metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP request messages."), - ) - handleErr(err) - - responseBytesCounter, err := meter.Int64Counter( - serverResponseSize, - metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP response messages."), - ) - handleErr(err) - - serverLatencyMeasure, err := meter.Float64Histogram( - serverDuration, - metric.WithUnit("ms"), - metric.WithDescription("Measures the duration of inbound HTTP requests."), - ) - handleErr(err) - - return requestBytesCounter, responseBytesCounter, serverLatencyMeasure -} - -func (o OldHTTPServer) MetricAttributes(server string, req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { - n := len(additionalAttributes) + 3 - var host string - var p int - if server == "" { - host, p = SplitHostPort(req.Host) - } else { - // Prioritize the primary server name. - host, p = SplitHostPort(server) - if p < 0 { - _, p = SplitHostPort(req.Host) - } - } - hostPort := requiredHTTPPort(req.TLS != nil, p) - if hostPort > 0 { - n++ - } - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" { - n++ - } - if protoVersion != "" { - n++ - } - - if statusCode > 0 { - n++ - } - - attributes := slices.Grow(additionalAttributes, n) - attributes = append(attributes, - semconv.HTTPMethod(standardizeHTTPMethod(req.Method)), - o.scheme(req.TLS != nil), - semconv.NetHostName(host)) - - if hostPort > 0 { - attributes = append(attributes, semconv.NetHostPort(hostPort)) - } - if protoName != "" { - attributes = append(attributes, semconv.NetProtocolName(protoName)) - } - if protoVersion != "" { - attributes = append(attributes, semconv.NetProtocolVersion(protoVersion)) - } - - if statusCode > 0 { - attributes = append(attributes, semconv.HTTPStatusCode(statusCode)) - } - return attributes -} - -func (o OldHTTPServer) scheme(https bool) attribute.KeyValue { // nolint:revive - if https { - return semconv.HTTPSchemeHTTPS - } - return semconv.HTTPSchemeHTTP -} - -type OldHTTPClient struct{} - -func (o OldHTTPClient) RequestTraceAttrs(req *http.Request, attrs []attribute.KeyValue) []attribute.KeyValue { - return semconvutil.HTTPClientRequest(req, attrs) -} - -func (o OldHTTPClient) ResponseTraceAttrs(resp *http.Response, attrs []attribute.KeyValue) []attribute.KeyValue { - return semconvutil.HTTPClientResponse(resp, attrs) -} - -func (o OldHTTPClient) MetricAttributes(req *http.Request, statusCode int, additionalAttributes []attribute.KeyValue) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.method string - http.status_code int - net.peer.name string - net.peer.port int - */ - - n := 2 // method, peer name. - var h string - if req.URL != nil { - h = req.URL.Host - } - var requestHost string - var requestPort int - for _, hostport := range []string{h, req.Header.Get("Host")} { - requestHost, requestPort = SplitHostPort(hostport) - if requestHost != "" || requestPort > 0 { - break - } - } - - port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", requestPort) - if port > 0 { - n++ - } - - if statusCode > 0 { - n++ - } - - attributes := slices.Grow(additionalAttributes, n) - attributes = append(attributes, - semconv.HTTPMethod(standardizeHTTPMethod(req.Method)), - semconv.NetPeerName(requestHost), - ) - - if port > 0 { - attributes = append(attributes, semconv.NetPeerPort(port)) - } - - if statusCode > 0 { - attributes = append(attributes, semconv.HTTPStatusCode(statusCode)) - } - return attributes -} - -// Client HTTP metrics. -const ( - clientRequestSize = "http.client.request.size" // Incoming request bytes total - clientResponseSize = "http.client.response.size" // Incoming response bytes total - clientDuration = "http.client.duration" // Incoming end to end duration, milliseconds -) - -func (o OldHTTPClient) createMeasures(meter metric.Meter) (metric.Int64Counter, metric.Int64Counter, metric.Float64Histogram) { - if meter == nil { - return noop.Int64Counter{}, noop.Int64Counter{}, noop.Float64Histogram{} - } - requestBytesCounter, err := meter.Int64Counter( - clientRequestSize, - metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP request messages."), - ) - handleErr(err) - - responseBytesCounter, err := meter.Int64Counter( - clientResponseSize, - metric.WithUnit("By"), - metric.WithDescription("Measures the size of HTTP response messages."), - ) - handleErr(err) - - latencyMeasure, err := meter.Float64Histogram( - clientDuration, - metric.WithUnit("ms"), - metric.WithDescription("Measures the duration of outbound HTTP requests."), - ) - handleErr(err) - - return requestBytesCounter, responseBytesCounter, latencyMeasure -} - -// TraceAttributes returns attributes for httptrace. -func (c OldHTTPClient) TraceAttributes(host string, attrs []attribute.KeyValue) []attribute.KeyValue { - return append(attrs, semconv.NetHostName(host)) -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go deleted file mode 100644 index 7aa5f99e81..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/gen.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" - -// Generate semconvutil package: -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv_test.go.tmpl "--data={}" --out=httpconv_test.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/httpconv.go.tmpl "--data={}" --out=httpconv.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv_test.go.tmpl "--data={}" --out=netconv_test.go -//go:generate gotmpl --body=../../../../../../internal/shared/semconvutil/netconv.go.tmpl "--data={}" --out=netconv.go diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go deleted file mode 100644 index b997354793..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/httpconv.go +++ /dev/null @@ -1,594 +0,0 @@ -// Code generated by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconvutil/httpconv.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package semconvutil provides OpenTelemetry semantic convention utilities. -package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" - -import ( - "fmt" - "net/http" - "slices" - "strings" - - "go.opentelemetry.io/otel/attribute" - "go.opentelemetry.io/otel/codes" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" -) - -type HTTPServerRequestOptions struct { - // If set, this is used as value for the "http.client_ip" attribute. - HTTPClientIP string -} - -// HTTPClientResponse returns trace attributes for an HTTP response received by a -// client from a server. It will return the following attributes if the related -// values are defined in resp: "http.status.code", -// "http.response_content_length". -// -// This does not add all OpenTelemetry required attributes for an HTTP event, -// it assumes ClientRequest was used to create the span with a complete set of -// attributes. If a complete set of attributes can be generated using the -// request contained in resp. For example: -// -// HTTPClientResponse(resp, ClientRequest(resp.Request))) -func HTTPClientResponse(resp *http.Response, attrs []attribute.KeyValue) []attribute.KeyValue { - return hc.ClientResponse(resp, attrs) -} - -// HTTPClientRequest returns trace attributes for an HTTP request made by a client. -// The following attributes are always returned: "http.url", "http.method", -// "net.peer.name". The following attributes are returned if the related values -// are defined in req: "net.peer.port", "user_agent.original", -// "http.request_content_length". -func HTTPClientRequest(req *http.Request, attrs []attribute.KeyValue) []attribute.KeyValue { - return hc.ClientRequest(req, attrs) -} - -// HTTPClientRequestMetrics returns metric attributes for an HTTP request made by a client. -// The following attributes are always returned: "http.method", "net.peer.name". -// The following attributes are returned if the -// related values are defined in req: "net.peer.port". -func HTTPClientRequestMetrics(req *http.Request) []attribute.KeyValue { - return hc.ClientRequestMetrics(req) -} - -// HTTPClientStatus returns a span status code and message for an HTTP status code -// value received by a client. -func HTTPClientStatus(code int) (codes.Code, string) { - return hc.ClientStatus(code) -} - -// HTTPServerRequest returns trace attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "http.target", "net.host.name". The following attributes are returned if -// they related values are defined in req: "net.host.port", "net.sock.peer.addr", -// "net.sock.peer.port", "user_agent.original", "http.client_ip". -func HTTPServerRequest(server string, req *http.Request, opts HTTPServerRequestOptions, attrs []attribute.KeyValue) []attribute.KeyValue { - return hc.ServerRequest(server, req, opts, attrs) -} - -// HTTPServerRequestMetrics returns metric attributes for an HTTP request received by a -// server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "net.host.name". The following attributes are returned if they related -// values are defined in req: "net.host.port". -func HTTPServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { - return hc.ServerRequestMetrics(server, req) -} - -// HTTPServerStatus returns a span status code and message for an HTTP status code -// value returned by a server. Status codes in the 400-499 range are not -// returned as errors. -func HTTPServerStatus(code int) (codes.Code, string) { - return hc.ServerStatus(code) -} - -// httpConv are the HTTP semantic convention attributes defined for a version -// of the OpenTelemetry specification. -type httpConv struct { - NetConv *netConv - - HTTPClientIPKey attribute.Key - HTTPMethodKey attribute.Key - HTTPRequestContentLengthKey attribute.Key - HTTPResponseContentLengthKey attribute.Key - HTTPRouteKey attribute.Key - HTTPSchemeHTTP attribute.KeyValue - HTTPSchemeHTTPS attribute.KeyValue - HTTPStatusCodeKey attribute.Key - HTTPTargetKey attribute.Key - HTTPURLKey attribute.Key - UserAgentOriginalKey attribute.Key -} - -var hc = &httpConv{ - NetConv: nc, - - HTTPClientIPKey: semconv.HTTPClientIPKey, - HTTPMethodKey: semconv.HTTPMethodKey, - HTTPRequestContentLengthKey: semconv.HTTPRequestContentLengthKey, - HTTPResponseContentLengthKey: semconv.HTTPResponseContentLengthKey, - HTTPRouteKey: semconv.HTTPRouteKey, - HTTPSchemeHTTP: semconv.HTTPSchemeHTTP, - HTTPSchemeHTTPS: semconv.HTTPSchemeHTTPS, - HTTPStatusCodeKey: semconv.HTTPStatusCodeKey, - HTTPTargetKey: semconv.HTTPTargetKey, - HTTPURLKey: semconv.HTTPURLKey, - UserAgentOriginalKey: semconv.UserAgentOriginalKey, -} - -// ClientResponse returns attributes for an HTTP response received by a client -// from a server. The following attributes are returned if the related values -// are defined in resp: "http.status.code", "http.response_content_length". -// -// This does not add all OpenTelemetry required attributes for an HTTP event, -// it assumes ClientRequest was used to create the span with a complete set of -// attributes. If a complete set of attributes can be generated using the -// request contained in resp. For example: -// -// ClientResponse(resp, ClientRequest(resp.Request)) -func (c *httpConv) ClientResponse(resp *http.Response, attrs []attribute.KeyValue) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.status_code int - http.response_content_length int - */ - var n int - if resp.StatusCode > 0 { - n++ - } - if resp.ContentLength > 0 { - n++ - } - if n == 0 { - return attrs - } - - attrs = slices.Grow(attrs, n) - if resp.StatusCode > 0 { - attrs = append(attrs, c.HTTPStatusCodeKey.Int(resp.StatusCode)) - } - if resp.ContentLength > 0 { - attrs = append(attrs, c.HTTPResponseContentLengthKey.Int(int(resp.ContentLength))) - } - return attrs -} - -// ClientRequest returns attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.url", "http.method", -// "net.peer.name". The following attributes are returned if the related values -// are defined in req: "net.peer.port", "user_agent.original", -// "http.request_content_length", "user_agent.original". -func (c *httpConv) ClientRequest(req *http.Request, attrs []attribute.KeyValue) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.method string - user_agent.original string - http.url string - net.peer.name string - net.peer.port int - http.request_content_length int - */ - - /* The following semantic conventions are not returned: - http.status_code This requires the response. See ClientResponse. - http.response_content_length This requires the response. See ClientResponse. - net.sock.family This requires the socket used. - net.sock.peer.addr This requires the socket used. - net.sock.peer.name This requires the socket used. - net.sock.peer.port This requires the socket used. - http.resend_count This is something outside of a single request. - net.protocol.name The value is the Request is ignored, and the go client will always use "http". - net.protocol.version The value in the Request is ignored, and the go client will always use 1.1 or 2.0. - */ - n := 3 // URL, peer name, proto, and method. - var h string - if req.URL != nil { - h = req.URL.Host - } - peer, p := firstHostPort(h, req.Header.Get("Host")) - port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) - if port > 0 { - n++ - } - useragent := req.UserAgent() - if useragent != "" { - n++ - } - if req.ContentLength > 0 { - n++ - } - - attrs = slices.Grow(attrs, n) - attrs = append(attrs, c.method(req.Method)) - - var u string - if req.URL != nil { - // Remove any username/password info that may be in the URL. - userinfo := req.URL.User - req.URL.User = nil - u = req.URL.String() - // Restore any username/password info that was removed. - req.URL.User = userinfo - } - attrs = append(attrs, c.HTTPURLKey.String(u)) - - attrs = append(attrs, c.NetConv.PeerName(peer)) - if port > 0 { - attrs = append(attrs, c.NetConv.PeerPort(port)) - } - - if useragent != "" { - attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) - } - - if l := req.ContentLength; l > 0 { - attrs = append(attrs, c.HTTPRequestContentLengthKey.Int64(l)) - } - - return attrs -} - -// ClientRequestMetrics returns metric attributes for an HTTP request made by a client. The -// following attributes are always returned: "http.method", "net.peer.name". -// The following attributes are returned if the related values -// are defined in req: "net.peer.port". -func (c *httpConv) ClientRequestMetrics(req *http.Request) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.method string - net.peer.name string - net.peer.port int - */ - - n := 2 // method, peer name. - var h string - if req.URL != nil { - h = req.URL.Host - } - peer, p := firstHostPort(h, req.Header.Get("Host")) - port := requiredHTTPPort(req.URL != nil && req.URL.Scheme == "https", p) - if port > 0 { - n++ - } - - attrs := make([]attribute.KeyValue, 0, n) - attrs = append(attrs, c.method(req.Method), c.NetConv.PeerName(peer)) - - if port > 0 { - attrs = append(attrs, c.NetConv.PeerPort(port)) - } - - return attrs -} - -// ServerRequest returns attributes for an HTTP request received by a server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "http.target", "net.host.name". The following attributes are returned if they -// related values are defined in req: "net.host.port", "net.sock.peer.addr", -// "net.sock.peer.port", "user_agent.original", "http.client_ip", -// "net.protocol.name", "net.protocol.version". -func (c *httpConv) ServerRequest(server string, req *http.Request, opts HTTPServerRequestOptions, attrs []attribute.KeyValue) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.method string - http.scheme string - net.host.name string - net.host.port int - net.sock.peer.addr string - net.sock.peer.port int - user_agent.original string - http.client_ip string - net.protocol.name string Note: not set if the value is "http". - net.protocol.version string - http.target string Note: doesn't include the query parameter. - */ - - /* The following semantic conventions are not returned: - http.status_code This requires the response. - http.request_content_length This requires the len() of body, which can mutate it. - http.response_content_length This requires the response. - http.route This is not available. - net.sock.peer.name This would require a DNS lookup. - net.sock.host.addr The request doesn't have access to the underlying socket. - net.sock.host.port The request doesn't have access to the underlying socket. - - */ - n := 4 // Method, scheme, proto, and host name. - var host string - var p int - if server == "" { - host, p = splitHostPort(req.Host) - } else { - // Prioritize the primary server name. - host, p = splitHostPort(server) - if p < 0 { - _, p = splitHostPort(req.Host) - } - } - hostPort := requiredHTTPPort(req.TLS != nil, p) - if hostPort > 0 { - n++ - } - peer, peerPort := splitHostPort(req.RemoteAddr) - if peer != "" { - n++ - if peerPort > 0 { - n++ - } - } - useragent := req.UserAgent() - if useragent != "" { - n++ - } - - // For client IP, use, in order: - // 1. The value passed in the options - // 2. The value in the X-Forwarded-For header - // 3. The peer address - clientIP := opts.HTTPClientIP - if clientIP == "" { - clientIP = serverClientIP(req.Header.Get("X-Forwarded-For")) - if clientIP == "" { - clientIP = peer - } - } - if clientIP != "" { - n++ - } - - var target string - if req.URL != nil { - target = req.URL.Path - if target != "" { - n++ - } - } - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" && protoName != "http" { - n++ - } - if protoVersion != "" { - n++ - } - - attrs = slices.Grow(attrs, n) - - attrs = append(attrs, c.method(req.Method)) - attrs = append(attrs, c.scheme(req.TLS != nil)) - attrs = append(attrs, c.NetConv.HostName(host)) - - if hostPort > 0 { - attrs = append(attrs, c.NetConv.HostPort(hostPort)) - } - - if peer != "" { - // The Go HTTP server sets RemoteAddr to "IP:port", this will not be a - // file-path that would be interpreted with a sock family. - attrs = append(attrs, c.NetConv.SockPeerAddr(peer)) - if peerPort > 0 { - attrs = append(attrs, c.NetConv.SockPeerPort(peerPort)) - } - } - - if useragent != "" { - attrs = append(attrs, c.UserAgentOriginalKey.String(useragent)) - } - - if clientIP != "" { - attrs = append(attrs, c.HTTPClientIPKey.String(clientIP)) - } - - if target != "" { - attrs = append(attrs, c.HTTPTargetKey.String(target)) - } - - if protoName != "" && protoName != "http" { - attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) - } - if protoVersion != "" { - attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) - } - - return attrs -} - -// ServerRequestMetrics returns metric attributes for an HTTP request received -// by a server. -// -// The server must be the primary server name if it is known. For example this -// would be the ServerName directive -// (https://httpd.apache.org/docs/2.4/mod/core.html#servername) for an Apache -// server, and the server_name directive -// (http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name) for an -// nginx server. More generically, the primary server name would be the host -// header value that matches the default virtual host of an HTTP server. It -// should include the host identifier and if a port is used to route to the -// server that port identifier should be included as an appropriate port -// suffix. -// -// If the primary server name is not known, server should be an empty string. -// The req Host will be used to determine the server instead. -// -// The following attributes are always returned: "http.method", "http.scheme", -// "net.host.name". The following attributes are returned if they related -// values are defined in req: "net.host.port". -func (c *httpConv) ServerRequestMetrics(server string, req *http.Request) []attribute.KeyValue { - /* The following semantic conventions are returned if present: - http.scheme string - http.route string - http.method string - http.status_code int - net.host.name string - net.host.port int - net.protocol.name string Note: not set if the value is "http". - net.protocol.version string - */ - - n := 3 // Method, scheme, and host name. - var host string - var p int - if server == "" { - host, p = splitHostPort(req.Host) - } else { - // Prioritize the primary server name. - host, p = splitHostPort(server) - if p < 0 { - _, p = splitHostPort(req.Host) - } - } - hostPort := requiredHTTPPort(req.TLS != nil, p) - if hostPort > 0 { - n++ - } - protoName, protoVersion := netProtocol(req.Proto) - if protoName != "" { - n++ - } - if protoVersion != "" { - n++ - } - - attrs := make([]attribute.KeyValue, 0, n) - - attrs = append(attrs, c.methodMetric(req.Method)) - attrs = append(attrs, c.scheme(req.TLS != nil)) - attrs = append(attrs, c.NetConv.HostName(host)) - - if hostPort > 0 { - attrs = append(attrs, c.NetConv.HostPort(hostPort)) - } - if protoName != "" { - attrs = append(attrs, c.NetConv.NetProtocolName.String(protoName)) - } - if protoVersion != "" { - attrs = append(attrs, c.NetConv.NetProtocolVersion.String(protoVersion)) - } - - return attrs -} - -func (c *httpConv) method(method string) attribute.KeyValue { - if method == "" { - return c.HTTPMethodKey.String(http.MethodGet) - } - return c.HTTPMethodKey.String(method) -} - -func (c *httpConv) methodMetric(method string) attribute.KeyValue { - method = strings.ToUpper(method) - switch method { - case http.MethodConnect, http.MethodDelete, http.MethodGet, http.MethodHead, http.MethodOptions, http.MethodPatch, http.MethodPost, http.MethodPut, http.MethodTrace: - default: - method = "_OTHER" - } - return c.HTTPMethodKey.String(method) -} - -func (c *httpConv) scheme(https bool) attribute.KeyValue { // nolint:revive - if https { - return c.HTTPSchemeHTTPS - } - return c.HTTPSchemeHTTP -} - -func serverClientIP(xForwardedFor string) string { - if idx := strings.Index(xForwardedFor, ","); idx >= 0 { - xForwardedFor = xForwardedFor[:idx] - } - return xForwardedFor -} - -func requiredHTTPPort(https bool, port int) int { // nolint:revive - if https { - if port > 0 && port != 443 { - return port - } - } else { - if port > 0 && port != 80 { - return port - } - } - return -1 -} - -// Return the request host and port from the first non-empty source. -func firstHostPort(source ...string) (host string, port int) { - for _, hostport := range source { - host, port = splitHostPort(hostport) - if host != "" || port > 0 { - break - } - } - return -} - -// ClientStatus returns a span status code and message for an HTTP status code -// value received by a client. -func (c *httpConv) ClientStatus(code int) (codes.Code, string) { - if code < 100 || code >= 600 { - return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) - } - if code >= 400 { - return codes.Error, "" - } - return codes.Unset, "" -} - -// ServerStatus returns a span status code and message for an HTTP status code -// value returned by a server. Status codes in the 400-499 range are not -// returned as errors. -func (c *httpConv) ServerStatus(code int) (codes.Code, string) { - if code < 100 || code >= 600 { - return codes.Error, fmt.Sprintf("Invalid HTTP status code %d", code) - } - if code >= 500 { - return codes.Error, "" - } - return codes.Unset, "" -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go deleted file mode 100644 index df97255e41..0000000000 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil/netconv.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by gotmpl. DO NOT MODIFY. -// source: internal/shared/semconvutil/netconv.go.tmpl - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconvutil // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil" - -import ( - "net" - "strconv" - "strings" - - "go.opentelemetry.io/otel/attribute" - semconv "go.opentelemetry.io/otel/semconv/v1.20.0" -) - -// NetTransport returns a trace attribute describing the transport protocol of the -// passed network. See the net.Dial for information about acceptable network -// values. -func NetTransport(network string) attribute.KeyValue { - return nc.Transport(network) -} - -// netConv are the network semantic convention attributes defined for a version -// of the OpenTelemetry specification. -type netConv struct { - NetHostNameKey attribute.Key - NetHostPortKey attribute.Key - NetPeerNameKey attribute.Key - NetPeerPortKey attribute.Key - NetProtocolName attribute.Key - NetProtocolVersion attribute.Key - NetSockFamilyKey attribute.Key - NetSockPeerAddrKey attribute.Key - NetSockPeerPortKey attribute.Key - NetSockHostAddrKey attribute.Key - NetSockHostPortKey attribute.Key - NetTransportOther attribute.KeyValue - NetTransportTCP attribute.KeyValue - NetTransportUDP attribute.KeyValue - NetTransportInProc attribute.KeyValue -} - -var nc = &netConv{ - NetHostNameKey: semconv.NetHostNameKey, - NetHostPortKey: semconv.NetHostPortKey, - NetPeerNameKey: semconv.NetPeerNameKey, - NetPeerPortKey: semconv.NetPeerPortKey, - NetProtocolName: semconv.NetProtocolNameKey, - NetProtocolVersion: semconv.NetProtocolVersionKey, - NetSockFamilyKey: semconv.NetSockFamilyKey, - NetSockPeerAddrKey: semconv.NetSockPeerAddrKey, - NetSockPeerPortKey: semconv.NetSockPeerPortKey, - NetSockHostAddrKey: semconv.NetSockHostAddrKey, - NetSockHostPortKey: semconv.NetSockHostPortKey, - NetTransportOther: semconv.NetTransportOther, - NetTransportTCP: semconv.NetTransportTCP, - NetTransportUDP: semconv.NetTransportUDP, - NetTransportInProc: semconv.NetTransportInProc, -} - -func (c *netConv) Transport(network string) attribute.KeyValue { - switch network { - case "tcp", "tcp4", "tcp6": - return c.NetTransportTCP - case "udp", "udp4", "udp6": - return c.NetTransportUDP - case "unix", "unixgram", "unixpacket": - return c.NetTransportInProc - default: - // "ip:*", "ip4:*", and "ip6:*" all are considered other. - return c.NetTransportOther - } -} - -// Host returns attributes for a network host address. -func (c *netConv) Host(address string) []attribute.KeyValue { - h, p := splitHostPort(address) - var n int - if h != "" { - n++ - if p > 0 { - n++ - } - } - - if n == 0 { - return nil - } - - attrs := make([]attribute.KeyValue, 0, n) - attrs = append(attrs, c.HostName(h)) - if p > 0 { - attrs = append(attrs, c.HostPort(p)) - } - return attrs -} - -func (c *netConv) HostName(name string) attribute.KeyValue { - return c.NetHostNameKey.String(name) -} - -func (c *netConv) HostPort(port int) attribute.KeyValue { - return c.NetHostPortKey.Int(port) -} - -func family(network, address string) string { - switch network { - case "unix", "unixgram", "unixpacket": - return "unix" - default: - if ip := net.ParseIP(address); ip != nil { - if ip.To4() == nil { - return "inet6" - } - return "inet" - } - } - return "" -} - -// Peer returns attributes for a network peer address. -func (c *netConv) Peer(address string) []attribute.KeyValue { - h, p := splitHostPort(address) - var n int - if h != "" { - n++ - if p > 0 { - n++ - } - } - - if n == 0 { - return nil - } - - attrs := make([]attribute.KeyValue, 0, n) - attrs = append(attrs, c.PeerName(h)) - if p > 0 { - attrs = append(attrs, c.PeerPort(p)) - } - return attrs -} - -func (c *netConv) PeerName(name string) attribute.KeyValue { - return c.NetPeerNameKey.String(name) -} - -func (c *netConv) PeerPort(port int) attribute.KeyValue { - return c.NetPeerPortKey.Int(port) -} - -func (c *netConv) SockPeerAddr(addr string) attribute.KeyValue { - return c.NetSockPeerAddrKey.String(addr) -} - -func (c *netConv) SockPeerPort(port int) attribute.KeyValue { - return c.NetSockPeerPortKey.Int(port) -} - -// splitHostPort splits a network address hostport of the form "host", -// "host%zone", "[host]", "[host%zone], "host:port", "host%zone:port", -// "[host]:port", "[host%zone]:port", or ":port" into host or host%zone and -// port. -// -// An empty host is returned if it is not provided or unparsable. A negative -// port is returned if it is not provided or unparsable. -func splitHostPort(hostport string) (host string, port int) { - port = -1 - - if strings.HasPrefix(hostport, "[") { - addrEnd := strings.LastIndex(hostport, "]") - if addrEnd < 0 { - // Invalid hostport. - return - } - if i := strings.LastIndex(hostport[addrEnd:], ":"); i < 0 { - host = hostport[1:addrEnd] - return - } - } else { - if i := strings.LastIndex(hostport, ":"); i < 0 { - host = hostport - return - } - } - - host, pStr, err := net.SplitHostPort(hostport) - if err != nil { - return - } - - p, err := strconv.ParseUint(pStr, 10, 16) - if err != nil { - return - } - return host, int(p) // nolint: gosec // Bitsize checked to be 16 above. -} - -func netProtocol(proto string) (name string, version string) { - name, version, _ = strings.Cut(proto, "/") - switch name { - case "HTTP": - name = "http" - case "QUIC": - name = "quic" - case "SPDY": - name = "spdy" - default: - name = strings.ToLower(name) - } - return name, version -} diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go index 44b86ad860..59b6c5498d 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/transport.go @@ -5,20 +5,22 @@ package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http import ( "context" + "fmt" "io" "net/http" "net/http/httptrace" "sync/atomic" "time" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" - "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" - + otelsemconv "go.opentelemetry.io/otel/semconv/v1.39.0" "go.opentelemetry.io/otel/trace" + + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request" + "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv" ) // Transport implements the http.RoundTripper interface and wraps @@ -83,6 +85,8 @@ func defaultTransportFormatter(_ string, r *http.Request) string { // RoundTrip creates a Span and propagates its context via the provided request's headers // before handing the request to the configured base RoundTripper. The created span will // end when the response body is closed or when a read from the body returns io.EOF. +// If GetBody returns an error, the error is reported via otel.Handle and the request +// continues with the original Body. func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { requestStartTime := time.Now() for _, f := range t.filters { @@ -117,11 +121,22 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { r = r.Clone(ctx) // According to RoundTripper spec, we shouldn't modify the origin request. - // if request body is nil or NoBody, we don't want to mutate the body as it + // GetBody is preferred over direct access to Body if the function is set. + // If the resulting body is nil or is NoBody, we don't want to mutate the body as it // will affect the identity of it in an unforeseeable way because we assert // ReadCloser fulfills a certain interface and it is indeed nil or NoBody. - bw := request.NewBodyWrapper(r.Body, func(int64) {}) - if r.Body != nil && r.Body != http.NoBody { + body := r.Body + if r.GetBody != nil { + b, err := r.GetBody() + if err != nil { + otel.Handle(fmt.Errorf("http.Request GetBody returned an error: %w", err)) + } else { + body = b + } + } + + bw := request.NewBodyWrapper(body, func(int64) {}) + if body != nil && body != http.NoBody { r.Body = bw } @@ -129,47 +144,49 @@ func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error) { t.propagators.Inject(ctx, propagation.HeaderCarrier(r.Header)) res, err := t.rt.RoundTrip(r) - if err != nil { - // set error type attribute if the error is part of the predefined - // error types. - // otherwise, record it as an exception - if errType := t.semconv.ErrorType(err); errType.Valid() { - span.SetAttributes(errType) - } else { - span.RecordError(err) + + // Defer metrics recording function to record the metrics on error or no error. + defer func() { + metricAttributes := semconv.MetricAttributes{ + Req: r, + AdditionalAttributes: append(labeler.Get(), t.metricAttributesFromRequest(r)...), + } + + if err == nil { + metricAttributes.StatusCode = res.StatusCode } + metricOpts := t.semconv.MetricOptions(metricAttributes) + + metricData := semconv.MetricData{ + RequestSize: bw.BytesRead(), + } + + if err == nil { + readRecordFunc := func(int64) {} + res.Body = newWrappedBody(span, readRecordFunc, res.Body) + } + + // Use floating point division here for higher precision (instead of Millisecond method). + elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) + + metricData.ElapsedTime = elapsedTime + + t.semconv.RecordMetrics(ctx, metricData, metricOpts) + }() + + if err != nil { + span.SetAttributes(otelsemconv.ErrorType(err)) span.SetStatus(codes.Error, err.Error()) span.End() - return res, err - } - // metrics - metricOpts := t.semconv.MetricOptions(semconv.MetricAttributes{ - Req: r, - StatusCode: res.StatusCode, - AdditionalAttributes: append(labeler.Get(), t.metricAttributesFromRequest(r)...), - }) - - // For handling response bytes we leverage a callback when the client reads the http response - readRecordFunc := func(n int64) { - t.semconv.RecordResponseSize(ctx, n, metricOpts) + return res, err } // traces span.SetAttributes(t.semconv.ResponseTraceAttrs(res)...) span.SetStatus(t.semconv.Status(res.StatusCode)) - res.Body = newWrappedBody(span, readRecordFunc, res.Body) - - // Use floating point division here for higher precision (instead of Millisecond method). - elapsedTime := float64(time.Since(requestStartTime)) / float64(time.Millisecond) - - t.semconv.RecordMetrics(ctx, semconv.MetricData{ - RequestSize: bw.BytesRead(), - ElapsedTime: elapsedTime, - }, metricOpts) - return res, nil } @@ -219,7 +236,7 @@ func (wb *wrappedBody) Write(p []byte) (int, error) { // This will not panic given the guard in newWrappedBody. n, err := wb.body.(io.Writer).Write(p) if err != nil { - wb.span.RecordError(err) + wb.span.SetAttributes(otelsemconv.ErrorType(err)) wb.span.SetStatus(codes.Error, err.Error()) } return n, err @@ -237,7 +254,7 @@ func (wb *wrappedBody) Read(b []byte) (int, error) { wb.recordBytesRead() wb.span.End() default: - wb.span.RecordError(err) + wb.span.SetAttributes(otelsemconv.ErrorType(err)) wb.span.SetStatus(codes.Error, err.Error()) } return n, err diff --git a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go index 6be4c1fde2..d0107952e1 100644 --- a/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go +++ b/vendor/go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/version.go @@ -4,7 +4,4 @@ package otelhttp // import "go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp" // Version is the current release version of the otelhttp instrumentation. -func Version() string { - return "0.61.0" - // This string is updated by the pre_release.sh script during release -} +const Version = "0.65.0" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/LICENSE b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/LICENSE index 261eeb9e9f..f1aee0f110 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/LICENSE +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/LICENSE @@ -199,3 +199,33 @@ 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. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go index 3f0a518ae0..30446bd28b 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/exporter.go @@ -94,7 +94,7 @@ func NewUnstarted(client Client) *Exporter { } // MarshalLog is the marshaling function used by the logging system to represent this Exporter. -func (e *Exporter) MarshalLog() interface{} { +func (e *Exporter) MarshalLog() any { return struct { Type string Client Client diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go index 4571a5ca39..d9bfd6e176 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/attribute.go @@ -1,12 +1,15 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +// Package tracetransform provides conversion functionality for the otlptrace +// exporters. package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" import ( + commonpb "go.opentelemetry.io/proto/otlp/common/v1" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/sdk/resource" - commonpb "go.opentelemetry.io/proto/otlp/common/v1" ) // KeyValues transforms a slice of attribute KeyValues into OTLP key-values. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go index 2e7690e43a..43359c8944 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/instrumentation.go @@ -4,8 +4,9 @@ package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" import ( - "go.opentelemetry.io/otel/sdk/instrumentation" commonpb "go.opentelemetry.io/proto/otlp/common/v1" + + "go.opentelemetry.io/otel/sdk/instrumentation" ) func InstrumentationScope(il instrumentation.Scope) *commonpb.InstrumentationScope { diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go index db7b698a56..526bb5e070 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/resource.go @@ -4,8 +4,9 @@ package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform" import ( - "go.opentelemetry.io/otel/sdk/resource" resourcepb "go.opentelemetry.io/proto/otlp/resource/v1" + + "go.opentelemetry.io/otel/sdk/resource" ) // Resource transforms a Resource into an OTLP Resource. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go index bf27ef0220..d431fc4517 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform/span.go @@ -6,12 +6,13 @@ package tracetransform // import "go.opentelemetry.io/otel/exporters/otlp/otlptr import ( "math" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" + "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/sdk/instrumentation" tracesdk "go.opentelemetry.io/otel/sdk/trace" "go.opentelemetry.io/otel/trace" - tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) // Spans transforms a slice of OpenTelemetry spans into a slice of OTLP @@ -112,7 +113,7 @@ func span(sd tracesdk.ReadOnlySpan) *tracepb.Span { if psid := sd.Parent().SpanID(); psid.IsValid() { s.ParentSpanId = psid[:] } - s.Flags = buildSpanFlags(sd.Parent()) + s.Flags = buildSpanFlagsWith(sd.SpanContext().TraceFlags(), sd.Parent()) return s } @@ -154,12 +155,11 @@ func links(links []tracesdk.Link) []*tracepb.Span_Link { for _, otLink := range links { // This redefinition is necessary to prevent otLink.*ID[:] copies // being reused -- in short we need a new otLink per iteration. - otLink := otLink tid := otLink.SpanContext.TraceID() sid := otLink.SpanContext.SpanID() - flags := buildSpanFlags(otLink.SpanContext) + flags := buildSpanFlagsWith(otLink.SpanContext.TraceFlags(), otLink.SpanContext) sl = append(sl, &tracepb.Span_Link{ TraceId: tid[:], @@ -172,13 +172,15 @@ func links(links []tracesdk.Link) []*tracepb.Span_Link { return sl } -func buildSpanFlags(sc trace.SpanContext) uint32 { - flags := tracepb.SpanFlags_SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK - if sc.IsRemote() { - flags |= tracepb.SpanFlags_SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK +func buildSpanFlagsWith(tf trace.TraceFlags, parent trace.SpanContext) uint32 { + // Lower 8 bits are the W3C TraceFlags; always indicate that we know whether the parent is remote + flags := uint32(tf) | uint32(tracepb.SpanFlags_SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK) + // Set the parent-is-remote bit when applicable + if parent.IsRemote() { + flags |= uint32(tracepb.SpanFlags_SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK) } - return uint32(flags) // nolint:gosec // Flags is a bitmask and can't be negative + return flags // nolint:gosec // Flags is a bitmask and can't be negative } // spanEvents transforms span Events to an OTLP span events. @@ -189,7 +191,7 @@ func spanEvents(es []tracesdk.Event) []*tracepb.Span_Event { events := make([]*tracepb.Span_Event, len(es)) // Transform message events - for i := 0; i < len(es); i++ { + for i := range es { events[i] = &tracepb.Span_Event{ Name: es[i].Name, TimeUnixNano: uint64(max(0, es[i].Time.UnixNano())), // nolint:gosec // Overflow checked. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/LICENSE b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/LICENSE index 261eeb9e9f..f1aee0f110 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/LICENSE +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/LICENSE @@ -199,3 +199,33 @@ 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. + +-------------------------------------------------------------------------------- + +Copyright 2009 The Go Authors. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google LLC nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go index 8409b5f8f9..76b7cd461b 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -9,19 +9,20 @@ import ( "sync" "time" + coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" + tracepb "go.opentelemetry.io/proto/otlp/trace/v1" "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/exporters/otlp/otlptrace" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry" - coltracepb "go.opentelemetry.io/proto/otlp/collector/trace/v1" - tracepb "go.opentelemetry.io/proto/otlp/trace/v1" ) type client struct { @@ -45,6 +46,9 @@ type client struct { conn *grpc.ClientConn tscMu sync.RWMutex tsc coltracepb.TraceServiceClient + + instID int64 + inst *observ.Instrumentation } // Compile time check *client implements otlptrace.Client. @@ -68,6 +72,7 @@ func newClient(opts ...Option) *client { stopCtx: ctx, stopFunc: cancel, conn: cfg.GRPCConn, + instID: counter.NextExporterID(), } if len(cfg.Traces.Headers) > 0 { @@ -92,13 +97,24 @@ func (c *client) Start(context.Context) error { c.conn = conn } + // Initialize the instrumentation if not already done. + // + // Initialize here instead of NewClient to allow any errors to be passed + // back to the caller and so that any setup of the environment variables to + // enable instrumentation can be set via code. + var err error + if c.inst == nil { + target := c.conn.CanonicalTarget() + c.inst, err = observ.NewInstrumentation(c.instID, target) + } + // The otlptrace.Client interface states this method is called just once, // so no need to check if already started. c.tscMu.Lock() c.tsc = coltracepb.NewTraceServiceClient(c.conn) c.tscMu.Unlock() - return nil + return err } var errAlreadyStopped = errors.New("the client is already stopped") @@ -174,7 +190,7 @@ var errShutdown = errors.New("the client is shutdown") // // Retryable errors from the server will be handled according to any // RetryConfig the client was created with. -func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.ResourceSpans) error { +func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.ResourceSpans) (uploadErr error) { // Hold a read lock to ensure a shut down initiated after this starts does // not abandon the export. This read lock acquire has less priority than a // write lock acquire (i.e. Stop), meaning if the client is shutting down @@ -189,6 +205,12 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc ctx, cancel := c.exportContext(ctx) defer cancel() + var code codes.Code + if c.inst != nil { + op := c.inst.ExportSpans(ctx, len(protoSpans)) + defer func() { op.End(uploadErr, code) }() + } + return c.requestFunc(ctx, func(iCtx context.Context) error { resp, err := c.tsc.Export(iCtx, &coltracepb.ExportTraceServiceRequest{ ResourceSpans: protoSpans, @@ -197,16 +219,17 @@ func (c *client) UploadTraces(ctx context.Context, protoSpans []*tracepb.Resourc msg := resp.PartialSuccess.GetErrorMessage() n := resp.PartialSuccess.GetRejectedSpans() if n != 0 || msg != "" { - err := internal.TracePartialSuccessError(n, msg) - otel.Handle(err) + e := internal.TracePartialSuccessError(n, msg) + uploadErr = errors.Join(uploadErr, e) } } // nil is converted to OK. - if status.Code(err) == codes.OK { + code = status.Code(err) + if code == codes.OK { // Success. - return nil + return uploadErr } - return err + return errors.Join(uploadErr, err) }) } @@ -223,7 +246,7 @@ func (c *client) exportContext(parent context.Context) (context.Context, context ) if c.exportTimeout > 0 { - ctx, cancel = context.WithTimeout(parent, c.exportTimeout) + ctx, cancel = context.WithTimeoutCause(parent, c.exportTimeout, errors.New("exporter export timeout")) } else { ctx, cancel = context.WithCancel(parent) } @@ -289,7 +312,7 @@ func throttleDelay(s *status.Status) (bool, time.Duration) { } // MarshalLog is the marshaling function used by the logging system to represent this Client. -func (c *client) MarshalLog() interface{} { +func (c *client) MarshalLog() any { return struct { Type string Endpoint string diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter/counter.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter/counter.go new file mode 100644 index 0000000000..323b2a2c9a --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter/counter.go @@ -0,0 +1,31 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/counter/counter.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package counter provides a simple counter for generating unique IDs. +// +// This package is used to generate unique IDs while allowing testing packages +// to reset the counter. +package counter // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter" + +import "sync/atomic" + +// exporterN is a global 0-based count of the number of exporters created. +var exporterN atomic.Int64 + +// NextExporterID returns the next unique ID for an exporter. +func NextExporterID() int64 { + const inc = 1 + return exporterN.Add(inc) - inc +} + +// SetExporterID sets the exporter ID counter to v and returns the previous +// value. +// +// This function is useful for testing purposes, allowing you to reset the +// counter. It should not be used in production code. +func SetExporterID(v int64) int64 { + return exporterN.Swap(v) +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go index 4abf48d1f6..6eacdf311d 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig/envconfig.go @@ -1,9 +1,11 @@ -// Code created by gotmpl. DO NOT MODIFY. +// Code generated by gotmpl. DO NOT MODIFY. // source: internal/shared/otlp/envconfig/envconfig.go.tmpl // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +// Package envconfig provides functionality to parse configuration from +// environment variables. package envconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig" import ( diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go index 97cd6c54f7..7fe9c9f3a3 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/gen.go @@ -1,6 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +// Package internal provides internal functionally for the otlptracegrpc package. package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" //go:generate gotmpl --body=../../../../../internal/shared/otlp/partialsuccess.go.tmpl "--data={}" --out=partialsuccess.go @@ -22,3 +23,12 @@ package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/ot //go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/collector.go.tmpl "--data={}" --out=otlptracetest/collector.go //go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/data.go.tmpl "--data={}" --out=otlptracetest/data.go //go:generate gotmpl --body=../../../../../internal/shared/otlp/otlptrace/otlptracetest/otlptest.go.tmpl "--data={}" --out=otlptracetest/otlptest.go + +//go:generate gotmpl --body=../../../../../internal/shared/x/x.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc\" }" --out=x/x.go +//go:generate gotmpl --body=../../../../../internal/shared/x/x_test.go.tmpl "--data={}" --out=x/x_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/otlp/observ/target.go.tmpl "--data={ \"pkg\": \"observ\", \"pkg_path\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ\" }" --out=observ/target.go +//go:generate gotmpl --body=../../../../../internal/shared/otlp/observ/target_test.go.tmpl "--data={ \"pkg\": \"observ\" }" --out=observ/target_test.go + +//go:generate gotmpl --body=../../../../../internal/shared/counter/counter.go.tmpl "--data={ \"pkg\": \"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter\" }" --out=counter/counter.go +//go:generate gotmpl --body=../../../../../internal/shared/counter/counter_test.go.tmpl "--data={}" --out=counter/counter_test.go diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/doc.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/doc.go new file mode 100644 index 0000000000..0dd54e4b96 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/doc.go @@ -0,0 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package observ provides experimental observability instrumentation for the +// otlptracegrpc exporter. +package observ // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go new file mode 100644 index 0000000000..d4a69f4d7c --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/instrumentation.go @@ -0,0 +1,342 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package observ // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ" + +import ( + "context" + "errors" + "fmt" + "sync" + "time" + + "google.golang.org/grpc/codes" + + "go.opentelemetry.io/otel" + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x" + "go.opentelemetry.io/otel/internal/global" + "go.opentelemetry.io/otel/metric" + semconv "go.opentelemetry.io/otel/semconv/v1.39.0" + "go.opentelemetry.io/otel/semconv/v1.39.0/otelconv" +) + +const ( + // ScopeName is the unique name of the meter used for instrumentation. + ScopeName = "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ" + + // SchemaURL is the schema URL of the metrics produced by this + // instrumentation. + SchemaURL = semconv.SchemaURL + + // Version is the current version of this instrumentation. + // + // This matches the version of the exporter. + Version = internal.Version +) + +var ( + measureAttrsPool = &sync.Pool{ + New: func() any { + const n = 1 + // component.name + 1 + // component.type + 1 + // server.addr + 1 + // server.port + 1 + // error.type + 1 // rpc.grpc.status_code + s := make([]attribute.KeyValue, 0, n) + // Return a pointer to a slice instead of a slice itself + // to avoid allocations on every call. + return &s + }, + } + + addOptPool = &sync.Pool{ + New: func() any { + const n = 1 // WithAttributeSet + o := make([]metric.AddOption, 0, n) + return &o + }, + } + + recordOptPool = &sync.Pool{ + New: func() any { + const n = 1 // WithAttributeSet + o := make([]metric.RecordOption, 0, n) + return &o + }, + } +) + +func get[T any](p *sync.Pool) *[]T { return p.Get().(*[]T) } + +func put[T any](p *sync.Pool, s *[]T) { + *s = (*s)[:0] // Reset. + p.Put(s) +} + +// ComponentName returns the component name for the exporter with the +// provided ID. +func ComponentName(id int64) string { + t := semconv.OTelComponentTypeOtlpGRPCSpanExporter.Value.AsString() + return fmt.Sprintf("%s/%d", t, id) +} + +// Instrumentation is experimental instrumentation for the exporter. +type Instrumentation struct { + inflightSpans metric.Int64UpDownCounter + exportedSpans metric.Int64Counter + opDuration metric.Float64Histogram + + attrs []attribute.KeyValue + addOpt metric.AddOption + recOpt metric.RecordOption +} + +// NewInstrumentation returns instrumentation for an OTLP over gPRC trace +// exporter with the provided ID using the global MeterProvider. +// +// The id should be the unique exporter instance ID. It is used +// to set the "component.name" attribute. +// +// The target is the endpoint the exporter is exporting to. +// +// If the experimental observability is disabled, nil is returned. +func NewInstrumentation(id int64, target string) (*Instrumentation, error) { + if !x.Observability.Enabled() { + return nil, nil + } + + attrs := BaseAttrs(id, target) + i := &Instrumentation{ + attrs: attrs, + addOpt: metric.WithAttributeSet(attribute.NewSet(attrs...)), + + // Do not modify attrs (NewSet sorts in-place), make a new slice. + recOpt: metric.WithAttributeSet(attribute.NewSet(append( + // Default to OK status code. + []attribute.KeyValue{ + semconv.RPCResponseStatusCode(codes.OK.String()), + }, + attrs..., + )...)), + } + + mp := otel.GetMeterProvider() + m := mp.Meter( + ScopeName, + metric.WithInstrumentationVersion(Version), + metric.WithSchemaURL(SchemaURL), + ) + + var err error + + inflightSpans, e := otelconv.NewSDKExporterSpanInflight(m) + if e != nil { + e = fmt.Errorf("failed to create span inflight metric: %w", e) + err = errors.Join(err, e) + } + i.inflightSpans = inflightSpans.Inst() + + exportedSpans, e := otelconv.NewSDKExporterSpanExported(m) + if e != nil { + e = fmt.Errorf("failed to create span exported metric: %w", e) + err = errors.Join(err, e) + } + i.exportedSpans = exportedSpans.Inst() + + opDuration, e := otelconv.NewSDKExporterOperationDuration(m) + if e != nil { + e = fmt.Errorf("failed to create operation duration metric: %w", e) + err = errors.Join(err, e) + } + i.opDuration = opDuration.Inst() + + return i, err +} + +// BaseAttrs returns the base attributes for the exporter with the provided ID +// and target. +// +// The id should be the unique exporter instance ID. It is used +// to set the "component.name" attribute. +// +// The target is the gRPC target the exporter is exporting to. It is expected +// to be the output of the Client's CanonicalTarget method. +func BaseAttrs(id int64, target string) []attribute.KeyValue { + host, port, err := ParseCanonicalTarget(target) + if err != nil || (host == "" && port < 0) { + if err != nil { + global.Debug("failed to parse target", "target", target, "error", err) + } + return []attribute.KeyValue{ + semconv.OTelComponentName(ComponentName(id)), + semconv.OTelComponentTypeOtlpGRPCSpanExporter, + } + } + + // Do not use append so the slice is exactly allocated. + + if port < 0 { + return []attribute.KeyValue{ + semconv.OTelComponentName(ComponentName(id)), + semconv.OTelComponentTypeOtlpGRPCSpanExporter, + semconv.ServerAddress(host), + } + } + + if host == "" { + return []attribute.KeyValue{ + semconv.OTelComponentName(ComponentName(id)), + semconv.OTelComponentTypeOtlpGRPCSpanExporter, + semconv.ServerPort(port), + } + } + + return []attribute.KeyValue{ + semconv.OTelComponentName(ComponentName(id)), + semconv.OTelComponentTypeOtlpGRPCSpanExporter, + semconv.ServerAddress(host), + semconv.ServerPort(port), + } +} + +// ExportSpans instruments the ExportSpans method of the exporter. It returns +// an [ExportOp] that must have its [ExportOp.End] method called when the +// ExportSpans method returns. +func (i *Instrumentation) ExportSpans(ctx context.Context, nSpans int) ExportOp { + start := time.Now() + + addOpt := get[metric.AddOption](addOptPool) + defer put(addOptPool, addOpt) + *addOpt = append(*addOpt, i.addOpt) + i.inflightSpans.Add(ctx, int64(nSpans), *addOpt...) + + return ExportOp{ + ctx: ctx, + start: start, + nSpans: int64(nSpans), + inst: i, + } +} + +// ExportOp tracks the operation being observed by [Instrumentation.ExportSpans]. +type ExportOp struct { + ctx context.Context + start time.Time + nSpans int64 + + inst *Instrumentation +} + +// End completes the observation of the operation being observed by a call to +// [Instrumentation.ExportSpans]. +// +// Any error that is encountered is provided as err. +// +// If err is not nil, all spans will be recorded as failures unless error is of +// type [internal.PartialSuccess]. In the case of a PartialSuccess, the number +// of successfully exported spans will be determined by inspecting the +// RejectedItems field of the PartialSuccess. +func (e ExportOp) End(err error, code codes.Code) { + addOpt := get[metric.AddOption](addOptPool) + defer put(addOptPool, addOpt) + *addOpt = append(*addOpt, e.inst.addOpt) + + e.inst.inflightSpans.Add(e.ctx, -e.nSpans, *addOpt...) + + success := successful(e.nSpans, err) + // Record successfully exported spans, even if the value is 0 which are + // meaningful to distribution aggregations. + e.inst.exportedSpans.Add(e.ctx, success, *addOpt...) + + if err != nil { + attrs := get[attribute.KeyValue](measureAttrsPool) + defer put(measureAttrsPool, attrs) + *attrs = append(*attrs, e.inst.attrs...) + *attrs = append(*attrs, semconv.ErrorType(err)) + + // Do not inefficiently make a copy of attrs by using + // WithAttributes instead of WithAttributeSet. + o := metric.WithAttributeSet(attribute.NewSet(*attrs...)) + // Reset addOpt with new attribute set. + *addOpt = append((*addOpt)[:0], o) + + e.inst.exportedSpans.Add(e.ctx, e.nSpans-success, *addOpt...) + } + + recOpt := get[metric.RecordOption](recordOptPool) + defer put(recordOptPool, recOpt) + *recOpt = append(*recOpt, e.inst.recordOption(err, code)) + + d := time.Since(e.start).Seconds() + e.inst.opDuration.Record(e.ctx, d, *recOpt...) +} + +// recordOption returns a RecordOption with attributes representing the +// outcome of the operation being recorded. +// +// If err is nil and code is codes.OK, the default recOpt of the +// Instrumentation is returned. +// +// If err is not nil or code is not codes.OK, a new RecordOption is returned +// with the base attributes of the Instrumentation plus the rpc.grpc.status_code +// attribute set to the provided code, and if err is not nil, the error.type +// attribute set to the type of the error. +func (i *Instrumentation) recordOption(err error, code codes.Code) metric.RecordOption { + if err == nil && code == codes.OK { + return i.recOpt + } + + attrs := get[attribute.KeyValue](measureAttrsPool) + defer put(measureAttrsPool, attrs) + *attrs = append(*attrs, i.attrs...) + + *attrs = append(*attrs, semconv.RPCResponseStatusCode(code.String())) + if err != nil { + *attrs = append(*attrs, semconv.ErrorType(err)) + } + + // Do not inefficiently make a copy of attrs by using WithAttributes + // instead of WithAttributeSet. + return metric.WithAttributeSet(attribute.NewSet(*attrs...)) +} + +// successful returns the number of successfully exported spans out of the n +// that were exported based on the provided error. +// +// If err is nil, n is returned. All spans were successfully exported. +// +// If err is not nil and not an [internal.PartialSuccess] error, 0 is returned. +// It is assumed all spans failed to be exported. +// +// If err is an [internal.PartialSuccess] error, the number of successfully +// exported spans is computed by subtracting the RejectedItems field from n. If +// RejectedItems is negative, n is returned. If RejectedItems is greater than +// n, 0 is returned. +func successful(n int64, err error) int64 { + if err == nil { + return n // All spans successfully exported. + } + // Split rejection calculation so successful is inlinable. + return n - rejected(n, err) +} + +var errPartialPool = &sync.Pool{ + New: func() any { return new(internal.PartialSuccess) }, +} + +// rejected returns how many out of the n spans exporter were rejected based on +// the provided non-nil err. +func rejected(n int64, err error) int64 { + ps := errPartialPool.Get().(*internal.PartialSuccess) + defer errPartialPool.Put(ps) + // Check for partial success. + if errors.As(err, ps) { + // Bound RejectedItems to [0, n]. This should not be needed, + // but be defensive as this is from an external source. + return min(max(ps.RejectedItems, 0), n) + } + return n // All spans rejected. +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/target.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/target.go new file mode 100644 index 0000000000..34eee27db0 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ/target.go @@ -0,0 +1,143 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/otlp/observ/target.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package observ // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ" + +import ( + "errors" + "fmt" + "net" + "net/netip" + "strconv" + "strings" +) + +const ( + schemeUnix = "unix" + schemeUnixAbstract = "unix-abstract" +) + +// ParseCanonicalTarget parses a target string and returns the extracted host +// (domain address or IP), the target port, or an error. +// +// If no port is specified, -1 is returned. +// +// If no host is specified, an empty string is returned. +// +// The target string is expected to always have the form +// "://[authority]/". For example: +// - "dns:///example.com:42" +// - "dns://8.8.8.8/example.com:42" +// - "unix:///path/to/socket" +// - "unix-abstract:///socket-name" +// - "passthrough:///192.34.2.1:42" +// +// The target is expected to come from the CanonicalTarget method of a gRPC +// Client. +func ParseCanonicalTarget(target string) (string, int, error) { + const sep = "://" + + // Find scheme. Do not allocate the string by using url.Parse. + idx := strings.Index(target, sep) + if idx == -1 { + return "", -1, fmt.Errorf("invalid target %q: missing scheme", target) + } + scheme, endpoint := target[:idx], target[idx+len(sep):] + + // Check for unix schemes. + if scheme == schemeUnix || scheme == schemeUnixAbstract { + return parseUnix(endpoint) + } + + // Strip leading slash and any authority. + if i := strings.Index(endpoint, "/"); i != -1 { + endpoint = endpoint[i+1:] + } + + // DNS, passthrough, and custom resolvers. + return parseEndpoint(endpoint) +} + +// parseUnix parses unix socket targets. +func parseUnix(endpoint string) (string, int, error) { + // Format: unix[-abstract]://path + // + // We should have "/path" (empty authority) if valid. + if len(endpoint) >= 1 && endpoint[0] == '/' { + // Return the full path including leading slash. + return endpoint, -1, nil + } + + // If there's no leading slash, it means there might be an authority + // Check for authority case (should error): "authority/path" + if slashIdx := strings.Index(endpoint, "/"); slashIdx > 0 { + return "", -1, fmt.Errorf("invalid (non-empty) authority: %s", endpoint[:slashIdx]) + } + + return "", -1, errors.New("invalid unix target format") +} + +// parseEndpoint parses an endpoint from a gRPC target. +// +// It supports the following formats: +// - "host" +// - "host%zone" +// - "host:port" +// - "host%zone:port" +// - "ipv4" +// - "ipv4%zone" +// - "ipv4:port" +// - "ipv4%zone:port" +// - "ipv6" +// - "ipv6%zone" +// - "[ipv6]" +// - "[ipv6%zone]" +// - "[ipv6]:port" +// - "[ipv6%zone]:port" +// +// It returns the host or host%zone (domain address or IP), the port (or -1 if +// not specified), or an error if the input is not a valid. +func parseEndpoint(endpoint string) (string, int, error) { + // First check if the endpoint is just an IP address. + if ip := parseIP(endpoint); ip != "" { + return ip, -1, nil + } + + // If there's no colon, there is no port (IPv6 with no port checked above). + if !strings.Contains(endpoint, ":") { + return endpoint, -1, nil + } + + host, portStr, err := net.SplitHostPort(endpoint) + if err != nil { + return "", -1, fmt.Errorf("invalid host:port %q: %w", endpoint, err) + } + + const base, bitSize = 10, 16 + port16, err := strconv.ParseUint(portStr, base, bitSize) + if err != nil { + return "", -1, fmt.Errorf("invalid port %q: %w", portStr, err) + } + port := int(port16) // port is guaranteed to be in the range [0, 65535]. + + return host, port, nil +} + +// parseIP attempts to parse the entire endpoint as an IP address. +// It returns the normalized string form of the IP if successful, +// or an empty string if parsing fails. +func parseIP(ip string) string { + // Strip leading and trailing brackets for IPv6 addresses. + if len(ip) >= 2 && ip[0] == '[' && ip[len(ip)-1] == ']' { + ip = ip[1 : len(ip)-1] + } + addr, err := netip.ParseAddr(ip) + if err != nil { + return "" + } + // Return the normalized string form of the IP. + return addr.String() +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go index 7bb189a94b..1d840be205 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/envconfig.go @@ -1,4 +1,4 @@ -// Code created by gotmpl. DO NOT MODIFY. +// Code generated by gotmpl. DO NOT MODIFY. // source: internal/shared/otlp/otlptrace/otlpconfig/envconfig.go.tmpl // Copyright The OpenTelemetry Authors @@ -77,8 +77,16 @@ func getOptionsFromEnv() []GenericOption { }), envconfig.WithCertPool("CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), envconfig.WithCertPool("TRACES_CERTIFICATE", func(p *x509.CertPool) { tlsConf.RootCAs = p }), - envconfig.WithClientCert("CLIENT_CERTIFICATE", "CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), - envconfig.WithClientCert("TRACES_CLIENT_CERTIFICATE", "TRACES_CLIENT_KEY", func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }), + envconfig.WithClientCert( + "CLIENT_CERTIFICATE", + "CLIENT_KEY", + func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }, + ), + envconfig.WithClientCert( + "TRACES_CLIENT_CERTIFICATE", + "TRACES_CLIENT_KEY", + func(c tls.Certificate) { tlsConf.Certificates = []tls.Certificate{c} }, + ), withTLSConfig(tlsConf, func(c *tls.Config) { opts = append(opts, WithTLSClientConfig(c)) }), envconfig.WithBool("INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), envconfig.WithBool("TRACES_INSECURE", func(b bool) { opts = append(opts, withInsecure(b)) }), diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go index 0a317d9263..4f47117a58 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go @@ -1,9 +1,10 @@ -// Code created by gotmpl. DO NOT MODIFY. +// Code generated by gotmpl. DO NOT MODIFY. // source: internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +// Package otlpconfig provides configuration for the otlptrace exporters. package otlpconfig // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig" import ( @@ -52,7 +53,9 @@ type ( // gRPC configurations GRPCCredentials credentials.TransportCredentials - Proxy HTTPTransportProxyFunc + // HTTP configurations + Proxy HTTPTransportProxyFunc + HTTPClient *http.Client } Config struct { @@ -89,12 +92,11 @@ func NewHTTPConfig(opts ...HTTPOption) Config { return cfg } -// cleanPath returns a path with all spaces trimmed and all redundancies -// removed. If urlPath is empty or cleaning it results in an empty string, +// cleanPath returns a path with all spaces trimmed. If urlPath is empty, // defaultPath is returned instead. func cleanPath(urlPath string, defaultPath string) string { - tmp := path.Clean(strings.TrimSpace(urlPath)) - if tmp == "." { + tmp := strings.TrimSpace(urlPath) + if tmp == "" || tmp == "." { return defaultPath } if !path.IsAbs(tmp) { @@ -349,3 +351,10 @@ func WithProxy(pf HTTPTransportProxyFunc) GenericOption { return cfg }) } + +func WithHTTPClient(c *http.Client) GenericOption { + return newGenericOption(func(cfg Config) Config { + cfg.Traces.HTTPClient = c + return cfg + }) +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go index 3d4f699d47..9184903872 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/optiontypes.go @@ -1,4 +1,4 @@ -// Code created by gotmpl. DO NOT MODIFY. +// Code generated by gotmpl. DO NOT MODIFY. // source: internal/shared/otlp/otlptrace/otlpconfig/optiontypes.go.tmpl // Copyright The OpenTelemetry Authors diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go index 38b97a0131..ba6e411835 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/tls.go @@ -1,4 +1,4 @@ -// Code created by gotmpl. DO NOT MODIFY. +// Code generated by gotmpl. DO NOT MODIFY. // source: internal/shared/otlp/otlptrace/otlpconfig/tls.go.tmpl // Copyright The OpenTelemetry Authors diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go index a12ea4c48e..a811a07b35 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/partialsuccess.go @@ -1,4 +1,4 @@ -// Code created by gotmpl. DO NOT MODIFY. +// Code generated by gotmpl. DO NOT MODIFY. // source: internal/shared/otlp/partialsuccess.go // Copyright The OpenTelemetry Authors @@ -29,6 +29,17 @@ func (ps PartialSuccess) Error() string { return fmt.Sprintf("OTLP partial success: %s (%d %s rejected)", msg, ps.RejectedItems, ps.RejectedKind) } +// As returns true if ps can be assigned to target and makes the assignment. +// Otherwise, it returns false. This supports the errors.As() interface. +func (ps PartialSuccess) As(target any) bool { + t, ok := target.(*PartialSuccess) + if !ok { + return false + } + *t = ps + return true +} + // Is supports the errors.Is() interface. func (ps PartialSuccess) Is(err error) bool { _, ok := err.(PartialSuccess) diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go index 1c5450ab62..a7b8e81a78 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry/retry.go @@ -1,4 +1,4 @@ -// Code created by gotmpl. DO NOT MODIFY. +// Code generated by gotmpl. DO NOT MODIFY. // source: internal/shared/otlp/retry/retry.go.tmpl // Copyright The OpenTelemetry Authors @@ -14,7 +14,7 @@ import ( "fmt" "time" - "github.com/cenkalti/backoff/v4" + "github.com/cenkalti/backoff/v5" ) // DefaultConfig are the recommended defaults to use. @@ -77,12 +77,12 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { RandomizationFactor: backoff.DefaultRandomizationFactor, Multiplier: backoff.DefaultMultiplier, MaxInterval: c.MaxInterval, - MaxElapsedTime: c.MaxElapsedTime, - Stop: backoff.Stop, - Clock: backoff.SystemClock, } b.Reset() + maxElapsedTime := c.MaxElapsedTime + startTime := time.Now() + for { err := fn(ctx) if err == nil { @@ -94,21 +94,22 @@ func (c Config) RequestFunc(evaluate EvaluateFunc) RequestFunc { return err } - bOff := b.NextBackOff() - if bOff == backoff.Stop { + // Check if context is canceled before attempting to wait and retry. + if ctx.Err() != nil { + return fmt.Errorf("%w: %w", ctx.Err(), err) + } + + if maxElapsedTime != 0 && time.Since(startTime) > maxElapsedTime { return fmt.Errorf("max retry time elapsed: %w", err) } // Wait for the greater of the backoff or throttle delay. - var delay time.Duration - if bOff > throttle { - delay = bOff - } else { - elapsed := b.GetElapsedTime() - if b.MaxElapsedTime != 0 && elapsed+throttle > b.MaxElapsedTime { - return fmt.Errorf("max retry time would elapse: %w", err) - } - delay = throttle + bOff := b.NextBackOff() + delay := max(throttle, bOff) + + elapsed := time.Since(startTime) + if maxElapsedTime != 0 && elapsed+throttle > maxElapsedTime { + return fmt.Errorf("max retry time would elapse: %w", err) } if ctxErr := waitFunc(ctx, delay); ctxErr != nil { @@ -136,7 +137,7 @@ func wait(ctx context.Context, delay time.Duration) error { select { case <-timer.C: default: - return ctx.Err() + return context.Cause(ctx) } case <-timer.C: } diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go new file mode 100644 index 0000000000..19fac1b725 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/version.go @@ -0,0 +1,8 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package internal // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal" + +// Version is the current release version of the OpenTelemetry OTLP gRPC trace +// exporter in use. +const Version = "1.40.0" diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/README.md b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/README.md new file mode 100644 index 0000000000..15a3011bff --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/README.md @@ -0,0 +1,36 @@ +# Experimental Features + +The `otlptracegrpc` exporter contains features that have not yet stabilized in the OpenTelemetry specification. +These features are added to the `otlptracegrpc` exporter prior to stabilization in the specification so that users can start experimenting with them and provide feedback. + +These feature may change in backwards incompatible ways as feedback is applied. +See the [Compatibility and Stability](#compatibility-and-stability) section for more information. + +## Features + +- [Observability](#observability) + +### Observability + +The `otlptracegrpc` exporter provides a observability feature that allows you to monitor the SDK itself. + +To opt-in, set the environment variable `OTEL_GO_X_OBSERVABILITY` to `true`. + +When enabled, the SDK will create the following metrics using the global `MeterProvider`: + +- `otel.sdk.exporter.span.inflight` +- `otel.sdk.exporter.span.exported` +- `otel.sdk.exporter.operation.duration` + +Please see the [Semantic conventions for OpenTelemetry SDK metrics] documentation for more details on these metrics. + +[Semantic conventions for OpenTelemetry SDK metrics]: https://github.com/open-telemetry/semantic-conventions/blob/v1.37.0/docs/otel/sdk-metrics.md + +## Compatibility and Stability + +Experimental features do not fall within the scope of the OpenTelemetry Go versioning and stability [policy](../../../../../../VERSIONING.md). +These features may be removed or modified in successive version releases, including patch versions. + +When an experimental feature is promoted to a stable feature, a migration path will be included in the changelog entry of the release. +There is no guarantee that any environment variable feature flags that enabled the experimental feature will be supported by the stable version. +If they are supported, they may be accompanied with a deprecation notice stating a timeline for the removal of that support. diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/observ.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/observ.go new file mode 100644 index 0000000000..4e89c6524f --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/observ.go @@ -0,0 +1,22 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package x // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x" + +import "strings" + +// Observability is an experimental feature flag that determines if exporter +// observability metrics are enabled. +// +// To enable this feature set the OTEL_GO_X_OBSERVABILITY environment variable +// to the case-insensitive string value of "true" (i.e. "True" and "TRUE" +// will also enable this). +var Observability = newFeature( + []string{"OBSERVABILITY"}, + func(v string) (string, bool) { + if strings.EqualFold(v, "true") { + return v, true + } + return "", false + }, +) diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/x.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/x.go new file mode 100644 index 0000000000..741ba62c97 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x/x.go @@ -0,0 +1,58 @@ +// Code generated by gotmpl. DO NOT MODIFY. +// source: internal/shared/x/x.go.tmpl + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package x documents experimental features for [go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc]. +package x // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x" + +import ( + "os" +) + +// Feature is an experimental feature control flag. It provides a uniform way +// to interact with these feature flags and parse their values. +type Feature[T any] struct { + keys []string + parse func(v string) (T, bool) +} + +func newFeature[T any](suffix []string, parse func(string) (T, bool)) Feature[T] { + const envKeyRoot = "OTEL_GO_X_" + keys := make([]string, 0, len(suffix)) + for _, s := range suffix { + keys = append(keys, envKeyRoot+s) + } + return Feature[T]{ + keys: keys, + parse: parse, + } +} + +// Keys returns the environment variable keys that can be set to enable the +// feature. +func (f Feature[T]) Keys() []string { return f.keys } + +// Lookup returns the user configured value for the feature and true if the +// user has enabled the feature. Otherwise, if the feature is not enabled, a +// zero-value and false are returned. +func (f Feature[T]) Lookup() (v T, ok bool) { + // https://github.com/open-telemetry/opentelemetry-specification/blob/62effed618589a0bec416a87e559c0a9d96289bb/specification/configuration/sdk-environment-variables.md#parsing-empty-value + // + // > The SDK MUST interpret an empty value of an environment variable the + // > same way as when the variable is unset. + for _, key := range f.keys { + vRaw := os.Getenv(key) + if vRaw != "" { + return f.parse(vRaw) + } + } + return v, ok +} + +// Enabled reports whether the feature is enabled. +func (f Feature[T]) Enabled() bool { + _, ok := f.Lookup() + return ok +} diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go index 00ab1f20c6..2da2298701 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/options.go @@ -199,8 +199,9 @@ func WithTimeout(duration time.Duration) Option { // explicitly returns a backoff time in the response. That time will take // precedence over these settings. // -// These settings do not define any network retry strategy. That is entirely -// handled by the gRPC ClientConn. +// These settings define the retry strategy implemented by the exporter. +// These settings do not define any network retry strategy. +// That is handled by the gRPC ClientConn. // // If unset, the default retry policy will be used. It will retry the export // 5 seconds after receiving a retryable error and increase exponentially diff --git a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go index f5cad46b74..370cd2a6f8 100644 --- a/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go +++ b/vendor/go.opentelemetry.io/otel/exporters/otlp/otlptrace/version.go @@ -5,5 +5,5 @@ package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace" // Version is the current release version of the OpenTelemetry OTLP trace exporter in use. func Version() string { - return "1.35.0" + return "1.40.0" } diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md deleted file mode 100644 index 82e1f46b4e..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Semconv v1.20.0 - -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.20.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.20.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go deleted file mode 100644 index 6685c392b5..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/attribute_group.go +++ /dev/null @@ -1,1198 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" - -import "go.opentelemetry.io/otel/attribute" - -// Describes HTTP attributes. -const ( - // HTTPMethodKey is the attribute Key conforming to the "http.method" - // semantic conventions. It represents the hTTP request method. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'GET', 'POST', 'HEAD' - HTTPMethodKey = attribute.Key("http.method") - - // HTTPStatusCodeKey is the attribute Key conforming to the - // "http.status_code" semantic conventions. It represents the [HTTP - // response status code](https://tools.ietf.org/html/rfc7231#section-6). - // - // Type: int - // RequirementLevel: ConditionallyRequired (If and only if one was - // received/sent.) - // Stability: stable - // Examples: 200 - HTTPStatusCodeKey = attribute.Key("http.status_code") -) - -// HTTPMethod returns an attribute KeyValue conforming to the "http.method" -// semantic conventions. It represents the hTTP request method. -func HTTPMethod(val string) attribute.KeyValue { - return HTTPMethodKey.String(val) -} - -// HTTPStatusCode returns an attribute KeyValue conforming to the -// "http.status_code" semantic conventions. It represents the [HTTP response -// status code](https://tools.ietf.org/html/rfc7231#section-6). -func HTTPStatusCode(val int) attribute.KeyValue { - return HTTPStatusCodeKey.Int(val) -} - -// HTTP Server spans attributes -const ( - // HTTPSchemeKey is the attribute Key conforming to the "http.scheme" - // semantic conventions. It represents the URI scheme identifying the used - // protocol. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'http', 'https' - HTTPSchemeKey = attribute.Key("http.scheme") - - // HTTPRouteKey is the attribute Key conforming to the "http.route" - // semantic conventions. It represents the matched route (path template in - // the format used by the respective server framework). See note below - // - // Type: string - // RequirementLevel: ConditionallyRequired (If and only if it's available) - // Stability: stable - // Examples: '/users/:userID?', '{controller}/{action}/{id?}' - // Note: MUST NOT be populated when this is not supported by the HTTP - // server framework as the route attribute should have low-cardinality and - // the URI path can NOT substitute it. - // SHOULD include the [application - // root](/specification/trace/semantic_conventions/http.md#http-server-definitions) - // if there is one. - HTTPRouteKey = attribute.Key("http.route") -) - -// HTTPScheme returns an attribute KeyValue conforming to the "http.scheme" -// semantic conventions. It represents the URI scheme identifying the used -// protocol. -func HTTPScheme(val string) attribute.KeyValue { - return HTTPSchemeKey.String(val) -} - -// HTTPRoute returns an attribute KeyValue conforming to the "http.route" -// semantic conventions. It represents the matched route (path template in the -// format used by the respective server framework). See note below -func HTTPRoute(val string) attribute.KeyValue { - return HTTPRouteKey.String(val) -} - -// Attributes for Events represented using Log Records. -const ( - // EventNameKey is the attribute Key conforming to the "event.name" - // semantic conventions. It represents the name identifies the event. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'click', 'exception' - EventNameKey = attribute.Key("event.name") - - // EventDomainKey is the attribute Key conforming to the "event.domain" - // semantic conventions. It represents the domain identifies the business - // context for the events. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Note: Events across different domains may have same `event.name`, yet be - // unrelated events. - EventDomainKey = attribute.Key("event.domain") -) - -var ( - // Events from browser apps - EventDomainBrowser = EventDomainKey.String("browser") - // Events from mobile apps - EventDomainDevice = EventDomainKey.String("device") - // Events from Kubernetes - EventDomainK8S = EventDomainKey.String("k8s") -) - -// EventName returns an attribute KeyValue conforming to the "event.name" -// semantic conventions. It represents the name identifies the event. -func EventName(val string) attribute.KeyValue { - return EventNameKey.String(val) -} - -// These attributes may be used for any network related operation. -const ( - // NetTransportKey is the attribute Key conforming to the "net.transport" - // semantic conventions. It represents the transport protocol used. See - // note below. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - NetTransportKey = attribute.Key("net.transport") - - // NetProtocolNameKey is the attribute Key conforming to the - // "net.protocol.name" semantic conventions. It represents the application - // layer protocol used. The value SHOULD be normalized to lowercase. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'amqp', 'http', 'mqtt' - NetProtocolNameKey = attribute.Key("net.protocol.name") - - // NetProtocolVersionKey is the attribute Key conforming to the - // "net.protocol.version" semantic conventions. It represents the version - // of the application layer protocol used. See note below. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '3.1.1' - // Note: `net.protocol.version` refers to the version of the protocol used - // and might be different from the protocol client's version. If the HTTP - // client used has a version of `0.27.2`, but sends HTTP version `1.1`, - // this attribute should be set to `1.1`. - NetProtocolVersionKey = attribute.Key("net.protocol.version") - - // NetSockPeerNameKey is the attribute Key conforming to the - // "net.sock.peer.name" semantic conventions. It represents the remote - // socket peer name. - // - // Type: string - // RequirementLevel: Recommended (If available and different from - // `net.peer.name` and if `net.sock.peer.addr` is set.) - // Stability: stable - // Examples: 'proxy.example.com' - NetSockPeerNameKey = attribute.Key("net.sock.peer.name") - - // NetSockPeerAddrKey is the attribute Key conforming to the - // "net.sock.peer.addr" semantic conventions. It represents the remote - // socket peer address: IPv4 or IPv6 for internet protocols, path for local - // communication, - // [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '127.0.0.1', '/tmp/mysql.sock' - NetSockPeerAddrKey = attribute.Key("net.sock.peer.addr") - - // NetSockPeerPortKey is the attribute Key conforming to the - // "net.sock.peer.port" semantic conventions. It represents the remote - // socket peer port. - // - // Type: int - // RequirementLevel: Recommended (If defined for the address family and if - // different than `net.peer.port` and if `net.sock.peer.addr` is set.) - // Stability: stable - // Examples: 16456 - NetSockPeerPortKey = attribute.Key("net.sock.peer.port") - - // NetSockFamilyKey is the attribute Key conforming to the - // "net.sock.family" semantic conventions. It represents the protocol - // [address - // family](https://man7.org/linux/man-pages/man7/address_families.7.html) - // which is used for communication. - // - // Type: Enum - // RequirementLevel: ConditionallyRequired (If different than `inet` and if - // any of `net.sock.peer.addr` or `net.sock.host.addr` are set. Consumers - // of telemetry SHOULD accept both IPv4 and IPv6 formats for the address in - // `net.sock.peer.addr` if `net.sock.family` is not set. This is to support - // instrumentations that follow previous versions of this document.) - // Stability: stable - // Examples: 'inet6', 'bluetooth' - NetSockFamilyKey = attribute.Key("net.sock.family") - - // NetPeerNameKey is the attribute Key conforming to the "net.peer.name" - // semantic conventions. It represents the logical remote hostname, see - // note below. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'example.com' - // Note: `net.peer.name` SHOULD NOT be set if capturing it would require an - // extra DNS lookup. - NetPeerNameKey = attribute.Key("net.peer.name") - - // NetPeerPortKey is the attribute Key conforming to the "net.peer.port" - // semantic conventions. It represents the logical remote port number - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 80, 8080, 443 - NetPeerPortKey = attribute.Key("net.peer.port") - - // NetHostNameKey is the attribute Key conforming to the "net.host.name" - // semantic conventions. It represents the logical local hostname or - // similar, see note below. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'localhost' - NetHostNameKey = attribute.Key("net.host.name") - - // NetHostPortKey is the attribute Key conforming to the "net.host.port" - // semantic conventions. It represents the logical local port number, - // preferably the one that the peer used to connect - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 8080 - NetHostPortKey = attribute.Key("net.host.port") - - // NetSockHostAddrKey is the attribute Key conforming to the - // "net.sock.host.addr" semantic conventions. It represents the local - // socket address. Useful in case of a multi-IP host. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '192.168.0.1' - NetSockHostAddrKey = attribute.Key("net.sock.host.addr") - - // NetSockHostPortKey is the attribute Key conforming to the - // "net.sock.host.port" semantic conventions. It represents the local - // socket port number. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If defined for the address - // family and if different than `net.host.port` and if `net.sock.host.addr` - // is set. In other cases, it is still recommended to set this.) - // Stability: stable - // Examples: 35555 - NetSockHostPortKey = attribute.Key("net.sock.host.port") -) - -var ( - // ip_tcp - NetTransportTCP = NetTransportKey.String("ip_tcp") - // ip_udp - NetTransportUDP = NetTransportKey.String("ip_udp") - // Named or anonymous pipe. See note below - NetTransportPipe = NetTransportKey.String("pipe") - // In-process communication - NetTransportInProc = NetTransportKey.String("inproc") - // Something else (non IP-based) - NetTransportOther = NetTransportKey.String("other") -) - -var ( - // IPv4 address - NetSockFamilyInet = NetSockFamilyKey.String("inet") - // IPv6 address - NetSockFamilyInet6 = NetSockFamilyKey.String("inet6") - // Unix domain socket path - NetSockFamilyUnix = NetSockFamilyKey.String("unix") -) - -// NetProtocolName returns an attribute KeyValue conforming to the -// "net.protocol.name" semantic conventions. It represents the application -// layer protocol used. The value SHOULD be normalized to lowercase. -func NetProtocolName(val string) attribute.KeyValue { - return NetProtocolNameKey.String(val) -} - -// NetProtocolVersion returns an attribute KeyValue conforming to the -// "net.protocol.version" semantic conventions. It represents the version of -// the application layer protocol used. See note below. -func NetProtocolVersion(val string) attribute.KeyValue { - return NetProtocolVersionKey.String(val) -} - -// NetSockPeerName returns an attribute KeyValue conforming to the -// "net.sock.peer.name" semantic conventions. It represents the remote socket -// peer name. -func NetSockPeerName(val string) attribute.KeyValue { - return NetSockPeerNameKey.String(val) -} - -// NetSockPeerAddr returns an attribute KeyValue conforming to the -// "net.sock.peer.addr" semantic conventions. It represents the remote socket -// peer address: IPv4 or IPv6 for internet protocols, path for local -// communication, -// [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). -func NetSockPeerAddr(val string) attribute.KeyValue { - return NetSockPeerAddrKey.String(val) -} - -// NetSockPeerPort returns an attribute KeyValue conforming to the -// "net.sock.peer.port" semantic conventions. It represents the remote socket -// peer port. -func NetSockPeerPort(val int) attribute.KeyValue { - return NetSockPeerPortKey.Int(val) -} - -// NetPeerName returns an attribute KeyValue conforming to the -// "net.peer.name" semantic conventions. It represents the logical remote -// hostname, see note below. -func NetPeerName(val string) attribute.KeyValue { - return NetPeerNameKey.String(val) -} - -// NetPeerPort returns an attribute KeyValue conforming to the -// "net.peer.port" semantic conventions. It represents the logical remote port -// number -func NetPeerPort(val int) attribute.KeyValue { - return NetPeerPortKey.Int(val) -} - -// NetHostName returns an attribute KeyValue conforming to the -// "net.host.name" semantic conventions. It represents the logical local -// hostname or similar, see note below. -func NetHostName(val string) attribute.KeyValue { - return NetHostNameKey.String(val) -} - -// NetHostPort returns an attribute KeyValue conforming to the -// "net.host.port" semantic conventions. It represents the logical local port -// number, preferably the one that the peer used to connect -func NetHostPort(val int) attribute.KeyValue { - return NetHostPortKey.Int(val) -} - -// NetSockHostAddr returns an attribute KeyValue conforming to the -// "net.sock.host.addr" semantic conventions. It represents the local socket -// address. Useful in case of a multi-IP host. -func NetSockHostAddr(val string) attribute.KeyValue { - return NetSockHostAddrKey.String(val) -} - -// NetSockHostPort returns an attribute KeyValue conforming to the -// "net.sock.host.port" semantic conventions. It represents the local socket -// port number. -func NetSockHostPort(val int) attribute.KeyValue { - return NetSockHostPortKey.Int(val) -} - -// These attributes may be used for any network related operation. -const ( - // NetHostConnectionTypeKey is the attribute Key conforming to the - // "net.host.connection.type" semantic conventions. It represents the - // internet connection type currently being used by the host. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'wifi' - NetHostConnectionTypeKey = attribute.Key("net.host.connection.type") - - // NetHostConnectionSubtypeKey is the attribute Key conforming to the - // "net.host.connection.subtype" semantic conventions. It represents the - // this describes more details regarding the connection.type. It may be the - // type of cell technology connection, but it could be used for describing - // details about a wifi connection. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'LTE' - NetHostConnectionSubtypeKey = attribute.Key("net.host.connection.subtype") - - // NetHostCarrierNameKey is the attribute Key conforming to the - // "net.host.carrier.name" semantic conventions. It represents the name of - // the mobile carrier. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'sprint' - NetHostCarrierNameKey = attribute.Key("net.host.carrier.name") - - // NetHostCarrierMccKey is the attribute Key conforming to the - // "net.host.carrier.mcc" semantic conventions. It represents the mobile - // carrier country code. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '310' - NetHostCarrierMccKey = attribute.Key("net.host.carrier.mcc") - - // NetHostCarrierMncKey is the attribute Key conforming to the - // "net.host.carrier.mnc" semantic conventions. It represents the mobile - // carrier network code. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '001' - NetHostCarrierMncKey = attribute.Key("net.host.carrier.mnc") - - // NetHostCarrierIccKey is the attribute Key conforming to the - // "net.host.carrier.icc" semantic conventions. It represents the ISO - // 3166-1 alpha-2 2-character country code associated with the mobile - // carrier network. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'DE' - NetHostCarrierIccKey = attribute.Key("net.host.carrier.icc") -) - -var ( - // wifi - NetHostConnectionTypeWifi = NetHostConnectionTypeKey.String("wifi") - // wired - NetHostConnectionTypeWired = NetHostConnectionTypeKey.String("wired") - // cell - NetHostConnectionTypeCell = NetHostConnectionTypeKey.String("cell") - // unavailable - NetHostConnectionTypeUnavailable = NetHostConnectionTypeKey.String("unavailable") - // unknown - NetHostConnectionTypeUnknown = NetHostConnectionTypeKey.String("unknown") -) - -var ( - // GPRS - NetHostConnectionSubtypeGprs = NetHostConnectionSubtypeKey.String("gprs") - // EDGE - NetHostConnectionSubtypeEdge = NetHostConnectionSubtypeKey.String("edge") - // UMTS - NetHostConnectionSubtypeUmts = NetHostConnectionSubtypeKey.String("umts") - // CDMA - NetHostConnectionSubtypeCdma = NetHostConnectionSubtypeKey.String("cdma") - // EVDO Rel. 0 - NetHostConnectionSubtypeEvdo0 = NetHostConnectionSubtypeKey.String("evdo_0") - // EVDO Rev. A - NetHostConnectionSubtypeEvdoA = NetHostConnectionSubtypeKey.String("evdo_a") - // CDMA2000 1XRTT - NetHostConnectionSubtypeCdma20001xrtt = NetHostConnectionSubtypeKey.String("cdma2000_1xrtt") - // HSDPA - NetHostConnectionSubtypeHsdpa = NetHostConnectionSubtypeKey.String("hsdpa") - // HSUPA - NetHostConnectionSubtypeHsupa = NetHostConnectionSubtypeKey.String("hsupa") - // HSPA - NetHostConnectionSubtypeHspa = NetHostConnectionSubtypeKey.String("hspa") - // IDEN - NetHostConnectionSubtypeIden = NetHostConnectionSubtypeKey.String("iden") - // EVDO Rev. B - NetHostConnectionSubtypeEvdoB = NetHostConnectionSubtypeKey.String("evdo_b") - // LTE - NetHostConnectionSubtypeLte = NetHostConnectionSubtypeKey.String("lte") - // EHRPD - NetHostConnectionSubtypeEhrpd = NetHostConnectionSubtypeKey.String("ehrpd") - // HSPAP - NetHostConnectionSubtypeHspap = NetHostConnectionSubtypeKey.String("hspap") - // GSM - NetHostConnectionSubtypeGsm = NetHostConnectionSubtypeKey.String("gsm") - // TD-SCDMA - NetHostConnectionSubtypeTdScdma = NetHostConnectionSubtypeKey.String("td_scdma") - // IWLAN - NetHostConnectionSubtypeIwlan = NetHostConnectionSubtypeKey.String("iwlan") - // 5G NR (New Radio) - NetHostConnectionSubtypeNr = NetHostConnectionSubtypeKey.String("nr") - // 5G NRNSA (New Radio Non-Standalone) - NetHostConnectionSubtypeNrnsa = NetHostConnectionSubtypeKey.String("nrnsa") - // LTE CA - NetHostConnectionSubtypeLteCa = NetHostConnectionSubtypeKey.String("lte_ca") -) - -// NetHostCarrierName returns an attribute KeyValue conforming to the -// "net.host.carrier.name" semantic conventions. It represents the name of the -// mobile carrier. -func NetHostCarrierName(val string) attribute.KeyValue { - return NetHostCarrierNameKey.String(val) -} - -// NetHostCarrierMcc returns an attribute KeyValue conforming to the -// "net.host.carrier.mcc" semantic conventions. It represents the mobile -// carrier country code. -func NetHostCarrierMcc(val string) attribute.KeyValue { - return NetHostCarrierMccKey.String(val) -} - -// NetHostCarrierMnc returns an attribute KeyValue conforming to the -// "net.host.carrier.mnc" semantic conventions. It represents the mobile -// carrier network code. -func NetHostCarrierMnc(val string) attribute.KeyValue { - return NetHostCarrierMncKey.String(val) -} - -// NetHostCarrierIcc returns an attribute KeyValue conforming to the -// "net.host.carrier.icc" semantic conventions. It represents the ISO 3166-1 -// alpha-2 2-character country code associated with the mobile carrier network. -func NetHostCarrierIcc(val string) attribute.KeyValue { - return NetHostCarrierIccKey.String(val) -} - -// Semantic conventions for HTTP client and server Spans. -const ( - // HTTPRequestContentLengthKey is the attribute Key conforming to the - // "http.request_content_length" semantic conventions. It represents the - // size of the request payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3495 - HTTPRequestContentLengthKey = attribute.Key("http.request_content_length") - - // HTTPResponseContentLengthKey is the attribute Key conforming to the - // "http.response_content_length" semantic conventions. It represents the - // size of the response payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3495 - HTTPResponseContentLengthKey = attribute.Key("http.response_content_length") -) - -// HTTPRequestContentLength returns an attribute KeyValue conforming to the -// "http.request_content_length" semantic conventions. It represents the size -// of the request payload body in bytes. This is the number of bytes -// transferred excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPRequestContentLength(val int) attribute.KeyValue { - return HTTPRequestContentLengthKey.Int(val) -} - -// HTTPResponseContentLength returns an attribute KeyValue conforming to the -// "http.response_content_length" semantic conventions. It represents the size -// of the response payload body in bytes. This is the number of bytes -// transferred excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPResponseContentLength(val int) attribute.KeyValue { - return HTTPResponseContentLengthKey.Int(val) -} - -// Semantic convention describing per-message attributes populated on messaging -// spans or links. -const ( - // MessagingMessageIDKey is the attribute Key conforming to the - // "messaging.message.id" semantic conventions. It represents a value used - // by the messaging system as an identifier for the message, represented as - // a string. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '452a7c7c7c7048c2f887f61572b18fc2' - MessagingMessageIDKey = attribute.Key("messaging.message.id") - - // MessagingMessageConversationIDKey is the attribute Key conforming to the - // "messaging.message.conversation_id" semantic conventions. It represents - // the [conversation ID](#conversations) identifying the conversation to - // which the message belongs, represented as a string. Sometimes called - // "Correlation ID". - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyConversationID' - MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") - - // MessagingMessagePayloadSizeBytesKey is the attribute Key conforming to - // the "messaging.message.payload_size_bytes" semantic conventions. It - // represents the (uncompressed) size of the message payload in bytes. Also - // use this attribute if it is unknown whether the compressed or - // uncompressed payload size is reported. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2738 - MessagingMessagePayloadSizeBytesKey = attribute.Key("messaging.message.payload_size_bytes") - - // MessagingMessagePayloadCompressedSizeBytesKey is the attribute Key - // conforming to the "messaging.message.payload_compressed_size_bytes" - // semantic conventions. It represents the compressed size of the message - // payload in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2048 - MessagingMessagePayloadCompressedSizeBytesKey = attribute.Key("messaging.message.payload_compressed_size_bytes") -) - -// MessagingMessageID returns an attribute KeyValue conforming to the -// "messaging.message.id" semantic conventions. It represents a value used by -// the messaging system as an identifier for the message, represented as a -// string. -func MessagingMessageID(val string) attribute.KeyValue { - return MessagingMessageIDKey.String(val) -} - -// MessagingMessageConversationID returns an attribute KeyValue conforming -// to the "messaging.message.conversation_id" semantic conventions. It -// represents the [conversation ID](#conversations) identifying the -// conversation to which the message belongs, represented as a string. -// Sometimes called "Correlation ID". -func MessagingMessageConversationID(val string) attribute.KeyValue { - return MessagingMessageConversationIDKey.String(val) -} - -// MessagingMessagePayloadSizeBytes returns an attribute KeyValue conforming -// to the "messaging.message.payload_size_bytes" semantic conventions. It -// represents the (uncompressed) size of the message payload in bytes. Also use -// this attribute if it is unknown whether the compressed or uncompressed -// payload size is reported. -func MessagingMessagePayloadSizeBytes(val int) attribute.KeyValue { - return MessagingMessagePayloadSizeBytesKey.Int(val) -} - -// MessagingMessagePayloadCompressedSizeBytes returns an attribute KeyValue -// conforming to the "messaging.message.payload_compressed_size_bytes" semantic -// conventions. It represents the compressed size of the message payload in -// bytes. -func MessagingMessagePayloadCompressedSizeBytes(val int) attribute.KeyValue { - return MessagingMessagePayloadCompressedSizeBytesKey.Int(val) -} - -// Semantic convention for attributes that describe messaging destination on -// broker -const ( - // MessagingDestinationNameKey is the attribute Key conforming to the - // "messaging.destination.name" semantic conventions. It represents the - // message destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyQueue', 'MyTopic' - // Note: Destination name SHOULD uniquely identify a specific queue, topic - // or other entity within the broker. If - // the broker does not have such notion, the destination name SHOULD - // uniquely identify the broker. - MessagingDestinationNameKey = attribute.Key("messaging.destination.name") - - // MessagingDestinationTemplateKey is the attribute Key conforming to the - // "messaging.destination.template" semantic conventions. It represents the - // low cardinality representation of the messaging destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/customers/{customerID}' - // Note: Destination names could be constructed from templates. An example - // would be a destination name involving a user name or product id. - // Although the destination name in this case is of high cardinality, the - // underlying template is of low cardinality and can be effectively used - // for grouping and aggregation. - MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") - - // MessagingDestinationTemporaryKey is the attribute Key conforming to the - // "messaging.destination.temporary" semantic conventions. It represents a - // boolean that is true if the message destination is temporary and might - // not exist anymore after messages are processed. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") - - // MessagingDestinationAnonymousKey is the attribute Key conforming to the - // "messaging.destination.anonymous" semantic conventions. It represents a - // boolean that is true if the message destination is anonymous (could be - // unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") -) - -// MessagingDestinationName returns an attribute KeyValue conforming to the -// "messaging.destination.name" semantic conventions. It represents the message -// destination name -func MessagingDestinationName(val string) attribute.KeyValue { - return MessagingDestinationNameKey.String(val) -} - -// MessagingDestinationTemplate returns an attribute KeyValue conforming to -// the "messaging.destination.template" semantic conventions. It represents the -// low cardinality representation of the messaging destination name -func MessagingDestinationTemplate(val string) attribute.KeyValue { - return MessagingDestinationTemplateKey.String(val) -} - -// MessagingDestinationTemporary returns an attribute KeyValue conforming to -// the "messaging.destination.temporary" semantic conventions. It represents a -// boolean that is true if the message destination is temporary and might not -// exist anymore after messages are processed. -func MessagingDestinationTemporary(val bool) attribute.KeyValue { - return MessagingDestinationTemporaryKey.Bool(val) -} - -// MessagingDestinationAnonymous returns an attribute KeyValue conforming to -// the "messaging.destination.anonymous" semantic conventions. It represents a -// boolean that is true if the message destination is anonymous (could be -// unnamed or have auto-generated name). -func MessagingDestinationAnonymous(val bool) attribute.KeyValue { - return MessagingDestinationAnonymousKey.Bool(val) -} - -// Semantic convention for attributes that describe messaging source on broker -const ( - // MessagingSourceNameKey is the attribute Key conforming to the - // "messaging.source.name" semantic conventions. It represents the message - // source name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MyQueue', 'MyTopic' - // Note: Source name SHOULD uniquely identify a specific queue, topic, or - // other entity within the broker. If - // the broker does not have such notion, the source name SHOULD uniquely - // identify the broker. - MessagingSourceNameKey = attribute.Key("messaging.source.name") - - // MessagingSourceTemplateKey is the attribute Key conforming to the - // "messaging.source.template" semantic conventions. It represents the low - // cardinality representation of the messaging source name - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/customers/{customerID}' - // Note: Source names could be constructed from templates. An example would - // be a source name involving a user name or product id. Although the - // source name in this case is of high cardinality, the underlying template - // is of low cardinality and can be effectively used for grouping and - // aggregation. - MessagingSourceTemplateKey = attribute.Key("messaging.source.template") - - // MessagingSourceTemporaryKey is the attribute Key conforming to the - // "messaging.source.temporary" semantic conventions. It represents a - // boolean that is true if the message source is temporary and might not - // exist anymore after messages are processed. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingSourceTemporaryKey = attribute.Key("messaging.source.temporary") - - // MessagingSourceAnonymousKey is the attribute Key conforming to the - // "messaging.source.anonymous" semantic conventions. It represents a - // boolean that is true if the message source is anonymous (could be - // unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - MessagingSourceAnonymousKey = attribute.Key("messaging.source.anonymous") -) - -// MessagingSourceName returns an attribute KeyValue conforming to the -// "messaging.source.name" semantic conventions. It represents the message -// source name -func MessagingSourceName(val string) attribute.KeyValue { - return MessagingSourceNameKey.String(val) -} - -// MessagingSourceTemplate returns an attribute KeyValue conforming to the -// "messaging.source.template" semantic conventions. It represents the low -// cardinality representation of the messaging source name -func MessagingSourceTemplate(val string) attribute.KeyValue { - return MessagingSourceTemplateKey.String(val) -} - -// MessagingSourceTemporary returns an attribute KeyValue conforming to the -// "messaging.source.temporary" semantic conventions. It represents a boolean -// that is true if the message source is temporary and might not exist anymore -// after messages are processed. -func MessagingSourceTemporary(val bool) attribute.KeyValue { - return MessagingSourceTemporaryKey.Bool(val) -} - -// MessagingSourceAnonymous returns an attribute KeyValue conforming to the -// "messaging.source.anonymous" semantic conventions. It represents a boolean -// that is true if the message source is anonymous (could be unnamed or have -// auto-generated name). -func MessagingSourceAnonymous(val bool) attribute.KeyValue { - return MessagingSourceAnonymousKey.Bool(val) -} - -// Attributes for RabbitMQ -const ( - // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key - // conforming to the "messaging.rabbitmq.destination.routing_key" semantic - // conventions. It represents the rabbitMQ message routing key. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If not empty.) - // Stability: stable - // Examples: 'myKey' - MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") -) - -// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue -// conforming to the "messaging.rabbitmq.destination.routing_key" semantic -// conventions. It represents the rabbitMQ message routing key. -func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { - return MessagingRabbitmqDestinationRoutingKeyKey.String(val) -} - -// Attributes for Apache Kafka -const ( - // MessagingKafkaMessageKeyKey is the attribute Key conforming to the - // "messaging.kafka.message.key" semantic conventions. It represents the - // message keys in Kafka are used for grouping alike messages to ensure - // they're processed on the same partition. They differ from - // `messaging.message.id` in that they're not unique. If the key is `null`, - // the attribute MUST NOT be set. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'myKey' - // Note: If the key type is not string, it's string representation has to - // be supplied for the attribute. If the key has no unambiguous, canonical - // string form, don't include its value. - MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") - - // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the - // "messaging.kafka.consumer.group" semantic conventions. It represents the - // name of the Kafka Consumer Group that is handling the message. Only - // applies to consumers, not producers. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'my-group' - MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") - - // MessagingKafkaClientIDKey is the attribute Key conforming to the - // "messaging.kafka.client_id" semantic conventions. It represents the - // client ID for the Consumer or Producer that is handling the message. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'client-5' - MessagingKafkaClientIDKey = attribute.Key("messaging.kafka.client_id") - - // MessagingKafkaDestinationPartitionKey is the attribute Key conforming to - // the "messaging.kafka.destination.partition" semantic conventions. It - // represents the partition the message is sent to. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2 - MessagingKafkaDestinationPartitionKey = attribute.Key("messaging.kafka.destination.partition") - - // MessagingKafkaSourcePartitionKey is the attribute Key conforming to the - // "messaging.kafka.source.partition" semantic conventions. It represents - // the partition the message is received from. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 2 - MessagingKafkaSourcePartitionKey = attribute.Key("messaging.kafka.source.partition") - - // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the - // "messaging.kafka.message.offset" semantic conventions. It represents the - // offset of a record in the corresponding Kafka partition. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 42 - MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") - - // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the - // "messaging.kafka.message.tombstone" semantic conventions. It represents - // a boolean that is true if the message is a tombstone. - // - // Type: boolean - // RequirementLevel: ConditionallyRequired (If value is `true`. When - // missing, the value is assumed to be `false`.) - // Stability: stable - MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") -) - -// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the -// "messaging.kafka.message.key" semantic conventions. It represents the -// message keys in Kafka are used for grouping alike messages to ensure they're -// processed on the same partition. They differ from `messaging.message.id` in -// that they're not unique. If the key is `null`, the attribute MUST NOT be -// set. -func MessagingKafkaMessageKey(val string) attribute.KeyValue { - return MessagingKafkaMessageKeyKey.String(val) -} - -// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to -// the "messaging.kafka.consumer.group" semantic conventions. It represents the -// name of the Kafka Consumer Group that is handling the message. Only applies -// to consumers, not producers. -func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { - return MessagingKafkaConsumerGroupKey.String(val) -} - -// MessagingKafkaClientID returns an attribute KeyValue conforming to the -// "messaging.kafka.client_id" semantic conventions. It represents the client -// ID for the Consumer or Producer that is handling the message. -func MessagingKafkaClientID(val string) attribute.KeyValue { - return MessagingKafkaClientIDKey.String(val) -} - -// MessagingKafkaDestinationPartition returns an attribute KeyValue -// conforming to the "messaging.kafka.destination.partition" semantic -// conventions. It represents the partition the message is sent to. -func MessagingKafkaDestinationPartition(val int) attribute.KeyValue { - return MessagingKafkaDestinationPartitionKey.Int(val) -} - -// MessagingKafkaSourcePartition returns an attribute KeyValue conforming to -// the "messaging.kafka.source.partition" semantic conventions. It represents -// the partition the message is received from. -func MessagingKafkaSourcePartition(val int) attribute.KeyValue { - return MessagingKafkaSourcePartitionKey.Int(val) -} - -// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to -// the "messaging.kafka.message.offset" semantic conventions. It represents the -// offset of a record in the corresponding Kafka partition. -func MessagingKafkaMessageOffset(val int) attribute.KeyValue { - return MessagingKafkaMessageOffsetKey.Int(val) -} - -// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming -// to the "messaging.kafka.message.tombstone" semantic conventions. It -// represents a boolean that is true if the message is a tombstone. -func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { - return MessagingKafkaMessageTombstoneKey.Bool(val) -} - -// Attributes for Apache RocketMQ -const ( - // MessagingRocketmqNamespaceKey is the attribute Key conforming to the - // "messaging.rocketmq.namespace" semantic conventions. It represents the - // namespace of RocketMQ resources, resources in different namespaces are - // individual. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myNamespace' - MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") - - // MessagingRocketmqClientGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.client_group" semantic conventions. It represents - // the name of the RocketMQ producer/consumer group that is handling the - // message. The client type is identified by the SpanKind. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myConsumerGroup' - MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") - - // MessagingRocketmqClientIDKey is the attribute Key conforming to the - // "messaging.rocketmq.client_id" semantic conventions. It represents the - // unique identifier for each client. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myhost@8742@s8083jm' - MessagingRocketmqClientIDKey = attribute.Key("messaging.rocketmq.client_id") - - // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delivery_timestamp" - // semantic conventions. It represents the timestamp in milliseconds that - // the delay message is expected to be delivered to consumer. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay - // and delay time level is not specified.) - // Stability: stable - // Examples: 1665987217045 - MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") - - // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delay_time_level" semantic - // conventions. It represents the delay time level for delay message, which - // determines the message delay time. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the message type is delay - // and delivery timestamp is not specified.) - // Stability: stable - // Examples: 3 - MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") - - // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.message.group" semantic conventions. It represents - // the it is essential for FIFO message. Messages that belong to the same - // message group are always processed one by one within the same consumer - // group. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If the message type is FIFO.) - // Stability: stable - // Examples: 'myMessageGroup' - MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") - - // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the - // "messaging.rocketmq.message.type" semantic conventions. It represents - // the type of message. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") - - // MessagingRocketmqMessageTagKey is the attribute Key conforming to the - // "messaging.rocketmq.message.tag" semantic conventions. It represents the - // secondary classifier of message besides topic. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'tagA' - MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") - - // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the - // "messaging.rocketmq.message.keys" semantic conventions. It represents - // the key(s) of message, another way to mark message besides message id. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'keyA', 'keyB' - MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") - - // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to - // the "messaging.rocketmq.consumption_model" semantic conventions. It - // represents the model of message consumption. This only applies to - // consumer spans. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") -) - -var ( - // Normal message - MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") - // FIFO message - MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") - // Delay message - MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") - // Transaction message - MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") -) - -var ( - // Clustering consumption model - MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") - // Broadcasting consumption model - MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") -) - -// MessagingRocketmqNamespace returns an attribute KeyValue conforming to -// the "messaging.rocketmq.namespace" semantic conventions. It represents the -// namespace of RocketMQ resources, resources in different namespaces are -// individual. -func MessagingRocketmqNamespace(val string) attribute.KeyValue { - return MessagingRocketmqNamespaceKey.String(val) -} - -// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.client_group" semantic conventions. It represents -// the name of the RocketMQ producer/consumer group that is handling the -// message. The client type is identified by the SpanKind. -func MessagingRocketmqClientGroup(val string) attribute.KeyValue { - return MessagingRocketmqClientGroupKey.String(val) -} - -// MessagingRocketmqClientID returns an attribute KeyValue conforming to the -// "messaging.rocketmq.client_id" semantic conventions. It represents the -// unique identifier for each client. -func MessagingRocketmqClientID(val string) attribute.KeyValue { - return MessagingRocketmqClientIDKey.String(val) -} - -// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic -// conventions. It represents the timestamp in milliseconds that the delay -// message is expected to be delivered to consumer. -func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { - return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) -} - -// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delay_time_level" semantic -// conventions. It represents the delay time level for delay message, which -// determines the message delay time. -func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { - return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) -} - -// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.group" semantic conventions. It represents -// the it is essential for FIFO message. Messages that belong to the same -// message group are always processed one by one within the same consumer -// group. -func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { - return MessagingRocketmqMessageGroupKey.String(val) -} - -// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.tag" semantic conventions. It represents the -// secondary classifier of message besides topic. -func MessagingRocketmqMessageTag(val string) attribute.KeyValue { - return MessagingRocketmqMessageTagKey.String(val) -} - -// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.keys" semantic conventions. It represents -// the key(s) of message, another way to mark message besides message id. -func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { - return MessagingRocketmqMessageKeysKey.StringSlice(val) -} - -// Describes user-agent attributes. -const ( - // UserAgentOriginalKey is the attribute Key conforming to the - // "user_agent.original" semantic conventions. It represents the value of - // the [HTTP - // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) - // header sent by the client. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'CERN-LineMode/2.15 libwww/2.17b3' - UserAgentOriginalKey = attribute.Key("user_agent.original") -) - -// UserAgentOriginal returns an attribute KeyValue conforming to the -// "user_agent.original" semantic conventions. It represents the value of the -// [HTTP -// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) -// header sent by the client. -func UserAgentOriginal(val string) attribute.KeyValue { - return UserAgentOriginalKey.String(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go deleted file mode 100644 index 0d1f55a8fe..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package semconv implements OpenTelemetry semantic conventions. -// -// OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the conventions -// as of the v1.20.0 version of the OpenTelemetry specification. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go deleted file mode 100644 index 6377639321..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/event.go +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" - -import "go.opentelemetry.io/otel/attribute" - -// This semantic convention defines the attributes used to represent a feature -// flag evaluation as an event. -const ( - // FeatureFlagKeyKey is the attribute Key conforming to the - // "feature_flag.key" semantic conventions. It represents the unique - // identifier of the feature flag. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'logo-color' - FeatureFlagKeyKey = attribute.Key("feature_flag.key") - - // FeatureFlagProviderNameKey is the attribute Key conforming to the - // "feature_flag.provider_name" semantic conventions. It represents the - // name of the service provider that performs the flag evaluation. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'Flag Manager' - FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") - - // FeatureFlagVariantKey is the attribute Key conforming to the - // "feature_flag.variant" semantic conventions. It represents the sHOULD be - // a semantic identifier for a value. If one is unavailable, a stringified - // version of the value can be used. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'red', 'true', 'on' - // Note: A semantic identifier, commonly referred to as a variant, provides - // a means - // for referring to a value without including the value itself. This can - // provide additional context for understanding the meaning behind a value. - // For example, the variant `red` maybe be used for the value `#c05543`. - // - // A stringified version of the value can be used in situations where a - // semantic identifier is unavailable. String representation of the value - // should be determined by the implementer. - FeatureFlagVariantKey = attribute.Key("feature_flag.variant") -) - -// FeatureFlagKey returns an attribute KeyValue conforming to the -// "feature_flag.key" semantic conventions. It represents the unique identifier -// of the feature flag. -func FeatureFlagKey(val string) attribute.KeyValue { - return FeatureFlagKeyKey.String(val) -} - -// FeatureFlagProviderName returns an attribute KeyValue conforming to the -// "feature_flag.provider_name" semantic conventions. It represents the name of -// the service provider that performs the flag evaluation. -func FeatureFlagProviderName(val string) attribute.KeyValue { - return FeatureFlagProviderNameKey.String(val) -} - -// FeatureFlagVariant returns an attribute KeyValue conforming to the -// "feature_flag.variant" semantic conventions. It represents the sHOULD be a -// semantic identifier for a value. If one is unavailable, a stringified -// version of the value can be used. -func FeatureFlagVariant(val string) attribute.KeyValue { - return FeatureFlagVariantKey.String(val) -} - -// RPC received/sent message. -const ( - // MessageTypeKey is the attribute Key conforming to the "message.type" - // semantic conventions. It represents the whether this is a received or - // sent message. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - MessageTypeKey = attribute.Key("message.type") - - // MessageIDKey is the attribute Key conforming to the "message.id" - // semantic conventions. It represents the mUST be calculated as two - // different counters starting from `1` one for sent messages and one for - // received message. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Note: This way we guarantee that the values will be consistent between - // different implementations. - MessageIDKey = attribute.Key("message.id") - - // MessageCompressedSizeKey is the attribute Key conforming to the - // "message.compressed_size" semantic conventions. It represents the - // compressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - MessageCompressedSizeKey = attribute.Key("message.compressed_size") - - // MessageUncompressedSizeKey is the attribute Key conforming to the - // "message.uncompressed_size" semantic conventions. It represents the - // uncompressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - MessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") -) - -var ( - // sent - MessageTypeSent = MessageTypeKey.String("SENT") - // received - MessageTypeReceived = MessageTypeKey.String("RECEIVED") -) - -// MessageID returns an attribute KeyValue conforming to the "message.id" -// semantic conventions. It represents the mUST be calculated as two different -// counters starting from `1` one for sent messages and one for received -// message. -func MessageID(val int) attribute.KeyValue { - return MessageIDKey.Int(val) -} - -// MessageCompressedSize returns an attribute KeyValue conforming to the -// "message.compressed_size" semantic conventions. It represents the compressed -// size of the message in bytes. -func MessageCompressedSize(val int) attribute.KeyValue { - return MessageCompressedSizeKey.Int(val) -} - -// MessageUncompressedSize returns an attribute KeyValue conforming to the -// "message.uncompressed_size" semantic conventions. It represents the -// uncompressed size of the message in bytes. -func MessageUncompressedSize(val int) attribute.KeyValue { - return MessageUncompressedSizeKey.Int(val) -} - -// The attributes used to report a single exception associated with a span. -const ( - // ExceptionEscapedKey is the attribute Key conforming to the - // "exception.escaped" semantic conventions. It represents the sHOULD be - // set to true if the exception event is recorded at a point where it is - // known that the exception is escaping the scope of the span. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - // Note: An exception is considered to have escaped (or left) the scope of - // a span, - // if that span is ended while the exception is still logically "in - // flight". - // This may be actually "in flight" in some languages (e.g. if the - // exception - // is passed to a Context manager's `__exit__` method in Python) but will - // usually be caught at the point of recording the exception in most - // languages. - // - // It is usually not possible to determine at the point where an exception - // is thrown - // whether it will escape the scope of a span. - // However, it is trivial to know that an exception - // will escape, if one checks for an active exception just before ending - // the span, - // as done in the [example above](#recording-an-exception). - // - // It follows that an exception may still escape the scope of the span - // even if the `exception.escaped` attribute was not set or set to false, - // since the event might have been recorded at a time where it was not - // clear whether the exception will escape. - ExceptionEscapedKey = attribute.Key("exception.escaped") -) - -// ExceptionEscaped returns an attribute KeyValue conforming to the -// "exception.escaped" semantic conventions. It represents the sHOULD be set to -// true if the exception event is recorded at a point where it is known that -// the exception is escaping the scope of the span. -func ExceptionEscaped(val bool) attribute.KeyValue { - return ExceptionEscapedKey.Bool(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go deleted file mode 100644 index f40c97825a..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/exception.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" - -const ( - // ExceptionEventName is the name of the Span event representing an exception. - ExceptionEventName = "exception" -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go deleted file mode 100644 index 9c1840631b..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/http.go +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" - -// HTTP scheme attributes. -var ( - HTTPSchemeHTTP = HTTPSchemeKey.String("http") - HTTPSchemeHTTPS = HTTPSchemeKey.String("https") -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go deleted file mode 100644 index 3d44dae275..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/resource.go +++ /dev/null @@ -1,2060 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" - -import "go.opentelemetry.io/otel/attribute" - -// The web browser in which the application represented by the resource is -// running. The `browser.*` attributes MUST be used only for resources that -// represent applications running in a web browser (regardless of whether -// running on a mobile or desktop device). -const ( - // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" - // semantic conventions. It represents the array of brand name and version - // separated by a space - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.brands`). - BrowserBrandsKey = attribute.Key("browser.brands") - - // BrowserPlatformKey is the attribute Key conforming to the - // "browser.platform" semantic conventions. It represents the platform on - // which the browser is running - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Windows', 'macOS', 'Android' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.platform`). If unavailable, the legacy - // `navigator.platform` API SHOULD NOT be used instead and this attribute - // SHOULD be left unset in order for the values to be consistent. - // The list of possible values is defined in the [W3C User-Agent Client - // Hints - // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). - // Note that some (but not all) of these values can overlap with values in - // the [`os.type` and `os.name` attributes](./os.md). However, for - // consistency, the values in the `browser.platform` attribute should - // capture the exact value that the user agent provides. - BrowserPlatformKey = attribute.Key("browser.platform") - - // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" - // semantic conventions. It represents a boolean that is true if the - // browser is running on a mobile device - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.mobile`). If unavailable, this attribute - // SHOULD be left unset. - BrowserMobileKey = attribute.Key("browser.mobile") - - // BrowserLanguageKey is the attribute Key conforming to the - // "browser.language" semantic conventions. It represents the preferred - // language of the user using the browser - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'en', 'en-US', 'fr', 'fr-FR' - // Note: This value is intended to be taken from the Navigator API - // `navigator.language`. - BrowserLanguageKey = attribute.Key("browser.language") -) - -// BrowserBrands returns an attribute KeyValue conforming to the -// "browser.brands" semantic conventions. It represents the array of brand name -// and version separated by a space -func BrowserBrands(val ...string) attribute.KeyValue { - return BrowserBrandsKey.StringSlice(val) -} - -// BrowserPlatform returns an attribute KeyValue conforming to the -// "browser.platform" semantic conventions. It represents the platform on which -// the browser is running -func BrowserPlatform(val string) attribute.KeyValue { - return BrowserPlatformKey.String(val) -} - -// BrowserMobile returns an attribute KeyValue conforming to the -// "browser.mobile" semantic conventions. It represents a boolean that is true -// if the browser is running on a mobile device -func BrowserMobile(val bool) attribute.KeyValue { - return BrowserMobileKey.Bool(val) -} - -// BrowserLanguage returns an attribute KeyValue conforming to the -// "browser.language" semantic conventions. It represents the preferred -// language of the user using the browser -func BrowserLanguage(val string) attribute.KeyValue { - return BrowserLanguageKey.String(val) -} - -// A cloud environment (e.g. GCP, Azure, AWS) -const ( - // CloudProviderKey is the attribute Key conforming to the "cloud.provider" - // semantic conventions. It represents the name of the cloud provider. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - CloudProviderKey = attribute.Key("cloud.provider") - - // CloudAccountIDKey is the attribute Key conforming to the - // "cloud.account.id" semantic conventions. It represents the cloud account - // ID the resource is assigned to. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '111111111111', 'opentelemetry' - CloudAccountIDKey = attribute.Key("cloud.account.id") - - // CloudRegionKey is the attribute Key conforming to the "cloud.region" - // semantic conventions. It represents the geographical region the resource - // is running. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'us-central1', 'us-east-1' - // Note: Refer to your provider's docs to see the available regions, for - // example [Alibaba Cloud - // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS - // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), - // [Azure - // regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), - // [Google Cloud regions](https://cloud.google.com/about/locations), or - // [Tencent Cloud - // regions](https://www.tencentcloud.com/document/product/213/6091). - CloudRegionKey = attribute.Key("cloud.region") - - // CloudResourceIDKey is the attribute Key conforming to the - // "cloud.resource_id" semantic conventions. It represents the cloud - // provider-specific native identifier of the monitored cloud resource - // (e.g. an - // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // on AWS, a [fully qualified resource - // ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) - // on Azure, a [full resource - // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // on GCP) - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', - // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', - // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' - // Note: On some cloud providers, it may not be possible to determine the - // full ID at startup, - // so it may be necessary to set `cloud.resource_id` as a span attribute - // instead. - // - // The exact value to use for `cloud.resource_id` depends on the cloud - // provider. - // The following well-known definitions MUST be used if you set this - // attribute and they apply: - // - // * **AWS Lambda:** The function - // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). - // Take care not to use the "invoked ARN" directly but replace any - // [alias - // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) - // with the resolved function version, as the same runtime instance may - // be invokable with - // multiple different aliases. - // * **GCP:** The [URI of the - // resource](https://cloud.google.com/iam/docs/full-resource-names) - // * **Azure:** The [Fully Qualified Resource - // ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id) - // of the invoked function, - // *not* the function app, having the form - // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider. - CloudResourceIDKey = attribute.Key("cloud.resource_id") - - // CloudAvailabilityZoneKey is the attribute Key conforming to the - // "cloud.availability_zone" semantic conventions. It represents the cloud - // regions often have multiple, isolated locations known as zones to - // increase availability. Availability zone represents the zone where the - // resource is running. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'us-east-1c' - // Note: Availability zones are called "zones" on Alibaba Cloud and Google - // Cloud. - CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") - - // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" - // semantic conventions. It represents the cloud platform in use. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Note: The prefix of the service SHOULD match the one specified in - // `cloud.provider`. - CloudPlatformKey = attribute.Key("cloud.platform") -) - -var ( - // Alibaba Cloud - CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") - // Amazon Web Services - CloudProviderAWS = CloudProviderKey.String("aws") - // Microsoft Azure - CloudProviderAzure = CloudProviderKey.String("azure") - // Google Cloud Platform - CloudProviderGCP = CloudProviderKey.String("gcp") - // Heroku Platform as a Service - CloudProviderHeroku = CloudProviderKey.String("heroku") - // IBM Cloud - CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") - // Tencent Cloud - CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") -) - -var ( - // Alibaba Cloud Elastic Compute Service - CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") - // Alibaba Cloud Function Compute - CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") - // Red Hat OpenShift on Alibaba Cloud - CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") - // AWS Elastic Compute Cloud - CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") - // AWS Elastic Container Service - CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") - // AWS Elastic Kubernetes Service - CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") - // AWS Lambda - CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") - // AWS Elastic Beanstalk - CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") - // AWS App Runner - CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") - // Red Hat OpenShift on AWS (ROSA) - CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") - // Azure Virtual Machines - CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") - // Azure Container Instances - CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") - // Azure Kubernetes Service - CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") - // Azure Functions - CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") - // Azure App Service - CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") - // Azure Red Hat OpenShift - CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") - // Google Cloud Compute Engine (GCE) - CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") - // Google Cloud Run - CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") - // Google Cloud Kubernetes Engine (GKE) - CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") - // Google Cloud Functions (GCF) - CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") - // Google Cloud App Engine (GAE) - CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") - // Red Hat OpenShift on Google Cloud - CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") - // Red Hat OpenShift on IBM Cloud - CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") - // Tencent Cloud Cloud Virtual Machine (CVM) - CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") - // Tencent Cloud Elastic Kubernetes Service (EKS) - CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") - // Tencent Cloud Serverless Cloud Function (SCF) - CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") -) - -// CloudAccountID returns an attribute KeyValue conforming to the -// "cloud.account.id" semantic conventions. It represents the cloud account ID -// the resource is assigned to. -func CloudAccountID(val string) attribute.KeyValue { - return CloudAccountIDKey.String(val) -} - -// CloudRegion returns an attribute KeyValue conforming to the -// "cloud.region" semantic conventions. It represents the geographical region -// the resource is running. -func CloudRegion(val string) attribute.KeyValue { - return CloudRegionKey.String(val) -} - -// CloudResourceID returns an attribute KeyValue conforming to the -// "cloud.resource_id" semantic conventions. It represents the cloud -// provider-specific native identifier of the monitored cloud resource (e.g. an -// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) -// on AWS, a [fully qualified resource -// ID](https://learn.microsoft.com/en-us/rest/api/resources/resources/get-by-id) -// on Azure, a [full resource -// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) -// on GCP) -func CloudResourceID(val string) attribute.KeyValue { - return CloudResourceIDKey.String(val) -} - -// CloudAvailabilityZone returns an attribute KeyValue conforming to the -// "cloud.availability_zone" semantic conventions. It represents the cloud -// regions often have multiple, isolated locations known as zones to increase -// availability. Availability zone represents the zone where the resource is -// running. -func CloudAvailabilityZone(val string) attribute.KeyValue { - return CloudAvailabilityZoneKey.String(val) -} - -// Resources used by AWS Elastic Container Service (ECS). -const ( - // AWSECSContainerARNKey is the attribute Key conforming to the - // "aws.ecs.container.arn" semantic conventions. It represents the Amazon - // Resource Name (ARN) of an [ECS container - // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' - AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") - - // AWSECSClusterARNKey is the attribute Key conforming to the - // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an - // [ECS - // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") - - // AWSECSLaunchtypeKey is the attribute Key conforming to the - // "aws.ecs.launchtype" semantic conventions. It represents the [launch - // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) - // for an ECS task. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") - - // AWSECSTaskARNKey is the attribute Key conforming to the - // "aws.ecs.task.arn" semantic conventions. It represents the ARN of an - // [ECS task - // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b' - AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") - - // AWSECSTaskFamilyKey is the attribute Key conforming to the - // "aws.ecs.task.family" semantic conventions. It represents the task - // definition family this task definition is a member of. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-family' - AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") - - // AWSECSTaskRevisionKey is the attribute Key conforming to the - // "aws.ecs.task.revision" semantic conventions. It represents the revision - // for this task definition. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '8', '26' - AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") -) - -var ( - // ec2 - AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") - // fargate - AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") -) - -// AWSECSContainerARN returns an attribute KeyValue conforming to the -// "aws.ecs.container.arn" semantic conventions. It represents the Amazon -// Resource Name (ARN) of an [ECS container -// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). -func AWSECSContainerARN(val string) attribute.KeyValue { - return AWSECSContainerARNKey.String(val) -} - -// AWSECSClusterARN returns an attribute KeyValue conforming to the -// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS -// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). -func AWSECSClusterARN(val string) attribute.KeyValue { - return AWSECSClusterARNKey.String(val) -} - -// AWSECSTaskARN returns an attribute KeyValue conforming to the -// "aws.ecs.task.arn" semantic conventions. It represents the ARN of an [ECS -// task -// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). -func AWSECSTaskARN(val string) attribute.KeyValue { - return AWSECSTaskARNKey.String(val) -} - -// AWSECSTaskFamily returns an attribute KeyValue conforming to the -// "aws.ecs.task.family" semantic conventions. It represents the task -// definition family this task definition is a member of. -func AWSECSTaskFamily(val string) attribute.KeyValue { - return AWSECSTaskFamilyKey.String(val) -} - -// AWSECSTaskRevision returns an attribute KeyValue conforming to the -// "aws.ecs.task.revision" semantic conventions. It represents the revision for -// this task definition. -func AWSECSTaskRevision(val string) attribute.KeyValue { - return AWSECSTaskRevisionKey.String(val) -} - -// Resources used by AWS Elastic Kubernetes Service (EKS). -const ( - // AWSEKSClusterARNKey is the attribute Key conforming to the - // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an - // EKS cluster. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") -) - -// AWSEKSClusterARN returns an attribute KeyValue conforming to the -// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS -// cluster. -func AWSEKSClusterARN(val string) attribute.KeyValue { - return AWSEKSClusterARNKey.String(val) -} - -// Resources specific to Amazon Web Services. -const ( - // AWSLogGroupNamesKey is the attribute Key conforming to the - // "aws.log.group.names" semantic conventions. It represents the name(s) of - // the AWS log group(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '/aws/lambda/my-function', 'opentelemetry-service' - // Note: Multiple log groups must be supported for cases like - // multi-container applications, where a single application has sidecar - // containers, and each write to their own log group. - AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") - - // AWSLogGroupARNsKey is the attribute Key conforming to the - // "aws.log.group.arns" semantic conventions. It represents the Amazon - // Resource Name(s) (ARN) of the AWS log group(s). - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' - // Note: See the [log group ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") - - // AWSLogStreamNamesKey is the attribute Key conforming to the - // "aws.log.stream.names" semantic conventions. It represents the name(s) - // of the AWS log stream(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") - - // AWSLogStreamARNsKey is the attribute Key conforming to the - // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of - // the AWS log stream(s). - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - // Note: See the [log stream ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - // One log group can contain several log streams, so these ARNs necessarily - // identify both a log group and a log stream. - AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") -) - -// AWSLogGroupNames returns an attribute KeyValue conforming to the -// "aws.log.group.names" semantic conventions. It represents the name(s) of the -// AWS log group(s) an application is writing to. -func AWSLogGroupNames(val ...string) attribute.KeyValue { - return AWSLogGroupNamesKey.StringSlice(val) -} - -// AWSLogGroupARNs returns an attribute KeyValue conforming to the -// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource -// Name(s) (ARN) of the AWS log group(s). -func AWSLogGroupARNs(val ...string) attribute.KeyValue { - return AWSLogGroupARNsKey.StringSlice(val) -} - -// AWSLogStreamNames returns an attribute KeyValue conforming to the -// "aws.log.stream.names" semantic conventions. It represents the name(s) of -// the AWS log stream(s) an application is writing to. -func AWSLogStreamNames(val ...string) attribute.KeyValue { - return AWSLogStreamNamesKey.StringSlice(val) -} - -// AWSLogStreamARNs returns an attribute KeyValue conforming to the -// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the -// AWS log stream(s). -func AWSLogStreamARNs(val ...string) attribute.KeyValue { - return AWSLogStreamARNsKey.StringSlice(val) -} - -// Heroku dyno metadata -const ( - // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the - // "heroku.release.creation_timestamp" semantic conventions. It represents - // the time and date the release was created - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2022-10-23T18:00:42Z' - HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") - - // HerokuReleaseCommitKey is the attribute Key conforming to the - // "heroku.release.commit" semantic conventions. It represents the commit - // hash for the current release - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' - HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") - - // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" - // semantic conventions. It represents the unique identifier for the - // application - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' - HerokuAppIDKey = attribute.Key("heroku.app.id") -) - -// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming -// to the "heroku.release.creation_timestamp" semantic conventions. It -// represents the time and date the release was created -func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { - return HerokuReleaseCreationTimestampKey.String(val) -} - -// HerokuReleaseCommit returns an attribute KeyValue conforming to the -// "heroku.release.commit" semantic conventions. It represents the commit hash -// for the current release -func HerokuReleaseCommit(val string) attribute.KeyValue { - return HerokuReleaseCommitKey.String(val) -} - -// HerokuAppID returns an attribute KeyValue conforming to the -// "heroku.app.id" semantic conventions. It represents the unique identifier -// for the application -func HerokuAppID(val string) attribute.KeyValue { - return HerokuAppIDKey.String(val) -} - -// A container instance. -const ( - // ContainerNameKey is the attribute Key conforming to the "container.name" - // semantic conventions. It represents the container name used by container - // runtime. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-autoconf' - ContainerNameKey = attribute.Key("container.name") - - // ContainerIDKey is the attribute Key conforming to the "container.id" - // semantic conventions. It represents the container ID. Usually a UUID, as - // for example used to [identify Docker - // containers](https://docs.docker.com/engine/reference/run/#container-identification). - // The UUID might be abbreviated. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'a3bf90e006b2' - ContainerIDKey = attribute.Key("container.id") - - // ContainerRuntimeKey is the attribute Key conforming to the - // "container.runtime" semantic conventions. It represents the container - // runtime managing this container. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'docker', 'containerd', 'rkt' - ContainerRuntimeKey = attribute.Key("container.runtime") - - // ContainerImageNameKey is the attribute Key conforming to the - // "container.image.name" semantic conventions. It represents the name of - // the image the container was built on. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'gcr.io/opentelemetry/operator' - ContainerImageNameKey = attribute.Key("container.image.name") - - // ContainerImageTagKey is the attribute Key conforming to the - // "container.image.tag" semantic conventions. It represents the container - // image tag. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '0.1' - ContainerImageTagKey = attribute.Key("container.image.tag") -) - -// ContainerName returns an attribute KeyValue conforming to the -// "container.name" semantic conventions. It represents the container name used -// by container runtime. -func ContainerName(val string) attribute.KeyValue { - return ContainerNameKey.String(val) -} - -// ContainerID returns an attribute KeyValue conforming to the -// "container.id" semantic conventions. It represents the container ID. Usually -// a UUID, as for example used to [identify Docker -// containers](https://docs.docker.com/engine/reference/run/#container-identification). -// The UUID might be abbreviated. -func ContainerID(val string) attribute.KeyValue { - return ContainerIDKey.String(val) -} - -// ContainerRuntime returns an attribute KeyValue conforming to the -// "container.runtime" semantic conventions. It represents the container -// runtime managing this container. -func ContainerRuntime(val string) attribute.KeyValue { - return ContainerRuntimeKey.String(val) -} - -// ContainerImageName returns an attribute KeyValue conforming to the -// "container.image.name" semantic conventions. It represents the name of the -// image the container was built on. -func ContainerImageName(val string) attribute.KeyValue { - return ContainerImageNameKey.String(val) -} - -// ContainerImageTag returns an attribute KeyValue conforming to the -// "container.image.tag" semantic conventions. It represents the container -// image tag. -func ContainerImageTag(val string) attribute.KeyValue { - return ContainerImageTagKey.String(val) -} - -// The software deployment. -const ( - // DeploymentEnvironmentKey is the attribute Key conforming to the - // "deployment.environment" semantic conventions. It represents the name of - // the [deployment - // environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka - // deployment tier). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'staging', 'production' - DeploymentEnvironmentKey = attribute.Key("deployment.environment") -) - -// DeploymentEnvironment returns an attribute KeyValue conforming to the -// "deployment.environment" semantic conventions. It represents the name of the -// [deployment -// environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka -// deployment tier). -func DeploymentEnvironment(val string) attribute.KeyValue { - return DeploymentEnvironmentKey.String(val) -} - -// The device on which the process represented by this resource is running. -const ( - // DeviceIDKey is the attribute Key conforming to the "device.id" semantic - // conventions. It represents a unique identifier representing the device - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' - // Note: The device identifier MUST only be defined using the values - // outlined below. This value is not an advertising identifier and MUST NOT - // be used as such. On iOS (Swift or Objective-C), this value MUST be equal - // to the [vendor - // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). - // On Android (Java or Kotlin), this value MUST be equal to the Firebase - // Installation ID or a globally unique UUID which is persisted across - // sessions in your application. More information can be found - // [here](https://developer.android.com/training/articles/user-data-ids) on - // best practices and exact implementation details. Caution should be taken - // when storing personal data or anything which can identify a user. GDPR - // and data protection laws may apply, ensure you do your own due - // diligence. - DeviceIDKey = attribute.Key("device.id") - - // DeviceModelIdentifierKey is the attribute Key conforming to the - // "device.model.identifier" semantic conventions. It represents the model - // identifier for the device - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'iPhone3,4', 'SM-G920F' - // Note: It's recommended this value represents a machine readable version - // of the model identifier rather than the market or consumer-friendly name - // of the device. - DeviceModelIdentifierKey = attribute.Key("device.model.identifier") - - // DeviceModelNameKey is the attribute Key conforming to the - // "device.model.name" semantic conventions. It represents the marketing - // name for the device model - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' - // Note: It's recommended this value represents a human readable version of - // the device model rather than a machine readable alternative. - DeviceModelNameKey = attribute.Key("device.model.name") - - // DeviceManufacturerKey is the attribute Key conforming to the - // "device.manufacturer" semantic conventions. It represents the name of - // the device manufacturer - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Apple', 'Samsung' - // Note: The Android OS provides this field via - // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). - // iOS apps SHOULD hardcode the value `Apple`. - DeviceManufacturerKey = attribute.Key("device.manufacturer") -) - -// DeviceID returns an attribute KeyValue conforming to the "device.id" -// semantic conventions. It represents a unique identifier representing the -// device -func DeviceID(val string) attribute.KeyValue { - return DeviceIDKey.String(val) -} - -// DeviceModelIdentifier returns an attribute KeyValue conforming to the -// "device.model.identifier" semantic conventions. It represents the model -// identifier for the device -func DeviceModelIdentifier(val string) attribute.KeyValue { - return DeviceModelIdentifierKey.String(val) -} - -// DeviceModelName returns an attribute KeyValue conforming to the -// "device.model.name" semantic conventions. It represents the marketing name -// for the device model -func DeviceModelName(val string) attribute.KeyValue { - return DeviceModelNameKey.String(val) -} - -// DeviceManufacturer returns an attribute KeyValue conforming to the -// "device.manufacturer" semantic conventions. It represents the name of the -// device manufacturer -func DeviceManufacturer(val string) attribute.KeyValue { - return DeviceManufacturerKey.String(val) -} - -// A serverless instance. -const ( - // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic - // conventions. It represents the name of the single function that this - // runtime instance executes. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'my-function', 'myazurefunctionapp/some-function-name' - // Note: This is the name of the function as configured/deployed on the - // FaaS - // platform and is usually different from the name of the callback - // function (which may be stored in the - // [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) - // span attributes). - // - // For some cloud providers, the above definition is ambiguous. The - // following - // definition of function name MUST be used for this attribute - // (and consequently the span name) for the listed cloud - // providers/products: - // - // * **Azure:** The full name `/`, i.e., function app name - // followed by a forward slash followed by the function name (this form - // can also be seen in the resource JSON for the function). - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider (see also the `cloud.resource_id` attribute). - FaaSNameKey = attribute.Key("faas.name") - - // FaaSVersionKey is the attribute Key conforming to the "faas.version" - // semantic conventions. It represents the immutable version of the - // function being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '26', 'pinkfroid-00002' - // Note: Depending on the cloud provider and platform, use: - // - // * **AWS Lambda:** The [function - // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) - // (an integer represented as a decimal string). - // * **Google Cloud Run:** The - // [revision](https://cloud.google.com/run/docs/managing/revisions) - // (i.e., the function name plus the revision suffix). - // * **Google Cloud Functions:** The value of the - // [`K_REVISION` environment - // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). - // * **Azure Functions:** Not applicable. Do not set this attribute. - FaaSVersionKey = attribute.Key("faas.version") - - // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" - // semantic conventions. It represents the execution environment ID as a - // string, that will be potentially reused for other invocations to the - // same function/function version. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' - // Note: * **AWS Lambda:** Use the (full) log stream name. - FaaSInstanceKey = attribute.Key("faas.instance") - - // FaaSMaxMemoryKey is the attribute Key conforming to the - // "faas.max_memory" semantic conventions. It represents the amount of - // memory available to the serverless function converted to Bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 134217728 - // Note: It's recommended to set this attribute since e.g. too little - // memory can easily stop a Java AWS Lambda function from working - // correctly. On AWS Lambda, the environment variable - // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must - // be multiplied by 1,048,576). - FaaSMaxMemoryKey = attribute.Key("faas.max_memory") -) - -// FaaSName returns an attribute KeyValue conforming to the "faas.name" -// semantic conventions. It represents the name of the single function that -// this runtime instance executes. -func FaaSName(val string) attribute.KeyValue { - return FaaSNameKey.String(val) -} - -// FaaSVersion returns an attribute KeyValue conforming to the -// "faas.version" semantic conventions. It represents the immutable version of -// the function being executed. -func FaaSVersion(val string) attribute.KeyValue { - return FaaSVersionKey.String(val) -} - -// FaaSInstance returns an attribute KeyValue conforming to the -// "faas.instance" semantic conventions. It represents the execution -// environment ID as a string, that will be potentially reused for other -// invocations to the same function/function version. -func FaaSInstance(val string) attribute.KeyValue { - return FaaSInstanceKey.String(val) -} - -// FaaSMaxMemory returns an attribute KeyValue conforming to the -// "faas.max_memory" semantic conventions. It represents the amount of memory -// available to the serverless function converted to Bytes. -func FaaSMaxMemory(val int) attribute.KeyValue { - return FaaSMaxMemoryKey.Int(val) -} - -// A host is defined as a general computing instance. -const ( - // HostIDKey is the attribute Key conforming to the "host.id" semantic - // conventions. It represents the unique host ID. For Cloud, this must be - // the instance_id assigned by the cloud provider. For non-containerized - // systems, this should be the `machine-id`. See the table below for the - // sources to use to determine the `machine-id` based on operating system. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'fdbf79e8af94cb7f9e8df36789187052' - HostIDKey = attribute.Key("host.id") - - // HostNameKey is the attribute Key conforming to the "host.name" semantic - // conventions. It represents the name of the host. On Unix systems, it may - // contain what the hostname command returns, or the fully qualified - // hostname, or another name specified by the user. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-test' - HostNameKey = attribute.Key("host.name") - - // HostTypeKey is the attribute Key conforming to the "host.type" semantic - // conventions. It represents the type of host. For Cloud, this must be the - // machine type. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'n1-standard-1' - HostTypeKey = attribute.Key("host.type") - - // HostArchKey is the attribute Key conforming to the "host.arch" semantic - // conventions. It represents the CPU architecture the host system is - // running on. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - HostArchKey = attribute.Key("host.arch") - - // HostImageNameKey is the attribute Key conforming to the - // "host.image.name" semantic conventions. It represents the name of the VM - // image or OS install the host was instantiated from. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' - HostImageNameKey = attribute.Key("host.image.name") - - // HostImageIDKey is the attribute Key conforming to the "host.image.id" - // semantic conventions. It represents the vM image ID. For Cloud, this - // value is from the provider. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'ami-07b06b442921831e5' - HostImageIDKey = attribute.Key("host.image.id") - - // HostImageVersionKey is the attribute Key conforming to the - // "host.image.version" semantic conventions. It represents the version - // string of the VM image as defined in [Version - // Attributes](README.md#version-attributes). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '0.1' - HostImageVersionKey = attribute.Key("host.image.version") -) - -var ( - // AMD64 - HostArchAMD64 = HostArchKey.String("amd64") - // ARM32 - HostArchARM32 = HostArchKey.String("arm32") - // ARM64 - HostArchARM64 = HostArchKey.String("arm64") - // Itanium - HostArchIA64 = HostArchKey.String("ia64") - // 32-bit PowerPC - HostArchPPC32 = HostArchKey.String("ppc32") - // 64-bit PowerPC - HostArchPPC64 = HostArchKey.String("ppc64") - // IBM z/Architecture - HostArchS390x = HostArchKey.String("s390x") - // 32-bit x86 - HostArchX86 = HostArchKey.String("x86") -) - -// HostID returns an attribute KeyValue conforming to the "host.id" semantic -// conventions. It represents the unique host ID. For Cloud, this must be the -// instance_id assigned by the cloud provider. For non-containerized systems, -// this should be the `machine-id`. See the table below for the sources to use -// to determine the `machine-id` based on operating system. -func HostID(val string) attribute.KeyValue { - return HostIDKey.String(val) -} - -// HostName returns an attribute KeyValue conforming to the "host.name" -// semantic conventions. It represents the name of the host. On Unix systems, -// it may contain what the hostname command returns, or the fully qualified -// hostname, or another name specified by the user. -func HostName(val string) attribute.KeyValue { - return HostNameKey.String(val) -} - -// HostType returns an attribute KeyValue conforming to the "host.type" -// semantic conventions. It represents the type of host. For Cloud, this must -// be the machine type. -func HostType(val string) attribute.KeyValue { - return HostTypeKey.String(val) -} - -// HostImageName returns an attribute KeyValue conforming to the -// "host.image.name" semantic conventions. It represents the name of the VM -// image or OS install the host was instantiated from. -func HostImageName(val string) attribute.KeyValue { - return HostImageNameKey.String(val) -} - -// HostImageID returns an attribute KeyValue conforming to the -// "host.image.id" semantic conventions. It represents the vM image ID. For -// Cloud, this value is from the provider. -func HostImageID(val string) attribute.KeyValue { - return HostImageIDKey.String(val) -} - -// HostImageVersion returns an attribute KeyValue conforming to the -// "host.image.version" semantic conventions. It represents the version string -// of the VM image as defined in [Version -// Attributes](README.md#version-attributes). -func HostImageVersion(val string) attribute.KeyValue { - return HostImageVersionKey.String(val) -} - -// A Kubernetes Cluster. -const ( - // K8SClusterNameKey is the attribute Key conforming to the - // "k8s.cluster.name" semantic conventions. It represents the name of the - // cluster. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-cluster' - K8SClusterNameKey = attribute.Key("k8s.cluster.name") -) - -// K8SClusterName returns an attribute KeyValue conforming to the -// "k8s.cluster.name" semantic conventions. It represents the name of the -// cluster. -func K8SClusterName(val string) attribute.KeyValue { - return K8SClusterNameKey.String(val) -} - -// A Kubernetes Node object. -const ( - // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" - // semantic conventions. It represents the name of the Node. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'node-1' - K8SNodeNameKey = attribute.Key("k8s.node.name") - - // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" - // semantic conventions. It represents the UID of the Node. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' - K8SNodeUIDKey = attribute.Key("k8s.node.uid") -) - -// K8SNodeName returns an attribute KeyValue conforming to the -// "k8s.node.name" semantic conventions. It represents the name of the Node. -func K8SNodeName(val string) attribute.KeyValue { - return K8SNodeNameKey.String(val) -} - -// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" -// semantic conventions. It represents the UID of the Node. -func K8SNodeUID(val string) attribute.KeyValue { - return K8SNodeUIDKey.String(val) -} - -// A Kubernetes Namespace. -const ( - // K8SNamespaceNameKey is the attribute Key conforming to the - // "k8s.namespace.name" semantic conventions. It represents the name of the - // namespace that the pod is running in. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'default' - K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") -) - -// K8SNamespaceName returns an attribute KeyValue conforming to the -// "k8s.namespace.name" semantic conventions. It represents the name of the -// namespace that the pod is running in. -func K8SNamespaceName(val string) attribute.KeyValue { - return K8SNamespaceNameKey.String(val) -} - -// A Kubernetes Pod object. -const ( - // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" - // semantic conventions. It represents the UID of the Pod. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SPodUIDKey = attribute.Key("k8s.pod.uid") - - // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" - // semantic conventions. It represents the name of the Pod. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry-pod-autoconf' - K8SPodNameKey = attribute.Key("k8s.pod.name") -) - -// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" -// semantic conventions. It represents the UID of the Pod. -func K8SPodUID(val string) attribute.KeyValue { - return K8SPodUIDKey.String(val) -} - -// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" -// semantic conventions. It represents the name of the Pod. -func K8SPodName(val string) attribute.KeyValue { - return K8SPodNameKey.String(val) -} - -// A container in a -// [PodTemplate](https://kubernetes.io/docs/concepts/workloads/pods/#pod-templates). -const ( - // K8SContainerNameKey is the attribute Key conforming to the - // "k8s.container.name" semantic conventions. It represents the name of the - // Container from Pod specification, must be unique within a Pod. Container - // runtime usually uses different globally unique name (`container.name`). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'redis' - K8SContainerNameKey = attribute.Key("k8s.container.name") - - // K8SContainerRestartCountKey is the attribute Key conforming to the - // "k8s.container.restart_count" semantic conventions. It represents the - // number of times the container was restarted. This attribute can be used - // to identify a particular container (running or stopped) within a - // container spec. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 0, 2 - K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") -) - -// K8SContainerName returns an attribute KeyValue conforming to the -// "k8s.container.name" semantic conventions. It represents the name of the -// Container from Pod specification, must be unique within a Pod. Container -// runtime usually uses different globally unique name (`container.name`). -func K8SContainerName(val string) attribute.KeyValue { - return K8SContainerNameKey.String(val) -} - -// K8SContainerRestartCount returns an attribute KeyValue conforming to the -// "k8s.container.restart_count" semantic conventions. It represents the number -// of times the container was restarted. This attribute can be used to identify -// a particular container (running or stopped) within a container spec. -func K8SContainerRestartCount(val int) attribute.KeyValue { - return K8SContainerRestartCountKey.Int(val) -} - -// A Kubernetes ReplicaSet object. -const ( - // K8SReplicaSetUIDKey is the attribute Key conforming to the - // "k8s.replicaset.uid" semantic conventions. It represents the UID of the - // ReplicaSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") - - // K8SReplicaSetNameKey is the attribute Key conforming to the - // "k8s.replicaset.name" semantic conventions. It represents the name of - // the ReplicaSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") -) - -// K8SReplicaSetUID returns an attribute KeyValue conforming to the -// "k8s.replicaset.uid" semantic conventions. It represents the UID of the -// ReplicaSet. -func K8SReplicaSetUID(val string) attribute.KeyValue { - return K8SReplicaSetUIDKey.String(val) -} - -// K8SReplicaSetName returns an attribute KeyValue conforming to the -// "k8s.replicaset.name" semantic conventions. It represents the name of the -// ReplicaSet. -func K8SReplicaSetName(val string) attribute.KeyValue { - return K8SReplicaSetNameKey.String(val) -} - -// A Kubernetes Deployment object. -const ( - // K8SDeploymentUIDKey is the attribute Key conforming to the - // "k8s.deployment.uid" semantic conventions. It represents the UID of the - // Deployment. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") - - // K8SDeploymentNameKey is the attribute Key conforming to the - // "k8s.deployment.name" semantic conventions. It represents the name of - // the Deployment. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") -) - -// K8SDeploymentUID returns an attribute KeyValue conforming to the -// "k8s.deployment.uid" semantic conventions. It represents the UID of the -// Deployment. -func K8SDeploymentUID(val string) attribute.KeyValue { - return K8SDeploymentUIDKey.String(val) -} - -// K8SDeploymentName returns an attribute KeyValue conforming to the -// "k8s.deployment.name" semantic conventions. It represents the name of the -// Deployment. -func K8SDeploymentName(val string) attribute.KeyValue { - return K8SDeploymentNameKey.String(val) -} - -// A Kubernetes StatefulSet object. -const ( - // K8SStatefulSetUIDKey is the attribute Key conforming to the - // "k8s.statefulset.uid" semantic conventions. It represents the UID of the - // StatefulSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") - - // K8SStatefulSetNameKey is the attribute Key conforming to the - // "k8s.statefulset.name" semantic conventions. It represents the name of - // the StatefulSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") -) - -// K8SStatefulSetUID returns an attribute KeyValue conforming to the -// "k8s.statefulset.uid" semantic conventions. It represents the UID of the -// StatefulSet. -func K8SStatefulSetUID(val string) attribute.KeyValue { - return K8SStatefulSetUIDKey.String(val) -} - -// K8SStatefulSetName returns an attribute KeyValue conforming to the -// "k8s.statefulset.name" semantic conventions. It represents the name of the -// StatefulSet. -func K8SStatefulSetName(val string) attribute.KeyValue { - return K8SStatefulSetNameKey.String(val) -} - -// A Kubernetes DaemonSet object. -const ( - // K8SDaemonSetUIDKey is the attribute Key conforming to the - // "k8s.daemonset.uid" semantic conventions. It represents the UID of the - // DaemonSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") - - // K8SDaemonSetNameKey is the attribute Key conforming to the - // "k8s.daemonset.name" semantic conventions. It represents the name of the - // DaemonSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") -) - -// K8SDaemonSetUID returns an attribute KeyValue conforming to the -// "k8s.daemonset.uid" semantic conventions. It represents the UID of the -// DaemonSet. -func K8SDaemonSetUID(val string) attribute.KeyValue { - return K8SDaemonSetUIDKey.String(val) -} - -// K8SDaemonSetName returns an attribute KeyValue conforming to the -// "k8s.daemonset.name" semantic conventions. It represents the name of the -// DaemonSet. -func K8SDaemonSetName(val string) attribute.KeyValue { - return K8SDaemonSetNameKey.String(val) -} - -// A Kubernetes Job object. -const ( - // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" - // semantic conventions. It represents the UID of the Job. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SJobUIDKey = attribute.Key("k8s.job.uid") - - // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" - // semantic conventions. It represents the name of the Job. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SJobNameKey = attribute.Key("k8s.job.name") -) - -// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" -// semantic conventions. It represents the UID of the Job. -func K8SJobUID(val string) attribute.KeyValue { - return K8SJobUIDKey.String(val) -} - -// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" -// semantic conventions. It represents the name of the Job. -func K8SJobName(val string) attribute.KeyValue { - return K8SJobNameKey.String(val) -} - -// A Kubernetes CronJob object. -const ( - // K8SCronJobUIDKey is the attribute Key conforming to the - // "k8s.cronjob.uid" semantic conventions. It represents the UID of the - // CronJob. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") - - // K8SCronJobNameKey is the attribute Key conforming to the - // "k8s.cronjob.name" semantic conventions. It represents the name of the - // CronJob. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'opentelemetry' - K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") -) - -// K8SCronJobUID returns an attribute KeyValue conforming to the -// "k8s.cronjob.uid" semantic conventions. It represents the UID of the -// CronJob. -func K8SCronJobUID(val string) attribute.KeyValue { - return K8SCronJobUIDKey.String(val) -} - -// K8SCronJobName returns an attribute KeyValue conforming to the -// "k8s.cronjob.name" semantic conventions. It represents the name of the -// CronJob. -func K8SCronJobName(val string) attribute.KeyValue { - return K8SCronJobNameKey.String(val) -} - -// The operating system (OS) on which the process represented by this resource -// is running. -const ( - // OSTypeKey is the attribute Key conforming to the "os.type" semantic - // conventions. It represents the operating system type. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - OSTypeKey = attribute.Key("os.type") - - // OSDescriptionKey is the attribute Key conforming to the "os.description" - // semantic conventions. It represents the human readable (not intended to - // be parsed) OS version information, like e.g. reported by `ver` or - // `lsb_release -a` commands. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 - // LTS' - OSDescriptionKey = attribute.Key("os.description") - - // OSNameKey is the attribute Key conforming to the "os.name" semantic - // conventions. It represents the human readable operating system name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'iOS', 'Android', 'Ubuntu' - OSNameKey = attribute.Key("os.name") - - // OSVersionKey is the attribute Key conforming to the "os.version" - // semantic conventions. It represents the version string of the operating - // system as defined in [Version - // Attributes](../../resource/semantic_conventions/README.md#version-attributes). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '14.2.1', '18.04.1' - OSVersionKey = attribute.Key("os.version") -) - -var ( - // Microsoft Windows - OSTypeWindows = OSTypeKey.String("windows") - // Linux - OSTypeLinux = OSTypeKey.String("linux") - // Apple Darwin - OSTypeDarwin = OSTypeKey.String("darwin") - // FreeBSD - OSTypeFreeBSD = OSTypeKey.String("freebsd") - // NetBSD - OSTypeNetBSD = OSTypeKey.String("netbsd") - // OpenBSD - OSTypeOpenBSD = OSTypeKey.String("openbsd") - // DragonFly BSD - OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") - // HP-UX (Hewlett Packard Unix) - OSTypeHPUX = OSTypeKey.String("hpux") - // AIX (Advanced Interactive eXecutive) - OSTypeAIX = OSTypeKey.String("aix") - // SunOS, Oracle Solaris - OSTypeSolaris = OSTypeKey.String("solaris") - // IBM z/OS - OSTypeZOS = OSTypeKey.String("z_os") -) - -// OSDescription returns an attribute KeyValue conforming to the -// "os.description" semantic conventions. It represents the human readable (not -// intended to be parsed) OS version information, like e.g. reported by `ver` -// or `lsb_release -a` commands. -func OSDescription(val string) attribute.KeyValue { - return OSDescriptionKey.String(val) -} - -// OSName returns an attribute KeyValue conforming to the "os.name" semantic -// conventions. It represents the human readable operating system name. -func OSName(val string) attribute.KeyValue { - return OSNameKey.String(val) -} - -// OSVersion returns an attribute KeyValue conforming to the "os.version" -// semantic conventions. It represents the version string of the operating -// system as defined in [Version -// Attributes](../../resource/semantic_conventions/README.md#version-attributes). -func OSVersion(val string) attribute.KeyValue { - return OSVersionKey.String(val) -} - -// An operating system process. -const ( - // ProcessPIDKey is the attribute Key conforming to the "process.pid" - // semantic conventions. It represents the process identifier (PID). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 1234 - ProcessPIDKey = attribute.Key("process.pid") - - // ProcessParentPIDKey is the attribute Key conforming to the - // "process.parent_pid" semantic conventions. It represents the parent - // Process identifier (PID). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 111 - ProcessParentPIDKey = attribute.Key("process.parent_pid") - - // ProcessExecutableNameKey is the attribute Key conforming to the - // "process.executable.name" semantic conventions. It represents the name - // of the process executable. On Linux based systems, can be set to the - // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name - // of `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'otelcol' - ProcessExecutableNameKey = attribute.Key("process.executable.name") - - // ProcessExecutablePathKey is the attribute Key conforming to the - // "process.executable.path" semantic conventions. It represents the full - // path to the process executable. On Linux based systems, can be set to - // the target of `proc/[pid]/exe`. On Windows, can be set to the result of - // `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: '/usr/bin/cmd/otelcol' - ProcessExecutablePathKey = attribute.Key("process.executable.path") - - // ProcessCommandKey is the attribute Key conforming to the - // "process.command" semantic conventions. It represents the command used - // to launch the process (i.e. the command name). On Linux based systems, - // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can - // be set to the first parameter extracted from `GetCommandLineW`. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'cmd/otelcol' - ProcessCommandKey = attribute.Key("process.command") - - // ProcessCommandLineKey is the attribute Key conforming to the - // "process.command_line" semantic conventions. It represents the full - // command used to launch the process as a single string representing the - // full command. On Windows, can be set to the result of `GetCommandLineW`. - // Do not set this if you have to assemble it just for monitoring; use - // `process.command_args` instead. - // - // Type: string - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' - ProcessCommandLineKey = attribute.Key("process.command_line") - - // ProcessCommandArgsKey is the attribute Key conforming to the - // "process.command_args" semantic conventions. It represents the all the - // command arguments (including the command/executable itself) as received - // by the process. On Linux-based systems (and some other Unixoid systems - // supporting procfs), can be set according to the list of null-delimited - // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, - // this would be the full argv vector passed to `main`. - // - // Type: string[] - // RequirementLevel: ConditionallyRequired (See alternative attributes - // below.) - // Stability: stable - // Examples: 'cmd/otecol', '--config=config.yaml' - ProcessCommandArgsKey = attribute.Key("process.command_args") - - // ProcessOwnerKey is the attribute Key conforming to the "process.owner" - // semantic conventions. It represents the username of the user that owns - // the process. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'root' - ProcessOwnerKey = attribute.Key("process.owner") -) - -// ProcessPID returns an attribute KeyValue conforming to the "process.pid" -// semantic conventions. It represents the process identifier (PID). -func ProcessPID(val int) attribute.KeyValue { - return ProcessPIDKey.Int(val) -} - -// ProcessParentPID returns an attribute KeyValue conforming to the -// "process.parent_pid" semantic conventions. It represents the parent Process -// identifier (PID). -func ProcessParentPID(val int) attribute.KeyValue { - return ProcessParentPIDKey.Int(val) -} - -// ProcessExecutableName returns an attribute KeyValue conforming to the -// "process.executable.name" semantic conventions. It represents the name of -// the process executable. On Linux based systems, can be set to the `Name` in -// `proc/[pid]/status`. On Windows, can be set to the base name of -// `GetProcessImageFileNameW`. -func ProcessExecutableName(val string) attribute.KeyValue { - return ProcessExecutableNameKey.String(val) -} - -// ProcessExecutablePath returns an attribute KeyValue conforming to the -// "process.executable.path" semantic conventions. It represents the full path -// to the process executable. On Linux based systems, can be set to the target -// of `proc/[pid]/exe`. On Windows, can be set to the result of -// `GetProcessImageFileNameW`. -func ProcessExecutablePath(val string) attribute.KeyValue { - return ProcessExecutablePathKey.String(val) -} - -// ProcessCommand returns an attribute KeyValue conforming to the -// "process.command" semantic conventions. It represents the command used to -// launch the process (i.e. the command name). On Linux based systems, can be -// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to -// the first parameter extracted from `GetCommandLineW`. -func ProcessCommand(val string) attribute.KeyValue { - return ProcessCommandKey.String(val) -} - -// ProcessCommandLine returns an attribute KeyValue conforming to the -// "process.command_line" semantic conventions. It represents the full command -// used to launch the process as a single string representing the full command. -// On Windows, can be set to the result of `GetCommandLineW`. Do not set this -// if you have to assemble it just for monitoring; use `process.command_args` -// instead. -func ProcessCommandLine(val string) attribute.KeyValue { - return ProcessCommandLineKey.String(val) -} - -// ProcessCommandArgs returns an attribute KeyValue conforming to the -// "process.command_args" semantic conventions. It represents the all the -// command arguments (including the command/executable itself) as received by -// the process. On Linux-based systems (and some other Unixoid systems -// supporting procfs), can be set according to the list of null-delimited -// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, -// this would be the full argv vector passed to `main`. -func ProcessCommandArgs(val ...string) attribute.KeyValue { - return ProcessCommandArgsKey.StringSlice(val) -} - -// ProcessOwner returns an attribute KeyValue conforming to the -// "process.owner" semantic conventions. It represents the username of the user -// that owns the process. -func ProcessOwner(val string) attribute.KeyValue { - return ProcessOwnerKey.String(val) -} - -// The single (language) runtime instance which is monitored. -const ( - // ProcessRuntimeNameKey is the attribute Key conforming to the - // "process.runtime.name" semantic conventions. It represents the name of - // the runtime of this process. For compiled native binaries, this SHOULD - // be the name of the compiler. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'OpenJDK Runtime Environment' - ProcessRuntimeNameKey = attribute.Key("process.runtime.name") - - // ProcessRuntimeVersionKey is the attribute Key conforming to the - // "process.runtime.version" semantic conventions. It represents the - // version of the runtime of this process, as returned by the runtime - // without modification. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '14.0.2' - ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") - - // ProcessRuntimeDescriptionKey is the attribute Key conforming to the - // "process.runtime.description" semantic conventions. It represents an - // additional description about the runtime of the process, for example a - // specific vendor customization of the runtime environment. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' - ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") -) - -// ProcessRuntimeName returns an attribute KeyValue conforming to the -// "process.runtime.name" semantic conventions. It represents the name of the -// runtime of this process. For compiled native binaries, this SHOULD be the -// name of the compiler. -func ProcessRuntimeName(val string) attribute.KeyValue { - return ProcessRuntimeNameKey.String(val) -} - -// ProcessRuntimeVersion returns an attribute KeyValue conforming to the -// "process.runtime.version" semantic conventions. It represents the version of -// the runtime of this process, as returned by the runtime without -// modification. -func ProcessRuntimeVersion(val string) attribute.KeyValue { - return ProcessRuntimeVersionKey.String(val) -} - -// ProcessRuntimeDescription returns an attribute KeyValue conforming to the -// "process.runtime.description" semantic conventions. It represents an -// additional description about the runtime of the process, for example a -// specific vendor customization of the runtime environment. -func ProcessRuntimeDescription(val string) attribute.KeyValue { - return ProcessRuntimeDescriptionKey.String(val) -} - -// A service instance. -const ( - // ServiceNameKey is the attribute Key conforming to the "service.name" - // semantic conventions. It represents the logical name of the service. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'shoppingcart' - // Note: MUST be the same for all instances of horizontally scaled - // services. If the value was not specified, SDKs MUST fallback to - // `unknown_service:` concatenated with - // [`process.executable.name`](process.md#process), e.g. - // `unknown_service:bash`. If `process.executable.name` is not available, - // the value MUST be set to `unknown_service`. - ServiceNameKey = attribute.Key("service.name") -) - -// ServiceName returns an attribute KeyValue conforming to the -// "service.name" semantic conventions. It represents the logical name of the -// service. -func ServiceName(val string) attribute.KeyValue { - return ServiceNameKey.String(val) -} - -// A service instance. -const ( - // ServiceNamespaceKey is the attribute Key conforming to the - // "service.namespace" semantic conventions. It represents a namespace for - // `service.name`. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Shop' - // Note: A string value having a meaning that helps to distinguish a group - // of services, for example the team name that owns a group of services. - // `service.name` is expected to be unique within the same namespace. If - // `service.namespace` is not specified in the Resource then `service.name` - // is expected to be unique for all services that have no explicit - // namespace defined (so the empty/unspecified namespace is simply one more - // valid namespace). Zero-length namespace string is assumed equal to - // unspecified namespace. - ServiceNamespaceKey = attribute.Key("service.namespace") - - // ServiceInstanceIDKey is the attribute Key conforming to the - // "service.instance.id" semantic conventions. It represents the string ID - // of the service instance. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'my-k8s-pod-deployment-1', - // '627cc493-f310-47de-96bd-71410b7dec09' - // Note: MUST be unique for each instance of the same - // `service.namespace,service.name` pair (in other words - // `service.namespace,service.name,service.instance.id` triplet MUST be - // globally unique). The ID helps to distinguish instances of the same - // service that exist at the same time (e.g. instances of a horizontally - // scaled service). It is preferable for the ID to be persistent and stay - // the same for the lifetime of the service instance, however it is - // acceptable that the ID is ephemeral and changes during important - // lifetime events for the service (e.g. service restarts). If the service - // has no inherent unique ID that can be used as the value of this - // attribute it is recommended to generate a random Version 1 or Version 4 - // RFC 4122 UUID (services aiming for reproducible UUIDs may also use - // Version 5, see RFC 4122 for more recommendations). - ServiceInstanceIDKey = attribute.Key("service.instance.id") - - // ServiceVersionKey is the attribute Key conforming to the - // "service.version" semantic conventions. It represents the version string - // of the service API or implementation. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2.0.0' - ServiceVersionKey = attribute.Key("service.version") -) - -// ServiceNamespace returns an attribute KeyValue conforming to the -// "service.namespace" semantic conventions. It represents a namespace for -// `service.name`. -func ServiceNamespace(val string) attribute.KeyValue { - return ServiceNamespaceKey.String(val) -} - -// ServiceInstanceID returns an attribute KeyValue conforming to the -// "service.instance.id" semantic conventions. It represents the string ID of -// the service instance. -func ServiceInstanceID(val string) attribute.KeyValue { - return ServiceInstanceIDKey.String(val) -} - -// ServiceVersion returns an attribute KeyValue conforming to the -// "service.version" semantic conventions. It represents the version string of -// the service API or implementation. -func ServiceVersion(val string) attribute.KeyValue { - return ServiceVersionKey.String(val) -} - -// The telemetry SDK used to capture data recorded by the instrumentation -// libraries. -const ( - // TelemetrySDKNameKey is the attribute Key conforming to the - // "telemetry.sdk.name" semantic conventions. It represents the name of the - // telemetry SDK as defined above. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'opentelemetry' - TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") - - // TelemetrySDKLanguageKey is the attribute Key conforming to the - // "telemetry.sdk.language" semantic conventions. It represents the - // language of the telemetry SDK. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") - - // TelemetrySDKVersionKey is the attribute Key conforming to the - // "telemetry.sdk.version" semantic conventions. It represents the version - // string of the telemetry SDK. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: '1.2.3' - TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") -) - -var ( - // cpp - TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") - // dotnet - TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") - // erlang - TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") - // go - TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") - // java - TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") - // nodejs - TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") - // php - TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") - // python - TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") - // ruby - TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") - // webjs - TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") - // swift - TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") -) - -// TelemetrySDKName returns an attribute KeyValue conforming to the -// "telemetry.sdk.name" semantic conventions. It represents the name of the -// telemetry SDK as defined above. -func TelemetrySDKName(val string) attribute.KeyValue { - return TelemetrySDKNameKey.String(val) -} - -// TelemetrySDKVersion returns an attribute KeyValue conforming to the -// "telemetry.sdk.version" semantic conventions. It represents the version -// string of the telemetry SDK. -func TelemetrySDKVersion(val string) attribute.KeyValue { - return TelemetrySDKVersionKey.String(val) -} - -// The telemetry SDK used to capture data recorded by the instrumentation -// libraries. -const ( - // TelemetryAutoVersionKey is the attribute Key conforming to the - // "telemetry.auto.version" semantic conventions. It represents the version - // string of the auto instrumentation agent, if used. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.2.3' - TelemetryAutoVersionKey = attribute.Key("telemetry.auto.version") -) - -// TelemetryAutoVersion returns an attribute KeyValue conforming to the -// "telemetry.auto.version" semantic conventions. It represents the version -// string of the auto instrumentation agent, if used. -func TelemetryAutoVersion(val string) attribute.KeyValue { - return TelemetryAutoVersionKey.String(val) -} - -// Resource describing the packaged software running the application code. Web -// engines are typically executed using process.runtime. -const ( - // WebEngineNameKey is the attribute Key conforming to the "webengine.name" - // semantic conventions. It represents the name of the web engine. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'WildFly' - WebEngineNameKey = attribute.Key("webengine.name") - - // WebEngineVersionKey is the attribute Key conforming to the - // "webengine.version" semantic conventions. It represents the version of - // the web engine. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '21.0.0' - WebEngineVersionKey = attribute.Key("webengine.version") - - // WebEngineDescriptionKey is the attribute Key conforming to the - // "webengine.description" semantic conventions. It represents the - // additional description of the web engine (e.g. detailed version and - // edition information). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - - // 2.2.2.Final' - WebEngineDescriptionKey = attribute.Key("webengine.description") -) - -// WebEngineName returns an attribute KeyValue conforming to the -// "webengine.name" semantic conventions. It represents the name of the web -// engine. -func WebEngineName(val string) attribute.KeyValue { - return WebEngineNameKey.String(val) -} - -// WebEngineVersion returns an attribute KeyValue conforming to the -// "webengine.version" semantic conventions. It represents the version of the -// web engine. -func WebEngineVersion(val string) attribute.KeyValue { - return WebEngineVersionKey.String(val) -} - -// WebEngineDescription returns an attribute KeyValue conforming to the -// "webengine.description" semantic conventions. It represents the additional -// description of the web engine (e.g. detailed version and edition -// information). -func WebEngineDescription(val string) attribute.KeyValue { - return WebEngineDescriptionKey.String(val) -} - -// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's -// concepts. -const ( - // OTelScopeNameKey is the attribute Key conforming to the - // "otel.scope.name" semantic conventions. It represents the name of the - // instrumentation scope - (`InstrumentationScope.Name` in OTLP). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'io.opentelemetry.contrib.mongodb' - OTelScopeNameKey = attribute.Key("otel.scope.name") - - // OTelScopeVersionKey is the attribute Key conforming to the - // "otel.scope.version" semantic conventions. It represents the version of - // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.0.0' - OTelScopeVersionKey = attribute.Key("otel.scope.version") -) - -// OTelScopeName returns an attribute KeyValue conforming to the -// "otel.scope.name" semantic conventions. It represents the name of the -// instrumentation scope - (`InstrumentationScope.Name` in OTLP). -func OTelScopeName(val string) attribute.KeyValue { - return OTelScopeNameKey.String(val) -} - -// OTelScopeVersion returns an attribute KeyValue conforming to the -// "otel.scope.version" semantic conventions. It represents the version of the -// instrumentation scope - (`InstrumentationScope.Version` in OTLP). -func OTelScopeVersion(val string) attribute.KeyValue { - return OTelScopeVersionKey.String(val) -} - -// Span attributes used by non-OTLP exporters to represent OpenTelemetry -// Scope's concepts. -const ( - // OTelLibraryNameKey is the attribute Key conforming to the - // "otel.library.name" semantic conventions. It represents the deprecated, - // use the `otel.scope.name` attribute. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: 'io.opentelemetry.contrib.mongodb' - OTelLibraryNameKey = attribute.Key("otel.library.name") - - // OTelLibraryVersionKey is the attribute Key conforming to the - // "otel.library.version" semantic conventions. It represents the - // deprecated, use the `otel.scope.version` attribute. - // - // Type: string - // RequirementLevel: Optional - // Stability: deprecated - // Examples: '1.0.0' - OTelLibraryVersionKey = attribute.Key("otel.library.version") -) - -// OTelLibraryName returns an attribute KeyValue conforming to the -// "otel.library.name" semantic conventions. It represents the deprecated, use -// the `otel.scope.name` attribute. -func OTelLibraryName(val string) attribute.KeyValue { - return OTelLibraryNameKey.String(val) -} - -// OTelLibraryVersion returns an attribute KeyValue conforming to the -// "otel.library.version" semantic conventions. It represents the deprecated, -// use the `otel.scope.version` attribute. -func OTelLibraryVersion(val string) attribute.KeyValue { - return OTelLibraryVersionKey.String(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go deleted file mode 100644 index 95d0210e38..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/schema.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" - -// SchemaURL is the schema URL that matches the version of the semantic conventions -// that this package defines. Semconv packages starting from v1.4.0 must declare -// non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.20.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go b/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go deleted file mode 100644 index 90b1b0452c..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.20.0/trace.go +++ /dev/null @@ -1,2599 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.20.0" - -import "go.opentelemetry.io/otel/attribute" - -// The shared attributes used to report a single exception associated with a -// span or log. -const ( - // ExceptionTypeKey is the attribute Key conforming to the "exception.type" - // semantic conventions. It represents the type of the exception (its - // fully-qualified class name, if applicable). The dynamic type of the - // exception should be preferred over the static type in languages that - // support it. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'java.net.ConnectException', 'OSError' - ExceptionTypeKey = attribute.Key("exception.type") - - // ExceptionMessageKey is the attribute Key conforming to the - // "exception.message" semantic conventions. It represents the exception - // message. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Division by zero', "Can't convert 'int' object to str - // implicitly" - ExceptionMessageKey = attribute.Key("exception.message") - - // ExceptionStacktraceKey is the attribute Key conforming to the - // "exception.stacktrace" semantic conventions. It represents a stacktrace - // as a string in the natural representation for the language runtime. The - // representation is to be determined and documented by each language SIG. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test - // exception\\n at ' - // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' - // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' - // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' - ExceptionStacktraceKey = attribute.Key("exception.stacktrace") -) - -// ExceptionType returns an attribute KeyValue conforming to the -// "exception.type" semantic conventions. It represents the type of the -// exception (its fully-qualified class name, if applicable). The dynamic type -// of the exception should be preferred over the static type in languages that -// support it. -func ExceptionType(val string) attribute.KeyValue { - return ExceptionTypeKey.String(val) -} - -// ExceptionMessage returns an attribute KeyValue conforming to the -// "exception.message" semantic conventions. It represents the exception -// message. -func ExceptionMessage(val string) attribute.KeyValue { - return ExceptionMessageKey.String(val) -} - -// ExceptionStacktrace returns an attribute KeyValue conforming to the -// "exception.stacktrace" semantic conventions. It represents a stacktrace as a -// string in the natural representation for the language runtime. The -// representation is to be determined and documented by each language SIG. -func ExceptionStacktrace(val string) attribute.KeyValue { - return ExceptionStacktraceKey.String(val) -} - -// The attributes described in this section are rather generic. They may be -// used in any Log Record they apply to. -const ( - // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" - // semantic conventions. It represents a unique identifier for the Log - // Record. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' - // Note: If an id is provided, other log records with the same id will be - // considered duplicates and can be removed safely. This means, that two - // distinguishable log records MUST have different values. - // The id MAY be an [Universally Unique Lexicographically Sortable - // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers - // (e.g. UUID) may be used as needed. - LogRecordUIDKey = attribute.Key("log.record.uid") -) - -// LogRecordUID returns an attribute KeyValue conforming to the -// "log.record.uid" semantic conventions. It represents a unique identifier for -// the Log Record. -func LogRecordUID(val string) attribute.KeyValue { - return LogRecordUIDKey.String(val) -} - -// Span attributes used by AWS Lambda (in addition to general `faas` -// attributes). -const ( - // AWSLambdaInvokedARNKey is the attribute Key conforming to the - // "aws.lambda.invoked_arn" semantic conventions. It represents the full - // invoked ARN as provided on the `Context` passed to the function - // (`Lambda-Runtime-Invoked-Function-ARN` header on the - // `/runtime/invocation/next` applicable). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' - // Note: This may be different from `cloud.resource_id` if an alias is - // involved. - AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") -) - -// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the -// "aws.lambda.invoked_arn" semantic conventions. It represents the full -// invoked ARN as provided on the `Context` passed to the function -// (`Lambda-Runtime-Invoked-Function-ARN` header on the -// `/runtime/invocation/next` applicable). -func AWSLambdaInvokedARN(val string) attribute.KeyValue { - return AWSLambdaInvokedARNKey.String(val) -} - -// Attributes for CloudEvents. CloudEvents is a specification on how to define -// event data in a standard way. These attributes can be attached to spans when -// performing operations with CloudEvents, regardless of the protocol being -// used. -const ( - // CloudeventsEventIDKey is the attribute Key conforming to the - // "cloudevents.event_id" semantic conventions. It represents the - // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) - // uniquely identifies the event. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' - CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") - - // CloudeventsEventSourceKey is the attribute Key conforming to the - // "cloudevents.event_source" semantic conventions. It represents the - // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) - // identifies the context in which an event happened. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'https://github.com/cloudevents', - // '/cloudevents/spec/pull/123', 'my-service' - CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") - - // CloudeventsEventSpecVersionKey is the attribute Key conforming to the - // "cloudevents.event_spec_version" semantic conventions. It represents the - // [version of the CloudEvents - // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) - // which the event uses. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.0' - CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") - - // CloudeventsEventTypeKey is the attribute Key conforming to the - // "cloudevents.event_type" semantic conventions. It represents the - // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) - // contains a value describing the type of event related to the originating - // occurrence. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'com.github.pull_request.opened', - // 'com.example.object.deleted.v2' - CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") - - // CloudeventsEventSubjectKey is the attribute Key conforming to the - // "cloudevents.event_subject" semantic conventions. It represents the - // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) - // of the event in the context of the event producer (identified by - // source). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'mynewfile.jpg' - CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") -) - -// CloudeventsEventID returns an attribute KeyValue conforming to the -// "cloudevents.event_id" semantic conventions. It represents the -// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) -// uniquely identifies the event. -func CloudeventsEventID(val string) attribute.KeyValue { - return CloudeventsEventIDKey.String(val) -} - -// CloudeventsEventSource returns an attribute KeyValue conforming to the -// "cloudevents.event_source" semantic conventions. It represents the -// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) -// identifies the context in which an event happened. -func CloudeventsEventSource(val string) attribute.KeyValue { - return CloudeventsEventSourceKey.String(val) -} - -// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to -// the "cloudevents.event_spec_version" semantic conventions. It represents the -// [version of the CloudEvents -// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) -// which the event uses. -func CloudeventsEventSpecVersion(val string) attribute.KeyValue { - return CloudeventsEventSpecVersionKey.String(val) -} - -// CloudeventsEventType returns an attribute KeyValue conforming to the -// "cloudevents.event_type" semantic conventions. It represents the -// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) -// contains a value describing the type of event related to the originating -// occurrence. -func CloudeventsEventType(val string) attribute.KeyValue { - return CloudeventsEventTypeKey.String(val) -} - -// CloudeventsEventSubject returns an attribute KeyValue conforming to the -// "cloudevents.event_subject" semantic conventions. It represents the -// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) -// of the event in the context of the event producer (identified by source). -func CloudeventsEventSubject(val string) attribute.KeyValue { - return CloudeventsEventSubjectKey.String(val) -} - -// Semantic conventions for the OpenTracing Shim -const ( - // OpentracingRefTypeKey is the attribute Key conforming to the - // "opentracing.ref_type" semantic conventions. It represents the - // parent-child Reference type - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Note: The causal relationship between a child Span and a parent Span. - OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") -) - -var ( - // The parent Span depends on the child Span in some capacity - OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") - // The parent Span does not depend in any way on the result of the child Span - OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") -) - -// The attributes used to perform database client calls. -const ( - // DBSystemKey is the attribute Key conforming to the "db.system" semantic - // conventions. It represents an identifier for the database management - // system (DBMS) product being used. See below for a list of well-known - // identifiers. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - DBSystemKey = attribute.Key("db.system") - - // DBConnectionStringKey is the attribute Key conforming to the - // "db.connection_string" semantic conventions. It represents the - // connection string used to connect to the database. It is recommended to - // remove embedded credentials. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Server=(localdb)\\v11.0;Integrated Security=true;' - DBConnectionStringKey = attribute.Key("db.connection_string") - - // DBUserKey is the attribute Key conforming to the "db.user" semantic - // conventions. It represents the username for accessing the database. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'readonly_user', 'reporting_user' - DBUserKey = attribute.Key("db.user") - - // DBJDBCDriverClassnameKey is the attribute Key conforming to the - // "db.jdbc.driver_classname" semantic conventions. It represents the - // fully-qualified class name of the [Java Database Connectivity - // (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) - // driver used to connect. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'org.postgresql.Driver', - // 'com.microsoft.sqlserver.jdbc.SQLServerDriver' - DBJDBCDriverClassnameKey = attribute.Key("db.jdbc.driver_classname") - - // DBNameKey is the attribute Key conforming to the "db.name" semantic - // conventions. It represents the this attribute is used to report the name - // of the database being accessed. For commands that switch the database, - // this should be set to the target database (even if the command fails). - // - // Type: string - // RequirementLevel: ConditionallyRequired (If applicable.) - // Stability: stable - // Examples: 'customers', 'main' - // Note: In some SQL databases, the database name to be used is called - // "schema name". In case there are multiple layers that could be - // considered for database name (e.g. Oracle instance name and schema - // name), the database name to be used is the more specific layer (e.g. - // Oracle schema name). - DBNameKey = attribute.Key("db.name") - - // DBStatementKey is the attribute Key conforming to the "db.statement" - // semantic conventions. It represents the database statement being - // executed. - // - // Type: string - // RequirementLevel: Recommended (Should be collected by default only if - // there is sanitization that excludes sensitive information.) - // Stability: stable - // Examples: 'SELECT * FROM wuser_table', 'SET mykey "WuValue"' - DBStatementKey = attribute.Key("db.statement") - - // DBOperationKey is the attribute Key conforming to the "db.operation" - // semantic conventions. It represents the name of the operation being - // executed, e.g. the [MongoDB command - // name](https://docs.mongodb.com/manual/reference/command/#database-operations) - // such as `findAndModify`, or the SQL keyword. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If `db.statement` is not - // applicable.) - // Stability: stable - // Examples: 'findAndModify', 'HMSET', 'SELECT' - // Note: When setting this to an SQL keyword, it is not recommended to - // attempt any client-side parsing of `db.statement` just to get this - // property, but it should be set if the operation name is provided by the - // library being instrumented. If the SQL statement has an ambiguous - // operation, or performs more than one operation, this value may be - // omitted. - DBOperationKey = attribute.Key("db.operation") -) - -var ( - // Some other SQL database. Fallback only. See notes - DBSystemOtherSQL = DBSystemKey.String("other_sql") - // Microsoft SQL Server - DBSystemMSSQL = DBSystemKey.String("mssql") - // Microsoft SQL Server Compact - DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") - // MySQL - DBSystemMySQL = DBSystemKey.String("mysql") - // Oracle Database - DBSystemOracle = DBSystemKey.String("oracle") - // IBM DB2 - DBSystemDB2 = DBSystemKey.String("db2") - // PostgreSQL - DBSystemPostgreSQL = DBSystemKey.String("postgresql") - // Amazon Redshift - DBSystemRedshift = DBSystemKey.String("redshift") - // Apache Hive - DBSystemHive = DBSystemKey.String("hive") - // Cloudscape - DBSystemCloudscape = DBSystemKey.String("cloudscape") - // HyperSQL DataBase - DBSystemHSQLDB = DBSystemKey.String("hsqldb") - // Progress Database - DBSystemProgress = DBSystemKey.String("progress") - // SAP MaxDB - DBSystemMaxDB = DBSystemKey.String("maxdb") - // SAP HANA - DBSystemHanaDB = DBSystemKey.String("hanadb") - // Ingres - DBSystemIngres = DBSystemKey.String("ingres") - // FirstSQL - DBSystemFirstSQL = DBSystemKey.String("firstsql") - // EnterpriseDB - DBSystemEDB = DBSystemKey.String("edb") - // InterSystems Caché - DBSystemCache = DBSystemKey.String("cache") - // Adabas (Adaptable Database System) - DBSystemAdabas = DBSystemKey.String("adabas") - // Firebird - DBSystemFirebird = DBSystemKey.String("firebird") - // Apache Derby - DBSystemDerby = DBSystemKey.String("derby") - // FileMaker - DBSystemFilemaker = DBSystemKey.String("filemaker") - // Informix - DBSystemInformix = DBSystemKey.String("informix") - // InstantDB - DBSystemInstantDB = DBSystemKey.String("instantdb") - // InterBase - DBSystemInterbase = DBSystemKey.String("interbase") - // MariaDB - DBSystemMariaDB = DBSystemKey.String("mariadb") - // Netezza - DBSystemNetezza = DBSystemKey.String("netezza") - // Pervasive PSQL - DBSystemPervasive = DBSystemKey.String("pervasive") - // PointBase - DBSystemPointbase = DBSystemKey.String("pointbase") - // SQLite - DBSystemSqlite = DBSystemKey.String("sqlite") - // Sybase - DBSystemSybase = DBSystemKey.String("sybase") - // Teradata - DBSystemTeradata = DBSystemKey.String("teradata") - // Vertica - DBSystemVertica = DBSystemKey.String("vertica") - // H2 - DBSystemH2 = DBSystemKey.String("h2") - // ColdFusion IMQ - DBSystemColdfusion = DBSystemKey.String("coldfusion") - // Apache Cassandra - DBSystemCassandra = DBSystemKey.String("cassandra") - // Apache HBase - DBSystemHBase = DBSystemKey.String("hbase") - // MongoDB - DBSystemMongoDB = DBSystemKey.String("mongodb") - // Redis - DBSystemRedis = DBSystemKey.String("redis") - // Couchbase - DBSystemCouchbase = DBSystemKey.String("couchbase") - // CouchDB - DBSystemCouchDB = DBSystemKey.String("couchdb") - // Microsoft Azure Cosmos DB - DBSystemCosmosDB = DBSystemKey.String("cosmosdb") - // Amazon DynamoDB - DBSystemDynamoDB = DBSystemKey.String("dynamodb") - // Neo4j - DBSystemNeo4j = DBSystemKey.String("neo4j") - // Apache Geode - DBSystemGeode = DBSystemKey.String("geode") - // Elasticsearch - DBSystemElasticsearch = DBSystemKey.String("elasticsearch") - // Memcached - DBSystemMemcached = DBSystemKey.String("memcached") - // CockroachDB - DBSystemCockroachdb = DBSystemKey.String("cockroachdb") - // OpenSearch - DBSystemOpensearch = DBSystemKey.String("opensearch") - // ClickHouse - DBSystemClickhouse = DBSystemKey.String("clickhouse") - // Cloud Spanner - DBSystemSpanner = DBSystemKey.String("spanner") - // Trino - DBSystemTrino = DBSystemKey.String("trino") -) - -// DBConnectionString returns an attribute KeyValue conforming to the -// "db.connection_string" semantic conventions. It represents the connection -// string used to connect to the database. It is recommended to remove embedded -// credentials. -func DBConnectionString(val string) attribute.KeyValue { - return DBConnectionStringKey.String(val) -} - -// DBUser returns an attribute KeyValue conforming to the "db.user" semantic -// conventions. It represents the username for accessing the database. -func DBUser(val string) attribute.KeyValue { - return DBUserKey.String(val) -} - -// DBJDBCDriverClassname returns an attribute KeyValue conforming to the -// "db.jdbc.driver_classname" semantic conventions. It represents the -// fully-qualified class name of the [Java Database Connectivity -// (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver -// used to connect. -func DBJDBCDriverClassname(val string) attribute.KeyValue { - return DBJDBCDriverClassnameKey.String(val) -} - -// DBName returns an attribute KeyValue conforming to the "db.name" semantic -// conventions. It represents the this attribute is used to report the name of -// the database being accessed. For commands that switch the database, this -// should be set to the target database (even if the command fails). -func DBName(val string) attribute.KeyValue { - return DBNameKey.String(val) -} - -// DBStatement returns an attribute KeyValue conforming to the -// "db.statement" semantic conventions. It represents the database statement -// being executed. -func DBStatement(val string) attribute.KeyValue { - return DBStatementKey.String(val) -} - -// DBOperation returns an attribute KeyValue conforming to the -// "db.operation" semantic conventions. It represents the name of the operation -// being executed, e.g. the [MongoDB command -// name](https://docs.mongodb.com/manual/reference/command/#database-operations) -// such as `findAndModify`, or the SQL keyword. -func DBOperation(val string) attribute.KeyValue { - return DBOperationKey.String(val) -} - -// Connection-level attributes for Microsoft SQL Server -const ( - // DBMSSQLInstanceNameKey is the attribute Key conforming to the - // "db.mssql.instance_name" semantic conventions. It represents the - // Microsoft SQL Server [instance - // name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) - // connecting to. This name is used to determine the port of a named - // instance. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'MSSQLSERVER' - // Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no - // longer required (but still recommended if non-standard). - DBMSSQLInstanceNameKey = attribute.Key("db.mssql.instance_name") -) - -// DBMSSQLInstanceName returns an attribute KeyValue conforming to the -// "db.mssql.instance_name" semantic conventions. It represents the Microsoft -// SQL Server [instance -// name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) -// connecting to. This name is used to determine the port of a named instance. -func DBMSSQLInstanceName(val string) attribute.KeyValue { - return DBMSSQLInstanceNameKey.String(val) -} - -// Call-level attributes for Cassandra -const ( - // DBCassandraPageSizeKey is the attribute Key conforming to the - // "db.cassandra.page_size" semantic conventions. It represents the fetch - // size used for paging, i.e. how many rows will be returned at once. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 5000 - DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") - - // DBCassandraConsistencyLevelKey is the attribute Key conforming to the - // "db.cassandra.consistency_level" semantic conventions. It represents the - // consistency level of the query. Based on consistency values from - // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") - - // DBCassandraTableKey is the attribute Key conforming to the - // "db.cassandra.table" semantic conventions. It represents the name of the - // primary table that the operation is acting upon, including the keyspace - // name (if applicable). - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'mytable' - // Note: This mirrors the db.sql.table attribute but references cassandra - // rather than sql. It is not recommended to attempt any client-side - // parsing of `db.statement` just to get this property, but it should be - // set if it is provided by the library being instrumented. If the - // operation is acting upon an anonymous table, or more than one table, - // this value MUST NOT be set. - DBCassandraTableKey = attribute.Key("db.cassandra.table") - - // DBCassandraIdempotenceKey is the attribute Key conforming to the - // "db.cassandra.idempotence" semantic conventions. It represents the - // whether or not the query is idempotent. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") - - // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming - // to the "db.cassandra.speculative_execution_count" semantic conventions. - // It represents the number of times a query was speculatively executed. - // Not set or `0` if the query was not executed speculatively. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 0, 2 - DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") - - // DBCassandraCoordinatorIDKey is the attribute Key conforming to the - // "db.cassandra.coordinator.id" semantic conventions. It represents the ID - // of the coordinating node for a query. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' - DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") - - // DBCassandraCoordinatorDCKey is the attribute Key conforming to the - // "db.cassandra.coordinator.dc" semantic conventions. It represents the - // data center of the coordinating node for a query. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'us-west-2' - DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") -) - -var ( - // all - DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") - // each_quorum - DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") - // quorum - DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") - // local_quorum - DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") - // one - DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") - // two - DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") - // three - DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") - // local_one - DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") - // any - DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") - // serial - DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") - // local_serial - DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") -) - -// DBCassandraPageSize returns an attribute KeyValue conforming to the -// "db.cassandra.page_size" semantic conventions. It represents the fetch size -// used for paging, i.e. how many rows will be returned at once. -func DBCassandraPageSize(val int) attribute.KeyValue { - return DBCassandraPageSizeKey.Int(val) -} - -// DBCassandraTable returns an attribute KeyValue conforming to the -// "db.cassandra.table" semantic conventions. It represents the name of the -// primary table that the operation is acting upon, including the keyspace name -// (if applicable). -func DBCassandraTable(val string) attribute.KeyValue { - return DBCassandraTableKey.String(val) -} - -// DBCassandraIdempotence returns an attribute KeyValue conforming to the -// "db.cassandra.idempotence" semantic conventions. It represents the whether -// or not the query is idempotent. -func DBCassandraIdempotence(val bool) attribute.KeyValue { - return DBCassandraIdempotenceKey.Bool(val) -} - -// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue -// conforming to the "db.cassandra.speculative_execution_count" semantic -// conventions. It represents the number of times a query was speculatively -// executed. Not set or `0` if the query was not executed speculatively. -func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { - return DBCassandraSpeculativeExecutionCountKey.Int(val) -} - -// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the -// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of -// the coordinating node for a query. -func DBCassandraCoordinatorID(val string) attribute.KeyValue { - return DBCassandraCoordinatorIDKey.String(val) -} - -// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the -// "db.cassandra.coordinator.dc" semantic conventions. It represents the data -// center of the coordinating node for a query. -func DBCassandraCoordinatorDC(val string) attribute.KeyValue { - return DBCassandraCoordinatorDCKey.String(val) -} - -// Call-level attributes for Redis -const ( - // DBRedisDBIndexKey is the attribute Key conforming to the - // "db.redis.database_index" semantic conventions. It represents the index - // of the database being accessed as used in the [`SELECT` - // command](https://redis.io/commands/select), provided as an integer. To - // be used instead of the generic `db.name` attribute. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If other than the default - // database (`0`).) - // Stability: stable - // Examples: 0, 1, 15 - DBRedisDBIndexKey = attribute.Key("db.redis.database_index") -) - -// DBRedisDBIndex returns an attribute KeyValue conforming to the -// "db.redis.database_index" semantic conventions. It represents the index of -// the database being accessed as used in the [`SELECT` -// command](https://redis.io/commands/select), provided as an integer. To be -// used instead of the generic `db.name` attribute. -func DBRedisDBIndex(val int) attribute.KeyValue { - return DBRedisDBIndexKey.Int(val) -} - -// Call-level attributes for MongoDB -const ( - // DBMongoDBCollectionKey is the attribute Key conforming to the - // "db.mongodb.collection" semantic conventions. It represents the - // collection being accessed within the database stated in `db.name`. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'customers', 'products' - DBMongoDBCollectionKey = attribute.Key("db.mongodb.collection") -) - -// DBMongoDBCollection returns an attribute KeyValue conforming to the -// "db.mongodb.collection" semantic conventions. It represents the collection -// being accessed within the database stated in `db.name`. -func DBMongoDBCollection(val string) attribute.KeyValue { - return DBMongoDBCollectionKey.String(val) -} - -// Call-level attributes for SQL databases -const ( - // DBSQLTableKey is the attribute Key conforming to the "db.sql.table" - // semantic conventions. It represents the name of the primary table that - // the operation is acting upon, including the database name (if - // applicable). - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'public.users', 'customers' - // Note: It is not recommended to attempt any client-side parsing of - // `db.statement` just to get this property, but it should be set if it is - // provided by the library being instrumented. If the operation is acting - // upon an anonymous table, or more than one table, this value MUST NOT be - // set. - DBSQLTableKey = attribute.Key("db.sql.table") -) - -// DBSQLTable returns an attribute KeyValue conforming to the "db.sql.table" -// semantic conventions. It represents the name of the primary table that the -// operation is acting upon, including the database name (if applicable). -func DBSQLTable(val string) attribute.KeyValue { - return DBSQLTableKey.String(val) -} - -// Call-level attributes for Cosmos DB. -const ( - // DBCosmosDBClientIDKey is the attribute Key conforming to the - // "db.cosmosdb.client_id" semantic conventions. It represents the unique - // Cosmos client instance id. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' - DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") - - // DBCosmosDBOperationTypeKey is the attribute Key conforming to the - // "db.cosmosdb.operation_type" semantic conventions. It represents the - // cosmosDB Operation Type. - // - // Type: Enum - // RequirementLevel: ConditionallyRequired (when performing one of the - // operations in this list) - // Stability: stable - DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") - - // DBCosmosDBConnectionModeKey is the attribute Key conforming to the - // "db.cosmosdb.connection_mode" semantic conventions. It represents the - // cosmos client connection mode. - // - // Type: Enum - // RequirementLevel: ConditionallyRequired (if not `direct` (or pick gw as - // default)) - // Stability: stable - DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") - - // DBCosmosDBContainerKey is the attribute Key conforming to the - // "db.cosmosdb.container" semantic conventions. It represents the cosmos - // DB container name. - // - // Type: string - // RequirementLevel: ConditionallyRequired (if available) - // Stability: stable - // Examples: 'anystring' - DBCosmosDBContainerKey = attribute.Key("db.cosmosdb.container") - - // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the - // "db.cosmosdb.request_content_length" semantic conventions. It represents - // the request payload size in bytes - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") - - // DBCosmosDBStatusCodeKey is the attribute Key conforming to the - // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos - // DB status code. - // - // Type: int - // RequirementLevel: ConditionallyRequired (if response was received) - // Stability: stable - // Examples: 200, 201 - DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") - - // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the - // "db.cosmosdb.sub_status_code" semantic conventions. It represents the - // cosmos DB sub status code. - // - // Type: int - // RequirementLevel: ConditionallyRequired (when response was received and - // contained sub-code.) - // Stability: stable - // Examples: 1000, 1002 - DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") - - // DBCosmosDBRequestChargeKey is the attribute Key conforming to the - // "db.cosmosdb.request_charge" semantic conventions. It represents the rU - // consumed for that operation - // - // Type: double - // RequirementLevel: ConditionallyRequired (when available) - // Stability: stable - // Examples: 46.18, 1.0 - DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") -) - -var ( - // invalid - DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") - // create - DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") - // patch - DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") - // read - DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") - // read_feed - DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") - // delete - DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") - // replace - DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") - // execute - DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") - // query - DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") - // head - DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") - // head_feed - DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") - // upsert - DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") - // batch - DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") - // query_plan - DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") - // execute_javascript - DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") -) - -var ( - // Gateway (HTTP) connections mode - DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") - // Direct connection - DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") -) - -// DBCosmosDBClientID returns an attribute KeyValue conforming to the -// "db.cosmosdb.client_id" semantic conventions. It represents the unique -// Cosmos client instance id. -func DBCosmosDBClientID(val string) attribute.KeyValue { - return DBCosmosDBClientIDKey.String(val) -} - -// DBCosmosDBContainer returns an attribute KeyValue conforming to the -// "db.cosmosdb.container" semantic conventions. It represents the cosmos DB -// container name. -func DBCosmosDBContainer(val string) attribute.KeyValue { - return DBCosmosDBContainerKey.String(val) -} - -// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming -// to the "db.cosmosdb.request_content_length" semantic conventions. It -// represents the request payload size in bytes -func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { - return DBCosmosDBRequestContentLengthKey.Int(val) -} - -// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the -// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB -// status code. -func DBCosmosDBStatusCode(val int) attribute.KeyValue { - return DBCosmosDBStatusCodeKey.Int(val) -} - -// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the -// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos -// DB sub status code. -func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { - return DBCosmosDBSubStatusCodeKey.Int(val) -} - -// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the -// "db.cosmosdb.request_charge" semantic conventions. It represents the rU -// consumed for that operation -func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { - return DBCosmosDBRequestChargeKey.Float64(val) -} - -// Span attributes used by non-OTLP exporters to represent OpenTelemetry Span's -// concepts. -const ( - // OTelStatusCodeKey is the attribute Key conforming to the - // "otel.status_code" semantic conventions. It represents the name of the - // code, either "OK" or "ERROR". MUST NOT be set if the status code is - // UNSET. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - OTelStatusCodeKey = attribute.Key("otel.status_code") - - // OTelStatusDescriptionKey is the attribute Key conforming to the - // "otel.status_description" semantic conventions. It represents the - // description of the Status if it has a value, otherwise not set. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'resource not found' - OTelStatusDescriptionKey = attribute.Key("otel.status_description") -) - -var ( - // The operation has been validated by an Application developer or Operator to have completed successfully - OTelStatusCodeOk = OTelStatusCodeKey.String("OK") - // The operation contains an error - OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") -) - -// OTelStatusDescription returns an attribute KeyValue conforming to the -// "otel.status_description" semantic conventions. It represents the -// description of the Status if it has a value, otherwise not set. -func OTelStatusDescription(val string) attribute.KeyValue { - return OTelStatusDescriptionKey.String(val) -} - -// This semantic convention describes an instance of a function that runs -// without provisioning or managing of servers (also known as serverless -// functions or Function as a Service (FaaS)) with spans. -const ( - // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" - // semantic conventions. It represents the type of the trigger which caused - // this function invocation. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Note: For the server/consumer span on the incoming side, - // `faas.trigger` MUST be set. - // - // Clients invoking FaaS instances usually cannot set `faas.trigger`, - // since they would typically need to look in the payload to determine - // the event type. If clients set it, it should be the same as the - // trigger that corresponding incoming would have (i.e., this has - // nothing to do with the underlying transport used to make the API - // call to invoke the lambda, which is often HTTP). - FaaSTriggerKey = attribute.Key("faas.trigger") - - // FaaSInvocationIDKey is the attribute Key conforming to the - // "faas.invocation_id" semantic conventions. It represents the invocation - // ID of the current function invocation. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' - FaaSInvocationIDKey = attribute.Key("faas.invocation_id") -) - -var ( - // A response to some data source operation such as a database or filesystem read/write - FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") - // To provide an answer to an inbound HTTP request - FaaSTriggerHTTP = FaaSTriggerKey.String("http") - // A function is set to be executed when messages are sent to a messaging system - FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") - // A function is scheduled to be executed regularly - FaaSTriggerTimer = FaaSTriggerKey.String("timer") - // If none of the others apply - FaaSTriggerOther = FaaSTriggerKey.String("other") -) - -// FaaSInvocationID returns an attribute KeyValue conforming to the -// "faas.invocation_id" semantic conventions. It represents the invocation ID -// of the current function invocation. -func FaaSInvocationID(val string) attribute.KeyValue { - return FaaSInvocationIDKey.String(val) -} - -// Semantic Convention for FaaS triggered as a response to some data source -// operation such as a database or filesystem read/write. -const ( - // FaaSDocumentCollectionKey is the attribute Key conforming to the - // "faas.document.collection" semantic conventions. It represents the name - // of the source on which the triggering operation was performed. For - // example, in Cloud Storage or S3 corresponds to the bucket name, and in - // Cosmos DB to the database name. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'myBucketName', 'myDBName' - FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") - - // FaaSDocumentOperationKey is the attribute Key conforming to the - // "faas.document.operation" semantic conventions. It represents the - // describes the type of the operation that was performed on the data. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - FaaSDocumentOperationKey = attribute.Key("faas.document.operation") - - // FaaSDocumentTimeKey is the attribute Key conforming to the - // "faas.document.time" semantic conventions. It represents a string - // containing the time when the data was accessed in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format - // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2020-01-23T13:47:06Z' - FaaSDocumentTimeKey = attribute.Key("faas.document.time") - - // FaaSDocumentNameKey is the attribute Key conforming to the - // "faas.document.name" semantic conventions. It represents the document - // name/table subjected to the operation. For example, in Cloud Storage or - // S3 is the name of the file, and in Cosmos DB the table name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'myFile.txt', 'myTableName' - FaaSDocumentNameKey = attribute.Key("faas.document.name") -) - -var ( - // When a new object is created - FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") - // When an object is modified - FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") - // When an object is deleted - FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") -) - -// FaaSDocumentCollection returns an attribute KeyValue conforming to the -// "faas.document.collection" semantic conventions. It represents the name of -// the source on which the triggering operation was performed. For example, in -// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the -// database name. -func FaaSDocumentCollection(val string) attribute.KeyValue { - return FaaSDocumentCollectionKey.String(val) -} - -// FaaSDocumentTime returns an attribute KeyValue conforming to the -// "faas.document.time" semantic conventions. It represents a string containing -// the time when the data was accessed in the [ISO -// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format -// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). -func FaaSDocumentTime(val string) attribute.KeyValue { - return FaaSDocumentTimeKey.String(val) -} - -// FaaSDocumentName returns an attribute KeyValue conforming to the -// "faas.document.name" semantic conventions. It represents the document -// name/table subjected to the operation. For example, in Cloud Storage or S3 -// is the name of the file, and in Cosmos DB the table name. -func FaaSDocumentName(val string) attribute.KeyValue { - return FaaSDocumentNameKey.String(val) -} - -// Semantic Convention for FaaS scheduled to be executed regularly. -const ( - // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic - // conventions. It represents a string containing the function invocation - // time in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format - // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2020-01-23T13:47:06Z' - FaaSTimeKey = attribute.Key("faas.time") - - // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic - // conventions. It represents a string containing the schedule period as - // [Cron - // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '0/5 * * * ? *' - FaaSCronKey = attribute.Key("faas.cron") -) - -// FaaSTime returns an attribute KeyValue conforming to the "faas.time" -// semantic conventions. It represents a string containing the function -// invocation time in the [ISO -// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format -// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). -func FaaSTime(val string) attribute.KeyValue { - return FaaSTimeKey.String(val) -} - -// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" -// semantic conventions. It represents a string containing the schedule period -// as [Cron -// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). -func FaaSCron(val string) attribute.KeyValue { - return FaaSCronKey.String(val) -} - -// Contains additional attributes for incoming FaaS spans. -const ( - // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" - // semantic conventions. It represents a boolean that is true if the - // serverless function is executed for the first time (aka cold-start). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - FaaSColdstartKey = attribute.Key("faas.coldstart") -) - -// FaaSColdstart returns an attribute KeyValue conforming to the -// "faas.coldstart" semantic conventions. It represents a boolean that is true -// if the serverless function is executed for the first time (aka cold-start). -func FaaSColdstart(val bool) attribute.KeyValue { - return FaaSColdstartKey.Bool(val) -} - -// Contains additional attributes for outgoing FaaS spans. -const ( - // FaaSInvokedNameKey is the attribute Key conforming to the - // "faas.invoked_name" semantic conventions. It represents the name of the - // invoked function. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'my-function' - // Note: SHOULD be equal to the `faas.name` resource attribute of the - // invoked function. - FaaSInvokedNameKey = attribute.Key("faas.invoked_name") - - // FaaSInvokedProviderKey is the attribute Key conforming to the - // "faas.invoked_provider" semantic conventions. It represents the cloud - // provider of the invoked function. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Note: SHOULD be equal to the `cloud.provider` resource attribute of the - // invoked function. - FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") - - // FaaSInvokedRegionKey is the attribute Key conforming to the - // "faas.invoked_region" semantic conventions. It represents the cloud - // region of the invoked function. - // - // Type: string - // RequirementLevel: ConditionallyRequired (For some cloud providers, like - // AWS or GCP, the region in which a function is hosted is essential to - // uniquely identify the function and also part of its endpoint. Since it's - // part of the endpoint being called, the region is always known to - // clients. In these cases, `faas.invoked_region` MUST be set accordingly. - // If the region is unknown to the client or not required for identifying - // the invoked function, setting `faas.invoked_region` is optional.) - // Stability: stable - // Examples: 'eu-central-1' - // Note: SHOULD be equal to the `cloud.region` resource attribute of the - // invoked function. - FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") -) - -var ( - // Alibaba Cloud - FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") - // Amazon Web Services - FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") - // Microsoft Azure - FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") - // Google Cloud Platform - FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") - // Tencent Cloud - FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") -) - -// FaaSInvokedName returns an attribute KeyValue conforming to the -// "faas.invoked_name" semantic conventions. It represents the name of the -// invoked function. -func FaaSInvokedName(val string) attribute.KeyValue { - return FaaSInvokedNameKey.String(val) -} - -// FaaSInvokedRegion returns an attribute KeyValue conforming to the -// "faas.invoked_region" semantic conventions. It represents the cloud region -// of the invoked function. -func FaaSInvokedRegion(val string) attribute.KeyValue { - return FaaSInvokedRegionKey.String(val) -} - -// Operations that access some remote service. -const ( - // PeerServiceKey is the attribute Key conforming to the "peer.service" - // semantic conventions. It represents the - // [`service.name`](../../resource/semantic_conventions/README.md#service) - // of the remote service. SHOULD be equal to the actual `service.name` - // resource attribute of the remote service if any. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'AuthTokenCache' - PeerServiceKey = attribute.Key("peer.service") -) - -// PeerService returns an attribute KeyValue conforming to the -// "peer.service" semantic conventions. It represents the -// [`service.name`](../../resource/semantic_conventions/README.md#service) of -// the remote service. SHOULD be equal to the actual `service.name` resource -// attribute of the remote service if any. -func PeerService(val string) attribute.KeyValue { - return PeerServiceKey.String(val) -} - -// These attributes may be used for any operation with an authenticated and/or -// authorized enduser. -const ( - // EnduserIDKey is the attribute Key conforming to the "enduser.id" - // semantic conventions. It represents the username or client_id extracted - // from the access token or - // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header - // in the inbound request from outside the system. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'username' - EnduserIDKey = attribute.Key("enduser.id") - - // EnduserRoleKey is the attribute Key conforming to the "enduser.role" - // semantic conventions. It represents the actual/assumed role the client - // is making the request under extracted from token or application security - // context. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'admin' - EnduserRoleKey = attribute.Key("enduser.role") - - // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" - // semantic conventions. It represents the scopes or granted authorities - // the client currently possesses extracted from token or application - // security context. The value would come from the scope associated with an - // [OAuth 2.0 Access - // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute - // value in a [SAML 2.0 - // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'read:message, write:files' - EnduserScopeKey = attribute.Key("enduser.scope") -) - -// EnduserID returns an attribute KeyValue conforming to the "enduser.id" -// semantic conventions. It represents the username or client_id extracted from -// the access token or -// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in -// the inbound request from outside the system. -func EnduserID(val string) attribute.KeyValue { - return EnduserIDKey.String(val) -} - -// EnduserRole returns an attribute KeyValue conforming to the -// "enduser.role" semantic conventions. It represents the actual/assumed role -// the client is making the request under extracted from token or application -// security context. -func EnduserRole(val string) attribute.KeyValue { - return EnduserRoleKey.String(val) -} - -// EnduserScope returns an attribute KeyValue conforming to the -// "enduser.scope" semantic conventions. It represents the scopes or granted -// authorities the client currently possesses extracted from token or -// application security context. The value would come from the scope associated -// with an [OAuth 2.0 Access -// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute -// value in a [SAML 2.0 -// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). -func EnduserScope(val string) attribute.KeyValue { - return EnduserScopeKey.String(val) -} - -// These attributes may be used for any operation to store information about a -// thread that started a span. -const ( - // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic - // conventions. It represents the current "managed" thread ID (as opposed - // to OS thread ID). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 42 - ThreadIDKey = attribute.Key("thread.id") - - // ThreadNameKey is the attribute Key conforming to the "thread.name" - // semantic conventions. It represents the current thread name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'main' - ThreadNameKey = attribute.Key("thread.name") -) - -// ThreadID returns an attribute KeyValue conforming to the "thread.id" -// semantic conventions. It represents the current "managed" thread ID (as -// opposed to OS thread ID). -func ThreadID(val int) attribute.KeyValue { - return ThreadIDKey.Int(val) -} - -// ThreadName returns an attribute KeyValue conforming to the "thread.name" -// semantic conventions. It represents the current thread name. -func ThreadName(val string) attribute.KeyValue { - return ThreadNameKey.String(val) -} - -// These attributes allow to report this unit of code and therefore to provide -// more context about the span. -const ( - // CodeFunctionKey is the attribute Key conforming to the "code.function" - // semantic conventions. It represents the method or function name, or - // equivalent (usually rightmost part of the code unit's name). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'serveRequest' - CodeFunctionKey = attribute.Key("code.function") - - // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" - // semantic conventions. It represents the "namespace" within which - // `code.function` is defined. Usually the qualified class or module name, - // such that `code.namespace` + some separator + `code.function` form a - // unique identifier for the code unit. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'com.example.MyHTTPService' - CodeNamespaceKey = attribute.Key("code.namespace") - - // CodeFilepathKey is the attribute Key conforming to the "code.filepath" - // semantic conventions. It represents the source code file name that - // identifies the code unit as uniquely as possible (preferably an absolute - // file path). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/usr/local/MyApplication/content_root/app/index.php' - CodeFilepathKey = attribute.Key("code.filepath") - - // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" - // semantic conventions. It represents the line number in `code.filepath` - // best representing the operation. It SHOULD point within the code unit - // named in `code.function`. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 42 - CodeLineNumberKey = attribute.Key("code.lineno") - - // CodeColumnKey is the attribute Key conforming to the "code.column" - // semantic conventions. It represents the column number in `code.filepath` - // best representing the operation. It SHOULD point within the code unit - // named in `code.function`. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 16 - CodeColumnKey = attribute.Key("code.column") -) - -// CodeFunction returns an attribute KeyValue conforming to the -// "code.function" semantic conventions. It represents the method or function -// name, or equivalent (usually rightmost part of the code unit's name). -func CodeFunction(val string) attribute.KeyValue { - return CodeFunctionKey.String(val) -} - -// CodeNamespace returns an attribute KeyValue conforming to the -// "code.namespace" semantic conventions. It represents the "namespace" within -// which `code.function` is defined. Usually the qualified class or module -// name, such that `code.namespace` + some separator + `code.function` form a -// unique identifier for the code unit. -func CodeNamespace(val string) attribute.KeyValue { - return CodeNamespaceKey.String(val) -} - -// CodeFilepath returns an attribute KeyValue conforming to the -// "code.filepath" semantic conventions. It represents the source code file -// name that identifies the code unit as uniquely as possible (preferably an -// absolute file path). -func CodeFilepath(val string) attribute.KeyValue { - return CodeFilepathKey.String(val) -} - -// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" -// semantic conventions. It represents the line number in `code.filepath` best -// representing the operation. It SHOULD point within the code unit named in -// `code.function`. -func CodeLineNumber(val int) attribute.KeyValue { - return CodeLineNumberKey.Int(val) -} - -// CodeColumn returns an attribute KeyValue conforming to the "code.column" -// semantic conventions. It represents the column number in `code.filepath` -// best representing the operation. It SHOULD point within the code unit named -// in `code.function`. -func CodeColumn(val int) attribute.KeyValue { - return CodeColumnKey.Int(val) -} - -// Semantic Convention for HTTP Client -const ( - // HTTPURLKey is the attribute Key conforming to the "http.url" semantic - // conventions. It represents the full HTTP request URL in the form - // `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is - // not transmitted over HTTP, but if it is known, it should be included - // nevertheless. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv' - // Note: `http.url` MUST NOT contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case the - // attribute's value should be `https://www.example.com/`. - HTTPURLKey = attribute.Key("http.url") - - // HTTPResendCountKey is the attribute Key conforming to the - // "http.resend_count" semantic conventions. It represents the ordinal - // number of request resending attempt (for any reason, including - // redirects). - // - // Type: int - // RequirementLevel: Recommended (if and only if request was retried.) - // Stability: stable - // Examples: 3 - // Note: The resend count SHOULD be updated each time an HTTP request gets - // resent by the client, regardless of what was the cause of the resending - // (e.g. redirection, authorization failure, 503 Server Unavailable, - // network issues, or any other). - HTTPResendCountKey = attribute.Key("http.resend_count") -) - -// HTTPURL returns an attribute KeyValue conforming to the "http.url" -// semantic conventions. It represents the full HTTP request URL in the form -// `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not -// transmitted over HTTP, but if it is known, it should be included -// nevertheless. -func HTTPURL(val string) attribute.KeyValue { - return HTTPURLKey.String(val) -} - -// HTTPResendCount returns an attribute KeyValue conforming to the -// "http.resend_count" semantic conventions. It represents the ordinal number -// of request resending attempt (for any reason, including redirects). -func HTTPResendCount(val int) attribute.KeyValue { - return HTTPResendCountKey.Int(val) -} - -// Semantic Convention for HTTP Server -const ( - // HTTPTargetKey is the attribute Key conforming to the "http.target" - // semantic conventions. It represents the full request target as passed in - // a HTTP request line or equivalent. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: '/users/12314/?q=ddds' - HTTPTargetKey = attribute.Key("http.target") - - // HTTPClientIPKey is the attribute Key conforming to the "http.client_ip" - // semantic conventions. It represents the IP address of the original - // client behind all proxies, if known (e.g. from - // [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '83.164.160.102' - // Note: This is not necessarily the same as `net.sock.peer.addr`, which - // would - // identify the network-level peer, which may be a proxy. - // - // This attribute should be set when a source of information different - // from the one used for `net.sock.peer.addr`, is available even if that - // other - // source just confirms the same value as `net.sock.peer.addr`. - // Rationale: For `net.sock.peer.addr`, one typically does not know if it - // comes from a proxy, reverse proxy, or the actual client. Setting - // `http.client_ip` when it's the same as `net.sock.peer.addr` means that - // one is at least somewhat confident that the address is not that of - // the closest proxy. - HTTPClientIPKey = attribute.Key("http.client_ip") -) - -// HTTPTarget returns an attribute KeyValue conforming to the "http.target" -// semantic conventions. It represents the full request target as passed in a -// HTTP request line or equivalent. -func HTTPTarget(val string) attribute.KeyValue { - return HTTPTargetKey.String(val) -} - -// HTTPClientIP returns an attribute KeyValue conforming to the -// "http.client_ip" semantic conventions. It represents the IP address of the -// original client behind all proxies, if known (e.g. from -// [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). -func HTTPClientIP(val string) attribute.KeyValue { - return HTTPClientIPKey.String(val) -} - -// The `aws` conventions apply to operations using the AWS SDK. They map -// request or response parameters in AWS SDK API calls to attributes on a Span. -// The conventions have been collected over time based on feedback from AWS -// users of tracing and will continue to evolve as new interesting conventions -// are found. -// Some descriptions are also provided for populating general OpenTelemetry -// semantic conventions based on these APIs. -const ( - // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" - // semantic conventions. It represents the AWS request ID as returned in - // the response headers `x-amz-request-id` or `x-amz-requestid`. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' - AWSRequestIDKey = attribute.Key("aws.request_id") -) - -// AWSRequestID returns an attribute KeyValue conforming to the -// "aws.request_id" semantic conventions. It represents the AWS request ID as -// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. -func AWSRequestID(val string) attribute.KeyValue { - return AWSRequestIDKey.String(val) -} - -// Attributes that exist for multiple DynamoDB request types. -const ( - // AWSDynamoDBTableNamesKey is the attribute Key conforming to the - // "aws.dynamodb.table_names" semantic conventions. It represents the keys - // in the `RequestItems` object field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Users', 'Cats' - AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") - - // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the - // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the - // JSON-serialized value of each item in the `ConsumedCapacity` response - // field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { - // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : - // { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": - // { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number }, "TableName": "string", - // "WriteCapacityUnits": number }' - AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") - - // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to - // the "aws.dynamodb.item_collection_metrics" semantic conventions. It - // represents the JSON-serialized value of the `ItemCollectionMetrics` - // response field. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": - // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { - // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], - // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, - // "SizeEstimateRangeGB": [ number ] } ] }' - AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") - - // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to - // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It - // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` - // request parameter. - // - // Type: double - // RequirementLevel: Optional - // Stability: stable - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") - - // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming - // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. - // It represents the value of the - // `ProvisionedThroughput.WriteCapacityUnits` request parameter. - // - // Type: double - // RequirementLevel: Optional - // Stability: stable - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") - - // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the - // "aws.dynamodb.consistent_read" semantic conventions. It represents the - // value of the `ConsistentRead` request parameter. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") - - // AWSDynamoDBProjectionKey is the attribute Key conforming to the - // "aws.dynamodb.projection" semantic conventions. It represents the value - // of the `ProjectionExpression` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Title', 'Title, Price, Color', 'Title, Description, - // RelatedItems, ProductReviews' - AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") - - // AWSDynamoDBLimitKey is the attribute Key conforming to the - // "aws.dynamodb.limit" semantic conventions. It represents the value of - // the `Limit` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 10 - AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") - - // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the - // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the - // value of the `AttributesToGet` request parameter. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: 'lives', 'id' - AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") - - // AWSDynamoDBIndexNameKey is the attribute Key conforming to the - // "aws.dynamodb.index_name" semantic conventions. It represents the value - // of the `IndexName` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'name_to_group' - AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") - - // AWSDynamoDBSelectKey is the attribute Key conforming to the - // "aws.dynamodb.select" semantic conventions. It represents the value of - // the `Select` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'ALL_ATTRIBUTES', 'COUNT' - AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") -) - -// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_names" semantic conventions. It represents the keys in -// the `RequestItems` object field. -func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { - return AWSDynamoDBTableNamesKey.StringSlice(val) -} - -// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to -// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the -// JSON-serialized value of each item in the `ConsumedCapacity` response field. -func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { - return AWSDynamoDBConsumedCapacityKey.StringSlice(val) -} - -// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming -// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It -// represents the JSON-serialized value of the `ItemCollectionMetrics` response -// field. -func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { - return AWSDynamoDBItemCollectionMetricsKey.String(val) -} - -// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue -// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic -// conventions. It represents the value of the -// `ProvisionedThroughput.ReadCapacityUnits` request parameter. -func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) -} - -// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue -// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic -// conventions. It represents the value of the -// `ProvisionedThroughput.WriteCapacityUnits` request parameter. -func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) -} - -// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the -// "aws.dynamodb.consistent_read" semantic conventions. It represents the value -// of the `ConsistentRead` request parameter. -func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { - return AWSDynamoDBConsistentReadKey.Bool(val) -} - -// AWSDynamoDBProjection returns an attribute KeyValue conforming to the -// "aws.dynamodb.projection" semantic conventions. It represents the value of -// the `ProjectionExpression` request parameter. -func AWSDynamoDBProjection(val string) attribute.KeyValue { - return AWSDynamoDBProjectionKey.String(val) -} - -// AWSDynamoDBLimit returns an attribute KeyValue conforming to the -// "aws.dynamodb.limit" semantic conventions. It represents the value of the -// `Limit` request parameter. -func AWSDynamoDBLimit(val int) attribute.KeyValue { - return AWSDynamoDBLimitKey.Int(val) -} - -// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to -// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the -// value of the `AttributesToGet` request parameter. -func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributesToGetKey.StringSlice(val) -} - -// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the -// "aws.dynamodb.index_name" semantic conventions. It represents the value of -// the `IndexName` request parameter. -func AWSDynamoDBIndexName(val string) attribute.KeyValue { - return AWSDynamoDBIndexNameKey.String(val) -} - -// AWSDynamoDBSelect returns an attribute KeyValue conforming to the -// "aws.dynamodb.select" semantic conventions. It represents the value of the -// `Select` request parameter. -func AWSDynamoDBSelect(val string) attribute.KeyValue { - return AWSDynamoDBSelectKey.String(val) -} - -// DynamoDB.CreateTable -const ( - // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to - // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It - // represents the JSON-serialized value of each item of the - // `GlobalSecondaryIndexes` request field - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": - // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ - // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { - // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' - AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") - - // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to - // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It - // represents the JSON-serialized value of each item of the - // `LocalSecondaryIndexes` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "IndexARN": "string", "IndexName": "string", - // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' - AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") -) - -// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue -// conforming to the "aws.dynamodb.global_secondary_indexes" semantic -// conventions. It represents the JSON-serialized value of each item of the -// `GlobalSecondaryIndexes` request field -func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) -} - -// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming -// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It -// represents the JSON-serialized value of each item of the -// `LocalSecondaryIndexes` request field. -func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) -} - -// DynamoDB.ListTables -const ( - // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the - // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents - // the value of the `ExclusiveStartTableName` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Users', 'CatsTable' - AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - - // AWSDynamoDBTableCountKey is the attribute Key conforming to the - // "aws.dynamodb.table_count" semantic conventions. It represents the the - // number of items in the `TableNames` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 20 - AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") -) - -// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming -// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It -// represents the value of the `ExclusiveStartTableName` request parameter. -func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { - return AWSDynamoDBExclusiveStartTableKey.String(val) -} - -// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_count" semantic conventions. It represents the the -// number of items in the `TableNames` response parameter. -func AWSDynamoDBTableCount(val int) attribute.KeyValue { - return AWSDynamoDBTableCountKey.Int(val) -} - -// DynamoDB.Query -const ( - // AWSDynamoDBScanForwardKey is the attribute Key conforming to the - // "aws.dynamodb.scan_forward" semantic conventions. It represents the - // value of the `ScanIndexForward` request parameter. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") -) - -// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the -// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of -// the `ScanIndexForward` request parameter. -func AWSDynamoDBScanForward(val bool) attribute.KeyValue { - return AWSDynamoDBScanForwardKey.Bool(val) -} - -// DynamoDB.Scan -const ( - // AWSDynamoDBSegmentKey is the attribute Key conforming to the - // "aws.dynamodb.segment" semantic conventions. It represents the value of - // the `Segment` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 10 - AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") - - // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the - // "aws.dynamodb.total_segments" semantic conventions. It represents the - // value of the `TotalSegments` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 100 - AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") - - // AWSDynamoDBCountKey is the attribute Key conforming to the - // "aws.dynamodb.count" semantic conventions. It represents the value of - // the `Count` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 10 - AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") - - // AWSDynamoDBScannedCountKey is the attribute Key conforming to the - // "aws.dynamodb.scanned_count" semantic conventions. It represents the - // value of the `ScannedCount` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 50 - AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") -) - -// AWSDynamoDBSegment returns an attribute KeyValue conforming to the -// "aws.dynamodb.segment" semantic conventions. It represents the value of the -// `Segment` request parameter. -func AWSDynamoDBSegment(val int) attribute.KeyValue { - return AWSDynamoDBSegmentKey.Int(val) -} - -// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the -// "aws.dynamodb.total_segments" semantic conventions. It represents the value -// of the `TotalSegments` request parameter. -func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { - return AWSDynamoDBTotalSegmentsKey.Int(val) -} - -// AWSDynamoDBCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.count" semantic conventions. It represents the value of the -// `Count` response parameter. -func AWSDynamoDBCount(val int) attribute.KeyValue { - return AWSDynamoDBCountKey.Int(val) -} - -// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.scanned_count" semantic conventions. It represents the value -// of the `ScannedCount` response parameter. -func AWSDynamoDBScannedCount(val int) attribute.KeyValue { - return AWSDynamoDBScannedCountKey.Int(val) -} - -// DynamoDB.UpdateTable -const ( - // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to - // the "aws.dynamodb.attribute_definitions" semantic conventions. It - // represents the JSON-serialized value of each item in the - // `AttributeDefinitions` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' - AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - - // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key - // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic - // conventions. It represents the JSON-serialized value of each item in the - // the `GlobalSecondaryIndexUpdates` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: stable - // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, - // "ProvisionedThroughput": { "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }' - AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") -) - -// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming -// to the "aws.dynamodb.attribute_definitions" semantic conventions. It -// represents the JSON-serialized value of each item in the -// `AttributeDefinitions` request field. -func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) -} - -// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue -// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic -// conventions. It represents the JSON-serialized value of each item in the the -// `GlobalSecondaryIndexUpdates` request field. -func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) -} - -// Attributes that exist for S3 request types. -const ( - // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" - // semantic conventions. It represents the S3 bucket name the request - // refers to. Corresponds to the `--bucket` parameter of the [S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) - // operations. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'some-bucket-name' - // Note: The `bucket` attribute is applicable to all S3 operations that - // reference a bucket, i.e. that require the bucket name as a mandatory - // parameter. - // This applies to almost all S3 operations except `list-buckets`. - AWSS3BucketKey = attribute.Key("aws.s3.bucket") - - // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic - // conventions. It represents the S3 object key the request refers to. - // Corresponds to the `--key` parameter of the [S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) - // operations. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'someFile.yml' - // Note: The `key` attribute is applicable to all object-related S3 - // operations, i.e. that require the object key as a mandatory parameter. - // This applies in particular to the following operations: - // - // - - // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) - // - - // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) - // - - // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) - // - - // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) - // - - // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) - // - - // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) - // - - // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) - // - - // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) - // - - // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) - // - - // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) - // - - // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) - // - - // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - // - - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - AWSS3KeyKey = attribute.Key("aws.s3.key") - - // AWSS3CopySourceKey is the attribute Key conforming to the - // "aws.s3.copy_source" semantic conventions. It represents the source - // object (in the form `bucket`/`key`) for the copy operation. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'someFile.yml' - // Note: The `copy_source` attribute applies to S3 copy operations and - // corresponds to the `--copy-source` parameter - // of the [copy-object operation within the S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). - // This applies in particular to the following operations: - // - // - - // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) - // - - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") - - // AWSS3UploadIDKey is the attribute Key conforming to the - // "aws.s3.upload_id" semantic conventions. It represents the upload ID - // that identifies the multipart upload. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' - // Note: The `upload_id` attribute applies to S3 multipart-upload - // operations and corresponds to the `--upload-id` parameter - // of the [S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) - // multipart operations. - // This applies in particular to the following operations: - // - // - - // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) - // - - // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) - // - - // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) - // - - // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - // - - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") - - // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" - // semantic conventions. It represents the delete request container that - // specifies the objects to be deleted. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: - // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' - // Note: The `delete` attribute is only applicable to the - // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) - // operation. - // The `delete` attribute corresponds to the `--delete` parameter of the - // [delete-objects operation within the S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). - AWSS3DeleteKey = attribute.Key("aws.s3.delete") - - // AWSS3PartNumberKey is the attribute Key conforming to the - // "aws.s3.part_number" semantic conventions. It represents the part number - // of the part being uploaded in a multipart-upload operation. This is a - // positive integer between 1 and 10,000. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3456 - // Note: The `part_number` attribute is only applicable to the - // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - // and - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - // operations. - // The `part_number` attribute corresponds to the `--part-number` parameter - // of the - // [upload-part operation within the S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). - AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") -) - -// AWSS3Bucket returns an attribute KeyValue conforming to the -// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the -// request refers to. Corresponds to the `--bucket` parameter of the [S3 -// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) -// operations. -func AWSS3Bucket(val string) attribute.KeyValue { - return AWSS3BucketKey.String(val) -} - -// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" -// semantic conventions. It represents the S3 object key the request refers to. -// Corresponds to the `--key` parameter of the [S3 -// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) -// operations. -func AWSS3Key(val string) attribute.KeyValue { - return AWSS3KeyKey.String(val) -} - -// AWSS3CopySource returns an attribute KeyValue conforming to the -// "aws.s3.copy_source" semantic conventions. It represents the source object -// (in the form `bucket`/`key`) for the copy operation. -func AWSS3CopySource(val string) attribute.KeyValue { - return AWSS3CopySourceKey.String(val) -} - -// AWSS3UploadID returns an attribute KeyValue conforming to the -// "aws.s3.upload_id" semantic conventions. It represents the upload ID that -// identifies the multipart upload. -func AWSS3UploadID(val string) attribute.KeyValue { - return AWSS3UploadIDKey.String(val) -} - -// AWSS3Delete returns an attribute KeyValue conforming to the -// "aws.s3.delete" semantic conventions. It represents the delete request -// container that specifies the objects to be deleted. -func AWSS3Delete(val string) attribute.KeyValue { - return AWSS3DeleteKey.String(val) -} - -// AWSS3PartNumber returns an attribute KeyValue conforming to the -// "aws.s3.part_number" semantic conventions. It represents the part number of -// the part being uploaded in a multipart-upload operation. This is a positive -// integer between 1 and 10,000. -func AWSS3PartNumber(val int) attribute.KeyValue { - return AWSS3PartNumberKey.Int(val) -} - -// Semantic conventions to apply when instrumenting the GraphQL implementation. -// They map GraphQL operations to attributes on a Span. -const ( - // GraphqlOperationNameKey is the attribute Key conforming to the - // "graphql.operation.name" semantic conventions. It represents the name of - // the operation being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'findBookByID' - GraphqlOperationNameKey = attribute.Key("graphql.operation.name") - - // GraphqlOperationTypeKey is the attribute Key conforming to the - // "graphql.operation.type" semantic conventions. It represents the type of - // the operation being executed. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'query', 'mutation', 'subscription' - GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") - - // GraphqlDocumentKey is the attribute Key conforming to the - // "graphql.document" semantic conventions. It represents the GraphQL - // document being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'query findBookByID { bookByID(id: ?) { name } }' - // Note: The value may be sanitized to exclude sensitive information. - GraphqlDocumentKey = attribute.Key("graphql.document") -) - -var ( - // GraphQL query - GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") - // GraphQL mutation - GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") - // GraphQL subscription - GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") -) - -// GraphqlOperationName returns an attribute KeyValue conforming to the -// "graphql.operation.name" semantic conventions. It represents the name of the -// operation being executed. -func GraphqlOperationName(val string) attribute.KeyValue { - return GraphqlOperationNameKey.String(val) -} - -// GraphqlDocument returns an attribute KeyValue conforming to the -// "graphql.document" semantic conventions. It represents the GraphQL document -// being executed. -func GraphqlDocument(val string) attribute.KeyValue { - return GraphqlDocumentKey.String(val) -} - -// General attributes used in messaging systems. -const ( - // MessagingSystemKey is the attribute Key conforming to the - // "messaging.system" semantic conventions. It represents a string - // identifying the messaging system. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'kafka', 'rabbitmq', 'rocketmq', 'activemq', 'AmazonSQS' - MessagingSystemKey = attribute.Key("messaging.system") - - // MessagingOperationKey is the attribute Key conforming to the - // "messaging.operation" semantic conventions. It represents a string - // identifying the kind of messaging operation as defined in the [Operation - // names](#operation-names) section above. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Note: If a custom value is used, it MUST be of low cardinality. - MessagingOperationKey = attribute.Key("messaging.operation") - - // MessagingBatchMessageCountKey is the attribute Key conforming to the - // "messaging.batch.message_count" semantic conventions. It represents the - // number of messages sent, received, or processed in the scope of the - // batching operation. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If the span describes an - // operation on a batch of messages.) - // Stability: stable - // Examples: 0, 1, 2 - // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on - // spans that operate with a single message. When a messaging client - // library supports both batch and single-message API for the same - // operation, instrumentations SHOULD use `messaging.batch.message_count` - // for batching APIs and SHOULD NOT use it for single-message APIs. - MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") -) - -var ( - // publish - MessagingOperationPublish = MessagingOperationKey.String("publish") - // receive - MessagingOperationReceive = MessagingOperationKey.String("receive") - // process - MessagingOperationProcess = MessagingOperationKey.String("process") -) - -// MessagingSystem returns an attribute KeyValue conforming to the -// "messaging.system" semantic conventions. It represents a string identifying -// the messaging system. -func MessagingSystem(val string) attribute.KeyValue { - return MessagingSystemKey.String(val) -} - -// MessagingBatchMessageCount returns an attribute KeyValue conforming to -// the "messaging.batch.message_count" semantic conventions. It represents the -// number of messages sent, received, or processed in the scope of the batching -// operation. -func MessagingBatchMessageCount(val int) attribute.KeyValue { - return MessagingBatchMessageCountKey.Int(val) -} - -// Semantic convention for a consumer of messages received from a messaging -// system -const ( - // MessagingConsumerIDKey is the attribute Key conforming to the - // "messaging.consumer.id" semantic conventions. It represents the - // identifier for the consumer receiving a message. For Kafka, set it to - // `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if - // both are present, or only `messaging.kafka.consumer.group`. For brokers, - // such as RabbitMQ and Artemis, set it to the `client_id` of the client - // consuming the message. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'mygroup - client-6' - MessagingConsumerIDKey = attribute.Key("messaging.consumer.id") -) - -// MessagingConsumerID returns an attribute KeyValue conforming to the -// "messaging.consumer.id" semantic conventions. It represents the identifier -// for the consumer receiving a message. For Kafka, set it to -// `{messaging.kafka.consumer.group} - {messaging.kafka.client_id}`, if both -// are present, or only `messaging.kafka.consumer.group`. For brokers, such as -// RabbitMQ and Artemis, set it to the `client_id` of the client consuming the -// message. -func MessagingConsumerID(val string) attribute.KeyValue { - return MessagingConsumerIDKey.String(val) -} - -// Semantic conventions for remote procedure calls. -const ( - // RPCSystemKey is the attribute Key conforming to the "rpc.system" - // semantic conventions. It represents a string identifying the remoting - // system. See below for a list of well-known identifiers. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - RPCSystemKey = attribute.Key("rpc.system") - - // RPCServiceKey is the attribute Key conforming to the "rpc.service" - // semantic conventions. It represents the full (logical) name of the - // service being called, including its package name, if applicable. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'myservice.EchoService' - // Note: This is the logical name of the service from the RPC interface - // perspective, which can be different from the name of any implementing - // class. The `code.namespace` attribute may be used to store the latter - // (despite the attribute name, it may include a class name; e.g., class - // with method actually executing the call on the server side, RPC client - // stub class on the client side). - RPCServiceKey = attribute.Key("rpc.service") - - // RPCMethodKey is the attribute Key conforming to the "rpc.method" - // semantic conventions. It represents the name of the (logical) method - // being called, must be equal to the $method part in the span name. - // - // Type: string - // RequirementLevel: Recommended - // Stability: stable - // Examples: 'exampleMethod' - // Note: This is the logical name of the method from the RPC interface - // perspective, which can be different from the name of any implementing - // method/function. The `code.function` attribute may be used to store the - // latter (e.g., method actually executing the call on the server side, RPC - // client stub method on the client side). - RPCMethodKey = attribute.Key("rpc.method") -) - -var ( - // gRPC - RPCSystemGRPC = RPCSystemKey.String("grpc") - // Java RMI - RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") - // .NET WCF - RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") - // Apache Dubbo - RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") - // Connect RPC - RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") -) - -// RPCService returns an attribute KeyValue conforming to the "rpc.service" -// semantic conventions. It represents the full (logical) name of the service -// being called, including its package name, if applicable. -func RPCService(val string) attribute.KeyValue { - return RPCServiceKey.String(val) -} - -// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" -// semantic conventions. It represents the name of the (logical) method being -// called, must be equal to the $method part in the span name. -func RPCMethod(val string) attribute.KeyValue { - return RPCMethodKey.String(val) -} - -// Tech-specific attributes for gRPC. -const ( - // RPCGRPCStatusCodeKey is the attribute Key conforming to the - // "rpc.grpc.status_code" semantic conventions. It represents the [numeric - // status - // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of - // the gRPC request. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") -) - -var ( - // OK - RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) - // CANCELLED - RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) - // UNKNOWN - RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) - // INVALID_ARGUMENT - RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) - // DEADLINE_EXCEEDED - RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) - // NOT_FOUND - RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) - // ALREADY_EXISTS - RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) - // PERMISSION_DENIED - RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) - // RESOURCE_EXHAUSTED - RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) - // FAILED_PRECONDITION - RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) - // ABORTED - RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) - // OUT_OF_RANGE - RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) - // UNIMPLEMENTED - RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) - // INTERNAL - RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) - // UNAVAILABLE - RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) - // DATA_LOSS - RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) - // UNAUTHENTICATED - RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) -) - -// Tech-specific attributes for [JSON RPC](https://www.jsonrpc.org/). -const ( - // RPCJsonrpcVersionKey is the attribute Key conforming to the - // "rpc.jsonrpc.version" semantic conventions. It represents the protocol - // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 - // does not specify this, the value can be omitted. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If other than the default - // version (`1.0`)) - // Stability: stable - // Examples: '2.0', '1.0' - RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") - - // RPCJsonrpcRequestIDKey is the attribute Key conforming to the - // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` - // property of request or response. Since protocol allows id to be int, - // string, `null` or missing (for notifications), value is expected to be - // cast to string for simplicity. Use empty string in case of `null` value. - // Omit entirely if this is a notification. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '10', 'request-7', '' - RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") - - // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the - // "rpc.jsonrpc.error_code" semantic conventions. It represents the - // `error.code` property of response if it is an error response. - // - // Type: int - // RequirementLevel: ConditionallyRequired (If response is not successful.) - // Stability: stable - // Examples: -32700, 100 - RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") - - // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the - // "rpc.jsonrpc.error_message" semantic conventions. It represents the - // `error.message` property of response if it is an error response. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Parse error', 'User already exists' - RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") -) - -// RPCJsonrpcVersion returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.version" semantic conventions. It represents the protocol -// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 -// does not specify this, the value can be omitted. -func RPCJsonrpcVersion(val string) attribute.KeyValue { - return RPCJsonrpcVersionKey.String(val) -} - -// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` -// property of request or response. Since protocol allows id to be int, string, -// `null` or missing (for notifications), value is expected to be cast to -// string for simplicity. Use empty string in case of `null` value. Omit -// entirely if this is a notification. -func RPCJsonrpcRequestID(val string) attribute.KeyValue { - return RPCJsonrpcRequestIDKey.String(val) -} - -// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.error_code" semantic conventions. It represents the -// `error.code` property of response if it is an error response. -func RPCJsonrpcErrorCode(val int) attribute.KeyValue { - return RPCJsonrpcErrorCodeKey.Int(val) -} - -// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.error_message" semantic conventions. It represents the -// `error.message` property of response if it is an error response. -func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { - return RPCJsonrpcErrorMessageKey.String(val) -} - -// Tech-specific attributes for Connect RPC. -const ( - // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the - // "rpc.connect_rpc.error_code" semantic conventions. It represents the - // [error codes](https://connect.build/docs/protocol/#error-codes) of the - // Connect request. Error codes are always string values. - // - // Type: Enum - // RequirementLevel: ConditionallyRequired (If response is not successful - // and if error code available.) - // Stability: stable - RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") -) - -var ( - // cancelled - RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") - // unknown - RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") - // invalid_argument - RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") - // deadline_exceeded - RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") - // not_found - RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") - // already_exists - RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") - // permission_denied - RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") - // resource_exhausted - RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") - // failed_precondition - RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") - // aborted - RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") - // out_of_range - RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") - // unimplemented - RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") - // internal - RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") - // unavailable - RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") - // data_loss - RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") - // unauthenticated - RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md deleted file mode 100644 index 2de1fc3c6b..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Semconv v1.26.0 - -[![PkgGoDev](https://pkg.go.dev/badge/go.opentelemetry.io/otel/semconv/v1.26.0)](https://pkg.go.dev/go.opentelemetry.io/otel/semconv/v1.26.0) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go deleted file mode 100644 index d8dc822b26..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/attribute_group.go +++ /dev/null @@ -1,8996 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" - -import "go.opentelemetry.io/otel/attribute" - -// The Android platform on which the Android application is running. -const ( - // AndroidOSAPILevelKey is the attribute Key conforming to the - // "android.os.api_level" semantic conventions. It represents the uniquely - // identifies the framework API revision offered by a version - // (`os.version`) of the android operating system. More information can be - // found - // [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '33', '32' - AndroidOSAPILevelKey = attribute.Key("android.os.api_level") -) - -// AndroidOSAPILevel returns an attribute KeyValue conforming to the -// "android.os.api_level" semantic conventions. It represents the uniquely -// identifies the framework API revision offered by a version (`os.version`) of -// the android operating system. More information can be found -// [here](https://developer.android.com/guide/topics/manifest/uses-sdk-element#APILevels). -func AndroidOSAPILevel(val string) attribute.KeyValue { - return AndroidOSAPILevelKey.String(val) -} - -// ASP.NET Core attributes -const ( - // AspnetcoreRateLimitingResultKey is the attribute Key conforming to the - // "aspnetcore.rate_limiting.result" semantic conventions. It represents - // the rate-limiting result, shows whether the lease was acquired or - // contains a rejection reason - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - // Examples: 'acquired', 'request_canceled' - AspnetcoreRateLimitingResultKey = attribute.Key("aspnetcore.rate_limiting.result") - - // AspnetcoreDiagnosticsHandlerTypeKey is the attribute Key conforming to - // the "aspnetcore.diagnostics.handler.type" semantic conventions. It - // represents the full type name of the - // [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) - // implementation that handled the exception. - // - // Type: string - // RequirementLevel: ConditionallyRequired (if and only if the exception - // was handled by this handler.) - // Stability: stable - // Examples: 'Contoso.MyHandler' - AspnetcoreDiagnosticsHandlerTypeKey = attribute.Key("aspnetcore.diagnostics.handler.type") - - // AspnetcoreDiagnosticsExceptionResultKey is the attribute Key conforming - // to the "aspnetcore.diagnostics.exception.result" semantic conventions. - // It represents the aSP.NET Core exception middleware handling result - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'handled', 'unhandled' - AspnetcoreDiagnosticsExceptionResultKey = attribute.Key("aspnetcore.diagnostics.exception.result") - - // AspnetcoreRateLimitingPolicyKey is the attribute Key conforming to the - // "aspnetcore.rate_limiting.policy" semantic conventions. It represents - // the rate limiting policy name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'fixed', 'sliding', 'token' - AspnetcoreRateLimitingPolicyKey = attribute.Key("aspnetcore.rate_limiting.policy") - - // AspnetcoreRequestIsUnhandledKey is the attribute Key conforming to the - // "aspnetcore.request.is_unhandled" semantic conventions. It represents - // the flag indicating if request was handled by the application pipeline. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - // Examples: True - AspnetcoreRequestIsUnhandledKey = attribute.Key("aspnetcore.request.is_unhandled") - - // AspnetcoreRoutingIsFallbackKey is the attribute Key conforming to the - // "aspnetcore.routing.is_fallback" semantic conventions. It represents a - // value that indicates whether the matched route is a fallback route. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - // Examples: True - AspnetcoreRoutingIsFallbackKey = attribute.Key("aspnetcore.routing.is_fallback") - - // AspnetcoreRoutingMatchStatusKey is the attribute Key conforming to the - // "aspnetcore.routing.match_status" semantic conventions. It represents - // the match result - success or failure - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'success', 'failure' - AspnetcoreRoutingMatchStatusKey = attribute.Key("aspnetcore.routing.match_status") -) - -var ( - // Lease was acquired - AspnetcoreRateLimitingResultAcquired = AspnetcoreRateLimitingResultKey.String("acquired") - // Lease request was rejected by the endpoint limiter - AspnetcoreRateLimitingResultEndpointLimiter = AspnetcoreRateLimitingResultKey.String("endpoint_limiter") - // Lease request was rejected by the global limiter - AspnetcoreRateLimitingResultGlobalLimiter = AspnetcoreRateLimitingResultKey.String("global_limiter") - // Lease request was canceled - AspnetcoreRateLimitingResultRequestCanceled = AspnetcoreRateLimitingResultKey.String("request_canceled") -) - -var ( - // Exception was handled by the exception handling middleware - AspnetcoreDiagnosticsExceptionResultHandled = AspnetcoreDiagnosticsExceptionResultKey.String("handled") - // Exception was not handled by the exception handling middleware - AspnetcoreDiagnosticsExceptionResultUnhandled = AspnetcoreDiagnosticsExceptionResultKey.String("unhandled") - // Exception handling was skipped because the response had started - AspnetcoreDiagnosticsExceptionResultSkipped = AspnetcoreDiagnosticsExceptionResultKey.String("skipped") - // Exception handling didn't run because the request was aborted - AspnetcoreDiagnosticsExceptionResultAborted = AspnetcoreDiagnosticsExceptionResultKey.String("aborted") -) - -var ( - // Match succeeded - AspnetcoreRoutingMatchStatusSuccess = AspnetcoreRoutingMatchStatusKey.String("success") - // Match failed - AspnetcoreRoutingMatchStatusFailure = AspnetcoreRoutingMatchStatusKey.String("failure") -) - -// AspnetcoreDiagnosticsHandlerType returns an attribute KeyValue conforming -// to the "aspnetcore.diagnostics.handler.type" semantic conventions. It -// represents the full type name of the -// [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) -// implementation that handled the exception. -func AspnetcoreDiagnosticsHandlerType(val string) attribute.KeyValue { - return AspnetcoreDiagnosticsHandlerTypeKey.String(val) -} - -// AspnetcoreRateLimitingPolicy returns an attribute KeyValue conforming to -// the "aspnetcore.rate_limiting.policy" semantic conventions. It represents -// the rate limiting policy name. -func AspnetcoreRateLimitingPolicy(val string) attribute.KeyValue { - return AspnetcoreRateLimitingPolicyKey.String(val) -} - -// AspnetcoreRequestIsUnhandled returns an attribute KeyValue conforming to -// the "aspnetcore.request.is_unhandled" semantic conventions. It represents -// the flag indicating if request was handled by the application pipeline. -func AspnetcoreRequestIsUnhandled(val bool) attribute.KeyValue { - return AspnetcoreRequestIsUnhandledKey.Bool(val) -} - -// AspnetcoreRoutingIsFallback returns an attribute KeyValue conforming to -// the "aspnetcore.routing.is_fallback" semantic conventions. It represents a -// value that indicates whether the matched route is a fallback route. -func AspnetcoreRoutingIsFallback(val bool) attribute.KeyValue { - return AspnetcoreRoutingIsFallbackKey.Bool(val) -} - -// Generic attributes for AWS services. -const ( - // AWSRequestIDKey is the attribute Key conforming to the "aws.request_id" - // semantic conventions. It represents the AWS request ID as returned in - // the response headers `x-amz-request-id` or `x-amz-requestid`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '79b9da39-b7ae-508a-a6bc-864b2829c622', 'C9ER4AJX75574TDJ' - AWSRequestIDKey = attribute.Key("aws.request_id") -) - -// AWSRequestID returns an attribute KeyValue conforming to the -// "aws.request_id" semantic conventions. It represents the AWS request ID as -// returned in the response headers `x-amz-request-id` or `x-amz-requestid`. -func AWSRequestID(val string) attribute.KeyValue { - return AWSRequestIDKey.String(val) -} - -// Attributes for AWS DynamoDB. -const ( - // AWSDynamoDBAttributeDefinitionsKey is the attribute Key conforming to - // the "aws.dynamodb.attribute_definitions" semantic conventions. It - // represents the JSON-serialized value of each item in the - // `AttributeDefinitions` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '{ "AttributeName": "string", "AttributeType": "string" }' - AWSDynamoDBAttributeDefinitionsKey = attribute.Key("aws.dynamodb.attribute_definitions") - - // AWSDynamoDBAttributesToGetKey is the attribute Key conforming to the - // "aws.dynamodb.attributes_to_get" semantic conventions. It represents the - // value of the `AttributesToGet` request parameter. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'lives', 'id' - AWSDynamoDBAttributesToGetKey = attribute.Key("aws.dynamodb.attributes_to_get") - - // AWSDynamoDBConsistentReadKey is the attribute Key conforming to the - // "aws.dynamodb.consistent_read" semantic conventions. It represents the - // value of the `ConsistentRead` request parameter. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - AWSDynamoDBConsistentReadKey = attribute.Key("aws.dynamodb.consistent_read") - - // AWSDynamoDBConsumedCapacityKey is the attribute Key conforming to the - // "aws.dynamodb.consumed_capacity" semantic conventions. It represents the - // JSON-serialized value of each item in the `ConsumedCapacity` response - // field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '{ "CapacityUnits": number, "GlobalSecondaryIndexes": { - // "string" : { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }, "LocalSecondaryIndexes": { "string" : - // { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }, "ReadCapacityUnits": number, "Table": - // { "CapacityUnits": number, "ReadCapacityUnits": number, - // "WriteCapacityUnits": number }, "TableName": "string", - // "WriteCapacityUnits": number }' - AWSDynamoDBConsumedCapacityKey = attribute.Key("aws.dynamodb.consumed_capacity") - - // AWSDynamoDBCountKey is the attribute Key conforming to the - // "aws.dynamodb.count" semantic conventions. It represents the value of - // the `Count` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 10 - AWSDynamoDBCountKey = attribute.Key("aws.dynamodb.count") - - // AWSDynamoDBExclusiveStartTableKey is the attribute Key conforming to the - // "aws.dynamodb.exclusive_start_table" semantic conventions. It represents - // the value of the `ExclusiveStartTableName` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Users', 'CatsTable' - AWSDynamoDBExclusiveStartTableKey = attribute.Key("aws.dynamodb.exclusive_start_table") - - // AWSDynamoDBGlobalSecondaryIndexUpdatesKey is the attribute Key - // conforming to the "aws.dynamodb.global_secondary_index_updates" semantic - // conventions. It represents the JSON-serialized value of each item in the - // `GlobalSecondaryIndexUpdates` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '{ "Create": { "IndexName": "string", "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" }, - // "ProvisionedThroughput": { "ReadCapacityUnits": number, - // "WriteCapacityUnits": number } }' - AWSDynamoDBGlobalSecondaryIndexUpdatesKey = attribute.Key("aws.dynamodb.global_secondary_index_updates") - - // AWSDynamoDBGlobalSecondaryIndexesKey is the attribute Key conforming to - // the "aws.dynamodb.global_secondary_indexes" semantic conventions. It - // represents the JSON-serialized value of each item of the - // `GlobalSecondaryIndexes` request field - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '{ "IndexName": "string", "KeySchema": [ { "AttributeName": - // "string", "KeyType": "string" } ], "Projection": { "NonKeyAttributes": [ - // "string" ], "ProjectionType": "string" }, "ProvisionedThroughput": { - // "ReadCapacityUnits": number, "WriteCapacityUnits": number } }' - AWSDynamoDBGlobalSecondaryIndexesKey = attribute.Key("aws.dynamodb.global_secondary_indexes") - - // AWSDynamoDBIndexNameKey is the attribute Key conforming to the - // "aws.dynamodb.index_name" semantic conventions. It represents the value - // of the `IndexName` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'name_to_group' - AWSDynamoDBIndexNameKey = attribute.Key("aws.dynamodb.index_name") - - // AWSDynamoDBItemCollectionMetricsKey is the attribute Key conforming to - // the "aws.dynamodb.item_collection_metrics" semantic conventions. It - // represents the JSON-serialized value of the `ItemCollectionMetrics` - // response field. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '{ "string" : [ { "ItemCollectionKey": { "string" : { "B": - // blob, "BOOL": boolean, "BS": [ blob ], "L": [ "AttributeValue" ], "M": { - // "string" : "AttributeValue" }, "N": "string", "NS": [ "string" ], - // "NULL": boolean, "S": "string", "SS": [ "string" ] } }, - // "SizeEstimateRangeGB": [ number ] } ] }' - AWSDynamoDBItemCollectionMetricsKey = attribute.Key("aws.dynamodb.item_collection_metrics") - - // AWSDynamoDBLimitKey is the attribute Key conforming to the - // "aws.dynamodb.limit" semantic conventions. It represents the value of - // the `Limit` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 10 - AWSDynamoDBLimitKey = attribute.Key("aws.dynamodb.limit") - - // AWSDynamoDBLocalSecondaryIndexesKey is the attribute Key conforming to - // the "aws.dynamodb.local_secondary_indexes" semantic conventions. It - // represents the JSON-serialized value of each item of the - // `LocalSecondaryIndexes` request field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '{ "IndexARN": "string", "IndexName": "string", - // "IndexSizeBytes": number, "ItemCount": number, "KeySchema": [ { - // "AttributeName": "string", "KeyType": "string" } ], "Projection": { - // "NonKeyAttributes": [ "string" ], "ProjectionType": "string" } }' - AWSDynamoDBLocalSecondaryIndexesKey = attribute.Key("aws.dynamodb.local_secondary_indexes") - - // AWSDynamoDBProjectionKey is the attribute Key conforming to the - // "aws.dynamodb.projection" semantic conventions. It represents the value - // of the `ProjectionExpression` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Title', 'Title, Price, Color', 'Title, Description, - // RelatedItems, ProductReviews' - AWSDynamoDBProjectionKey = attribute.Key("aws.dynamodb.projection") - - // AWSDynamoDBProvisionedReadCapacityKey is the attribute Key conforming to - // the "aws.dynamodb.provisioned_read_capacity" semantic conventions. It - // represents the value of the `ProvisionedThroughput.ReadCapacityUnits` - // request parameter. - // - // Type: double - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedReadCapacityKey = attribute.Key("aws.dynamodb.provisioned_read_capacity") - - // AWSDynamoDBProvisionedWriteCapacityKey is the attribute Key conforming - // to the "aws.dynamodb.provisioned_write_capacity" semantic conventions. - // It represents the value of the - // `ProvisionedThroughput.WriteCapacityUnits` request parameter. - // - // Type: double - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1.0, 2.0 - AWSDynamoDBProvisionedWriteCapacityKey = attribute.Key("aws.dynamodb.provisioned_write_capacity") - - // AWSDynamoDBScanForwardKey is the attribute Key conforming to the - // "aws.dynamodb.scan_forward" semantic conventions. It represents the - // value of the `ScanIndexForward` request parameter. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - AWSDynamoDBScanForwardKey = attribute.Key("aws.dynamodb.scan_forward") - - // AWSDynamoDBScannedCountKey is the attribute Key conforming to the - // "aws.dynamodb.scanned_count" semantic conventions. It represents the - // value of the `ScannedCount` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 50 - AWSDynamoDBScannedCountKey = attribute.Key("aws.dynamodb.scanned_count") - - // AWSDynamoDBSegmentKey is the attribute Key conforming to the - // "aws.dynamodb.segment" semantic conventions. It represents the value of - // the `Segment` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 10 - AWSDynamoDBSegmentKey = attribute.Key("aws.dynamodb.segment") - - // AWSDynamoDBSelectKey is the attribute Key conforming to the - // "aws.dynamodb.select" semantic conventions. It represents the value of - // the `Select` request parameter. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'ALL_ATTRIBUTES', 'COUNT' - AWSDynamoDBSelectKey = attribute.Key("aws.dynamodb.select") - - // AWSDynamoDBTableCountKey is the attribute Key conforming to the - // "aws.dynamodb.table_count" semantic conventions. It represents the - // number of items in the `TableNames` response parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 20 - AWSDynamoDBTableCountKey = attribute.Key("aws.dynamodb.table_count") - - // AWSDynamoDBTableNamesKey is the attribute Key conforming to the - // "aws.dynamodb.table_names" semantic conventions. It represents the keys - // in the `RequestItems` object field. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Users', 'Cats' - AWSDynamoDBTableNamesKey = attribute.Key("aws.dynamodb.table_names") - - // AWSDynamoDBTotalSegmentsKey is the attribute Key conforming to the - // "aws.dynamodb.total_segments" semantic conventions. It represents the - // value of the `TotalSegments` request parameter. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 100 - AWSDynamoDBTotalSegmentsKey = attribute.Key("aws.dynamodb.total_segments") -) - -// AWSDynamoDBAttributeDefinitions returns an attribute KeyValue conforming -// to the "aws.dynamodb.attribute_definitions" semantic conventions. It -// represents the JSON-serialized value of each item in the -// `AttributeDefinitions` request field. -func AWSDynamoDBAttributeDefinitions(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributeDefinitionsKey.StringSlice(val) -} - -// AWSDynamoDBAttributesToGet returns an attribute KeyValue conforming to -// the "aws.dynamodb.attributes_to_get" semantic conventions. It represents the -// value of the `AttributesToGet` request parameter. -func AWSDynamoDBAttributesToGet(val ...string) attribute.KeyValue { - return AWSDynamoDBAttributesToGetKey.StringSlice(val) -} - -// AWSDynamoDBConsistentRead returns an attribute KeyValue conforming to the -// "aws.dynamodb.consistent_read" semantic conventions. It represents the value -// of the `ConsistentRead` request parameter. -func AWSDynamoDBConsistentRead(val bool) attribute.KeyValue { - return AWSDynamoDBConsistentReadKey.Bool(val) -} - -// AWSDynamoDBConsumedCapacity returns an attribute KeyValue conforming to -// the "aws.dynamodb.consumed_capacity" semantic conventions. It represents the -// JSON-serialized value of each item in the `ConsumedCapacity` response field. -func AWSDynamoDBConsumedCapacity(val ...string) attribute.KeyValue { - return AWSDynamoDBConsumedCapacityKey.StringSlice(val) -} - -// AWSDynamoDBCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.count" semantic conventions. It represents the value of the -// `Count` response parameter. -func AWSDynamoDBCount(val int) attribute.KeyValue { - return AWSDynamoDBCountKey.Int(val) -} - -// AWSDynamoDBExclusiveStartTable returns an attribute KeyValue conforming -// to the "aws.dynamodb.exclusive_start_table" semantic conventions. It -// represents the value of the `ExclusiveStartTableName` request parameter. -func AWSDynamoDBExclusiveStartTable(val string) attribute.KeyValue { - return AWSDynamoDBExclusiveStartTableKey.String(val) -} - -// AWSDynamoDBGlobalSecondaryIndexUpdates returns an attribute KeyValue -// conforming to the "aws.dynamodb.global_secondary_index_updates" semantic -// conventions. It represents the JSON-serialized value of each item in the -// `GlobalSecondaryIndexUpdates` request field. -func AWSDynamoDBGlobalSecondaryIndexUpdates(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexUpdatesKey.StringSlice(val) -} - -// AWSDynamoDBGlobalSecondaryIndexes returns an attribute KeyValue -// conforming to the "aws.dynamodb.global_secondary_indexes" semantic -// conventions. It represents the JSON-serialized value of each item of the -// `GlobalSecondaryIndexes` request field -func AWSDynamoDBGlobalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBGlobalSecondaryIndexesKey.StringSlice(val) -} - -// AWSDynamoDBIndexName returns an attribute KeyValue conforming to the -// "aws.dynamodb.index_name" semantic conventions. It represents the value of -// the `IndexName` request parameter. -func AWSDynamoDBIndexName(val string) attribute.KeyValue { - return AWSDynamoDBIndexNameKey.String(val) -} - -// AWSDynamoDBItemCollectionMetrics returns an attribute KeyValue conforming -// to the "aws.dynamodb.item_collection_metrics" semantic conventions. It -// represents the JSON-serialized value of the `ItemCollectionMetrics` response -// field. -func AWSDynamoDBItemCollectionMetrics(val string) attribute.KeyValue { - return AWSDynamoDBItemCollectionMetricsKey.String(val) -} - -// AWSDynamoDBLimit returns an attribute KeyValue conforming to the -// "aws.dynamodb.limit" semantic conventions. It represents the value of the -// `Limit` request parameter. -func AWSDynamoDBLimit(val int) attribute.KeyValue { - return AWSDynamoDBLimitKey.Int(val) -} - -// AWSDynamoDBLocalSecondaryIndexes returns an attribute KeyValue conforming -// to the "aws.dynamodb.local_secondary_indexes" semantic conventions. It -// represents the JSON-serialized value of each item of the -// `LocalSecondaryIndexes` request field. -func AWSDynamoDBLocalSecondaryIndexes(val ...string) attribute.KeyValue { - return AWSDynamoDBLocalSecondaryIndexesKey.StringSlice(val) -} - -// AWSDynamoDBProjection returns an attribute KeyValue conforming to the -// "aws.dynamodb.projection" semantic conventions. It represents the value of -// the `ProjectionExpression` request parameter. -func AWSDynamoDBProjection(val string) attribute.KeyValue { - return AWSDynamoDBProjectionKey.String(val) -} - -// AWSDynamoDBProvisionedReadCapacity returns an attribute KeyValue -// conforming to the "aws.dynamodb.provisioned_read_capacity" semantic -// conventions. It represents the value of the -// `ProvisionedThroughput.ReadCapacityUnits` request parameter. -func AWSDynamoDBProvisionedReadCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedReadCapacityKey.Float64(val) -} - -// AWSDynamoDBProvisionedWriteCapacity returns an attribute KeyValue -// conforming to the "aws.dynamodb.provisioned_write_capacity" semantic -// conventions. It represents the value of the -// `ProvisionedThroughput.WriteCapacityUnits` request parameter. -func AWSDynamoDBProvisionedWriteCapacity(val float64) attribute.KeyValue { - return AWSDynamoDBProvisionedWriteCapacityKey.Float64(val) -} - -// AWSDynamoDBScanForward returns an attribute KeyValue conforming to the -// "aws.dynamodb.scan_forward" semantic conventions. It represents the value of -// the `ScanIndexForward` request parameter. -func AWSDynamoDBScanForward(val bool) attribute.KeyValue { - return AWSDynamoDBScanForwardKey.Bool(val) -} - -// AWSDynamoDBScannedCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.scanned_count" semantic conventions. It represents the value -// of the `ScannedCount` response parameter. -func AWSDynamoDBScannedCount(val int) attribute.KeyValue { - return AWSDynamoDBScannedCountKey.Int(val) -} - -// AWSDynamoDBSegment returns an attribute KeyValue conforming to the -// "aws.dynamodb.segment" semantic conventions. It represents the value of the -// `Segment` request parameter. -func AWSDynamoDBSegment(val int) attribute.KeyValue { - return AWSDynamoDBSegmentKey.Int(val) -} - -// AWSDynamoDBSelect returns an attribute KeyValue conforming to the -// "aws.dynamodb.select" semantic conventions. It represents the value of the -// `Select` request parameter. -func AWSDynamoDBSelect(val string) attribute.KeyValue { - return AWSDynamoDBSelectKey.String(val) -} - -// AWSDynamoDBTableCount returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_count" semantic conventions. It represents the number of -// items in the `TableNames` response parameter. -func AWSDynamoDBTableCount(val int) attribute.KeyValue { - return AWSDynamoDBTableCountKey.Int(val) -} - -// AWSDynamoDBTableNames returns an attribute KeyValue conforming to the -// "aws.dynamodb.table_names" semantic conventions. It represents the keys in -// the `RequestItems` object field. -func AWSDynamoDBTableNames(val ...string) attribute.KeyValue { - return AWSDynamoDBTableNamesKey.StringSlice(val) -} - -// AWSDynamoDBTotalSegments returns an attribute KeyValue conforming to the -// "aws.dynamodb.total_segments" semantic conventions. It represents the value -// of the `TotalSegments` request parameter. -func AWSDynamoDBTotalSegments(val int) attribute.KeyValue { - return AWSDynamoDBTotalSegmentsKey.Int(val) -} - -// Attributes for AWS Elastic Container Service (ECS). -const ( - // AWSECSTaskIDKey is the attribute Key conforming to the "aws.ecs.task.id" - // semantic conventions. It represents the ID of a running ECS task. The ID - // MUST be extracted from `task.arn`. - // - // Type: string - // RequirementLevel: ConditionallyRequired (If and only if `task.arn` is - // populated.) - // Stability: experimental - // Examples: '10838bed-421f-43ef-870a-f43feacbbb5b', - // '23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd' - AWSECSTaskIDKey = attribute.Key("aws.ecs.task.id") - - // AWSECSClusterARNKey is the attribute Key conforming to the - // "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an - // [ECS - // cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSECSClusterARNKey = attribute.Key("aws.ecs.cluster.arn") - - // AWSECSContainerARNKey is the attribute Key conforming to the - // "aws.ecs.container.arn" semantic conventions. It represents the Amazon - // Resource Name (ARN) of an [ECS container - // instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'arn:aws:ecs:us-west-1:123456789123:container/32624152-9086-4f0e-acae-1a75b14fe4d9' - AWSECSContainerARNKey = attribute.Key("aws.ecs.container.arn") - - // AWSECSLaunchtypeKey is the attribute Key conforming to the - // "aws.ecs.launchtype" semantic conventions. It represents the [launch - // type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) - // for an ECS task. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - AWSECSLaunchtypeKey = attribute.Key("aws.ecs.launchtype") - - // AWSECSTaskARNKey is the attribute Key conforming to the - // "aws.ecs.task.arn" semantic conventions. It represents the ARN of a - // running [ECS - // task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'arn:aws:ecs:us-west-1:123456789123:task/10838bed-421f-43ef-870a-f43feacbbb5b', - // 'arn:aws:ecs:us-west-1:123456789123:task/my-cluster/task-id/23ebb8ac-c18f-46c6-8bbe-d55d0e37cfbd' - AWSECSTaskARNKey = attribute.Key("aws.ecs.task.arn") - - // AWSECSTaskFamilyKey is the attribute Key conforming to the - // "aws.ecs.task.family" semantic conventions. It represents the family - // name of the [ECS task - // definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) - // used to create the ECS task. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry-family' - AWSECSTaskFamilyKey = attribute.Key("aws.ecs.task.family") - - // AWSECSTaskRevisionKey is the attribute Key conforming to the - // "aws.ecs.task.revision" semantic conventions. It represents the revision - // for the task definition used to create the ECS task. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '8', '26' - AWSECSTaskRevisionKey = attribute.Key("aws.ecs.task.revision") -) - -var ( - // ec2 - AWSECSLaunchtypeEC2 = AWSECSLaunchtypeKey.String("ec2") - // fargate - AWSECSLaunchtypeFargate = AWSECSLaunchtypeKey.String("fargate") -) - -// AWSECSTaskID returns an attribute KeyValue conforming to the -// "aws.ecs.task.id" semantic conventions. It represents the ID of a running -// ECS task. The ID MUST be extracted from `task.arn`. -func AWSECSTaskID(val string) attribute.KeyValue { - return AWSECSTaskIDKey.String(val) -} - -// AWSECSClusterARN returns an attribute KeyValue conforming to the -// "aws.ecs.cluster.arn" semantic conventions. It represents the ARN of an [ECS -// cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). -func AWSECSClusterARN(val string) attribute.KeyValue { - return AWSECSClusterARNKey.String(val) -} - -// AWSECSContainerARN returns an attribute KeyValue conforming to the -// "aws.ecs.container.arn" semantic conventions. It represents the Amazon -// Resource Name (ARN) of an [ECS container -// instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). -func AWSECSContainerARN(val string) attribute.KeyValue { - return AWSECSContainerARNKey.String(val) -} - -// AWSECSTaskARN returns an attribute KeyValue conforming to the -// "aws.ecs.task.arn" semantic conventions. It represents the ARN of a running -// [ECS -// task](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-account-settings.html#ecs-resource-ids). -func AWSECSTaskARN(val string) attribute.KeyValue { - return AWSECSTaskARNKey.String(val) -} - -// AWSECSTaskFamily returns an attribute KeyValue conforming to the -// "aws.ecs.task.family" semantic conventions. It represents the family name of -// the [ECS task -// definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html) -// used to create the ECS task. -func AWSECSTaskFamily(val string) attribute.KeyValue { - return AWSECSTaskFamilyKey.String(val) -} - -// AWSECSTaskRevision returns an attribute KeyValue conforming to the -// "aws.ecs.task.revision" semantic conventions. It represents the revision for -// the task definition used to create the ECS task. -func AWSECSTaskRevision(val string) attribute.KeyValue { - return AWSECSTaskRevisionKey.String(val) -} - -// Attributes for AWS Elastic Kubernetes Service (EKS). -const ( - // AWSEKSClusterARNKey is the attribute Key conforming to the - // "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an - // EKS cluster. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'arn:aws:ecs:us-west-2:123456789123:cluster/my-cluster' - AWSEKSClusterARNKey = attribute.Key("aws.eks.cluster.arn") -) - -// AWSEKSClusterARN returns an attribute KeyValue conforming to the -// "aws.eks.cluster.arn" semantic conventions. It represents the ARN of an EKS -// cluster. -func AWSEKSClusterARN(val string) attribute.KeyValue { - return AWSEKSClusterARNKey.String(val) -} - -// Attributes for AWS Logs. -const ( - // AWSLogGroupARNsKey is the attribute Key conforming to the - // "aws.log.group.arns" semantic conventions. It represents the Amazon - // Resource Name(s) (ARN) of the AWS log group(s). - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:*' - // Note: See the [log group ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - AWSLogGroupARNsKey = attribute.Key("aws.log.group.arns") - - // AWSLogGroupNamesKey is the attribute Key conforming to the - // "aws.log.group.names" semantic conventions. It represents the name(s) of - // the AWS log group(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/aws/lambda/my-function', 'opentelemetry-service' - // Note: Multiple log groups must be supported for cases like - // multi-container applications, where a single application has sidecar - // containers, and each write to their own log group. - AWSLogGroupNamesKey = attribute.Key("aws.log.group.names") - - // AWSLogStreamARNsKey is the attribute Key conforming to the - // "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of - // the AWS log stream(s). - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'arn:aws:logs:us-west-1:123456789012:log-group:/aws/my/group:log-stream:logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - // Note: See the [log stream ARN format - // documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). - // One log group can contain several log streams, so these ARNs necessarily - // identify both a log group and a log stream. - AWSLogStreamARNsKey = attribute.Key("aws.log.stream.arns") - - // AWSLogStreamNamesKey is the attribute Key conforming to the - // "aws.log.stream.names" semantic conventions. It represents the name(s) - // of the AWS log stream(s) an application is writing to. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'logs/main/10838bed-421f-43ef-870a-f43feacbbb5b' - AWSLogStreamNamesKey = attribute.Key("aws.log.stream.names") -) - -// AWSLogGroupARNs returns an attribute KeyValue conforming to the -// "aws.log.group.arns" semantic conventions. It represents the Amazon Resource -// Name(s) (ARN) of the AWS log group(s). -func AWSLogGroupARNs(val ...string) attribute.KeyValue { - return AWSLogGroupARNsKey.StringSlice(val) -} - -// AWSLogGroupNames returns an attribute KeyValue conforming to the -// "aws.log.group.names" semantic conventions. It represents the name(s) of the -// AWS log group(s) an application is writing to. -func AWSLogGroupNames(val ...string) attribute.KeyValue { - return AWSLogGroupNamesKey.StringSlice(val) -} - -// AWSLogStreamARNs returns an attribute KeyValue conforming to the -// "aws.log.stream.arns" semantic conventions. It represents the ARN(s) of the -// AWS log stream(s). -func AWSLogStreamARNs(val ...string) attribute.KeyValue { - return AWSLogStreamARNsKey.StringSlice(val) -} - -// AWSLogStreamNames returns an attribute KeyValue conforming to the -// "aws.log.stream.names" semantic conventions. It represents the name(s) of -// the AWS log stream(s) an application is writing to. -func AWSLogStreamNames(val ...string) attribute.KeyValue { - return AWSLogStreamNamesKey.StringSlice(val) -} - -// Attributes for AWS Lambda. -const ( - // AWSLambdaInvokedARNKey is the attribute Key conforming to the - // "aws.lambda.invoked_arn" semantic conventions. It represents the full - // invoked ARN as provided on the `Context` passed to the function - // (`Lambda-Runtime-Invoked-Function-ARN` header on the - // `/runtime/invocation/next` applicable). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'arn:aws:lambda:us-east-1:123456:function:myfunction:myalias' - // Note: This may be different from `cloud.resource_id` if an alias is - // involved. - AWSLambdaInvokedARNKey = attribute.Key("aws.lambda.invoked_arn") -) - -// AWSLambdaInvokedARN returns an attribute KeyValue conforming to the -// "aws.lambda.invoked_arn" semantic conventions. It represents the full -// invoked ARN as provided on the `Context` passed to the function -// (`Lambda-Runtime-Invoked-Function-ARN` header on the -// `/runtime/invocation/next` applicable). -func AWSLambdaInvokedARN(val string) attribute.KeyValue { - return AWSLambdaInvokedARNKey.String(val) -} - -// Attributes for AWS S3. -const ( - // AWSS3BucketKey is the attribute Key conforming to the "aws.s3.bucket" - // semantic conventions. It represents the S3 bucket name the request - // refers to. Corresponds to the `--bucket` parameter of the [S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) - // operations. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'some-bucket-name' - // Note: The `bucket` attribute is applicable to all S3 operations that - // reference a bucket, i.e. that require the bucket name as a mandatory - // parameter. - // This applies to almost all S3 operations except `list-buckets`. - AWSS3BucketKey = attribute.Key("aws.s3.bucket") - - // AWSS3CopySourceKey is the attribute Key conforming to the - // "aws.s3.copy_source" semantic conventions. It represents the source - // object (in the form `bucket`/`key`) for the copy operation. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'someFile.yml' - // Note: The `copy_source` attribute applies to S3 copy operations and - // corresponds to the `--copy-source` parameter - // of the [copy-object operation within the S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html). - // This applies in particular to the following operations: - // - // - - // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) - // - - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - AWSS3CopySourceKey = attribute.Key("aws.s3.copy_source") - - // AWSS3DeleteKey is the attribute Key conforming to the "aws.s3.delete" - // semantic conventions. It represents the delete request container that - // specifies the objects to be deleted. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'Objects=[{Key=string,VersionID=string},{Key=string,VersionID=string}],Quiet=boolean' - // Note: The `delete` attribute is only applicable to the - // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) - // operation. - // The `delete` attribute corresponds to the `--delete` parameter of the - // [delete-objects operation within the S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-objects.html). - AWSS3DeleteKey = attribute.Key("aws.s3.delete") - - // AWSS3KeyKey is the attribute Key conforming to the "aws.s3.key" semantic - // conventions. It represents the S3 object key the request refers to. - // Corresponds to the `--key` parameter of the [S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) - // operations. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'someFile.yml' - // Note: The `key` attribute is applicable to all object-related S3 - // operations, i.e. that require the object key as a mandatory parameter. - // This applies in particular to the following operations: - // - // - - // [copy-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/copy-object.html) - // - - // [delete-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/delete-object.html) - // - - // [get-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html) - // - - // [head-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/head-object.html) - // - - // [put-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/put-object.html) - // - - // [restore-object](https://docs.aws.amazon.com/cli/latest/reference/s3api/restore-object.html) - // - - // [select-object-content](https://docs.aws.amazon.com/cli/latest/reference/s3api/select-object-content.html) - // - - // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) - // - - // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) - // - - // [create-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/create-multipart-upload.html) - // - - // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) - // - - // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - // - - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - AWSS3KeyKey = attribute.Key("aws.s3.key") - - // AWSS3PartNumberKey is the attribute Key conforming to the - // "aws.s3.part_number" semantic conventions. It represents the part number - // of the part being uploaded in a multipart-upload operation. This is a - // positive integer between 1 and 10,000. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 3456 - // Note: The `part_number` attribute is only applicable to the - // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - // and - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - // operations. - // The `part_number` attribute corresponds to the `--part-number` parameter - // of the - // [upload-part operation within the S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html). - AWSS3PartNumberKey = attribute.Key("aws.s3.part_number") - - // AWSS3UploadIDKey is the attribute Key conforming to the - // "aws.s3.upload_id" semantic conventions. It represents the upload ID - // that identifies the multipart upload. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'dfRtDYWFbkRONycy.Yxwh66Yjlx.cph0gtNBtJ' - // Note: The `upload_id` attribute applies to S3 multipart-upload - // operations and corresponds to the `--upload-id` parameter - // of the [S3 - // API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) - // multipart operations. - // This applies in particular to the following operations: - // - // - - // [abort-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/abort-multipart-upload.html) - // - - // [complete-multipart-upload](https://docs.aws.amazon.com/cli/latest/reference/s3api/complete-multipart-upload.html) - // - - // [list-parts](https://docs.aws.amazon.com/cli/latest/reference/s3api/list-parts.html) - // - - // [upload-part](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part.html) - // - - // [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html) - AWSS3UploadIDKey = attribute.Key("aws.s3.upload_id") -) - -// AWSS3Bucket returns an attribute KeyValue conforming to the -// "aws.s3.bucket" semantic conventions. It represents the S3 bucket name the -// request refers to. Corresponds to the `--bucket` parameter of the [S3 -// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) -// operations. -func AWSS3Bucket(val string) attribute.KeyValue { - return AWSS3BucketKey.String(val) -} - -// AWSS3CopySource returns an attribute KeyValue conforming to the -// "aws.s3.copy_source" semantic conventions. It represents the source object -// (in the form `bucket`/`key`) for the copy operation. -func AWSS3CopySource(val string) attribute.KeyValue { - return AWSS3CopySourceKey.String(val) -} - -// AWSS3Delete returns an attribute KeyValue conforming to the -// "aws.s3.delete" semantic conventions. It represents the delete request -// container that specifies the objects to be deleted. -func AWSS3Delete(val string) attribute.KeyValue { - return AWSS3DeleteKey.String(val) -} - -// AWSS3Key returns an attribute KeyValue conforming to the "aws.s3.key" -// semantic conventions. It represents the S3 object key the request refers to. -// Corresponds to the `--key` parameter of the [S3 -// API](https://docs.aws.amazon.com/cli/latest/reference/s3api/index.html) -// operations. -func AWSS3Key(val string) attribute.KeyValue { - return AWSS3KeyKey.String(val) -} - -// AWSS3PartNumber returns an attribute KeyValue conforming to the -// "aws.s3.part_number" semantic conventions. It represents the part number of -// the part being uploaded in a multipart-upload operation. This is a positive -// integer between 1 and 10,000. -func AWSS3PartNumber(val int) attribute.KeyValue { - return AWSS3PartNumberKey.Int(val) -} - -// AWSS3UploadID returns an attribute KeyValue conforming to the -// "aws.s3.upload_id" semantic conventions. It represents the upload ID that -// identifies the multipart upload. -func AWSS3UploadID(val string) attribute.KeyValue { - return AWSS3UploadIDKey.String(val) -} - -// The web browser attributes -const ( - // BrowserBrandsKey is the attribute Key conforming to the "browser.brands" - // semantic conventions. It represents the array of brand name and version - // separated by a space - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: ' Not A;Brand 99', 'Chromium 99', 'Chrome 99' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.brands`). - BrowserBrandsKey = attribute.Key("browser.brands") - - // BrowserLanguageKey is the attribute Key conforming to the - // "browser.language" semantic conventions. It represents the preferred - // language of the user using the browser - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'en', 'en-US', 'fr', 'fr-FR' - // Note: This value is intended to be taken from the Navigator API - // `navigator.language`. - BrowserLanguageKey = attribute.Key("browser.language") - - // BrowserMobileKey is the attribute Key conforming to the "browser.mobile" - // semantic conventions. It represents a boolean that is true if the - // browser is running on a mobile device - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.mobile`). If unavailable, this attribute - // SHOULD be left unset. - BrowserMobileKey = attribute.Key("browser.mobile") - - // BrowserPlatformKey is the attribute Key conforming to the - // "browser.platform" semantic conventions. It represents the platform on - // which the browser is running - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Windows', 'macOS', 'Android' - // Note: This value is intended to be taken from the [UA client hints - // API](https://wicg.github.io/ua-client-hints/#interface) - // (`navigator.userAgentData.platform`). If unavailable, the legacy - // `navigator.platform` API SHOULD NOT be used instead and this attribute - // SHOULD be left unset in order for the values to be consistent. - // The list of possible values is defined in the [W3C User-Agent Client - // Hints - // specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). - // Note that some (but not all) of these values can overlap with values in - // the [`os.type` and `os.name` attributes](./os.md). However, for - // consistency, the values in the `browser.platform` attribute should - // capture the exact value that the user agent provides. - BrowserPlatformKey = attribute.Key("browser.platform") -) - -// BrowserBrands returns an attribute KeyValue conforming to the -// "browser.brands" semantic conventions. It represents the array of brand name -// and version separated by a space -func BrowserBrands(val ...string) attribute.KeyValue { - return BrowserBrandsKey.StringSlice(val) -} - -// BrowserLanguage returns an attribute KeyValue conforming to the -// "browser.language" semantic conventions. It represents the preferred -// language of the user using the browser -func BrowserLanguage(val string) attribute.KeyValue { - return BrowserLanguageKey.String(val) -} - -// BrowserMobile returns an attribute KeyValue conforming to the -// "browser.mobile" semantic conventions. It represents a boolean that is true -// if the browser is running on a mobile device -func BrowserMobile(val bool) attribute.KeyValue { - return BrowserMobileKey.Bool(val) -} - -// BrowserPlatform returns an attribute KeyValue conforming to the -// "browser.platform" semantic conventions. It represents the platform on which -// the browser is running -func BrowserPlatform(val string) attribute.KeyValue { - return BrowserPlatformKey.String(val) -} - -// These attributes may be used to describe the client in a connection-based -// network interaction where there is one side that initiates the connection -// (the client is the side that initiates the connection). This covers all TCP -// network interactions since TCP is connection-based and one side initiates -// the connection (an exception is made for peer-to-peer communication over TCP -// where the "user-facing" surface of the protocol / API doesn't expose a clear -// notion of client and server). This also covers UDP network interactions -// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. -const ( - // ClientAddressKey is the attribute Key conforming to the "client.address" - // semantic conventions. It represents the client address - domain name if - // available without reverse DNS lookup; otherwise, IP address or Unix - // domain socket name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'client.example.com', '10.1.2.80', '/tmp/my.sock' - // Note: When observed from the server side, and when communicating through - // an intermediary, `client.address` SHOULD represent the client address - // behind any intermediaries, for example proxies, if it's available. - ClientAddressKey = attribute.Key("client.address") - - // ClientPortKey is the attribute Key conforming to the "client.port" - // semantic conventions. It represents the client port number. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 65123 - // Note: When observed from the server side, and when communicating through - // an intermediary, `client.port` SHOULD represent the client port behind - // any intermediaries, for example proxies, if it's available. - ClientPortKey = attribute.Key("client.port") -) - -// ClientAddress returns an attribute KeyValue conforming to the -// "client.address" semantic conventions. It represents the client address - -// domain name if available without reverse DNS lookup; otherwise, IP address -// or Unix domain socket name. -func ClientAddress(val string) attribute.KeyValue { - return ClientAddressKey.String(val) -} - -// ClientPort returns an attribute KeyValue conforming to the "client.port" -// semantic conventions. It represents the client port number. -func ClientPort(val int) attribute.KeyValue { - return ClientPortKey.Int(val) -} - -// A cloud environment (e.g. GCP, Azure, AWS). -const ( - // CloudAccountIDKey is the attribute Key conforming to the - // "cloud.account.id" semantic conventions. It represents the cloud account - // ID the resource is assigned to. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '111111111111', 'opentelemetry' - CloudAccountIDKey = attribute.Key("cloud.account.id") - - // CloudAvailabilityZoneKey is the attribute Key conforming to the - // "cloud.availability_zone" semantic conventions. It represents the cloud - // regions often have multiple, isolated locations known as zones to - // increase availability. Availability zone represents the zone where the - // resource is running. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'us-east-1c' - // Note: Availability zones are called "zones" on Alibaba Cloud and Google - // Cloud. - CloudAvailabilityZoneKey = attribute.Key("cloud.availability_zone") - - // CloudPlatformKey is the attribute Key conforming to the "cloud.platform" - // semantic conventions. It represents the cloud platform in use. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Note: The prefix of the service SHOULD match the one specified in - // `cloud.provider`. - CloudPlatformKey = attribute.Key("cloud.platform") - - // CloudProviderKey is the attribute Key conforming to the "cloud.provider" - // semantic conventions. It represents the name of the cloud provider. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - CloudProviderKey = attribute.Key("cloud.provider") - - // CloudRegionKey is the attribute Key conforming to the "cloud.region" - // semantic conventions. It represents the geographical region the resource - // is running. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'us-central1', 'us-east-1' - // Note: Refer to your provider's docs to see the available regions, for - // example [Alibaba Cloud - // regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS - // regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), - // [Azure - // regions](https://azure.microsoft.com/global-infrastructure/geographies/), - // [Google Cloud regions](https://cloud.google.com/about/locations), or - // [Tencent Cloud - // regions](https://www.tencentcloud.com/document/product/213/6091). - CloudRegionKey = attribute.Key("cloud.region") - - // CloudResourceIDKey is the attribute Key conforming to the - // "cloud.resource_id" semantic conventions. It represents the cloud - // provider-specific native identifier of the monitored cloud resource - // (e.g. an - // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) - // on AWS, a [fully qualified resource - // ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) - // on Azure, a [full resource - // name](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // on GCP) - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'arn:aws:lambda:REGION:ACCOUNT_ID:function:my-function', - // '//run.googleapis.com/projects/PROJECT_ID/locations/LOCATION_ID/services/SERVICE_ID', - // '/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/' - // Note: On some cloud providers, it may not be possible to determine the - // full ID at startup, - // so it may be necessary to set `cloud.resource_id` as a span attribute - // instead. - // - // The exact value to use for `cloud.resource_id` depends on the cloud - // provider. - // The following well-known definitions MUST be used if you set this - // attribute and they apply: - // - // * **AWS Lambda:** The function - // [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). - // Take care not to use the "invoked ARN" directly but replace any - // [alias - // suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) - // with the resolved function version, as the same runtime instance may - // be invokable with - // multiple different aliases. - // * **GCP:** The [URI of the - // resource](https://cloud.google.com/iam/docs/full-resource-names) - // * **Azure:** The [Fully Qualified Resource - // ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) - // of the invoked function, - // *not* the function app, having the form - // `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider. - CloudResourceIDKey = attribute.Key("cloud.resource_id") -) - -var ( - // Alibaba Cloud Elastic Compute Service - CloudPlatformAlibabaCloudECS = CloudPlatformKey.String("alibaba_cloud_ecs") - // Alibaba Cloud Function Compute - CloudPlatformAlibabaCloudFc = CloudPlatformKey.String("alibaba_cloud_fc") - // Red Hat OpenShift on Alibaba Cloud - CloudPlatformAlibabaCloudOpenshift = CloudPlatformKey.String("alibaba_cloud_openshift") - // AWS Elastic Compute Cloud - CloudPlatformAWSEC2 = CloudPlatformKey.String("aws_ec2") - // AWS Elastic Container Service - CloudPlatformAWSECS = CloudPlatformKey.String("aws_ecs") - // AWS Elastic Kubernetes Service - CloudPlatformAWSEKS = CloudPlatformKey.String("aws_eks") - // AWS Lambda - CloudPlatformAWSLambda = CloudPlatformKey.String("aws_lambda") - // AWS Elastic Beanstalk - CloudPlatformAWSElasticBeanstalk = CloudPlatformKey.String("aws_elastic_beanstalk") - // AWS App Runner - CloudPlatformAWSAppRunner = CloudPlatformKey.String("aws_app_runner") - // Red Hat OpenShift on AWS (ROSA) - CloudPlatformAWSOpenshift = CloudPlatformKey.String("aws_openshift") - // Azure Virtual Machines - CloudPlatformAzureVM = CloudPlatformKey.String("azure_vm") - // Azure Container Apps - CloudPlatformAzureContainerApps = CloudPlatformKey.String("azure_container_apps") - // Azure Container Instances - CloudPlatformAzureContainerInstances = CloudPlatformKey.String("azure_container_instances") - // Azure Kubernetes Service - CloudPlatformAzureAKS = CloudPlatformKey.String("azure_aks") - // Azure Functions - CloudPlatformAzureFunctions = CloudPlatformKey.String("azure_functions") - // Azure App Service - CloudPlatformAzureAppService = CloudPlatformKey.String("azure_app_service") - // Azure Red Hat OpenShift - CloudPlatformAzureOpenshift = CloudPlatformKey.String("azure_openshift") - // Google Bare Metal Solution (BMS) - CloudPlatformGCPBareMetalSolution = CloudPlatformKey.String("gcp_bare_metal_solution") - // Google Cloud Compute Engine (GCE) - CloudPlatformGCPComputeEngine = CloudPlatformKey.String("gcp_compute_engine") - // Google Cloud Run - CloudPlatformGCPCloudRun = CloudPlatformKey.String("gcp_cloud_run") - // Google Cloud Kubernetes Engine (GKE) - CloudPlatformGCPKubernetesEngine = CloudPlatformKey.String("gcp_kubernetes_engine") - // Google Cloud Functions (GCF) - CloudPlatformGCPCloudFunctions = CloudPlatformKey.String("gcp_cloud_functions") - // Google Cloud App Engine (GAE) - CloudPlatformGCPAppEngine = CloudPlatformKey.String("gcp_app_engine") - // Red Hat OpenShift on Google Cloud - CloudPlatformGCPOpenshift = CloudPlatformKey.String("gcp_openshift") - // Red Hat OpenShift on IBM Cloud - CloudPlatformIbmCloudOpenshift = CloudPlatformKey.String("ibm_cloud_openshift") - // Tencent Cloud Cloud Virtual Machine (CVM) - CloudPlatformTencentCloudCvm = CloudPlatformKey.String("tencent_cloud_cvm") - // Tencent Cloud Elastic Kubernetes Service (EKS) - CloudPlatformTencentCloudEKS = CloudPlatformKey.String("tencent_cloud_eks") - // Tencent Cloud Serverless Cloud Function (SCF) - CloudPlatformTencentCloudScf = CloudPlatformKey.String("tencent_cloud_scf") -) - -var ( - // Alibaba Cloud - CloudProviderAlibabaCloud = CloudProviderKey.String("alibaba_cloud") - // Amazon Web Services - CloudProviderAWS = CloudProviderKey.String("aws") - // Microsoft Azure - CloudProviderAzure = CloudProviderKey.String("azure") - // Google Cloud Platform - CloudProviderGCP = CloudProviderKey.String("gcp") - // Heroku Platform as a Service - CloudProviderHeroku = CloudProviderKey.String("heroku") - // IBM Cloud - CloudProviderIbmCloud = CloudProviderKey.String("ibm_cloud") - // Tencent Cloud - CloudProviderTencentCloud = CloudProviderKey.String("tencent_cloud") -) - -// CloudAccountID returns an attribute KeyValue conforming to the -// "cloud.account.id" semantic conventions. It represents the cloud account ID -// the resource is assigned to. -func CloudAccountID(val string) attribute.KeyValue { - return CloudAccountIDKey.String(val) -} - -// CloudAvailabilityZone returns an attribute KeyValue conforming to the -// "cloud.availability_zone" semantic conventions. It represents the cloud -// regions often have multiple, isolated locations known as zones to increase -// availability. Availability zone represents the zone where the resource is -// running. -func CloudAvailabilityZone(val string) attribute.KeyValue { - return CloudAvailabilityZoneKey.String(val) -} - -// CloudRegion returns an attribute KeyValue conforming to the -// "cloud.region" semantic conventions. It represents the geographical region -// the resource is running. -func CloudRegion(val string) attribute.KeyValue { - return CloudRegionKey.String(val) -} - -// CloudResourceID returns an attribute KeyValue conforming to the -// "cloud.resource_id" semantic conventions. It represents the cloud -// provider-specific native identifier of the monitored cloud resource (e.g. an -// [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) -// on AWS, a [fully qualified resource -// ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) on -// Azure, a [full resource -// name](https://cloud.google.com/apis/design/resource_names#full_resource_name) -// on GCP) -func CloudResourceID(val string) attribute.KeyValue { - return CloudResourceIDKey.String(val) -} - -// Attributes for CloudEvents. -const ( - // CloudeventsEventIDKey is the attribute Key conforming to the - // "cloudevents.event_id" semantic conventions. It represents the - // [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) - // uniquely identifies the event. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '123e4567-e89b-12d3-a456-426614174000', '0001' - CloudeventsEventIDKey = attribute.Key("cloudevents.event_id") - - // CloudeventsEventSourceKey is the attribute Key conforming to the - // "cloudevents.event_source" semantic conventions. It represents the - // [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) - // identifies the context in which an event happened. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'https://github.com/cloudevents', - // '/cloudevents/spec/pull/123', 'my-service' - CloudeventsEventSourceKey = attribute.Key("cloudevents.event_source") - - // CloudeventsEventSpecVersionKey is the attribute Key conforming to the - // "cloudevents.event_spec_version" semantic conventions. It represents the - // [version of the CloudEvents - // specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) - // which the event uses. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1.0' - CloudeventsEventSpecVersionKey = attribute.Key("cloudevents.event_spec_version") - - // CloudeventsEventSubjectKey is the attribute Key conforming to the - // "cloudevents.event_subject" semantic conventions. It represents the - // [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) - // of the event in the context of the event producer (identified by - // source). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'mynewfile.jpg' - CloudeventsEventSubjectKey = attribute.Key("cloudevents.event_subject") - - // CloudeventsEventTypeKey is the attribute Key conforming to the - // "cloudevents.event_type" semantic conventions. It represents the - // [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) - // contains a value describing the type of event related to the originating - // occurrence. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'com.github.pull_request.opened', - // 'com.example.object.deleted.v2' - CloudeventsEventTypeKey = attribute.Key("cloudevents.event_type") -) - -// CloudeventsEventID returns an attribute KeyValue conforming to the -// "cloudevents.event_id" semantic conventions. It represents the -// [event_id](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#id) -// uniquely identifies the event. -func CloudeventsEventID(val string) attribute.KeyValue { - return CloudeventsEventIDKey.String(val) -} - -// CloudeventsEventSource returns an attribute KeyValue conforming to the -// "cloudevents.event_source" semantic conventions. It represents the -// [source](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#source-1) -// identifies the context in which an event happened. -func CloudeventsEventSource(val string) attribute.KeyValue { - return CloudeventsEventSourceKey.String(val) -} - -// CloudeventsEventSpecVersion returns an attribute KeyValue conforming to -// the "cloudevents.event_spec_version" semantic conventions. It represents the -// [version of the CloudEvents -// specification](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#specversion) -// which the event uses. -func CloudeventsEventSpecVersion(val string) attribute.KeyValue { - return CloudeventsEventSpecVersionKey.String(val) -} - -// CloudeventsEventSubject returns an attribute KeyValue conforming to the -// "cloudevents.event_subject" semantic conventions. It represents the -// [subject](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#subject) -// of the event in the context of the event producer (identified by source). -func CloudeventsEventSubject(val string) attribute.KeyValue { - return CloudeventsEventSubjectKey.String(val) -} - -// CloudeventsEventType returns an attribute KeyValue conforming to the -// "cloudevents.event_type" semantic conventions. It represents the -// [event_type](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#type) -// contains a value describing the type of event related to the originating -// occurrence. -func CloudeventsEventType(val string) attribute.KeyValue { - return CloudeventsEventTypeKey.String(val) -} - -// These attributes allow to report this unit of code and therefore to provide -// more context about the span. -const ( - // CodeColumnKey is the attribute Key conforming to the "code.column" - // semantic conventions. It represents the column number in `code.filepath` - // best representing the operation. It SHOULD point within the code unit - // named in `code.function`. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 16 - CodeColumnKey = attribute.Key("code.column") - - // CodeFilepathKey is the attribute Key conforming to the "code.filepath" - // semantic conventions. It represents the source code file name that - // identifies the code unit as uniquely as possible (preferably an absolute - // file path). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/usr/local/MyApplication/content_root/app/index.php' - CodeFilepathKey = attribute.Key("code.filepath") - - // CodeFunctionKey is the attribute Key conforming to the "code.function" - // semantic conventions. It represents the method or function name, or - // equivalent (usually rightmost part of the code unit's name). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'serveRequest' - CodeFunctionKey = attribute.Key("code.function") - - // CodeLineNumberKey is the attribute Key conforming to the "code.lineno" - // semantic conventions. It represents the line number in `code.filepath` - // best representing the operation. It SHOULD point within the code unit - // named in `code.function`. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 42 - CodeLineNumberKey = attribute.Key("code.lineno") - - // CodeNamespaceKey is the attribute Key conforming to the "code.namespace" - // semantic conventions. It represents the "namespace" within which - // `code.function` is defined. Usually the qualified class or module name, - // such that `code.namespace` + some separator + `code.function` form a - // unique identifier for the code unit. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'com.example.MyHTTPService' - CodeNamespaceKey = attribute.Key("code.namespace") - - // CodeStacktraceKey is the attribute Key conforming to the - // "code.stacktrace" semantic conventions. It represents a stacktrace as a - // string in the natural representation for the language runtime. The - // representation is to be determined and documented by each language SIG. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'at - // com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' - // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' - // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' - CodeStacktraceKey = attribute.Key("code.stacktrace") -) - -// CodeColumn returns an attribute KeyValue conforming to the "code.column" -// semantic conventions. It represents the column number in `code.filepath` -// best representing the operation. It SHOULD point within the code unit named -// in `code.function`. -func CodeColumn(val int) attribute.KeyValue { - return CodeColumnKey.Int(val) -} - -// CodeFilepath returns an attribute KeyValue conforming to the -// "code.filepath" semantic conventions. It represents the source code file -// name that identifies the code unit as uniquely as possible (preferably an -// absolute file path). -func CodeFilepath(val string) attribute.KeyValue { - return CodeFilepathKey.String(val) -} - -// CodeFunction returns an attribute KeyValue conforming to the -// "code.function" semantic conventions. It represents the method or function -// name, or equivalent (usually rightmost part of the code unit's name). -func CodeFunction(val string) attribute.KeyValue { - return CodeFunctionKey.String(val) -} - -// CodeLineNumber returns an attribute KeyValue conforming to the "code.lineno" -// semantic conventions. It represents the line number in `code.filepath` best -// representing the operation. It SHOULD point within the code unit named in -// `code.function`. -func CodeLineNumber(val int) attribute.KeyValue { - return CodeLineNumberKey.Int(val) -} - -// CodeNamespace returns an attribute KeyValue conforming to the -// "code.namespace" semantic conventions. It represents the "namespace" within -// which `code.function` is defined. Usually the qualified class or module -// name, such that `code.namespace` + some separator + `code.function` form a -// unique identifier for the code unit. -func CodeNamespace(val string) attribute.KeyValue { - return CodeNamespaceKey.String(val) -} - -// CodeStacktrace returns an attribute KeyValue conforming to the -// "code.stacktrace" semantic conventions. It represents a stacktrace as a -// string in the natural representation for the language runtime. The -// representation is to be determined and documented by each language SIG. -func CodeStacktrace(val string) attribute.KeyValue { - return CodeStacktraceKey.String(val) -} - -// A container instance. -const ( - // ContainerCommandKey is the attribute Key conforming to the - // "container.command" semantic conventions. It represents the command used - // to run the container (i.e. the command name). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'otelcontribcol' - // Note: If using embedded credentials or sensitive data, it is recommended - // to remove them to prevent potential leakage. - ContainerCommandKey = attribute.Key("container.command") - - // ContainerCommandArgsKey is the attribute Key conforming to the - // "container.command_args" semantic conventions. It represents the all the - // command arguments (including the command/executable itself) run by the - // container. [2] - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'otelcontribcol, --config, config.yaml' - ContainerCommandArgsKey = attribute.Key("container.command_args") - - // ContainerCommandLineKey is the attribute Key conforming to the - // "container.command_line" semantic conventions. It represents the full - // command run by the container as a single string representing the full - // command. [2] - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'otelcontribcol --config config.yaml' - ContainerCommandLineKey = attribute.Key("container.command_line") - - // ContainerCPUStateKey is the attribute Key conforming to the - // "container.cpu.state" semantic conventions. It represents the CPU state - // for this data point. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'user', 'kernel' - ContainerCPUStateKey = attribute.Key("container.cpu.state") - - // ContainerIDKey is the attribute Key conforming to the "container.id" - // semantic conventions. It represents the container ID. Usually a UUID, as - // for example used to [identify Docker - // containers](https://docs.docker.com/engine/reference/run/#container-identification). - // The UUID might be abbreviated. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'a3bf90e006b2' - ContainerIDKey = attribute.Key("container.id") - - // ContainerImageIDKey is the attribute Key conforming to the - // "container.image.id" semantic conventions. It represents the runtime - // specific image identifier. Usually a hash algorithm followed by a UUID. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'sha256:19c92d0a00d1b66d897bceaa7319bee0dd38a10a851c60bcec9474aa3f01e50f' - // Note: Docker defines a sha256 of the image id; `container.image.id` - // corresponds to the `Image` field from the Docker container inspect - // [API](https://docs.docker.com/engine/api/v1.43/#tag/Container/operation/ContainerInspect) - // endpoint. - // K8S defines a link to the container registry repository with digest - // `"imageID": "registry.azurecr.io - // /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625"`. - // The ID is assigned by the container runtime and can vary in different - // environments. Consider using `oci.manifest.digest` if it is important to - // identify the same image in different environments/runtimes. - ContainerImageIDKey = attribute.Key("container.image.id") - - // ContainerImageNameKey is the attribute Key conforming to the - // "container.image.name" semantic conventions. It represents the name of - // the image the container was built on. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'gcr.io/opentelemetry/operator' - ContainerImageNameKey = attribute.Key("container.image.name") - - // ContainerImageRepoDigestsKey is the attribute Key conforming to the - // "container.image.repo_digests" semantic conventions. It represents the - // repo digests of the container image as provided by the container - // runtime. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'example@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb', - // 'internal.registry.example.com:5000/example@sha256:b69959407d21e8a062e0416bf13405bb2b71ed7a84dde4158ebafacfa06f5578' - // Note: - // [Docker](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect) - // and - // [CRI](https://github.com/kubernetes/cri-api/blob/c75ef5b473bbe2d0a4fc92f82235efd665ea8e9f/pkg/apis/runtime/v1/api.proto#L1237-L1238) - // report those under the `RepoDigests` field. - ContainerImageRepoDigestsKey = attribute.Key("container.image.repo_digests") - - // ContainerImageTagsKey is the attribute Key conforming to the - // "container.image.tags" semantic conventions. It represents the container - // image tags. An example can be found in [Docker Image - // Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). - // Should be only the `` section of the full name for example from - // `registry.example.com/my-org/my-image:`. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'v1.27.1', '3.5.7-0' - ContainerImageTagsKey = attribute.Key("container.image.tags") - - // ContainerNameKey is the attribute Key conforming to the "container.name" - // semantic conventions. It represents the container name used by container - // runtime. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry-autoconf' - ContainerNameKey = attribute.Key("container.name") - - // ContainerRuntimeKey is the attribute Key conforming to the - // "container.runtime" semantic conventions. It represents the container - // runtime managing this container. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'docker', 'containerd', 'rkt' - ContainerRuntimeKey = attribute.Key("container.runtime") -) - -var ( - // When tasks of the cgroup are in user mode (Linux). When all container processes are in user mode (Windows) - ContainerCPUStateUser = ContainerCPUStateKey.String("user") - // When CPU is used by the system (host OS) - ContainerCPUStateSystem = ContainerCPUStateKey.String("system") - // When tasks of the cgroup are in kernel mode (Linux). When all container processes are in kernel mode (Windows) - ContainerCPUStateKernel = ContainerCPUStateKey.String("kernel") -) - -// ContainerCommand returns an attribute KeyValue conforming to the -// "container.command" semantic conventions. It represents the command used to -// run the container (i.e. the command name). -func ContainerCommand(val string) attribute.KeyValue { - return ContainerCommandKey.String(val) -} - -// ContainerCommandArgs returns an attribute KeyValue conforming to the -// "container.command_args" semantic conventions. It represents the all the -// command arguments (including the command/executable itself) run by the -// container. [2] -func ContainerCommandArgs(val ...string) attribute.KeyValue { - return ContainerCommandArgsKey.StringSlice(val) -} - -// ContainerCommandLine returns an attribute KeyValue conforming to the -// "container.command_line" semantic conventions. It represents the full -// command run by the container as a single string representing the full -// command. [2] -func ContainerCommandLine(val string) attribute.KeyValue { - return ContainerCommandLineKey.String(val) -} - -// ContainerID returns an attribute KeyValue conforming to the -// "container.id" semantic conventions. It represents the container ID. Usually -// a UUID, as for example used to [identify Docker -// containers](https://docs.docker.com/engine/reference/run/#container-identification). -// The UUID might be abbreviated. -func ContainerID(val string) attribute.KeyValue { - return ContainerIDKey.String(val) -} - -// ContainerImageID returns an attribute KeyValue conforming to the -// "container.image.id" semantic conventions. It represents the runtime -// specific image identifier. Usually a hash algorithm followed by a UUID. -func ContainerImageID(val string) attribute.KeyValue { - return ContainerImageIDKey.String(val) -} - -// ContainerImageName returns an attribute KeyValue conforming to the -// "container.image.name" semantic conventions. It represents the name of the -// image the container was built on. -func ContainerImageName(val string) attribute.KeyValue { - return ContainerImageNameKey.String(val) -} - -// ContainerImageRepoDigests returns an attribute KeyValue conforming to the -// "container.image.repo_digests" semantic conventions. It represents the repo -// digests of the container image as provided by the container runtime. -func ContainerImageRepoDigests(val ...string) attribute.KeyValue { - return ContainerImageRepoDigestsKey.StringSlice(val) -} - -// ContainerImageTags returns an attribute KeyValue conforming to the -// "container.image.tags" semantic conventions. It represents the container -// image tags. An example can be found in [Docker Image -// Inspect](https://docs.docker.com/engine/api/v1.43/#tag/Image/operation/ImageInspect). -// Should be only the `` section of the full name for example from -// `registry.example.com/my-org/my-image:`. -func ContainerImageTags(val ...string) attribute.KeyValue { - return ContainerImageTagsKey.StringSlice(val) -} - -// ContainerName returns an attribute KeyValue conforming to the -// "container.name" semantic conventions. It represents the container name used -// by container runtime. -func ContainerName(val string) attribute.KeyValue { - return ContainerNameKey.String(val) -} - -// ContainerRuntime returns an attribute KeyValue conforming to the -// "container.runtime" semantic conventions. It represents the container -// runtime managing this container. -func ContainerRuntime(val string) attribute.KeyValue { - return ContainerRuntimeKey.String(val) -} - -// This group defines the attributes used to describe telemetry in the context -// of databases. -const ( - // DBClientConnectionsPoolNameKey is the attribute Key conforming to the - // "db.client.connections.pool.name" semantic conventions. It represents - // the name of the connection pool; unique within the instrumented - // application. In case the connection pool implementation doesn't provide - // a name, instrumentation should use a combination of `server.address` and - // `server.port` attributes formatted as `server.address:server.port`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myDataSource' - DBClientConnectionsPoolNameKey = attribute.Key("db.client.connections.pool.name") - - // DBClientConnectionsStateKey is the attribute Key conforming to the - // "db.client.connections.state" semantic conventions. It represents the - // state of a connection in the pool - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'idle' - DBClientConnectionsStateKey = attribute.Key("db.client.connections.state") - - // DBCollectionNameKey is the attribute Key conforming to the - // "db.collection.name" semantic conventions. It represents the name of a - // collection (table, container) within the database. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'public.users', 'customers' - // Note: If the collection name is parsed from the query, it SHOULD match - // the value provided in the query and may be qualified with the schema and - // database name. - // It is RECOMMENDED to capture the value as provided by the application - // without attempting to do any case normalization. - DBCollectionNameKey = attribute.Key("db.collection.name") - - // DBNamespaceKey is the attribute Key conforming to the "db.namespace" - // semantic conventions. It represents the name of the database, fully - // qualified within the server address and port. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'customers', 'test.users' - // Note: If a database system has multiple namespace components, they - // SHOULD be concatenated (potentially using database system specific - // conventions) from most general to most specific namespace component, and - // more specific namespaces SHOULD NOT be captured without the more general - // namespaces, to ensure that "startswith" queries for the more general - // namespaces will be valid. - // Semantic conventions for individual database systems SHOULD document - // what `db.namespace` means in the context of that system. - // It is RECOMMENDED to capture the value as provided by the application - // without attempting to do any case normalization. - DBNamespaceKey = attribute.Key("db.namespace") - - // DBOperationNameKey is the attribute Key conforming to the - // "db.operation.name" semantic conventions. It represents the name of the - // operation or command being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'findAndModify', 'HMSET', 'SELECT' - // Note: It is RECOMMENDED to capture the value as provided by the - // application without attempting to do any case normalization. - DBOperationNameKey = attribute.Key("db.operation.name") - - // DBQueryTextKey is the attribute Key conforming to the "db.query.text" - // semantic conventions. It represents the database query being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'SELECT * FROM wuser_table where username = ?', 'SET mykey - // "WuValue"' - DBQueryTextKey = attribute.Key("db.query.text") - - // DBSystemKey is the attribute Key conforming to the "db.system" semantic - // conventions. It represents the database management system (DBMS) product - // as identified by the client instrumentation. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Note: The actual DBMS may differ from the one identified by the client. - // For example, when using PostgreSQL client libraries to connect to a - // CockroachDB, the `db.system` is set to `postgresql` based on the - // instrumentation's best knowledge. - DBSystemKey = attribute.Key("db.system") -) - -var ( - // idle - DBClientConnectionsStateIdle = DBClientConnectionsStateKey.String("idle") - // used - DBClientConnectionsStateUsed = DBClientConnectionsStateKey.String("used") -) - -var ( - // Some other SQL database. Fallback only. See notes - DBSystemOtherSQL = DBSystemKey.String("other_sql") - // Microsoft SQL Server - DBSystemMSSQL = DBSystemKey.String("mssql") - // Microsoft SQL Server Compact - DBSystemMssqlcompact = DBSystemKey.String("mssqlcompact") - // MySQL - DBSystemMySQL = DBSystemKey.String("mysql") - // Oracle Database - DBSystemOracle = DBSystemKey.String("oracle") - // IBM DB2 - DBSystemDB2 = DBSystemKey.String("db2") - // PostgreSQL - DBSystemPostgreSQL = DBSystemKey.String("postgresql") - // Amazon Redshift - DBSystemRedshift = DBSystemKey.String("redshift") - // Apache Hive - DBSystemHive = DBSystemKey.String("hive") - // Cloudscape - DBSystemCloudscape = DBSystemKey.String("cloudscape") - // HyperSQL DataBase - DBSystemHSQLDB = DBSystemKey.String("hsqldb") - // Progress Database - DBSystemProgress = DBSystemKey.String("progress") - // SAP MaxDB - DBSystemMaxDB = DBSystemKey.String("maxdb") - // SAP HANA - DBSystemHanaDB = DBSystemKey.String("hanadb") - // Ingres - DBSystemIngres = DBSystemKey.String("ingres") - // FirstSQL - DBSystemFirstSQL = DBSystemKey.String("firstsql") - // EnterpriseDB - DBSystemEDB = DBSystemKey.String("edb") - // InterSystems Caché - DBSystemCache = DBSystemKey.String("cache") - // Adabas (Adaptable Database System) - DBSystemAdabas = DBSystemKey.String("adabas") - // Firebird - DBSystemFirebird = DBSystemKey.String("firebird") - // Apache Derby - DBSystemDerby = DBSystemKey.String("derby") - // FileMaker - DBSystemFilemaker = DBSystemKey.String("filemaker") - // Informix - DBSystemInformix = DBSystemKey.String("informix") - // InstantDB - DBSystemInstantDB = DBSystemKey.String("instantdb") - // InterBase - DBSystemInterbase = DBSystemKey.String("interbase") - // MariaDB - DBSystemMariaDB = DBSystemKey.String("mariadb") - // Netezza - DBSystemNetezza = DBSystemKey.String("netezza") - // Pervasive PSQL - DBSystemPervasive = DBSystemKey.String("pervasive") - // PointBase - DBSystemPointbase = DBSystemKey.String("pointbase") - // SQLite - DBSystemSqlite = DBSystemKey.String("sqlite") - // Sybase - DBSystemSybase = DBSystemKey.String("sybase") - // Teradata - DBSystemTeradata = DBSystemKey.String("teradata") - // Vertica - DBSystemVertica = DBSystemKey.String("vertica") - // H2 - DBSystemH2 = DBSystemKey.String("h2") - // ColdFusion IMQ - DBSystemColdfusion = DBSystemKey.String("coldfusion") - // Apache Cassandra - DBSystemCassandra = DBSystemKey.String("cassandra") - // Apache HBase - DBSystemHBase = DBSystemKey.String("hbase") - // MongoDB - DBSystemMongoDB = DBSystemKey.String("mongodb") - // Redis - DBSystemRedis = DBSystemKey.String("redis") - // Couchbase - DBSystemCouchbase = DBSystemKey.String("couchbase") - // CouchDB - DBSystemCouchDB = DBSystemKey.String("couchdb") - // Microsoft Azure Cosmos DB - DBSystemCosmosDB = DBSystemKey.String("cosmosdb") - // Amazon DynamoDB - DBSystemDynamoDB = DBSystemKey.String("dynamodb") - // Neo4j - DBSystemNeo4j = DBSystemKey.String("neo4j") - // Apache Geode - DBSystemGeode = DBSystemKey.String("geode") - // Elasticsearch - DBSystemElasticsearch = DBSystemKey.String("elasticsearch") - // Memcached - DBSystemMemcached = DBSystemKey.String("memcached") - // CockroachDB - DBSystemCockroachdb = DBSystemKey.String("cockroachdb") - // OpenSearch - DBSystemOpensearch = DBSystemKey.String("opensearch") - // ClickHouse - DBSystemClickhouse = DBSystemKey.String("clickhouse") - // Cloud Spanner - DBSystemSpanner = DBSystemKey.String("spanner") - // Trino - DBSystemTrino = DBSystemKey.String("trino") -) - -// DBClientConnectionsPoolName returns an attribute KeyValue conforming to -// the "db.client.connections.pool.name" semantic conventions. It represents -// the name of the connection pool; unique within the instrumented application. -// In case the connection pool implementation doesn't provide a name, -// instrumentation should use a combination of `server.address` and -// `server.port` attributes formatted as `server.address:server.port`. -func DBClientConnectionsPoolName(val string) attribute.KeyValue { - return DBClientConnectionsPoolNameKey.String(val) -} - -// DBCollectionName returns an attribute KeyValue conforming to the -// "db.collection.name" semantic conventions. It represents the name of a -// collection (table, container) within the database. -func DBCollectionName(val string) attribute.KeyValue { - return DBCollectionNameKey.String(val) -} - -// DBNamespace returns an attribute KeyValue conforming to the -// "db.namespace" semantic conventions. It represents the name of the database, -// fully qualified within the server address and port. -func DBNamespace(val string) attribute.KeyValue { - return DBNamespaceKey.String(val) -} - -// DBOperationName returns an attribute KeyValue conforming to the -// "db.operation.name" semantic conventions. It represents the name of the -// operation or command being executed. -func DBOperationName(val string) attribute.KeyValue { - return DBOperationNameKey.String(val) -} - -// DBQueryText returns an attribute KeyValue conforming to the -// "db.query.text" semantic conventions. It represents the database query being -// executed. -func DBQueryText(val string) attribute.KeyValue { - return DBQueryTextKey.String(val) -} - -// This group defines attributes for Cassandra. -const ( - // DBCassandraConsistencyLevelKey is the attribute Key conforming to the - // "db.cassandra.consistency_level" semantic conventions. It represents the - // consistency level of the query. Based on consistency values from - // [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - DBCassandraConsistencyLevelKey = attribute.Key("db.cassandra.consistency_level") - - // DBCassandraCoordinatorDCKey is the attribute Key conforming to the - // "db.cassandra.coordinator.dc" semantic conventions. It represents the - // data center of the coordinating node for a query. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'us-west-2' - DBCassandraCoordinatorDCKey = attribute.Key("db.cassandra.coordinator.dc") - - // DBCassandraCoordinatorIDKey is the attribute Key conforming to the - // "db.cassandra.coordinator.id" semantic conventions. It represents the ID - // of the coordinating node for a query. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'be13faa2-8574-4d71-926d-27f16cf8a7af' - DBCassandraCoordinatorIDKey = attribute.Key("db.cassandra.coordinator.id") - - // DBCassandraIdempotenceKey is the attribute Key conforming to the - // "db.cassandra.idempotence" semantic conventions. It represents the - // whether or not the query is idempotent. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - DBCassandraIdempotenceKey = attribute.Key("db.cassandra.idempotence") - - // DBCassandraPageSizeKey is the attribute Key conforming to the - // "db.cassandra.page_size" semantic conventions. It represents the fetch - // size used for paging, i.e. how many rows will be returned at once. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 5000 - DBCassandraPageSizeKey = attribute.Key("db.cassandra.page_size") - - // DBCassandraSpeculativeExecutionCountKey is the attribute Key conforming - // to the "db.cassandra.speculative_execution_count" semantic conventions. - // It represents the number of times a query was speculatively executed. - // Not set or `0` if the query was not executed speculatively. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 0, 2 - DBCassandraSpeculativeExecutionCountKey = attribute.Key("db.cassandra.speculative_execution_count") -) - -var ( - // all - DBCassandraConsistencyLevelAll = DBCassandraConsistencyLevelKey.String("all") - // each_quorum - DBCassandraConsistencyLevelEachQuorum = DBCassandraConsistencyLevelKey.String("each_quorum") - // quorum - DBCassandraConsistencyLevelQuorum = DBCassandraConsistencyLevelKey.String("quorum") - // local_quorum - DBCassandraConsistencyLevelLocalQuorum = DBCassandraConsistencyLevelKey.String("local_quorum") - // one - DBCassandraConsistencyLevelOne = DBCassandraConsistencyLevelKey.String("one") - // two - DBCassandraConsistencyLevelTwo = DBCassandraConsistencyLevelKey.String("two") - // three - DBCassandraConsistencyLevelThree = DBCassandraConsistencyLevelKey.String("three") - // local_one - DBCassandraConsistencyLevelLocalOne = DBCassandraConsistencyLevelKey.String("local_one") - // any - DBCassandraConsistencyLevelAny = DBCassandraConsistencyLevelKey.String("any") - // serial - DBCassandraConsistencyLevelSerial = DBCassandraConsistencyLevelKey.String("serial") - // local_serial - DBCassandraConsistencyLevelLocalSerial = DBCassandraConsistencyLevelKey.String("local_serial") -) - -// DBCassandraCoordinatorDC returns an attribute KeyValue conforming to the -// "db.cassandra.coordinator.dc" semantic conventions. It represents the data -// center of the coordinating node for a query. -func DBCassandraCoordinatorDC(val string) attribute.KeyValue { - return DBCassandraCoordinatorDCKey.String(val) -} - -// DBCassandraCoordinatorID returns an attribute KeyValue conforming to the -// "db.cassandra.coordinator.id" semantic conventions. It represents the ID of -// the coordinating node for a query. -func DBCassandraCoordinatorID(val string) attribute.KeyValue { - return DBCassandraCoordinatorIDKey.String(val) -} - -// DBCassandraIdempotence returns an attribute KeyValue conforming to the -// "db.cassandra.idempotence" semantic conventions. It represents the whether -// or not the query is idempotent. -func DBCassandraIdempotence(val bool) attribute.KeyValue { - return DBCassandraIdempotenceKey.Bool(val) -} - -// DBCassandraPageSize returns an attribute KeyValue conforming to the -// "db.cassandra.page_size" semantic conventions. It represents the fetch size -// used for paging, i.e. how many rows will be returned at once. -func DBCassandraPageSize(val int) attribute.KeyValue { - return DBCassandraPageSizeKey.Int(val) -} - -// DBCassandraSpeculativeExecutionCount returns an attribute KeyValue -// conforming to the "db.cassandra.speculative_execution_count" semantic -// conventions. It represents the number of times a query was speculatively -// executed. Not set or `0` if the query was not executed speculatively. -func DBCassandraSpeculativeExecutionCount(val int) attribute.KeyValue { - return DBCassandraSpeculativeExecutionCountKey.Int(val) -} - -// This group defines attributes for Azure Cosmos DB. -const ( - // DBCosmosDBClientIDKey is the attribute Key conforming to the - // "db.cosmosdb.client_id" semantic conventions. It represents the unique - // Cosmos client instance id. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '3ba4827d-4422-483f-b59f-85b74211c11d' - DBCosmosDBClientIDKey = attribute.Key("db.cosmosdb.client_id") - - // DBCosmosDBConnectionModeKey is the attribute Key conforming to the - // "db.cosmosdb.connection_mode" semantic conventions. It represents the - // cosmos client connection mode. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - DBCosmosDBConnectionModeKey = attribute.Key("db.cosmosdb.connection_mode") - - // DBCosmosDBOperationTypeKey is the attribute Key conforming to the - // "db.cosmosdb.operation_type" semantic conventions. It represents the - // cosmosDB Operation Type. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - DBCosmosDBOperationTypeKey = attribute.Key("db.cosmosdb.operation_type") - - // DBCosmosDBRequestChargeKey is the attribute Key conforming to the - // "db.cosmosdb.request_charge" semantic conventions. It represents the rU - // consumed for that operation - // - // Type: double - // RequirementLevel: Optional - // Stability: experimental - // Examples: 46.18, 1.0 - DBCosmosDBRequestChargeKey = attribute.Key("db.cosmosdb.request_charge") - - // DBCosmosDBRequestContentLengthKey is the attribute Key conforming to the - // "db.cosmosdb.request_content_length" semantic conventions. It represents - // the request payload size in bytes - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - DBCosmosDBRequestContentLengthKey = attribute.Key("db.cosmosdb.request_content_length") - - // DBCosmosDBStatusCodeKey is the attribute Key conforming to the - // "db.cosmosdb.status_code" semantic conventions. It represents the cosmos - // DB status code. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 200, 201 - DBCosmosDBStatusCodeKey = attribute.Key("db.cosmosdb.status_code") - - // DBCosmosDBSubStatusCodeKey is the attribute Key conforming to the - // "db.cosmosdb.sub_status_code" semantic conventions. It represents the - // cosmos DB sub status code. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1000, 1002 - DBCosmosDBSubStatusCodeKey = attribute.Key("db.cosmosdb.sub_status_code") -) - -var ( - // Gateway (HTTP) connections mode - DBCosmosDBConnectionModeGateway = DBCosmosDBConnectionModeKey.String("gateway") - // Direct connection - DBCosmosDBConnectionModeDirect = DBCosmosDBConnectionModeKey.String("direct") -) - -var ( - // invalid - DBCosmosDBOperationTypeInvalid = DBCosmosDBOperationTypeKey.String("Invalid") - // create - DBCosmosDBOperationTypeCreate = DBCosmosDBOperationTypeKey.String("Create") - // patch - DBCosmosDBOperationTypePatch = DBCosmosDBOperationTypeKey.String("Patch") - // read - DBCosmosDBOperationTypeRead = DBCosmosDBOperationTypeKey.String("Read") - // read_feed - DBCosmosDBOperationTypeReadFeed = DBCosmosDBOperationTypeKey.String("ReadFeed") - // delete - DBCosmosDBOperationTypeDelete = DBCosmosDBOperationTypeKey.String("Delete") - // replace - DBCosmosDBOperationTypeReplace = DBCosmosDBOperationTypeKey.String("Replace") - // execute - DBCosmosDBOperationTypeExecute = DBCosmosDBOperationTypeKey.String("Execute") - // query - DBCosmosDBOperationTypeQuery = DBCosmosDBOperationTypeKey.String("Query") - // head - DBCosmosDBOperationTypeHead = DBCosmosDBOperationTypeKey.String("Head") - // head_feed - DBCosmosDBOperationTypeHeadFeed = DBCosmosDBOperationTypeKey.String("HeadFeed") - // upsert - DBCosmosDBOperationTypeUpsert = DBCosmosDBOperationTypeKey.String("Upsert") - // batch - DBCosmosDBOperationTypeBatch = DBCosmosDBOperationTypeKey.String("Batch") - // query_plan - DBCosmosDBOperationTypeQueryPlan = DBCosmosDBOperationTypeKey.String("QueryPlan") - // execute_javascript - DBCosmosDBOperationTypeExecuteJavascript = DBCosmosDBOperationTypeKey.String("ExecuteJavaScript") -) - -// DBCosmosDBClientID returns an attribute KeyValue conforming to the -// "db.cosmosdb.client_id" semantic conventions. It represents the unique -// Cosmos client instance id. -func DBCosmosDBClientID(val string) attribute.KeyValue { - return DBCosmosDBClientIDKey.String(val) -} - -// DBCosmosDBRequestCharge returns an attribute KeyValue conforming to the -// "db.cosmosdb.request_charge" semantic conventions. It represents the rU -// consumed for that operation -func DBCosmosDBRequestCharge(val float64) attribute.KeyValue { - return DBCosmosDBRequestChargeKey.Float64(val) -} - -// DBCosmosDBRequestContentLength returns an attribute KeyValue conforming -// to the "db.cosmosdb.request_content_length" semantic conventions. It -// represents the request payload size in bytes -func DBCosmosDBRequestContentLength(val int) attribute.KeyValue { - return DBCosmosDBRequestContentLengthKey.Int(val) -} - -// DBCosmosDBStatusCode returns an attribute KeyValue conforming to the -// "db.cosmosdb.status_code" semantic conventions. It represents the cosmos DB -// status code. -func DBCosmosDBStatusCode(val int) attribute.KeyValue { - return DBCosmosDBStatusCodeKey.Int(val) -} - -// DBCosmosDBSubStatusCode returns an attribute KeyValue conforming to the -// "db.cosmosdb.sub_status_code" semantic conventions. It represents the cosmos -// DB sub status code. -func DBCosmosDBSubStatusCode(val int) attribute.KeyValue { - return DBCosmosDBSubStatusCodeKey.Int(val) -} - -// This group defines attributes for Elasticsearch. -const ( - // DBElasticsearchClusterNameKey is the attribute Key conforming to the - // "db.elasticsearch.cluster.name" semantic conventions. It represents the - // represents the identifier of an Elasticsearch cluster. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'e9106fc68e3044f0b1475b04bf4ffd5f' - DBElasticsearchClusterNameKey = attribute.Key("db.elasticsearch.cluster.name") - - // DBElasticsearchNodeNameKey is the attribute Key conforming to the - // "db.elasticsearch.node.name" semantic conventions. It represents the - // represents the human-readable identifier of the node/instance to which a - // request was routed. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'instance-0000000001' - DBElasticsearchNodeNameKey = attribute.Key("db.elasticsearch.node.name") -) - -// DBElasticsearchClusterName returns an attribute KeyValue conforming to -// the "db.elasticsearch.cluster.name" semantic conventions. It represents the -// represents the identifier of an Elasticsearch cluster. -func DBElasticsearchClusterName(val string) attribute.KeyValue { - return DBElasticsearchClusterNameKey.String(val) -} - -// DBElasticsearchNodeName returns an attribute KeyValue conforming to the -// "db.elasticsearch.node.name" semantic conventions. It represents the -// represents the human-readable identifier of the node/instance to which a -// request was routed. -func DBElasticsearchNodeName(val string) attribute.KeyValue { - return DBElasticsearchNodeNameKey.String(val) -} - -// Attributes for software deployments. -const ( - // DeploymentEnvironmentKey is the attribute Key conforming to the - // "deployment.environment" semantic conventions. It represents the name of - // the [deployment - // environment](https://wikipedia.org/wiki/Deployment_environment) (aka - // deployment tier). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'staging', 'production' - // Note: `deployment.environment` does not affect the uniqueness - // constraints defined through - // the `service.namespace`, `service.name` and `service.instance.id` - // resource attributes. - // This implies that resources carrying the following attribute - // combinations MUST be - // considered to be identifying the same service: - // - // * `service.name=frontend`, `deployment.environment=production` - // * `service.name=frontend`, `deployment.environment=staging`. - DeploymentEnvironmentKey = attribute.Key("deployment.environment") -) - -// DeploymentEnvironment returns an attribute KeyValue conforming to the -// "deployment.environment" semantic conventions. It represents the name of the -// [deployment environment](https://wikipedia.org/wiki/Deployment_environment) -// (aka deployment tier). -func DeploymentEnvironment(val string) attribute.KeyValue { - return DeploymentEnvironmentKey.String(val) -} - -// Attributes that represents an occurrence of a lifecycle transition on the -// Android platform. -const ( - // AndroidStateKey is the attribute Key conforming to the "android.state" - // semantic conventions. It represents the deprecated use the - // `device.app.lifecycle` event definition including `android.state` as a - // payload field instead. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Note: The Android lifecycle states are defined in [Activity lifecycle - // callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), - // and from which the `OS identifiers` are derived. - AndroidStateKey = attribute.Key("android.state") -) - -var ( - // Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time - AndroidStateCreated = AndroidStateKey.String("created") - // Any time after Activity.onPause() or, if the app has no Activity, Context.stopService() has been called when the app was in the foreground state - AndroidStateBackground = AndroidStateKey.String("background") - // Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states - AndroidStateForeground = AndroidStateKey.String("foreground") -) - -// These attributes may be used to describe the receiver of a network -// exchange/packet. These should be used when there is no client/server -// relationship between the two sides, or when that relationship is unknown. -// This covers low-level network interactions (e.g. packet tracing) where you -// don't know if there was a connection or which side initiated it. This also -// covers unidirectional UDP flows and peer-to-peer communication where the -// "user-facing" surface of the protocol / API doesn't expose a clear notion of -// client and server. -const ( - // DestinationAddressKey is the attribute Key conforming to the - // "destination.address" semantic conventions. It represents the - // destination address - domain name if available without reverse DNS - // lookup; otherwise, IP address or Unix domain socket name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'destination.example.com', '10.1.2.80', '/tmp/my.sock' - // Note: When observed from the source side, and when communicating through - // an intermediary, `destination.address` SHOULD represent the destination - // address behind any intermediaries, for example proxies, if it's - // available. - DestinationAddressKey = attribute.Key("destination.address") - - // DestinationPortKey is the attribute Key conforming to the - // "destination.port" semantic conventions. It represents the destination - // port number - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 3389, 2888 - DestinationPortKey = attribute.Key("destination.port") -) - -// DestinationAddress returns an attribute KeyValue conforming to the -// "destination.address" semantic conventions. It represents the destination -// address - domain name if available without reverse DNS lookup; otherwise, IP -// address or Unix domain socket name. -func DestinationAddress(val string) attribute.KeyValue { - return DestinationAddressKey.String(val) -} - -// DestinationPort returns an attribute KeyValue conforming to the -// "destination.port" semantic conventions. It represents the destination port -// number -func DestinationPort(val int) attribute.KeyValue { - return DestinationPortKey.Int(val) -} - -// Describes device attributes. -const ( - // DeviceIDKey is the attribute Key conforming to the "device.id" semantic - // conventions. It represents a unique identifier representing the device - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2ab2916d-a51f-4ac8-80ee-45ac31a28092' - // Note: The device identifier MUST only be defined using the values - // outlined below. This value is not an advertising identifier and MUST NOT - // be used as such. On iOS (Swift or Objective-C), this value MUST be equal - // to the [vendor - // identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). - // On Android (Java or Kotlin), this value MUST be equal to the Firebase - // Installation ID or a globally unique UUID which is persisted across - // sessions in your application. More information can be found - // [here](https://developer.android.com/training/articles/user-data-ids) on - // best practices and exact implementation details. Caution should be taken - // when storing personal data or anything which can identify a user. GDPR - // and data protection laws may apply, ensure you do your own due - // diligence. - DeviceIDKey = attribute.Key("device.id") - - // DeviceManufacturerKey is the attribute Key conforming to the - // "device.manufacturer" semantic conventions. It represents the name of - // the device manufacturer - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Apple', 'Samsung' - // Note: The Android OS provides this field via - // [Build](https://developer.android.com/reference/android/os/Build#MANUFACTURER). - // iOS apps SHOULD hardcode the value `Apple`. - DeviceManufacturerKey = attribute.Key("device.manufacturer") - - // DeviceModelIdentifierKey is the attribute Key conforming to the - // "device.model.identifier" semantic conventions. It represents the model - // identifier for the device - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'iPhone3,4', 'SM-G920F' - // Note: It's recommended this value represents a machine-readable version - // of the model identifier rather than the market or consumer-friendly name - // of the device. - DeviceModelIdentifierKey = attribute.Key("device.model.identifier") - - // DeviceModelNameKey is the attribute Key conforming to the - // "device.model.name" semantic conventions. It represents the marketing - // name for the device model - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'iPhone 6s Plus', 'Samsung Galaxy S6' - // Note: It's recommended this value represents a human-readable version of - // the device model rather than a machine-readable alternative. - DeviceModelNameKey = attribute.Key("device.model.name") -) - -// DeviceID returns an attribute KeyValue conforming to the "device.id" -// semantic conventions. It represents a unique identifier representing the -// device -func DeviceID(val string) attribute.KeyValue { - return DeviceIDKey.String(val) -} - -// DeviceManufacturer returns an attribute KeyValue conforming to the -// "device.manufacturer" semantic conventions. It represents the name of the -// device manufacturer -func DeviceManufacturer(val string) attribute.KeyValue { - return DeviceManufacturerKey.String(val) -} - -// DeviceModelIdentifier returns an attribute KeyValue conforming to the -// "device.model.identifier" semantic conventions. It represents the model -// identifier for the device -func DeviceModelIdentifier(val string) attribute.KeyValue { - return DeviceModelIdentifierKey.String(val) -} - -// DeviceModelName returns an attribute KeyValue conforming to the -// "device.model.name" semantic conventions. It represents the marketing name -// for the device model -func DeviceModelName(val string) attribute.KeyValue { - return DeviceModelNameKey.String(val) -} - -// These attributes may be used for any disk related operation. -const ( - // DiskIoDirectionKey is the attribute Key conforming to the - // "disk.io.direction" semantic conventions. It represents the disk IO - // operation direction. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'read' - DiskIoDirectionKey = attribute.Key("disk.io.direction") -) - -var ( - // read - DiskIoDirectionRead = DiskIoDirectionKey.String("read") - // write - DiskIoDirectionWrite = DiskIoDirectionKey.String("write") -) - -// The shared attributes used to report a DNS query. -const ( - // DNSQuestionNameKey is the attribute Key conforming to the - // "dns.question.name" semantic conventions. It represents the name being - // queried. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'www.example.com', 'opentelemetry.io' - // Note: If the name field contains non-printable characters (below 32 or - // above 126), those characters should be represented as escaped base 10 - // integers (\DDD). Back slashes and quotes should be escaped. Tabs, - // carriage returns, and line feeds should be converted to \t, \r, and \n - // respectively. - DNSQuestionNameKey = attribute.Key("dns.question.name") -) - -// DNSQuestionName returns an attribute KeyValue conforming to the -// "dns.question.name" semantic conventions. It represents the name being -// queried. -func DNSQuestionName(val string) attribute.KeyValue { - return DNSQuestionNameKey.String(val) -} - -// Attributes for operations with an authenticated and/or authorized enduser. -const ( - // EnduserIDKey is the attribute Key conforming to the "enduser.id" - // semantic conventions. It represents the username or client_id extracted - // from the access token or - // [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header - // in the inbound request from outside the system. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'username' - EnduserIDKey = attribute.Key("enduser.id") - - // EnduserRoleKey is the attribute Key conforming to the "enduser.role" - // semantic conventions. It represents the actual/assumed role the client - // is making the request under extracted from token or application security - // context. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'admin' - EnduserRoleKey = attribute.Key("enduser.role") - - // EnduserScopeKey is the attribute Key conforming to the "enduser.scope" - // semantic conventions. It represents the scopes or granted authorities - // the client currently possesses extracted from token or application - // security context. The value would come from the scope associated with an - // [OAuth 2.0 Access - // Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute - // value in a [SAML 2.0 - // Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'read:message, write:files' - EnduserScopeKey = attribute.Key("enduser.scope") -) - -// EnduserID returns an attribute KeyValue conforming to the "enduser.id" -// semantic conventions. It represents the username or client_id extracted from -// the access token or -// [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in -// the inbound request from outside the system. -func EnduserID(val string) attribute.KeyValue { - return EnduserIDKey.String(val) -} - -// EnduserRole returns an attribute KeyValue conforming to the -// "enduser.role" semantic conventions. It represents the actual/assumed role -// the client is making the request under extracted from token or application -// security context. -func EnduserRole(val string) attribute.KeyValue { - return EnduserRoleKey.String(val) -} - -// EnduserScope returns an attribute KeyValue conforming to the -// "enduser.scope" semantic conventions. It represents the scopes or granted -// authorities the client currently possesses extracted from token or -// application security context. The value would come from the scope associated -// with an [OAuth 2.0 Access -// Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute -// value in a [SAML 2.0 -// Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). -func EnduserScope(val string) attribute.KeyValue { - return EnduserScopeKey.String(val) -} - -// The shared attributes used to report an error. -const ( - // ErrorTypeKey is the attribute Key conforming to the "error.type" - // semantic conventions. It represents the describes a class of error the - // operation ended with. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'timeout', 'java.net.UnknownHostException', - // 'server_certificate_invalid', '500' - // Note: The `error.type` SHOULD be predictable, and SHOULD have low - // cardinality. - // - // When `error.type` is set to a type (e.g., an exception type), its - // canonical class name identifying the type within the artifact SHOULD be - // used. - // - // Instrumentations SHOULD document the list of errors they report. - // - // The cardinality of `error.type` within one instrumentation library - // SHOULD be low. - // Telemetry consumers that aggregate data from multiple instrumentation - // libraries and applications - // should be prepared for `error.type` to have high cardinality at query - // time when no - // additional filters are applied. - // - // If the operation has completed successfully, instrumentations SHOULD NOT - // set `error.type`. - // - // If a specific domain defines its own set of error identifiers (such as - // HTTP or gRPC status codes), - // it's RECOMMENDED to: - // - // * Use a domain-specific attribute - // * Set `error.type` to capture all errors, regardless of whether they are - // defined within the domain-specific set or not. - ErrorTypeKey = attribute.Key("error.type") -) - -var ( - // A fallback error value to be used when the instrumentation doesn't define a custom value - ErrorTypeOther = ErrorTypeKey.String("_OTHER") -) - -// Attributes for Events represented using Log Records. -const ( - // EventNameKey is the attribute Key conforming to the "event.name" - // semantic conventions. It represents the identifies the class / type of - // event. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'browser.mouse.click', 'device.app.lifecycle' - // Note: Event names are subject to the same rules as [attribute - // names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.33.0/specification/common/attribute-naming.md). - // Notably, event names are namespaced to avoid collisions and provide a - // clean separation of semantics for events in separate domains like - // browser, mobile, and kubernetes. - EventNameKey = attribute.Key("event.name") -) - -// EventName returns an attribute KeyValue conforming to the "event.name" -// semantic conventions. It represents the identifies the class / type of -// event. -func EventName(val string) attribute.KeyValue { - return EventNameKey.String(val) -} - -// The shared attributes used to report a single exception associated with a -// span or log. -const ( - // ExceptionEscapedKey is the attribute Key conforming to the - // "exception.escaped" semantic conventions. It represents the sHOULD be - // set to true if the exception event is recorded at a point where it is - // known that the exception is escaping the scope of the span. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - // Note: An exception is considered to have escaped (or left) the scope of - // a span, - // if that span is ended while the exception is still logically "in - // flight". - // This may be actually "in flight" in some languages (e.g. if the - // exception - // is passed to a Context manager's `__exit__` method in Python) but will - // usually be caught at the point of recording the exception in most - // languages. - // - // It is usually not possible to determine at the point where an exception - // is thrown - // whether it will escape the scope of a span. - // However, it is trivial to know that an exception - // will escape, if one checks for an active exception just before ending - // the span, - // as done in the [example for recording span - // exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). - // - // It follows that an exception may still escape the scope of the span - // even if the `exception.escaped` attribute was not set or set to false, - // since the event might have been recorded at a time where it was not - // clear whether the exception will escape. - ExceptionEscapedKey = attribute.Key("exception.escaped") - - // ExceptionMessageKey is the attribute Key conforming to the - // "exception.message" semantic conventions. It represents the exception - // message. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Division by zero', "Can't convert 'int' object to str - // implicitly" - ExceptionMessageKey = attribute.Key("exception.message") - - // ExceptionStacktraceKey is the attribute Key conforming to the - // "exception.stacktrace" semantic conventions. It represents a stacktrace - // as a string in the natural representation for the language runtime. The - // representation is to be determined and documented by each language SIG. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'Exception in thread "main" java.lang.RuntimeException: Test - // exception\\n at ' - // 'com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at ' - // 'com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at ' - // 'com.example.GenerateTrace.main(GenerateTrace.java:5)' - ExceptionStacktraceKey = attribute.Key("exception.stacktrace") - - // ExceptionTypeKey is the attribute Key conforming to the "exception.type" - // semantic conventions. It represents the type of the exception (its - // fully-qualified class name, if applicable). The dynamic type of the - // exception should be preferred over the static type in languages that - // support it. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'java.net.ConnectException', 'OSError' - ExceptionTypeKey = attribute.Key("exception.type") -) - -// ExceptionEscaped returns an attribute KeyValue conforming to the -// "exception.escaped" semantic conventions. It represents the sHOULD be set to -// true if the exception event is recorded at a point where it is known that -// the exception is escaping the scope of the span. -func ExceptionEscaped(val bool) attribute.KeyValue { - return ExceptionEscapedKey.Bool(val) -} - -// ExceptionMessage returns an attribute KeyValue conforming to the -// "exception.message" semantic conventions. It represents the exception -// message. -func ExceptionMessage(val string) attribute.KeyValue { - return ExceptionMessageKey.String(val) -} - -// ExceptionStacktrace returns an attribute KeyValue conforming to the -// "exception.stacktrace" semantic conventions. It represents a stacktrace as a -// string in the natural representation for the language runtime. The -// representation is to be determined and documented by each language SIG. -func ExceptionStacktrace(val string) attribute.KeyValue { - return ExceptionStacktraceKey.String(val) -} - -// ExceptionType returns an attribute KeyValue conforming to the -// "exception.type" semantic conventions. It represents the type of the -// exception (its fully-qualified class name, if applicable). The dynamic type -// of the exception should be preferred over the static type in languages that -// support it. -func ExceptionType(val string) attribute.KeyValue { - return ExceptionTypeKey.String(val) -} - -// FaaS attributes -const ( - // FaaSColdstartKey is the attribute Key conforming to the "faas.coldstart" - // semantic conventions. It represents a boolean that is true if the - // serverless function is executed for the first time (aka cold-start). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - FaaSColdstartKey = attribute.Key("faas.coldstart") - - // FaaSCronKey is the attribute Key conforming to the "faas.cron" semantic - // conventions. It represents a string containing the schedule period as - // [Cron - // Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '0/5 * * * ? *' - FaaSCronKey = attribute.Key("faas.cron") - - // FaaSDocumentCollectionKey is the attribute Key conforming to the - // "faas.document.collection" semantic conventions. It represents the name - // of the source on which the triggering operation was performed. For - // example, in Cloud Storage or S3 corresponds to the bucket name, and in - // Cosmos DB to the database name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myBucketName', 'myDBName' - FaaSDocumentCollectionKey = attribute.Key("faas.document.collection") - - // FaaSDocumentNameKey is the attribute Key conforming to the - // "faas.document.name" semantic conventions. It represents the document - // name/table subjected to the operation. For example, in Cloud Storage or - // S3 is the name of the file, and in Cosmos DB the table name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myFile.txt', 'myTableName' - FaaSDocumentNameKey = attribute.Key("faas.document.name") - - // FaaSDocumentOperationKey is the attribute Key conforming to the - // "faas.document.operation" semantic conventions. It represents the - // describes the type of the operation that was performed on the data. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - FaaSDocumentOperationKey = attribute.Key("faas.document.operation") - - // FaaSDocumentTimeKey is the attribute Key conforming to the - // "faas.document.time" semantic conventions. It represents a string - // containing the time when the data was accessed in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format - // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2020-01-23T13:47:06Z' - FaaSDocumentTimeKey = attribute.Key("faas.document.time") - - // FaaSInstanceKey is the attribute Key conforming to the "faas.instance" - // semantic conventions. It represents the execution environment ID as a - // string, that will be potentially reused for other invocations to the - // same function/function version. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2021/06/28/[$LATEST]2f399eb14537447da05ab2a2e39309de' - // Note: * **AWS Lambda:** Use the (full) log stream name. - FaaSInstanceKey = attribute.Key("faas.instance") - - // FaaSInvocationIDKey is the attribute Key conforming to the - // "faas.invocation_id" semantic conventions. It represents the invocation - // ID of the current function invocation. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'af9d5aa4-a685-4c5f-a22b-444f80b3cc28' - FaaSInvocationIDKey = attribute.Key("faas.invocation_id") - - // FaaSInvokedNameKey is the attribute Key conforming to the - // "faas.invoked_name" semantic conventions. It represents the name of the - // invoked function. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'my-function' - // Note: SHOULD be equal to the `faas.name` resource attribute of the - // invoked function. - FaaSInvokedNameKey = attribute.Key("faas.invoked_name") - - // FaaSInvokedProviderKey is the attribute Key conforming to the - // "faas.invoked_provider" semantic conventions. It represents the cloud - // provider of the invoked function. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Note: SHOULD be equal to the `cloud.provider` resource attribute of the - // invoked function. - FaaSInvokedProviderKey = attribute.Key("faas.invoked_provider") - - // FaaSInvokedRegionKey is the attribute Key conforming to the - // "faas.invoked_region" semantic conventions. It represents the cloud - // region of the invoked function. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'eu-central-1' - // Note: SHOULD be equal to the `cloud.region` resource attribute of the - // invoked function. - FaaSInvokedRegionKey = attribute.Key("faas.invoked_region") - - // FaaSMaxMemoryKey is the attribute Key conforming to the - // "faas.max_memory" semantic conventions. It represents the amount of - // memory available to the serverless function converted to Bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 134217728 - // Note: It's recommended to set this attribute since e.g. too little - // memory can easily stop a Java AWS Lambda function from working - // correctly. On AWS Lambda, the environment variable - // `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information (which must - // be multiplied by 1,048,576). - FaaSMaxMemoryKey = attribute.Key("faas.max_memory") - - // FaaSNameKey is the attribute Key conforming to the "faas.name" semantic - // conventions. It represents the name of the single function that this - // runtime instance executes. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'my-function', 'myazurefunctionapp/some-function-name' - // Note: This is the name of the function as configured/deployed on the - // FaaS - // platform and is usually different from the name of the callback - // function (which may be stored in the - // [`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) - // span attributes). - // - // For some cloud providers, the above definition is ambiguous. The - // following - // definition of function name MUST be used for this attribute - // (and consequently the span name) for the listed cloud - // providers/products: - // - // * **Azure:** The full name `/`, i.e., function app name - // followed by a forward slash followed by the function name (this form - // can also be seen in the resource JSON for the function). - // This means that a span attribute MUST be used, as an Azure function - // app can host multiple functions that would usually share - // a TracerProvider (see also the `cloud.resource_id` attribute). - FaaSNameKey = attribute.Key("faas.name") - - // FaaSTimeKey is the attribute Key conforming to the "faas.time" semantic - // conventions. It represents a string containing the function invocation - // time in the [ISO - // 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format - // expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2020-01-23T13:47:06Z' - FaaSTimeKey = attribute.Key("faas.time") - - // FaaSTriggerKey is the attribute Key conforming to the "faas.trigger" - // semantic conventions. It represents the type of the trigger which caused - // this function invocation. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - FaaSTriggerKey = attribute.Key("faas.trigger") - - // FaaSVersionKey is the attribute Key conforming to the "faas.version" - // semantic conventions. It represents the immutable version of the - // function being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '26', 'pinkfroid-00002' - // Note: Depending on the cloud provider and platform, use: - // - // * **AWS Lambda:** The [function - // version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) - // (an integer represented as a decimal string). - // * **Google Cloud Run (Services):** The - // [revision](https://cloud.google.com/run/docs/managing/revisions) - // (i.e., the function name plus the revision suffix). - // * **Google Cloud Functions:** The value of the - // [`K_REVISION` environment - // variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). - // * **Azure Functions:** Not applicable. Do not set this attribute. - FaaSVersionKey = attribute.Key("faas.version") -) - -var ( - // When a new object is created - FaaSDocumentOperationInsert = FaaSDocumentOperationKey.String("insert") - // When an object is modified - FaaSDocumentOperationEdit = FaaSDocumentOperationKey.String("edit") - // When an object is deleted - FaaSDocumentOperationDelete = FaaSDocumentOperationKey.String("delete") -) - -var ( - // Alibaba Cloud - FaaSInvokedProviderAlibabaCloud = FaaSInvokedProviderKey.String("alibaba_cloud") - // Amazon Web Services - FaaSInvokedProviderAWS = FaaSInvokedProviderKey.String("aws") - // Microsoft Azure - FaaSInvokedProviderAzure = FaaSInvokedProviderKey.String("azure") - // Google Cloud Platform - FaaSInvokedProviderGCP = FaaSInvokedProviderKey.String("gcp") - // Tencent Cloud - FaaSInvokedProviderTencentCloud = FaaSInvokedProviderKey.String("tencent_cloud") -) - -var ( - // A response to some data source operation such as a database or filesystem read/write - FaaSTriggerDatasource = FaaSTriggerKey.String("datasource") - // To provide an answer to an inbound HTTP request - FaaSTriggerHTTP = FaaSTriggerKey.String("http") - // A function is set to be executed when messages are sent to a messaging system - FaaSTriggerPubsub = FaaSTriggerKey.String("pubsub") - // A function is scheduled to be executed regularly - FaaSTriggerTimer = FaaSTriggerKey.String("timer") - // If none of the others apply - FaaSTriggerOther = FaaSTriggerKey.String("other") -) - -// FaaSColdstart returns an attribute KeyValue conforming to the -// "faas.coldstart" semantic conventions. It represents a boolean that is true -// if the serverless function is executed for the first time (aka cold-start). -func FaaSColdstart(val bool) attribute.KeyValue { - return FaaSColdstartKey.Bool(val) -} - -// FaaSCron returns an attribute KeyValue conforming to the "faas.cron" -// semantic conventions. It represents a string containing the schedule period -// as [Cron -// Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). -func FaaSCron(val string) attribute.KeyValue { - return FaaSCronKey.String(val) -} - -// FaaSDocumentCollection returns an attribute KeyValue conforming to the -// "faas.document.collection" semantic conventions. It represents the name of -// the source on which the triggering operation was performed. For example, in -// Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the -// database name. -func FaaSDocumentCollection(val string) attribute.KeyValue { - return FaaSDocumentCollectionKey.String(val) -} - -// FaaSDocumentName returns an attribute KeyValue conforming to the -// "faas.document.name" semantic conventions. It represents the document -// name/table subjected to the operation. For example, in Cloud Storage or S3 -// is the name of the file, and in Cosmos DB the table name. -func FaaSDocumentName(val string) attribute.KeyValue { - return FaaSDocumentNameKey.String(val) -} - -// FaaSDocumentTime returns an attribute KeyValue conforming to the -// "faas.document.time" semantic conventions. It represents a string containing -// the time when the data was accessed in the [ISO -// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format -// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). -func FaaSDocumentTime(val string) attribute.KeyValue { - return FaaSDocumentTimeKey.String(val) -} - -// FaaSInstance returns an attribute KeyValue conforming to the -// "faas.instance" semantic conventions. It represents the execution -// environment ID as a string, that will be potentially reused for other -// invocations to the same function/function version. -func FaaSInstance(val string) attribute.KeyValue { - return FaaSInstanceKey.String(val) -} - -// FaaSInvocationID returns an attribute KeyValue conforming to the -// "faas.invocation_id" semantic conventions. It represents the invocation ID -// of the current function invocation. -func FaaSInvocationID(val string) attribute.KeyValue { - return FaaSInvocationIDKey.String(val) -} - -// FaaSInvokedName returns an attribute KeyValue conforming to the -// "faas.invoked_name" semantic conventions. It represents the name of the -// invoked function. -func FaaSInvokedName(val string) attribute.KeyValue { - return FaaSInvokedNameKey.String(val) -} - -// FaaSInvokedRegion returns an attribute KeyValue conforming to the -// "faas.invoked_region" semantic conventions. It represents the cloud region -// of the invoked function. -func FaaSInvokedRegion(val string) attribute.KeyValue { - return FaaSInvokedRegionKey.String(val) -} - -// FaaSMaxMemory returns an attribute KeyValue conforming to the -// "faas.max_memory" semantic conventions. It represents the amount of memory -// available to the serverless function converted to Bytes. -func FaaSMaxMemory(val int) attribute.KeyValue { - return FaaSMaxMemoryKey.Int(val) -} - -// FaaSName returns an attribute KeyValue conforming to the "faas.name" -// semantic conventions. It represents the name of the single function that -// this runtime instance executes. -func FaaSName(val string) attribute.KeyValue { - return FaaSNameKey.String(val) -} - -// FaaSTime returns an attribute KeyValue conforming to the "faas.time" -// semantic conventions. It represents a string containing the function -// invocation time in the [ISO -// 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format -// expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). -func FaaSTime(val string) attribute.KeyValue { - return FaaSTimeKey.String(val) -} - -// FaaSVersion returns an attribute KeyValue conforming to the -// "faas.version" semantic conventions. It represents the immutable version of -// the function being executed. -func FaaSVersion(val string) attribute.KeyValue { - return FaaSVersionKey.String(val) -} - -// Attributes for Feature Flags. -const ( - // FeatureFlagKeyKey is the attribute Key conforming to the - // "feature_flag.key" semantic conventions. It represents the unique - // identifier of the feature flag. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'logo-color' - FeatureFlagKeyKey = attribute.Key("feature_flag.key") - - // FeatureFlagProviderNameKey is the attribute Key conforming to the - // "feature_flag.provider_name" semantic conventions. It represents the - // name of the service provider that performs the flag evaluation. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Flag Manager' - FeatureFlagProviderNameKey = attribute.Key("feature_flag.provider_name") - - // FeatureFlagVariantKey is the attribute Key conforming to the - // "feature_flag.variant" semantic conventions. It represents the sHOULD be - // a semantic identifier for a value. If one is unavailable, a stringified - // version of the value can be used. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'red', 'true', 'on' - // Note: A semantic identifier, commonly referred to as a variant, provides - // a means - // for referring to a value without including the value itself. This can - // provide additional context for understanding the meaning behind a value. - // For example, the variant `red` maybe be used for the value `#c05543`. - // - // A stringified version of the value can be used in situations where a - // semantic identifier is unavailable. String representation of the value - // should be determined by the implementer. - FeatureFlagVariantKey = attribute.Key("feature_flag.variant") -) - -// FeatureFlagKey returns an attribute KeyValue conforming to the -// "feature_flag.key" semantic conventions. It represents the unique identifier -// of the feature flag. -func FeatureFlagKey(val string) attribute.KeyValue { - return FeatureFlagKeyKey.String(val) -} - -// FeatureFlagProviderName returns an attribute KeyValue conforming to the -// "feature_flag.provider_name" semantic conventions. It represents the name of -// the service provider that performs the flag evaluation. -func FeatureFlagProviderName(val string) attribute.KeyValue { - return FeatureFlagProviderNameKey.String(val) -} - -// FeatureFlagVariant returns an attribute KeyValue conforming to the -// "feature_flag.variant" semantic conventions. It represents the sHOULD be a -// semantic identifier for a value. If one is unavailable, a stringified -// version of the value can be used. -func FeatureFlagVariant(val string) attribute.KeyValue { - return FeatureFlagVariantKey.String(val) -} - -// Describes file attributes. -const ( - // FileDirectoryKey is the attribute Key conforming to the "file.directory" - // semantic conventions. It represents the directory where the file is - // located. It should include the drive letter, when appropriate. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/home/user', 'C:\\Program Files\\MyApp' - FileDirectoryKey = attribute.Key("file.directory") - - // FileExtensionKey is the attribute Key conforming to the "file.extension" - // semantic conventions. It represents the file extension, excluding the - // leading dot. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'png', 'gz' - // Note: When the file name has multiple extensions (example.tar.gz), only - // the last one should be captured ("gz", not "tar.gz"). - FileExtensionKey = attribute.Key("file.extension") - - // FileNameKey is the attribute Key conforming to the "file.name" semantic - // conventions. It represents the name of the file including the extension, - // without the directory. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'example.png' - FileNameKey = attribute.Key("file.name") - - // FilePathKey is the attribute Key conforming to the "file.path" semantic - // conventions. It represents the full path to the file, including the file - // name. It should include the drive letter, when appropriate. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/home/alice/example.png', 'C:\\Program - // Files\\MyApp\\myapp.exe' - FilePathKey = attribute.Key("file.path") - - // FileSizeKey is the attribute Key conforming to the "file.size" semantic - // conventions. It represents the file size in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - FileSizeKey = attribute.Key("file.size") -) - -// FileDirectory returns an attribute KeyValue conforming to the -// "file.directory" semantic conventions. It represents the directory where the -// file is located. It should include the drive letter, when appropriate. -func FileDirectory(val string) attribute.KeyValue { - return FileDirectoryKey.String(val) -} - -// FileExtension returns an attribute KeyValue conforming to the -// "file.extension" semantic conventions. It represents the file extension, -// excluding the leading dot. -func FileExtension(val string) attribute.KeyValue { - return FileExtensionKey.String(val) -} - -// FileName returns an attribute KeyValue conforming to the "file.name" -// semantic conventions. It represents the name of the file including the -// extension, without the directory. -func FileName(val string) attribute.KeyValue { - return FileNameKey.String(val) -} - -// FilePath returns an attribute KeyValue conforming to the "file.path" -// semantic conventions. It represents the full path to the file, including the -// file name. It should include the drive letter, when appropriate. -func FilePath(val string) attribute.KeyValue { - return FilePathKey.String(val) -} - -// FileSize returns an attribute KeyValue conforming to the "file.size" -// semantic conventions. It represents the file size in bytes. -func FileSize(val int) attribute.KeyValue { - return FileSizeKey.Int(val) -} - -// Attributes for Google Cloud Run. -const ( - // GCPCloudRunJobExecutionKey is the attribute Key conforming to the - // "gcp.cloud_run.job.execution" semantic conventions. It represents the - // name of the Cloud Run - // [execution](https://cloud.google.com/run/docs/managing/job-executions) - // being run for the Job, as set by the - // [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) - // environment variable. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'job-name-xxxx', 'sample-job-mdw84' - GCPCloudRunJobExecutionKey = attribute.Key("gcp.cloud_run.job.execution") - - // GCPCloudRunJobTaskIndexKey is the attribute Key conforming to the - // "gcp.cloud_run.job.task_index" semantic conventions. It represents the - // index for a task within an execution as provided by the - // [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) - // environment variable. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 0, 1 - GCPCloudRunJobTaskIndexKey = attribute.Key("gcp.cloud_run.job.task_index") -) - -// GCPCloudRunJobExecution returns an attribute KeyValue conforming to the -// "gcp.cloud_run.job.execution" semantic conventions. It represents the name -// of the Cloud Run -// [execution](https://cloud.google.com/run/docs/managing/job-executions) being -// run for the Job, as set by the -// [`CLOUD_RUN_EXECUTION`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) -// environment variable. -func GCPCloudRunJobExecution(val string) attribute.KeyValue { - return GCPCloudRunJobExecutionKey.String(val) -} - -// GCPCloudRunJobTaskIndex returns an attribute KeyValue conforming to the -// "gcp.cloud_run.job.task_index" semantic conventions. It represents the index -// for a task within an execution as provided by the -// [`CLOUD_RUN_TASK_INDEX`](https://cloud.google.com/run/docs/container-contract#jobs-env-vars) -// environment variable. -func GCPCloudRunJobTaskIndex(val int) attribute.KeyValue { - return GCPCloudRunJobTaskIndexKey.Int(val) -} - -// Attributes for Google Compute Engine (GCE). -const ( - // GCPGceInstanceHostnameKey is the attribute Key conforming to the - // "gcp.gce.instance.hostname" semantic conventions. It represents the - // hostname of a GCE instance. This is the full value of the default or - // [custom - // hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'my-host1234.example.com', - // 'sample-vm.us-west1-b.c.my-project.internal' - GCPGceInstanceHostnameKey = attribute.Key("gcp.gce.instance.hostname") - - // GCPGceInstanceNameKey is the attribute Key conforming to the - // "gcp.gce.instance.name" semantic conventions. It represents the instance - // name of a GCE instance. This is the value provided by `host.name`, the - // visible name of the instance in the Cloud Console UI, and the prefix for - // the default hostname of the instance as defined by the [default internal - // DNS - // name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'instance-1', 'my-vm-name' - GCPGceInstanceNameKey = attribute.Key("gcp.gce.instance.name") -) - -// GCPGceInstanceHostname returns an attribute KeyValue conforming to the -// "gcp.gce.instance.hostname" semantic conventions. It represents the hostname -// of a GCE instance. This is the full value of the default or [custom -// hostname](https://cloud.google.com/compute/docs/instances/custom-hostname-vm). -func GCPGceInstanceHostname(val string) attribute.KeyValue { - return GCPGceInstanceHostnameKey.String(val) -} - -// GCPGceInstanceName returns an attribute KeyValue conforming to the -// "gcp.gce.instance.name" semantic conventions. It represents the instance -// name of a GCE instance. This is the value provided by `host.name`, the -// visible name of the instance in the Cloud Console UI, and the prefix for the -// default hostname of the instance as defined by the [default internal DNS -// name](https://cloud.google.com/compute/docs/internal-dns#instance-fully-qualified-domain-names). -func GCPGceInstanceName(val string) attribute.KeyValue { - return GCPGceInstanceNameKey.String(val) -} - -// The attributes used to describe telemetry in the context of LLM (Large -// Language Models) requests and responses. -const ( - // GenAiCompletionKey is the attribute Key conforming to the - // "gen_ai.completion" semantic conventions. It represents the full - // response received from the LLM. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: "[{'role': 'assistant', 'content': 'The capital of France is - // Paris.'}]" - // Note: It's RECOMMENDED to format completions as JSON string matching - // [OpenAI messages - // format](https://platform.openai.com/docs/guides/text-generation) - GenAiCompletionKey = attribute.Key("gen_ai.completion") - - // GenAiPromptKey is the attribute Key conforming to the "gen_ai.prompt" - // semantic conventions. It represents the full prompt sent to an LLM. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: "[{'role': 'user', 'content': 'What is the capital of - // France?'}]" - // Note: It's RECOMMENDED to format prompts as JSON string matching [OpenAI - // messages - // format](https://platform.openai.com/docs/guides/text-generation) - GenAiPromptKey = attribute.Key("gen_ai.prompt") - - // GenAiRequestMaxTokensKey is the attribute Key conforming to the - // "gen_ai.request.max_tokens" semantic conventions. It represents the - // maximum number of tokens the LLM generates for a request. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 100 - GenAiRequestMaxTokensKey = attribute.Key("gen_ai.request.max_tokens") - - // GenAiRequestModelKey is the attribute Key conforming to the - // "gen_ai.request.model" semantic conventions. It represents the name of - // the LLM a request is being made to. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'gpt-4' - GenAiRequestModelKey = attribute.Key("gen_ai.request.model") - - // GenAiRequestTemperatureKey is the attribute Key conforming to the - // "gen_ai.request.temperature" semantic conventions. It represents the - // temperature setting for the LLM request. - // - // Type: double - // RequirementLevel: Optional - // Stability: experimental - // Examples: 0.0 - GenAiRequestTemperatureKey = attribute.Key("gen_ai.request.temperature") - - // GenAiRequestTopPKey is the attribute Key conforming to the - // "gen_ai.request.top_p" semantic conventions. It represents the top_p - // sampling setting for the LLM request. - // - // Type: double - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1.0 - GenAiRequestTopPKey = attribute.Key("gen_ai.request.top_p") - - // GenAiResponseFinishReasonsKey is the attribute Key conforming to the - // "gen_ai.response.finish_reasons" semantic conventions. It represents the - // array of reasons the model stopped generating tokens, corresponding to - // each generation received. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'stop' - GenAiResponseFinishReasonsKey = attribute.Key("gen_ai.response.finish_reasons") - - // GenAiResponseIDKey is the attribute Key conforming to the - // "gen_ai.response.id" semantic conventions. It represents the unique - // identifier for the completion. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'chatcmpl-123' - GenAiResponseIDKey = attribute.Key("gen_ai.response.id") - - // GenAiResponseModelKey is the attribute Key conforming to the - // "gen_ai.response.model" semantic conventions. It represents the name of - // the LLM a response was generated from. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'gpt-4-0613' - GenAiResponseModelKey = attribute.Key("gen_ai.response.model") - - // GenAiSystemKey is the attribute Key conforming to the "gen_ai.system" - // semantic conventions. It represents the Generative AI product as - // identified by the client instrumentation. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'openai' - // Note: The actual GenAI product may differ from the one identified by the - // client. For example, when using OpenAI client libraries to communicate - // with Mistral, the `gen_ai.system` is set to `openai` based on the - // instrumentation's best knowledge. - GenAiSystemKey = attribute.Key("gen_ai.system") - - // GenAiUsageCompletionTokensKey is the attribute Key conforming to the - // "gen_ai.usage.completion_tokens" semantic conventions. It represents the - // number of tokens used in the LLM response (completion). - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 180 - GenAiUsageCompletionTokensKey = attribute.Key("gen_ai.usage.completion_tokens") - - // GenAiUsagePromptTokensKey is the attribute Key conforming to the - // "gen_ai.usage.prompt_tokens" semantic conventions. It represents the - // number of tokens used in the LLM prompt. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 100 - GenAiUsagePromptTokensKey = attribute.Key("gen_ai.usage.prompt_tokens") -) - -var ( - // OpenAI - GenAiSystemOpenai = GenAiSystemKey.String("openai") -) - -// GenAiCompletion returns an attribute KeyValue conforming to the -// "gen_ai.completion" semantic conventions. It represents the full response -// received from the LLM. -func GenAiCompletion(val string) attribute.KeyValue { - return GenAiCompletionKey.String(val) -} - -// GenAiPrompt returns an attribute KeyValue conforming to the -// "gen_ai.prompt" semantic conventions. It represents the full prompt sent to -// an LLM. -func GenAiPrompt(val string) attribute.KeyValue { - return GenAiPromptKey.String(val) -} - -// GenAiRequestMaxTokens returns an attribute KeyValue conforming to the -// "gen_ai.request.max_tokens" semantic conventions. It represents the maximum -// number of tokens the LLM generates for a request. -func GenAiRequestMaxTokens(val int) attribute.KeyValue { - return GenAiRequestMaxTokensKey.Int(val) -} - -// GenAiRequestModel returns an attribute KeyValue conforming to the -// "gen_ai.request.model" semantic conventions. It represents the name of the -// LLM a request is being made to. -func GenAiRequestModel(val string) attribute.KeyValue { - return GenAiRequestModelKey.String(val) -} - -// GenAiRequestTemperature returns an attribute KeyValue conforming to the -// "gen_ai.request.temperature" semantic conventions. It represents the -// temperature setting for the LLM request. -func GenAiRequestTemperature(val float64) attribute.KeyValue { - return GenAiRequestTemperatureKey.Float64(val) -} - -// GenAiRequestTopP returns an attribute KeyValue conforming to the -// "gen_ai.request.top_p" semantic conventions. It represents the top_p -// sampling setting for the LLM request. -func GenAiRequestTopP(val float64) attribute.KeyValue { - return GenAiRequestTopPKey.Float64(val) -} - -// GenAiResponseFinishReasons returns an attribute KeyValue conforming to -// the "gen_ai.response.finish_reasons" semantic conventions. It represents the -// array of reasons the model stopped generating tokens, corresponding to each -// generation received. -func GenAiResponseFinishReasons(val ...string) attribute.KeyValue { - return GenAiResponseFinishReasonsKey.StringSlice(val) -} - -// GenAiResponseID returns an attribute KeyValue conforming to the -// "gen_ai.response.id" semantic conventions. It represents the unique -// identifier for the completion. -func GenAiResponseID(val string) attribute.KeyValue { - return GenAiResponseIDKey.String(val) -} - -// GenAiResponseModel returns an attribute KeyValue conforming to the -// "gen_ai.response.model" semantic conventions. It represents the name of the -// LLM a response was generated from. -func GenAiResponseModel(val string) attribute.KeyValue { - return GenAiResponseModelKey.String(val) -} - -// GenAiUsageCompletionTokens returns an attribute KeyValue conforming to -// the "gen_ai.usage.completion_tokens" semantic conventions. It represents the -// number of tokens used in the LLM response (completion). -func GenAiUsageCompletionTokens(val int) attribute.KeyValue { - return GenAiUsageCompletionTokensKey.Int(val) -} - -// GenAiUsagePromptTokens returns an attribute KeyValue conforming to the -// "gen_ai.usage.prompt_tokens" semantic conventions. It represents the number -// of tokens used in the LLM prompt. -func GenAiUsagePromptTokens(val int) attribute.KeyValue { - return GenAiUsagePromptTokensKey.Int(val) -} - -// Attributes for GraphQL. -const ( - // GraphqlDocumentKey is the attribute Key conforming to the - // "graphql.document" semantic conventions. It represents the GraphQL - // document being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'query findBookByID { bookByID(id: ?) { name } }' - // Note: The value may be sanitized to exclude sensitive information. - GraphqlDocumentKey = attribute.Key("graphql.document") - - // GraphqlOperationNameKey is the attribute Key conforming to the - // "graphql.operation.name" semantic conventions. It represents the name of - // the operation being executed. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'findBookByID' - GraphqlOperationNameKey = attribute.Key("graphql.operation.name") - - // GraphqlOperationTypeKey is the attribute Key conforming to the - // "graphql.operation.type" semantic conventions. It represents the type of - // the operation being executed. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'query', 'mutation', 'subscription' - GraphqlOperationTypeKey = attribute.Key("graphql.operation.type") -) - -var ( - // GraphQL query - GraphqlOperationTypeQuery = GraphqlOperationTypeKey.String("query") - // GraphQL mutation - GraphqlOperationTypeMutation = GraphqlOperationTypeKey.String("mutation") - // GraphQL subscription - GraphqlOperationTypeSubscription = GraphqlOperationTypeKey.String("subscription") -) - -// GraphqlDocument returns an attribute KeyValue conforming to the -// "graphql.document" semantic conventions. It represents the GraphQL document -// being executed. -func GraphqlDocument(val string) attribute.KeyValue { - return GraphqlDocumentKey.String(val) -} - -// GraphqlOperationName returns an attribute KeyValue conforming to the -// "graphql.operation.name" semantic conventions. It represents the name of the -// operation being executed. -func GraphqlOperationName(val string) attribute.KeyValue { - return GraphqlOperationNameKey.String(val) -} - -// Attributes for the Android platform on which the Android application is -// running. -const ( - // HerokuAppIDKey is the attribute Key conforming to the "heroku.app.id" - // semantic conventions. It represents the unique identifier for the - // application - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2daa2797-e42b-4624-9322-ec3f968df4da' - HerokuAppIDKey = attribute.Key("heroku.app.id") - - // HerokuReleaseCommitKey is the attribute Key conforming to the - // "heroku.release.commit" semantic conventions. It represents the commit - // hash for the current release - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'e6134959463efd8966b20e75b913cafe3f5ec' - HerokuReleaseCommitKey = attribute.Key("heroku.release.commit") - - // HerokuReleaseCreationTimestampKey is the attribute Key conforming to the - // "heroku.release.creation_timestamp" semantic conventions. It represents - // the time and date the release was created - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2022-10-23T18:00:42Z' - HerokuReleaseCreationTimestampKey = attribute.Key("heroku.release.creation_timestamp") -) - -// HerokuAppID returns an attribute KeyValue conforming to the -// "heroku.app.id" semantic conventions. It represents the unique identifier -// for the application -func HerokuAppID(val string) attribute.KeyValue { - return HerokuAppIDKey.String(val) -} - -// HerokuReleaseCommit returns an attribute KeyValue conforming to the -// "heroku.release.commit" semantic conventions. It represents the commit hash -// for the current release -func HerokuReleaseCommit(val string) attribute.KeyValue { - return HerokuReleaseCommitKey.String(val) -} - -// HerokuReleaseCreationTimestamp returns an attribute KeyValue conforming -// to the "heroku.release.creation_timestamp" semantic conventions. It -// represents the time and date the release was created -func HerokuReleaseCreationTimestamp(val string) attribute.KeyValue { - return HerokuReleaseCreationTimestampKey.String(val) -} - -// A host is defined as a computing instance. For example, physical servers, -// virtual machines, switches or disk array. -const ( - // HostArchKey is the attribute Key conforming to the "host.arch" semantic - // conventions. It represents the CPU architecture the host system is - // running on. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - HostArchKey = attribute.Key("host.arch") - - // HostCPUCacheL2SizeKey is the attribute Key conforming to the - // "host.cpu.cache.l2.size" semantic conventions. It represents the amount - // of level 2 memory cache available to the processor (in Bytes). - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 12288000 - HostCPUCacheL2SizeKey = attribute.Key("host.cpu.cache.l2.size") - - // HostCPUFamilyKey is the attribute Key conforming to the - // "host.cpu.family" semantic conventions. It represents the family or - // generation of the CPU. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '6', 'PA-RISC 1.1e' - HostCPUFamilyKey = attribute.Key("host.cpu.family") - - // HostCPUModelIDKey is the attribute Key conforming to the - // "host.cpu.model.id" semantic conventions. It represents the model - // identifier. It provides more granular information about the CPU, - // distinguishing it from other CPUs within the same family. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '6', '9000/778/B180L' - HostCPUModelIDKey = attribute.Key("host.cpu.model.id") - - // HostCPUModelNameKey is the attribute Key conforming to the - // "host.cpu.model.name" semantic conventions. It represents the model - // designation of the processor. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz' - HostCPUModelNameKey = attribute.Key("host.cpu.model.name") - - // HostCPUSteppingKey is the attribute Key conforming to the - // "host.cpu.stepping" semantic conventions. It represents the stepping or - // core revisions. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1', 'r1p1' - HostCPUSteppingKey = attribute.Key("host.cpu.stepping") - - // HostCPUVendorIDKey is the attribute Key conforming to the - // "host.cpu.vendor.id" semantic conventions. It represents the processor - // manufacturer identifier. A maximum 12-character string. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'GenuineIntel' - // Note: [CPUID](https://wiki.osdev.org/CPUID) command returns the vendor - // ID string in EBX, EDX and ECX registers. Writing these to memory in this - // order results in a 12-character string. - HostCPUVendorIDKey = attribute.Key("host.cpu.vendor.id") - - // HostIDKey is the attribute Key conforming to the "host.id" semantic - // conventions. It represents the unique host ID. For Cloud, this must be - // the instance_id assigned by the cloud provider. For non-containerized - // systems, this should be the `machine-id`. See the table below for the - // sources to use to determine the `machine-id` based on operating system. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'fdbf79e8af94cb7f9e8df36789187052' - HostIDKey = attribute.Key("host.id") - - // HostImageIDKey is the attribute Key conforming to the "host.image.id" - // semantic conventions. It represents the vM image ID or host OS image ID. - // For Cloud, this value is from the provider. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'ami-07b06b442921831e5' - HostImageIDKey = attribute.Key("host.image.id") - - // HostImageNameKey is the attribute Key conforming to the - // "host.image.name" semantic conventions. It represents the name of the VM - // image or OS install the host was instantiated from. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'infra-ami-eks-worker-node-7d4ec78312', 'CentOS-8-x86_64-1905' - HostImageNameKey = attribute.Key("host.image.name") - - // HostImageVersionKey is the attribute Key conforming to the - // "host.image.version" semantic conventions. It represents the version - // string of the VM image or host OS as defined in [Version - // Attributes](/docs/resource/README.md#version-attributes). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '0.1' - HostImageVersionKey = attribute.Key("host.image.version") - - // HostIPKey is the attribute Key conforming to the "host.ip" semantic - // conventions. It represents the available IP addresses of the host, - // excluding loopback interfaces. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '192.168.1.140', 'fe80::abc2:4a28:737a:609e' - // Note: IPv4 Addresses MUST be specified in dotted-quad notation. IPv6 - // addresses MUST be specified in the [RFC - // 5952](https://www.rfc-editor.org/rfc/rfc5952.html) format. - HostIPKey = attribute.Key("host.ip") - - // HostMacKey is the attribute Key conforming to the "host.mac" semantic - // conventions. It represents the available MAC addresses of the host, - // excluding loopback interfaces. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'AC-DE-48-23-45-67', 'AC-DE-48-23-45-67-01-9F' - // Note: MAC Addresses MUST be represented in [IEEE RA hexadecimal - // form](https://standards.ieee.org/wp-content/uploads/import/documents/tutorials/eui.pdf): - // as hyphen-separated octets in uppercase hexadecimal form from most to - // least significant. - HostMacKey = attribute.Key("host.mac") - - // HostNameKey is the attribute Key conforming to the "host.name" semantic - // conventions. It represents the name of the host. On Unix systems, it may - // contain what the hostname command returns, or the fully qualified - // hostname, or another name specified by the user. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry-test' - HostNameKey = attribute.Key("host.name") - - // HostTypeKey is the attribute Key conforming to the "host.type" semantic - // conventions. It represents the type of host. For Cloud, this must be the - // machine type. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'n1-standard-1' - HostTypeKey = attribute.Key("host.type") -) - -var ( - // AMD64 - HostArchAMD64 = HostArchKey.String("amd64") - // ARM32 - HostArchARM32 = HostArchKey.String("arm32") - // ARM64 - HostArchARM64 = HostArchKey.String("arm64") - // Itanium - HostArchIA64 = HostArchKey.String("ia64") - // 32-bit PowerPC - HostArchPPC32 = HostArchKey.String("ppc32") - // 64-bit PowerPC - HostArchPPC64 = HostArchKey.String("ppc64") - // IBM z/Architecture - HostArchS390x = HostArchKey.String("s390x") - // 32-bit x86 - HostArchX86 = HostArchKey.String("x86") -) - -// HostCPUCacheL2Size returns an attribute KeyValue conforming to the -// "host.cpu.cache.l2.size" semantic conventions. It represents the amount of -// level 2 memory cache available to the processor (in Bytes). -func HostCPUCacheL2Size(val int) attribute.KeyValue { - return HostCPUCacheL2SizeKey.Int(val) -} - -// HostCPUFamily returns an attribute KeyValue conforming to the -// "host.cpu.family" semantic conventions. It represents the family or -// generation of the CPU. -func HostCPUFamily(val string) attribute.KeyValue { - return HostCPUFamilyKey.String(val) -} - -// HostCPUModelID returns an attribute KeyValue conforming to the -// "host.cpu.model.id" semantic conventions. It represents the model -// identifier. It provides more granular information about the CPU, -// distinguishing it from other CPUs within the same family. -func HostCPUModelID(val string) attribute.KeyValue { - return HostCPUModelIDKey.String(val) -} - -// HostCPUModelName returns an attribute KeyValue conforming to the -// "host.cpu.model.name" semantic conventions. It represents the model -// designation of the processor. -func HostCPUModelName(val string) attribute.KeyValue { - return HostCPUModelNameKey.String(val) -} - -// HostCPUStepping returns an attribute KeyValue conforming to the -// "host.cpu.stepping" semantic conventions. It represents the stepping or core -// revisions. -func HostCPUStepping(val string) attribute.KeyValue { - return HostCPUSteppingKey.String(val) -} - -// HostCPUVendorID returns an attribute KeyValue conforming to the -// "host.cpu.vendor.id" semantic conventions. It represents the processor -// manufacturer identifier. A maximum 12-character string. -func HostCPUVendorID(val string) attribute.KeyValue { - return HostCPUVendorIDKey.String(val) -} - -// HostID returns an attribute KeyValue conforming to the "host.id" semantic -// conventions. It represents the unique host ID. For Cloud, this must be the -// instance_id assigned by the cloud provider. For non-containerized systems, -// this should be the `machine-id`. See the table below for the sources to use -// to determine the `machine-id` based on operating system. -func HostID(val string) attribute.KeyValue { - return HostIDKey.String(val) -} - -// HostImageID returns an attribute KeyValue conforming to the -// "host.image.id" semantic conventions. It represents the vM image ID or host -// OS image ID. For Cloud, this value is from the provider. -func HostImageID(val string) attribute.KeyValue { - return HostImageIDKey.String(val) -} - -// HostImageName returns an attribute KeyValue conforming to the -// "host.image.name" semantic conventions. It represents the name of the VM -// image or OS install the host was instantiated from. -func HostImageName(val string) attribute.KeyValue { - return HostImageNameKey.String(val) -} - -// HostImageVersion returns an attribute KeyValue conforming to the -// "host.image.version" semantic conventions. It represents the version string -// of the VM image or host OS as defined in [Version -// Attributes](/docs/resource/README.md#version-attributes). -func HostImageVersion(val string) attribute.KeyValue { - return HostImageVersionKey.String(val) -} - -// HostIP returns an attribute KeyValue conforming to the "host.ip" semantic -// conventions. It represents the available IP addresses of the host, excluding -// loopback interfaces. -func HostIP(val ...string) attribute.KeyValue { - return HostIPKey.StringSlice(val) -} - -// HostMac returns an attribute KeyValue conforming to the "host.mac" -// semantic conventions. It represents the available MAC addresses of the host, -// excluding loopback interfaces. -func HostMac(val ...string) attribute.KeyValue { - return HostMacKey.StringSlice(val) -} - -// HostName returns an attribute KeyValue conforming to the "host.name" -// semantic conventions. It represents the name of the host. On Unix systems, -// it may contain what the hostname command returns, or the fully qualified -// hostname, or another name specified by the user. -func HostName(val string) attribute.KeyValue { - return HostNameKey.String(val) -} - -// HostType returns an attribute KeyValue conforming to the "host.type" -// semantic conventions. It represents the type of host. For Cloud, this must -// be the machine type. -func HostType(val string) attribute.KeyValue { - return HostTypeKey.String(val) -} - -// Semantic convention attributes in the HTTP namespace. -const ( - // HTTPConnectionStateKey is the attribute Key conforming to the - // "http.connection.state" semantic conventions. It represents the state of - // the HTTP connection in the HTTP connection pool. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'active', 'idle' - HTTPConnectionStateKey = attribute.Key("http.connection.state") - - // HTTPRequestBodySizeKey is the attribute Key conforming to the - // "http.request.body.size" semantic conventions. It represents the size of - // the request payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 3495 - HTTPRequestBodySizeKey = attribute.Key("http.request.body.size") - - // HTTPRequestMethodKey is the attribute Key conforming to the - // "http.request.method" semantic conventions. It represents the hTTP - // request method. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'GET', 'POST', 'HEAD' - // Note: HTTP request method value SHOULD be "known" to the - // instrumentation. - // By default, this convention defines "known" methods as the ones listed - // in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) - // and the PATCH method defined in - // [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). - // - // If the HTTP request method is not known to instrumentation, it MUST set - // the `http.request.method` attribute to `_OTHER`. - // - // If the HTTP instrumentation could end up converting valid HTTP request - // methods to `_OTHER`, then it MUST provide a way to override - // the list of known HTTP methods. If this override is done via environment - // variable, then the environment variable MUST be named - // OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated - // list of case-sensitive known HTTP methods - // (this list MUST be a full override of the default known method, it is - // not a list of known methods in addition to the defaults). - // - // HTTP method names are case-sensitive and `http.request.method` attribute - // value MUST match a known HTTP method name exactly. - // Instrumentations for specific web frameworks that consider HTTP methods - // to be case insensitive, SHOULD populate a canonical equivalent. - // Tracing instrumentations that do so, MUST also set - // `http.request.method_original` to the original value. - HTTPRequestMethodKey = attribute.Key("http.request.method") - - // HTTPRequestMethodOriginalKey is the attribute Key conforming to the - // "http.request.method_original" semantic conventions. It represents the - // original HTTP method sent by the client in the request line. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'GeT', 'ACL', 'foo' - HTTPRequestMethodOriginalKey = attribute.Key("http.request.method_original") - - // HTTPRequestResendCountKey is the attribute Key conforming to the - // "http.request.resend_count" semantic conventions. It represents the - // ordinal number of request resending attempt (for any reason, including - // redirects). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 3 - // Note: The resend count SHOULD be updated each time an HTTP request gets - // resent by the client, regardless of what was the cause of the resending - // (e.g. redirection, authorization failure, 503 Server Unavailable, - // network issues, or any other). - HTTPRequestResendCountKey = attribute.Key("http.request.resend_count") - - // HTTPRequestSizeKey is the attribute Key conforming to the - // "http.request.size" semantic conventions. It represents the total size - // of the request in bytes. This should be the total number of bytes sent - // over the wire, including the request line (HTTP/1.1), framing (HTTP/2 - // and HTTP/3), headers, and request body if any. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1437 - HTTPRequestSizeKey = attribute.Key("http.request.size") - - // HTTPResponseBodySizeKey is the attribute Key conforming to the - // "http.response.body.size" semantic conventions. It represents the size - // of the response payload body in bytes. This is the number of bytes - // transferred excluding headers and is often, but not always, present as - // the - // [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) - // header. For requests using transport encoding, this should be the - // compressed size. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 3495 - HTTPResponseBodySizeKey = attribute.Key("http.response.body.size") - - // HTTPResponseSizeKey is the attribute Key conforming to the - // "http.response.size" semantic conventions. It represents the total size - // of the response in bytes. This should be the total number of bytes sent - // over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and - // HTTP/3), headers, and response body and trailers if any. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1437 - HTTPResponseSizeKey = attribute.Key("http.response.size") - - // HTTPResponseStatusCodeKey is the attribute Key conforming to the - // "http.response.status_code" semantic conventions. It represents the - // [HTTP response status - // code](https://tools.ietf.org/html/rfc7231#section-6). - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 200 - HTTPResponseStatusCodeKey = attribute.Key("http.response.status_code") - - // HTTPRouteKey is the attribute Key conforming to the "http.route" - // semantic conventions. It represents the matched route, that is, the path - // template in the format used by the respective server framework. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/users/:userID?', '{controller}/{action}/{id?}' - // Note: MUST NOT be populated when this is not supported by the HTTP - // server framework as the route attribute should have low-cardinality and - // the URI path can NOT substitute it. - // SHOULD include the [application - // root](/docs/http/http-spans.md#http-server-definitions) if there is one. - HTTPRouteKey = attribute.Key("http.route") -) - -var ( - // active state - HTTPConnectionStateActive = HTTPConnectionStateKey.String("active") - // idle state - HTTPConnectionStateIdle = HTTPConnectionStateKey.String("idle") -) - -var ( - // CONNECT method - HTTPRequestMethodConnect = HTTPRequestMethodKey.String("CONNECT") - // DELETE method - HTTPRequestMethodDelete = HTTPRequestMethodKey.String("DELETE") - // GET method - HTTPRequestMethodGet = HTTPRequestMethodKey.String("GET") - // HEAD method - HTTPRequestMethodHead = HTTPRequestMethodKey.String("HEAD") - // OPTIONS method - HTTPRequestMethodOptions = HTTPRequestMethodKey.String("OPTIONS") - // PATCH method - HTTPRequestMethodPatch = HTTPRequestMethodKey.String("PATCH") - // POST method - HTTPRequestMethodPost = HTTPRequestMethodKey.String("POST") - // PUT method - HTTPRequestMethodPut = HTTPRequestMethodKey.String("PUT") - // TRACE method - HTTPRequestMethodTrace = HTTPRequestMethodKey.String("TRACE") - // Any HTTP method that the instrumentation has no prior knowledge of - HTTPRequestMethodOther = HTTPRequestMethodKey.String("_OTHER") -) - -// HTTPRequestBodySize returns an attribute KeyValue conforming to the -// "http.request.body.size" semantic conventions. It represents the size of the -// request payload body in bytes. This is the number of bytes transferred -// excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPRequestBodySize(val int) attribute.KeyValue { - return HTTPRequestBodySizeKey.Int(val) -} - -// HTTPRequestMethodOriginal returns an attribute KeyValue conforming to the -// "http.request.method_original" semantic conventions. It represents the -// original HTTP method sent by the client in the request line. -func HTTPRequestMethodOriginal(val string) attribute.KeyValue { - return HTTPRequestMethodOriginalKey.String(val) -} - -// HTTPRequestResendCount returns an attribute KeyValue conforming to the -// "http.request.resend_count" semantic conventions. It represents the ordinal -// number of request resending attempt (for any reason, including redirects). -func HTTPRequestResendCount(val int) attribute.KeyValue { - return HTTPRequestResendCountKey.Int(val) -} - -// HTTPRequestSize returns an attribute KeyValue conforming to the -// "http.request.size" semantic conventions. It represents the total size of -// the request in bytes. This should be the total number of bytes sent over the -// wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), -// headers, and request body if any. -func HTTPRequestSize(val int) attribute.KeyValue { - return HTTPRequestSizeKey.Int(val) -} - -// HTTPResponseBodySize returns an attribute KeyValue conforming to the -// "http.response.body.size" semantic conventions. It represents the size of -// the response payload body in bytes. This is the number of bytes transferred -// excluding headers and is often, but not always, present as the -// [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) -// header. For requests using transport encoding, this should be the compressed -// size. -func HTTPResponseBodySize(val int) attribute.KeyValue { - return HTTPResponseBodySizeKey.Int(val) -} - -// HTTPResponseSize returns an attribute KeyValue conforming to the -// "http.response.size" semantic conventions. It represents the total size of -// the response in bytes. This should be the total number of bytes sent over -// the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), -// headers, and response body and trailers if any. -func HTTPResponseSize(val int) attribute.KeyValue { - return HTTPResponseSizeKey.Int(val) -} - -// HTTPResponseStatusCode returns an attribute KeyValue conforming to the -// "http.response.status_code" semantic conventions. It represents the [HTTP -// response status code](https://tools.ietf.org/html/rfc7231#section-6). -func HTTPResponseStatusCode(val int) attribute.KeyValue { - return HTTPResponseStatusCodeKey.Int(val) -} - -// HTTPRoute returns an attribute KeyValue conforming to the "http.route" -// semantic conventions. It represents the matched route, that is, the path -// template in the format used by the respective server framework. -func HTTPRoute(val string) attribute.KeyValue { - return HTTPRouteKey.String(val) -} - -// Java Virtual machine related attributes. -const ( - // JvmBufferPoolNameKey is the attribute Key conforming to the - // "jvm.buffer.pool.name" semantic conventions. It represents the name of - // the buffer pool. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'mapped', 'direct' - // Note: Pool names are generally obtained via - // [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). - JvmBufferPoolNameKey = attribute.Key("jvm.buffer.pool.name") - - // JvmGcActionKey is the attribute Key conforming to the "jvm.gc.action" - // semantic conventions. It represents the name of the garbage collector - // action. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'end of minor GC', 'end of major GC' - // Note: Garbage collector action is generally obtained via - // [GarbageCollectionNotificationInfo#getGcAction()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcAction()). - JvmGcActionKey = attribute.Key("jvm.gc.action") - - // JvmGcNameKey is the attribute Key conforming to the "jvm.gc.name" - // semantic conventions. It represents the name of the garbage collector. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'G1 Young Generation', 'G1 Old Generation' - // Note: Garbage collector name is generally obtained via - // [GarbageCollectionNotificationInfo#getGcName()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcName()). - JvmGcNameKey = attribute.Key("jvm.gc.name") - - // JvmMemoryPoolNameKey is the attribute Key conforming to the - // "jvm.memory.pool.name" semantic conventions. It represents the name of - // the memory pool. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'G1 Old Gen', 'G1 Eden space', 'G1 Survivor Space' - // Note: Pool names are generally obtained via - // [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). - JvmMemoryPoolNameKey = attribute.Key("jvm.memory.pool.name") - - // JvmMemoryTypeKey is the attribute Key conforming to the - // "jvm.memory.type" semantic conventions. It represents the type of - // memory. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'heap', 'non_heap' - JvmMemoryTypeKey = attribute.Key("jvm.memory.type") - - // JvmThreadDaemonKey is the attribute Key conforming to the - // "jvm.thread.daemon" semantic conventions. It represents the whether the - // thread is daemon or not. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: stable - JvmThreadDaemonKey = attribute.Key("jvm.thread.daemon") - - // JvmThreadStateKey is the attribute Key conforming to the - // "jvm.thread.state" semantic conventions. It represents the state of the - // thread. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'runnable', 'blocked' - JvmThreadStateKey = attribute.Key("jvm.thread.state") -) - -var ( - // Heap memory - JvmMemoryTypeHeap = JvmMemoryTypeKey.String("heap") - // Non-heap memory - JvmMemoryTypeNonHeap = JvmMemoryTypeKey.String("non_heap") -) - -var ( - // A thread that has not yet started is in this state - JvmThreadStateNew = JvmThreadStateKey.String("new") - // A thread executing in the Java virtual machine is in this state - JvmThreadStateRunnable = JvmThreadStateKey.String("runnable") - // A thread that is blocked waiting for a monitor lock is in this state - JvmThreadStateBlocked = JvmThreadStateKey.String("blocked") - // A thread that is waiting indefinitely for another thread to perform a particular action is in this state - JvmThreadStateWaiting = JvmThreadStateKey.String("waiting") - // A thread that is waiting for another thread to perform an action for up to a specified waiting time is in this state - JvmThreadStateTimedWaiting = JvmThreadStateKey.String("timed_waiting") - // A thread that has exited is in this state - JvmThreadStateTerminated = JvmThreadStateKey.String("terminated") -) - -// JvmBufferPoolName returns an attribute KeyValue conforming to the -// "jvm.buffer.pool.name" semantic conventions. It represents the name of the -// buffer pool. -func JvmBufferPoolName(val string) attribute.KeyValue { - return JvmBufferPoolNameKey.String(val) -} - -// JvmGcAction returns an attribute KeyValue conforming to the -// "jvm.gc.action" semantic conventions. It represents the name of the garbage -// collector action. -func JvmGcAction(val string) attribute.KeyValue { - return JvmGcActionKey.String(val) -} - -// JvmGcName returns an attribute KeyValue conforming to the "jvm.gc.name" -// semantic conventions. It represents the name of the garbage collector. -func JvmGcName(val string) attribute.KeyValue { - return JvmGcNameKey.String(val) -} - -// JvmMemoryPoolName returns an attribute KeyValue conforming to the -// "jvm.memory.pool.name" semantic conventions. It represents the name of the -// memory pool. -func JvmMemoryPoolName(val string) attribute.KeyValue { - return JvmMemoryPoolNameKey.String(val) -} - -// JvmThreadDaemon returns an attribute KeyValue conforming to the -// "jvm.thread.daemon" semantic conventions. It represents the whether the -// thread is daemon or not. -func JvmThreadDaemon(val bool) attribute.KeyValue { - return JvmThreadDaemonKey.Bool(val) -} - -// Kubernetes resource attributes. -const ( - // K8SClusterNameKey is the attribute Key conforming to the - // "k8s.cluster.name" semantic conventions. It represents the name of the - // cluster. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry-cluster' - K8SClusterNameKey = attribute.Key("k8s.cluster.name") - - // K8SClusterUIDKey is the attribute Key conforming to the - // "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for - // the cluster, set to the UID of the `kube-system` namespace. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '218fc5a9-a5f1-4b54-aa05-46717d0ab26d' - // Note: K8S doesn't have support for obtaining a cluster ID. If this is - // ever - // added, we will recommend collecting the `k8s.cluster.uid` through the - // official APIs. In the meantime, we are able to use the `uid` of the - // `kube-system` namespace as a proxy for cluster ID. Read on for the - // rationale. - // - // Every object created in a K8S cluster is assigned a distinct UID. The - // `kube-system` namespace is used by Kubernetes itself and will exist - // for the lifetime of the cluster. Using the `uid` of the `kube-system` - // namespace is a reasonable proxy for the K8S ClusterID as it will only - // change if the cluster is rebuilt. Furthermore, Kubernetes UIDs are - // UUIDs as standardized by - // [ISO/IEC 9834-8 and ITU-T - // X.667](https://www.itu.int/ITU-T/studygroups/com17/oid.html). - // Which states: - // - // > If generated according to one of the mechanisms defined in Rec. - // ITU-T X.667 | ISO/IEC 9834-8, a UUID is either guaranteed to be - // different from all other UUIDs generated before 3603 A.D., or is - // extremely likely to be different (depending on the mechanism chosen). - // - // Therefore, UIDs between clusters should be extremely unlikely to - // conflict. - K8SClusterUIDKey = attribute.Key("k8s.cluster.uid") - - // K8SContainerNameKey is the attribute Key conforming to the - // "k8s.container.name" semantic conventions. It represents the name of the - // Container from Pod specification, must be unique within a Pod. Container - // runtime usually uses different globally unique name (`container.name`). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'redis' - K8SContainerNameKey = attribute.Key("k8s.container.name") - - // K8SContainerRestartCountKey is the attribute Key conforming to the - // "k8s.container.restart_count" semantic conventions. It represents the - // number of times the container was restarted. This attribute can be used - // to identify a particular container (running or stopped) within a - // container spec. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - K8SContainerRestartCountKey = attribute.Key("k8s.container.restart_count") - - // K8SContainerStatusLastTerminatedReasonKey is the attribute Key - // conforming to the "k8s.container.status.last_terminated_reason" semantic - // conventions. It represents the last terminated reason of the Container. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Evicted', 'Error' - K8SContainerStatusLastTerminatedReasonKey = attribute.Key("k8s.container.status.last_terminated_reason") - - // K8SCronJobNameKey is the attribute Key conforming to the - // "k8s.cronjob.name" semantic conventions. It represents the name of the - // CronJob. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry' - K8SCronJobNameKey = attribute.Key("k8s.cronjob.name") - - // K8SCronJobUIDKey is the attribute Key conforming to the - // "k8s.cronjob.uid" semantic conventions. It represents the UID of the - // CronJob. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SCronJobUIDKey = attribute.Key("k8s.cronjob.uid") - - // K8SDaemonSetNameKey is the attribute Key conforming to the - // "k8s.daemonset.name" semantic conventions. It represents the name of the - // DaemonSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry' - K8SDaemonSetNameKey = attribute.Key("k8s.daemonset.name") - - // K8SDaemonSetUIDKey is the attribute Key conforming to the - // "k8s.daemonset.uid" semantic conventions. It represents the UID of the - // DaemonSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDaemonSetUIDKey = attribute.Key("k8s.daemonset.uid") - - // K8SDeploymentNameKey is the attribute Key conforming to the - // "k8s.deployment.name" semantic conventions. It represents the name of - // the Deployment. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry' - K8SDeploymentNameKey = attribute.Key("k8s.deployment.name") - - // K8SDeploymentUIDKey is the attribute Key conforming to the - // "k8s.deployment.uid" semantic conventions. It represents the UID of the - // Deployment. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SDeploymentUIDKey = attribute.Key("k8s.deployment.uid") - - // K8SJobNameKey is the attribute Key conforming to the "k8s.job.name" - // semantic conventions. It represents the name of the Job. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry' - K8SJobNameKey = attribute.Key("k8s.job.name") - - // K8SJobUIDKey is the attribute Key conforming to the "k8s.job.uid" - // semantic conventions. It represents the UID of the Job. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SJobUIDKey = attribute.Key("k8s.job.uid") - - // K8SNamespaceNameKey is the attribute Key conforming to the - // "k8s.namespace.name" semantic conventions. It represents the name of the - // namespace that the pod is running in. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'default' - K8SNamespaceNameKey = attribute.Key("k8s.namespace.name") - - // K8SNodeNameKey is the attribute Key conforming to the "k8s.node.name" - // semantic conventions. It represents the name of the Node. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'node-1' - K8SNodeNameKey = attribute.Key("k8s.node.name") - - // K8SNodeUIDKey is the attribute Key conforming to the "k8s.node.uid" - // semantic conventions. It represents the UID of the Node. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1eb3a0c6-0477-4080-a9cb-0cb7db65c6a2' - K8SNodeUIDKey = attribute.Key("k8s.node.uid") - - // K8SPodNameKey is the attribute Key conforming to the "k8s.pod.name" - // semantic conventions. It represents the name of the Pod. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry-pod-autoconf' - K8SPodNameKey = attribute.Key("k8s.pod.name") - - // K8SPodUIDKey is the attribute Key conforming to the "k8s.pod.uid" - // semantic conventions. It represents the UID of the Pod. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SPodUIDKey = attribute.Key("k8s.pod.uid") - - // K8SReplicaSetNameKey is the attribute Key conforming to the - // "k8s.replicaset.name" semantic conventions. It represents the name of - // the ReplicaSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry' - K8SReplicaSetNameKey = attribute.Key("k8s.replicaset.name") - - // K8SReplicaSetUIDKey is the attribute Key conforming to the - // "k8s.replicaset.uid" semantic conventions. It represents the UID of the - // ReplicaSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SReplicaSetUIDKey = attribute.Key("k8s.replicaset.uid") - - // K8SStatefulSetNameKey is the attribute Key conforming to the - // "k8s.statefulset.name" semantic conventions. It represents the name of - // the StatefulSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry' - K8SStatefulSetNameKey = attribute.Key("k8s.statefulset.name") - - // K8SStatefulSetUIDKey is the attribute Key conforming to the - // "k8s.statefulset.uid" semantic conventions. It represents the UID of the - // StatefulSet. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' - K8SStatefulSetUIDKey = attribute.Key("k8s.statefulset.uid") -) - -// K8SClusterName returns an attribute KeyValue conforming to the -// "k8s.cluster.name" semantic conventions. It represents the name of the -// cluster. -func K8SClusterName(val string) attribute.KeyValue { - return K8SClusterNameKey.String(val) -} - -// K8SClusterUID returns an attribute KeyValue conforming to the -// "k8s.cluster.uid" semantic conventions. It represents a pseudo-ID for the -// cluster, set to the UID of the `kube-system` namespace. -func K8SClusterUID(val string) attribute.KeyValue { - return K8SClusterUIDKey.String(val) -} - -// K8SContainerName returns an attribute KeyValue conforming to the -// "k8s.container.name" semantic conventions. It represents the name of the -// Container from Pod specification, must be unique within a Pod. Container -// runtime usually uses different globally unique name (`container.name`). -func K8SContainerName(val string) attribute.KeyValue { - return K8SContainerNameKey.String(val) -} - -// K8SContainerRestartCount returns an attribute KeyValue conforming to the -// "k8s.container.restart_count" semantic conventions. It represents the number -// of times the container was restarted. This attribute can be used to identify -// a particular container (running or stopped) within a container spec. -func K8SContainerRestartCount(val int) attribute.KeyValue { - return K8SContainerRestartCountKey.Int(val) -} - -// K8SContainerStatusLastTerminatedReason returns an attribute KeyValue -// conforming to the "k8s.container.status.last_terminated_reason" semantic -// conventions. It represents the last terminated reason of the Container. -func K8SContainerStatusLastTerminatedReason(val string) attribute.KeyValue { - return K8SContainerStatusLastTerminatedReasonKey.String(val) -} - -// K8SCronJobName returns an attribute KeyValue conforming to the -// "k8s.cronjob.name" semantic conventions. It represents the name of the -// CronJob. -func K8SCronJobName(val string) attribute.KeyValue { - return K8SCronJobNameKey.String(val) -} - -// K8SCronJobUID returns an attribute KeyValue conforming to the -// "k8s.cronjob.uid" semantic conventions. It represents the UID of the -// CronJob. -func K8SCronJobUID(val string) attribute.KeyValue { - return K8SCronJobUIDKey.String(val) -} - -// K8SDaemonSetName returns an attribute KeyValue conforming to the -// "k8s.daemonset.name" semantic conventions. It represents the name of the -// DaemonSet. -func K8SDaemonSetName(val string) attribute.KeyValue { - return K8SDaemonSetNameKey.String(val) -} - -// K8SDaemonSetUID returns an attribute KeyValue conforming to the -// "k8s.daemonset.uid" semantic conventions. It represents the UID of the -// DaemonSet. -func K8SDaemonSetUID(val string) attribute.KeyValue { - return K8SDaemonSetUIDKey.String(val) -} - -// K8SDeploymentName returns an attribute KeyValue conforming to the -// "k8s.deployment.name" semantic conventions. It represents the name of the -// Deployment. -func K8SDeploymentName(val string) attribute.KeyValue { - return K8SDeploymentNameKey.String(val) -} - -// K8SDeploymentUID returns an attribute KeyValue conforming to the -// "k8s.deployment.uid" semantic conventions. It represents the UID of the -// Deployment. -func K8SDeploymentUID(val string) attribute.KeyValue { - return K8SDeploymentUIDKey.String(val) -} - -// K8SJobName returns an attribute KeyValue conforming to the "k8s.job.name" -// semantic conventions. It represents the name of the Job. -func K8SJobName(val string) attribute.KeyValue { - return K8SJobNameKey.String(val) -} - -// K8SJobUID returns an attribute KeyValue conforming to the "k8s.job.uid" -// semantic conventions. It represents the UID of the Job. -func K8SJobUID(val string) attribute.KeyValue { - return K8SJobUIDKey.String(val) -} - -// K8SNamespaceName returns an attribute KeyValue conforming to the -// "k8s.namespace.name" semantic conventions. It represents the name of the -// namespace that the pod is running in. -func K8SNamespaceName(val string) attribute.KeyValue { - return K8SNamespaceNameKey.String(val) -} - -// K8SNodeName returns an attribute KeyValue conforming to the -// "k8s.node.name" semantic conventions. It represents the name of the Node. -func K8SNodeName(val string) attribute.KeyValue { - return K8SNodeNameKey.String(val) -} - -// K8SNodeUID returns an attribute KeyValue conforming to the "k8s.node.uid" -// semantic conventions. It represents the UID of the Node. -func K8SNodeUID(val string) attribute.KeyValue { - return K8SNodeUIDKey.String(val) -} - -// K8SPodName returns an attribute KeyValue conforming to the "k8s.pod.name" -// semantic conventions. It represents the name of the Pod. -func K8SPodName(val string) attribute.KeyValue { - return K8SPodNameKey.String(val) -} - -// K8SPodUID returns an attribute KeyValue conforming to the "k8s.pod.uid" -// semantic conventions. It represents the UID of the Pod. -func K8SPodUID(val string) attribute.KeyValue { - return K8SPodUIDKey.String(val) -} - -// K8SReplicaSetName returns an attribute KeyValue conforming to the -// "k8s.replicaset.name" semantic conventions. It represents the name of the -// ReplicaSet. -func K8SReplicaSetName(val string) attribute.KeyValue { - return K8SReplicaSetNameKey.String(val) -} - -// K8SReplicaSetUID returns an attribute KeyValue conforming to the -// "k8s.replicaset.uid" semantic conventions. It represents the UID of the -// ReplicaSet. -func K8SReplicaSetUID(val string) attribute.KeyValue { - return K8SReplicaSetUIDKey.String(val) -} - -// K8SStatefulSetName returns an attribute KeyValue conforming to the -// "k8s.statefulset.name" semantic conventions. It represents the name of the -// StatefulSet. -func K8SStatefulSetName(val string) attribute.KeyValue { - return K8SStatefulSetNameKey.String(val) -} - -// K8SStatefulSetUID returns an attribute KeyValue conforming to the -// "k8s.statefulset.uid" semantic conventions. It represents the UID of the -// StatefulSet. -func K8SStatefulSetUID(val string) attribute.KeyValue { - return K8SStatefulSetUIDKey.String(val) -} - -// Log attributes -const ( - // LogIostreamKey is the attribute Key conforming to the "log.iostream" - // semantic conventions. It represents the stream associated with the log. - // See below for a list of well-known values. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - LogIostreamKey = attribute.Key("log.iostream") -) - -var ( - // Logs from stdout stream - LogIostreamStdout = LogIostreamKey.String("stdout") - // Events from stderr stream - LogIostreamStderr = LogIostreamKey.String("stderr") -) - -// Attributes for a file to which log was emitted. -const ( - // LogFileNameKey is the attribute Key conforming to the "log.file.name" - // semantic conventions. It represents the basename of the file. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'audit.log' - LogFileNameKey = attribute.Key("log.file.name") - - // LogFileNameResolvedKey is the attribute Key conforming to the - // "log.file.name_resolved" semantic conventions. It represents the - // basename of the file, with symlinks resolved. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'uuid.log' - LogFileNameResolvedKey = attribute.Key("log.file.name_resolved") - - // LogFilePathKey is the attribute Key conforming to the "log.file.path" - // semantic conventions. It represents the full path to the file. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/var/log/mysql/audit.log' - LogFilePathKey = attribute.Key("log.file.path") - - // LogFilePathResolvedKey is the attribute Key conforming to the - // "log.file.path_resolved" semantic conventions. It represents the full - // path to the file, with symlinks resolved. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/var/lib/docker/uuid.log' - LogFilePathResolvedKey = attribute.Key("log.file.path_resolved") -) - -// LogFileName returns an attribute KeyValue conforming to the -// "log.file.name" semantic conventions. It represents the basename of the -// file. -func LogFileName(val string) attribute.KeyValue { - return LogFileNameKey.String(val) -} - -// LogFileNameResolved returns an attribute KeyValue conforming to the -// "log.file.name_resolved" semantic conventions. It represents the basename of -// the file, with symlinks resolved. -func LogFileNameResolved(val string) attribute.KeyValue { - return LogFileNameResolvedKey.String(val) -} - -// LogFilePath returns an attribute KeyValue conforming to the -// "log.file.path" semantic conventions. It represents the full path to the -// file. -func LogFilePath(val string) attribute.KeyValue { - return LogFilePathKey.String(val) -} - -// LogFilePathResolved returns an attribute KeyValue conforming to the -// "log.file.path_resolved" semantic conventions. It represents the full path -// to the file, with symlinks resolved. -func LogFilePathResolved(val string) attribute.KeyValue { - return LogFilePathResolvedKey.String(val) -} - -// The generic attributes that may be used in any Log Record. -const ( - // LogRecordUIDKey is the attribute Key conforming to the "log.record.uid" - // semantic conventions. It represents a unique identifier for the Log - // Record. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '01ARZ3NDEKTSV4RRFFQ69G5FAV' - // Note: If an id is provided, other log records with the same id will be - // considered duplicates and can be removed safely. This means, that two - // distinguishable log records MUST have different values. - // The id MAY be an [Universally Unique Lexicographically Sortable - // Identifier (ULID)](https://github.com/ulid/spec), but other identifiers - // (e.g. UUID) may be used as needed. - LogRecordUIDKey = attribute.Key("log.record.uid") -) - -// LogRecordUID returns an attribute KeyValue conforming to the -// "log.record.uid" semantic conventions. It represents a unique identifier for -// the Log Record. -func LogRecordUID(val string) attribute.KeyValue { - return LogRecordUIDKey.String(val) -} - -// Attributes describing telemetry around messaging systems and messaging -// activities. -const ( - // MessagingBatchMessageCountKey is the attribute Key conforming to the - // "messaging.batch.message_count" semantic conventions. It represents the - // number of messages sent, received, or processed in the scope of the - // batching operation. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 0, 1, 2 - // Note: Instrumentations SHOULD NOT set `messaging.batch.message_count` on - // spans that operate with a single message. When a messaging client - // library supports both batch and single-message API for the same - // operation, instrumentations SHOULD use `messaging.batch.message_count` - // for batching APIs and SHOULD NOT use it for single-message APIs. - MessagingBatchMessageCountKey = attribute.Key("messaging.batch.message_count") - - // MessagingClientIDKey is the attribute Key conforming to the - // "messaging.client.id" semantic conventions. It represents a unique - // identifier for the client that consumes or produces a message. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'client-5', 'myhost@8742@s8083jm' - MessagingClientIDKey = attribute.Key("messaging.client.id") - - // MessagingDestinationAnonymousKey is the attribute Key conforming to the - // "messaging.destination.anonymous" semantic conventions. It represents a - // boolean that is true if the message destination is anonymous (could be - // unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - MessagingDestinationAnonymousKey = attribute.Key("messaging.destination.anonymous") - - // MessagingDestinationNameKey is the attribute Key conforming to the - // "messaging.destination.name" semantic conventions. It represents the - // message destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'MyQueue', 'MyTopic' - // Note: Destination name SHOULD uniquely identify a specific queue, topic - // or other entity within the broker. If - // the broker doesn't have such notion, the destination name SHOULD - // uniquely identify the broker. - MessagingDestinationNameKey = attribute.Key("messaging.destination.name") - - // MessagingDestinationPartitionIDKey is the attribute Key conforming to - // the "messaging.destination.partition.id" semantic conventions. It - // represents the identifier of the partition messages are sent to or - // received from, unique within the `messaging.destination.name`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1' - MessagingDestinationPartitionIDKey = attribute.Key("messaging.destination.partition.id") - - // MessagingDestinationTemplateKey is the attribute Key conforming to the - // "messaging.destination.template" semantic conventions. It represents the - // low cardinality representation of the messaging destination name - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/customers/{customerID}' - // Note: Destination names could be constructed from templates. An example - // would be a destination name involving a user name or product id. - // Although the destination name in this case is of high cardinality, the - // underlying template is of low cardinality and can be effectively used - // for grouping and aggregation. - MessagingDestinationTemplateKey = attribute.Key("messaging.destination.template") - - // MessagingDestinationTemporaryKey is the attribute Key conforming to the - // "messaging.destination.temporary" semantic conventions. It represents a - // boolean that is true if the message destination is temporary and might - // not exist anymore after messages are processed. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - MessagingDestinationTemporaryKey = attribute.Key("messaging.destination.temporary") - - // MessagingDestinationPublishAnonymousKey is the attribute Key conforming - // to the "messaging.destination_publish.anonymous" semantic conventions. - // It represents a boolean that is true if the publish message destination - // is anonymous (could be unnamed or have auto-generated name). - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - MessagingDestinationPublishAnonymousKey = attribute.Key("messaging.destination_publish.anonymous") - - // MessagingDestinationPublishNameKey is the attribute Key conforming to - // the "messaging.destination_publish.name" semantic conventions. It - // represents the name of the original destination the message was - // published to - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'MyQueue', 'MyTopic' - // Note: The name SHOULD uniquely identify a specific queue, topic, or - // other entity within the broker. If - // the broker doesn't have such notion, the original destination name - // SHOULD uniquely identify the broker. - MessagingDestinationPublishNameKey = attribute.Key("messaging.destination_publish.name") - - // MessagingMessageBodySizeKey is the attribute Key conforming to the - // "messaging.message.body.size" semantic conventions. It represents the - // size of the message body in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1439 - // Note: This can refer to both the compressed or uncompressed body size. - // If both sizes are known, the uncompressed - // body size should be used. - MessagingMessageBodySizeKey = attribute.Key("messaging.message.body.size") - - // MessagingMessageConversationIDKey is the attribute Key conforming to the - // "messaging.message.conversation_id" semantic conventions. It represents - // the conversation ID identifying the conversation to which the message - // belongs, represented as a string. Sometimes called "Correlation ID". - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'MyConversationID' - MessagingMessageConversationIDKey = attribute.Key("messaging.message.conversation_id") - - // MessagingMessageEnvelopeSizeKey is the attribute Key conforming to the - // "messaging.message.envelope.size" semantic conventions. It represents - // the size of the message body and metadata in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 2738 - // Note: This can refer to both the compressed or uncompressed size. If - // both sizes are known, the uncompressed - // size should be used. - MessagingMessageEnvelopeSizeKey = attribute.Key("messaging.message.envelope.size") - - // MessagingMessageIDKey is the attribute Key conforming to the - // "messaging.message.id" semantic conventions. It represents a value used - // by the messaging system as an identifier for the message, represented as - // a string. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '452a7c7c7c7048c2f887f61572b18fc2' - MessagingMessageIDKey = attribute.Key("messaging.message.id") - - // MessagingOperationNameKey is the attribute Key conforming to the - // "messaging.operation.name" semantic conventions. It represents the - // system-specific name of the messaging operation. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'ack', 'nack', 'send' - MessagingOperationNameKey = attribute.Key("messaging.operation.name") - - // MessagingOperationTypeKey is the attribute Key conforming to the - // "messaging.operation.type" semantic conventions. It represents a string - // identifying the type of the messaging operation. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Note: If a custom value is used, it MUST be of low cardinality. - MessagingOperationTypeKey = attribute.Key("messaging.operation.type") - - // MessagingSystemKey is the attribute Key conforming to the - // "messaging.system" semantic conventions. It represents the messaging - // system as identified by the client instrumentation. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Note: The actual messaging system may differ from the one known by the - // client. For example, when using Kafka client libraries to communicate - // with Azure Event Hubs, the `messaging.system` is set to `kafka` based on - // the instrumentation's best knowledge. - MessagingSystemKey = attribute.Key("messaging.system") -) - -var ( - // One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created - MessagingOperationTypePublish = MessagingOperationTypeKey.String("publish") - // A message is created. "Create" spans always refer to a single message and are used to provide a unique creation context for messages in batch publishing scenarios - MessagingOperationTypeCreate = MessagingOperationTypeKey.String("create") - // One or more messages are requested by a consumer. This operation refers to pull-based scenarios, where consumers explicitly call methods of messaging SDKs to receive messages - MessagingOperationTypeReceive = MessagingOperationTypeKey.String("receive") - // One or more messages are delivered to or processed by a consumer - MessagingOperationTypeDeliver = MessagingOperationTypeKey.String("process") - // One or more messages are settled - MessagingOperationTypeSettle = MessagingOperationTypeKey.String("settle") -) - -var ( - // Apache ActiveMQ - MessagingSystemActivemq = MessagingSystemKey.String("activemq") - // Amazon Simple Queue Service (SQS) - MessagingSystemAWSSqs = MessagingSystemKey.String("aws_sqs") - // Azure Event Grid - MessagingSystemEventgrid = MessagingSystemKey.String("eventgrid") - // Azure Event Hubs - MessagingSystemEventhubs = MessagingSystemKey.String("eventhubs") - // Azure Service Bus - MessagingSystemServicebus = MessagingSystemKey.String("servicebus") - // Google Cloud Pub/Sub - MessagingSystemGCPPubsub = MessagingSystemKey.String("gcp_pubsub") - // Java Message Service - MessagingSystemJms = MessagingSystemKey.String("jms") - // Apache Kafka - MessagingSystemKafka = MessagingSystemKey.String("kafka") - // RabbitMQ - MessagingSystemRabbitmq = MessagingSystemKey.String("rabbitmq") - // Apache RocketMQ - MessagingSystemRocketmq = MessagingSystemKey.String("rocketmq") -) - -// MessagingBatchMessageCount returns an attribute KeyValue conforming to -// the "messaging.batch.message_count" semantic conventions. It represents the -// number of messages sent, received, or processed in the scope of the batching -// operation. -func MessagingBatchMessageCount(val int) attribute.KeyValue { - return MessagingBatchMessageCountKey.Int(val) -} - -// MessagingClientID returns an attribute KeyValue conforming to the -// "messaging.client.id" semantic conventions. It represents a unique -// identifier for the client that consumes or produces a message. -func MessagingClientID(val string) attribute.KeyValue { - return MessagingClientIDKey.String(val) -} - -// MessagingDestinationAnonymous returns an attribute KeyValue conforming to -// the "messaging.destination.anonymous" semantic conventions. It represents a -// boolean that is true if the message destination is anonymous (could be -// unnamed or have auto-generated name). -func MessagingDestinationAnonymous(val bool) attribute.KeyValue { - return MessagingDestinationAnonymousKey.Bool(val) -} - -// MessagingDestinationName returns an attribute KeyValue conforming to the -// "messaging.destination.name" semantic conventions. It represents the message -// destination name -func MessagingDestinationName(val string) attribute.KeyValue { - return MessagingDestinationNameKey.String(val) -} - -// MessagingDestinationPartitionID returns an attribute KeyValue conforming -// to the "messaging.destination.partition.id" semantic conventions. It -// represents the identifier of the partition messages are sent to or received -// from, unique within the `messaging.destination.name`. -func MessagingDestinationPartitionID(val string) attribute.KeyValue { - return MessagingDestinationPartitionIDKey.String(val) -} - -// MessagingDestinationTemplate returns an attribute KeyValue conforming to -// the "messaging.destination.template" semantic conventions. It represents the -// low cardinality representation of the messaging destination name -func MessagingDestinationTemplate(val string) attribute.KeyValue { - return MessagingDestinationTemplateKey.String(val) -} - -// MessagingDestinationTemporary returns an attribute KeyValue conforming to -// the "messaging.destination.temporary" semantic conventions. It represents a -// boolean that is true if the message destination is temporary and might not -// exist anymore after messages are processed. -func MessagingDestinationTemporary(val bool) attribute.KeyValue { - return MessagingDestinationTemporaryKey.Bool(val) -} - -// MessagingDestinationPublishAnonymous returns an attribute KeyValue -// conforming to the "messaging.destination_publish.anonymous" semantic -// conventions. It represents a boolean that is true if the publish message -// destination is anonymous (could be unnamed or have auto-generated name). -func MessagingDestinationPublishAnonymous(val bool) attribute.KeyValue { - return MessagingDestinationPublishAnonymousKey.Bool(val) -} - -// MessagingDestinationPublishName returns an attribute KeyValue conforming -// to the "messaging.destination_publish.name" semantic conventions. It -// represents the name of the original destination the message was published to -func MessagingDestinationPublishName(val string) attribute.KeyValue { - return MessagingDestinationPublishNameKey.String(val) -} - -// MessagingMessageBodySize returns an attribute KeyValue conforming to the -// "messaging.message.body.size" semantic conventions. It represents the size -// of the message body in bytes. -func MessagingMessageBodySize(val int) attribute.KeyValue { - return MessagingMessageBodySizeKey.Int(val) -} - -// MessagingMessageConversationID returns an attribute KeyValue conforming -// to the "messaging.message.conversation_id" semantic conventions. It -// represents the conversation ID identifying the conversation to which the -// message belongs, represented as a string. Sometimes called "Correlation ID". -func MessagingMessageConversationID(val string) attribute.KeyValue { - return MessagingMessageConversationIDKey.String(val) -} - -// MessagingMessageEnvelopeSize returns an attribute KeyValue conforming to -// the "messaging.message.envelope.size" semantic conventions. It represents -// the size of the message body and metadata in bytes. -func MessagingMessageEnvelopeSize(val int) attribute.KeyValue { - return MessagingMessageEnvelopeSizeKey.Int(val) -} - -// MessagingMessageID returns an attribute KeyValue conforming to the -// "messaging.message.id" semantic conventions. It represents a value used by -// the messaging system as an identifier for the message, represented as a -// string. -func MessagingMessageID(val string) attribute.KeyValue { - return MessagingMessageIDKey.String(val) -} - -// MessagingOperationName returns an attribute KeyValue conforming to the -// "messaging.operation.name" semantic conventions. It represents the -// system-specific name of the messaging operation. -func MessagingOperationName(val string) attribute.KeyValue { - return MessagingOperationNameKey.String(val) -} - -// This group describes attributes specific to Apache Kafka. -const ( - // MessagingKafkaConsumerGroupKey is the attribute Key conforming to the - // "messaging.kafka.consumer.group" semantic conventions. It represents the - // name of the Kafka Consumer Group that is handling the message. Only - // applies to consumers, not producers. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'my-group' - MessagingKafkaConsumerGroupKey = attribute.Key("messaging.kafka.consumer.group") - - // MessagingKafkaMessageKeyKey is the attribute Key conforming to the - // "messaging.kafka.message.key" semantic conventions. It represents the - // message keys in Kafka are used for grouping alike messages to ensure - // they're processed on the same partition. They differ from - // `messaging.message.id` in that they're not unique. If the key is `null`, - // the attribute MUST NOT be set. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myKey' - // Note: If the key type is not string, it's string representation has to - // be supplied for the attribute. If the key has no unambiguous, canonical - // string form, don't include its value. - MessagingKafkaMessageKeyKey = attribute.Key("messaging.kafka.message.key") - - // MessagingKafkaMessageOffsetKey is the attribute Key conforming to the - // "messaging.kafka.message.offset" semantic conventions. It represents the - // offset of a record in the corresponding Kafka partition. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 42 - MessagingKafkaMessageOffsetKey = attribute.Key("messaging.kafka.message.offset") - - // MessagingKafkaMessageTombstoneKey is the attribute Key conforming to the - // "messaging.kafka.message.tombstone" semantic conventions. It represents - // a boolean that is true if the message is a tombstone. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - MessagingKafkaMessageTombstoneKey = attribute.Key("messaging.kafka.message.tombstone") -) - -// MessagingKafkaConsumerGroup returns an attribute KeyValue conforming to -// the "messaging.kafka.consumer.group" semantic conventions. It represents the -// name of the Kafka Consumer Group that is handling the message. Only applies -// to consumers, not producers. -func MessagingKafkaConsumerGroup(val string) attribute.KeyValue { - return MessagingKafkaConsumerGroupKey.String(val) -} - -// MessagingKafkaMessageKey returns an attribute KeyValue conforming to the -// "messaging.kafka.message.key" semantic conventions. It represents the -// message keys in Kafka are used for grouping alike messages to ensure they're -// processed on the same partition. They differ from `messaging.message.id` in -// that they're not unique. If the key is `null`, the attribute MUST NOT be -// set. -func MessagingKafkaMessageKey(val string) attribute.KeyValue { - return MessagingKafkaMessageKeyKey.String(val) -} - -// MessagingKafkaMessageOffset returns an attribute KeyValue conforming to -// the "messaging.kafka.message.offset" semantic conventions. It represents the -// offset of a record in the corresponding Kafka partition. -func MessagingKafkaMessageOffset(val int) attribute.KeyValue { - return MessagingKafkaMessageOffsetKey.Int(val) -} - -// MessagingKafkaMessageTombstone returns an attribute KeyValue conforming -// to the "messaging.kafka.message.tombstone" semantic conventions. It -// represents a boolean that is true if the message is a tombstone. -func MessagingKafkaMessageTombstone(val bool) attribute.KeyValue { - return MessagingKafkaMessageTombstoneKey.Bool(val) -} - -// This group describes attributes specific to RabbitMQ. -const ( - // MessagingRabbitmqDestinationRoutingKeyKey is the attribute Key - // conforming to the "messaging.rabbitmq.destination.routing_key" semantic - // conventions. It represents the rabbitMQ message routing key. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myKey' - MessagingRabbitmqDestinationRoutingKeyKey = attribute.Key("messaging.rabbitmq.destination.routing_key") - - // MessagingRabbitmqMessageDeliveryTagKey is the attribute Key conforming - // to the "messaging.rabbitmq.message.delivery_tag" semantic conventions. - // It represents the rabbitMQ message delivery tag - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 123 - MessagingRabbitmqMessageDeliveryTagKey = attribute.Key("messaging.rabbitmq.message.delivery_tag") -) - -// MessagingRabbitmqDestinationRoutingKey returns an attribute KeyValue -// conforming to the "messaging.rabbitmq.destination.routing_key" semantic -// conventions. It represents the rabbitMQ message routing key. -func MessagingRabbitmqDestinationRoutingKey(val string) attribute.KeyValue { - return MessagingRabbitmqDestinationRoutingKeyKey.String(val) -} - -// MessagingRabbitmqMessageDeliveryTag returns an attribute KeyValue -// conforming to the "messaging.rabbitmq.message.delivery_tag" semantic -// conventions. It represents the rabbitMQ message delivery tag -func MessagingRabbitmqMessageDeliveryTag(val int) attribute.KeyValue { - return MessagingRabbitmqMessageDeliveryTagKey.Int(val) -} - -// This group describes attributes specific to RocketMQ. -const ( - // MessagingRocketmqClientGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.client_group" semantic conventions. It represents - // the name of the RocketMQ producer/consumer group that is handling the - // message. The client type is identified by the SpanKind. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myConsumerGroup' - MessagingRocketmqClientGroupKey = attribute.Key("messaging.rocketmq.client_group") - - // MessagingRocketmqConsumptionModelKey is the attribute Key conforming to - // the "messaging.rocketmq.consumption_model" semantic conventions. It - // represents the model of message consumption. This only applies to - // consumer spans. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - MessagingRocketmqConsumptionModelKey = attribute.Key("messaging.rocketmq.consumption_model") - - // MessagingRocketmqMessageDelayTimeLevelKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delay_time_level" semantic - // conventions. It represents the delay time level for delay message, which - // determines the message delay time. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 3 - MessagingRocketmqMessageDelayTimeLevelKey = attribute.Key("messaging.rocketmq.message.delay_time_level") - - // MessagingRocketmqMessageDeliveryTimestampKey is the attribute Key - // conforming to the "messaging.rocketmq.message.delivery_timestamp" - // semantic conventions. It represents the timestamp in milliseconds that - // the delay message is expected to be delivered to consumer. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1665987217045 - MessagingRocketmqMessageDeliveryTimestampKey = attribute.Key("messaging.rocketmq.message.delivery_timestamp") - - // MessagingRocketmqMessageGroupKey is the attribute Key conforming to the - // "messaging.rocketmq.message.group" semantic conventions. It represents - // the it is essential for FIFO message. Messages that belong to the same - // message group are always processed one by one within the same consumer - // group. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myMessageGroup' - MessagingRocketmqMessageGroupKey = attribute.Key("messaging.rocketmq.message.group") - - // MessagingRocketmqMessageKeysKey is the attribute Key conforming to the - // "messaging.rocketmq.message.keys" semantic conventions. It represents - // the key(s) of message, another way to mark message besides message id. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'keyA', 'keyB' - MessagingRocketmqMessageKeysKey = attribute.Key("messaging.rocketmq.message.keys") - - // MessagingRocketmqMessageTagKey is the attribute Key conforming to the - // "messaging.rocketmq.message.tag" semantic conventions. It represents the - // secondary classifier of message besides topic. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'tagA' - MessagingRocketmqMessageTagKey = attribute.Key("messaging.rocketmq.message.tag") - - // MessagingRocketmqMessageTypeKey is the attribute Key conforming to the - // "messaging.rocketmq.message.type" semantic conventions. It represents - // the type of message. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - MessagingRocketmqMessageTypeKey = attribute.Key("messaging.rocketmq.message.type") - - // MessagingRocketmqNamespaceKey is the attribute Key conforming to the - // "messaging.rocketmq.namespace" semantic conventions. It represents the - // namespace of RocketMQ resources, resources in different namespaces are - // individual. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myNamespace' - MessagingRocketmqNamespaceKey = attribute.Key("messaging.rocketmq.namespace") -) - -var ( - // Clustering consumption model - MessagingRocketmqConsumptionModelClustering = MessagingRocketmqConsumptionModelKey.String("clustering") - // Broadcasting consumption model - MessagingRocketmqConsumptionModelBroadcasting = MessagingRocketmqConsumptionModelKey.String("broadcasting") -) - -var ( - // Normal message - MessagingRocketmqMessageTypeNormal = MessagingRocketmqMessageTypeKey.String("normal") - // FIFO message - MessagingRocketmqMessageTypeFifo = MessagingRocketmqMessageTypeKey.String("fifo") - // Delay message - MessagingRocketmqMessageTypeDelay = MessagingRocketmqMessageTypeKey.String("delay") - // Transaction message - MessagingRocketmqMessageTypeTransaction = MessagingRocketmqMessageTypeKey.String("transaction") -) - -// MessagingRocketmqClientGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.client_group" semantic conventions. It represents -// the name of the RocketMQ producer/consumer group that is handling the -// message. The client type is identified by the SpanKind. -func MessagingRocketmqClientGroup(val string) attribute.KeyValue { - return MessagingRocketmqClientGroupKey.String(val) -} - -// MessagingRocketmqMessageDelayTimeLevel returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delay_time_level" semantic -// conventions. It represents the delay time level for delay message, which -// determines the message delay time. -func MessagingRocketmqMessageDelayTimeLevel(val int) attribute.KeyValue { - return MessagingRocketmqMessageDelayTimeLevelKey.Int(val) -} - -// MessagingRocketmqMessageDeliveryTimestamp returns an attribute KeyValue -// conforming to the "messaging.rocketmq.message.delivery_timestamp" semantic -// conventions. It represents the timestamp in milliseconds that the delay -// message is expected to be delivered to consumer. -func MessagingRocketmqMessageDeliveryTimestamp(val int) attribute.KeyValue { - return MessagingRocketmqMessageDeliveryTimestampKey.Int(val) -} - -// MessagingRocketmqMessageGroup returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.group" semantic conventions. It represents -// the it is essential for FIFO message. Messages that belong to the same -// message group are always processed one by one within the same consumer -// group. -func MessagingRocketmqMessageGroup(val string) attribute.KeyValue { - return MessagingRocketmqMessageGroupKey.String(val) -} - -// MessagingRocketmqMessageKeys returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.keys" semantic conventions. It represents -// the key(s) of message, another way to mark message besides message id. -func MessagingRocketmqMessageKeys(val ...string) attribute.KeyValue { - return MessagingRocketmqMessageKeysKey.StringSlice(val) -} - -// MessagingRocketmqMessageTag returns an attribute KeyValue conforming to -// the "messaging.rocketmq.message.tag" semantic conventions. It represents the -// secondary classifier of message besides topic. -func MessagingRocketmqMessageTag(val string) attribute.KeyValue { - return MessagingRocketmqMessageTagKey.String(val) -} - -// MessagingRocketmqNamespace returns an attribute KeyValue conforming to -// the "messaging.rocketmq.namespace" semantic conventions. It represents the -// namespace of RocketMQ resources, resources in different namespaces are -// individual. -func MessagingRocketmqNamespace(val string) attribute.KeyValue { - return MessagingRocketmqNamespaceKey.String(val) -} - -// This group describes attributes specific to GCP Pub/Sub. -const ( - // MessagingGCPPubsubMessageAckDeadlineKey is the attribute Key conforming - // to the "messaging.gcp_pubsub.message.ack_deadline" semantic conventions. - // It represents the ack deadline in seconds set for the modify ack - // deadline request. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 10 - MessagingGCPPubsubMessageAckDeadlineKey = attribute.Key("messaging.gcp_pubsub.message.ack_deadline") - - // MessagingGCPPubsubMessageAckIDKey is the attribute Key conforming to the - // "messaging.gcp_pubsub.message.ack_id" semantic conventions. It - // represents the ack id for a given message. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'ack_id' - MessagingGCPPubsubMessageAckIDKey = attribute.Key("messaging.gcp_pubsub.message.ack_id") - - // MessagingGCPPubsubMessageDeliveryAttemptKey is the attribute Key - // conforming to the "messaging.gcp_pubsub.message.delivery_attempt" - // semantic conventions. It represents the delivery attempt for a given - // message. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 2 - MessagingGCPPubsubMessageDeliveryAttemptKey = attribute.Key("messaging.gcp_pubsub.message.delivery_attempt") - - // MessagingGCPPubsubMessageOrderingKeyKey is the attribute Key conforming - // to the "messaging.gcp_pubsub.message.ordering_key" semantic conventions. - // It represents the ordering key for a given message. If the attribute is - // not present, the message does not have an ordering key. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'ordering_key' - MessagingGCPPubsubMessageOrderingKeyKey = attribute.Key("messaging.gcp_pubsub.message.ordering_key") -) - -// MessagingGCPPubsubMessageAckDeadline returns an attribute KeyValue -// conforming to the "messaging.gcp_pubsub.message.ack_deadline" semantic -// conventions. It represents the ack deadline in seconds set for the modify -// ack deadline request. -func MessagingGCPPubsubMessageAckDeadline(val int) attribute.KeyValue { - return MessagingGCPPubsubMessageAckDeadlineKey.Int(val) -} - -// MessagingGCPPubsubMessageAckID returns an attribute KeyValue conforming -// to the "messaging.gcp_pubsub.message.ack_id" semantic conventions. It -// represents the ack id for a given message. -func MessagingGCPPubsubMessageAckID(val string) attribute.KeyValue { - return MessagingGCPPubsubMessageAckIDKey.String(val) -} - -// MessagingGCPPubsubMessageDeliveryAttempt returns an attribute KeyValue -// conforming to the "messaging.gcp_pubsub.message.delivery_attempt" semantic -// conventions. It represents the delivery attempt for a given message. -func MessagingGCPPubsubMessageDeliveryAttempt(val int) attribute.KeyValue { - return MessagingGCPPubsubMessageDeliveryAttemptKey.Int(val) -} - -// MessagingGCPPubsubMessageOrderingKey returns an attribute KeyValue -// conforming to the "messaging.gcp_pubsub.message.ordering_key" semantic -// conventions. It represents the ordering key for a given message. If the -// attribute is not present, the message does not have an ordering key. -func MessagingGCPPubsubMessageOrderingKey(val string) attribute.KeyValue { - return MessagingGCPPubsubMessageOrderingKeyKey.String(val) -} - -// This group describes attributes specific to Azure Service Bus. -const ( - // MessagingServicebusDestinationSubscriptionNameKey is the attribute Key - // conforming to the "messaging.servicebus.destination.subscription_name" - // semantic conventions. It represents the name of the subscription in the - // topic messages are received from. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'mySubscription' - MessagingServicebusDestinationSubscriptionNameKey = attribute.Key("messaging.servicebus.destination.subscription_name") - - // MessagingServicebusDispositionStatusKey is the attribute Key conforming - // to the "messaging.servicebus.disposition_status" semantic conventions. - // It represents the describes the [settlement - // type](https://learn.microsoft.com/azure/service-bus-messaging/message-transfers-locks-settlement#peeklock). - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - MessagingServicebusDispositionStatusKey = attribute.Key("messaging.servicebus.disposition_status") - - // MessagingServicebusMessageDeliveryCountKey is the attribute Key - // conforming to the "messaging.servicebus.message.delivery_count" semantic - // conventions. It represents the number of deliveries that have been - // attempted for this message. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 2 - MessagingServicebusMessageDeliveryCountKey = attribute.Key("messaging.servicebus.message.delivery_count") - - // MessagingServicebusMessageEnqueuedTimeKey is the attribute Key - // conforming to the "messaging.servicebus.message.enqueued_time" semantic - // conventions. It represents the UTC epoch seconds at which the message - // has been accepted and stored in the entity. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1701393730 - MessagingServicebusMessageEnqueuedTimeKey = attribute.Key("messaging.servicebus.message.enqueued_time") -) - -var ( - // Message is completed - MessagingServicebusDispositionStatusComplete = MessagingServicebusDispositionStatusKey.String("complete") - // Message is abandoned - MessagingServicebusDispositionStatusAbandon = MessagingServicebusDispositionStatusKey.String("abandon") - // Message is sent to dead letter queue - MessagingServicebusDispositionStatusDeadLetter = MessagingServicebusDispositionStatusKey.String("dead_letter") - // Message is deferred - MessagingServicebusDispositionStatusDefer = MessagingServicebusDispositionStatusKey.String("defer") -) - -// MessagingServicebusDestinationSubscriptionName returns an attribute -// KeyValue conforming to the -// "messaging.servicebus.destination.subscription_name" semantic conventions. -// It represents the name of the subscription in the topic messages are -// received from. -func MessagingServicebusDestinationSubscriptionName(val string) attribute.KeyValue { - return MessagingServicebusDestinationSubscriptionNameKey.String(val) -} - -// MessagingServicebusMessageDeliveryCount returns an attribute KeyValue -// conforming to the "messaging.servicebus.message.delivery_count" semantic -// conventions. It represents the number of deliveries that have been attempted -// for this message. -func MessagingServicebusMessageDeliveryCount(val int) attribute.KeyValue { - return MessagingServicebusMessageDeliveryCountKey.Int(val) -} - -// MessagingServicebusMessageEnqueuedTime returns an attribute KeyValue -// conforming to the "messaging.servicebus.message.enqueued_time" semantic -// conventions. It represents the UTC epoch seconds at which the message has -// been accepted and stored in the entity. -func MessagingServicebusMessageEnqueuedTime(val int) attribute.KeyValue { - return MessagingServicebusMessageEnqueuedTimeKey.Int(val) -} - -// This group describes attributes specific to Azure Event Hubs. -const ( - // MessagingEventhubsConsumerGroupKey is the attribute Key conforming to - // the "messaging.eventhubs.consumer.group" semantic conventions. It - // represents the name of the consumer group the event consumer is - // associated with. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'indexer' - MessagingEventhubsConsumerGroupKey = attribute.Key("messaging.eventhubs.consumer.group") - - // MessagingEventhubsMessageEnqueuedTimeKey is the attribute Key conforming - // to the "messaging.eventhubs.message.enqueued_time" semantic conventions. - // It represents the UTC epoch seconds at which the message has been - // accepted and stored in the entity. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1701393730 - MessagingEventhubsMessageEnqueuedTimeKey = attribute.Key("messaging.eventhubs.message.enqueued_time") -) - -// MessagingEventhubsConsumerGroup returns an attribute KeyValue conforming -// to the "messaging.eventhubs.consumer.group" semantic conventions. It -// represents the name of the consumer group the event consumer is associated -// with. -func MessagingEventhubsConsumerGroup(val string) attribute.KeyValue { - return MessagingEventhubsConsumerGroupKey.String(val) -} - -// MessagingEventhubsMessageEnqueuedTime returns an attribute KeyValue -// conforming to the "messaging.eventhubs.message.enqueued_time" semantic -// conventions. It represents the UTC epoch seconds at which the message has -// been accepted and stored in the entity. -func MessagingEventhubsMessageEnqueuedTime(val int) attribute.KeyValue { - return MessagingEventhubsMessageEnqueuedTimeKey.Int(val) -} - -// These attributes may be used for any network related operation. -const ( - // NetworkCarrierIccKey is the attribute Key conforming to the - // "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 - // alpha-2 2-character country code associated with the mobile carrier - // network. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'DE' - NetworkCarrierIccKey = attribute.Key("network.carrier.icc") - - // NetworkCarrierMccKey is the attribute Key conforming to the - // "network.carrier.mcc" semantic conventions. It represents the mobile - // carrier country code. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '310' - NetworkCarrierMccKey = attribute.Key("network.carrier.mcc") - - // NetworkCarrierMncKey is the attribute Key conforming to the - // "network.carrier.mnc" semantic conventions. It represents the mobile - // carrier network code. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '001' - NetworkCarrierMncKey = attribute.Key("network.carrier.mnc") - - // NetworkCarrierNameKey is the attribute Key conforming to the - // "network.carrier.name" semantic conventions. It represents the name of - // the mobile carrier. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'sprint' - NetworkCarrierNameKey = attribute.Key("network.carrier.name") - - // NetworkConnectionSubtypeKey is the attribute Key conforming to the - // "network.connection.subtype" semantic conventions. It represents the - // this describes more details regarding the connection.type. It may be the - // type of cell technology connection, but it could be used for describing - // details about a wifi connection. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'LTE' - NetworkConnectionSubtypeKey = attribute.Key("network.connection.subtype") - - // NetworkConnectionTypeKey is the attribute Key conforming to the - // "network.connection.type" semantic conventions. It represents the - // internet connection type. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'wifi' - NetworkConnectionTypeKey = attribute.Key("network.connection.type") - - // NetworkIoDirectionKey is the attribute Key conforming to the - // "network.io.direction" semantic conventions. It represents the network - // IO operation direction. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'transmit' - NetworkIoDirectionKey = attribute.Key("network.io.direction") - - // NetworkLocalAddressKey is the attribute Key conforming to the - // "network.local.address" semantic conventions. It represents the local - // address of the network connection - IP address or Unix domain socket - // name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '10.1.2.80', '/tmp/my.sock' - NetworkLocalAddressKey = attribute.Key("network.local.address") - - // NetworkLocalPortKey is the attribute Key conforming to the - // "network.local.port" semantic conventions. It represents the local port - // number of the network connection. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 65123 - NetworkLocalPortKey = attribute.Key("network.local.port") - - // NetworkPeerAddressKey is the attribute Key conforming to the - // "network.peer.address" semantic conventions. It represents the peer - // address of the network connection - IP address or Unix domain socket - // name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '10.1.2.80', '/tmp/my.sock' - NetworkPeerAddressKey = attribute.Key("network.peer.address") - - // NetworkPeerPortKey is the attribute Key conforming to the - // "network.peer.port" semantic conventions. It represents the peer port - // number of the network connection. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 65123 - NetworkPeerPortKey = attribute.Key("network.peer.port") - - // NetworkProtocolNameKey is the attribute Key conforming to the - // "network.protocol.name" semantic conventions. It represents the [OSI - // application layer](https://osi-model.com/application-layer/) or non-OSI - // equivalent. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'amqp', 'http', 'mqtt' - // Note: The value SHOULD be normalized to lowercase. - NetworkProtocolNameKey = attribute.Key("network.protocol.name") - - // NetworkProtocolVersionKey is the attribute Key conforming to the - // "network.protocol.version" semantic conventions. It represents the - // actual version of the protocol used for network communication. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.1', '2' - // Note: If protocol version is subject to negotiation (for example using - // [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute - // SHOULD be set to the negotiated version. If the actual protocol version - // is not known, this attribute SHOULD NOT be set. - NetworkProtocolVersionKey = attribute.Key("network.protocol.version") - - // NetworkTransportKey is the attribute Key conforming to the - // "network.transport" semantic conventions. It represents the [OSI - // transport layer](https://osi-model.com/transport-layer/) or - // [inter-process communication - // method](https://wikipedia.org/wiki/Inter-process_communication). - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'tcp', 'udp' - // Note: The value SHOULD be normalized to lowercase. - // - // Consider always setting the transport when setting a port number, since - // a port number is ambiguous without knowing the transport. For example - // different processes could be listening on TCP port 12345 and UDP port - // 12345. - NetworkTransportKey = attribute.Key("network.transport") - - // NetworkTypeKey is the attribute Key conforming to the "network.type" - // semantic conventions. It represents the [OSI network - // layer](https://osi-model.com/network-layer/) or non-OSI equivalent. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'ipv4', 'ipv6' - // Note: The value SHOULD be normalized to lowercase. - NetworkTypeKey = attribute.Key("network.type") -) - -var ( - // GPRS - NetworkConnectionSubtypeGprs = NetworkConnectionSubtypeKey.String("gprs") - // EDGE - NetworkConnectionSubtypeEdge = NetworkConnectionSubtypeKey.String("edge") - // UMTS - NetworkConnectionSubtypeUmts = NetworkConnectionSubtypeKey.String("umts") - // CDMA - NetworkConnectionSubtypeCdma = NetworkConnectionSubtypeKey.String("cdma") - // EVDO Rel. 0 - NetworkConnectionSubtypeEvdo0 = NetworkConnectionSubtypeKey.String("evdo_0") - // EVDO Rev. A - NetworkConnectionSubtypeEvdoA = NetworkConnectionSubtypeKey.String("evdo_a") - // CDMA2000 1XRTT - NetworkConnectionSubtypeCdma20001xrtt = NetworkConnectionSubtypeKey.String("cdma2000_1xrtt") - // HSDPA - NetworkConnectionSubtypeHsdpa = NetworkConnectionSubtypeKey.String("hsdpa") - // HSUPA - NetworkConnectionSubtypeHsupa = NetworkConnectionSubtypeKey.String("hsupa") - // HSPA - NetworkConnectionSubtypeHspa = NetworkConnectionSubtypeKey.String("hspa") - // IDEN - NetworkConnectionSubtypeIden = NetworkConnectionSubtypeKey.String("iden") - // EVDO Rev. B - NetworkConnectionSubtypeEvdoB = NetworkConnectionSubtypeKey.String("evdo_b") - // LTE - NetworkConnectionSubtypeLte = NetworkConnectionSubtypeKey.String("lte") - // EHRPD - NetworkConnectionSubtypeEhrpd = NetworkConnectionSubtypeKey.String("ehrpd") - // HSPAP - NetworkConnectionSubtypeHspap = NetworkConnectionSubtypeKey.String("hspap") - // GSM - NetworkConnectionSubtypeGsm = NetworkConnectionSubtypeKey.String("gsm") - // TD-SCDMA - NetworkConnectionSubtypeTdScdma = NetworkConnectionSubtypeKey.String("td_scdma") - // IWLAN - NetworkConnectionSubtypeIwlan = NetworkConnectionSubtypeKey.String("iwlan") - // 5G NR (New Radio) - NetworkConnectionSubtypeNr = NetworkConnectionSubtypeKey.String("nr") - // 5G NRNSA (New Radio Non-Standalone) - NetworkConnectionSubtypeNrnsa = NetworkConnectionSubtypeKey.String("nrnsa") - // LTE CA - NetworkConnectionSubtypeLteCa = NetworkConnectionSubtypeKey.String("lte_ca") -) - -var ( - // wifi - NetworkConnectionTypeWifi = NetworkConnectionTypeKey.String("wifi") - // wired - NetworkConnectionTypeWired = NetworkConnectionTypeKey.String("wired") - // cell - NetworkConnectionTypeCell = NetworkConnectionTypeKey.String("cell") - // unavailable - NetworkConnectionTypeUnavailable = NetworkConnectionTypeKey.String("unavailable") - // unknown - NetworkConnectionTypeUnknown = NetworkConnectionTypeKey.String("unknown") -) - -var ( - // transmit - NetworkIoDirectionTransmit = NetworkIoDirectionKey.String("transmit") - // receive - NetworkIoDirectionReceive = NetworkIoDirectionKey.String("receive") -) - -var ( - // TCP - NetworkTransportTCP = NetworkTransportKey.String("tcp") - // UDP - NetworkTransportUDP = NetworkTransportKey.String("udp") - // Named or anonymous pipe - NetworkTransportPipe = NetworkTransportKey.String("pipe") - // Unix domain socket - NetworkTransportUnix = NetworkTransportKey.String("unix") -) - -var ( - // IPv4 - NetworkTypeIpv4 = NetworkTypeKey.String("ipv4") - // IPv6 - NetworkTypeIpv6 = NetworkTypeKey.String("ipv6") -) - -// NetworkCarrierIcc returns an attribute KeyValue conforming to the -// "network.carrier.icc" semantic conventions. It represents the ISO 3166-1 -// alpha-2 2-character country code associated with the mobile carrier network. -func NetworkCarrierIcc(val string) attribute.KeyValue { - return NetworkCarrierIccKey.String(val) -} - -// NetworkCarrierMcc returns an attribute KeyValue conforming to the -// "network.carrier.mcc" semantic conventions. It represents the mobile carrier -// country code. -func NetworkCarrierMcc(val string) attribute.KeyValue { - return NetworkCarrierMccKey.String(val) -} - -// NetworkCarrierMnc returns an attribute KeyValue conforming to the -// "network.carrier.mnc" semantic conventions. It represents the mobile carrier -// network code. -func NetworkCarrierMnc(val string) attribute.KeyValue { - return NetworkCarrierMncKey.String(val) -} - -// NetworkCarrierName returns an attribute KeyValue conforming to the -// "network.carrier.name" semantic conventions. It represents the name of the -// mobile carrier. -func NetworkCarrierName(val string) attribute.KeyValue { - return NetworkCarrierNameKey.String(val) -} - -// NetworkLocalAddress returns an attribute KeyValue conforming to the -// "network.local.address" semantic conventions. It represents the local -// address of the network connection - IP address or Unix domain socket name. -func NetworkLocalAddress(val string) attribute.KeyValue { - return NetworkLocalAddressKey.String(val) -} - -// NetworkLocalPort returns an attribute KeyValue conforming to the -// "network.local.port" semantic conventions. It represents the local port -// number of the network connection. -func NetworkLocalPort(val int) attribute.KeyValue { - return NetworkLocalPortKey.Int(val) -} - -// NetworkPeerAddress returns an attribute KeyValue conforming to the -// "network.peer.address" semantic conventions. It represents the peer address -// of the network connection - IP address or Unix domain socket name. -func NetworkPeerAddress(val string) attribute.KeyValue { - return NetworkPeerAddressKey.String(val) -} - -// NetworkPeerPort returns an attribute KeyValue conforming to the -// "network.peer.port" semantic conventions. It represents the peer port number -// of the network connection. -func NetworkPeerPort(val int) attribute.KeyValue { - return NetworkPeerPortKey.Int(val) -} - -// NetworkProtocolName returns an attribute KeyValue conforming to the -// "network.protocol.name" semantic conventions. It represents the [OSI -// application layer](https://osi-model.com/application-layer/) or non-OSI -// equivalent. -func NetworkProtocolName(val string) attribute.KeyValue { - return NetworkProtocolNameKey.String(val) -} - -// NetworkProtocolVersion returns an attribute KeyValue conforming to the -// "network.protocol.version" semantic conventions. It represents the actual -// version of the protocol used for network communication. -func NetworkProtocolVersion(val string) attribute.KeyValue { - return NetworkProtocolVersionKey.String(val) -} - -// An OCI image manifest. -const ( - // OciManifestDigestKey is the attribute Key conforming to the - // "oci.manifest.digest" semantic conventions. It represents the digest of - // the OCI image manifest. For container images specifically is the digest - // by which the container image is known. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // 'sha256:e4ca62c0d62f3e886e684806dfe9d4e0cda60d54986898173c1083856cfda0f4' - // Note: Follows [OCI Image Manifest - // Specification](https://github.com/opencontainers/image-spec/blob/main/manifest.md), - // and specifically the [Digest - // property](https://github.com/opencontainers/image-spec/blob/main/descriptor.md#digests). - // An example can be found in [Example Image - // Manifest](https://docs.docker.com/registry/spec/manifest-v2-2/#example-image-manifest). - OciManifestDigestKey = attribute.Key("oci.manifest.digest") -) - -// OciManifestDigest returns an attribute KeyValue conforming to the -// "oci.manifest.digest" semantic conventions. It represents the digest of the -// OCI image manifest. For container images specifically is the digest by which -// the container image is known. -func OciManifestDigest(val string) attribute.KeyValue { - return OciManifestDigestKey.String(val) -} - -// Attributes used by the OpenTracing Shim layer. -const ( - // OpentracingRefTypeKey is the attribute Key conforming to the - // "opentracing.ref_type" semantic conventions. It represents the - // parent-child Reference type - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Note: The causal relationship between a child Span and a parent Span. - OpentracingRefTypeKey = attribute.Key("opentracing.ref_type") -) - -var ( - // The parent Span depends on the child Span in some capacity - OpentracingRefTypeChildOf = OpentracingRefTypeKey.String("child_of") - // The parent Span doesn't depend in any way on the result of the child Span - OpentracingRefTypeFollowsFrom = OpentracingRefTypeKey.String("follows_from") -) - -// The operating system (OS) on which the process represented by this resource -// is running. -const ( - // OSBuildIDKey is the attribute Key conforming to the "os.build_id" - // semantic conventions. It represents the unique identifier for a - // particular build or compilation of the operating system. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'TQ3C.230805.001.B2', '20E247', '22621' - OSBuildIDKey = attribute.Key("os.build_id") - - // OSDescriptionKey is the attribute Key conforming to the "os.description" - // semantic conventions. It represents the human readable (not intended to - // be parsed) OS version information, like e.g. reported by `ver` or - // `lsb_release -a` commands. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 - // LTS' - OSDescriptionKey = attribute.Key("os.description") - - // OSNameKey is the attribute Key conforming to the "os.name" semantic - // conventions. It represents the human readable operating system name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'iOS', 'Android', 'Ubuntu' - OSNameKey = attribute.Key("os.name") - - // OSTypeKey is the attribute Key conforming to the "os.type" semantic - // conventions. It represents the operating system type. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - OSTypeKey = attribute.Key("os.type") - - // OSVersionKey is the attribute Key conforming to the "os.version" - // semantic conventions. It represents the version string of the operating - // system as defined in [Version - // Attributes](/docs/resource/README.md#version-attributes). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '14.2.1', '18.04.1' - OSVersionKey = attribute.Key("os.version") -) - -var ( - // Microsoft Windows - OSTypeWindows = OSTypeKey.String("windows") - // Linux - OSTypeLinux = OSTypeKey.String("linux") - // Apple Darwin - OSTypeDarwin = OSTypeKey.String("darwin") - // FreeBSD - OSTypeFreeBSD = OSTypeKey.String("freebsd") - // NetBSD - OSTypeNetBSD = OSTypeKey.String("netbsd") - // OpenBSD - OSTypeOpenBSD = OSTypeKey.String("openbsd") - // DragonFly BSD - OSTypeDragonflyBSD = OSTypeKey.String("dragonflybsd") - // HP-UX (Hewlett Packard Unix) - OSTypeHPUX = OSTypeKey.String("hpux") - // AIX (Advanced Interactive eXecutive) - OSTypeAIX = OSTypeKey.String("aix") - // SunOS, Oracle Solaris - OSTypeSolaris = OSTypeKey.String("solaris") - // IBM z/OS - OSTypeZOS = OSTypeKey.String("z_os") -) - -// OSBuildID returns an attribute KeyValue conforming to the "os.build_id" -// semantic conventions. It represents the unique identifier for a particular -// build or compilation of the operating system. -func OSBuildID(val string) attribute.KeyValue { - return OSBuildIDKey.String(val) -} - -// OSDescription returns an attribute KeyValue conforming to the -// "os.description" semantic conventions. It represents the human readable (not -// intended to be parsed) OS version information, like e.g. reported by `ver` -// or `lsb_release -a` commands. -func OSDescription(val string) attribute.KeyValue { - return OSDescriptionKey.String(val) -} - -// OSName returns an attribute KeyValue conforming to the "os.name" semantic -// conventions. It represents the human readable operating system name. -func OSName(val string) attribute.KeyValue { - return OSNameKey.String(val) -} - -// OSVersion returns an attribute KeyValue conforming to the "os.version" -// semantic conventions. It represents the version string of the operating -// system as defined in [Version -// Attributes](/docs/resource/README.md#version-attributes). -func OSVersion(val string) attribute.KeyValue { - return OSVersionKey.String(val) -} - -// Attributes reserved for OpenTelemetry -const ( - // OTelStatusCodeKey is the attribute Key conforming to the - // "otel.status_code" semantic conventions. It represents the name of the - // code, either "OK" or "ERROR". MUST NOT be set if the status code is - // UNSET. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - OTelStatusCodeKey = attribute.Key("otel.status_code") - - // OTelStatusDescriptionKey is the attribute Key conforming to the - // "otel.status_description" semantic conventions. It represents the - // description of the Status if it has a value, otherwise not set. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'resource not found' - OTelStatusDescriptionKey = attribute.Key("otel.status_description") -) - -var ( - // The operation has been validated by an Application developer or Operator to have completed successfully - OTelStatusCodeOk = OTelStatusCodeKey.String("OK") - // The operation contains an error - OTelStatusCodeError = OTelStatusCodeKey.String("ERROR") -) - -// OTelStatusDescription returns an attribute KeyValue conforming to the -// "otel.status_description" semantic conventions. It represents the -// description of the Status if it has a value, otherwise not set. -func OTelStatusDescription(val string) attribute.KeyValue { - return OTelStatusDescriptionKey.String(val) -} - -// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's -// concepts. -const ( - // OTelScopeNameKey is the attribute Key conforming to the - // "otel.scope.name" semantic conventions. It represents the name of the - // instrumentation scope - (`InstrumentationScope.Name` in OTLP). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'io.opentelemetry.contrib.mongodb' - OTelScopeNameKey = attribute.Key("otel.scope.name") - - // OTelScopeVersionKey is the attribute Key conforming to the - // "otel.scope.version" semantic conventions. It represents the version of - // the instrumentation scope - (`InstrumentationScope.Version` in OTLP). - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '1.0.0' - OTelScopeVersionKey = attribute.Key("otel.scope.version") -) - -// OTelScopeName returns an attribute KeyValue conforming to the -// "otel.scope.name" semantic conventions. It represents the name of the -// instrumentation scope - (`InstrumentationScope.Name` in OTLP). -func OTelScopeName(val string) attribute.KeyValue { - return OTelScopeNameKey.String(val) -} - -// OTelScopeVersion returns an attribute KeyValue conforming to the -// "otel.scope.version" semantic conventions. It represents the version of the -// instrumentation scope - (`InstrumentationScope.Version` in OTLP). -func OTelScopeVersion(val string) attribute.KeyValue { - return OTelScopeVersionKey.String(val) -} - -// Operations that access some remote service. -const ( - // PeerServiceKey is the attribute Key conforming to the "peer.service" - // semantic conventions. It represents the - // [`service.name`](/docs/resource/README.md#service) of the remote - // service. SHOULD be equal to the actual `service.name` resource attribute - // of the remote service if any. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'AuthTokenCache' - PeerServiceKey = attribute.Key("peer.service") -) - -// PeerService returns an attribute KeyValue conforming to the -// "peer.service" semantic conventions. It represents the -// [`service.name`](/docs/resource/README.md#service) of the remote service. -// SHOULD be equal to the actual `service.name` resource attribute of the -// remote service if any. -func PeerService(val string) attribute.KeyValue { - return PeerServiceKey.String(val) -} - -// An operating system process. -const ( - // ProcessCommandKey is the attribute Key conforming to the - // "process.command" semantic conventions. It represents the command used - // to launch the process (i.e. the command name). On Linux based systems, - // can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can - // be set to the first parameter extracted from `GetCommandLineW`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'cmd/otelcol' - ProcessCommandKey = attribute.Key("process.command") - - // ProcessCommandArgsKey is the attribute Key conforming to the - // "process.command_args" semantic conventions. It represents the all the - // command arguments (including the command/executable itself) as received - // by the process. On Linux-based systems (and some other Unixoid systems - // supporting procfs), can be set according to the list of null-delimited - // strings extracted from `proc/[pid]/cmdline`. For libc-based executables, - // this would be the full argv vector passed to `main`. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'cmd/otecol', '--config=config.yaml' - ProcessCommandArgsKey = attribute.Key("process.command_args") - - // ProcessCommandLineKey is the attribute Key conforming to the - // "process.command_line" semantic conventions. It represents the full - // command used to launch the process as a single string representing the - // full command. On Windows, can be set to the result of `GetCommandLineW`. - // Do not set this if you have to assemble it just for monitoring; use - // `process.command_args` instead. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'C:\\cmd\\otecol --config="my directory\\config.yaml"' - ProcessCommandLineKey = attribute.Key("process.command_line") - - // ProcessContextSwitchTypeKey is the attribute Key conforming to the - // "process.context_switch_type" semantic conventions. It represents the - // specifies whether the context switches for this data point were - // voluntary or involuntary. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - ProcessContextSwitchTypeKey = attribute.Key("process.context_switch_type") - - // ProcessCreationTimeKey is the attribute Key conforming to the - // "process.creation.time" semantic conventions. It represents the date and - // time the process was created, in ISO 8601 format. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2023-11-21T09:25:34.853Z' - ProcessCreationTimeKey = attribute.Key("process.creation.time") - - // ProcessExecutableNameKey is the attribute Key conforming to the - // "process.executable.name" semantic conventions. It represents the name - // of the process executable. On Linux based systems, can be set to the - // `Name` in `proc/[pid]/status`. On Windows, can be set to the base name - // of `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'otelcol' - ProcessExecutableNameKey = attribute.Key("process.executable.name") - - // ProcessExecutablePathKey is the attribute Key conforming to the - // "process.executable.path" semantic conventions. It represents the full - // path to the process executable. On Linux based systems, can be set to - // the target of `proc/[pid]/exe`. On Windows, can be set to the result of - // `GetProcessImageFileNameW`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/usr/bin/cmd/otelcol' - ProcessExecutablePathKey = attribute.Key("process.executable.path") - - // ProcessExitCodeKey is the attribute Key conforming to the - // "process.exit.code" semantic conventions. It represents the exit code of - // the process. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 127 - ProcessExitCodeKey = attribute.Key("process.exit.code") - - // ProcessExitTimeKey is the attribute Key conforming to the - // "process.exit.time" semantic conventions. It represents the date and - // time the process exited, in ISO 8601 format. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2023-11-21T09:26:12.315Z' - ProcessExitTimeKey = attribute.Key("process.exit.time") - - // ProcessGroupLeaderPIDKey is the attribute Key conforming to the - // "process.group_leader.pid" semantic conventions. It represents the PID - // of the process's group leader. This is also the process group ID (PGID) - // of the process. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 23 - ProcessGroupLeaderPIDKey = attribute.Key("process.group_leader.pid") - - // ProcessInteractiveKey is the attribute Key conforming to the - // "process.interactive" semantic conventions. It represents the whether - // the process is connected to an interactive shell. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - ProcessInteractiveKey = attribute.Key("process.interactive") - - // ProcessOwnerKey is the attribute Key conforming to the "process.owner" - // semantic conventions. It represents the username of the user that owns - // the process. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'root' - ProcessOwnerKey = attribute.Key("process.owner") - - // ProcessPagingFaultTypeKey is the attribute Key conforming to the - // "process.paging.fault_type" semantic conventions. It represents the type - // of page fault for this data point. Type `major` is for major/hard page - // faults, and `minor` is for minor/soft page faults. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - ProcessPagingFaultTypeKey = attribute.Key("process.paging.fault_type") - - // ProcessParentPIDKey is the attribute Key conforming to the - // "process.parent_pid" semantic conventions. It represents the parent - // Process identifier (PPID). - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 111 - ProcessParentPIDKey = attribute.Key("process.parent_pid") - - // ProcessPIDKey is the attribute Key conforming to the "process.pid" - // semantic conventions. It represents the process identifier (PID). - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1234 - ProcessPIDKey = attribute.Key("process.pid") - - // ProcessRealUserIDKey is the attribute Key conforming to the - // "process.real_user.id" semantic conventions. It represents the real user - // ID (RUID) of the process. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1000 - ProcessRealUserIDKey = attribute.Key("process.real_user.id") - - // ProcessRealUserNameKey is the attribute Key conforming to the - // "process.real_user.name" semantic conventions. It represents the - // username of the real user of the process. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'operator' - ProcessRealUserNameKey = attribute.Key("process.real_user.name") - - // ProcessRuntimeDescriptionKey is the attribute Key conforming to the - // "process.runtime.description" semantic conventions. It represents an - // additional description about the runtime of the process, for example a - // specific vendor customization of the runtime environment. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Eclipse OpenJ9 Eclipse OpenJ9 VM openj9-0.21.0' - ProcessRuntimeDescriptionKey = attribute.Key("process.runtime.description") - - // ProcessRuntimeNameKey is the attribute Key conforming to the - // "process.runtime.name" semantic conventions. It represents the name of - // the runtime of this process. For compiled native binaries, this SHOULD - // be the name of the compiler. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'OpenJDK Runtime Environment' - ProcessRuntimeNameKey = attribute.Key("process.runtime.name") - - // ProcessRuntimeVersionKey is the attribute Key conforming to the - // "process.runtime.version" semantic conventions. It represents the - // version of the runtime of this process, as returned by the runtime - // without modification. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '14.0.2' - ProcessRuntimeVersionKey = attribute.Key("process.runtime.version") - - // ProcessSavedUserIDKey is the attribute Key conforming to the - // "process.saved_user.id" semantic conventions. It represents the saved - // user ID (SUID) of the process. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1002 - ProcessSavedUserIDKey = attribute.Key("process.saved_user.id") - - // ProcessSavedUserNameKey is the attribute Key conforming to the - // "process.saved_user.name" semantic conventions. It represents the - // username of the saved user. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'operator' - ProcessSavedUserNameKey = attribute.Key("process.saved_user.name") - - // ProcessSessionLeaderPIDKey is the attribute Key conforming to the - // "process.session_leader.pid" semantic conventions. It represents the PID - // of the process's session leader. This is also the session ID (SID) of - // the process. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 14 - ProcessSessionLeaderPIDKey = attribute.Key("process.session_leader.pid") - - // ProcessUserIDKey is the attribute Key conforming to the - // "process.user.id" semantic conventions. It represents the effective user - // ID (EUID) of the process. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1001 - ProcessUserIDKey = attribute.Key("process.user.id") - - // ProcessUserNameKey is the attribute Key conforming to the - // "process.user.name" semantic conventions. It represents the username of - // the effective user of the process. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'root' - ProcessUserNameKey = attribute.Key("process.user.name") - - // ProcessVpidKey is the attribute Key conforming to the "process.vpid" - // semantic conventions. It represents the virtual process identifier. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 12 - // Note: The process ID within a PID namespace. This is not necessarily - // unique across all processes on the host but it is unique within the - // process namespace that the process exists within. - ProcessVpidKey = attribute.Key("process.vpid") -) - -var ( - // voluntary - ProcessContextSwitchTypeVoluntary = ProcessContextSwitchTypeKey.String("voluntary") - // involuntary - ProcessContextSwitchTypeInvoluntary = ProcessContextSwitchTypeKey.String("involuntary") -) - -var ( - // major - ProcessPagingFaultTypeMajor = ProcessPagingFaultTypeKey.String("major") - // minor - ProcessPagingFaultTypeMinor = ProcessPagingFaultTypeKey.String("minor") -) - -// ProcessCommand returns an attribute KeyValue conforming to the -// "process.command" semantic conventions. It represents the command used to -// launch the process (i.e. the command name). On Linux based systems, can be -// set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to -// the first parameter extracted from `GetCommandLineW`. -func ProcessCommand(val string) attribute.KeyValue { - return ProcessCommandKey.String(val) -} - -// ProcessCommandArgs returns an attribute KeyValue conforming to the -// "process.command_args" semantic conventions. It represents the all the -// command arguments (including the command/executable itself) as received by -// the process. On Linux-based systems (and some other Unixoid systems -// supporting procfs), can be set according to the list of null-delimited -// strings extracted from `proc/[pid]/cmdline`. For libc-based executables, -// this would be the full argv vector passed to `main`. -func ProcessCommandArgs(val ...string) attribute.KeyValue { - return ProcessCommandArgsKey.StringSlice(val) -} - -// ProcessCommandLine returns an attribute KeyValue conforming to the -// "process.command_line" semantic conventions. It represents the full command -// used to launch the process as a single string representing the full command. -// On Windows, can be set to the result of `GetCommandLineW`. Do not set this -// if you have to assemble it just for monitoring; use `process.command_args` -// instead. -func ProcessCommandLine(val string) attribute.KeyValue { - return ProcessCommandLineKey.String(val) -} - -// ProcessCreationTime returns an attribute KeyValue conforming to the -// "process.creation.time" semantic conventions. It represents the date and -// time the process was created, in ISO 8601 format. -func ProcessCreationTime(val string) attribute.KeyValue { - return ProcessCreationTimeKey.String(val) -} - -// ProcessExecutableName returns an attribute KeyValue conforming to the -// "process.executable.name" semantic conventions. It represents the name of -// the process executable. On Linux based systems, can be set to the `Name` in -// `proc/[pid]/status`. On Windows, can be set to the base name of -// `GetProcessImageFileNameW`. -func ProcessExecutableName(val string) attribute.KeyValue { - return ProcessExecutableNameKey.String(val) -} - -// ProcessExecutablePath returns an attribute KeyValue conforming to the -// "process.executable.path" semantic conventions. It represents the full path -// to the process executable. On Linux based systems, can be set to the target -// of `proc/[pid]/exe`. On Windows, can be set to the result of -// `GetProcessImageFileNameW`. -func ProcessExecutablePath(val string) attribute.KeyValue { - return ProcessExecutablePathKey.String(val) -} - -// ProcessExitCode returns an attribute KeyValue conforming to the -// "process.exit.code" semantic conventions. It represents the exit code of the -// process. -func ProcessExitCode(val int) attribute.KeyValue { - return ProcessExitCodeKey.Int(val) -} - -// ProcessExitTime returns an attribute KeyValue conforming to the -// "process.exit.time" semantic conventions. It represents the date and time -// the process exited, in ISO 8601 format. -func ProcessExitTime(val string) attribute.KeyValue { - return ProcessExitTimeKey.String(val) -} - -// ProcessGroupLeaderPID returns an attribute KeyValue conforming to the -// "process.group_leader.pid" semantic conventions. It represents the PID of -// the process's group leader. This is also the process group ID (PGID) of the -// process. -func ProcessGroupLeaderPID(val int) attribute.KeyValue { - return ProcessGroupLeaderPIDKey.Int(val) -} - -// ProcessInteractive returns an attribute KeyValue conforming to the -// "process.interactive" semantic conventions. It represents the whether the -// process is connected to an interactive shell. -func ProcessInteractive(val bool) attribute.KeyValue { - return ProcessInteractiveKey.Bool(val) -} - -// ProcessOwner returns an attribute KeyValue conforming to the -// "process.owner" semantic conventions. It represents the username of the user -// that owns the process. -func ProcessOwner(val string) attribute.KeyValue { - return ProcessOwnerKey.String(val) -} - -// ProcessParentPID returns an attribute KeyValue conforming to the -// "process.parent_pid" semantic conventions. It represents the parent Process -// identifier (PPID). -func ProcessParentPID(val int) attribute.KeyValue { - return ProcessParentPIDKey.Int(val) -} - -// ProcessPID returns an attribute KeyValue conforming to the "process.pid" -// semantic conventions. It represents the process identifier (PID). -func ProcessPID(val int) attribute.KeyValue { - return ProcessPIDKey.Int(val) -} - -// ProcessRealUserID returns an attribute KeyValue conforming to the -// "process.real_user.id" semantic conventions. It represents the real user ID -// (RUID) of the process. -func ProcessRealUserID(val int) attribute.KeyValue { - return ProcessRealUserIDKey.Int(val) -} - -// ProcessRealUserName returns an attribute KeyValue conforming to the -// "process.real_user.name" semantic conventions. It represents the username of -// the real user of the process. -func ProcessRealUserName(val string) attribute.KeyValue { - return ProcessRealUserNameKey.String(val) -} - -// ProcessRuntimeDescription returns an attribute KeyValue conforming to the -// "process.runtime.description" semantic conventions. It represents an -// additional description about the runtime of the process, for example a -// specific vendor customization of the runtime environment. -func ProcessRuntimeDescription(val string) attribute.KeyValue { - return ProcessRuntimeDescriptionKey.String(val) -} - -// ProcessRuntimeName returns an attribute KeyValue conforming to the -// "process.runtime.name" semantic conventions. It represents the name of the -// runtime of this process. For compiled native binaries, this SHOULD be the -// name of the compiler. -func ProcessRuntimeName(val string) attribute.KeyValue { - return ProcessRuntimeNameKey.String(val) -} - -// ProcessRuntimeVersion returns an attribute KeyValue conforming to the -// "process.runtime.version" semantic conventions. It represents the version of -// the runtime of this process, as returned by the runtime without -// modification. -func ProcessRuntimeVersion(val string) attribute.KeyValue { - return ProcessRuntimeVersionKey.String(val) -} - -// ProcessSavedUserID returns an attribute KeyValue conforming to the -// "process.saved_user.id" semantic conventions. It represents the saved user -// ID (SUID) of the process. -func ProcessSavedUserID(val int) attribute.KeyValue { - return ProcessSavedUserIDKey.Int(val) -} - -// ProcessSavedUserName returns an attribute KeyValue conforming to the -// "process.saved_user.name" semantic conventions. It represents the username -// of the saved user. -func ProcessSavedUserName(val string) attribute.KeyValue { - return ProcessSavedUserNameKey.String(val) -} - -// ProcessSessionLeaderPID returns an attribute KeyValue conforming to the -// "process.session_leader.pid" semantic conventions. It represents the PID of -// the process's session leader. This is also the session ID (SID) of the -// process. -func ProcessSessionLeaderPID(val int) attribute.KeyValue { - return ProcessSessionLeaderPIDKey.Int(val) -} - -// ProcessUserID returns an attribute KeyValue conforming to the -// "process.user.id" semantic conventions. It represents the effective user ID -// (EUID) of the process. -func ProcessUserID(val int) attribute.KeyValue { - return ProcessUserIDKey.Int(val) -} - -// ProcessUserName returns an attribute KeyValue conforming to the -// "process.user.name" semantic conventions. It represents the username of the -// effective user of the process. -func ProcessUserName(val string) attribute.KeyValue { - return ProcessUserNameKey.String(val) -} - -// ProcessVpid returns an attribute KeyValue conforming to the -// "process.vpid" semantic conventions. It represents the virtual process -// identifier. -func ProcessVpid(val int) attribute.KeyValue { - return ProcessVpidKey.Int(val) -} - -// Attributes for process CPU -const ( - // ProcessCPUStateKey is the attribute Key conforming to the - // "process.cpu.state" semantic conventions. It represents the CPU state of - // the process. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - ProcessCPUStateKey = attribute.Key("process.cpu.state") -) - -var ( - // system - ProcessCPUStateSystem = ProcessCPUStateKey.String("system") - // user - ProcessCPUStateUser = ProcessCPUStateKey.String("user") - // wait - ProcessCPUStateWait = ProcessCPUStateKey.String("wait") -) - -// Attributes for remote procedure calls. -const ( - // RPCConnectRPCErrorCodeKey is the attribute Key conforming to the - // "rpc.connect_rpc.error_code" semantic conventions. It represents the - // [error codes](https://connect.build/docs/protocol/#error-codes) of the - // Connect request. Error codes are always string values. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - RPCConnectRPCErrorCodeKey = attribute.Key("rpc.connect_rpc.error_code") - - // RPCGRPCStatusCodeKey is the attribute Key conforming to the - // "rpc.grpc.status_code" semantic conventions. It represents the [numeric - // status - // code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of - // the gRPC request. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - RPCGRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") - - // RPCJsonrpcErrorCodeKey is the attribute Key conforming to the - // "rpc.jsonrpc.error_code" semantic conventions. It represents the - // `error.code` property of response if it is an error response. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: -32700, 100 - RPCJsonrpcErrorCodeKey = attribute.Key("rpc.jsonrpc.error_code") - - // RPCJsonrpcErrorMessageKey is the attribute Key conforming to the - // "rpc.jsonrpc.error_message" semantic conventions. It represents the - // `error.message` property of response if it is an error response. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Parse error', 'User already exists' - RPCJsonrpcErrorMessageKey = attribute.Key("rpc.jsonrpc.error_message") - - // RPCJsonrpcRequestIDKey is the attribute Key conforming to the - // "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` - // property of request or response. Since protocol allows id to be int, - // string, `null` or missing (for notifications), value is expected to be - // cast to string for simplicity. Use empty string in case of `null` value. - // Omit entirely if this is a notification. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '10', 'request-7', '' - RPCJsonrpcRequestIDKey = attribute.Key("rpc.jsonrpc.request_id") - - // RPCJsonrpcVersionKey is the attribute Key conforming to the - // "rpc.jsonrpc.version" semantic conventions. It represents the protocol - // version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 - // doesn't specify this, the value can be omitted. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2.0', '1.0' - RPCJsonrpcVersionKey = attribute.Key("rpc.jsonrpc.version") - - // RPCMessageCompressedSizeKey is the attribute Key conforming to the - // "rpc.message.compressed_size" semantic conventions. It represents the - // compressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - RPCMessageCompressedSizeKey = attribute.Key("rpc.message.compressed_size") - - // RPCMessageIDKey is the attribute Key conforming to the "rpc.message.id" - // semantic conventions. It represents the mUST be calculated as two - // different counters starting from `1` one for sent messages and one for - // received message. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Note: This way we guarantee that the values will be consistent between - // different implementations. - RPCMessageIDKey = attribute.Key("rpc.message.id") - - // RPCMessageTypeKey is the attribute Key conforming to the - // "rpc.message.type" semantic conventions. It represents the whether this - // is a received or sent message. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - RPCMessageTypeKey = attribute.Key("rpc.message.type") - - // RPCMessageUncompressedSizeKey is the attribute Key conforming to the - // "rpc.message.uncompressed_size" semantic conventions. It represents the - // uncompressed size of the message in bytes. - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - RPCMessageUncompressedSizeKey = attribute.Key("rpc.message.uncompressed_size") - - // RPCMethodKey is the attribute Key conforming to the "rpc.method" - // semantic conventions. It represents the name of the (logical) method - // being called, must be equal to the $method part in the span name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'exampleMethod' - // Note: This is the logical name of the method from the RPC interface - // perspective, which can be different from the name of any implementing - // method/function. The `code.function` attribute may be used to store the - // latter (e.g., method actually executing the call on the server side, RPC - // client stub method on the client side). - RPCMethodKey = attribute.Key("rpc.method") - - // RPCServiceKey is the attribute Key conforming to the "rpc.service" - // semantic conventions. It represents the full (logical) name of the - // service being called, including its package name, if applicable. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'myservice.EchoService' - // Note: This is the logical name of the service from the RPC interface - // perspective, which can be different from the name of any implementing - // class. The `code.namespace` attribute may be used to store the latter - // (despite the attribute name, it may include a class name; e.g., class - // with method actually executing the call on the server side, RPC client - // stub class on the client side). - RPCServiceKey = attribute.Key("rpc.service") - - // RPCSystemKey is the attribute Key conforming to the "rpc.system" - // semantic conventions. It represents a string identifying the remoting - // system. See below for a list of well-known identifiers. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - RPCSystemKey = attribute.Key("rpc.system") -) - -var ( - // cancelled - RPCConnectRPCErrorCodeCancelled = RPCConnectRPCErrorCodeKey.String("cancelled") - // unknown - RPCConnectRPCErrorCodeUnknown = RPCConnectRPCErrorCodeKey.String("unknown") - // invalid_argument - RPCConnectRPCErrorCodeInvalidArgument = RPCConnectRPCErrorCodeKey.String("invalid_argument") - // deadline_exceeded - RPCConnectRPCErrorCodeDeadlineExceeded = RPCConnectRPCErrorCodeKey.String("deadline_exceeded") - // not_found - RPCConnectRPCErrorCodeNotFound = RPCConnectRPCErrorCodeKey.String("not_found") - // already_exists - RPCConnectRPCErrorCodeAlreadyExists = RPCConnectRPCErrorCodeKey.String("already_exists") - // permission_denied - RPCConnectRPCErrorCodePermissionDenied = RPCConnectRPCErrorCodeKey.String("permission_denied") - // resource_exhausted - RPCConnectRPCErrorCodeResourceExhausted = RPCConnectRPCErrorCodeKey.String("resource_exhausted") - // failed_precondition - RPCConnectRPCErrorCodeFailedPrecondition = RPCConnectRPCErrorCodeKey.String("failed_precondition") - // aborted - RPCConnectRPCErrorCodeAborted = RPCConnectRPCErrorCodeKey.String("aborted") - // out_of_range - RPCConnectRPCErrorCodeOutOfRange = RPCConnectRPCErrorCodeKey.String("out_of_range") - // unimplemented - RPCConnectRPCErrorCodeUnimplemented = RPCConnectRPCErrorCodeKey.String("unimplemented") - // internal - RPCConnectRPCErrorCodeInternal = RPCConnectRPCErrorCodeKey.String("internal") - // unavailable - RPCConnectRPCErrorCodeUnavailable = RPCConnectRPCErrorCodeKey.String("unavailable") - // data_loss - RPCConnectRPCErrorCodeDataLoss = RPCConnectRPCErrorCodeKey.String("data_loss") - // unauthenticated - RPCConnectRPCErrorCodeUnauthenticated = RPCConnectRPCErrorCodeKey.String("unauthenticated") -) - -var ( - // OK - RPCGRPCStatusCodeOk = RPCGRPCStatusCodeKey.Int(0) - // CANCELLED - RPCGRPCStatusCodeCancelled = RPCGRPCStatusCodeKey.Int(1) - // UNKNOWN - RPCGRPCStatusCodeUnknown = RPCGRPCStatusCodeKey.Int(2) - // INVALID_ARGUMENT - RPCGRPCStatusCodeInvalidArgument = RPCGRPCStatusCodeKey.Int(3) - // DEADLINE_EXCEEDED - RPCGRPCStatusCodeDeadlineExceeded = RPCGRPCStatusCodeKey.Int(4) - // NOT_FOUND - RPCGRPCStatusCodeNotFound = RPCGRPCStatusCodeKey.Int(5) - // ALREADY_EXISTS - RPCGRPCStatusCodeAlreadyExists = RPCGRPCStatusCodeKey.Int(6) - // PERMISSION_DENIED - RPCGRPCStatusCodePermissionDenied = RPCGRPCStatusCodeKey.Int(7) - // RESOURCE_EXHAUSTED - RPCGRPCStatusCodeResourceExhausted = RPCGRPCStatusCodeKey.Int(8) - // FAILED_PRECONDITION - RPCGRPCStatusCodeFailedPrecondition = RPCGRPCStatusCodeKey.Int(9) - // ABORTED - RPCGRPCStatusCodeAborted = RPCGRPCStatusCodeKey.Int(10) - // OUT_OF_RANGE - RPCGRPCStatusCodeOutOfRange = RPCGRPCStatusCodeKey.Int(11) - // UNIMPLEMENTED - RPCGRPCStatusCodeUnimplemented = RPCGRPCStatusCodeKey.Int(12) - // INTERNAL - RPCGRPCStatusCodeInternal = RPCGRPCStatusCodeKey.Int(13) - // UNAVAILABLE - RPCGRPCStatusCodeUnavailable = RPCGRPCStatusCodeKey.Int(14) - // DATA_LOSS - RPCGRPCStatusCodeDataLoss = RPCGRPCStatusCodeKey.Int(15) - // UNAUTHENTICATED - RPCGRPCStatusCodeUnauthenticated = RPCGRPCStatusCodeKey.Int(16) -) - -var ( - // sent - RPCMessageTypeSent = RPCMessageTypeKey.String("SENT") - // received - RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED") -) - -var ( - // gRPC - RPCSystemGRPC = RPCSystemKey.String("grpc") - // Java RMI - RPCSystemJavaRmi = RPCSystemKey.String("java_rmi") - // .NET WCF - RPCSystemDotnetWcf = RPCSystemKey.String("dotnet_wcf") - // Apache Dubbo - RPCSystemApacheDubbo = RPCSystemKey.String("apache_dubbo") - // Connect RPC - RPCSystemConnectRPC = RPCSystemKey.String("connect_rpc") -) - -// RPCJsonrpcErrorCode returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.error_code" semantic conventions. It represents the -// `error.code` property of response if it is an error response. -func RPCJsonrpcErrorCode(val int) attribute.KeyValue { - return RPCJsonrpcErrorCodeKey.Int(val) -} - -// RPCJsonrpcErrorMessage returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.error_message" semantic conventions. It represents the -// `error.message` property of response if it is an error response. -func RPCJsonrpcErrorMessage(val string) attribute.KeyValue { - return RPCJsonrpcErrorMessageKey.String(val) -} - -// RPCJsonrpcRequestID returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.request_id" semantic conventions. It represents the `id` -// property of request or response. Since protocol allows id to be int, string, -// `null` or missing (for notifications), value is expected to be cast to -// string for simplicity. Use empty string in case of `null` value. Omit -// entirely if this is a notification. -func RPCJsonrpcRequestID(val string) attribute.KeyValue { - return RPCJsonrpcRequestIDKey.String(val) -} - -// RPCJsonrpcVersion returns an attribute KeyValue conforming to the -// "rpc.jsonrpc.version" semantic conventions. It represents the protocol -// version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 -// doesn't specify this, the value can be omitted. -func RPCJsonrpcVersion(val string) attribute.KeyValue { - return RPCJsonrpcVersionKey.String(val) -} - -// RPCMessageCompressedSize returns an attribute KeyValue conforming to the -// "rpc.message.compressed_size" semantic conventions. It represents the -// compressed size of the message in bytes. -func RPCMessageCompressedSize(val int) attribute.KeyValue { - return RPCMessageCompressedSizeKey.Int(val) -} - -// RPCMessageID returns an attribute KeyValue conforming to the -// "rpc.message.id" semantic conventions. It represents the mUST be calculated -// as two different counters starting from `1` one for sent messages and one -// for received message. -func RPCMessageID(val int) attribute.KeyValue { - return RPCMessageIDKey.Int(val) -} - -// RPCMessageUncompressedSize returns an attribute KeyValue conforming to -// the "rpc.message.uncompressed_size" semantic conventions. It represents the -// uncompressed size of the message in bytes. -func RPCMessageUncompressedSize(val int) attribute.KeyValue { - return RPCMessageUncompressedSizeKey.Int(val) -} - -// RPCMethod returns an attribute KeyValue conforming to the "rpc.method" -// semantic conventions. It represents the name of the (logical) method being -// called, must be equal to the $method part in the span name. -func RPCMethod(val string) attribute.KeyValue { - return RPCMethodKey.String(val) -} - -// RPCService returns an attribute KeyValue conforming to the "rpc.service" -// semantic conventions. It represents the full (logical) name of the service -// being called, including its package name, if applicable. -func RPCService(val string) attribute.KeyValue { - return RPCServiceKey.String(val) -} - -// These attributes may be used to describe the server in a connection-based -// network interaction where there is one side that initiates the connection -// (the client is the side that initiates the connection). This covers all TCP -// network interactions since TCP is connection-based and one side initiates -// the connection (an exception is made for peer-to-peer communication over TCP -// where the "user-facing" surface of the protocol / API doesn't expose a clear -// notion of client and server). This also covers UDP network interactions -// where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. -const ( - // ServerAddressKey is the attribute Key conforming to the "server.address" - // semantic conventions. It represents the server domain name if available - // without reverse DNS lookup; otherwise, IP address or Unix domain socket - // name. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'example.com', '10.1.2.80', '/tmp/my.sock' - // Note: When observed from the client side, and when communicating through - // an intermediary, `server.address` SHOULD represent the server address - // behind any intermediaries, for example proxies, if it's available. - ServerAddressKey = attribute.Key("server.address") - - // ServerPortKey is the attribute Key conforming to the "server.port" - // semantic conventions. It represents the server port number. - // - // Type: int - // RequirementLevel: Optional - // Stability: stable - // Examples: 80, 8080, 443 - // Note: When observed from the client side, and when communicating through - // an intermediary, `server.port` SHOULD represent the server port behind - // any intermediaries, for example proxies, if it's available. - ServerPortKey = attribute.Key("server.port") -) - -// ServerAddress returns an attribute KeyValue conforming to the -// "server.address" semantic conventions. It represents the server domain name -// if available without reverse DNS lookup; otherwise, IP address or Unix -// domain socket name. -func ServerAddress(val string) attribute.KeyValue { - return ServerAddressKey.String(val) -} - -// ServerPort returns an attribute KeyValue conforming to the "server.port" -// semantic conventions. It represents the server port number. -func ServerPort(val int) attribute.KeyValue { - return ServerPortKey.Int(val) -} - -// A service instance. -const ( - // ServiceInstanceIDKey is the attribute Key conforming to the - // "service.instance.id" semantic conventions. It represents the string ID - // of the service instance. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '627cc493-f310-47de-96bd-71410b7dec09' - // Note: MUST be unique for each instance of the same - // `service.namespace,service.name` pair (in other words - // `service.namespace,service.name,service.instance.id` triplet MUST be - // globally unique). The ID helps to - // distinguish instances of the same service that exist at the same time - // (e.g. instances of a horizontally scaled - // service). - // - // Implementations, such as SDKs, are recommended to generate a random - // Version 1 or Version 4 [RFC - // 4122](https://www.ietf.org/rfc/rfc4122.txt) UUID, but are free to use an - // inherent unique ID as the source of - // this value if stability is desirable. In that case, the ID SHOULD be - // used as source of a UUID Version 5 and - // SHOULD use the following UUID as the namespace: - // `4d63009a-8d0f-11ee-aad7-4c796ed8e320`. - // - // UUIDs are typically recommended, as only an opaque value for the - // purposes of identifying a service instance is - // needed. Similar to what can be seen in the man page for the - // [`/etc/machine-id`](https://www.freedesktop.org/software/systemd/man/machine-id.html) - // file, the underlying - // data, such as pod name and namespace should be treated as confidential, - // being the user's choice to expose it - // or not via another resource attribute. - // - // For applications running behind an application server (like unicorn), we - // do not recommend using one identifier - // for all processes participating in the application. Instead, it's - // recommended each division (e.g. a worker - // thread in unicorn) to have its own instance.id. - // - // It's not recommended for a Collector to set `service.instance.id` if it - // can't unambiguously determine the - // service instance that is generating that telemetry. For instance, - // creating an UUID based on `pod.name` will - // likely be wrong, as the Collector might not know from which container - // within that pod the telemetry originated. - // However, Collectors can set the `service.instance.id` if they can - // unambiguously determine the service instance - // for that telemetry. This is typically the case for scraping receivers, - // as they know the target address and - // port. - ServiceInstanceIDKey = attribute.Key("service.instance.id") - - // ServiceNameKey is the attribute Key conforming to the "service.name" - // semantic conventions. It represents the logical name of the service. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'shoppingcart' - // Note: MUST be the same for all instances of horizontally scaled - // services. If the value was not specified, SDKs MUST fallback to - // `unknown_service:` concatenated with - // [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If - // `process.executable.name` is not available, the value MUST be set to - // `unknown_service`. - ServiceNameKey = attribute.Key("service.name") - - // ServiceNamespaceKey is the attribute Key conforming to the - // "service.namespace" semantic conventions. It represents a namespace for - // `service.name`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Shop' - // Note: A string value having a meaning that helps to distinguish a group - // of services, for example the team name that owns a group of services. - // `service.name` is expected to be unique within the same namespace. If - // `service.namespace` is not specified in the Resource then `service.name` - // is expected to be unique for all services that have no explicit - // namespace defined (so the empty/unspecified namespace is simply one more - // valid namespace). Zero-length namespace string is assumed equal to - // unspecified namespace. - ServiceNamespaceKey = attribute.Key("service.namespace") - - // ServiceVersionKey is the attribute Key conforming to the - // "service.version" semantic conventions. It represents the version string - // of the service API or implementation. The format is not defined by these - // conventions. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '2.0.0', 'a01dbef8a' - ServiceVersionKey = attribute.Key("service.version") -) - -// ServiceInstanceID returns an attribute KeyValue conforming to the -// "service.instance.id" semantic conventions. It represents the string ID of -// the service instance. -func ServiceInstanceID(val string) attribute.KeyValue { - return ServiceInstanceIDKey.String(val) -} - -// ServiceName returns an attribute KeyValue conforming to the -// "service.name" semantic conventions. It represents the logical name of the -// service. -func ServiceName(val string) attribute.KeyValue { - return ServiceNameKey.String(val) -} - -// ServiceNamespace returns an attribute KeyValue conforming to the -// "service.namespace" semantic conventions. It represents a namespace for -// `service.name`. -func ServiceNamespace(val string) attribute.KeyValue { - return ServiceNamespaceKey.String(val) -} - -// ServiceVersion returns an attribute KeyValue conforming to the -// "service.version" semantic conventions. It represents the version string of -// the service API or implementation. The format is not defined by these -// conventions. -func ServiceVersion(val string) attribute.KeyValue { - return ServiceVersionKey.String(val) -} - -// Session is defined as the period of time encompassing all activities -// performed by the application and the actions executed by the end user. -// Consequently, a Session is represented as a collection of Logs, Events, and -// Spans emitted by the Client Application throughout the Session's duration. -// Each Session is assigned a unique identifier, which is included as an -// attribute in the Logs, Events, and Spans generated during the Session's -// lifecycle. -// When a session reaches end of life, typically due to user inactivity or -// session timeout, a new session identifier will be assigned. The previous -// session identifier may be provided by the instrumentation so that telemetry -// backends can link the two sessions. -const ( - // SessionIDKey is the attribute Key conforming to the "session.id" - // semantic conventions. It represents a unique id to identify a session. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '00112233-4455-6677-8899-aabbccddeeff' - SessionIDKey = attribute.Key("session.id") - - // SessionPreviousIDKey is the attribute Key conforming to the - // "session.previous_id" semantic conventions. It represents the previous - // `session.id` for this user, when known. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '00112233-4455-6677-8899-aabbccddeeff' - SessionPreviousIDKey = attribute.Key("session.previous_id") -) - -// SessionID returns an attribute KeyValue conforming to the "session.id" -// semantic conventions. It represents a unique id to identify a session. -func SessionID(val string) attribute.KeyValue { - return SessionIDKey.String(val) -} - -// SessionPreviousID returns an attribute KeyValue conforming to the -// "session.previous_id" semantic conventions. It represents the previous -// `session.id` for this user, when known. -func SessionPreviousID(val string) attribute.KeyValue { - return SessionPreviousIDKey.String(val) -} - -// SignalR attributes -const ( - // SignalrConnectionStatusKey is the attribute Key conforming to the - // "signalr.connection.status" semantic conventions. It represents the - // signalR HTTP connection closure status. - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'app_shutdown', 'timeout' - SignalrConnectionStatusKey = attribute.Key("signalr.connection.status") - - // SignalrTransportKey is the attribute Key conforming to the - // "signalr.transport" semantic conventions. It represents the [SignalR - // transport - // type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) - // - // Type: Enum - // RequirementLevel: Optional - // Stability: stable - // Examples: 'web_sockets', 'long_polling' - SignalrTransportKey = attribute.Key("signalr.transport") -) - -var ( - // The connection was closed normally - SignalrConnectionStatusNormalClosure = SignalrConnectionStatusKey.String("normal_closure") - // The connection was closed due to a timeout - SignalrConnectionStatusTimeout = SignalrConnectionStatusKey.String("timeout") - // The connection was closed because the app is shutting down - SignalrConnectionStatusAppShutdown = SignalrConnectionStatusKey.String("app_shutdown") -) - -var ( - // ServerSentEvents protocol - SignalrTransportServerSentEvents = SignalrTransportKey.String("server_sent_events") - // LongPolling protocol - SignalrTransportLongPolling = SignalrTransportKey.String("long_polling") - // WebSockets protocol - SignalrTransportWebSockets = SignalrTransportKey.String("web_sockets") -) - -// These attributes may be used to describe the sender of a network -// exchange/packet. These should be used when there is no client/server -// relationship between the two sides, or when that relationship is unknown. -// This covers low-level network interactions (e.g. packet tracing) where you -// don't know if there was a connection or which side initiated it. This also -// covers unidirectional UDP flows and peer-to-peer communication where the -// "user-facing" surface of the protocol / API doesn't expose a clear notion of -// client and server. -const ( - // SourceAddressKey is the attribute Key conforming to the "source.address" - // semantic conventions. It represents the source address - domain name if - // available without reverse DNS lookup; otherwise, IP address or Unix - // domain socket name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'source.example.com', '10.1.2.80', '/tmp/my.sock' - // Note: When observed from the destination side, and when communicating - // through an intermediary, `source.address` SHOULD represent the source - // address behind any intermediaries, for example proxies, if it's - // available. - SourceAddressKey = attribute.Key("source.address") - - // SourcePortKey is the attribute Key conforming to the "source.port" - // semantic conventions. It represents the source port number - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 3389, 2888 - SourcePortKey = attribute.Key("source.port") -) - -// SourceAddress returns an attribute KeyValue conforming to the -// "source.address" semantic conventions. It represents the source address - -// domain name if available without reverse DNS lookup; otherwise, IP address -// or Unix domain socket name. -func SourceAddress(val string) attribute.KeyValue { - return SourceAddressKey.String(val) -} - -// SourcePort returns an attribute KeyValue conforming to the "source.port" -// semantic conventions. It represents the source port number -func SourcePort(val int) attribute.KeyValue { - return SourcePortKey.Int(val) -} - -// Describes System attributes -const ( - // SystemDeviceKey is the attribute Key conforming to the "system.device" - // semantic conventions. It represents the device identifier - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '(identifier)' - SystemDeviceKey = attribute.Key("system.device") -) - -// SystemDevice returns an attribute KeyValue conforming to the -// "system.device" semantic conventions. It represents the device identifier -func SystemDevice(val string) attribute.KeyValue { - return SystemDeviceKey.String(val) -} - -// Describes System CPU attributes -const ( - // SystemCPULogicalNumberKey is the attribute Key conforming to the - // "system.cpu.logical_number" semantic conventions. It represents the - // logical CPU number [0..n-1] - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 1 - SystemCPULogicalNumberKey = attribute.Key("system.cpu.logical_number") - - // SystemCPUStateKey is the attribute Key conforming to the - // "system.cpu.state" semantic conventions. It represents the state of the - // CPU - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'idle', 'interrupt' - SystemCPUStateKey = attribute.Key("system.cpu.state") -) - -var ( - // user - SystemCPUStateUser = SystemCPUStateKey.String("user") - // system - SystemCPUStateSystem = SystemCPUStateKey.String("system") - // nice - SystemCPUStateNice = SystemCPUStateKey.String("nice") - // idle - SystemCPUStateIdle = SystemCPUStateKey.String("idle") - // iowait - SystemCPUStateIowait = SystemCPUStateKey.String("iowait") - // interrupt - SystemCPUStateInterrupt = SystemCPUStateKey.String("interrupt") - // steal - SystemCPUStateSteal = SystemCPUStateKey.String("steal") -) - -// SystemCPULogicalNumber returns an attribute KeyValue conforming to the -// "system.cpu.logical_number" semantic conventions. It represents the logical -// CPU number [0..n-1] -func SystemCPULogicalNumber(val int) attribute.KeyValue { - return SystemCPULogicalNumberKey.Int(val) -} - -// Describes System Memory attributes -const ( - // SystemMemoryStateKey is the attribute Key conforming to the - // "system.memory.state" semantic conventions. It represents the memory - // state - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'free', 'cached' - SystemMemoryStateKey = attribute.Key("system.memory.state") -) - -var ( - // used - SystemMemoryStateUsed = SystemMemoryStateKey.String("used") - // free - SystemMemoryStateFree = SystemMemoryStateKey.String("free") - // shared - SystemMemoryStateShared = SystemMemoryStateKey.String("shared") - // buffers - SystemMemoryStateBuffers = SystemMemoryStateKey.String("buffers") - // cached - SystemMemoryStateCached = SystemMemoryStateKey.String("cached") -) - -// Describes System Memory Paging attributes -const ( - // SystemPagingDirectionKey is the attribute Key conforming to the - // "system.paging.direction" semantic conventions. It represents the paging - // access direction - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'in' - SystemPagingDirectionKey = attribute.Key("system.paging.direction") - - // SystemPagingStateKey is the attribute Key conforming to the - // "system.paging.state" semantic conventions. It represents the memory - // paging state - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'free' - SystemPagingStateKey = attribute.Key("system.paging.state") - - // SystemPagingTypeKey is the attribute Key conforming to the - // "system.paging.type" semantic conventions. It represents the memory - // paging type - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'minor' - SystemPagingTypeKey = attribute.Key("system.paging.type") -) - -var ( - // in - SystemPagingDirectionIn = SystemPagingDirectionKey.String("in") - // out - SystemPagingDirectionOut = SystemPagingDirectionKey.String("out") -) - -var ( - // used - SystemPagingStateUsed = SystemPagingStateKey.String("used") - // free - SystemPagingStateFree = SystemPagingStateKey.String("free") -) - -var ( - // major - SystemPagingTypeMajor = SystemPagingTypeKey.String("major") - // minor - SystemPagingTypeMinor = SystemPagingTypeKey.String("minor") -) - -// Describes Filesystem attributes -const ( - // SystemFilesystemModeKey is the attribute Key conforming to the - // "system.filesystem.mode" semantic conventions. It represents the - // filesystem mode - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'rw, ro' - SystemFilesystemModeKey = attribute.Key("system.filesystem.mode") - - // SystemFilesystemMountpointKey is the attribute Key conforming to the - // "system.filesystem.mountpoint" semantic conventions. It represents the - // filesystem mount path - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/mnt/data' - SystemFilesystemMountpointKey = attribute.Key("system.filesystem.mountpoint") - - // SystemFilesystemStateKey is the attribute Key conforming to the - // "system.filesystem.state" semantic conventions. It represents the - // filesystem state - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'used' - SystemFilesystemStateKey = attribute.Key("system.filesystem.state") - - // SystemFilesystemTypeKey is the attribute Key conforming to the - // "system.filesystem.type" semantic conventions. It represents the - // filesystem type - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'ext4' - SystemFilesystemTypeKey = attribute.Key("system.filesystem.type") -) - -var ( - // used - SystemFilesystemStateUsed = SystemFilesystemStateKey.String("used") - // free - SystemFilesystemStateFree = SystemFilesystemStateKey.String("free") - // reserved - SystemFilesystemStateReserved = SystemFilesystemStateKey.String("reserved") -) - -var ( - // fat32 - SystemFilesystemTypeFat32 = SystemFilesystemTypeKey.String("fat32") - // exfat - SystemFilesystemTypeExfat = SystemFilesystemTypeKey.String("exfat") - // ntfs - SystemFilesystemTypeNtfs = SystemFilesystemTypeKey.String("ntfs") - // refs - SystemFilesystemTypeRefs = SystemFilesystemTypeKey.String("refs") - // hfsplus - SystemFilesystemTypeHfsplus = SystemFilesystemTypeKey.String("hfsplus") - // ext4 - SystemFilesystemTypeExt4 = SystemFilesystemTypeKey.String("ext4") -) - -// SystemFilesystemMode returns an attribute KeyValue conforming to the -// "system.filesystem.mode" semantic conventions. It represents the filesystem -// mode -func SystemFilesystemMode(val string) attribute.KeyValue { - return SystemFilesystemModeKey.String(val) -} - -// SystemFilesystemMountpoint returns an attribute KeyValue conforming to -// the "system.filesystem.mountpoint" semantic conventions. It represents the -// filesystem mount path -func SystemFilesystemMountpoint(val string) attribute.KeyValue { - return SystemFilesystemMountpointKey.String(val) -} - -// Describes Network attributes -const ( - // SystemNetworkStateKey is the attribute Key conforming to the - // "system.network.state" semantic conventions. It represents a stateless - // protocol MUST NOT set this attribute - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'close_wait' - SystemNetworkStateKey = attribute.Key("system.network.state") -) - -var ( - // close - SystemNetworkStateClose = SystemNetworkStateKey.String("close") - // close_wait - SystemNetworkStateCloseWait = SystemNetworkStateKey.String("close_wait") - // closing - SystemNetworkStateClosing = SystemNetworkStateKey.String("closing") - // delete - SystemNetworkStateDelete = SystemNetworkStateKey.String("delete") - // established - SystemNetworkStateEstablished = SystemNetworkStateKey.String("established") - // fin_wait_1 - SystemNetworkStateFinWait1 = SystemNetworkStateKey.String("fin_wait_1") - // fin_wait_2 - SystemNetworkStateFinWait2 = SystemNetworkStateKey.String("fin_wait_2") - // last_ack - SystemNetworkStateLastAck = SystemNetworkStateKey.String("last_ack") - // listen - SystemNetworkStateListen = SystemNetworkStateKey.String("listen") - // syn_recv - SystemNetworkStateSynRecv = SystemNetworkStateKey.String("syn_recv") - // syn_sent - SystemNetworkStateSynSent = SystemNetworkStateKey.String("syn_sent") - // time_wait - SystemNetworkStateTimeWait = SystemNetworkStateKey.String("time_wait") -) - -// Describes System Process attributes -const ( - // SystemProcessStatusKey is the attribute Key conforming to the - // "system.process.status" semantic conventions. It represents the process - // state, e.g., [Linux Process State - // Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES) - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'running' - SystemProcessStatusKey = attribute.Key("system.process.status") -) - -var ( - // running - SystemProcessStatusRunning = SystemProcessStatusKey.String("running") - // sleeping - SystemProcessStatusSleeping = SystemProcessStatusKey.String("sleeping") - // stopped - SystemProcessStatusStopped = SystemProcessStatusKey.String("stopped") - // defunct - SystemProcessStatusDefunct = SystemProcessStatusKey.String("defunct") -) - -// Attributes for telemetry SDK. -const ( - // TelemetrySDKLanguageKey is the attribute Key conforming to the - // "telemetry.sdk.language" semantic conventions. It represents the - // language of the telemetry SDK. - // - // Type: Enum - // RequirementLevel: Required - // Stability: stable - TelemetrySDKLanguageKey = attribute.Key("telemetry.sdk.language") - - // TelemetrySDKNameKey is the attribute Key conforming to the - // "telemetry.sdk.name" semantic conventions. It represents the name of the - // telemetry SDK as defined above. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: 'opentelemetry' - // Note: The OpenTelemetry SDK MUST set the `telemetry.sdk.name` attribute - // to `opentelemetry`. - // If another SDK, like a fork or a vendor-provided implementation, is - // used, this SDK MUST set the - // `telemetry.sdk.name` attribute to the fully-qualified class or module - // name of this SDK's main entry point - // or another suitable identifier depending on the language. - // The identifier `opentelemetry` is reserved and MUST NOT be used in this - // case. - // All custom identifiers SHOULD be stable across different versions of an - // implementation. - TelemetrySDKNameKey = attribute.Key("telemetry.sdk.name") - - // TelemetrySDKVersionKey is the attribute Key conforming to the - // "telemetry.sdk.version" semantic conventions. It represents the version - // string of the telemetry SDK. - // - // Type: string - // RequirementLevel: Required - // Stability: stable - // Examples: '1.2.3' - TelemetrySDKVersionKey = attribute.Key("telemetry.sdk.version") - - // TelemetryDistroNameKey is the attribute Key conforming to the - // "telemetry.distro.name" semantic conventions. It represents the name of - // the auto instrumentation agent or distribution, if used. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'parts-unlimited-java' - // Note: Official auto instrumentation agents and distributions SHOULD set - // the `telemetry.distro.name` attribute to - // a string starting with `opentelemetry-`, e.g. - // `opentelemetry-java-instrumentation`. - TelemetryDistroNameKey = attribute.Key("telemetry.distro.name") - - // TelemetryDistroVersionKey is the attribute Key conforming to the - // "telemetry.distro.version" semantic conventions. It represents the - // version string of the auto instrumentation agent or distribution, if - // used. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1.2.3' - TelemetryDistroVersionKey = attribute.Key("telemetry.distro.version") -) - -var ( - // cpp - TelemetrySDKLanguageCPP = TelemetrySDKLanguageKey.String("cpp") - // dotnet - TelemetrySDKLanguageDotnet = TelemetrySDKLanguageKey.String("dotnet") - // erlang - TelemetrySDKLanguageErlang = TelemetrySDKLanguageKey.String("erlang") - // go - TelemetrySDKLanguageGo = TelemetrySDKLanguageKey.String("go") - // java - TelemetrySDKLanguageJava = TelemetrySDKLanguageKey.String("java") - // nodejs - TelemetrySDKLanguageNodejs = TelemetrySDKLanguageKey.String("nodejs") - // php - TelemetrySDKLanguagePHP = TelemetrySDKLanguageKey.String("php") - // python - TelemetrySDKLanguagePython = TelemetrySDKLanguageKey.String("python") - // ruby - TelemetrySDKLanguageRuby = TelemetrySDKLanguageKey.String("ruby") - // rust - TelemetrySDKLanguageRust = TelemetrySDKLanguageKey.String("rust") - // swift - TelemetrySDKLanguageSwift = TelemetrySDKLanguageKey.String("swift") - // webjs - TelemetrySDKLanguageWebjs = TelemetrySDKLanguageKey.String("webjs") -) - -// TelemetrySDKName returns an attribute KeyValue conforming to the -// "telemetry.sdk.name" semantic conventions. It represents the name of the -// telemetry SDK as defined above. -func TelemetrySDKName(val string) attribute.KeyValue { - return TelemetrySDKNameKey.String(val) -} - -// TelemetrySDKVersion returns an attribute KeyValue conforming to the -// "telemetry.sdk.version" semantic conventions. It represents the version -// string of the telemetry SDK. -func TelemetrySDKVersion(val string) attribute.KeyValue { - return TelemetrySDKVersionKey.String(val) -} - -// TelemetryDistroName returns an attribute KeyValue conforming to the -// "telemetry.distro.name" semantic conventions. It represents the name of the -// auto instrumentation agent or distribution, if used. -func TelemetryDistroName(val string) attribute.KeyValue { - return TelemetryDistroNameKey.String(val) -} - -// TelemetryDistroVersion returns an attribute KeyValue conforming to the -// "telemetry.distro.version" semantic conventions. It represents the version -// string of the auto instrumentation agent or distribution, if used. -func TelemetryDistroVersion(val string) attribute.KeyValue { - return TelemetryDistroVersionKey.String(val) -} - -// These attributes may be used for any operation to store information about a -// thread that started a span. -const ( - // ThreadIDKey is the attribute Key conforming to the "thread.id" semantic - // conventions. It represents the current "managed" thread ID (as opposed - // to OS thread ID). - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 42 - ThreadIDKey = attribute.Key("thread.id") - - // ThreadNameKey is the attribute Key conforming to the "thread.name" - // semantic conventions. It represents the current thread name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'main' - ThreadNameKey = attribute.Key("thread.name") -) - -// ThreadID returns an attribute KeyValue conforming to the "thread.id" -// semantic conventions. It represents the current "managed" thread ID (as -// opposed to OS thread ID). -func ThreadID(val int) attribute.KeyValue { - return ThreadIDKey.Int(val) -} - -// ThreadName returns an attribute KeyValue conforming to the "thread.name" -// semantic conventions. It represents the current thread name. -func ThreadName(val string) attribute.KeyValue { - return ThreadNameKey.String(val) -} - -// Semantic convention attributes in the TLS namespace. -const ( - // TLSCipherKey is the attribute Key conforming to the "tls.cipher" - // semantic conventions. It represents the string indicating the - // [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) - // used during the current connection. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'TLS_RSA_WITH_3DES_EDE_CBC_SHA', - // 'TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256' - // Note: The values allowed for `tls.cipher` MUST be one of the - // `Descriptions` of the [registered TLS Cipher - // Suits](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4). - TLSCipherKey = attribute.Key("tls.cipher") - - // TLSClientCertificateKey is the attribute Key conforming to the - // "tls.client.certificate" semantic conventions. It represents the - // pEM-encoded stand-alone certificate offered by the client. This is - // usually mutually-exclusive of `client.certificate_chain` since this - // value also exists in that list. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'MII...' - TLSClientCertificateKey = attribute.Key("tls.client.certificate") - - // TLSClientCertificateChainKey is the attribute Key conforming to the - // "tls.client.certificate_chain" semantic conventions. It represents the - // array of PEM-encoded certificates that make up the certificate chain - // offered by the client. This is usually mutually-exclusive of - // `client.certificate` since that value should be the first certificate in - // the chain. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'MII...', 'MI...' - TLSClientCertificateChainKey = attribute.Key("tls.client.certificate_chain") - - // TLSClientHashMd5Key is the attribute Key conforming to the - // "tls.client.hash.md5" semantic conventions. It represents the - // certificate fingerprint using the MD5 digest of DER-encoded version of - // certificate offered by the client. For consistency with other hash - // values, this value should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' - TLSClientHashMd5Key = attribute.Key("tls.client.hash.md5") - - // TLSClientHashSha1Key is the attribute Key conforming to the - // "tls.client.hash.sha1" semantic conventions. It represents the - // certificate fingerprint using the SHA1 digest of DER-encoded version of - // certificate offered by the client. For consistency with other hash - // values, this value should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' - TLSClientHashSha1Key = attribute.Key("tls.client.hash.sha1") - - // TLSClientHashSha256Key is the attribute Key conforming to the - // "tls.client.hash.sha256" semantic conventions. It represents the - // certificate fingerprint using the SHA256 digest of DER-encoded version - // of certificate offered by the client. For consistency with other hash - // values, this value should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' - TLSClientHashSha256Key = attribute.Key("tls.client.hash.sha256") - - // TLSClientIssuerKey is the attribute Key conforming to the - // "tls.client.issuer" semantic conventions. It represents the - // distinguished name of - // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) - // of the issuer of the x.509 certificate presented by the client. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, - // DC=com' - TLSClientIssuerKey = attribute.Key("tls.client.issuer") - - // TLSClientJa3Key is the attribute Key conforming to the "tls.client.ja3" - // semantic conventions. It represents a hash that identifies clients based - // on how they perform an SSL/TLS handshake. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'd4e5b18d6b55c71272893221c96ba240' - TLSClientJa3Key = attribute.Key("tls.client.ja3") - - // TLSClientNotAfterKey is the attribute Key conforming to the - // "tls.client.not_after" semantic conventions. It represents the date/Time - // indicating when client certificate is no longer considered valid. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2021-01-01T00:00:00.000Z' - TLSClientNotAfterKey = attribute.Key("tls.client.not_after") - - // TLSClientNotBeforeKey is the attribute Key conforming to the - // "tls.client.not_before" semantic conventions. It represents the - // date/Time indicating when client certificate is first considered valid. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1970-01-01T00:00:00.000Z' - TLSClientNotBeforeKey = attribute.Key("tls.client.not_before") - - // TLSClientServerNameKey is the attribute Key conforming to the - // "tls.client.server_name" semantic conventions. It represents the also - // called an SNI, this tells the server which hostname to which the client - // is attempting to connect to. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'opentelemetry.io' - TLSClientServerNameKey = attribute.Key("tls.client.server_name") - - // TLSClientSubjectKey is the attribute Key conforming to the - // "tls.client.subject" semantic conventions. It represents the - // distinguished name of subject of the x.509 certificate presented by the - // client. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'CN=myclient, OU=Documentation Team, DC=example, DC=com' - TLSClientSubjectKey = attribute.Key("tls.client.subject") - - // TLSClientSupportedCiphersKey is the attribute Key conforming to the - // "tls.client.supported_ciphers" semantic conventions. It represents the - // array of ciphers offered by the client during the client hello. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: '"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", - // "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "..."' - TLSClientSupportedCiphersKey = attribute.Key("tls.client.supported_ciphers") - - // TLSCurveKey is the attribute Key conforming to the "tls.curve" semantic - // conventions. It represents the string indicating the curve used for the - // given cipher, when applicable - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'secp256r1' - TLSCurveKey = attribute.Key("tls.curve") - - // TLSEstablishedKey is the attribute Key conforming to the - // "tls.established" semantic conventions. It represents the boolean flag - // indicating if the TLS negotiation was successful and transitioned to an - // encrypted tunnel. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - // Examples: True - TLSEstablishedKey = attribute.Key("tls.established") - - // TLSNextProtocolKey is the attribute Key conforming to the - // "tls.next_protocol" semantic conventions. It represents the string - // indicating the protocol being tunneled. Per the values in the [IANA - // registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), - // this string should be lower case. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'http/1.1' - TLSNextProtocolKey = attribute.Key("tls.next_protocol") - - // TLSProtocolNameKey is the attribute Key conforming to the - // "tls.protocol.name" semantic conventions. It represents the normalized - // lowercase protocol name parsed from original string of the negotiated - // [SSL/TLS protocol - // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) - // - // Type: Enum - // RequirementLevel: Optional - // Stability: experimental - TLSProtocolNameKey = attribute.Key("tls.protocol.name") - - // TLSProtocolVersionKey is the attribute Key conforming to the - // "tls.protocol.version" semantic conventions. It represents the numeric - // part of the version parsed from the original string of the negotiated - // [SSL/TLS protocol - // version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1.2', '3' - TLSProtocolVersionKey = attribute.Key("tls.protocol.version") - - // TLSResumedKey is the attribute Key conforming to the "tls.resumed" - // semantic conventions. It represents the boolean flag indicating if this - // TLS connection was resumed from an existing TLS negotiation. - // - // Type: boolean - // RequirementLevel: Optional - // Stability: experimental - // Examples: True - TLSResumedKey = attribute.Key("tls.resumed") - - // TLSServerCertificateKey is the attribute Key conforming to the - // "tls.server.certificate" semantic conventions. It represents the - // pEM-encoded stand-alone certificate offered by the server. This is - // usually mutually-exclusive of `server.certificate_chain` since this - // value also exists in that list. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'MII...' - TLSServerCertificateKey = attribute.Key("tls.server.certificate") - - // TLSServerCertificateChainKey is the attribute Key conforming to the - // "tls.server.certificate_chain" semantic conventions. It represents the - // array of PEM-encoded certificates that make up the certificate chain - // offered by the server. This is usually mutually-exclusive of - // `server.certificate` since that value should be the first certificate in - // the chain. - // - // Type: string[] - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'MII...', 'MI...' - TLSServerCertificateChainKey = attribute.Key("tls.server.certificate_chain") - - // TLSServerHashMd5Key is the attribute Key conforming to the - // "tls.server.hash.md5" semantic conventions. It represents the - // certificate fingerprint using the MD5 digest of DER-encoded version of - // certificate offered by the server. For consistency with other hash - // values, this value should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '0F76C7F2C55BFD7D8E8B8F4BFBF0C9EC' - TLSServerHashMd5Key = attribute.Key("tls.server.hash.md5") - - // TLSServerHashSha1Key is the attribute Key conforming to the - // "tls.server.hash.sha1" semantic conventions. It represents the - // certificate fingerprint using the SHA1 digest of DER-encoded version of - // certificate offered by the server. For consistency with other hash - // values, this value should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '9E393D93138888D288266C2D915214D1D1CCEB2A' - TLSServerHashSha1Key = attribute.Key("tls.server.hash.sha1") - - // TLSServerHashSha256Key is the attribute Key conforming to the - // "tls.server.hash.sha256" semantic conventions. It represents the - // certificate fingerprint using the SHA256 digest of DER-encoded version - // of certificate offered by the server. For consistency with other hash - // values, this value should be formatted as an uppercase hash. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: - // '0687F666A054EF17A08E2F2162EAB4CBC0D265E1D7875BE74BF3C712CA92DAF0' - TLSServerHashSha256Key = attribute.Key("tls.server.hash.sha256") - - // TLSServerIssuerKey is the attribute Key conforming to the - // "tls.server.issuer" semantic conventions. It represents the - // distinguished name of - // [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) - // of the issuer of the x.509 certificate presented by the client. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'CN=Example Root CA, OU=Infrastructure Team, DC=example, - // DC=com' - TLSServerIssuerKey = attribute.Key("tls.server.issuer") - - // TLSServerJa3sKey is the attribute Key conforming to the - // "tls.server.ja3s" semantic conventions. It represents a hash that - // identifies servers based on how they perform an SSL/TLS handshake. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'd4e5b18d6b55c71272893221c96ba240' - TLSServerJa3sKey = attribute.Key("tls.server.ja3s") - - // TLSServerNotAfterKey is the attribute Key conforming to the - // "tls.server.not_after" semantic conventions. It represents the date/Time - // indicating when server certificate is no longer considered valid. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '2021-01-01T00:00:00.000Z' - TLSServerNotAfterKey = attribute.Key("tls.server.not_after") - - // TLSServerNotBeforeKey is the attribute Key conforming to the - // "tls.server.not_before" semantic conventions. It represents the - // date/Time indicating when server certificate is first considered valid. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '1970-01-01T00:00:00.000Z' - TLSServerNotBeforeKey = attribute.Key("tls.server.not_before") - - // TLSServerSubjectKey is the attribute Key conforming to the - // "tls.server.subject" semantic conventions. It represents the - // distinguished name of subject of the x.509 certificate presented by the - // server. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'CN=myserver, OU=Documentation Team, DC=example, DC=com' - TLSServerSubjectKey = attribute.Key("tls.server.subject") -) - -var ( - // ssl - TLSProtocolNameSsl = TLSProtocolNameKey.String("ssl") - // tls - TLSProtocolNameTLS = TLSProtocolNameKey.String("tls") -) - -// TLSCipher returns an attribute KeyValue conforming to the "tls.cipher" -// semantic conventions. It represents the string indicating the -// [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) used -// during the current connection. -func TLSCipher(val string) attribute.KeyValue { - return TLSCipherKey.String(val) -} - -// TLSClientCertificate returns an attribute KeyValue conforming to the -// "tls.client.certificate" semantic conventions. It represents the pEM-encoded -// stand-alone certificate offered by the client. This is usually -// mutually-exclusive of `client.certificate_chain` since this value also -// exists in that list. -func TLSClientCertificate(val string) attribute.KeyValue { - return TLSClientCertificateKey.String(val) -} - -// TLSClientCertificateChain returns an attribute KeyValue conforming to the -// "tls.client.certificate_chain" semantic conventions. It represents the array -// of PEM-encoded certificates that make up the certificate chain offered by -// the client. This is usually mutually-exclusive of `client.certificate` since -// that value should be the first certificate in the chain. -func TLSClientCertificateChain(val ...string) attribute.KeyValue { - return TLSClientCertificateChainKey.StringSlice(val) -} - -// TLSClientHashMd5 returns an attribute KeyValue conforming to the -// "tls.client.hash.md5" semantic conventions. It represents the certificate -// fingerprint using the MD5 digest of DER-encoded version of certificate -// offered by the client. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSClientHashMd5(val string) attribute.KeyValue { - return TLSClientHashMd5Key.String(val) -} - -// TLSClientHashSha1 returns an attribute KeyValue conforming to the -// "tls.client.hash.sha1" semantic conventions. It represents the certificate -// fingerprint using the SHA1 digest of DER-encoded version of certificate -// offered by the client. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSClientHashSha1(val string) attribute.KeyValue { - return TLSClientHashSha1Key.String(val) -} - -// TLSClientHashSha256 returns an attribute KeyValue conforming to the -// "tls.client.hash.sha256" semantic conventions. It represents the certificate -// fingerprint using the SHA256 digest of DER-encoded version of certificate -// offered by the client. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSClientHashSha256(val string) attribute.KeyValue { - return TLSClientHashSha256Key.String(val) -} - -// TLSClientIssuer returns an attribute KeyValue conforming to the -// "tls.client.issuer" semantic conventions. It represents the distinguished -// name of -// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of -// the issuer of the x.509 certificate presented by the client. -func TLSClientIssuer(val string) attribute.KeyValue { - return TLSClientIssuerKey.String(val) -} - -// TLSClientJa3 returns an attribute KeyValue conforming to the -// "tls.client.ja3" semantic conventions. It represents a hash that identifies -// clients based on how they perform an SSL/TLS handshake. -func TLSClientJa3(val string) attribute.KeyValue { - return TLSClientJa3Key.String(val) -} - -// TLSClientNotAfter returns an attribute KeyValue conforming to the -// "tls.client.not_after" semantic conventions. It represents the date/Time -// indicating when client certificate is no longer considered valid. -func TLSClientNotAfter(val string) attribute.KeyValue { - return TLSClientNotAfterKey.String(val) -} - -// TLSClientNotBefore returns an attribute KeyValue conforming to the -// "tls.client.not_before" semantic conventions. It represents the date/Time -// indicating when client certificate is first considered valid. -func TLSClientNotBefore(val string) attribute.KeyValue { - return TLSClientNotBeforeKey.String(val) -} - -// TLSClientServerName returns an attribute KeyValue conforming to the -// "tls.client.server_name" semantic conventions. It represents the also called -// an SNI, this tells the server which hostname to which the client is -// attempting to connect to. -func TLSClientServerName(val string) attribute.KeyValue { - return TLSClientServerNameKey.String(val) -} - -// TLSClientSubject returns an attribute KeyValue conforming to the -// "tls.client.subject" semantic conventions. It represents the distinguished -// name of subject of the x.509 certificate presented by the client. -func TLSClientSubject(val string) attribute.KeyValue { - return TLSClientSubjectKey.String(val) -} - -// TLSClientSupportedCiphers returns an attribute KeyValue conforming to the -// "tls.client.supported_ciphers" semantic conventions. It represents the array -// of ciphers offered by the client during the client hello. -func TLSClientSupportedCiphers(val ...string) attribute.KeyValue { - return TLSClientSupportedCiphersKey.StringSlice(val) -} - -// TLSCurve returns an attribute KeyValue conforming to the "tls.curve" -// semantic conventions. It represents the string indicating the curve used for -// the given cipher, when applicable -func TLSCurve(val string) attribute.KeyValue { - return TLSCurveKey.String(val) -} - -// TLSEstablished returns an attribute KeyValue conforming to the -// "tls.established" semantic conventions. It represents the boolean flag -// indicating if the TLS negotiation was successful and transitioned to an -// encrypted tunnel. -func TLSEstablished(val bool) attribute.KeyValue { - return TLSEstablishedKey.Bool(val) -} - -// TLSNextProtocol returns an attribute KeyValue conforming to the -// "tls.next_protocol" semantic conventions. It represents the string -// indicating the protocol being tunneled. Per the values in the [IANA -// registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), -// this string should be lower case. -func TLSNextProtocol(val string) attribute.KeyValue { - return TLSNextProtocolKey.String(val) -} - -// TLSProtocolVersion returns an attribute KeyValue conforming to the -// "tls.protocol.version" semantic conventions. It represents the numeric part -// of the version parsed from the original string of the negotiated [SSL/TLS -// protocol -// version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES) -func TLSProtocolVersion(val string) attribute.KeyValue { - return TLSProtocolVersionKey.String(val) -} - -// TLSResumed returns an attribute KeyValue conforming to the "tls.resumed" -// semantic conventions. It represents the boolean flag indicating if this TLS -// connection was resumed from an existing TLS negotiation. -func TLSResumed(val bool) attribute.KeyValue { - return TLSResumedKey.Bool(val) -} - -// TLSServerCertificate returns an attribute KeyValue conforming to the -// "tls.server.certificate" semantic conventions. It represents the pEM-encoded -// stand-alone certificate offered by the server. This is usually -// mutually-exclusive of `server.certificate_chain` since this value also -// exists in that list. -func TLSServerCertificate(val string) attribute.KeyValue { - return TLSServerCertificateKey.String(val) -} - -// TLSServerCertificateChain returns an attribute KeyValue conforming to the -// "tls.server.certificate_chain" semantic conventions. It represents the array -// of PEM-encoded certificates that make up the certificate chain offered by -// the server. This is usually mutually-exclusive of `server.certificate` since -// that value should be the first certificate in the chain. -func TLSServerCertificateChain(val ...string) attribute.KeyValue { - return TLSServerCertificateChainKey.StringSlice(val) -} - -// TLSServerHashMd5 returns an attribute KeyValue conforming to the -// "tls.server.hash.md5" semantic conventions. It represents the certificate -// fingerprint using the MD5 digest of DER-encoded version of certificate -// offered by the server. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSServerHashMd5(val string) attribute.KeyValue { - return TLSServerHashMd5Key.String(val) -} - -// TLSServerHashSha1 returns an attribute KeyValue conforming to the -// "tls.server.hash.sha1" semantic conventions. It represents the certificate -// fingerprint using the SHA1 digest of DER-encoded version of certificate -// offered by the server. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSServerHashSha1(val string) attribute.KeyValue { - return TLSServerHashSha1Key.String(val) -} - -// TLSServerHashSha256 returns an attribute KeyValue conforming to the -// "tls.server.hash.sha256" semantic conventions. It represents the certificate -// fingerprint using the SHA256 digest of DER-encoded version of certificate -// offered by the server. For consistency with other hash values, this value -// should be formatted as an uppercase hash. -func TLSServerHashSha256(val string) attribute.KeyValue { - return TLSServerHashSha256Key.String(val) -} - -// TLSServerIssuer returns an attribute KeyValue conforming to the -// "tls.server.issuer" semantic conventions. It represents the distinguished -// name of -// [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of -// the issuer of the x.509 certificate presented by the client. -func TLSServerIssuer(val string) attribute.KeyValue { - return TLSServerIssuerKey.String(val) -} - -// TLSServerJa3s returns an attribute KeyValue conforming to the -// "tls.server.ja3s" semantic conventions. It represents a hash that identifies -// servers based on how they perform an SSL/TLS handshake. -func TLSServerJa3s(val string) attribute.KeyValue { - return TLSServerJa3sKey.String(val) -} - -// TLSServerNotAfter returns an attribute KeyValue conforming to the -// "tls.server.not_after" semantic conventions. It represents the date/Time -// indicating when server certificate is no longer considered valid. -func TLSServerNotAfter(val string) attribute.KeyValue { - return TLSServerNotAfterKey.String(val) -} - -// TLSServerNotBefore returns an attribute KeyValue conforming to the -// "tls.server.not_before" semantic conventions. It represents the date/Time -// indicating when server certificate is first considered valid. -func TLSServerNotBefore(val string) attribute.KeyValue { - return TLSServerNotBeforeKey.String(val) -} - -// TLSServerSubject returns an attribute KeyValue conforming to the -// "tls.server.subject" semantic conventions. It represents the distinguished -// name of subject of the x.509 certificate presented by the server. -func TLSServerSubject(val string) attribute.KeyValue { - return TLSServerSubjectKey.String(val) -} - -// Attributes describing URL. -const ( - // URLDomainKey is the attribute Key conforming to the "url.domain" - // semantic conventions. It represents the domain extracted from the - // `url.full`, such as "opentelemetry.io". - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'www.foo.bar', 'opentelemetry.io', '3.12.167.2', - // '[1080:0:0:0:8:800:200C:417A]' - // Note: In some cases a URL may refer to an IP and/or port directly, - // without a domain name. In this case, the IP address would go to the - // domain field. If the URL contains a [literal IPv6 - // address](https://www.rfc-editor.org/rfc/rfc2732#section-2) enclosed by - // `[` and `]`, the `[` and `]` characters should also be captured in the - // domain field. - URLDomainKey = attribute.Key("url.domain") - - // URLExtensionKey is the attribute Key conforming to the "url.extension" - // semantic conventions. It represents the file extension extracted from - // the `url.full`, excluding the leading dot. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'png', 'gz' - // Note: The file extension is only set if it exists, as not every url has - // a file extension. When the file name has multiple extensions - // `example.tar.gz`, only the last one should be captured `gz`, not - // `tar.gz`. - URLExtensionKey = attribute.Key("url.extension") - - // URLFragmentKey is the attribute Key conforming to the "url.fragment" - // semantic conventions. It represents the [URI - // fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'SemConv' - URLFragmentKey = attribute.Key("url.fragment") - - // URLFullKey is the attribute Key conforming to the "url.full" semantic - // conventions. It represents the absolute URL describing a network - // resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', - // '//localhost' - // Note: For network calls, URL usually has - // `scheme://host[:port][path][?query][#fragment]` format, where the - // fragment is not transmitted over HTTP, but if it is known, it SHOULD be - // included nevertheless. - // `url.full` MUST NOT contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case username and - // password SHOULD be redacted and attribute's value SHOULD be - // `https://REDACTED:REDACTED@www.example.com/`. - // `url.full` SHOULD capture the absolute URL when it is available (or can - // be reconstructed). Sensitive content provided in `url.full` SHOULD be - // scrubbed when instrumentations can identify it. - URLFullKey = attribute.Key("url.full") - - // URLOriginalKey is the attribute Key conforming to the "url.original" - // semantic conventions. It represents the unmodified original URL as seen - // in the event source. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'https://www.foo.bar/search?q=OpenTelemetry#SemConv', - // 'search?q=OpenTelemetry' - // Note: In network monitoring, the observed URL may be a full URL, whereas - // in access logs, the URL is often just represented as a path. This field - // is meant to represent the URL as it was observed, complete or not. - // `url.original` might contain credentials passed via URL in form of - // `https://username:password@www.example.com/`. In such case password and - // username SHOULD NOT be redacted and attribute's value SHOULD remain the - // same. - URLOriginalKey = attribute.Key("url.original") - - // URLPathKey is the attribute Key conforming to the "url.path" semantic - // conventions. It represents the [URI - // path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: '/search' - // Note: Sensitive content provided in `url.path` SHOULD be scrubbed when - // instrumentations can identify it. - URLPathKey = attribute.Key("url.path") - - // URLPortKey is the attribute Key conforming to the "url.port" semantic - // conventions. It represents the port extracted from the `url.full` - // - // Type: int - // RequirementLevel: Optional - // Stability: experimental - // Examples: 443 - URLPortKey = attribute.Key("url.port") - - // URLQueryKey is the attribute Key conforming to the "url.query" semantic - // conventions. It represents the [URI - // query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'q=OpenTelemetry' - // Note: Sensitive content provided in `url.query` SHOULD be scrubbed when - // instrumentations can identify it. - URLQueryKey = attribute.Key("url.query") - - // URLRegisteredDomainKey is the attribute Key conforming to the - // "url.registered_domain" semantic conventions. It represents the highest - // registered url domain, stripped of the subdomain. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'example.com', 'foo.co.uk' - // Note: This value can be determined precisely with the [public suffix - // list](http://publicsuffix.org). For example, the registered domain for - // `foo.example.com` is `example.com`. Trying to approximate this by simply - // taking the last two labels will not work well for TLDs such as `co.uk`. - URLRegisteredDomainKey = attribute.Key("url.registered_domain") - - // URLSchemeKey is the attribute Key conforming to the "url.scheme" - // semantic conventions. It represents the [URI - // scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component - // identifying the used protocol. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'https', 'ftp', 'telnet' - URLSchemeKey = attribute.Key("url.scheme") - - // URLSubdomainKey is the attribute Key conforming to the "url.subdomain" - // semantic conventions. It represents the subdomain portion of a fully - // qualified domain name includes all of the names except the host name - // under the registered_domain. In a partially qualified domain, or if the - // qualification level of the full name cannot be determined, subdomain - // contains all of the names below the registered domain. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'east', 'sub2.sub1' - // Note: The subdomain portion of `www.east.mydomain.co.uk` is `east`. If - // the domain has multiple levels of subdomain, such as - // `sub2.sub1.example.com`, the subdomain field should contain `sub2.sub1`, - // with no trailing period. - URLSubdomainKey = attribute.Key("url.subdomain") - - // URLTemplateKey is the attribute Key conforming to the "url.template" - // semantic conventions. It represents the low-cardinality template of an - // [absolute path - // reference](https://www.rfc-editor.org/rfc/rfc3986#section-4.2). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '/users/{id}', '/users/:id', '/users?id={id}' - URLTemplateKey = attribute.Key("url.template") - - // URLTopLevelDomainKey is the attribute Key conforming to the - // "url.top_level_domain" semantic conventions. It represents the effective - // top level domain (eTLD), also known as the domain suffix, is the last - // part of the domain name. For example, the top level domain for - // example.com is `com`. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'com', 'co.uk' - // Note: This value can be determined precisely with the [public suffix - // list](http://publicsuffix.org). - URLTopLevelDomainKey = attribute.Key("url.top_level_domain") -) - -// URLDomain returns an attribute KeyValue conforming to the "url.domain" -// semantic conventions. It represents the domain extracted from the -// `url.full`, such as "opentelemetry.io". -func URLDomain(val string) attribute.KeyValue { - return URLDomainKey.String(val) -} - -// URLExtension returns an attribute KeyValue conforming to the -// "url.extension" semantic conventions. It represents the file extension -// extracted from the `url.full`, excluding the leading dot. -func URLExtension(val string) attribute.KeyValue { - return URLExtensionKey.String(val) -} - -// URLFragment returns an attribute KeyValue conforming to the -// "url.fragment" semantic conventions. It represents the [URI -// fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component -func URLFragment(val string) attribute.KeyValue { - return URLFragmentKey.String(val) -} - -// URLFull returns an attribute KeyValue conforming to the "url.full" -// semantic conventions. It represents the absolute URL describing a network -// resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) -func URLFull(val string) attribute.KeyValue { - return URLFullKey.String(val) -} - -// URLOriginal returns an attribute KeyValue conforming to the -// "url.original" semantic conventions. It represents the unmodified original -// URL as seen in the event source. -func URLOriginal(val string) attribute.KeyValue { - return URLOriginalKey.String(val) -} - -// URLPath returns an attribute KeyValue conforming to the "url.path" -// semantic conventions. It represents the [URI -// path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component -func URLPath(val string) attribute.KeyValue { - return URLPathKey.String(val) -} - -// URLPort returns an attribute KeyValue conforming to the "url.port" -// semantic conventions. It represents the port extracted from the `url.full` -func URLPort(val int) attribute.KeyValue { - return URLPortKey.Int(val) -} - -// URLQuery returns an attribute KeyValue conforming to the "url.query" -// semantic conventions. It represents the [URI -// query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component -func URLQuery(val string) attribute.KeyValue { - return URLQueryKey.String(val) -} - -// URLRegisteredDomain returns an attribute KeyValue conforming to the -// "url.registered_domain" semantic conventions. It represents the highest -// registered url domain, stripped of the subdomain. -func URLRegisteredDomain(val string) attribute.KeyValue { - return URLRegisteredDomainKey.String(val) -} - -// URLScheme returns an attribute KeyValue conforming to the "url.scheme" -// semantic conventions. It represents the [URI -// scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component -// identifying the used protocol. -func URLScheme(val string) attribute.KeyValue { - return URLSchemeKey.String(val) -} - -// URLSubdomain returns an attribute KeyValue conforming to the -// "url.subdomain" semantic conventions. It represents the subdomain portion of -// a fully qualified domain name includes all of the names except the host name -// under the registered_domain. In a partially qualified domain, or if the -// qualification level of the full name cannot be determined, subdomain -// contains all of the names below the registered domain. -func URLSubdomain(val string) attribute.KeyValue { - return URLSubdomainKey.String(val) -} - -// URLTemplate returns an attribute KeyValue conforming to the -// "url.template" semantic conventions. It represents the low-cardinality -// template of an [absolute path -// reference](https://www.rfc-editor.org/rfc/rfc3986#section-4.2). -func URLTemplate(val string) attribute.KeyValue { - return URLTemplateKey.String(val) -} - -// URLTopLevelDomain returns an attribute KeyValue conforming to the -// "url.top_level_domain" semantic conventions. It represents the effective top -// level domain (eTLD), also known as the domain suffix, is the last part of -// the domain name. For example, the top level domain for example.com is `com`. -func URLTopLevelDomain(val string) attribute.KeyValue { - return URLTopLevelDomainKey.String(val) -} - -// Describes user-agent attributes. -const ( - // UserAgentNameKey is the attribute Key conforming to the - // "user_agent.name" semantic conventions. It represents the name of the - // user-agent extracted from original. Usually refers to the browser's - // name. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'Safari', 'YourApp' - // Note: [Example](https://www.whatsmyua.info) of extracting browser's name - // from original string. In the case of using a user-agent for non-browser - // products, such as microservices with multiple names/versions inside the - // `user_agent.original`, the most significant name SHOULD be selected. In - // such a scenario it should align with `user_agent.version` - UserAgentNameKey = attribute.Key("user_agent.name") - - // UserAgentOriginalKey is the attribute Key conforming to the - // "user_agent.original" semantic conventions. It represents the value of - // the [HTTP - // User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) - // header sent by the client. - // - // Type: string - // RequirementLevel: Optional - // Stability: stable - // Examples: 'CERN-LineMode/2.15 libwww/2.17b3', 'Mozilla/5.0 (iPhone; CPU - // iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) - // Version/14.1.2 Mobile/15E148 Safari/604.1', 'YourApp/1.0.0 - // grpc-java-okhttp/1.27.2' - UserAgentOriginalKey = attribute.Key("user_agent.original") - - // UserAgentVersionKey is the attribute Key conforming to the - // "user_agent.version" semantic conventions. It represents the version of - // the user-agent extracted from original. Usually refers to the browser's - // version - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '14.1.2', '1.0.0' - // Note: [Example](https://www.whatsmyua.info) of extracting browser's - // version from original string. In the case of using a user-agent for - // non-browser products, such as microservices with multiple names/versions - // inside the `user_agent.original`, the most significant version SHOULD be - // selected. In such a scenario it should align with `user_agent.name` - UserAgentVersionKey = attribute.Key("user_agent.version") -) - -// UserAgentName returns an attribute KeyValue conforming to the -// "user_agent.name" semantic conventions. It represents the name of the -// user-agent extracted from original. Usually refers to the browser's name. -func UserAgentName(val string) attribute.KeyValue { - return UserAgentNameKey.String(val) -} - -// UserAgentOriginal returns an attribute KeyValue conforming to the -// "user_agent.original" semantic conventions. It represents the value of the -// [HTTP -// User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) -// header sent by the client. -func UserAgentOriginal(val string) attribute.KeyValue { - return UserAgentOriginalKey.String(val) -} - -// UserAgentVersion returns an attribute KeyValue conforming to the -// "user_agent.version" semantic conventions. It represents the version of the -// user-agent extracted from original. Usually refers to the browser's version -func UserAgentVersion(val string) attribute.KeyValue { - return UserAgentVersionKey.String(val) -} - -// The attributes used to describe the packaged software running the -// application code. -const ( - // WebEngineDescriptionKey is the attribute Key conforming to the - // "webengine.description" semantic conventions. It represents the - // additional description of the web engine (e.g. detailed version and - // edition information). - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'WildFly Full 21.0.0.Final (WildFly Core 13.0.1.Final) - - // 2.2.2.Final' - WebEngineDescriptionKey = attribute.Key("webengine.description") - - // WebEngineNameKey is the attribute Key conforming to the "webengine.name" - // semantic conventions. It represents the name of the web engine. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: 'WildFly' - WebEngineNameKey = attribute.Key("webengine.name") - - // WebEngineVersionKey is the attribute Key conforming to the - // "webengine.version" semantic conventions. It represents the version of - // the web engine. - // - // Type: string - // RequirementLevel: Optional - // Stability: experimental - // Examples: '21.0.0' - WebEngineVersionKey = attribute.Key("webengine.version") -) - -// WebEngineDescription returns an attribute KeyValue conforming to the -// "webengine.description" semantic conventions. It represents the additional -// description of the web engine (e.g. detailed version and edition -// information). -func WebEngineDescription(val string) attribute.KeyValue { - return WebEngineDescriptionKey.String(val) -} - -// WebEngineName returns an attribute KeyValue conforming to the -// "webengine.name" semantic conventions. It represents the name of the web -// engine. -func WebEngineName(val string) attribute.KeyValue { - return WebEngineNameKey.String(val) -} - -// WebEngineVersion returns an attribute KeyValue conforming to the -// "webengine.version" semantic conventions. It represents the version of the -// web engine. -func WebEngineVersion(val string) attribute.KeyValue { - return WebEngineVersionKey.String(val) -} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go deleted file mode 100644 index d031bbea78..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Package semconv implements OpenTelemetry semantic conventions. -// -// OpenTelemetry semantic conventions are agreed standardized naming -// patterns for OpenTelemetry things. This package represents the v1.26.0 -// version of the OpenTelemetry semantic conventions. -package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go deleted file mode 100644 index bfaee0d56e..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/exception.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" - -const ( - // ExceptionEventName is the name of the Span event representing an exception. - ExceptionEventName = "exception" -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go deleted file mode 100644 index fcdb9f4859..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/metric.go +++ /dev/null @@ -1,1307 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// Code generated from semantic convention specification. DO NOT EDIT. - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" - -const ( - - // ContainerCPUTime is the metric conforming to the "container.cpu.time" - // semantic conventions. It represents the total CPU time consumed. - // Instrument: counter - // Unit: s - // Stability: Experimental - ContainerCPUTimeName = "container.cpu.time" - ContainerCPUTimeUnit = "s" - ContainerCPUTimeDescription = "Total CPU time consumed" - - // ContainerMemoryUsage is the metric conforming to the - // "container.memory.usage" semantic conventions. It represents the memory - // usage of the container. - // Instrument: counter - // Unit: By - // Stability: Experimental - ContainerMemoryUsageName = "container.memory.usage" - ContainerMemoryUsageUnit = "By" - ContainerMemoryUsageDescription = "Memory usage of the container." - - // ContainerDiskIo is the metric conforming to the "container.disk.io" semantic - // conventions. It represents the disk bytes for the container. - // Instrument: counter - // Unit: By - // Stability: Experimental - ContainerDiskIoName = "container.disk.io" - ContainerDiskIoUnit = "By" - ContainerDiskIoDescription = "Disk bytes for the container." - - // ContainerNetworkIo is the metric conforming to the "container.network.io" - // semantic conventions. It represents the network bytes for the container. - // Instrument: counter - // Unit: By - // Stability: Experimental - ContainerNetworkIoName = "container.network.io" - ContainerNetworkIoUnit = "By" - ContainerNetworkIoDescription = "Network bytes for the container." - - // DBClientOperationDuration is the metric conforming to the - // "db.client.operation.duration" semantic conventions. It represents the - // duration of database client operations. - // Instrument: histogram - // Unit: s - // Stability: Experimental - DBClientOperationDurationName = "db.client.operation.duration" - DBClientOperationDurationUnit = "s" - DBClientOperationDurationDescription = "Duration of database client operations." - - // DBClientConnectionCount is the metric conforming to the - // "db.client.connection.count" semantic conventions. It represents the number - // of connections that are currently in state described by the `state` - // attribute. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionCountName = "db.client.connection.count" - DBClientConnectionCountUnit = "{connection}" - DBClientConnectionCountDescription = "The number of connections that are currently in state described by the `state` attribute" - - // DBClientConnectionIdleMax is the metric conforming to the - // "db.client.connection.idle.max" semantic conventions. It represents the - // maximum number of idle open connections allowed. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionIdleMaxName = "db.client.connection.idle.max" - DBClientConnectionIdleMaxUnit = "{connection}" - DBClientConnectionIdleMaxDescription = "The maximum number of idle open connections allowed" - - // DBClientConnectionIdleMin is the metric conforming to the - // "db.client.connection.idle.min" semantic conventions. It represents the - // minimum number of idle open connections allowed. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionIdleMinName = "db.client.connection.idle.min" - DBClientConnectionIdleMinUnit = "{connection}" - DBClientConnectionIdleMinDescription = "The minimum number of idle open connections allowed" - - // DBClientConnectionMax is the metric conforming to the - // "db.client.connection.max" semantic conventions. It represents the maximum - // number of open connections allowed. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionMaxName = "db.client.connection.max" - DBClientConnectionMaxUnit = "{connection}" - DBClientConnectionMaxDescription = "The maximum number of open connections allowed" - - // DBClientConnectionPendingRequests is the metric conforming to the - // "db.client.connection.pending_requests" semantic conventions. It represents - // the number of pending requests for an open connection, cumulative for the - // entire pool. - // Instrument: updowncounter - // Unit: {request} - // Stability: Experimental - DBClientConnectionPendingRequestsName = "db.client.connection.pending_requests" - DBClientConnectionPendingRequestsUnit = "{request}" - DBClientConnectionPendingRequestsDescription = "The number of pending requests for an open connection, cumulative for the entire pool" - - // DBClientConnectionTimeouts is the metric conforming to the - // "db.client.connection.timeouts" semantic conventions. It represents the - // number of connection timeouts that have occurred trying to obtain a - // connection from the pool. - // Instrument: counter - // Unit: {timeout} - // Stability: Experimental - DBClientConnectionTimeoutsName = "db.client.connection.timeouts" - DBClientConnectionTimeoutsUnit = "{timeout}" - DBClientConnectionTimeoutsDescription = "The number of connection timeouts that have occurred trying to obtain a connection from the pool" - - // DBClientConnectionCreateTime is the metric conforming to the - // "db.client.connection.create_time" semantic conventions. It represents the - // time it took to create a new connection. - // Instrument: histogram - // Unit: s - // Stability: Experimental - DBClientConnectionCreateTimeName = "db.client.connection.create_time" - DBClientConnectionCreateTimeUnit = "s" - DBClientConnectionCreateTimeDescription = "The time it took to create a new connection" - - // DBClientConnectionWaitTime is the metric conforming to the - // "db.client.connection.wait_time" semantic conventions. It represents the - // time it took to obtain an open connection from the pool. - // Instrument: histogram - // Unit: s - // Stability: Experimental - DBClientConnectionWaitTimeName = "db.client.connection.wait_time" - DBClientConnectionWaitTimeUnit = "s" - DBClientConnectionWaitTimeDescription = "The time it took to obtain an open connection from the pool" - - // DBClientConnectionUseTime is the metric conforming to the - // "db.client.connection.use_time" semantic conventions. It represents the time - // between borrowing a connection and returning it to the pool. - // Instrument: histogram - // Unit: s - // Stability: Experimental - DBClientConnectionUseTimeName = "db.client.connection.use_time" - DBClientConnectionUseTimeUnit = "s" - DBClientConnectionUseTimeDescription = "The time between borrowing a connection and returning it to the pool" - - // DBClientConnectionsUsage is the metric conforming to the - // "db.client.connections.usage" semantic conventions. It represents the - // deprecated, use `db.client.connection.count` instead. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionsUsageName = "db.client.connections.usage" - DBClientConnectionsUsageUnit = "{connection}" - DBClientConnectionsUsageDescription = "Deprecated, use `db.client.connection.count` instead." - - // DBClientConnectionsIdleMax is the metric conforming to the - // "db.client.connections.idle.max" semantic conventions. It represents the - // deprecated, use `db.client.connection.idle.max` instead. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionsIdleMaxName = "db.client.connections.idle.max" - DBClientConnectionsIdleMaxUnit = "{connection}" - DBClientConnectionsIdleMaxDescription = "Deprecated, use `db.client.connection.idle.max` instead." - - // DBClientConnectionsIdleMin is the metric conforming to the - // "db.client.connections.idle.min" semantic conventions. It represents the - // deprecated, use `db.client.connection.idle.min` instead. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionsIdleMinName = "db.client.connections.idle.min" - DBClientConnectionsIdleMinUnit = "{connection}" - DBClientConnectionsIdleMinDescription = "Deprecated, use `db.client.connection.idle.min` instead." - - // DBClientConnectionsMax is the metric conforming to the - // "db.client.connections.max" semantic conventions. It represents the - // deprecated, use `db.client.connection.max` instead. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - DBClientConnectionsMaxName = "db.client.connections.max" - DBClientConnectionsMaxUnit = "{connection}" - DBClientConnectionsMaxDescription = "Deprecated, use `db.client.connection.max` instead." - - // DBClientConnectionsPendingRequests is the metric conforming to the - // "db.client.connections.pending_requests" semantic conventions. It represents - // the deprecated, use `db.client.connection.pending_requests` instead. - // Instrument: updowncounter - // Unit: {request} - // Stability: Experimental - DBClientConnectionsPendingRequestsName = "db.client.connections.pending_requests" - DBClientConnectionsPendingRequestsUnit = "{request}" - DBClientConnectionsPendingRequestsDescription = "Deprecated, use `db.client.connection.pending_requests` instead." - - // DBClientConnectionsTimeouts is the metric conforming to the - // "db.client.connections.timeouts" semantic conventions. It represents the - // deprecated, use `db.client.connection.timeouts` instead. - // Instrument: counter - // Unit: {timeout} - // Stability: Experimental - DBClientConnectionsTimeoutsName = "db.client.connections.timeouts" - DBClientConnectionsTimeoutsUnit = "{timeout}" - DBClientConnectionsTimeoutsDescription = "Deprecated, use `db.client.connection.timeouts` instead." - - // DBClientConnectionsCreateTime is the metric conforming to the - // "db.client.connections.create_time" semantic conventions. It represents the - // deprecated, use `db.client.connection.create_time` instead. Note: the unit - // also changed from `ms` to `s`. - // Instrument: histogram - // Unit: ms - // Stability: Experimental - DBClientConnectionsCreateTimeName = "db.client.connections.create_time" - DBClientConnectionsCreateTimeUnit = "ms" - DBClientConnectionsCreateTimeDescription = "Deprecated, use `db.client.connection.create_time` instead. Note: the unit also changed from `ms` to `s`." - - // DBClientConnectionsWaitTime is the metric conforming to the - // "db.client.connections.wait_time" semantic conventions. It represents the - // deprecated, use `db.client.connection.wait_time` instead. Note: the unit - // also changed from `ms` to `s`. - // Instrument: histogram - // Unit: ms - // Stability: Experimental - DBClientConnectionsWaitTimeName = "db.client.connections.wait_time" - DBClientConnectionsWaitTimeUnit = "ms" - DBClientConnectionsWaitTimeDescription = "Deprecated, use `db.client.connection.wait_time` instead. Note: the unit also changed from `ms` to `s`." - - // DBClientConnectionsUseTime is the metric conforming to the - // "db.client.connections.use_time" semantic conventions. It represents the - // deprecated, use `db.client.connection.use_time` instead. Note: the unit also - // changed from `ms` to `s`. - // Instrument: histogram - // Unit: ms - // Stability: Experimental - DBClientConnectionsUseTimeName = "db.client.connections.use_time" - DBClientConnectionsUseTimeUnit = "ms" - DBClientConnectionsUseTimeDescription = "Deprecated, use `db.client.connection.use_time` instead. Note: the unit also changed from `ms` to `s`." - - // DNSLookupDuration is the metric conforming to the "dns.lookup.duration" - // semantic conventions. It represents the measures the time taken to perform a - // DNS lookup. - // Instrument: histogram - // Unit: s - // Stability: Experimental - DNSLookupDurationName = "dns.lookup.duration" - DNSLookupDurationUnit = "s" - DNSLookupDurationDescription = "Measures the time taken to perform a DNS lookup." - - // AspnetcoreRoutingMatchAttempts is the metric conforming to the - // "aspnetcore.routing.match_attempts" semantic conventions. It represents the - // number of requests that were attempted to be matched to an endpoint. - // Instrument: counter - // Unit: {match_attempt} - // Stability: Stable - AspnetcoreRoutingMatchAttemptsName = "aspnetcore.routing.match_attempts" - AspnetcoreRoutingMatchAttemptsUnit = "{match_attempt}" - AspnetcoreRoutingMatchAttemptsDescription = "Number of requests that were attempted to be matched to an endpoint." - - // AspnetcoreDiagnosticsExceptions is the metric conforming to the - // "aspnetcore.diagnostics.exceptions" semantic conventions. It represents the - // number of exceptions caught by exception handling middleware. - // Instrument: counter - // Unit: {exception} - // Stability: Stable - AspnetcoreDiagnosticsExceptionsName = "aspnetcore.diagnostics.exceptions" - AspnetcoreDiagnosticsExceptionsUnit = "{exception}" - AspnetcoreDiagnosticsExceptionsDescription = "Number of exceptions caught by exception handling middleware." - - // AspnetcoreRateLimitingActiveRequestLeases is the metric conforming to the - // "aspnetcore.rate_limiting.active_request_leases" semantic conventions. It - // represents the number of requests that are currently active on the server - // that hold a rate limiting lease. - // Instrument: updowncounter - // Unit: {request} - // Stability: Stable - AspnetcoreRateLimitingActiveRequestLeasesName = "aspnetcore.rate_limiting.active_request_leases" - AspnetcoreRateLimitingActiveRequestLeasesUnit = "{request}" - AspnetcoreRateLimitingActiveRequestLeasesDescription = "Number of requests that are currently active on the server that hold a rate limiting lease." - - // AspnetcoreRateLimitingRequestLeaseDuration is the metric conforming to the - // "aspnetcore.rate_limiting.request_lease.duration" semantic conventions. It - // represents the duration of rate limiting lease held by requests on the - // server. - // Instrument: histogram - // Unit: s - // Stability: Stable - AspnetcoreRateLimitingRequestLeaseDurationName = "aspnetcore.rate_limiting.request_lease.duration" - AspnetcoreRateLimitingRequestLeaseDurationUnit = "s" - AspnetcoreRateLimitingRequestLeaseDurationDescription = "The duration of rate limiting lease held by requests on the server." - - // AspnetcoreRateLimitingRequestTimeInQueue is the metric conforming to the - // "aspnetcore.rate_limiting.request.time_in_queue" semantic conventions. It - // represents the time the request spent in a queue waiting to acquire a rate - // limiting lease. - // Instrument: histogram - // Unit: s - // Stability: Stable - AspnetcoreRateLimitingRequestTimeInQueueName = "aspnetcore.rate_limiting.request.time_in_queue" - AspnetcoreRateLimitingRequestTimeInQueueUnit = "s" - AspnetcoreRateLimitingRequestTimeInQueueDescription = "The time the request spent in a queue waiting to acquire a rate limiting lease." - - // AspnetcoreRateLimitingQueuedRequests is the metric conforming to the - // "aspnetcore.rate_limiting.queued_requests" semantic conventions. It - // represents the number of requests that are currently queued, waiting to - // acquire a rate limiting lease. - // Instrument: updowncounter - // Unit: {request} - // Stability: Stable - AspnetcoreRateLimitingQueuedRequestsName = "aspnetcore.rate_limiting.queued_requests" - AspnetcoreRateLimitingQueuedRequestsUnit = "{request}" - AspnetcoreRateLimitingQueuedRequestsDescription = "Number of requests that are currently queued, waiting to acquire a rate limiting lease." - - // AspnetcoreRateLimitingRequests is the metric conforming to the - // "aspnetcore.rate_limiting.requests" semantic conventions. It represents the - // number of requests that tried to acquire a rate limiting lease. - // Instrument: counter - // Unit: {request} - // Stability: Stable - AspnetcoreRateLimitingRequestsName = "aspnetcore.rate_limiting.requests" - AspnetcoreRateLimitingRequestsUnit = "{request}" - AspnetcoreRateLimitingRequestsDescription = "Number of requests that tried to acquire a rate limiting lease." - - // KestrelActiveConnections is the metric conforming to the - // "kestrel.active_connections" semantic conventions. It represents the number - // of connections that are currently active on the server. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Stable - KestrelActiveConnectionsName = "kestrel.active_connections" - KestrelActiveConnectionsUnit = "{connection}" - KestrelActiveConnectionsDescription = "Number of connections that are currently active on the server." - - // KestrelConnectionDuration is the metric conforming to the - // "kestrel.connection.duration" semantic conventions. It represents the - // duration of connections on the server. - // Instrument: histogram - // Unit: s - // Stability: Stable - KestrelConnectionDurationName = "kestrel.connection.duration" - KestrelConnectionDurationUnit = "s" - KestrelConnectionDurationDescription = "The duration of connections on the server." - - // KestrelRejectedConnections is the metric conforming to the - // "kestrel.rejected_connections" semantic conventions. It represents the - // number of connections rejected by the server. - // Instrument: counter - // Unit: {connection} - // Stability: Stable - KestrelRejectedConnectionsName = "kestrel.rejected_connections" - KestrelRejectedConnectionsUnit = "{connection}" - KestrelRejectedConnectionsDescription = "Number of connections rejected by the server." - - // KestrelQueuedConnections is the metric conforming to the - // "kestrel.queued_connections" semantic conventions. It represents the number - // of connections that are currently queued and are waiting to start. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Stable - KestrelQueuedConnectionsName = "kestrel.queued_connections" - KestrelQueuedConnectionsUnit = "{connection}" - KestrelQueuedConnectionsDescription = "Number of connections that are currently queued and are waiting to start." - - // KestrelQueuedRequests is the metric conforming to the - // "kestrel.queued_requests" semantic conventions. It represents the number of - // HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are - // currently queued and are waiting to start. - // Instrument: updowncounter - // Unit: {request} - // Stability: Stable - KestrelQueuedRequestsName = "kestrel.queued_requests" - KestrelQueuedRequestsUnit = "{request}" - KestrelQueuedRequestsDescription = "Number of HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are currently queued and are waiting to start." - - // KestrelUpgradedConnections is the metric conforming to the - // "kestrel.upgraded_connections" semantic conventions. It represents the - // number of connections that are currently upgraded (WebSockets). . - // Instrument: updowncounter - // Unit: {connection} - // Stability: Stable - KestrelUpgradedConnectionsName = "kestrel.upgraded_connections" - KestrelUpgradedConnectionsUnit = "{connection}" - KestrelUpgradedConnectionsDescription = "Number of connections that are currently upgraded (WebSockets). ." - - // KestrelTLSHandshakeDuration is the metric conforming to the - // "kestrel.tls_handshake.duration" semantic conventions. It represents the - // duration of TLS handshakes on the server. - // Instrument: histogram - // Unit: s - // Stability: Stable - KestrelTLSHandshakeDurationName = "kestrel.tls_handshake.duration" - KestrelTLSHandshakeDurationUnit = "s" - KestrelTLSHandshakeDurationDescription = "The duration of TLS handshakes on the server." - - // KestrelActiveTLSHandshakes is the metric conforming to the - // "kestrel.active_tls_handshakes" semantic conventions. It represents the - // number of TLS handshakes that are currently in progress on the server. - // Instrument: updowncounter - // Unit: {handshake} - // Stability: Stable - KestrelActiveTLSHandshakesName = "kestrel.active_tls_handshakes" - KestrelActiveTLSHandshakesUnit = "{handshake}" - KestrelActiveTLSHandshakesDescription = "Number of TLS handshakes that are currently in progress on the server." - - // SignalrServerConnectionDuration is the metric conforming to the - // "signalr.server.connection.duration" semantic conventions. It represents the - // duration of connections on the server. - // Instrument: histogram - // Unit: s - // Stability: Stable - SignalrServerConnectionDurationName = "signalr.server.connection.duration" - SignalrServerConnectionDurationUnit = "s" - SignalrServerConnectionDurationDescription = "The duration of connections on the server." - - // SignalrServerActiveConnections is the metric conforming to the - // "signalr.server.active_connections" semantic conventions. It represents the - // number of connections that are currently active on the server. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Stable - SignalrServerActiveConnectionsName = "signalr.server.active_connections" - SignalrServerActiveConnectionsUnit = "{connection}" - SignalrServerActiveConnectionsDescription = "Number of connections that are currently active on the server." - - // FaaSInvokeDuration is the metric conforming to the "faas.invoke_duration" - // semantic conventions. It represents the measures the duration of the - // function's logic execution. - // Instrument: histogram - // Unit: s - // Stability: Experimental - FaaSInvokeDurationName = "faas.invoke_duration" - FaaSInvokeDurationUnit = "s" - FaaSInvokeDurationDescription = "Measures the duration of the function's logic execution" - - // FaaSInitDuration is the metric conforming to the "faas.init_duration" - // semantic conventions. It represents the measures the duration of the - // function's initialization, such as a cold start. - // Instrument: histogram - // Unit: s - // Stability: Experimental - FaaSInitDurationName = "faas.init_duration" - FaaSInitDurationUnit = "s" - FaaSInitDurationDescription = "Measures the duration of the function's initialization, such as a cold start" - - // FaaSColdstarts is the metric conforming to the "faas.coldstarts" semantic - // conventions. It represents the number of invocation cold starts. - // Instrument: counter - // Unit: {coldstart} - // Stability: Experimental - FaaSColdstartsName = "faas.coldstarts" - FaaSColdstartsUnit = "{coldstart}" - FaaSColdstartsDescription = "Number of invocation cold starts" - - // FaaSErrors is the metric conforming to the "faas.errors" semantic - // conventions. It represents the number of invocation errors. - // Instrument: counter - // Unit: {error} - // Stability: Experimental - FaaSErrorsName = "faas.errors" - FaaSErrorsUnit = "{error}" - FaaSErrorsDescription = "Number of invocation errors" - - // FaaSInvocations is the metric conforming to the "faas.invocations" semantic - // conventions. It represents the number of successful invocations. - // Instrument: counter - // Unit: {invocation} - // Stability: Experimental - FaaSInvocationsName = "faas.invocations" - FaaSInvocationsUnit = "{invocation}" - FaaSInvocationsDescription = "Number of successful invocations" - - // FaaSTimeouts is the metric conforming to the "faas.timeouts" semantic - // conventions. It represents the number of invocation timeouts. - // Instrument: counter - // Unit: {timeout} - // Stability: Experimental - FaaSTimeoutsName = "faas.timeouts" - FaaSTimeoutsUnit = "{timeout}" - FaaSTimeoutsDescription = "Number of invocation timeouts" - - // FaaSMemUsage is the metric conforming to the "faas.mem_usage" semantic - // conventions. It represents the distribution of max memory usage per - // invocation. - // Instrument: histogram - // Unit: By - // Stability: Experimental - FaaSMemUsageName = "faas.mem_usage" - FaaSMemUsageUnit = "By" - FaaSMemUsageDescription = "Distribution of max memory usage per invocation" - - // FaaSCPUUsage is the metric conforming to the "faas.cpu_usage" semantic - // conventions. It represents the distribution of CPU usage per invocation. - // Instrument: histogram - // Unit: s - // Stability: Experimental - FaaSCPUUsageName = "faas.cpu_usage" - FaaSCPUUsageUnit = "s" - FaaSCPUUsageDescription = "Distribution of CPU usage per invocation" - - // FaaSNetIo is the metric conforming to the "faas.net_io" semantic - // conventions. It represents the distribution of net I/O usage per invocation. - // Instrument: histogram - // Unit: By - // Stability: Experimental - FaaSNetIoName = "faas.net_io" - FaaSNetIoUnit = "By" - FaaSNetIoDescription = "Distribution of net I/O usage per invocation" - - // HTTPServerRequestDuration is the metric conforming to the - // "http.server.request.duration" semantic conventions. It represents the - // duration of HTTP server requests. - // Instrument: histogram - // Unit: s - // Stability: Stable - HTTPServerRequestDurationName = "http.server.request.duration" - HTTPServerRequestDurationUnit = "s" - HTTPServerRequestDurationDescription = "Duration of HTTP server requests." - - // HTTPServerActiveRequests is the metric conforming to the - // "http.server.active_requests" semantic conventions. It represents the number - // of active HTTP server requests. - // Instrument: updowncounter - // Unit: {request} - // Stability: Experimental - HTTPServerActiveRequestsName = "http.server.active_requests" - HTTPServerActiveRequestsUnit = "{request}" - HTTPServerActiveRequestsDescription = "Number of active HTTP server requests." - - // HTTPServerRequestBodySize is the metric conforming to the - // "http.server.request.body.size" semantic conventions. It represents the size - // of HTTP server request bodies. - // Instrument: histogram - // Unit: By - // Stability: Experimental - HTTPServerRequestBodySizeName = "http.server.request.body.size" - HTTPServerRequestBodySizeUnit = "By" - HTTPServerRequestBodySizeDescription = "Size of HTTP server request bodies." - - // HTTPServerResponseBodySize is the metric conforming to the - // "http.server.response.body.size" semantic conventions. It represents the - // size of HTTP server response bodies. - // Instrument: histogram - // Unit: By - // Stability: Experimental - HTTPServerResponseBodySizeName = "http.server.response.body.size" - HTTPServerResponseBodySizeUnit = "By" - HTTPServerResponseBodySizeDescription = "Size of HTTP server response bodies." - - // HTTPClientRequestDuration is the metric conforming to the - // "http.client.request.duration" semantic conventions. It represents the - // duration of HTTP client requests. - // Instrument: histogram - // Unit: s - // Stability: Stable - HTTPClientRequestDurationName = "http.client.request.duration" - HTTPClientRequestDurationUnit = "s" - HTTPClientRequestDurationDescription = "Duration of HTTP client requests." - - // HTTPClientRequestBodySize is the metric conforming to the - // "http.client.request.body.size" semantic conventions. It represents the size - // of HTTP client request bodies. - // Instrument: histogram - // Unit: By - // Stability: Experimental - HTTPClientRequestBodySizeName = "http.client.request.body.size" - HTTPClientRequestBodySizeUnit = "By" - HTTPClientRequestBodySizeDescription = "Size of HTTP client request bodies." - - // HTTPClientResponseBodySize is the metric conforming to the - // "http.client.response.body.size" semantic conventions. It represents the - // size of HTTP client response bodies. - // Instrument: histogram - // Unit: By - // Stability: Experimental - HTTPClientResponseBodySizeName = "http.client.response.body.size" - HTTPClientResponseBodySizeUnit = "By" - HTTPClientResponseBodySizeDescription = "Size of HTTP client response bodies." - - // HTTPClientOpenConnections is the metric conforming to the - // "http.client.open_connections" semantic conventions. It represents the - // number of outbound HTTP connections that are currently active or idle on the - // client. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - HTTPClientOpenConnectionsName = "http.client.open_connections" - HTTPClientOpenConnectionsUnit = "{connection}" - HTTPClientOpenConnectionsDescription = "Number of outbound HTTP connections that are currently active or idle on the client." - - // HTTPClientConnectionDuration is the metric conforming to the - // "http.client.connection.duration" semantic conventions. It represents the - // duration of the successfully established outbound HTTP connections. - // Instrument: histogram - // Unit: s - // Stability: Experimental - HTTPClientConnectionDurationName = "http.client.connection.duration" - HTTPClientConnectionDurationUnit = "s" - HTTPClientConnectionDurationDescription = "The duration of the successfully established outbound HTTP connections." - - // HTTPClientActiveRequests is the metric conforming to the - // "http.client.active_requests" semantic conventions. It represents the number - // of active HTTP requests. - // Instrument: updowncounter - // Unit: {request} - // Stability: Experimental - HTTPClientActiveRequestsName = "http.client.active_requests" - HTTPClientActiveRequestsUnit = "{request}" - HTTPClientActiveRequestsDescription = "Number of active HTTP requests." - - // JvmMemoryInit is the metric conforming to the "jvm.memory.init" semantic - // conventions. It represents the measure of initial memory requested. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - JvmMemoryInitName = "jvm.memory.init" - JvmMemoryInitUnit = "By" - JvmMemoryInitDescription = "Measure of initial memory requested." - - // JvmSystemCPUUtilization is the metric conforming to the - // "jvm.system.cpu.utilization" semantic conventions. It represents the recent - // CPU utilization for the whole system as reported by the JVM. - // Instrument: gauge - // Unit: 1 - // Stability: Experimental - JvmSystemCPUUtilizationName = "jvm.system.cpu.utilization" - JvmSystemCPUUtilizationUnit = "1" - JvmSystemCPUUtilizationDescription = "Recent CPU utilization for the whole system as reported by the JVM." - - // JvmSystemCPULoad1m is the metric conforming to the "jvm.system.cpu.load_1m" - // semantic conventions. It represents the average CPU load of the whole system - // for the last minute as reported by the JVM. - // Instrument: gauge - // Unit: {run_queue_item} - // Stability: Experimental - JvmSystemCPULoad1mName = "jvm.system.cpu.load_1m" - JvmSystemCPULoad1mUnit = "{run_queue_item}" - JvmSystemCPULoad1mDescription = "Average CPU load of the whole system for the last minute as reported by the JVM." - - // JvmBufferMemoryUsage is the metric conforming to the - // "jvm.buffer.memory.usage" semantic conventions. It represents the measure of - // memory used by buffers. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - JvmBufferMemoryUsageName = "jvm.buffer.memory.usage" - JvmBufferMemoryUsageUnit = "By" - JvmBufferMemoryUsageDescription = "Measure of memory used by buffers." - - // JvmBufferMemoryLimit is the metric conforming to the - // "jvm.buffer.memory.limit" semantic conventions. It represents the measure of - // total memory capacity of buffers. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - JvmBufferMemoryLimitName = "jvm.buffer.memory.limit" - JvmBufferMemoryLimitUnit = "By" - JvmBufferMemoryLimitDescription = "Measure of total memory capacity of buffers." - - // JvmBufferCount is the metric conforming to the "jvm.buffer.count" semantic - // conventions. It represents the number of buffers in the pool. - // Instrument: updowncounter - // Unit: {buffer} - // Stability: Experimental - JvmBufferCountName = "jvm.buffer.count" - JvmBufferCountUnit = "{buffer}" - JvmBufferCountDescription = "Number of buffers in the pool." - - // JvmMemoryUsed is the metric conforming to the "jvm.memory.used" semantic - // conventions. It represents the measure of memory used. - // Instrument: updowncounter - // Unit: By - // Stability: Stable - JvmMemoryUsedName = "jvm.memory.used" - JvmMemoryUsedUnit = "By" - JvmMemoryUsedDescription = "Measure of memory used." - - // JvmMemoryCommitted is the metric conforming to the "jvm.memory.committed" - // semantic conventions. It represents the measure of memory committed. - // Instrument: updowncounter - // Unit: By - // Stability: Stable - JvmMemoryCommittedName = "jvm.memory.committed" - JvmMemoryCommittedUnit = "By" - JvmMemoryCommittedDescription = "Measure of memory committed." - - // JvmMemoryLimit is the metric conforming to the "jvm.memory.limit" semantic - // conventions. It represents the measure of max obtainable memory. - // Instrument: updowncounter - // Unit: By - // Stability: Stable - JvmMemoryLimitName = "jvm.memory.limit" - JvmMemoryLimitUnit = "By" - JvmMemoryLimitDescription = "Measure of max obtainable memory." - - // JvmMemoryUsedAfterLastGc is the metric conforming to the - // "jvm.memory.used_after_last_gc" semantic conventions. It represents the - // measure of memory used, as measured after the most recent garbage collection - // event on this pool. - // Instrument: updowncounter - // Unit: By - // Stability: Stable - JvmMemoryUsedAfterLastGcName = "jvm.memory.used_after_last_gc" - JvmMemoryUsedAfterLastGcUnit = "By" - JvmMemoryUsedAfterLastGcDescription = "Measure of memory used, as measured after the most recent garbage collection event on this pool." - - // JvmGcDuration is the metric conforming to the "jvm.gc.duration" semantic - // conventions. It represents the duration of JVM garbage collection actions. - // Instrument: histogram - // Unit: s - // Stability: Stable - JvmGcDurationName = "jvm.gc.duration" - JvmGcDurationUnit = "s" - JvmGcDurationDescription = "Duration of JVM garbage collection actions." - - // JvmThreadCount is the metric conforming to the "jvm.thread.count" semantic - // conventions. It represents the number of executing platform threads. - // Instrument: updowncounter - // Unit: {thread} - // Stability: Stable - JvmThreadCountName = "jvm.thread.count" - JvmThreadCountUnit = "{thread}" - JvmThreadCountDescription = "Number of executing platform threads." - - // JvmClassLoaded is the metric conforming to the "jvm.class.loaded" semantic - // conventions. It represents the number of classes loaded since JVM start. - // Instrument: counter - // Unit: {class} - // Stability: Stable - JvmClassLoadedName = "jvm.class.loaded" - JvmClassLoadedUnit = "{class}" - JvmClassLoadedDescription = "Number of classes loaded since JVM start." - - // JvmClassUnloaded is the metric conforming to the "jvm.class.unloaded" - // semantic conventions. It represents the number of classes unloaded since JVM - // start. - // Instrument: counter - // Unit: {class} - // Stability: Stable - JvmClassUnloadedName = "jvm.class.unloaded" - JvmClassUnloadedUnit = "{class}" - JvmClassUnloadedDescription = "Number of classes unloaded since JVM start." - - // JvmClassCount is the metric conforming to the "jvm.class.count" semantic - // conventions. It represents the number of classes currently loaded. - // Instrument: updowncounter - // Unit: {class} - // Stability: Stable - JvmClassCountName = "jvm.class.count" - JvmClassCountUnit = "{class}" - JvmClassCountDescription = "Number of classes currently loaded." - - // JvmCPUCount is the metric conforming to the "jvm.cpu.count" semantic - // conventions. It represents the number of processors available to the Java - // virtual machine. - // Instrument: updowncounter - // Unit: {cpu} - // Stability: Stable - JvmCPUCountName = "jvm.cpu.count" - JvmCPUCountUnit = "{cpu}" - JvmCPUCountDescription = "Number of processors available to the Java virtual machine." - - // JvmCPUTime is the metric conforming to the "jvm.cpu.time" semantic - // conventions. It represents the cPU time used by the process as reported by - // the JVM. - // Instrument: counter - // Unit: s - // Stability: Stable - JvmCPUTimeName = "jvm.cpu.time" - JvmCPUTimeUnit = "s" - JvmCPUTimeDescription = "CPU time used by the process as reported by the JVM." - - // JvmCPURecentUtilization is the metric conforming to the - // "jvm.cpu.recent_utilization" semantic conventions. It represents the recent - // CPU utilization for the process as reported by the JVM. - // Instrument: gauge - // Unit: 1 - // Stability: Stable - JvmCPURecentUtilizationName = "jvm.cpu.recent_utilization" - JvmCPURecentUtilizationUnit = "1" - JvmCPURecentUtilizationDescription = "Recent CPU utilization for the process as reported by the JVM." - - // MessagingPublishDuration is the metric conforming to the - // "messaging.publish.duration" semantic conventions. It represents the - // measures the duration of publish operation. - // Instrument: histogram - // Unit: s - // Stability: Experimental - MessagingPublishDurationName = "messaging.publish.duration" - MessagingPublishDurationUnit = "s" - MessagingPublishDurationDescription = "Measures the duration of publish operation." - - // MessagingReceiveDuration is the metric conforming to the - // "messaging.receive.duration" semantic conventions. It represents the - // measures the duration of receive operation. - // Instrument: histogram - // Unit: s - // Stability: Experimental - MessagingReceiveDurationName = "messaging.receive.duration" - MessagingReceiveDurationUnit = "s" - MessagingReceiveDurationDescription = "Measures the duration of receive operation." - - // MessagingProcessDuration is the metric conforming to the - // "messaging.process.duration" semantic conventions. It represents the - // measures the duration of process operation. - // Instrument: histogram - // Unit: s - // Stability: Experimental - MessagingProcessDurationName = "messaging.process.duration" - MessagingProcessDurationUnit = "s" - MessagingProcessDurationDescription = "Measures the duration of process operation." - - // MessagingPublishMessages is the metric conforming to the - // "messaging.publish.messages" semantic conventions. It represents the - // measures the number of published messages. - // Instrument: counter - // Unit: {message} - // Stability: Experimental - MessagingPublishMessagesName = "messaging.publish.messages" - MessagingPublishMessagesUnit = "{message}" - MessagingPublishMessagesDescription = "Measures the number of published messages." - - // MessagingReceiveMessages is the metric conforming to the - // "messaging.receive.messages" semantic conventions. It represents the - // measures the number of received messages. - // Instrument: counter - // Unit: {message} - // Stability: Experimental - MessagingReceiveMessagesName = "messaging.receive.messages" - MessagingReceiveMessagesUnit = "{message}" - MessagingReceiveMessagesDescription = "Measures the number of received messages." - - // MessagingProcessMessages is the metric conforming to the - // "messaging.process.messages" semantic conventions. It represents the - // measures the number of processed messages. - // Instrument: counter - // Unit: {message} - // Stability: Experimental - MessagingProcessMessagesName = "messaging.process.messages" - MessagingProcessMessagesUnit = "{message}" - MessagingProcessMessagesDescription = "Measures the number of processed messages." - - // ProcessCPUTime is the metric conforming to the "process.cpu.time" semantic - // conventions. It represents the total CPU seconds broken down by different - // states. - // Instrument: counter - // Unit: s - // Stability: Experimental - ProcessCPUTimeName = "process.cpu.time" - ProcessCPUTimeUnit = "s" - ProcessCPUTimeDescription = "Total CPU seconds broken down by different states." - - // ProcessCPUUtilization is the metric conforming to the - // "process.cpu.utilization" semantic conventions. It represents the difference - // in process.cpu.time since the last measurement, divided by the elapsed time - // and number of CPUs available to the process. - // Instrument: gauge - // Unit: 1 - // Stability: Experimental - ProcessCPUUtilizationName = "process.cpu.utilization" - ProcessCPUUtilizationUnit = "1" - ProcessCPUUtilizationDescription = "Difference in process.cpu.time since the last measurement, divided by the elapsed time and number of CPUs available to the process." - - // ProcessMemoryUsage is the metric conforming to the "process.memory.usage" - // semantic conventions. It represents the amount of physical memory in use. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - ProcessMemoryUsageName = "process.memory.usage" - ProcessMemoryUsageUnit = "By" - ProcessMemoryUsageDescription = "The amount of physical memory in use." - - // ProcessMemoryVirtual is the metric conforming to the - // "process.memory.virtual" semantic conventions. It represents the amount of - // committed virtual memory. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - ProcessMemoryVirtualName = "process.memory.virtual" - ProcessMemoryVirtualUnit = "By" - ProcessMemoryVirtualDescription = "The amount of committed virtual memory." - - // ProcessDiskIo is the metric conforming to the "process.disk.io" semantic - // conventions. It represents the disk bytes transferred. - // Instrument: counter - // Unit: By - // Stability: Experimental - ProcessDiskIoName = "process.disk.io" - ProcessDiskIoUnit = "By" - ProcessDiskIoDescription = "Disk bytes transferred." - - // ProcessNetworkIo is the metric conforming to the "process.network.io" - // semantic conventions. It represents the network bytes transferred. - // Instrument: counter - // Unit: By - // Stability: Experimental - ProcessNetworkIoName = "process.network.io" - ProcessNetworkIoUnit = "By" - ProcessNetworkIoDescription = "Network bytes transferred." - - // ProcessThreadCount is the metric conforming to the "process.thread.count" - // semantic conventions. It represents the process threads count. - // Instrument: updowncounter - // Unit: {thread} - // Stability: Experimental - ProcessThreadCountName = "process.thread.count" - ProcessThreadCountUnit = "{thread}" - ProcessThreadCountDescription = "Process threads count." - - // ProcessOpenFileDescriptorCount is the metric conforming to the - // "process.open_file_descriptor.count" semantic conventions. It represents the - // number of file descriptors in use by the process. - // Instrument: updowncounter - // Unit: {count} - // Stability: Experimental - ProcessOpenFileDescriptorCountName = "process.open_file_descriptor.count" - ProcessOpenFileDescriptorCountUnit = "{count}" - ProcessOpenFileDescriptorCountDescription = "Number of file descriptors in use by the process." - - // ProcessContextSwitches is the metric conforming to the - // "process.context_switches" semantic conventions. It represents the number of - // times the process has been context switched. - // Instrument: counter - // Unit: {count} - // Stability: Experimental - ProcessContextSwitchesName = "process.context_switches" - ProcessContextSwitchesUnit = "{count}" - ProcessContextSwitchesDescription = "Number of times the process has been context switched." - - // ProcessPagingFaults is the metric conforming to the "process.paging.faults" - // semantic conventions. It represents the number of page faults the process - // has made. - // Instrument: counter - // Unit: {fault} - // Stability: Experimental - ProcessPagingFaultsName = "process.paging.faults" - ProcessPagingFaultsUnit = "{fault}" - ProcessPagingFaultsDescription = "Number of page faults the process has made." - - // RPCServerDuration is the metric conforming to the "rpc.server.duration" - // semantic conventions. It represents the measures the duration of inbound - // RPC. - // Instrument: histogram - // Unit: ms - // Stability: Experimental - RPCServerDurationName = "rpc.server.duration" - RPCServerDurationUnit = "ms" - RPCServerDurationDescription = "Measures the duration of inbound RPC." - - // RPCServerRequestSize is the metric conforming to the - // "rpc.server.request.size" semantic conventions. It represents the measures - // the size of RPC request messages (uncompressed). - // Instrument: histogram - // Unit: By - // Stability: Experimental - RPCServerRequestSizeName = "rpc.server.request.size" - RPCServerRequestSizeUnit = "By" - RPCServerRequestSizeDescription = "Measures the size of RPC request messages (uncompressed)." - - // RPCServerResponseSize is the metric conforming to the - // "rpc.server.response.size" semantic conventions. It represents the measures - // the size of RPC response messages (uncompressed). - // Instrument: histogram - // Unit: By - // Stability: Experimental - RPCServerResponseSizeName = "rpc.server.response.size" - RPCServerResponseSizeUnit = "By" - RPCServerResponseSizeDescription = "Measures the size of RPC response messages (uncompressed)." - - // RPCServerRequestsPerRPC is the metric conforming to the - // "rpc.server.requests_per_rpc" semantic conventions. It represents the - // measures the number of messages received per RPC. - // Instrument: histogram - // Unit: {count} - // Stability: Experimental - RPCServerRequestsPerRPCName = "rpc.server.requests_per_rpc" - RPCServerRequestsPerRPCUnit = "{count}" - RPCServerRequestsPerRPCDescription = "Measures the number of messages received per RPC." - - // RPCServerResponsesPerRPC is the metric conforming to the - // "rpc.server.responses_per_rpc" semantic conventions. It represents the - // measures the number of messages sent per RPC. - // Instrument: histogram - // Unit: {count} - // Stability: Experimental - RPCServerResponsesPerRPCName = "rpc.server.responses_per_rpc" - RPCServerResponsesPerRPCUnit = "{count}" - RPCServerResponsesPerRPCDescription = "Measures the number of messages sent per RPC." - - // RPCClientDuration is the metric conforming to the "rpc.client.duration" - // semantic conventions. It represents the measures the duration of outbound - // RPC. - // Instrument: histogram - // Unit: ms - // Stability: Experimental - RPCClientDurationName = "rpc.client.duration" - RPCClientDurationUnit = "ms" - RPCClientDurationDescription = "Measures the duration of outbound RPC." - - // RPCClientRequestSize is the metric conforming to the - // "rpc.client.request.size" semantic conventions. It represents the measures - // the size of RPC request messages (uncompressed). - // Instrument: histogram - // Unit: By - // Stability: Experimental - RPCClientRequestSizeName = "rpc.client.request.size" - RPCClientRequestSizeUnit = "By" - RPCClientRequestSizeDescription = "Measures the size of RPC request messages (uncompressed)." - - // RPCClientResponseSize is the metric conforming to the - // "rpc.client.response.size" semantic conventions. It represents the measures - // the size of RPC response messages (uncompressed). - // Instrument: histogram - // Unit: By - // Stability: Experimental - RPCClientResponseSizeName = "rpc.client.response.size" - RPCClientResponseSizeUnit = "By" - RPCClientResponseSizeDescription = "Measures the size of RPC response messages (uncompressed)." - - // RPCClientRequestsPerRPC is the metric conforming to the - // "rpc.client.requests_per_rpc" semantic conventions. It represents the - // measures the number of messages received per RPC. - // Instrument: histogram - // Unit: {count} - // Stability: Experimental - RPCClientRequestsPerRPCName = "rpc.client.requests_per_rpc" - RPCClientRequestsPerRPCUnit = "{count}" - RPCClientRequestsPerRPCDescription = "Measures the number of messages received per RPC." - - // RPCClientResponsesPerRPC is the metric conforming to the - // "rpc.client.responses_per_rpc" semantic conventions. It represents the - // measures the number of messages sent per RPC. - // Instrument: histogram - // Unit: {count} - // Stability: Experimental - RPCClientResponsesPerRPCName = "rpc.client.responses_per_rpc" - RPCClientResponsesPerRPCUnit = "{count}" - RPCClientResponsesPerRPCDescription = "Measures the number of messages sent per RPC." - - // SystemCPUTime is the metric conforming to the "system.cpu.time" semantic - // conventions. It represents the seconds each logical CPU spent on each mode. - // Instrument: counter - // Unit: s - // Stability: Experimental - SystemCPUTimeName = "system.cpu.time" - SystemCPUTimeUnit = "s" - SystemCPUTimeDescription = "Seconds each logical CPU spent on each mode" - - // SystemCPUUtilization is the metric conforming to the - // "system.cpu.utilization" semantic conventions. It represents the difference - // in system.cpu.time since the last measurement, divided by the elapsed time - // and number of logical CPUs. - // Instrument: gauge - // Unit: 1 - // Stability: Experimental - SystemCPUUtilizationName = "system.cpu.utilization" - SystemCPUUtilizationUnit = "1" - SystemCPUUtilizationDescription = "Difference in system.cpu.time since the last measurement, divided by the elapsed time and number of logical CPUs" - - // SystemCPUFrequency is the metric conforming to the "system.cpu.frequency" - // semantic conventions. It represents the reports the current frequency of the - // CPU in Hz. - // Instrument: gauge - // Unit: {Hz} - // Stability: Experimental - SystemCPUFrequencyName = "system.cpu.frequency" - SystemCPUFrequencyUnit = "{Hz}" - SystemCPUFrequencyDescription = "Reports the current frequency of the CPU in Hz" - - // SystemCPUPhysicalCount is the metric conforming to the - // "system.cpu.physical.count" semantic conventions. It represents the reports - // the number of actual physical processor cores on the hardware. - // Instrument: updowncounter - // Unit: {cpu} - // Stability: Experimental - SystemCPUPhysicalCountName = "system.cpu.physical.count" - SystemCPUPhysicalCountUnit = "{cpu}" - SystemCPUPhysicalCountDescription = "Reports the number of actual physical processor cores on the hardware" - - // SystemCPULogicalCount is the metric conforming to the - // "system.cpu.logical.count" semantic conventions. It represents the reports - // the number of logical (virtual) processor cores created by the operating - // system to manage multitasking. - // Instrument: updowncounter - // Unit: {cpu} - // Stability: Experimental - SystemCPULogicalCountName = "system.cpu.logical.count" - SystemCPULogicalCountUnit = "{cpu}" - SystemCPULogicalCountDescription = "Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking" - - // SystemMemoryUsage is the metric conforming to the "system.memory.usage" - // semantic conventions. It represents the reports memory in use by state. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - SystemMemoryUsageName = "system.memory.usage" - SystemMemoryUsageUnit = "By" - SystemMemoryUsageDescription = "Reports memory in use by state." - - // SystemMemoryLimit is the metric conforming to the "system.memory.limit" - // semantic conventions. It represents the total memory available in the - // system. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - SystemMemoryLimitName = "system.memory.limit" - SystemMemoryLimitUnit = "By" - SystemMemoryLimitDescription = "Total memory available in the system." - - // SystemMemoryShared is the metric conforming to the "system.memory.shared" - // semantic conventions. It represents the shared memory used (mostly by - // tmpfs). - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - SystemMemorySharedName = "system.memory.shared" - SystemMemorySharedUnit = "By" - SystemMemorySharedDescription = "Shared memory used (mostly by tmpfs)." - - // SystemMemoryUtilization is the metric conforming to the - // "system.memory.utilization" semantic conventions. - // Instrument: gauge - // Unit: 1 - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemMemoryUtilizationName = "system.memory.utilization" - SystemMemoryUtilizationUnit = "1" - - // SystemPagingUsage is the metric conforming to the "system.paging.usage" - // semantic conventions. It represents the unix swap or windows pagefile usage. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - SystemPagingUsageName = "system.paging.usage" - SystemPagingUsageUnit = "By" - SystemPagingUsageDescription = "Unix swap or windows pagefile usage" - - // SystemPagingUtilization is the metric conforming to the - // "system.paging.utilization" semantic conventions. - // Instrument: gauge - // Unit: 1 - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemPagingUtilizationName = "system.paging.utilization" - SystemPagingUtilizationUnit = "1" - - // SystemPagingFaults is the metric conforming to the "system.paging.faults" - // semantic conventions. - // Instrument: counter - // Unit: {fault} - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemPagingFaultsName = "system.paging.faults" - SystemPagingFaultsUnit = "{fault}" - - // SystemPagingOperations is the metric conforming to the - // "system.paging.operations" semantic conventions. - // Instrument: counter - // Unit: {operation} - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemPagingOperationsName = "system.paging.operations" - SystemPagingOperationsUnit = "{operation}" - - // SystemDiskIo is the metric conforming to the "system.disk.io" semantic - // conventions. - // Instrument: counter - // Unit: By - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemDiskIoName = "system.disk.io" - SystemDiskIoUnit = "By" - - // SystemDiskOperations is the metric conforming to the - // "system.disk.operations" semantic conventions. - // Instrument: counter - // Unit: {operation} - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemDiskOperationsName = "system.disk.operations" - SystemDiskOperationsUnit = "{operation}" - - // SystemDiskIoTime is the metric conforming to the "system.disk.io_time" - // semantic conventions. It represents the time disk spent activated. - // Instrument: counter - // Unit: s - // Stability: Experimental - SystemDiskIoTimeName = "system.disk.io_time" - SystemDiskIoTimeUnit = "s" - SystemDiskIoTimeDescription = "Time disk spent activated" - - // SystemDiskOperationTime is the metric conforming to the - // "system.disk.operation_time" semantic conventions. It represents the sum of - // the time each operation took to complete. - // Instrument: counter - // Unit: s - // Stability: Experimental - SystemDiskOperationTimeName = "system.disk.operation_time" - SystemDiskOperationTimeUnit = "s" - SystemDiskOperationTimeDescription = "Sum of the time each operation took to complete" - - // SystemDiskMerged is the metric conforming to the "system.disk.merged" - // semantic conventions. - // Instrument: counter - // Unit: {operation} - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemDiskMergedName = "system.disk.merged" - SystemDiskMergedUnit = "{operation}" - - // SystemFilesystemUsage is the metric conforming to the - // "system.filesystem.usage" semantic conventions. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemFilesystemUsageName = "system.filesystem.usage" - SystemFilesystemUsageUnit = "By" - - // SystemFilesystemUtilization is the metric conforming to the - // "system.filesystem.utilization" semantic conventions. - // Instrument: gauge - // Unit: 1 - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemFilesystemUtilizationName = "system.filesystem.utilization" - SystemFilesystemUtilizationUnit = "1" - - // SystemNetworkDropped is the metric conforming to the - // "system.network.dropped" semantic conventions. It represents the count of - // packets that are dropped or discarded even though there was no error. - // Instrument: counter - // Unit: {packet} - // Stability: Experimental - SystemNetworkDroppedName = "system.network.dropped" - SystemNetworkDroppedUnit = "{packet}" - SystemNetworkDroppedDescription = "Count of packets that are dropped or discarded even though there was no error" - - // SystemNetworkPackets is the metric conforming to the - // "system.network.packets" semantic conventions. - // Instrument: counter - // Unit: {packet} - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemNetworkPacketsName = "system.network.packets" - SystemNetworkPacketsUnit = "{packet}" - - // SystemNetworkErrors is the metric conforming to the "system.network.errors" - // semantic conventions. It represents the count of network errors detected. - // Instrument: counter - // Unit: {error} - // Stability: Experimental - SystemNetworkErrorsName = "system.network.errors" - SystemNetworkErrorsUnit = "{error}" - SystemNetworkErrorsDescription = "Count of network errors detected" - - // SystemNetworkIo is the metric conforming to the "system.network.io" semantic - // conventions. - // Instrument: counter - // Unit: By - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemNetworkIoName = "system.network.io" - SystemNetworkIoUnit = "By" - - // SystemNetworkConnections is the metric conforming to the - // "system.network.connections" semantic conventions. - // Instrument: updowncounter - // Unit: {connection} - // Stability: Experimental - // NOTE: The description (brief) for this metric is not defined in the semantic-conventions repository. - SystemNetworkConnectionsName = "system.network.connections" - SystemNetworkConnectionsUnit = "{connection}" - - // SystemProcessCount is the metric conforming to the "system.process.count" - // semantic conventions. It represents the total number of processes in each - // state. - // Instrument: updowncounter - // Unit: {process} - // Stability: Experimental - SystemProcessCountName = "system.process.count" - SystemProcessCountUnit = "{process}" - SystemProcessCountDescription = "Total number of processes in each state" - - // SystemProcessCreated is the metric conforming to the - // "system.process.created" semantic conventions. It represents the total - // number of processes created over uptime of the host. - // Instrument: counter - // Unit: {process} - // Stability: Experimental - SystemProcessCreatedName = "system.process.created" - SystemProcessCreatedUnit = "{process}" - SystemProcessCreatedDescription = "Total number of processes created over uptime of the host" - - // SystemLinuxMemoryAvailable is the metric conforming to the - // "system.linux.memory.available" semantic conventions. It represents an - // estimate of how much memory is available for starting new applications, - // without causing swapping. - // Instrument: updowncounter - // Unit: By - // Stability: Experimental - SystemLinuxMemoryAvailableName = "system.linux.memory.available" - SystemLinuxMemoryAvailableUnit = "By" - SystemLinuxMemoryAvailableDescription = "An estimate of how much memory is available for starting new applications, without causing swapping" -) diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go b/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go deleted file mode 100644 index 4c87c7adcc..0000000000 --- a/vendor/go.opentelemetry.io/otel/semconv/v1.26.0/schema.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package semconv // import "go.opentelemetry.io/otel/semconv/v1.26.0" - -// SchemaURL is the schema URL that matches the version of the semantic conventions -// that this package defines. Semconv packages starting from v1.4.0 must declare -// non-empty schema URL in the form https://opentelemetry.io/schemas/ -const SchemaURL = "https://opentelemetry.io/schemas/1.26.0" diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go new file mode 100644 index 0000000000..cb993812a8 --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/httpconv/metric.go @@ -0,0 +1,1733 @@ +// Code generated from semantic convention specification. DO NOT EDIT. + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package httpconv provides types and functionality for OpenTelemetry semantic +// conventions in the "http" namespace. +package httpconv + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" +) + +var ( + addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} + recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} +) + +// ErrorTypeAttr is an attribute conforming to the error.type semantic +// conventions. It represents the describes a class of error the operation ended +// with. +type ErrorTypeAttr string + +var ( + // ErrorTypeOther is a fallback error value to be used when the instrumentation + // doesn't define a custom value. + ErrorTypeOther ErrorTypeAttr = "_OTHER" +) + +// ConnectionStateAttr is an attribute conforming to the http.connection.state +// semantic conventions. It represents the state of the HTTP connection in the +// HTTP connection pool. +type ConnectionStateAttr string + +var ( + // ConnectionStateActive is the active state. + ConnectionStateActive ConnectionStateAttr = "active" + // ConnectionStateIdle is the idle state. + ConnectionStateIdle ConnectionStateAttr = "idle" +) + +// RequestMethodAttr is an attribute conforming to the http.request.method +// semantic conventions. It represents the HTTP request method. +type RequestMethodAttr string + +var ( + // RequestMethodConnect is the CONNECT method. + RequestMethodConnect RequestMethodAttr = "CONNECT" + // RequestMethodDelete is the DELETE method. + RequestMethodDelete RequestMethodAttr = "DELETE" + // RequestMethodGet is the GET method. + RequestMethodGet RequestMethodAttr = "GET" + // RequestMethodHead is the HEAD method. + RequestMethodHead RequestMethodAttr = "HEAD" + // RequestMethodOptions is the OPTIONS method. + RequestMethodOptions RequestMethodAttr = "OPTIONS" + // RequestMethodPatch is the PATCH method. + RequestMethodPatch RequestMethodAttr = "PATCH" + // RequestMethodPost is the POST method. + RequestMethodPost RequestMethodAttr = "POST" + // RequestMethodPut is the PUT method. + RequestMethodPut RequestMethodAttr = "PUT" + // RequestMethodTrace is the TRACE method. + RequestMethodTrace RequestMethodAttr = "TRACE" + // RequestMethodQuery is the QUERY method. + RequestMethodQuery RequestMethodAttr = "QUERY" + // RequestMethodOther is the any HTTP method that the instrumentation has no + // prior knowledge of. + RequestMethodOther RequestMethodAttr = "_OTHER" +) + +// UserAgentSyntheticTypeAttr is an attribute conforming to the +// user_agent.synthetic.type semantic conventions. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +type UserAgentSyntheticTypeAttr string + +var ( + // UserAgentSyntheticTypeBot is the bot source. + UserAgentSyntheticTypeBot UserAgentSyntheticTypeAttr = "bot" + // UserAgentSyntheticTypeTest is the synthetic test source. + UserAgentSyntheticTypeTest UserAgentSyntheticTypeAttr = "test" +) + +// ClientActiveRequests is an instrument used to record metric values conforming +// to the "http.client.active_requests" semantic conventions. It represents the +// number of active HTTP requests. +type ClientActiveRequests struct { + metric.Int64UpDownCounter +} + +var newClientActiveRequestsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of active HTTP requests."), + metric.WithUnit("{request}"), +} + +// NewClientActiveRequests returns a new ClientActiveRequests instrument. +func NewClientActiveRequests( + m metric.Meter, + opt ...metric.Int64UpDownCounterOption, +) (ClientActiveRequests, error) { + // Check if the meter is nil. + if m == nil { + return ClientActiveRequests{noop.Int64UpDownCounter{}}, nil + } + + if len(opt) == 0 { + opt = newClientActiveRequestsOpts + } else { + opt = append(opt, newClientActiveRequestsOpts...) + } + + i, err := m.Int64UpDownCounter( + "http.client.active_requests", + opt..., + ) + if err != nil { + return ClientActiveRequests{noop.Int64UpDownCounter{}}, err + } + return ClientActiveRequests{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientActiveRequests) Inst() metric.Int64UpDownCounter { + return m.Int64UpDownCounter +} + +// Name returns the semantic convention name of the instrument. +func (ClientActiveRequests) Name() string { + return "http.client.active_requests" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientActiveRequests) Unit() string { + return "{request}" +} + +// Description returns the semantic convention description of the instrument +func (ClientActiveRequests) Description() string { + return "Number of active HTTP requests." +} + +// Add adds incr to the existing count for attrs. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientActiveRequests) Add( + ctx context.Context, + incr int64, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AddSet adds incr to the existing count for set. +func (m ClientActiveRequests) AddSet(ctx context.Context, incr int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientActiveRequests) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// AttrRequestMethod returns an optional attribute for the "http.request.method" +// semantic convention. It represents the HTTP request method. +func (ClientActiveRequests) AttrRequestMethod(val RequestMethodAttr) attribute.KeyValue { + return attribute.String("http.request.method", string(val)) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientActiveRequests) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientConnectionDuration is an instrument used to record metric values +// conforming to the "http.client.connection.duration" semantic conventions. It +// represents the duration of the successfully established outbound HTTP +// connections. +type ClientConnectionDuration struct { + metric.Float64Histogram +} + +var newClientConnectionDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("The duration of the successfully established outbound HTTP connections."), + metric.WithUnit("s"), +} + +// NewClientConnectionDuration returns a new ClientConnectionDuration instrument. +func NewClientConnectionDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientConnectionDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientConnectionDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientConnectionDurationOpts + } else { + opt = append(opt, newClientConnectionDurationOpts...) + } + + i, err := m.Float64Histogram( + "http.client.connection.duration", + opt..., + ) + if err != nil { + return ClientConnectionDuration{noop.Float64Histogram{}}, err + } + return ClientConnectionDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientConnectionDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientConnectionDuration) Name() string { + return "http.client.connection.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientConnectionDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ClientConnectionDuration) Description() string { + return "The duration of the successfully established outbound HTTP connections." +} + +// Record records val to the current distribution for attrs. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientConnectionDuration) Record( + ctx context.Context, + val float64, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +func (m ClientConnectionDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrNetworkPeerAddress returns an optional attribute for the +// "network.peer.address" semantic convention. It represents the peer address of +// the network connection - IP address or Unix domain socket name. +func (ClientConnectionDuration) AttrNetworkPeerAddress(val string) attribute.KeyValue { + return attribute.String("network.peer.address", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientConnectionDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientConnectionDuration) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientOpenConnections is an instrument used to record metric values conforming +// to the "http.client.open_connections" semantic conventions. It represents the +// number of outbound HTTP connections that are currently active or idle on the +// client. +type ClientOpenConnections struct { + metric.Int64UpDownCounter +} + +var newClientOpenConnectionsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of outbound HTTP connections that are currently active or idle on the client."), + metric.WithUnit("{connection}"), +} + +// NewClientOpenConnections returns a new ClientOpenConnections instrument. +func NewClientOpenConnections( + m metric.Meter, + opt ...metric.Int64UpDownCounterOption, +) (ClientOpenConnections, error) { + // Check if the meter is nil. + if m == nil { + return ClientOpenConnections{noop.Int64UpDownCounter{}}, nil + } + + if len(opt) == 0 { + opt = newClientOpenConnectionsOpts + } else { + opt = append(opt, newClientOpenConnectionsOpts...) + } + + i, err := m.Int64UpDownCounter( + "http.client.open_connections", + opt..., + ) + if err != nil { + return ClientOpenConnections{noop.Int64UpDownCounter{}}, err + } + return ClientOpenConnections{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientOpenConnections) Inst() metric.Int64UpDownCounter { + return m.Int64UpDownCounter +} + +// Name returns the semantic convention name of the instrument. +func (ClientOpenConnections) Name() string { + return "http.client.open_connections" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientOpenConnections) Unit() string { + return "{connection}" +} + +// Description returns the semantic convention description of the instrument +func (ClientOpenConnections) Description() string { + return "Number of outbound HTTP connections that are currently active or idle on the client." +} + +// Add adds incr to the existing count for attrs. +// +// The connectionState is the state of the HTTP connection in the HTTP connection +// pool. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientOpenConnections) Add( + ctx context.Context, + incr int64, + connectionState ConnectionStateAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.connection.state", string(connectionState)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AddSet adds incr to the existing count for set. +func (m ClientOpenConnections) AddSet(ctx context.Context, incr int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AttrNetworkPeerAddress returns an optional attribute for the +// "network.peer.address" semantic convention. It represents the peer address of +// the network connection - IP address or Unix domain socket name. +func (ClientOpenConnections) AttrNetworkPeerAddress(val string) attribute.KeyValue { + return attribute.String("network.peer.address", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientOpenConnections) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientOpenConnections) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientRequestBodySize is an instrument used to record metric values conforming +// to the "http.client.request.body.size" semantic conventions. It represents the +// size of HTTP client request bodies. +type ClientRequestBodySize struct { + metric.Int64Histogram +} + +var newClientRequestBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP client request bodies."), + metric.WithUnit("By"), +} + +// NewClientRequestBodySize returns a new ClientRequestBodySize instrument. +func NewClientRequestBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientRequestBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestBodySizeOpts + } else { + opt = append(opt, newClientRequestBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.client.request.body.size", + opt..., + ) + if err != nil { + return ClientRequestBodySize{noop.Int64Histogram{}}, err + } + return ClientRequestBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestBodySize) Name() string { + return "http.client.request.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestBodySize) Description() string { + return "Size of HTTP client request bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientRequestBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientRequestBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientRequestBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ClientRequestBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientRequestBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientRequestBodySize) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientRequestBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientRequestBodySize) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ClientRequestDuration is an instrument used to record metric values conforming +// to the "http.client.request.duration" semantic conventions. It represents the +// duration of HTTP client requests. +type ClientRequestDuration struct { + metric.Float64Histogram +} + +var newClientRequestDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of HTTP client requests."), + metric.WithUnit("s"), +} + +// NewClientRequestDuration returns a new ClientRequestDuration instrument. +func NewClientRequestDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientRequestDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestDurationOpts + } else { + opt = append(opt, newClientRequestDurationOpts...) + } + + i, err := m.Float64Histogram( + "http.client.request.duration", + opt..., + ) + if err != nil { + return ClientRequestDuration{noop.Float64Histogram{}}, err + } + return ClientRequestDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestDuration) Name() string { + return "http.client.request.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestDuration) Description() string { + return "Duration of HTTP client requests." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +func (m ClientRequestDuration) Record( + ctx context.Context, + val float64, + requestMethod RequestMethodAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +func (m ClientRequestDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientRequestDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ClientRequestDuration) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientRequestDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientRequestDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientRequestDuration) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientRequestDuration) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// ClientResponseBodySize is an instrument used to record metric values +// conforming to the "http.client.response.body.size" semantic conventions. It +// represents the size of HTTP client response bodies. +type ClientResponseBodySize struct { + metric.Int64Histogram +} + +var newClientResponseBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP client response bodies."), + metric.WithUnit("By"), +} + +// NewClientResponseBodySize returns a new ClientResponseBodySize instrument. +func NewClientResponseBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientResponseBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ClientResponseBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientResponseBodySizeOpts + } else { + opt = append(opt, newClientResponseBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.client.response.body.size", + opt..., + ) + if err != nil { + return ClientResponseBodySize{noop.Int64Histogram{}}, err + } + return ClientResponseBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientResponseBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientResponseBodySize) Name() string { + return "http.client.response.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientResponseBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientResponseBodySize) Description() string { + return "Size of HTTP client response bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The serverAddress is the server domain name if available without reverse DNS +// lookup; otherwise, IP address or Unix domain socket name. +// +// The serverPort is the server port number. +// +// All additional attrs passed are included in the recorded value. +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientResponseBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + serverAddress string, + serverPort int, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.request.method", string(requestMethod)), + attribute.String("server.address", serverAddress), + attribute.Int("server.port", serverPort), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ClientResponseBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientResponseBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ClientResponseBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientResponseBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrURLTemplate returns an optional attribute for the "url.template" semantic +// convention. It represents the low-cardinality template of an +// [absolute path reference]. +// +// [absolute path reference]: https://www.rfc-editor.org/rfc/rfc3986#section-4.2 +func (ClientResponseBodySize) AttrURLTemplate(val string) attribute.KeyValue { + return attribute.String("url.template", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientResponseBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrURLScheme returns an optional attribute for the "url.scheme" semantic +// convention. It represents the [URI scheme] component identifying the used +// protocol. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (ClientResponseBodySize) AttrURLScheme(val string) attribute.KeyValue { + return attribute.String("url.scheme", val) +} + +// ServerActiveRequests is an instrument used to record metric values conforming +// to the "http.server.active_requests" semantic conventions. It represents the +// number of active HTTP server requests. +type ServerActiveRequests struct { + metric.Int64UpDownCounter +} + +var newServerActiveRequestsOpts = []metric.Int64UpDownCounterOption{ + metric.WithDescription("Number of active HTTP server requests."), + metric.WithUnit("{request}"), +} + +// NewServerActiveRequests returns a new ServerActiveRequests instrument. +func NewServerActiveRequests( + m metric.Meter, + opt ...metric.Int64UpDownCounterOption, +) (ServerActiveRequests, error) { + // Check if the meter is nil. + if m == nil { + return ServerActiveRequests{noop.Int64UpDownCounter{}}, nil + } + + if len(opt) == 0 { + opt = newServerActiveRequestsOpts + } else { + opt = append(opt, newServerActiveRequestsOpts...) + } + + i, err := m.Int64UpDownCounter( + "http.server.active_requests", + opt..., + ) + if err != nil { + return ServerActiveRequests{noop.Int64UpDownCounter{}}, err + } + return ServerActiveRequests{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerActiveRequests) Inst() metric.Int64UpDownCounter { + return m.Int64UpDownCounter +} + +// Name returns the semantic convention name of the instrument. +func (ServerActiveRequests) Name() string { + return "http.server.active_requests" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerActiveRequests) Unit() string { + return "{request}" +} + +// Description returns the semantic convention description of the instrument +func (ServerActiveRequests) Description() string { + return "Number of active HTTP server requests." +} + +// Add adds incr to the existing count for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (m ServerActiveRequests) Add( + ctx context.Context, + incr int64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AddSet adds incr to the existing count for set. +func (m ServerActiveRequests) AddSet(ctx context.Context, incr int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64UpDownCounter.Add(ctx, incr) + return + } + + o := addOptPool.Get().(*[]metric.AddOption) + defer func() { + *o = (*o)[:0] + addOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64UpDownCounter.Add(ctx, incr, *o...) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerActiveRequests) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerActiveRequests) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// ServerRequestBodySize is an instrument used to record metric values conforming +// to the "http.server.request.body.size" semantic conventions. It represents the +// size of HTTP server request bodies. +type ServerRequestBodySize struct { + metric.Int64Histogram +} + +var newServerRequestBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP server request bodies."), + metric.WithUnit("By"), +} + +// NewServerRequestBodySize returns a new ServerRequestBodySize instrument. +func NewServerRequestBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerRequestBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestBodySizeOpts + } else { + opt = append(opt, newServerRequestBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.server.request.body.size", + opt..., + ) + if err != nil { + return ServerRequestBodySize{noop.Int64Histogram{}}, err + } + return ServerRequestBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestBodySize) Name() string { + return "http.server.request.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestBodySize) Description() string { + return "Size of HTTP server request bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerRequestBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the request payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerRequestBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerRequestBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ServerRequestBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrRoute returns an optional attribute for the "http.route" semantic +// convention. It represents the matched route template for the request. This +// MUST be low-cardinality and include all static path segments, with dynamic +// path segments represented with placeholders. +func (ServerRequestBodySize) AttrRoute(val string) attribute.KeyValue { + return attribute.String("http.route", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerRequestBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerRequestBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerRequestBodySize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerRequestBodySize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrUserAgentSyntheticType returns an optional attribute for the +// "user_agent.synthetic.type" semantic convention. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +func (ServerRequestBodySize) AttrUserAgentSyntheticType(val UserAgentSyntheticTypeAttr) attribute.KeyValue { + return attribute.String("user_agent.synthetic.type", string(val)) +} + +// ServerRequestDuration is an instrument used to record metric values conforming +// to the "http.server.request.duration" semantic conventions. It represents the +// duration of HTTP server requests. +type ServerRequestDuration struct { + metric.Float64Histogram +} + +var newServerRequestDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Duration of HTTP server requests."), + metric.WithUnit("s"), +} + +// NewServerRequestDuration returns a new ServerRequestDuration instrument. +func NewServerRequestDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ServerRequestDuration, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestDurationOpts + } else { + opt = append(opt, newServerRequestDurationOpts...) + } + + i, err := m.Float64Histogram( + "http.server.request.duration", + opt..., + ) + if err != nil { + return ServerRequestDuration{noop.Float64Histogram{}}, err + } + return ServerRequestDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestDuration) Name() string { + return "http.server.request.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestDuration) Description() string { + return "Duration of HTTP server requests." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +func (m ServerRequestDuration) Record( + ctx context.Context, + val float64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +func (m ServerRequestDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerRequestDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ServerRequestDuration) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrRoute returns an optional attribute for the "http.route" semantic +// convention. It represents the matched route template for the request. This +// MUST be low-cardinality and include all static path segments, with dynamic +// path segments represented with placeholders. +func (ServerRequestDuration) AttrRoute(val string) attribute.KeyValue { + return attribute.String("http.route", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerRequestDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerRequestDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerRequestDuration) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerRequestDuration) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrUserAgentSyntheticType returns an optional attribute for the +// "user_agent.synthetic.type" semantic convention. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +func (ServerRequestDuration) AttrUserAgentSyntheticType(val UserAgentSyntheticTypeAttr) attribute.KeyValue { + return attribute.String("user_agent.synthetic.type", string(val)) +} + +// ServerResponseBodySize is an instrument used to record metric values +// conforming to the "http.server.response.body.size" semantic conventions. It +// represents the size of HTTP server response bodies. +type ServerResponseBodySize struct { + metric.Int64Histogram +} + +var newServerResponseBodySizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Size of HTTP server response bodies."), + metric.WithUnit("By"), +} + +// NewServerResponseBodySize returns a new ServerResponseBodySize instrument. +func NewServerResponseBodySize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerResponseBodySize, error) { + // Check if the meter is nil. + if m == nil { + return ServerResponseBodySize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerResponseBodySizeOpts + } else { + opt = append(opt, newServerResponseBodySizeOpts...) + } + + i, err := m.Int64Histogram( + "http.server.response.body.size", + opt..., + ) + if err != nil { + return ServerResponseBodySize{noop.Int64Histogram{}}, err + } + return ServerResponseBodySize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerResponseBodySize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerResponseBodySize) Name() string { + return "http.server.response.body.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerResponseBodySize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerResponseBodySize) Description() string { + return "Size of HTTP server response bodies." +} + +// Record records val to the current distribution for attrs. +// +// The requestMethod is the HTTP request method. +// +// The urlScheme is the the [URI scheme] component identifying the used protocol. +// +// All additional attrs passed are included in the recorded value. +// +// [URI scheme]: https://www.rfc-editor.org/rfc/rfc3986#section-3.1 +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerResponseBodySize) Record( + ctx context.Context, + val int64, + requestMethod RequestMethodAttr, + urlScheme string, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("http.request.method", string(requestMethod)), + attribute.String("url.scheme", urlScheme), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// The size of the response payload body in bytes. This is the number of bytes +// transferred excluding headers and is often, but not always, present as the +// [Content-Length] header. For requests using transport encoding, this should be +// the compressed size. +// +// [Content-Length]: https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length +func (m ServerResponseBodySize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerResponseBodySize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "http.response.status_code" semantic convention. It represents the +// [HTTP response status code]. +// +// [HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6 +func (ServerResponseBodySize) AttrResponseStatusCode(val int) attribute.KeyValue { + return attribute.Int("http.response.status_code", val) +} + +// AttrRoute returns an optional attribute for the "http.route" semantic +// convention. It represents the matched route template for the request. This +// MUST be low-cardinality and include all static path segments, with dynamic +// path segments represented with placeholders. +func (ServerResponseBodySize) AttrRoute(val string) attribute.KeyValue { + return attribute.String("http.route", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerResponseBodySize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerResponseBodySize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the name of the local HTTP server that +// received the request. +func (ServerResponseBodySize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the port of the local HTTP server that received the +// request. +func (ServerResponseBodySize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrUserAgentSyntheticType returns an optional attribute for the +// "user_agent.synthetic.type" semantic convention. It represents the specifies +// the category of synthetic traffic, such as tests or bots. +func (ServerResponseBodySize) AttrUserAgentSyntheticType(val UserAgentSyntheticTypeAttr) attribute.KeyValue { + return attribute.String("user_agent.synthetic.type", string(val)) +} diff --git a/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv/metric.go b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv/metric.go new file mode 100644 index 0000000000..813782a8de --- /dev/null +++ b/vendor/go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv/metric.go @@ -0,0 +1,1131 @@ +// Code generated from semantic convention specification. DO NOT EDIT. + +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +// Package rpcconv provides types and functionality for OpenTelemetry semantic +// conventions in the "rpc" namespace. +package rpcconv + +import ( + "context" + "sync" + + "go.opentelemetry.io/otel/attribute" + "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/noop" +) + +var ( + addOptPool = &sync.Pool{New: func() any { return &[]metric.AddOption{} }} + recOptPool = &sync.Pool{New: func() any { return &[]metric.RecordOption{} }} +) + +// ErrorTypeAttr is an attribute conforming to the error.type semantic +// conventions. It represents the describes a class of error the operation ended +// with. +type ErrorTypeAttr string + +var ( + // ErrorTypeOther is a fallback error value to be used when the instrumentation + // doesn't define a custom value. + ErrorTypeOther ErrorTypeAttr = "_OTHER" +) + +// NetworkTransportAttr is an attribute conforming to the network.transport +// semantic conventions. It represents the [OSI transport layer] or +// [inter-process communication method]. +// +// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer +// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication +type NetworkTransportAttr string + +var ( + // NetworkTransportTCP is the TCP. + NetworkTransportTCP NetworkTransportAttr = "tcp" + // NetworkTransportUDP is the UDP. + NetworkTransportUDP NetworkTransportAttr = "udp" + // NetworkTransportPipe is the named or anonymous pipe. + NetworkTransportPipe NetworkTransportAttr = "pipe" + // NetworkTransportUnix is the unix domain socket. + NetworkTransportUnix NetworkTransportAttr = "unix" + // NetworkTransportQUIC is the QUIC. + NetworkTransportQUIC NetworkTransportAttr = "quic" +) + +// SystemNameAttr is an attribute conforming to the rpc.system.name semantic +// conventions. It represents the Remote Procedure Call (RPC) system. +type SystemNameAttr string + +var ( + // SystemNameGRPC is the [gRPC]. + // + // [gRPC]: https://grpc.io/ + SystemNameGRPC SystemNameAttr = "grpc" + // SystemNameDubbo is the [Apache Dubbo]. + // + // [Apache Dubbo]: https://dubbo.apache.org/ + SystemNameDubbo SystemNameAttr = "dubbo" + // SystemNameConnectrpc is the [Connect RPC]. + // + // [Connect RPC]: https://connectrpc.com/ + SystemNameConnectrpc SystemNameAttr = "connectrpc" + // SystemNameJSONRPC is the [JSON-RPC]. + // + // [JSON-RPC]: https://www.jsonrpc.org/ + SystemNameJSONRPC SystemNameAttr = "jsonrpc" +) + +// ClientCallDuration is an instrument used to record metric values conforming to +// the "rpc.client.call.duration" semantic conventions. It represents the +// measures the duration of outbound remote procedure calls (RPC). +type ClientCallDuration struct { + metric.Float64Histogram +} + +var newClientCallDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of outbound remote procedure calls (RPC)."), + metric.WithUnit("s"), +} + +// NewClientCallDuration returns a new ClientCallDuration instrument. +func NewClientCallDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ClientCallDuration, error) { + // Check if the meter is nil. + if m == nil { + return ClientCallDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientCallDurationOpts + } else { + opt = append(opt, newClientCallDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.client.call.duration", + opt..., + ) + if err != nil { + return ClientCallDuration{noop.Float64Histogram{}}, err + } + return ClientCallDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientCallDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientCallDuration) Name() string { + return "rpc.client.call.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientCallDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ClientCallDuration) Description() string { + return "Measures the duration of outbound remote procedure calls (RPC)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// When this metric is reported alongside an RPC client span, the metric value +// SHOULD be the same as the RPC client span duration. +func (m ClientCallDuration) Record( + ctx context.Context, + val float64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// When this metric is reported alongside an RPC client span, the metric value +// SHOULD be the same as the RPC client span duration. +func (m ClientCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ClientCallDuration) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ClientCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the RPC server [host name]. +// +// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html +func (ClientCallDuration) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ClientCallDuration) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientCallDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientCallDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrNetworkTransport returns an optional attribute for the "network.transport" +// semantic convention. It represents the [OSI transport layer] or +// [inter-process communication method]. +// +// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer +// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication +func (ClientCallDuration) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { + return attribute.String("network.transport", string(val)) +} + +// ClientRequestSize is an instrument used to record metric values conforming to +// the "rpc.client.request.size" semantic conventions. It represents the measures +// the size of RPC request messages (uncompressed). +type ClientRequestSize struct { + metric.Int64Histogram +} + +var newClientRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewClientRequestSize returns a new ClientRequestSize instrument. +func NewClientRequestSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientRequestSize, error) { + // Check if the meter is nil. + if m == nil { + return ClientRequestSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientRequestSizeOpts + } else { + opt = append(opt, newClientRequestSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.request.size", + opt..., + ) + if err != nil { + return ClientRequestSize{noop.Int64Histogram{}}, err + } + return ClientRequestSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientRequestSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientRequestSize) Name() string { + return "rpc.client.request.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientRequestSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientRequestSize) Description() string { + return "Measures the size of RPC request messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ClientRequestSize) Record( + ctx context.Context, + val int64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ClientRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientRequestSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ClientRequestSize) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ClientRequestSize) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the RPC server [host name]. +// +// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html +func (ClientRequestSize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ClientRequestSize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientRequestSize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientRequestSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrNetworkTransport returns an optional attribute for the "network.transport" +// semantic convention. It represents the [OSI transport layer] or +// [inter-process communication method]. +// +// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer +// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication +func (ClientRequestSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { + return attribute.String("network.transport", string(val)) +} + +// ClientResponseSize is an instrument used to record metric values conforming to +// the "rpc.client.response.size" semantic conventions. It represents the +// measures the size of RPC response messages (uncompressed). +type ClientResponseSize struct { + metric.Int64Histogram +} + +var newClientResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewClientResponseSize returns a new ClientResponseSize instrument. +func NewClientResponseSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ClientResponseSize, error) { + // Check if the meter is nil. + if m == nil { + return ClientResponseSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newClientResponseSizeOpts + } else { + opt = append(opt, newClientResponseSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.client.response.size", + opt..., + ) + if err != nil { + return ClientResponseSize{noop.Int64Histogram{}}, err + } + return ClientResponseSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ClientResponseSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ClientResponseSize) Name() string { + return "rpc.client.response.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ClientResponseSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ClientResponseSize) Description() string { + return "Measures the size of RPC response messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ClientResponseSize) Record( + ctx context.Context, + val int64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ClientResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ClientResponseSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ClientResponseSize) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ClientResponseSize) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the RPC server [host name]. +// +// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html +func (ClientResponseSize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ClientResponseSize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ClientResponseSize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ClientResponseSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrNetworkTransport returns an optional attribute for the "network.transport" +// semantic convention. It represents the [OSI transport layer] or +// [inter-process communication method]. +// +// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer +// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication +func (ClientResponseSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { + return attribute.String("network.transport", string(val)) +} + +// ServerCallDuration is an instrument used to record metric values conforming to +// the "rpc.server.call.duration" semantic conventions. It represents the +// measures the duration of inbound remote procedure calls (RPC). +type ServerCallDuration struct { + metric.Float64Histogram +} + +var newServerCallDurationOpts = []metric.Float64HistogramOption{ + metric.WithDescription("Measures the duration of inbound remote procedure calls (RPC)."), + metric.WithUnit("s"), +} + +// NewServerCallDuration returns a new ServerCallDuration instrument. +func NewServerCallDuration( + m metric.Meter, + opt ...metric.Float64HistogramOption, +) (ServerCallDuration, error) { + // Check if the meter is nil. + if m == nil { + return ServerCallDuration{noop.Float64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerCallDurationOpts + } else { + opt = append(opt, newServerCallDurationOpts...) + } + + i, err := m.Float64Histogram( + "rpc.server.call.duration", + opt..., + ) + if err != nil { + return ServerCallDuration{noop.Float64Histogram{}}, err + } + return ServerCallDuration{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerCallDuration) Inst() metric.Float64Histogram { + return m.Float64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerCallDuration) Name() string { + return "rpc.server.call.duration" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerCallDuration) Unit() string { + return "s" +} + +// Description returns the semantic convention description of the instrument +func (ServerCallDuration) Description() string { + return "Measures the duration of inbound remote procedure calls (RPC)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// When this metric is reported alongside an RPC server span, the metric value +// SHOULD be the same as the RPC server span duration. +func (m ServerCallDuration) Record( + ctx context.Context, + val float64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Float64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// When this metric is reported alongside an RPC server span, the metric value +// SHOULD be the same as the RPC server span duration. +func (m ServerCallDuration) RecordSet(ctx context.Context, val float64, set attribute.Set) { + if set.Len() == 0 { + m.Float64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Float64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerCallDuration) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ServerCallDuration) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ServerCallDuration) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerCallDuration) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerCallDuration) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrNetworkTransport returns an optional attribute for the "network.transport" +// semantic convention. It represents the [OSI transport layer] or +// [inter-process communication method]. +// +// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer +// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication +func (ServerCallDuration) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { + return attribute.String("network.transport", string(val)) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the RPC server [host name]. +// +// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html +func (ServerCallDuration) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ServerCallDuration) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// ServerRequestSize is an instrument used to record metric values conforming to +// the "rpc.server.request.size" semantic conventions. It represents the measures +// the size of RPC request messages (uncompressed). +type ServerRequestSize struct { + metric.Int64Histogram +} + +var newServerRequestSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC request messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewServerRequestSize returns a new ServerRequestSize instrument. +func NewServerRequestSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerRequestSize, error) { + // Check if the meter is nil. + if m == nil { + return ServerRequestSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerRequestSizeOpts + } else { + opt = append(opt, newServerRequestSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.request.size", + opt..., + ) + if err != nil { + return ServerRequestSize{noop.Int64Histogram{}}, err + } + return ServerRequestSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerRequestSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerRequestSize) Name() string { + return "rpc.server.request.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerRequestSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerRequestSize) Description() string { + return "Measures the size of RPC request messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ServerRequestSize) Record( + ctx context.Context, + val int64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per message in a streaming batch +func (m ServerRequestSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerRequestSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ServerRequestSize) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ServerRequestSize) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerRequestSize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerRequestSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrNetworkTransport returns an optional attribute for the "network.transport" +// semantic convention. It represents the [OSI transport layer] or +// [inter-process communication method]. +// +// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer +// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication +func (ServerRequestSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { + return attribute.String("network.transport", string(val)) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the RPC server [host name]. +// +// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html +func (ServerRequestSize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ServerRequestSize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} + +// ServerResponseSize is an instrument used to record metric values conforming to +// the "rpc.server.response.size" semantic conventions. It represents the +// measures the size of RPC response messages (uncompressed). +type ServerResponseSize struct { + metric.Int64Histogram +} + +var newServerResponseSizeOpts = []metric.Int64HistogramOption{ + metric.WithDescription("Measures the size of RPC response messages (uncompressed)."), + metric.WithUnit("By"), +} + +// NewServerResponseSize returns a new ServerResponseSize instrument. +func NewServerResponseSize( + m metric.Meter, + opt ...metric.Int64HistogramOption, +) (ServerResponseSize, error) { + // Check if the meter is nil. + if m == nil { + return ServerResponseSize{noop.Int64Histogram{}}, nil + } + + if len(opt) == 0 { + opt = newServerResponseSizeOpts + } else { + opt = append(opt, newServerResponseSizeOpts...) + } + + i, err := m.Int64Histogram( + "rpc.server.response.size", + opt..., + ) + if err != nil { + return ServerResponseSize{noop.Int64Histogram{}}, err + } + return ServerResponseSize{i}, nil +} + +// Inst returns the underlying metric instrument. +func (m ServerResponseSize) Inst() metric.Int64Histogram { + return m.Int64Histogram +} + +// Name returns the semantic convention name of the instrument. +func (ServerResponseSize) Name() string { + return "rpc.server.response.size" +} + +// Unit returns the semantic convention unit of the instrument +func (ServerResponseSize) Unit() string { + return "By" +} + +// Description returns the semantic convention description of the instrument +func (ServerResponseSize) Description() string { + return "Measures the size of RPC response messages (uncompressed)." +} + +// Record records val to the current distribution for attrs. +// +// The systemName is the the Remote Procedure Call (RPC) system. +// +// All additional attrs passed are included in the recorded value. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ServerResponseSize) Record( + ctx context.Context, + val int64, + systemName SystemNameAttr, + attrs ...attribute.KeyValue, +) { + if len(attrs) == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append( + *o, + metric.WithAttributes( + append( + attrs, + attribute.String("rpc.system.name", string(systemName)), + )..., + ), + ) + + m.Int64Histogram.Record(ctx, val, *o...) +} + +// RecordSet records val to the current distribution for set. +// +// **Streaming**: Recorded per response in a streaming batch +func (m ServerResponseSize) RecordSet(ctx context.Context, val int64, set attribute.Set) { + if set.Len() == 0 { + m.Int64Histogram.Record(ctx, val) + return + } + + o := recOptPool.Get().(*[]metric.RecordOption) + defer func() { + *o = (*o)[:0] + recOptPool.Put(o) + }() + + *o = append(*o, metric.WithAttributeSet(set)) + m.Int64Histogram.Record(ctx, val, *o...) +} + +// AttrErrorType returns an optional attribute for the "error.type" semantic +// convention. It represents the describes a class of error the operation ended +// with. +func (ServerResponseSize) AttrErrorType(val ErrorTypeAttr) attribute.KeyValue { + return attribute.String("error.type", string(val)) +} + +// AttrMethod returns an optional attribute for the "rpc.method" semantic +// convention. It represents the fully-qualified logical name of the method from +// the RPC interface perspective. +func (ServerResponseSize) AttrMethod(val string) attribute.KeyValue { + return attribute.String("rpc.method", val) +} + +// AttrResponseStatusCode returns an optional attribute for the +// "rpc.response.status_code" semantic convention. It represents the status code +// of the RPC returned by the RPC server or generated by the client. +func (ServerResponseSize) AttrResponseStatusCode(val string) attribute.KeyValue { + return attribute.String("rpc.response.status_code", val) +} + +// AttrNetworkProtocolName returns an optional attribute for the +// "network.protocol.name" semantic convention. It represents the +// [OSI application layer] or non-OSI equivalent. +// +// [OSI application layer]: https://wikipedia.org/wiki/Application_layer +func (ServerResponseSize) AttrNetworkProtocolName(val string) attribute.KeyValue { + return attribute.String("network.protocol.name", val) +} + +// AttrNetworkProtocolVersion returns an optional attribute for the +// "network.protocol.version" semantic convention. It represents the actual +// version of the protocol used for network communication. +func (ServerResponseSize) AttrNetworkProtocolVersion(val string) attribute.KeyValue { + return attribute.String("network.protocol.version", val) +} + +// AttrNetworkTransport returns an optional attribute for the "network.transport" +// semantic convention. It represents the [OSI transport layer] or +// [inter-process communication method]. +// +// [OSI transport layer]: https://wikipedia.org/wiki/Transport_layer +// [inter-process communication method]: https://wikipedia.org/wiki/Inter-process_communication +func (ServerResponseSize) AttrNetworkTransport(val NetworkTransportAttr) attribute.KeyValue { + return attribute.String("network.transport", string(val)) +} + +// AttrServerAddress returns an optional attribute for the "server.address" +// semantic convention. It represents the RPC server [host name]. +// +// [host name]: https://grpc.github.io/grpc/core/md_doc_naming.html +func (ServerResponseSize) AttrServerAddress(val string) attribute.KeyValue { + return attribute.String("server.address", val) +} + +// AttrServerPort returns an optional attribute for the "server.port" semantic +// convention. It represents the server port number. +func (ServerResponseSize) AttrServerPort(val int) attribute.KeyValue { + return attribute.Int("server.port", val) +} diff --git a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go index a7c5d19bff..1f8d49bc98 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/common/v1/common.pb.go @@ -34,7 +34,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// AnyValue is used to represent any type of attribute value. AnyValue may contain a +// Represents any type of attribute value. AnyValue may contain a // primitive value such as a string or integer or it may contain an arbitrary nested // object containing arrays, key-value lists and primitives. type AnyValue struct { @@ -252,8 +252,10 @@ type KeyValueList struct { // A collection of key/value pairs of key-value pairs. The list may be empty (may // contain 0 elements). + // // The keys MUST be unique (it is not allowed to have more than one // value with the same key). + // The behavior of software that receives duplicated keys can be unpredictable. Values []*KeyValue `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` } @@ -296,14 +298,16 @@ func (x *KeyValueList) GetValues() []*KeyValue { return nil } -// KeyValue is a key-value pair that is used to store Span attributes, Link +// Represents a key-value pair that is used to store Span attributes, Link // attributes, etc. type KeyValue struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The key name of the pair. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The value of the pair. Value *AnyValue `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } @@ -360,14 +364,21 @@ type InstrumentationScope struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + // A name denoting the Instrumentation scope. // An empty instrumentation scope name means the name is unknown. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Defines the version of the instrumentation scope. + // An empty instrumentation scope version means the version is unknown. Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // Additional attributes that describe the scope. [Optional]. // Attribute keys MUST be unique (it is not allowed to have more than one // attribute with the same key). - Attributes []*KeyValue `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` - DroppedAttributesCount uint32 `protobuf:"varint,4,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + // The behavior of software that receives duplicated keys can be unpredictable. + Attributes []*KeyValue `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` + // The number of attributes that were discarded. Attributes + // can be discarded because their keys are too long or because there are too many + // attributes. If this value is 0, then no attributes were dropped. + DroppedAttributesCount uint32 `protobuf:"varint,4,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` } func (x *InstrumentationScope) Reset() { diff --git a/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go b/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go index eb7745d66e..301247ddfe 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/resource/v1/resource.pb.go @@ -44,8 +44,9 @@ type Resource struct { // Set of attributes that describe the resource. // Attribute keys MUST be unique (it is not allowed to have more than one // attribute with the same key). + // The behavior of software that receives duplicated keys can be unpredictable. Attributes []*v1.KeyValue `protobuf:"bytes,1,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of dropped attributes. If the value is 0, then + // The number of dropped attributes. If the value is 0, then // no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,2,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` // Set of entities that participate in this Resource. diff --git a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go index b342a0a940..d7bfca9029 100644 --- a/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go +++ b/vendor/go.opentelemetry.io/proto/otlp/trace/v1/trace.pb.go @@ -388,7 +388,8 @@ type ScopeSpans struct { // is recorded in. Notably, the last part of the URL path is the version number of the // schema: http[s]://server[:port]/path/. To learn more about Schema URL see // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url - // This schema_url applies to all spans and span events in the "spans" field. + // This schema_url applies to the data in the "scope" field and all spans and span + // events in the "spans" field. SchemaUrl string `protobuf:"bytes,3,opt,name=schema_url,json=schemaUrl,proto3" json:"schema_url,omitempty"` } @@ -512,21 +513,21 @@ type Span struct { // two spans with the same name may be distinguished using `CLIENT` (caller) // and `SERVER` (callee) to identify queueing latency associated with the span. Kind Span_SpanKind `protobuf:"varint,6,opt,name=kind,proto3,enum=opentelemetry.proto.trace.v1.Span_SpanKind" json:"kind,omitempty"` - // start_time_unix_nano is the start time of the span. On the client side, this is the time + // The start time of the span. On the client side, this is the time // kept by the local machine where the span execution starts. On the server side, this // is the time when the server's application handler starts running. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. // // This field is semantically required and it is expected that end_time >= start_time. StartTimeUnixNano uint64 `protobuf:"fixed64,7,opt,name=start_time_unix_nano,json=startTimeUnixNano,proto3" json:"start_time_unix_nano,omitempty"` - // end_time_unix_nano is the end time of the span. On the client side, this is the time + // The end time of the span. On the client side, this is the time // kept by the local machine where the span execution ends. On the server side, this // is the time when the server application handler stops running. // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. // // This field is semantically required and it is expected that end_time >= start_time. EndTimeUnixNano uint64 `protobuf:"fixed64,8,opt,name=end_time_unix_nano,json=endTimeUnixNano,proto3" json:"end_time_unix_nano,omitempty"` - // attributes is a collection of key/value pairs. Note, global attributes + // A collection of key/value pairs. Note, global attributes // like server name can be set using the resource API. Examples of attributes: // // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" @@ -534,24 +535,23 @@ type Span struct { // "example.com/myattribute": true // "example.com/score": 10.239 // - // The OpenTelemetry API specification further restricts the allowed value types: - // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute // Attribute keys MUST be unique (it is not allowed to have more than one // attribute with the same key). + // The behavior of software that receives duplicated keys can be unpredictable. Attributes []*v11.KeyValue `protobuf:"bytes,9,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of attributes that were discarded. Attributes + // The number of attributes that were discarded. Attributes // can be discarded because their keys are too long or because there are too many // attributes. If this value is 0, then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,10,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` - // events is a collection of Event items. + // A collection of Event items. Events []*Span_Event `protobuf:"bytes,11,rep,name=events,proto3" json:"events,omitempty"` - // dropped_events_count is the number of dropped events. If the value is 0, then no + // The number of dropped events. If the value is 0, then no // events were dropped. DroppedEventsCount uint32 `protobuf:"varint,12,opt,name=dropped_events_count,json=droppedEventsCount,proto3" json:"dropped_events_count,omitempty"` - // links is a collection of Links, which are references from this span to a span + // A collection of Links, which are references from this span to a span // in the same or different trace. Links []*Span_Link `protobuf:"bytes,13,rep,name=links,proto3" json:"links,omitempty"` - // dropped_links_count is the number of dropped links after the maximum size was + // The number of dropped links after the maximum size was // enforced. If this value is 0, then no links were dropped. DroppedLinksCount uint32 `protobuf:"varint,14,opt,name=dropped_links_count,json=droppedLinksCount,proto3" json:"dropped_links_count,omitempty"` // An optional final status for this span. Semantically when Status isn't set, it means @@ -769,16 +769,17 @@ type Span_Event struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // time_unix_nano is the time the event occurred. + // The time the event occurred. TimeUnixNano uint64 `protobuf:"fixed64,1,opt,name=time_unix_nano,json=timeUnixNano,proto3" json:"time_unix_nano,omitempty"` - // name of the event. + // The name of the event. // This field is semantically required to be set to non-empty string. Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - // attributes is a collection of attribute key/value pairs on the event. + // A collection of attribute key/value pairs on the event. // Attribute keys MUST be unique (it is not allowed to have more than one // attribute with the same key). + // The behavior of software that receives duplicated keys can be unpredictable. Attributes []*v11.KeyValue `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // The number of dropped attributes. If the value is 0, // then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,4,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` } @@ -859,11 +860,12 @@ type Span_Link struct { SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` // The trace_state associated with the link. TraceState string `protobuf:"bytes,3,opt,name=trace_state,json=traceState,proto3" json:"trace_state,omitempty"` - // attributes is a collection of attribute key/value pairs on the link. + // A collection of attribute key/value pairs on the link. // Attribute keys MUST be unique (it is not allowed to have more than one // attribute with the same key). + // The behavior of software that receives duplicated keys can be unpredictable. Attributes []*v11.KeyValue `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty"` - // dropped_attributes_count is the number of dropped attributes. If the value is 0, + // The number of dropped attributes. If the value is 0, // then no attributes were dropped. DroppedAttributesCount uint32 `protobuf:"varint,5,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` // Flags, a bit field. diff --git a/vendor/go.uber.org/zap/.golangci.yml b/vendor/go.uber.org/zap/.golangci.yml index 2346df1351..74faaa71d8 100644 --- a/vendor/go.uber.org/zap/.golangci.yml +++ b/vendor/go.uber.org/zap/.golangci.yml @@ -25,7 +25,7 @@ linters-settings: govet: # These govet checks are disabled by default, but they're useful. enable: - - niliness + - nilness - reflectvaluecompare - sortslice - unusedwrite diff --git a/vendor/go.uber.org/zap/CHANGELOG.md b/vendor/go.uber.org/zap/CHANGELOG.md index 6d6cd5f4d7..86e7e6f982 100644 --- a/vendor/go.uber.org/zap/CHANGELOG.md +++ b/vendor/go.uber.org/zap/CHANGELOG.md @@ -3,6 +3,16 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.27.1 (19 Nov 2025) +Enhancements: +* [#1501][]: prevent `Object` from panicking on nils +* [#1511][]: Fix a race condition in `WithLazy`. + +Thanks to @rabbbit, @alshopov, @jquirke, @arukiidou for their contributions to this release. + +[#1501]: https://github.com/uber-go/zap/pull/1501 +[#1511]: https://github.com/uber-go/zap/pull/1511 + ## 1.27.0 (20 Feb 2024) Enhancements: * [#1378][]: Add `WithLazy` method for `SugaredLogger`. diff --git a/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md b/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md index e327d9aa5c..bc988b72ed 100644 --- a/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md +++ b/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md @@ -71,5 +71,5 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]. -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ +[homepage]: https://contributor-covenant.org +[version]: https://contributor-covenant.org/version/1/4/ diff --git a/vendor/go.uber.org/zap/LICENSE b/vendor/go.uber.org/zap/LICENSE index 6652bed45f..3883b9a7ea 100644 --- a/vendor/go.uber.org/zap/LICENSE +++ b/vendor/go.uber.org/zap/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2016-2017 Uber Technologies, Inc. +Copyright (c) 2016-2024 Uber Technologies, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/go.uber.org/zap/Makefile b/vendor/go.uber.org/zap/Makefile index eb1cee53bd..f9db385b34 100644 --- a/vendor/go.uber.org/zap/Makefile +++ b/vendor/go.uber.org/zap/Makefile @@ -24,7 +24,7 @@ golangci-lint: @$(foreach mod,$(MODULE_DIRS), \ (cd $(mod) && \ echo "[lint] golangci-lint: $(mod)" && \ - golangci-lint run --path-prefix $(mod)) &&) true + golangci-lint run --path-prefix $(mod) ./...) &&) true .PHONY: tidy tidy: diff --git a/vendor/go.uber.org/zap/field.go b/vendor/go.uber.org/zap/field.go index 6743930b82..1884afabcd 100644 --- a/vendor/go.uber.org/zap/field.go +++ b/vendor/go.uber.org/zap/field.go @@ -398,6 +398,9 @@ func Durationp(key string, val *time.Duration) Field { // struct-like user-defined types to the logging context. The struct's // MarshalLogObject method is called lazily. func Object(key string, val zapcore.ObjectMarshaler) Field { + if val == nil { + return nilField(key) + } return Field{Key: key, Type: zapcore.ObjectMarshalerType, Interface: val} } @@ -431,6 +434,13 @@ func (d dictObject) MarshalLogObject(enc zapcore.ObjectEncoder) error { return nil } +// DictObject constructs a [zapcore.ObjectMarshaler] with the given list of fields. +// The resulting object marshaler can be used as input to [Object], [Objects], or +// any other functions that expect an object marshaler. +func DictObject(val ...Field) zapcore.ObjectMarshaler { + return dictObject(val) +} + // We discovered an issue where zap.Any can cause a performance degradation // when used in new goroutines. // diff --git a/vendor/go.uber.org/zap/http_handler.go b/vendor/go.uber.org/zap/http_handler.go index 2be8f65150..1cae2c164b 100644 --- a/vendor/go.uber.org/zap/http_handler.go +++ b/vendor/go.uber.org/zap/http_handler.go @@ -71,7 +71,7 @@ import ( func (lvl AtomicLevel) ServeHTTP(w http.ResponseWriter, r *http.Request) { if err := lvl.serveHTTP(w, r); err != nil { w.WriteHeader(http.StatusInternalServerError) - fmt.Fprintf(w, "internal error: %v", err) + _, _ = fmt.Fprintf(w, "internal error: %v", err) } } diff --git a/vendor/go.uber.org/zap/logger.go b/vendor/go.uber.org/zap/logger.go index c4d3003239..2d0ef141bc 100644 --- a/vendor/go.uber.org/zap/logger.go +++ b/vendor/go.uber.org/zap/logger.go @@ -381,7 +381,11 @@ func (log *Logger) check(lvl zapcore.Level, msg string) *zapcore.CheckedEntry { if stack.Count() == 0 { if log.addCaller { - fmt.Fprintf(log.errorOutput, "%v Logger.check error: failed to get caller\n", ent.Time.UTC()) + _, _ = fmt.Fprintf( + log.errorOutput, + "%v Logger.check error: failed to get caller\n", + ent.Time.UTC(), + ) _ = log.errorOutput.Sync() } return ce diff --git a/vendor/go.uber.org/zap/options.go b/vendor/go.uber.org/zap/options.go index 43d357ac90..04a3c1e635 100644 --- a/vendor/go.uber.org/zap/options.go +++ b/vendor/go.uber.org/zap/options.go @@ -125,7 +125,11 @@ func IncreaseLevel(lvl zapcore.LevelEnabler) Option { return optionFunc(func(log *Logger) { core, err := zapcore.NewIncreaseLevelCore(log.core, lvl) if err != nil { - fmt.Fprintf(log.errorOutput, "failed to IncreaseLevel: %v\n", err) + _, _ = fmt.Fprintf( + log.errorOutput, + "failed to IncreaseLevel: %v\n", + err, + ) } else { log.core = core } diff --git a/vendor/go.uber.org/zap/sink.go b/vendor/go.uber.org/zap/sink.go index 499772a00d..92202280f1 100644 --- a/vendor/go.uber.org/zap/sink.go +++ b/vendor/go.uber.org/zap/sink.go @@ -71,7 +71,7 @@ func newSinkRegistry() *sinkRegistry { return sr } -// RegisterScheme registers the given factory for the specific scheme. +// RegisterSink registers the given factory for the specific scheme. func (sr *sinkRegistry) RegisterSink(scheme string, factory func(*url.URL) (Sink, error)) error { sr.mu.Lock() defer sr.mu.Unlock() diff --git a/vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go b/vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go index a40e93b3ec..4b426a5648 100644 --- a/vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go +++ b/vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go @@ -188,32 +188,33 @@ func (s *BufferedWriteSyncer) flushLoop() { // Stop closes the buffer, cleans up background goroutines, and flushes // remaining unwritten data. func (s *BufferedWriteSyncer) Stop() (err error) { - var stopped bool - // Critical section. - func() { + stopped := func() bool { s.mu.Lock() defer s.mu.Unlock() if !s.initialized { - return + return false } - stopped = s.stopped - if stopped { - return + if s.stopped { + return false } s.stopped = true s.ticker.Stop() close(s.stop) // tell flushLoop to stop - <-s.done // and wait until it has + return true }() - // Don't call Sync on consecutive Stops. + // Not initialized, or already stopped, no need for any cleanup. if !stopped { - err = s.Sync() + return } - return err + // Wait for flushLoop to end outside of the lock, as it may need the lock to complete. + // See https://github.com/uber-go/zap/issues/1428 for details. + <-s.done + + return s.Sync() } diff --git a/vendor/go.uber.org/zap/zapcore/console_encoder.go b/vendor/go.uber.org/zap/zapcore/console_encoder.go index cc2b4e07b9..98eea5154d 100644 --- a/vendor/go.uber.org/zap/zapcore/console_encoder.go +++ b/vendor/go.uber.org/zap/zapcore/console_encoder.go @@ -105,7 +105,7 @@ func (c consoleEncoder) EncodeEntry(ent Entry, fields []Field) (*buffer.Buffer, if i > 0 { line.AppendString(c.ConsoleSeparator) } - fmt.Fprint(line, arr.elems[i]) + _, _ = fmt.Fprint(line, arr.elems[i]) } putSliceEncoder(arr) diff --git a/vendor/go.uber.org/zap/zapcore/entry.go b/vendor/go.uber.org/zap/zapcore/entry.go index 459a5d7ce3..841752f2ed 100644 --- a/vendor/go.uber.org/zap/zapcore/entry.go +++ b/vendor/go.uber.org/zap/zapcore/entry.go @@ -241,7 +241,12 @@ func (ce *CheckedEntry) Write(fields ...Field) { // If the entry is dirty, log an internal error; because the // CheckedEntry is being used after it was returned to the pool, // the message may be an amalgamation from multiple call sites. - fmt.Fprintf(ce.ErrorOutput, "%v Unsafe CheckedEntry re-use near Entry %+v.\n", ce.Time, ce.Entry) + _, _ = fmt.Fprintf( + ce.ErrorOutput, + "%v Unsafe CheckedEntry re-use near Entry %+v.\n", + ce.Time, + ce.Entry, + ) _ = ce.ErrorOutput.Sync() // ignore error } return @@ -253,7 +258,12 @@ func (ce *CheckedEntry) Write(fields ...Field) { err = multierr.Append(err, ce.cores[i].Write(ce.Entry, fields)) } if err != nil && ce.ErrorOutput != nil { - fmt.Fprintf(ce.ErrorOutput, "%v write error: %v\n", ce.Time, err) + _, _ = fmt.Fprintf( + ce.ErrorOutput, + "%v write error: %v\n", + ce.Time, + err, + ) _ = ce.ErrorOutput.Sync() // ignore error } diff --git a/vendor/go.uber.org/zap/zapcore/lazy_with.go b/vendor/go.uber.org/zap/zapcore/lazy_with.go index 05288d6a88..500809de08 100644 --- a/vendor/go.uber.org/zap/zapcore/lazy_with.go +++ b/vendor/go.uber.org/zap/zapcore/lazy_with.go @@ -23,7 +23,8 @@ package zapcore import "sync" type lazyWithCore struct { - Core + core Core + originalCore Core sync.Once fields []Field } @@ -32,23 +33,45 @@ type lazyWithCore struct { // the logger is written to (or is further chained in a lon-lazy manner). func NewLazyWith(core Core, fields []Field) Core { return &lazyWithCore{ - Core: core, - fields: fields, + core: nil, // core is allocated once `initOnce` is called. + originalCore: core, + fields: fields, } } func (d *lazyWithCore) initOnce() { d.Once.Do(func() { - d.Core = d.Core.With(d.fields) + d.core = d.originalCore.With(d.fields) }) } func (d *lazyWithCore) With(fields []Field) Core { d.initOnce() - return d.Core.With(fields) + return d.core.With(fields) } func (d *lazyWithCore) Check(e Entry, ce *CheckedEntry) *CheckedEntry { + // This is safe because `lazyWithCore` doesn't change the level. + // So we can delagate the level check, any not `initOnce` + // just for the check. + if !d.originalCore.Enabled(e.Level) { + return ce + } + d.initOnce() + return d.core.Check(e, ce) +} + +func (d *lazyWithCore) Enabled(level Level) bool { + // Like above, this is safe because `lazyWithCore` doesn't change the level. + return d.originalCore.Enabled(level) +} + +func (d *lazyWithCore) Write(e Entry, fields []Field) error { + d.initOnce() + return d.core.Write(e, fields) +} + +func (d *lazyWithCore) Sync() error { d.initOnce() - return d.Core.Check(e, ce) + return d.core.Sync() } diff --git a/vendor/go.uber.org/zap/zapcore/level.go b/vendor/go.uber.org/zap/zapcore/level.go index e01a241316..f3e166d67b 100644 --- a/vendor/go.uber.org/zap/zapcore/level.go +++ b/vendor/go.uber.org/zap/zapcore/level.go @@ -179,19 +179,19 @@ func (l *Level) UnmarshalText(text []byte) error { func (l *Level) unmarshalText(text []byte) bool { switch string(text) { - case "debug", "DEBUG": + case "debug": *l = DebugLevel - case "info", "INFO", "": // make the zero value useful + case "info", "": // make the zero value useful *l = InfoLevel - case "warn", "WARN": + case "warn", "warning": *l = WarnLevel - case "error", "ERROR": + case "error": *l = ErrorLevel - case "dpanic", "DPANIC": + case "dpanic": *l = DPanicLevel - case "panic", "PANIC": + case "panic": *l = PanicLevel - case "fatal", "FATAL": + case "fatal": *l = FatalLevel default: return false diff --git a/vendor/golang.org/x/exp/constraints/constraints.go b/vendor/golang.org/x/exp/constraints/constraints.go deleted file mode 100644 index 2c033dff47..0000000000 --- a/vendor/golang.org/x/exp/constraints/constraints.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package constraints defines a set of useful constraints to be used -// with type parameters. -package constraints - -// Signed is a constraint that permits any signed integer type. -// If future releases of Go add new predeclared signed integer types, -// this constraint will be modified to include them. -type Signed interface { - ~int | ~int8 | ~int16 | ~int32 | ~int64 -} - -// Unsigned is a constraint that permits any unsigned integer type. -// If future releases of Go add new predeclared unsigned integer types, -// this constraint will be modified to include them. -type Unsigned interface { - ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr -} - -// Integer is a constraint that permits any integer type. -// If future releases of Go add new predeclared integer types, -// this constraint will be modified to include them. -type Integer interface { - Signed | Unsigned -} - -// Float is a constraint that permits any floating-point type. -// If future releases of Go add new predeclared floating-point types, -// this constraint will be modified to include them. -type Float interface { - ~float32 | ~float64 -} - -// Complex is a constraint that permits any complex numeric type. -// If future releases of Go add new predeclared complex numeric types, -// this constraint will be modified to include them. -type Complex interface { - ~complex64 | ~complex128 -} - -// Ordered is a constraint that permits any ordered type: any type -// that supports the operators < <= >= >. -// If future releases of Go add new ordered types, -// this constraint will be modified to include them. -type Ordered interface { - Integer | Float | ~string -} diff --git a/vendor/golang.org/x/exp/slices/cmp.go b/vendor/golang.org/x/exp/slices/cmp.go deleted file mode 100644 index fbf1934a06..0000000000 --- a/vendor/golang.org/x/exp/slices/cmp.go +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2023 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package slices - -import "golang.org/x/exp/constraints" - -// min is a version of the predeclared function from the Go 1.21 release. -func min[T constraints.Ordered](a, b T) T { - if a < b || isNaN(a) { - return a - } - return b -} - -// max is a version of the predeclared function from the Go 1.21 release. -func max[T constraints.Ordered](a, b T) T { - if a > b || isNaN(a) { - return a - } - return b -} - -// cmpLess is a copy of cmp.Less from the Go 1.21 release. -func cmpLess[T constraints.Ordered](x, y T) bool { - return (isNaN(x) && !isNaN(y)) || x < y -} - -// cmpCompare is a copy of cmp.Compare from the Go 1.21 release. -func cmpCompare[T constraints.Ordered](x, y T) int { - xNaN := isNaN(x) - yNaN := isNaN(y) - if xNaN && yNaN { - return 0 - } - if xNaN || x < y { - return -1 - } - if yNaN || x > y { - return +1 - } - return 0 -} diff --git a/vendor/golang.org/x/exp/slices/slices.go b/vendor/golang.org/x/exp/slices/slices.go index 46ceac3439..da0df370da 100644 --- a/vendor/golang.org/x/exp/slices/slices.go +++ b/vendor/golang.org/x/exp/slices/slices.go @@ -6,9 +6,8 @@ package slices import ( - "unsafe" - - "golang.org/x/exp/constraints" + "cmp" + "slices" ) // Equal reports whether two slices are equal: the same length and all @@ -16,16 +15,10 @@ import ( // Otherwise, the elements are compared in increasing index order, and the // comparison stops at the first unequal pair. // Floating point NaNs are not considered equal. +// +//go:fix inline func Equal[S ~[]E, E comparable](s1, s2 S) bool { - if len(s1) != len(s2) { - return false - } - for i := range s1 { - if s1[i] != s2[i] { - return false - } - } - return true + return slices.Equal(s1, s2) } // EqualFunc reports whether two slices are equal using an equality @@ -33,17 +26,10 @@ func Equal[S ~[]E, E comparable](s1, s2 S) bool { // EqualFunc returns false. Otherwise, the elements are compared in // increasing index order, and the comparison stops at the first index // for which eq returns false. +// +//go:fix inline func EqualFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, eq func(E1, E2) bool) bool { - if len(s1) != len(s2) { - return false - } - for i, v1 := range s1 { - v2 := s2[i] - if !eq(v1, v2) { - return false - } - } - return true + return slices.EqualFunc(s1, s2, eq) } // Compare compares the elements of s1 and s2, using [cmp.Compare] on each pair @@ -53,20 +39,10 @@ func EqualFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, eq func(E1, E2) boo // If both slices are equal until one of them ends, the shorter slice is // considered less than the longer one. // The result is 0 if s1 == s2, -1 if s1 < s2, and +1 if s1 > s2. -func Compare[S ~[]E, E constraints.Ordered](s1, s2 S) int { - for i, v1 := range s1 { - if i >= len(s2) { - return +1 - } - v2 := s2[i] - if c := cmpCompare(v1, v2); c != 0 { - return c - } - } - if len(s1) < len(s2) { - return -1 - } - return 0 +// +//go:fix inline +func Compare[S ~[]E, E cmp.Ordered](s1, s2 S) int { + return slices.Compare(s1, s2) } // CompareFunc is like [Compare] but uses a custom comparison function on each @@ -74,53 +50,41 @@ func Compare[S ~[]E, E constraints.Ordered](s1, s2 S) int { // The result is the first non-zero result of cmp; if cmp always // returns 0 the result is 0 if len(s1) == len(s2), -1 if len(s1) < len(s2), // and +1 if len(s1) > len(s2). +// +//go:fix inline func CompareFunc[S1 ~[]E1, S2 ~[]E2, E1, E2 any](s1 S1, s2 S2, cmp func(E1, E2) int) int { - for i, v1 := range s1 { - if i >= len(s2) { - return +1 - } - v2 := s2[i] - if c := cmp(v1, v2); c != 0 { - return c - } - } - if len(s1) < len(s2) { - return -1 - } - return 0 + return slices.CompareFunc(s1, s2, cmp) } // Index returns the index of the first occurrence of v in s, // or -1 if not present. +// +//go:fix inline func Index[S ~[]E, E comparable](s S, v E) int { - for i := range s { - if v == s[i] { - return i - } - } - return -1 + return slices.Index(s, v) } // IndexFunc returns the first index i satisfying f(s[i]), // or -1 if none do. +// +//go:fix inline func IndexFunc[S ~[]E, E any](s S, f func(E) bool) int { - for i := range s { - if f(s[i]) { - return i - } - } - return -1 + return slices.IndexFunc(s, f) } // Contains reports whether v is present in s. +// +//go:fix inline func Contains[S ~[]E, E comparable](s S, v E) bool { - return Index(s, v) >= 0 + return slices.Contains(s, v) } // ContainsFunc reports whether at least one // element e of s satisfies f(e). +// +//go:fix inline func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool { - return IndexFunc(s, f) >= 0 + return slices.ContainsFunc(s, f) } // Insert inserts the values v... into s at index i, @@ -130,93 +94,10 @@ func ContainsFunc[S ~[]E, E any](s S, f func(E) bool) bool { // and r[i+len(v)] == value originally at r[i]. // Insert panics if i is out of range. // This function is O(len(s) + len(v)). +// +//go:fix inline func Insert[S ~[]E, E any](s S, i int, v ...E) S { - m := len(v) - if m == 0 { - return s - } - n := len(s) - if i == n { - return append(s, v...) - } - if n+m > cap(s) { - // Use append rather than make so that we bump the size of - // the slice up to the next storage class. - // This is what Grow does but we don't call Grow because - // that might copy the values twice. - s2 := append(s[:i], make(S, n+m-i)...) - copy(s2[i:], v) - copy(s2[i+m:], s[i:]) - return s2 - } - s = s[:n+m] - - // before: - // s: aaaaaaaabbbbccccccccdddd - // ^ ^ ^ ^ - // i i+m n n+m - // after: - // s: aaaaaaaavvvvbbbbcccccccc - // ^ ^ ^ ^ - // i i+m n n+m - // - // a are the values that don't move in s. - // v are the values copied in from v. - // b and c are the values from s that are shifted up in index. - // d are the values that get overwritten, never to be seen again. - - if !overlaps(v, s[i+m:]) { - // Easy case - v does not overlap either the c or d regions. - // (It might be in some of a or b, or elsewhere entirely.) - // The data we copy up doesn't write to v at all, so just do it. - - copy(s[i+m:], s[i:]) - - // Now we have - // s: aaaaaaaabbbbbbbbcccccccc - // ^ ^ ^ ^ - // i i+m n n+m - // Note the b values are duplicated. - - copy(s[i:], v) - - // Now we have - // s: aaaaaaaavvvvbbbbcccccccc - // ^ ^ ^ ^ - // i i+m n n+m - // That's the result we want. - return s - } - - // The hard case - v overlaps c or d. We can't just shift up - // the data because we'd move or clobber the values we're trying - // to insert. - // So instead, write v on top of d, then rotate. - copy(s[n:], v) - - // Now we have - // s: aaaaaaaabbbbccccccccvvvv - // ^ ^ ^ ^ - // i i+m n n+m - - rotateRight(s[i:], m) - - // Now we have - // s: aaaaaaaavvvvbbbbcccccccc - // ^ ^ ^ ^ - // i i+m n n+m - // That's the result we want. - return s -} - -// clearSlice sets all elements up to the length of s to the zero value of E. -// We may use the builtin clear func instead, and remove clearSlice, when upgrading -// to Go 1.21+. -func clearSlice[S ~[]E, E any](s S) { - var zero E - for i := range s { - s[i] = zero - } + return slices.Insert(s, i, v...) } // Delete removes the elements s[i:j] from s, returning the modified slice. @@ -224,136 +105,36 @@ func clearSlice[S ~[]E, E any](s S) { // Delete is O(len(s)-i), so if many items must be deleted, it is better to // make a single call deleting them all together than to delete one at a time. // Delete zeroes the elements s[len(s)-(j-i):len(s)]. +// +//go:fix inline func Delete[S ~[]E, E any](s S, i, j int) S { - _ = s[i:j:len(s)] // bounds check - - if i == j { - return s - } - - oldlen := len(s) - s = append(s[:i], s[j:]...) - clearSlice(s[len(s):oldlen]) // zero/nil out the obsolete elements, for GC - return s + return slices.Delete(s, i, j) } // DeleteFunc removes any elements from s for which del returns true, // returning the modified slice. // DeleteFunc zeroes the elements between the new length and the original length. +// +//go:fix inline func DeleteFunc[S ~[]E, E any](s S, del func(E) bool) S { - i := IndexFunc(s, del) - if i == -1 { - return s - } - // Don't start copying elements until we find one to delete. - for j := i + 1; j < len(s); j++ { - if v := s[j]; !del(v) { - s[i] = v - i++ - } - } - clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC - return s[:i] + return slices.DeleteFunc(s, del) } // Replace replaces the elements s[i:j] by the given v, and returns the // modified slice. Replace panics if s[i:j] is not a valid slice of s. // When len(v) < (j-i), Replace zeroes the elements between the new length and the original length. +// +//go:fix inline func Replace[S ~[]E, E any](s S, i, j int, v ...E) S { - _ = s[i:j] // verify that i:j is a valid subslice - - if i == j { - return Insert(s, i, v...) - } - if j == len(s) { - return append(s[:i], v...) - } - - tot := len(s[:i]) + len(v) + len(s[j:]) - if tot > cap(s) { - // Too big to fit, allocate and copy over. - s2 := append(s[:i], make(S, tot-i)...) // See Insert - copy(s2[i:], v) - copy(s2[i+len(v):], s[j:]) - return s2 - } - - r := s[:tot] - - if i+len(v) <= j { - // Easy, as v fits in the deleted portion. - copy(r[i:], v) - if i+len(v) != j { - copy(r[i+len(v):], s[j:]) - } - clearSlice(s[tot:]) // zero/nil out the obsolete elements, for GC - return r - } - - // We are expanding (v is bigger than j-i). - // The situation is something like this: - // (example has i=4,j=8,len(s)=16,len(v)=6) - // s: aaaaxxxxbbbbbbbbyy - // ^ ^ ^ ^ - // i j len(s) tot - // a: prefix of s - // x: deleted range - // b: more of s - // y: area to expand into - - if !overlaps(r[i+len(v):], v) { - // Easy, as v is not clobbered by the first copy. - copy(r[i+len(v):], s[j:]) - copy(r[i:], v) - return r - } - - // This is a situation where we don't have a single place to which - // we can copy v. Parts of it need to go to two different places. - // We want to copy the prefix of v into y and the suffix into x, then - // rotate |y| spots to the right. - // - // v[2:] v[:2] - // | | - // s: aaaavvvvbbbbbbbbvv - // ^ ^ ^ ^ - // i j len(s) tot - // - // If either of those two destinations don't alias v, then we're good. - y := len(v) - (j - i) // length of y portion - - if !overlaps(r[i:j], v) { - copy(r[i:j], v[y:]) - copy(r[len(s):], v[:y]) - rotateRight(r[i:], y) - return r - } - if !overlaps(r[len(s):], v) { - copy(r[len(s):], v[:y]) - copy(r[i:j], v[y:]) - rotateRight(r[i:], y) - return r - } - - // Now we know that v overlaps both x and y. - // That means that the entirety of b is *inside* v. - // So we don't need to preserve b at all; instead we - // can copy v first, then copy the b part of v out of - // v to the right destination. - k := startIdx(v, s[j:]) - copy(r[i:], v) - copy(r[i+len(v):], r[i+k:]) - return r + return slices.Replace(s, i, j, v...) } // Clone returns a copy of the slice. // The elements are copied using assignment, so this is a shallow clone. +// +//go:fix inline func Clone[S ~[]E, E any](s S) S { - // Preserve nil in case it matters. - if s == nil { - return nil - } - return append(S([]E{}), s...) + return slices.Clone(s) } // Compact replaces consecutive runs of equal elements with a single copy. @@ -361,155 +142,41 @@ func Clone[S ~[]E, E any](s S) S { // Compact modifies the contents of the slice s and returns the modified slice, // which may have a smaller length. // Compact zeroes the elements between the new length and the original length. +// +//go:fix inline func Compact[S ~[]E, E comparable](s S) S { - if len(s) < 2 { - return s - } - i := 1 - for k := 1; k < len(s); k++ { - if s[k] != s[k-1] { - if i != k { - s[i] = s[k] - } - i++ - } - } - clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC - return s[:i] + return slices.Compact(s) } // CompactFunc is like [Compact] but uses an equality function to compare elements. // For runs of elements that compare equal, CompactFunc keeps the first one. // CompactFunc zeroes the elements between the new length and the original length. +// +//go:fix inline func CompactFunc[S ~[]E, E any](s S, eq func(E, E) bool) S { - if len(s) < 2 { - return s - } - i := 1 - for k := 1; k < len(s); k++ { - if !eq(s[k], s[k-1]) { - if i != k { - s[i] = s[k] - } - i++ - } - } - clearSlice(s[i:]) // zero/nil out the obsolete elements, for GC - return s[:i] + return slices.CompactFunc(s, eq) } // Grow increases the slice's capacity, if necessary, to guarantee space for // another n elements. After Grow(n), at least n elements can be appended // to the slice without another allocation. If n is negative or too large to // allocate the memory, Grow panics. +// +//go:fix inline func Grow[S ~[]E, E any](s S, n int) S { - if n < 0 { - panic("cannot be negative") - } - if n -= cap(s) - len(s); n > 0 { - // TODO(https://go.dev/issue/53888): Make using []E instead of S - // to workaround a compiler bug where the runtime.growslice optimization - // does not take effect. Revert when the compiler is fixed. - s = append([]E(s)[:cap(s)], make([]E, n)...)[:len(s)] - } - return s + return slices.Grow(s, n) } // Clip removes unused capacity from the slice, returning s[:len(s):len(s)]. -func Clip[S ~[]E, E any](s S) S { - return s[:len(s):len(s)] -} - -// Rotation algorithm explanation: -// -// rotate left by 2 -// start with -// 0123456789 -// split up like this -// 01 234567 89 -// swap first 2 and last 2 -// 89 234567 01 -// join first parts -// 89234567 01 -// recursively rotate first left part by 2 -// 23456789 01 -// join at the end -// 2345678901 // -// rotate left by 8 -// start with -// 0123456789 -// split up like this -// 01 234567 89 -// swap first 2 and last 2 -// 89 234567 01 -// join last parts -// 89 23456701 -// recursively rotate second part left by 6 -// 89 01234567 -// join at the end -// 8901234567 - -// TODO: There are other rotate algorithms. -// This algorithm has the desirable property that it moves each element exactly twice. -// The triple-reverse algorithm is simpler and more cache friendly, but takes more writes. -// The follow-cycles algorithm can be 1-write but it is not very cache friendly. - -// rotateLeft rotates b left by n spaces. -// s_final[i] = s_orig[i+r], wrapping around. -func rotateLeft[E any](s []E, r int) { - for r != 0 && r != len(s) { - if r*2 <= len(s) { - swap(s[:r], s[len(s)-r:]) - s = s[:len(s)-r] - } else { - swap(s[:len(s)-r], s[r:]) - s, r = s[len(s)-r:], r*2-len(s) - } - } -} -func rotateRight[E any](s []E, r int) { - rotateLeft(s, len(s)-r) -} - -// swap swaps the contents of x and y. x and y must be equal length and disjoint. -func swap[E any](x, y []E) { - for i := 0; i < len(x); i++ { - x[i], y[i] = y[i], x[i] - } -} - -// overlaps reports whether the memory ranges a[0:len(a)] and b[0:len(b)] overlap. -func overlaps[E any](a, b []E) bool { - if len(a) == 0 || len(b) == 0 { - return false - } - elemSize := unsafe.Sizeof(a[0]) - if elemSize == 0 { - return false - } - // TODO: use a runtime/unsafe facility once one becomes available. See issue 12445. - // Also see crypto/internal/alias/alias.go:AnyOverlap - return uintptr(unsafe.Pointer(&a[0])) <= uintptr(unsafe.Pointer(&b[len(b)-1]))+(elemSize-1) && - uintptr(unsafe.Pointer(&b[0])) <= uintptr(unsafe.Pointer(&a[len(a)-1]))+(elemSize-1) -} - -// startIdx returns the index in haystack where the needle starts. -// prerequisite: the needle must be aliased entirely inside the haystack. -func startIdx[E any](haystack, needle []E) int { - p := &needle[0] - for i := range haystack { - if p == &haystack[i] { - return i - } - } - // TODO: what if the overlap is by a non-integral number of Es? - panic("needle not found") +//go:fix inline +func Clip[S ~[]E, E any](s S) S { + return slices.Clip(s) } // Reverse reverses the elements of the slice in place. +// +//go:fix inline func Reverse[S ~[]E, E any](s S) { - for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { - s[i], s[j] = s[j], s[i] - } + slices.Reverse(s) } diff --git a/vendor/golang.org/x/exp/slices/sort.go b/vendor/golang.org/x/exp/slices/sort.go index f58bbc7ba4..bd91a8d402 100644 --- a/vendor/golang.org/x/exp/slices/sort.go +++ b/vendor/golang.org/x/exp/slices/sort.go @@ -2,21 +2,19 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:generate go run $GOROOT/src/sort/gen_sort_variants.go -exp - package slices import ( - "math/bits" - - "golang.org/x/exp/constraints" + "cmp" + "slices" ) // Sort sorts a slice of any ordered type in ascending order. // When sorting floating-point numbers, NaNs are ordered before other values. -func Sort[S ~[]E, E constraints.Ordered](x S) { - n := len(x) - pdqsortOrdered(x, 0, n, bits.Len(uint(n))) +// +//go:fix inline +func Sort[S ~[]E, E cmp.Ordered](x S) { + slices.Sort(x) } // SortFunc sorts the slice x in ascending order as determined by the cmp @@ -28,119 +26,79 @@ func Sort[S ~[]E, E constraints.Ordered](x S) { // SortFunc requires that cmp is a strict weak ordering. // See https://en.wikipedia.org/wiki/Weak_ordering#Strict_weak_orderings. // To indicate 'uncomparable', return 0 from the function. +// +//go:fix inline func SortFunc[S ~[]E, E any](x S, cmp func(a, b E) int) { - n := len(x) - pdqsortCmpFunc(x, 0, n, bits.Len(uint(n)), cmp) + slices.SortFunc(x, cmp) } // SortStableFunc sorts the slice x while keeping the original order of equal // elements, using cmp to compare elements in the same way as [SortFunc]. +// +//go:fix inline func SortStableFunc[S ~[]E, E any](x S, cmp func(a, b E) int) { - stableCmpFunc(x, len(x), cmp) + slices.SortStableFunc(x, cmp) } // IsSorted reports whether x is sorted in ascending order. -func IsSorted[S ~[]E, E constraints.Ordered](x S) bool { - for i := len(x) - 1; i > 0; i-- { - if cmpLess(x[i], x[i-1]) { - return false - } - } - return true +// +//go:fix inline +func IsSorted[S ~[]E, E cmp.Ordered](x S) bool { + return slices.IsSorted(x) } // IsSortedFunc reports whether x is sorted in ascending order, with cmp as the // comparison function as defined by [SortFunc]. +// +//go:fix inline func IsSortedFunc[S ~[]E, E any](x S, cmp func(a, b E) int) bool { - for i := len(x) - 1; i > 0; i-- { - if cmp(x[i], x[i-1]) < 0 { - return false - } - } - return true + return slices.IsSortedFunc(x, cmp) } // Min returns the minimal value in x. It panics if x is empty. // For floating-point numbers, Min propagates NaNs (any NaN value in x // forces the output to be NaN). -func Min[S ~[]E, E constraints.Ordered](x S) E { - if len(x) < 1 { - panic("slices.Min: empty list") - } - m := x[0] - for i := 1; i < len(x); i++ { - m = min(m, x[i]) - } - return m +// +//go:fix inline +func Min[S ~[]E, E cmp.Ordered](x S) E { + return slices.Min(x) } // MinFunc returns the minimal value in x, using cmp to compare elements. // It panics if x is empty. If there is more than one minimal element // according to the cmp function, MinFunc returns the first one. +// +//go:fix inline func MinFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E { - if len(x) < 1 { - panic("slices.MinFunc: empty list") - } - m := x[0] - for i := 1; i < len(x); i++ { - if cmp(x[i], m) < 0 { - m = x[i] - } - } - return m + return slices.MinFunc(x, cmp) } // Max returns the maximal value in x. It panics if x is empty. // For floating-point E, Max propagates NaNs (any NaN value in x // forces the output to be NaN). -func Max[S ~[]E, E constraints.Ordered](x S) E { - if len(x) < 1 { - panic("slices.Max: empty list") - } - m := x[0] - for i := 1; i < len(x); i++ { - m = max(m, x[i]) - } - return m +// +//go:fix inline +func Max[S ~[]E, E cmp.Ordered](x S) E { + return slices.Max(x) } // MaxFunc returns the maximal value in x, using cmp to compare elements. // It panics if x is empty. If there is more than one maximal element // according to the cmp function, MaxFunc returns the first one. +// +//go:fix inline func MaxFunc[S ~[]E, E any](x S, cmp func(a, b E) int) E { - if len(x) < 1 { - panic("slices.MaxFunc: empty list") - } - m := x[0] - for i := 1; i < len(x); i++ { - if cmp(x[i], m) > 0 { - m = x[i] - } - } - return m + return slices.MaxFunc(x, cmp) } // BinarySearch searches for target in a sorted slice and returns the position // where target is found, or the position where target would appear in the // sort order; it also returns a bool saying whether the target is really found // in the slice. The slice must be sorted in increasing order. -func BinarySearch[S ~[]E, E constraints.Ordered](x S, target E) (int, bool) { - // Inlining is faster than calling BinarySearchFunc with a lambda. - n := len(x) - // Define x[-1] < target and x[n] >= target. - // Invariant: x[i-1] < target, x[j] >= target. - i, j := 0, n - for i < j { - h := int(uint(i+j) >> 1) // avoid overflow when computing h - // i ≤ h < j - if cmpLess(x[h], target) { - i = h + 1 // preserves x[i-1] < target - } else { - j = h // preserves x[j] >= target - } - } - // i == j, x[i-1] < target, and x[j] (= x[i]) >= target => answer is i. - return i, i < n && (x[i] == target || (isNaN(x[i]) && isNaN(target))) +// +//go:fix inline +func BinarySearch[S ~[]E, E cmp.Ordered](x S, target E) (int, bool) { + return slices.BinarySearch(x, target) } // BinarySearchFunc works like [BinarySearch], but uses a custom comparison @@ -150,48 +108,8 @@ func BinarySearch[S ~[]E, E constraints.Ordered](x S, target E) (int, bool) { // or a positive number if the slice element follows the target. // cmp must implement the same ordering as the slice, such that if // cmp(a, t) < 0 and cmp(b, t) >= 0, then a must precede b in the slice. +// +//go:fix inline func BinarySearchFunc[S ~[]E, E, T any](x S, target T, cmp func(E, T) int) (int, bool) { - n := len(x) - // Define cmp(x[-1], target) < 0 and cmp(x[n], target) >= 0 . - // Invariant: cmp(x[i - 1], target) < 0, cmp(x[j], target) >= 0. - i, j := 0, n - for i < j { - h := int(uint(i+j) >> 1) // avoid overflow when computing h - // i ≤ h < j - if cmp(x[h], target) < 0 { - i = h + 1 // preserves cmp(x[i - 1], target) < 0 - } else { - j = h // preserves cmp(x[j], target) >= 0 - } - } - // i == j, cmp(x[i-1], target) < 0, and cmp(x[j], target) (= cmp(x[i], target)) >= 0 => answer is i. - return i, i < n && cmp(x[i], target) == 0 -} - -type sortedHint int // hint for pdqsort when choosing the pivot - -const ( - unknownHint sortedHint = iota - increasingHint - decreasingHint -) - -// xorshift paper: https://www.jstatsoft.org/article/view/v008i14/xorshift.pdf -type xorshift uint64 - -func (r *xorshift) Next() uint64 { - *r ^= *r << 13 - *r ^= *r >> 17 - *r ^= *r << 5 - return uint64(*r) -} - -func nextPowerOfTwo(length int) uint { - return 1 << bits.Len(uint(length)) -} - -// isNaN reports whether x is a NaN without requiring the math package. -// This will always return false if T is not floating-point. -func isNaN[T constraints.Ordered](x T) bool { - return x != x + return slices.BinarySearchFunc(x, target, cmp) } diff --git a/vendor/golang.org/x/exp/slices/zsortanyfunc.go b/vendor/golang.org/x/exp/slices/zsortanyfunc.go deleted file mode 100644 index 06f2c7a248..0000000000 --- a/vendor/golang.org/x/exp/slices/zsortanyfunc.go +++ /dev/null @@ -1,479 +0,0 @@ -// Code generated by gen_sort_variants.go; DO NOT EDIT. - -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package slices - -// insertionSortCmpFunc sorts data[a:b] using insertion sort. -func insertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { - for i := a + 1; i < b; i++ { - for j := i; j > a && (cmp(data[j], data[j-1]) < 0); j-- { - data[j], data[j-1] = data[j-1], data[j] - } - } -} - -// siftDownCmpFunc implements the heap property on data[lo:hi]. -// first is an offset into the array where the root of the heap lies. -func siftDownCmpFunc[E any](data []E, lo, hi, first int, cmp func(a, b E) int) { - root := lo - for { - child := 2*root + 1 - if child >= hi { - break - } - if child+1 < hi && (cmp(data[first+child], data[first+child+1]) < 0) { - child++ - } - if !(cmp(data[first+root], data[first+child]) < 0) { - return - } - data[first+root], data[first+child] = data[first+child], data[first+root] - root = child - } -} - -func heapSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { - first := a - lo := 0 - hi := b - a - - // Build heap with greatest element at top. - for i := (hi - 1) / 2; i >= 0; i-- { - siftDownCmpFunc(data, i, hi, first, cmp) - } - - // Pop elements, largest first, into end of data. - for i := hi - 1; i >= 0; i-- { - data[first], data[first+i] = data[first+i], data[first] - siftDownCmpFunc(data, lo, i, first, cmp) - } -} - -// pdqsortCmpFunc sorts data[a:b]. -// The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort. -// pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf -// C++ implementation: https://github.com/orlp/pdqsort -// Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/ -// limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort. -func pdqsortCmpFunc[E any](data []E, a, b, limit int, cmp func(a, b E) int) { - const maxInsertion = 12 - - var ( - wasBalanced = true // whether the last partitioning was reasonably balanced - wasPartitioned = true // whether the slice was already partitioned - ) - - for { - length := b - a - - if length <= maxInsertion { - insertionSortCmpFunc(data, a, b, cmp) - return - } - - // Fall back to heapsort if too many bad choices were made. - if limit == 0 { - heapSortCmpFunc(data, a, b, cmp) - return - } - - // If the last partitioning was imbalanced, we need to breaking patterns. - if !wasBalanced { - breakPatternsCmpFunc(data, a, b, cmp) - limit-- - } - - pivot, hint := choosePivotCmpFunc(data, a, b, cmp) - if hint == decreasingHint { - reverseRangeCmpFunc(data, a, b, cmp) - // The chosen pivot was pivot-a elements after the start of the array. - // After reversing it is pivot-a elements before the end of the array. - // The idea came from Rust's implementation. - pivot = (b - 1) - (pivot - a) - hint = increasingHint - } - - // The slice is likely already sorted. - if wasBalanced && wasPartitioned && hint == increasingHint { - if partialInsertionSortCmpFunc(data, a, b, cmp) { - return - } - } - - // Probably the slice contains many duplicate elements, partition the slice into - // elements equal to and elements greater than the pivot. - if a > 0 && !(cmp(data[a-1], data[pivot]) < 0) { - mid := partitionEqualCmpFunc(data, a, b, pivot, cmp) - a = mid - continue - } - - mid, alreadyPartitioned := partitionCmpFunc(data, a, b, pivot, cmp) - wasPartitioned = alreadyPartitioned - - leftLen, rightLen := mid-a, b-mid - balanceThreshold := length / 8 - if leftLen < rightLen { - wasBalanced = leftLen >= balanceThreshold - pdqsortCmpFunc(data, a, mid, limit, cmp) - a = mid + 1 - } else { - wasBalanced = rightLen >= balanceThreshold - pdqsortCmpFunc(data, mid+1, b, limit, cmp) - b = mid - } - } -} - -// partitionCmpFunc does one quicksort partition. -// Let p = data[pivot] -// Moves elements in data[a:b] around, so that data[i]

=p for inewpivot. -// On return, data[newpivot] = p -func partitionCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int, alreadyPartitioned bool) { - data[a], data[pivot] = data[pivot], data[a] - i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned - - for i <= j && (cmp(data[i], data[a]) < 0) { - i++ - } - for i <= j && !(cmp(data[j], data[a]) < 0) { - j-- - } - if i > j { - data[j], data[a] = data[a], data[j] - return j, true - } - data[i], data[j] = data[j], data[i] - i++ - j-- - - for { - for i <= j && (cmp(data[i], data[a]) < 0) { - i++ - } - for i <= j && !(cmp(data[j], data[a]) < 0) { - j-- - } - if i > j { - break - } - data[i], data[j] = data[j], data[i] - i++ - j-- - } - data[j], data[a] = data[a], data[j] - return j, false -} - -// partitionEqualCmpFunc partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot]. -// It assumed that data[a:b] does not contain elements smaller than the data[pivot]. -func partitionEqualCmpFunc[E any](data []E, a, b, pivot int, cmp func(a, b E) int) (newpivot int) { - data[a], data[pivot] = data[pivot], data[a] - i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned - - for { - for i <= j && !(cmp(data[a], data[i]) < 0) { - i++ - } - for i <= j && (cmp(data[a], data[j]) < 0) { - j-- - } - if i > j { - break - } - data[i], data[j] = data[j], data[i] - i++ - j-- - } - return i -} - -// partialInsertionSortCmpFunc partially sorts a slice, returns true if the slice is sorted at the end. -func partialInsertionSortCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) bool { - const ( - maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted - shortestShifting = 50 // don't shift any elements on short arrays - ) - i := a + 1 - for j := 0; j < maxSteps; j++ { - for i < b && !(cmp(data[i], data[i-1]) < 0) { - i++ - } - - if i == b { - return true - } - - if b-a < shortestShifting { - return false - } - - data[i], data[i-1] = data[i-1], data[i] - - // Shift the smaller one to the left. - if i-a >= 2 { - for j := i - 1; j >= 1; j-- { - if !(cmp(data[j], data[j-1]) < 0) { - break - } - data[j], data[j-1] = data[j-1], data[j] - } - } - // Shift the greater one to the right. - if b-i >= 2 { - for j := i + 1; j < b; j++ { - if !(cmp(data[j], data[j-1]) < 0) { - break - } - data[j], data[j-1] = data[j-1], data[j] - } - } - } - return false -} - -// breakPatternsCmpFunc scatters some elements around in an attempt to break some patterns -// that might cause imbalanced partitions in quicksort. -func breakPatternsCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { - length := b - a - if length >= 8 { - random := xorshift(length) - modulus := nextPowerOfTwo(length) - - for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ { - other := int(uint(random.Next()) & (modulus - 1)) - if other >= length { - other -= length - } - data[idx], data[a+other] = data[a+other], data[idx] - } - } -} - -// choosePivotCmpFunc chooses a pivot in data[a:b]. -// -// [0,8): chooses a static pivot. -// [8,shortestNinther): uses the simple median-of-three method. -// [shortestNinther,∞): uses the Tukey ninther method. -func choosePivotCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) (pivot int, hint sortedHint) { - const ( - shortestNinther = 50 - maxSwaps = 4 * 3 - ) - - l := b - a - - var ( - swaps int - i = a + l/4*1 - j = a + l/4*2 - k = a + l/4*3 - ) - - if l >= 8 { - if l >= shortestNinther { - // Tukey ninther method, the idea came from Rust's implementation. - i = medianAdjacentCmpFunc(data, i, &swaps, cmp) - j = medianAdjacentCmpFunc(data, j, &swaps, cmp) - k = medianAdjacentCmpFunc(data, k, &swaps, cmp) - } - // Find the median among i, j, k and stores it into j. - j = medianCmpFunc(data, i, j, k, &swaps, cmp) - } - - switch swaps { - case 0: - return j, increasingHint - case maxSwaps: - return j, decreasingHint - default: - return j, unknownHint - } -} - -// order2CmpFunc returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a. -func order2CmpFunc[E any](data []E, a, b int, swaps *int, cmp func(a, b E) int) (int, int) { - if cmp(data[b], data[a]) < 0 { - *swaps++ - return b, a - } - return a, b -} - -// medianCmpFunc returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c. -func medianCmpFunc[E any](data []E, a, b, c int, swaps *int, cmp func(a, b E) int) int { - a, b = order2CmpFunc(data, a, b, swaps, cmp) - b, c = order2CmpFunc(data, b, c, swaps, cmp) - a, b = order2CmpFunc(data, a, b, swaps, cmp) - return b -} - -// medianAdjacentCmpFunc finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a. -func medianAdjacentCmpFunc[E any](data []E, a int, swaps *int, cmp func(a, b E) int) int { - return medianCmpFunc(data, a-1, a, a+1, swaps, cmp) -} - -func reverseRangeCmpFunc[E any](data []E, a, b int, cmp func(a, b E) int) { - i := a - j := b - 1 - for i < j { - data[i], data[j] = data[j], data[i] - i++ - j-- - } -} - -func swapRangeCmpFunc[E any](data []E, a, b, n int, cmp func(a, b E) int) { - for i := 0; i < n; i++ { - data[a+i], data[b+i] = data[b+i], data[a+i] - } -} - -func stableCmpFunc[E any](data []E, n int, cmp func(a, b E) int) { - blockSize := 20 // must be > 0 - a, b := 0, blockSize - for b <= n { - insertionSortCmpFunc(data, a, b, cmp) - a = b - b += blockSize - } - insertionSortCmpFunc(data, a, n, cmp) - - for blockSize < n { - a, b = 0, 2*blockSize - for b <= n { - symMergeCmpFunc(data, a, a+blockSize, b, cmp) - a = b - b += 2 * blockSize - } - if m := a + blockSize; m < n { - symMergeCmpFunc(data, a, m, n, cmp) - } - blockSize *= 2 - } -} - -// symMergeCmpFunc merges the two sorted subsequences data[a:m] and data[m:b] using -// the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum -// Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz -// Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in -// Computer Science, pages 714-723. Springer, 2004. -// -// Let M = m-a and N = b-n. Wolog M < N. -// The recursion depth is bound by ceil(log(N+M)). -// The algorithm needs O(M*log(N/M + 1)) calls to data.Less. -// The algorithm needs O((M+N)*log(M)) calls to data.Swap. -// -// The paper gives O((M+N)*log(M)) as the number of assignments assuming a -// rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation -// in the paper carries through for Swap operations, especially as the block -// swapping rotate uses only O(M+N) Swaps. -// -// symMerge assumes non-degenerate arguments: a < m && m < b. -// Having the caller check this condition eliminates many leaf recursion calls, -// which improves performance. -func symMergeCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) { - // Avoid unnecessary recursions of symMerge - // by direct insertion of data[a] into data[m:b] - // if data[a:m] only contains one element. - if m-a == 1 { - // Use binary search to find the lowest index i - // such that data[i] >= data[a] for m <= i < b. - // Exit the search loop with i == b in case no such index exists. - i := m - j := b - for i < j { - h := int(uint(i+j) >> 1) - if cmp(data[h], data[a]) < 0 { - i = h + 1 - } else { - j = h - } - } - // Swap values until data[a] reaches the position before i. - for k := a; k < i-1; k++ { - data[k], data[k+1] = data[k+1], data[k] - } - return - } - - // Avoid unnecessary recursions of symMerge - // by direct insertion of data[m] into data[a:m] - // if data[m:b] only contains one element. - if b-m == 1 { - // Use binary search to find the lowest index i - // such that data[i] > data[m] for a <= i < m. - // Exit the search loop with i == m in case no such index exists. - i := a - j := m - for i < j { - h := int(uint(i+j) >> 1) - if !(cmp(data[m], data[h]) < 0) { - i = h + 1 - } else { - j = h - } - } - // Swap values until data[m] reaches the position i. - for k := m; k > i; k-- { - data[k], data[k-1] = data[k-1], data[k] - } - return - } - - mid := int(uint(a+b) >> 1) - n := mid + m - var start, r int - if m > mid { - start = n - b - r = mid - } else { - start = a - r = m - } - p := n - 1 - - for start < r { - c := int(uint(start+r) >> 1) - if !(cmp(data[p-c], data[c]) < 0) { - start = c + 1 - } else { - r = c - } - } - - end := n - start - if start < m && m < end { - rotateCmpFunc(data, start, m, end, cmp) - } - if a < start && start < mid { - symMergeCmpFunc(data, a, start, mid, cmp) - } - if mid < end && end < b { - symMergeCmpFunc(data, mid, end, b, cmp) - } -} - -// rotateCmpFunc rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data: -// Data of the form 'x u v y' is changed to 'x v u y'. -// rotate performs at most b-a many calls to data.Swap, -// and it assumes non-degenerate arguments: a < m && m < b. -func rotateCmpFunc[E any](data []E, a, m, b int, cmp func(a, b E) int) { - i := m - a - j := b - m - - for i != j { - if i > j { - swapRangeCmpFunc(data, m-i, m, j, cmp) - i -= j - } else { - swapRangeCmpFunc(data, m-i, m+j-i, i, cmp) - j -= i - } - } - // i == j - swapRangeCmpFunc(data, m-i, m, i, cmp) -} diff --git a/vendor/golang.org/x/exp/slices/zsortordered.go b/vendor/golang.org/x/exp/slices/zsortordered.go deleted file mode 100644 index 99b47c3986..0000000000 --- a/vendor/golang.org/x/exp/slices/zsortordered.go +++ /dev/null @@ -1,481 +0,0 @@ -// Code generated by gen_sort_variants.go; DO NOT EDIT. - -// Copyright 2022 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package slices - -import "golang.org/x/exp/constraints" - -// insertionSortOrdered sorts data[a:b] using insertion sort. -func insertionSortOrdered[E constraints.Ordered](data []E, a, b int) { - for i := a + 1; i < b; i++ { - for j := i; j > a && cmpLess(data[j], data[j-1]); j-- { - data[j], data[j-1] = data[j-1], data[j] - } - } -} - -// siftDownOrdered implements the heap property on data[lo:hi]. -// first is an offset into the array where the root of the heap lies. -func siftDownOrdered[E constraints.Ordered](data []E, lo, hi, first int) { - root := lo - for { - child := 2*root + 1 - if child >= hi { - break - } - if child+1 < hi && cmpLess(data[first+child], data[first+child+1]) { - child++ - } - if !cmpLess(data[first+root], data[first+child]) { - return - } - data[first+root], data[first+child] = data[first+child], data[first+root] - root = child - } -} - -func heapSortOrdered[E constraints.Ordered](data []E, a, b int) { - first := a - lo := 0 - hi := b - a - - // Build heap with greatest element at top. - for i := (hi - 1) / 2; i >= 0; i-- { - siftDownOrdered(data, i, hi, first) - } - - // Pop elements, largest first, into end of data. - for i := hi - 1; i >= 0; i-- { - data[first], data[first+i] = data[first+i], data[first] - siftDownOrdered(data, lo, i, first) - } -} - -// pdqsortOrdered sorts data[a:b]. -// The algorithm based on pattern-defeating quicksort(pdqsort), but without the optimizations from BlockQuicksort. -// pdqsort paper: https://arxiv.org/pdf/2106.05123.pdf -// C++ implementation: https://github.com/orlp/pdqsort -// Rust implementation: https://docs.rs/pdqsort/latest/pdqsort/ -// limit is the number of allowed bad (very unbalanced) pivots before falling back to heapsort. -func pdqsortOrdered[E constraints.Ordered](data []E, a, b, limit int) { - const maxInsertion = 12 - - var ( - wasBalanced = true // whether the last partitioning was reasonably balanced - wasPartitioned = true // whether the slice was already partitioned - ) - - for { - length := b - a - - if length <= maxInsertion { - insertionSortOrdered(data, a, b) - return - } - - // Fall back to heapsort if too many bad choices were made. - if limit == 0 { - heapSortOrdered(data, a, b) - return - } - - // If the last partitioning was imbalanced, we need to breaking patterns. - if !wasBalanced { - breakPatternsOrdered(data, a, b) - limit-- - } - - pivot, hint := choosePivotOrdered(data, a, b) - if hint == decreasingHint { - reverseRangeOrdered(data, a, b) - // The chosen pivot was pivot-a elements after the start of the array. - // After reversing it is pivot-a elements before the end of the array. - // The idea came from Rust's implementation. - pivot = (b - 1) - (pivot - a) - hint = increasingHint - } - - // The slice is likely already sorted. - if wasBalanced && wasPartitioned && hint == increasingHint { - if partialInsertionSortOrdered(data, a, b) { - return - } - } - - // Probably the slice contains many duplicate elements, partition the slice into - // elements equal to and elements greater than the pivot. - if a > 0 && !cmpLess(data[a-1], data[pivot]) { - mid := partitionEqualOrdered(data, a, b, pivot) - a = mid - continue - } - - mid, alreadyPartitioned := partitionOrdered(data, a, b, pivot) - wasPartitioned = alreadyPartitioned - - leftLen, rightLen := mid-a, b-mid - balanceThreshold := length / 8 - if leftLen < rightLen { - wasBalanced = leftLen >= balanceThreshold - pdqsortOrdered(data, a, mid, limit) - a = mid + 1 - } else { - wasBalanced = rightLen >= balanceThreshold - pdqsortOrdered(data, mid+1, b, limit) - b = mid - } - } -} - -// partitionOrdered does one quicksort partition. -// Let p = data[pivot] -// Moves elements in data[a:b] around, so that data[i]

=p for inewpivot. -// On return, data[newpivot] = p -func partitionOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int, alreadyPartitioned bool) { - data[a], data[pivot] = data[pivot], data[a] - i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned - - for i <= j && cmpLess(data[i], data[a]) { - i++ - } - for i <= j && !cmpLess(data[j], data[a]) { - j-- - } - if i > j { - data[j], data[a] = data[a], data[j] - return j, true - } - data[i], data[j] = data[j], data[i] - i++ - j-- - - for { - for i <= j && cmpLess(data[i], data[a]) { - i++ - } - for i <= j && !cmpLess(data[j], data[a]) { - j-- - } - if i > j { - break - } - data[i], data[j] = data[j], data[i] - i++ - j-- - } - data[j], data[a] = data[a], data[j] - return j, false -} - -// partitionEqualOrdered partitions data[a:b] into elements equal to data[pivot] followed by elements greater than data[pivot]. -// It assumed that data[a:b] does not contain elements smaller than the data[pivot]. -func partitionEqualOrdered[E constraints.Ordered](data []E, a, b, pivot int) (newpivot int) { - data[a], data[pivot] = data[pivot], data[a] - i, j := a+1, b-1 // i and j are inclusive of the elements remaining to be partitioned - - for { - for i <= j && !cmpLess(data[a], data[i]) { - i++ - } - for i <= j && cmpLess(data[a], data[j]) { - j-- - } - if i > j { - break - } - data[i], data[j] = data[j], data[i] - i++ - j-- - } - return i -} - -// partialInsertionSortOrdered partially sorts a slice, returns true if the slice is sorted at the end. -func partialInsertionSortOrdered[E constraints.Ordered](data []E, a, b int) bool { - const ( - maxSteps = 5 // maximum number of adjacent out-of-order pairs that will get shifted - shortestShifting = 50 // don't shift any elements on short arrays - ) - i := a + 1 - for j := 0; j < maxSteps; j++ { - for i < b && !cmpLess(data[i], data[i-1]) { - i++ - } - - if i == b { - return true - } - - if b-a < shortestShifting { - return false - } - - data[i], data[i-1] = data[i-1], data[i] - - // Shift the smaller one to the left. - if i-a >= 2 { - for j := i - 1; j >= 1; j-- { - if !cmpLess(data[j], data[j-1]) { - break - } - data[j], data[j-1] = data[j-1], data[j] - } - } - // Shift the greater one to the right. - if b-i >= 2 { - for j := i + 1; j < b; j++ { - if !cmpLess(data[j], data[j-1]) { - break - } - data[j], data[j-1] = data[j-1], data[j] - } - } - } - return false -} - -// breakPatternsOrdered scatters some elements around in an attempt to break some patterns -// that might cause imbalanced partitions in quicksort. -func breakPatternsOrdered[E constraints.Ordered](data []E, a, b int) { - length := b - a - if length >= 8 { - random := xorshift(length) - modulus := nextPowerOfTwo(length) - - for idx := a + (length/4)*2 - 1; idx <= a+(length/4)*2+1; idx++ { - other := int(uint(random.Next()) & (modulus - 1)) - if other >= length { - other -= length - } - data[idx], data[a+other] = data[a+other], data[idx] - } - } -} - -// choosePivotOrdered chooses a pivot in data[a:b]. -// -// [0,8): chooses a static pivot. -// [8,shortestNinther): uses the simple median-of-three method. -// [shortestNinther,∞): uses the Tukey ninther method. -func choosePivotOrdered[E constraints.Ordered](data []E, a, b int) (pivot int, hint sortedHint) { - const ( - shortestNinther = 50 - maxSwaps = 4 * 3 - ) - - l := b - a - - var ( - swaps int - i = a + l/4*1 - j = a + l/4*2 - k = a + l/4*3 - ) - - if l >= 8 { - if l >= shortestNinther { - // Tukey ninther method, the idea came from Rust's implementation. - i = medianAdjacentOrdered(data, i, &swaps) - j = medianAdjacentOrdered(data, j, &swaps) - k = medianAdjacentOrdered(data, k, &swaps) - } - // Find the median among i, j, k and stores it into j. - j = medianOrdered(data, i, j, k, &swaps) - } - - switch swaps { - case 0: - return j, increasingHint - case maxSwaps: - return j, decreasingHint - default: - return j, unknownHint - } -} - -// order2Ordered returns x,y where data[x] <= data[y], where x,y=a,b or x,y=b,a. -func order2Ordered[E constraints.Ordered](data []E, a, b int, swaps *int) (int, int) { - if cmpLess(data[b], data[a]) { - *swaps++ - return b, a - } - return a, b -} - -// medianOrdered returns x where data[x] is the median of data[a],data[b],data[c], where x is a, b, or c. -func medianOrdered[E constraints.Ordered](data []E, a, b, c int, swaps *int) int { - a, b = order2Ordered(data, a, b, swaps) - b, c = order2Ordered(data, b, c, swaps) - a, b = order2Ordered(data, a, b, swaps) - return b -} - -// medianAdjacentOrdered finds the median of data[a - 1], data[a], data[a + 1] and stores the index into a. -func medianAdjacentOrdered[E constraints.Ordered](data []E, a int, swaps *int) int { - return medianOrdered(data, a-1, a, a+1, swaps) -} - -func reverseRangeOrdered[E constraints.Ordered](data []E, a, b int) { - i := a - j := b - 1 - for i < j { - data[i], data[j] = data[j], data[i] - i++ - j-- - } -} - -func swapRangeOrdered[E constraints.Ordered](data []E, a, b, n int) { - for i := 0; i < n; i++ { - data[a+i], data[b+i] = data[b+i], data[a+i] - } -} - -func stableOrdered[E constraints.Ordered](data []E, n int) { - blockSize := 20 // must be > 0 - a, b := 0, blockSize - for b <= n { - insertionSortOrdered(data, a, b) - a = b - b += blockSize - } - insertionSortOrdered(data, a, n) - - for blockSize < n { - a, b = 0, 2*blockSize - for b <= n { - symMergeOrdered(data, a, a+blockSize, b) - a = b - b += 2 * blockSize - } - if m := a + blockSize; m < n { - symMergeOrdered(data, a, m, n) - } - blockSize *= 2 - } -} - -// symMergeOrdered merges the two sorted subsequences data[a:m] and data[m:b] using -// the SymMerge algorithm from Pok-Son Kim and Arne Kutzner, "Stable Minimum -// Storage Merging by Symmetric Comparisons", in Susanne Albers and Tomasz -// Radzik, editors, Algorithms - ESA 2004, volume 3221 of Lecture Notes in -// Computer Science, pages 714-723. Springer, 2004. -// -// Let M = m-a and N = b-n. Wolog M < N. -// The recursion depth is bound by ceil(log(N+M)). -// The algorithm needs O(M*log(N/M + 1)) calls to data.Less. -// The algorithm needs O((M+N)*log(M)) calls to data.Swap. -// -// The paper gives O((M+N)*log(M)) as the number of assignments assuming a -// rotation algorithm which uses O(M+N+gcd(M+N)) assignments. The argumentation -// in the paper carries through for Swap operations, especially as the block -// swapping rotate uses only O(M+N) Swaps. -// -// symMerge assumes non-degenerate arguments: a < m && m < b. -// Having the caller check this condition eliminates many leaf recursion calls, -// which improves performance. -func symMergeOrdered[E constraints.Ordered](data []E, a, m, b int) { - // Avoid unnecessary recursions of symMerge - // by direct insertion of data[a] into data[m:b] - // if data[a:m] only contains one element. - if m-a == 1 { - // Use binary search to find the lowest index i - // such that data[i] >= data[a] for m <= i < b. - // Exit the search loop with i == b in case no such index exists. - i := m - j := b - for i < j { - h := int(uint(i+j) >> 1) - if cmpLess(data[h], data[a]) { - i = h + 1 - } else { - j = h - } - } - // Swap values until data[a] reaches the position before i. - for k := a; k < i-1; k++ { - data[k], data[k+1] = data[k+1], data[k] - } - return - } - - // Avoid unnecessary recursions of symMerge - // by direct insertion of data[m] into data[a:m] - // if data[m:b] only contains one element. - if b-m == 1 { - // Use binary search to find the lowest index i - // such that data[i] > data[m] for a <= i < m. - // Exit the search loop with i == m in case no such index exists. - i := a - j := m - for i < j { - h := int(uint(i+j) >> 1) - if !cmpLess(data[m], data[h]) { - i = h + 1 - } else { - j = h - } - } - // Swap values until data[m] reaches the position i. - for k := m; k > i; k-- { - data[k], data[k-1] = data[k-1], data[k] - } - return - } - - mid := int(uint(a+b) >> 1) - n := mid + m - var start, r int - if m > mid { - start = n - b - r = mid - } else { - start = a - r = m - } - p := n - 1 - - for start < r { - c := int(uint(start+r) >> 1) - if !cmpLess(data[p-c], data[c]) { - start = c + 1 - } else { - r = c - } - } - - end := n - start - if start < m && m < end { - rotateOrdered(data, start, m, end) - } - if a < start && start < mid { - symMergeOrdered(data, a, start, mid) - } - if mid < end && end < b { - symMergeOrdered(data, mid, end, b) - } -} - -// rotateOrdered rotates two consecutive blocks u = data[a:m] and v = data[m:b] in data: -// Data of the form 'x u v y' is changed to 'x v u y'. -// rotate performs at most b-a many calls to data.Swap, -// and it assumes non-degenerate arguments: a < m && m < b. -func rotateOrdered[E constraints.Ordered](data []E, a, m, b int) { - i := m - a - j := b - m - - for i != j { - if i > j { - swapRangeOrdered(data, m-i, m, j) - i -= j - } else { - swapRangeOrdered(data, m-i, m+j-i, i) - j -= i - } - } - // i == j - swapRangeOrdered(data, m-i, m, i) -} diff --git a/vendor/golang.org/x/net/context/context.go b/vendor/golang.org/x/net/context/context.go deleted file mode 100644 index 24cea68820..0000000000 --- a/vendor/golang.org/x/net/context/context.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package context has been superseded by the standard library [context] package. -// -// Deprecated: Use the standard library context package instead. -package context - -import ( - "context" // standard library's context, as of Go 1.7 - "time" -) - -// A Context carries a deadline, a cancellation signal, and other values across -// API boundaries. -// -// Context's methods may be called by multiple goroutines simultaneously. -// -//go:fix inline -type Context = context.Context - -// Canceled is the error returned by [Context.Err] when the context is canceled -// for some reason other than its deadline passing. -// -//go:fix inline -var Canceled = context.Canceled - -// DeadlineExceeded is the error returned by [Context.Err] when the context is canceled -// due to its deadline passing. -// -//go:fix inline -var DeadlineExceeded = context.DeadlineExceeded - -// Background returns a non-nil, empty Context. It is never canceled, has no -// values, and has no deadline. It is typically used by the main function, -// initialization, and tests, and as the top-level Context for incoming -// requests. -// -//go:fix inline -func Background() Context { return context.Background() } - -// TODO returns a non-nil, empty Context. Code should use context.TODO when -// it's unclear which Context to use or it is not yet available (because the -// surrounding function has not yet been extended to accept a Context -// parameter). -// -//go:fix inline -func TODO() Context { return context.TODO() } - -// A CancelFunc tells an operation to abandon its work. -// A CancelFunc does not wait for the work to stop. -// A CancelFunc may be called by multiple goroutines simultaneously. -// After the first call, subsequent calls to a CancelFunc do nothing. -type CancelFunc = context.CancelFunc - -// WithCancel returns a derived context that points to the parent context -// but has a new Done channel. The returned context's Done channel is closed -// when the returned cancel function is called or when the parent context's -// Done channel is closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this [Context] complete. -// -//go:fix inline -func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { - return context.WithCancel(parent) -} - -// WithDeadline returns a derived context that points to the parent context -// but has the deadline adjusted to be no later than d. If the parent's -// deadline is already earlier than d, WithDeadline(parent, d) is semantically -// equivalent to parent. The returned [Context.Done] channel is closed when -// the deadline expires, when the returned cancel function is called, -// or when the parent context's Done channel is closed, whichever happens first. -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this [Context] complete. -// -//go:fix inline -func WithDeadline(parent Context, d time.Time) (Context, CancelFunc) { - return context.WithDeadline(parent, d) -} - -// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)). -// -// Canceling this context releases resources associated with it, so code should -// call cancel as soon as the operations running in this [Context] complete: -// -// func slowOperationWithTimeout(ctx context.Context) (Result, error) { -// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond) -// defer cancel() // releases resources if slowOperation completes before timeout elapses -// return slowOperation(ctx) -// } -// -//go:fix inline -func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { - return context.WithTimeout(parent, timeout) -} - -// WithValue returns a derived context that points to the parent Context. -// In the derived context, the value associated with key is val. -// -// Use context Values only for request-scoped data that transits processes and -// APIs, not for passing optional parameters to functions. -// -// The provided key must be comparable and should not be of type -// string or any other built-in type to avoid collisions between -// packages using context. Users of WithValue should define their own -// types for keys. To avoid allocating when assigning to an -// interface{}, context keys often have concrete type -// struct{}. Alternatively, exported context key variables' static -// type should be a pointer or interface. -// -//go:fix inline -func WithValue(parent Context, key, val interface{}) Context { - return context.WithValue(parent, key, val) -} diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go index ec5f0cdd0c..563270c154 100644 --- a/vendor/golang.org/x/time/rate/rate.go +++ b/vendor/golang.org/x/time/rate/rate.go @@ -85,7 +85,7 @@ func (lim *Limiter) Burst() int { // TokensAt returns the number of tokens available at time t. func (lim *Limiter) TokensAt(t time.Time) float64 { lim.mu.Lock() - _, tokens := lim.advance(t) // does not mutate lim + tokens := lim.advance(t) // does not mutate lim lim.mu.Unlock() return tokens } @@ -186,7 +186,7 @@ func (r *Reservation) CancelAt(t time.Time) { return } // advance time to now - t, tokens := r.lim.advance(t) + tokens := r.lim.advance(t) // calculate new number of tokens tokens += restoreTokens if burst := float64(r.lim.burst); tokens > burst { @@ -195,7 +195,7 @@ func (r *Reservation) CancelAt(t time.Time) { // update state r.lim.last = t r.lim.tokens = tokens - if r.timeToAct == r.lim.lastEvent { + if r.timeToAct.Equal(r.lim.lastEvent) { prevEvent := r.timeToAct.Add(r.limit.durationFromTokens(float64(-r.tokens))) if !prevEvent.Before(t) { r.lim.lastEvent = prevEvent @@ -307,7 +307,7 @@ func (lim *Limiter) SetLimitAt(t time.Time, newLimit Limit) { lim.mu.Lock() defer lim.mu.Unlock() - t, tokens := lim.advance(t) + tokens := lim.advance(t) lim.last = t lim.tokens = tokens @@ -324,7 +324,7 @@ func (lim *Limiter) SetBurstAt(t time.Time, newBurst int) { lim.mu.Lock() defer lim.mu.Unlock() - t, tokens := lim.advance(t) + tokens := lim.advance(t) lim.last = t lim.tokens = tokens @@ -347,7 +347,7 @@ func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration) } } - t, tokens := lim.advance(t) + tokens := lim.advance(t) // Calculate the remaining number of tokens resulting from the request. tokens -= float64(n) @@ -380,10 +380,11 @@ func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration) return r } -// advance calculates and returns an updated state for lim resulting from the passage of time. +// advance calculates and returns an updated number of tokens for lim +// resulting from the passage of time. // lim is not changed. // advance requires that lim.mu is held. -func (lim *Limiter) advance(t time.Time) (newT time.Time, newTokens float64) { +func (lim *Limiter) advance(t time.Time) (newTokens float64) { last := lim.last if t.Before(last) { last = t @@ -396,7 +397,7 @@ func (lim *Limiter) advance(t time.Time) (newT time.Time, newTokens float64) { if burst := float64(lim.burst); tokens > burst { tokens = burst } - return t, tokens + return tokens } // durationFromTokens is a unit conversion function from the number of tokens to the duration diff --git a/vendor/golang.org/x/time/rate/sometimes.go b/vendor/golang.org/x/time/rate/sometimes.go index 6ba99ddb67..9b83932692 100644 --- a/vendor/golang.org/x/time/rate/sometimes.go +++ b/vendor/golang.org/x/time/rate/sometimes.go @@ -61,7 +61,9 @@ func (s *Sometimes) Do(f func()) { (s.Every > 0 && s.count%s.Every == 0) || (s.Interval > 0 && time.Since(s.last) >= s.Interval) { f() - s.last = time.Now() + if s.Interval > 0 { + s.last = time.Now() + } } s.count++ } diff --git a/vendor/google.golang.org/grpc/reflection/README.md b/vendor/google.golang.org/grpc/reflection/README.md new file mode 100644 index 0000000000..9ace83ccb6 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/README.md @@ -0,0 +1,18 @@ +# Reflection + +Package reflection implements server reflection service. + +The service implemented is defined in: https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1/reflection.proto. + +To register server reflection on a gRPC server: +```go +import "google.golang.org/grpc/reflection" + +s := grpc.NewServer() +pb.RegisterYourOwnServer(s, &server{}) + +// Register reflection service on gRPC server. +reflection.Register(s) + +s.Serve(lis) +``` diff --git a/vendor/google.golang.org/grpc/reflection/adapt.go b/vendor/google.golang.org/grpc/reflection/adapt.go new file mode 100644 index 0000000000..6997e47403 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/adapt.go @@ -0,0 +1,57 @@ +/* + * + * Copyright 2023 gRPC 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. + * + */ + +package reflection + +import ( + "google.golang.org/grpc/reflection/internal" + + v1reflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1" + v1reflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1" + v1alphareflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" +) + +// asV1Alpha returns an implementation of the v1alpha version of the reflection +// interface that delegates all calls to the given v1 version. +func asV1Alpha(svr v1reflectiongrpc.ServerReflectionServer) v1alphareflectiongrpc.ServerReflectionServer { + return v1AlphaServerImpl{svr: svr} +} + +type v1AlphaServerImpl struct { + svr v1reflectiongrpc.ServerReflectionServer +} + +func (s v1AlphaServerImpl) ServerReflectionInfo(stream v1alphareflectiongrpc.ServerReflection_ServerReflectionInfoServer) error { + return s.svr.ServerReflectionInfo(v1AlphaServerStreamAdapter{stream}) +} + +type v1AlphaServerStreamAdapter struct { + v1alphareflectiongrpc.ServerReflection_ServerReflectionInfoServer +} + +func (s v1AlphaServerStreamAdapter) Send(response *v1reflectionpb.ServerReflectionResponse) error { + return s.ServerReflection_ServerReflectionInfoServer.Send(internal.V1ToV1AlphaResponse(response)) +} + +func (s v1AlphaServerStreamAdapter) Recv() (*v1reflectionpb.ServerReflectionRequest, error) { + resp, err := s.ServerReflection_ServerReflectionInfoServer.Recv() + if err != nil { + return nil, err + } + return internal.V1AlphaToV1Request(resp), nil +} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go new file mode 100644 index 0000000000..92fdc3afab --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection.pb.go @@ -0,0 +1,777 @@ +// Copyright 2016 The gRPC 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. + +// Service exported by server reflection. A more complete description of how +// server reflection works can be found at +// https://github.com/grpc/grpc/blob/master/doc/server-reflection.md +// +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v5.27.1 +// source: grpc/reflection/v1/reflection.proto + +package grpc_reflection_v1 + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The message sent by the client when calling ServerReflectionInfo method. +type ServerReflectionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + // To use reflection service, the client should set one of the following + // fields in message_request. The server distinguishes requests by their + // defined field and then handles them using corresponding methods. + // + // Types that are valid to be assigned to MessageRequest: + // + // *ServerReflectionRequest_FileByFilename + // *ServerReflectionRequest_FileContainingSymbol + // *ServerReflectionRequest_FileContainingExtension + // *ServerReflectionRequest_AllExtensionNumbersOfType + // *ServerReflectionRequest_ListServices + MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerReflectionRequest) Reset() { + *x = ServerReflectionRequest{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerReflectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerReflectionRequest) ProtoMessage() {} + +func (x *ServerReflectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerReflectionRequest.ProtoReflect.Descriptor instead. +func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{0} +} + +func (x *ServerReflectionRequest) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *ServerReflectionRequest) GetMessageRequest() isServerReflectionRequest_MessageRequest { + if x != nil { + return x.MessageRequest + } + return nil +} + +func (x *ServerReflectionRequest) GetFileByFilename() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileByFilename); ok { + return x.FileByFilename + } + } + return "" +} + +func (x *ServerReflectionRequest) GetFileContainingSymbol() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingSymbol); ok { + return x.FileContainingSymbol + } + } + return "" +} + +func (x *ServerReflectionRequest) GetFileContainingExtension() *ExtensionRequest { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingExtension); ok { + return x.FileContainingExtension + } + } + return nil +} + +func (x *ServerReflectionRequest) GetAllExtensionNumbersOfType() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_AllExtensionNumbersOfType); ok { + return x.AllExtensionNumbersOfType + } + } + return "" +} + +func (x *ServerReflectionRequest) GetListServices() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_ListServices); ok { + return x.ListServices + } + } + return "" +} + +type isServerReflectionRequest_MessageRequest interface { + isServerReflectionRequest_MessageRequest() +} + +type ServerReflectionRequest_FileByFilename struct { + // Find a proto file by the file name. + FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"` +} + +type ServerReflectionRequest_FileContainingSymbol struct { + // Find the proto file that declares the given fully-qualified symbol name. + // This field should be a fully-qualified symbol name + // (e.g. .[.] or .). + FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"` +} + +type ServerReflectionRequest_FileContainingExtension struct { + // Find the proto file which defines an extension extending the given + // message type with the given field number. + FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"` +} + +type ServerReflectionRequest_AllExtensionNumbersOfType struct { + // Finds the tag numbers used by all known extensions of the given message + // type, and appends them to ExtensionNumberResponse in an undefined order. + // Its corresponding method is best-effort: it's not guaranteed that the + // reflection service will implement this method, and it's not guaranteed + // that this method will provide all extensions. Returns + // StatusCode::UNIMPLEMENTED if it's not implemented. + // This field should be a fully-qualified type name. The format is + // . + AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"` +} + +type ServerReflectionRequest_ListServices struct { + // List the full names of registered services. The content will not be + // checked. + ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,proto3,oneof"` +} + +func (*ServerReflectionRequest_FileByFilename) isServerReflectionRequest_MessageRequest() {} + +func (*ServerReflectionRequest_FileContainingSymbol) isServerReflectionRequest_MessageRequest() {} + +func (*ServerReflectionRequest_FileContainingExtension) isServerReflectionRequest_MessageRequest() {} + +func (*ServerReflectionRequest_AllExtensionNumbersOfType) isServerReflectionRequest_MessageRequest() { +} + +func (*ServerReflectionRequest_ListServices) isServerReflectionRequest_MessageRequest() {} + +// The type name and extension number sent by the client when requesting +// file_containing_extension. +type ExtensionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Fully-qualified type name. The format should be . + ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType,proto3" json:"containing_type,omitempty"` + ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtensionRequest) Reset() { + *x = ExtensionRequest{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtensionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtensionRequest) ProtoMessage() {} + +func (x *ExtensionRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtensionRequest.ProtoReflect.Descriptor instead. +func (*ExtensionRequest) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{1} +} + +func (x *ExtensionRequest) GetContainingType() string { + if x != nil { + return x.ContainingType + } + return "" +} + +func (x *ExtensionRequest) GetExtensionNumber() int32 { + if x != nil { + return x.ExtensionNumber + } + return 0 +} + +// The message sent by the server to answer ServerReflectionInfo method. +type ServerReflectionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost,proto3" json:"valid_host,omitempty"` + OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest,proto3" json:"original_request,omitempty"` + // The server sets one of the following fields according to the message_request + // in the request. + // + // Types that are valid to be assigned to MessageResponse: + // + // *ServerReflectionResponse_FileDescriptorResponse + // *ServerReflectionResponse_AllExtensionNumbersResponse + // *ServerReflectionResponse_ListServicesResponse + // *ServerReflectionResponse_ErrorResponse + MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerReflectionResponse) Reset() { + *x = ServerReflectionResponse{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerReflectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerReflectionResponse) ProtoMessage() {} + +func (x *ServerReflectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerReflectionResponse.ProtoReflect.Descriptor instead. +func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{2} +} + +func (x *ServerReflectionResponse) GetValidHost() string { + if x != nil { + return x.ValidHost + } + return "" +} + +func (x *ServerReflectionResponse) GetOriginalRequest() *ServerReflectionRequest { + if x != nil { + return x.OriginalRequest + } + return nil +} + +func (x *ServerReflectionResponse) GetMessageResponse() isServerReflectionResponse_MessageResponse { + if x != nil { + return x.MessageResponse + } + return nil +} + +func (x *ServerReflectionResponse) GetFileDescriptorResponse() *FileDescriptorResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_FileDescriptorResponse); ok { + return x.FileDescriptorResponse + } + } + return nil +} + +func (x *ServerReflectionResponse) GetAllExtensionNumbersResponse() *ExtensionNumberResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_AllExtensionNumbersResponse); ok { + return x.AllExtensionNumbersResponse + } + } + return nil +} + +func (x *ServerReflectionResponse) GetListServicesResponse() *ListServiceResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_ListServicesResponse); ok { + return x.ListServicesResponse + } + } + return nil +} + +func (x *ServerReflectionResponse) GetErrorResponse() *ErrorResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_ErrorResponse); ok { + return x.ErrorResponse + } + } + return nil +} + +type isServerReflectionResponse_MessageResponse interface { + isServerReflectionResponse_MessageResponse() +} + +type ServerReflectionResponse_FileDescriptorResponse struct { + // This message is used to answer file_by_filename, file_containing_symbol, + // file_containing_extension requests with transitive dependencies. + // As the repeated label is not allowed in oneof fields, we use a + // FileDescriptorResponse message to encapsulate the repeated fields. + // The reflection service is allowed to avoid sending FileDescriptorProtos + // that were previously sent in response to earlier requests in the stream. + FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"` +} + +type ServerReflectionResponse_AllExtensionNumbersResponse struct { + // This message is used to answer all_extension_numbers_of_type requests. + AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"` +} + +type ServerReflectionResponse_ListServicesResponse struct { + // This message is used to answer list_services requests. + ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"` +} + +type ServerReflectionResponse_ErrorResponse struct { + // This message is used when an error occurs. + ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,proto3,oneof"` +} + +func (*ServerReflectionResponse_FileDescriptorResponse) isServerReflectionResponse_MessageResponse() { +} + +func (*ServerReflectionResponse_AllExtensionNumbersResponse) isServerReflectionResponse_MessageResponse() { +} + +func (*ServerReflectionResponse_ListServicesResponse) isServerReflectionResponse_MessageResponse() {} + +func (*ServerReflectionResponse_ErrorResponse) isServerReflectionResponse_MessageResponse() {} + +// Serialized FileDescriptorProto messages sent by the server answering +// a file_by_filename, file_containing_symbol, or file_containing_extension +// request. +type FileDescriptorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Serialized FileDescriptorProto messages. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. + FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FileDescriptorResponse) Reset() { + *x = FileDescriptorResponse{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FileDescriptorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileDescriptorResponse) ProtoMessage() {} + +func (x *FileDescriptorResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileDescriptorResponse.ProtoReflect.Descriptor instead. +func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{3} +} + +func (x *FileDescriptorResponse) GetFileDescriptorProto() [][]byte { + if x != nil { + return x.FileDescriptorProto + } + return nil +} + +// A list of extension numbers sent by the server answering +// all_extension_numbers_of_type request. +type ExtensionNumberResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Full name of the base type, including the package name. The format + // is . + BaseTypeName string `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName,proto3" json:"base_type_name,omitempty"` + ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtensionNumberResponse) Reset() { + *x = ExtensionNumberResponse{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtensionNumberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtensionNumberResponse) ProtoMessage() {} + +func (x *ExtensionNumberResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtensionNumberResponse.ProtoReflect.Descriptor instead. +func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{4} +} + +func (x *ExtensionNumberResponse) GetBaseTypeName() string { + if x != nil { + return x.BaseTypeName + } + return "" +} + +func (x *ExtensionNumberResponse) GetExtensionNumber() []int32 { + if x != nil { + return x.ExtensionNumber + } + return nil +} + +// A list of ServiceResponse sent by the server answering list_services request. +type ListServiceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The information of each service may be expanded in the future, so we use + // ServiceResponse message to encapsulate it. + Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListServiceResponse) Reset() { + *x = ListServiceResponse{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListServiceResponse) ProtoMessage() {} + +func (x *ListServiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListServiceResponse.ProtoReflect.Descriptor instead. +func (*ListServiceResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{5} +} + +func (x *ListServiceResponse) GetService() []*ServiceResponse { + if x != nil { + return x.Service + } + return nil +} + +// The information of a single service used by ListServiceResponse to answer +// list_services request. +type ServiceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Full name of a registered service, including its package name. The format + // is . + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServiceResponse) Reset() { + *x = ServiceResponse{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceResponse) ProtoMessage() {} + +func (x *ServiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceResponse.ProtoReflect.Descriptor instead. +func (*ServiceResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{6} +} + +func (x *ServiceResponse) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// The error code and error message sent by the server when an error occurs. +type ErrorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // This field uses the error codes defined in grpc::StatusCode. + ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"` + ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ErrorResponse) Reset() { + *x = ErrorResponse{} + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ErrorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ErrorResponse) ProtoMessage() {} + +func (x *ErrorResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1_reflection_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead. +func (*ErrorResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1_reflection_proto_rawDescGZIP(), []int{7} +} + +func (x *ErrorResponse) GetErrorCode() int32 { + if x != nil { + return x.ErrorCode + } + return 0 +} + +func (x *ErrorResponse) GetErrorMessage() string { + if x != nil { + return x.ErrorMessage + } + return "" +} + +var File_grpc_reflection_v1_reflection_proto protoreflect.FileDescriptor + +const file_grpc_reflection_v1_reflection_proto_rawDesc = "" + + "\n" + + "#grpc/reflection/v1/reflection.proto\x12\x12grpc.reflection.v1\"\xf3\x02\n" + + "\x17ServerReflectionRequest\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12*\n" + + "\x10file_by_filename\x18\x03 \x01(\tH\x00R\x0efileByFilename\x126\n" + + "\x16file_containing_symbol\x18\x04 \x01(\tH\x00R\x14fileContainingSymbol\x12b\n" + + "\x19file_containing_extension\x18\x05 \x01(\v2$.grpc.reflection.v1.ExtensionRequestH\x00R\x17fileContainingExtension\x12B\n" + + "\x1dall_extension_numbers_of_type\x18\x06 \x01(\tH\x00R\x19allExtensionNumbersOfType\x12%\n" + + "\rlist_services\x18\a \x01(\tH\x00R\flistServicesB\x11\n" + + "\x0fmessage_request\"f\n" + + "\x10ExtensionRequest\x12'\n" + + "\x0fcontaining_type\x18\x01 \x01(\tR\x0econtainingType\x12)\n" + + "\x10extension_number\x18\x02 \x01(\x05R\x0fextensionNumber\"\xae\x04\n" + + "\x18ServerReflectionResponse\x12\x1d\n" + + "\n" + + "valid_host\x18\x01 \x01(\tR\tvalidHost\x12V\n" + + "\x10original_request\x18\x02 \x01(\v2+.grpc.reflection.v1.ServerReflectionRequestR\x0foriginalRequest\x12f\n" + + "\x18file_descriptor_response\x18\x04 \x01(\v2*.grpc.reflection.v1.FileDescriptorResponseH\x00R\x16fileDescriptorResponse\x12r\n" + + "\x1eall_extension_numbers_response\x18\x05 \x01(\v2+.grpc.reflection.v1.ExtensionNumberResponseH\x00R\x1ballExtensionNumbersResponse\x12_\n" + + "\x16list_services_response\x18\x06 \x01(\v2'.grpc.reflection.v1.ListServiceResponseH\x00R\x14listServicesResponse\x12J\n" + + "\x0eerror_response\x18\a \x01(\v2!.grpc.reflection.v1.ErrorResponseH\x00R\rerrorResponseB\x12\n" + + "\x10message_response\"L\n" + + "\x16FileDescriptorResponse\x122\n" + + "\x15file_descriptor_proto\x18\x01 \x03(\fR\x13fileDescriptorProto\"j\n" + + "\x17ExtensionNumberResponse\x12$\n" + + "\x0ebase_type_name\x18\x01 \x01(\tR\fbaseTypeName\x12)\n" + + "\x10extension_number\x18\x02 \x03(\x05R\x0fextensionNumber\"T\n" + + "\x13ListServiceResponse\x12=\n" + + "\aservice\x18\x01 \x03(\v2#.grpc.reflection.v1.ServiceResponseR\aservice\"%\n" + + "\x0fServiceResponse\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"S\n" + + "\rErrorResponse\x12\x1d\n" + + "\n" + + "error_code\x18\x01 \x01(\x05R\terrorCode\x12#\n" + + "\rerror_message\x18\x02 \x01(\tR\ferrorMessage2\x89\x01\n" + + "\x10ServerReflection\x12u\n" + + "\x14ServerReflectionInfo\x12+.grpc.reflection.v1.ServerReflectionRequest\x1a,.grpc.reflection.v1.ServerReflectionResponse(\x010\x01Bf\n" + + "\x15io.grpc.reflection.v1B\x15ServerReflectionProtoP\x01Z4google.golang.org/grpc/reflection/grpc_reflection_v1b\x06proto3" + +var ( + file_grpc_reflection_v1_reflection_proto_rawDescOnce sync.Once + file_grpc_reflection_v1_reflection_proto_rawDescData []byte +) + +func file_grpc_reflection_v1_reflection_proto_rawDescGZIP() []byte { + file_grpc_reflection_v1_reflection_proto_rawDescOnce.Do(func() { + file_grpc_reflection_v1_reflection_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1_reflection_proto_rawDesc), len(file_grpc_reflection_v1_reflection_proto_rawDesc))) + }) + return file_grpc_reflection_v1_reflection_proto_rawDescData +} + +var file_grpc_reflection_v1_reflection_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_grpc_reflection_v1_reflection_proto_goTypes = []any{ + (*ServerReflectionRequest)(nil), // 0: grpc.reflection.v1.ServerReflectionRequest + (*ExtensionRequest)(nil), // 1: grpc.reflection.v1.ExtensionRequest + (*ServerReflectionResponse)(nil), // 2: grpc.reflection.v1.ServerReflectionResponse + (*FileDescriptorResponse)(nil), // 3: grpc.reflection.v1.FileDescriptorResponse + (*ExtensionNumberResponse)(nil), // 4: grpc.reflection.v1.ExtensionNumberResponse + (*ListServiceResponse)(nil), // 5: grpc.reflection.v1.ListServiceResponse + (*ServiceResponse)(nil), // 6: grpc.reflection.v1.ServiceResponse + (*ErrorResponse)(nil), // 7: grpc.reflection.v1.ErrorResponse +} +var file_grpc_reflection_v1_reflection_proto_depIdxs = []int32{ + 1, // 0: grpc.reflection.v1.ServerReflectionRequest.file_containing_extension:type_name -> grpc.reflection.v1.ExtensionRequest + 0, // 1: grpc.reflection.v1.ServerReflectionResponse.original_request:type_name -> grpc.reflection.v1.ServerReflectionRequest + 3, // 2: grpc.reflection.v1.ServerReflectionResponse.file_descriptor_response:type_name -> grpc.reflection.v1.FileDescriptorResponse + 4, // 3: grpc.reflection.v1.ServerReflectionResponse.all_extension_numbers_response:type_name -> grpc.reflection.v1.ExtensionNumberResponse + 5, // 4: grpc.reflection.v1.ServerReflectionResponse.list_services_response:type_name -> grpc.reflection.v1.ListServiceResponse + 7, // 5: grpc.reflection.v1.ServerReflectionResponse.error_response:type_name -> grpc.reflection.v1.ErrorResponse + 6, // 6: grpc.reflection.v1.ListServiceResponse.service:type_name -> grpc.reflection.v1.ServiceResponse + 0, // 7: grpc.reflection.v1.ServerReflection.ServerReflectionInfo:input_type -> grpc.reflection.v1.ServerReflectionRequest + 2, // 8: grpc.reflection.v1.ServerReflection.ServerReflectionInfo:output_type -> grpc.reflection.v1.ServerReflectionResponse + 8, // [8:9] is the sub-list for method output_type + 7, // [7:8] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_grpc_reflection_v1_reflection_proto_init() } +func file_grpc_reflection_v1_reflection_proto_init() { + if File_grpc_reflection_v1_reflection_proto != nil { + return + } + file_grpc_reflection_v1_reflection_proto_msgTypes[0].OneofWrappers = []any{ + (*ServerReflectionRequest_FileByFilename)(nil), + (*ServerReflectionRequest_FileContainingSymbol)(nil), + (*ServerReflectionRequest_FileContainingExtension)(nil), + (*ServerReflectionRequest_AllExtensionNumbersOfType)(nil), + (*ServerReflectionRequest_ListServices)(nil), + } + file_grpc_reflection_v1_reflection_proto_msgTypes[2].OneofWrappers = []any{ + (*ServerReflectionResponse_FileDescriptorResponse)(nil), + (*ServerReflectionResponse_AllExtensionNumbersResponse)(nil), + (*ServerReflectionResponse_ListServicesResponse)(nil), + (*ServerReflectionResponse_ErrorResponse)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1_reflection_proto_rawDesc), len(file_grpc_reflection_v1_reflection_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_grpc_reflection_v1_reflection_proto_goTypes, + DependencyIndexes: file_grpc_reflection_v1_reflection_proto_depIdxs, + MessageInfos: file_grpc_reflection_v1_reflection_proto_msgTypes, + }.Build() + File_grpc_reflection_v1_reflection_proto = out.File + file_grpc_reflection_v1_reflection_proto_goTypes = nil + file_grpc_reflection_v1_reflection_proto_depIdxs = nil +} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go new file mode 100644 index 0000000000..93a243631c --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1/reflection_grpc.pb.go @@ -0,0 +1,138 @@ +// Copyright 2016 The gRPC 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. + +// Service exported by server reflection. A more complete description of how +// server reflection works can be found at +// https://github.com/grpc/grpc/blob/master/doc/server-reflection.md +// +// The canonical version of this proto can be found at +// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.0 +// - protoc v5.27.1 +// source: grpc/reflection/v1/reflection.proto + +package grpc_reflection_v1 + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo" +) + +// ServerReflectionClient is the client API for ServerReflection service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ServerReflectionClient interface { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) +} + +type serverReflectionClient struct { + cc grpc.ClientConnInterface +} + +func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClient { + return &serverReflectionClient{cc} +} + +func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse] + +// ServerReflectionServer is the server API for ServerReflection service. +// All implementations should embed UnimplementedServerReflectionServer +// for forward compatibility. +type ServerReflectionServer interface { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error +} + +// UnimplementedServerReflectionServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedServerReflectionServer struct{} + +func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error { + return status.Error(codes.Unimplemented, "method ServerReflectionInfo not implemented") +} +func (UnimplementedServerReflectionServer) testEmbeddedByValue() {} + +// UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ServerReflectionServer will +// result in compilation errors. +type UnsafeServerReflectionServer interface { + mustEmbedUnimplementedServerReflectionServer() +} + +func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) { + // If the following call panics, it indicates UnimplementedServerReflectionServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ServerReflection_ServiceDesc, srv) +} + +func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse] + +// ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ServerReflection_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.reflection.v1.ServerReflection", + HandlerType: (*ServerReflectionServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "ServerReflectionInfo", + Handler: _ServerReflection_ServerReflectionInfo_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "grpc/reflection/v1/reflection.proto", +} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go new file mode 100644 index 0000000000..c803cf3ba1 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection.pb.go @@ -0,0 +1,847 @@ +// Copyright 2016 The gRPC 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. +// Service exported by server reflection + +// Warning: this entire file is deprecated. Use this instead: +// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.10 +// protoc v5.27.1 +// grpc/reflection/v1alpha/reflection.proto is a deprecated file. + +package grpc_reflection_v1alpha + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The message sent by the client when calling ServerReflectionInfo method. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type ServerReflectionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"` + // To use reflection service, the client should set one of the following + // fields in message_request. The server distinguishes requests by their + // defined field and then handles them using corresponding methods. + // + // Types that are valid to be assigned to MessageRequest: + // + // *ServerReflectionRequest_FileByFilename + // *ServerReflectionRequest_FileContainingSymbol + // *ServerReflectionRequest_FileContainingExtension + // *ServerReflectionRequest_AllExtensionNumbersOfType + // *ServerReflectionRequest_ListServices + MessageRequest isServerReflectionRequest_MessageRequest `protobuf_oneof:"message_request"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerReflectionRequest) Reset() { + *x = ServerReflectionRequest{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerReflectionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerReflectionRequest) ProtoMessage() {} + +func (x *ServerReflectionRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerReflectionRequest.ProtoReflect.Descriptor instead. +func (*ServerReflectionRequest) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{0} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionRequest) GetHost() string { + if x != nil { + return x.Host + } + return "" +} + +func (x *ServerReflectionRequest) GetMessageRequest() isServerReflectionRequest_MessageRequest { + if x != nil { + return x.MessageRequest + } + return nil +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionRequest) GetFileByFilename() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileByFilename); ok { + return x.FileByFilename + } + } + return "" +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionRequest) GetFileContainingSymbol() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingSymbol); ok { + return x.FileContainingSymbol + } + } + return "" +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionRequest) GetFileContainingExtension() *ExtensionRequest { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_FileContainingExtension); ok { + return x.FileContainingExtension + } + } + return nil +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionRequest) GetAllExtensionNumbersOfType() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_AllExtensionNumbersOfType); ok { + return x.AllExtensionNumbersOfType + } + } + return "" +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionRequest) GetListServices() string { + if x != nil { + if x, ok := x.MessageRequest.(*ServerReflectionRequest_ListServices); ok { + return x.ListServices + } + } + return "" +} + +type isServerReflectionRequest_MessageRequest interface { + isServerReflectionRequest_MessageRequest() +} + +type ServerReflectionRequest_FileByFilename struct { + // Find a proto file by the file name. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + FileByFilename string `protobuf:"bytes,3,opt,name=file_by_filename,json=fileByFilename,proto3,oneof"` +} + +type ServerReflectionRequest_FileContainingSymbol struct { + // Find the proto file that declares the given fully-qualified symbol name. + // This field should be a fully-qualified symbol name + // (e.g. .[.] or .). + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + FileContainingSymbol string `protobuf:"bytes,4,opt,name=file_containing_symbol,json=fileContainingSymbol,proto3,oneof"` +} + +type ServerReflectionRequest_FileContainingExtension struct { + // Find the proto file which defines an extension extending the given + // message type with the given field number. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + FileContainingExtension *ExtensionRequest `protobuf:"bytes,5,opt,name=file_containing_extension,json=fileContainingExtension,proto3,oneof"` +} + +type ServerReflectionRequest_AllExtensionNumbersOfType struct { + // Finds the tag numbers used by all known extensions of extendee_type, and + // appends them to ExtensionNumberResponse in an undefined order. + // Its corresponding method is best-effort: it's not guaranteed that the + // reflection service will implement this method, and it's not guaranteed + // that this method will provide all extensions. Returns + // StatusCode::UNIMPLEMENTED if it's not implemented. + // This field should be a fully-qualified type name. The format is + // . + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + AllExtensionNumbersOfType string `protobuf:"bytes,6,opt,name=all_extension_numbers_of_type,json=allExtensionNumbersOfType,proto3,oneof"` +} + +type ServerReflectionRequest_ListServices struct { + // List the full names of registered services. The content will not be + // checked. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ListServices string `protobuf:"bytes,7,opt,name=list_services,json=listServices,proto3,oneof"` +} + +func (*ServerReflectionRequest_FileByFilename) isServerReflectionRequest_MessageRequest() {} + +func (*ServerReflectionRequest_FileContainingSymbol) isServerReflectionRequest_MessageRequest() {} + +func (*ServerReflectionRequest_FileContainingExtension) isServerReflectionRequest_MessageRequest() {} + +func (*ServerReflectionRequest_AllExtensionNumbersOfType) isServerReflectionRequest_MessageRequest() { +} + +func (*ServerReflectionRequest_ListServices) isServerReflectionRequest_MessageRequest() {} + +// The type name and extension number sent by the client when requesting +// file_containing_extension. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type ExtensionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Fully-qualified type name. The format should be . + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ContainingType string `protobuf:"bytes,1,opt,name=containing_type,json=containingType,proto3" json:"containing_type,omitempty"` + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ExtensionNumber int32 `protobuf:"varint,2,opt,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtensionRequest) Reset() { + *x = ExtensionRequest{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtensionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtensionRequest) ProtoMessage() {} + +func (x *ExtensionRequest) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtensionRequest.ProtoReflect.Descriptor instead. +func (*ExtensionRequest) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{1} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ExtensionRequest) GetContainingType() string { + if x != nil { + return x.ContainingType + } + return "" +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ExtensionRequest) GetExtensionNumber() int32 { + if x != nil { + return x.ExtensionNumber + } + return 0 +} + +// The message sent by the server to answer ServerReflectionInfo method. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type ServerReflectionResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ValidHost string `protobuf:"bytes,1,opt,name=valid_host,json=validHost,proto3" json:"valid_host,omitempty"` + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + OriginalRequest *ServerReflectionRequest `protobuf:"bytes,2,opt,name=original_request,json=originalRequest,proto3" json:"original_request,omitempty"` + // The server set one of the following fields according to the message_request + // in the request. + // + // Types that are valid to be assigned to MessageResponse: + // + // *ServerReflectionResponse_FileDescriptorResponse + // *ServerReflectionResponse_AllExtensionNumbersResponse + // *ServerReflectionResponse_ListServicesResponse + // *ServerReflectionResponse_ErrorResponse + MessageResponse isServerReflectionResponse_MessageResponse `protobuf_oneof:"message_response"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServerReflectionResponse) Reset() { + *x = ServerReflectionResponse{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServerReflectionResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerReflectionResponse) ProtoMessage() {} + +func (x *ServerReflectionResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerReflectionResponse.ProtoReflect.Descriptor instead. +func (*ServerReflectionResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{2} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionResponse) GetValidHost() string { + if x != nil { + return x.ValidHost + } + return "" +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionResponse) GetOriginalRequest() *ServerReflectionRequest { + if x != nil { + return x.OriginalRequest + } + return nil +} + +func (x *ServerReflectionResponse) GetMessageResponse() isServerReflectionResponse_MessageResponse { + if x != nil { + return x.MessageResponse + } + return nil +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionResponse) GetFileDescriptorResponse() *FileDescriptorResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_FileDescriptorResponse); ok { + return x.FileDescriptorResponse + } + } + return nil +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionResponse) GetAllExtensionNumbersResponse() *ExtensionNumberResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_AllExtensionNumbersResponse); ok { + return x.AllExtensionNumbersResponse + } + } + return nil +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionResponse) GetListServicesResponse() *ListServiceResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_ListServicesResponse); ok { + return x.ListServicesResponse + } + } + return nil +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServerReflectionResponse) GetErrorResponse() *ErrorResponse { + if x != nil { + if x, ok := x.MessageResponse.(*ServerReflectionResponse_ErrorResponse); ok { + return x.ErrorResponse + } + } + return nil +} + +type isServerReflectionResponse_MessageResponse interface { + isServerReflectionResponse_MessageResponse() +} + +type ServerReflectionResponse_FileDescriptorResponse struct { + // This message is used to answer file_by_filename, file_containing_symbol, + // file_containing_extension requests with transitive dependencies. As + // the repeated label is not allowed in oneof fields, we use a + // FileDescriptorResponse message to encapsulate the repeated fields. + // The reflection service is allowed to avoid sending FileDescriptorProtos + // that were previously sent in response to earlier requests in the stream. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + FileDescriptorResponse *FileDescriptorResponse `protobuf:"bytes,4,opt,name=file_descriptor_response,json=fileDescriptorResponse,proto3,oneof"` +} + +type ServerReflectionResponse_AllExtensionNumbersResponse struct { + // This message is used to answer all_extension_numbers_of_type request. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + AllExtensionNumbersResponse *ExtensionNumberResponse `protobuf:"bytes,5,opt,name=all_extension_numbers_response,json=allExtensionNumbersResponse,proto3,oneof"` +} + +type ServerReflectionResponse_ListServicesResponse struct { + // This message is used to answer list_services request. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ListServicesResponse *ListServiceResponse `protobuf:"bytes,6,opt,name=list_services_response,json=listServicesResponse,proto3,oneof"` +} + +type ServerReflectionResponse_ErrorResponse struct { + // This message is used when an error occurs. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ErrorResponse *ErrorResponse `protobuf:"bytes,7,opt,name=error_response,json=errorResponse,proto3,oneof"` +} + +func (*ServerReflectionResponse_FileDescriptorResponse) isServerReflectionResponse_MessageResponse() { +} + +func (*ServerReflectionResponse_AllExtensionNumbersResponse) isServerReflectionResponse_MessageResponse() { +} + +func (*ServerReflectionResponse_ListServicesResponse) isServerReflectionResponse_MessageResponse() {} + +func (*ServerReflectionResponse_ErrorResponse) isServerReflectionResponse_MessageResponse() {} + +// Serialized FileDescriptorProto messages sent by the server answering +// a file_by_filename, file_containing_symbol, or file_containing_extension +// request. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type FileDescriptorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Serialized FileDescriptorProto messages. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + FileDescriptorProto [][]byte `protobuf:"bytes,1,rep,name=file_descriptor_proto,json=fileDescriptorProto,proto3" json:"file_descriptor_proto,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *FileDescriptorResponse) Reset() { + *x = FileDescriptorResponse{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *FileDescriptorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileDescriptorResponse) ProtoMessage() {} + +func (x *FileDescriptorResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use FileDescriptorResponse.ProtoReflect.Descriptor instead. +func (*FileDescriptorResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{3} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *FileDescriptorResponse) GetFileDescriptorProto() [][]byte { + if x != nil { + return x.FileDescriptorProto + } + return nil +} + +// A list of extension numbers sent by the server answering +// all_extension_numbers_of_type request. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type ExtensionNumberResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Full name of the base type, including the package name. The format + // is . + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + BaseTypeName string `protobuf:"bytes,1,opt,name=base_type_name,json=baseTypeName,proto3" json:"base_type_name,omitempty"` + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ExtensionNumber []int32 `protobuf:"varint,2,rep,packed,name=extension_number,json=extensionNumber,proto3" json:"extension_number,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ExtensionNumberResponse) Reset() { + *x = ExtensionNumberResponse{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ExtensionNumberResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ExtensionNumberResponse) ProtoMessage() {} + +func (x *ExtensionNumberResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ExtensionNumberResponse.ProtoReflect.Descriptor instead. +func (*ExtensionNumberResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{4} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ExtensionNumberResponse) GetBaseTypeName() string { + if x != nil { + return x.BaseTypeName + } + return "" +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ExtensionNumberResponse) GetExtensionNumber() []int32 { + if x != nil { + return x.ExtensionNumber + } + return nil +} + +// A list of ServiceResponse sent by the server answering list_services request. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type ListServiceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // The information of each service may be expanded in the future, so we use + // ServiceResponse message to encapsulate it. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + Service []*ServiceResponse `protobuf:"bytes,1,rep,name=service,proto3" json:"service,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ListServiceResponse) Reset() { + *x = ListServiceResponse{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ListServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListServiceResponse) ProtoMessage() {} + +func (x *ListServiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListServiceResponse.ProtoReflect.Descriptor instead. +func (*ListServiceResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{5} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ListServiceResponse) GetService() []*ServiceResponse { + if x != nil { + return x.Service + } + return nil +} + +// The information of a single service used by ListServiceResponse to answer +// list_services request. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type ServiceResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Full name of a registered service, including its package name. The format + // is . + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ServiceResponse) Reset() { + *x = ServiceResponse{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ServiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServiceResponse) ProtoMessage() {} + +func (x *ServiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServiceResponse.ProtoReflect.Descriptor instead. +func (*ServiceResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{6} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ServiceResponse) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +// The error code and error message sent by the server when an error occurs. +// +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +type ErrorResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + // This field uses the error codes defined in grpc::StatusCode. + // + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"` + // Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. + ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ErrorResponse) Reset() { + *x = ErrorResponse{} + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ErrorResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ErrorResponse) ProtoMessage() {} + +func (x *ErrorResponse) ProtoReflect() protoreflect.Message { + mi := &file_grpc_reflection_v1alpha_reflection_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead. +func (*ErrorResponse) Descriptor() ([]byte, []int) { + return file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP(), []int{7} +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ErrorResponse) GetErrorCode() int32 { + if x != nil { + return x.ErrorCode + } + return 0 +} + +// Deprecated: The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated. +func (x *ErrorResponse) GetErrorMessage() string { + if x != nil { + return x.ErrorMessage + } + return "" +} + +var File_grpc_reflection_v1alpha_reflection_proto protoreflect.FileDescriptor + +const file_grpc_reflection_v1alpha_reflection_proto_rawDesc = "" + + "\n" + + "(grpc/reflection/v1alpha/reflection.proto\x12\x17grpc.reflection.v1alpha\"\xf8\x02\n" + + "\x17ServerReflectionRequest\x12\x12\n" + + "\x04host\x18\x01 \x01(\tR\x04host\x12*\n" + + "\x10file_by_filename\x18\x03 \x01(\tH\x00R\x0efileByFilename\x126\n" + + "\x16file_containing_symbol\x18\x04 \x01(\tH\x00R\x14fileContainingSymbol\x12g\n" + + "\x19file_containing_extension\x18\x05 \x01(\v2).grpc.reflection.v1alpha.ExtensionRequestH\x00R\x17fileContainingExtension\x12B\n" + + "\x1dall_extension_numbers_of_type\x18\x06 \x01(\tH\x00R\x19allExtensionNumbersOfType\x12%\n" + + "\rlist_services\x18\a \x01(\tH\x00R\flistServicesB\x11\n" + + "\x0fmessage_request\"f\n" + + "\x10ExtensionRequest\x12'\n" + + "\x0fcontaining_type\x18\x01 \x01(\tR\x0econtainingType\x12)\n" + + "\x10extension_number\x18\x02 \x01(\x05R\x0fextensionNumber\"\xc7\x04\n" + + "\x18ServerReflectionResponse\x12\x1d\n" + + "\n" + + "valid_host\x18\x01 \x01(\tR\tvalidHost\x12[\n" + + "\x10original_request\x18\x02 \x01(\v20.grpc.reflection.v1alpha.ServerReflectionRequestR\x0foriginalRequest\x12k\n" + + "\x18file_descriptor_response\x18\x04 \x01(\v2/.grpc.reflection.v1alpha.FileDescriptorResponseH\x00R\x16fileDescriptorResponse\x12w\n" + + "\x1eall_extension_numbers_response\x18\x05 \x01(\v20.grpc.reflection.v1alpha.ExtensionNumberResponseH\x00R\x1ballExtensionNumbersResponse\x12d\n" + + "\x16list_services_response\x18\x06 \x01(\v2,.grpc.reflection.v1alpha.ListServiceResponseH\x00R\x14listServicesResponse\x12O\n" + + "\x0eerror_response\x18\a \x01(\v2&.grpc.reflection.v1alpha.ErrorResponseH\x00R\rerrorResponseB\x12\n" + + "\x10message_response\"L\n" + + "\x16FileDescriptorResponse\x122\n" + + "\x15file_descriptor_proto\x18\x01 \x03(\fR\x13fileDescriptorProto\"j\n" + + "\x17ExtensionNumberResponse\x12$\n" + + "\x0ebase_type_name\x18\x01 \x01(\tR\fbaseTypeName\x12)\n" + + "\x10extension_number\x18\x02 \x03(\x05R\x0fextensionNumber\"Y\n" + + "\x13ListServiceResponse\x12B\n" + + "\aservice\x18\x01 \x03(\v2(.grpc.reflection.v1alpha.ServiceResponseR\aservice\"%\n" + + "\x0fServiceResponse\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"S\n" + + "\rErrorResponse\x12\x1d\n" + + "\n" + + "error_code\x18\x01 \x01(\x05R\terrorCode\x12#\n" + + "\rerror_message\x18\x02 \x01(\tR\ferrorMessage2\x93\x01\n" + + "\x10ServerReflection\x12\x7f\n" + + "\x14ServerReflectionInfo\x120.grpc.reflection.v1alpha.ServerReflectionRequest\x1a1.grpc.reflection.v1alpha.ServerReflectionResponse(\x010\x01Bs\n" + + "\x1aio.grpc.reflection.v1alphaB\x15ServerReflectionProtoP\x01Z9google.golang.org/grpc/reflection/grpc_reflection_v1alpha\xb8\x01\x01b\x06proto3" + +var ( + file_grpc_reflection_v1alpha_reflection_proto_rawDescOnce sync.Once + file_grpc_reflection_v1alpha_reflection_proto_rawDescData []byte +) + +func file_grpc_reflection_v1alpha_reflection_proto_rawDescGZIP() []byte { + file_grpc_reflection_v1alpha_reflection_proto_rawDescOnce.Do(func() { + file_grpc_reflection_v1alpha_reflection_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1alpha_reflection_proto_rawDesc), len(file_grpc_reflection_v1alpha_reflection_proto_rawDesc))) + }) + return file_grpc_reflection_v1alpha_reflection_proto_rawDescData +} + +var file_grpc_reflection_v1alpha_reflection_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_grpc_reflection_v1alpha_reflection_proto_goTypes = []any{ + (*ServerReflectionRequest)(nil), // 0: grpc.reflection.v1alpha.ServerReflectionRequest + (*ExtensionRequest)(nil), // 1: grpc.reflection.v1alpha.ExtensionRequest + (*ServerReflectionResponse)(nil), // 2: grpc.reflection.v1alpha.ServerReflectionResponse + (*FileDescriptorResponse)(nil), // 3: grpc.reflection.v1alpha.FileDescriptorResponse + (*ExtensionNumberResponse)(nil), // 4: grpc.reflection.v1alpha.ExtensionNumberResponse + (*ListServiceResponse)(nil), // 5: grpc.reflection.v1alpha.ListServiceResponse + (*ServiceResponse)(nil), // 6: grpc.reflection.v1alpha.ServiceResponse + (*ErrorResponse)(nil), // 7: grpc.reflection.v1alpha.ErrorResponse +} +var file_grpc_reflection_v1alpha_reflection_proto_depIdxs = []int32{ + 1, // 0: grpc.reflection.v1alpha.ServerReflectionRequest.file_containing_extension:type_name -> grpc.reflection.v1alpha.ExtensionRequest + 0, // 1: grpc.reflection.v1alpha.ServerReflectionResponse.original_request:type_name -> grpc.reflection.v1alpha.ServerReflectionRequest + 3, // 2: grpc.reflection.v1alpha.ServerReflectionResponse.file_descriptor_response:type_name -> grpc.reflection.v1alpha.FileDescriptorResponse + 4, // 3: grpc.reflection.v1alpha.ServerReflectionResponse.all_extension_numbers_response:type_name -> grpc.reflection.v1alpha.ExtensionNumberResponse + 5, // 4: grpc.reflection.v1alpha.ServerReflectionResponse.list_services_response:type_name -> grpc.reflection.v1alpha.ListServiceResponse + 7, // 5: grpc.reflection.v1alpha.ServerReflectionResponse.error_response:type_name -> grpc.reflection.v1alpha.ErrorResponse + 6, // 6: grpc.reflection.v1alpha.ListServiceResponse.service:type_name -> grpc.reflection.v1alpha.ServiceResponse + 0, // 7: grpc.reflection.v1alpha.ServerReflection.ServerReflectionInfo:input_type -> grpc.reflection.v1alpha.ServerReflectionRequest + 2, // 8: grpc.reflection.v1alpha.ServerReflection.ServerReflectionInfo:output_type -> grpc.reflection.v1alpha.ServerReflectionResponse + 8, // [8:9] is the sub-list for method output_type + 7, // [7:8] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_grpc_reflection_v1alpha_reflection_proto_init() } +func file_grpc_reflection_v1alpha_reflection_proto_init() { + if File_grpc_reflection_v1alpha_reflection_proto != nil { + return + } + file_grpc_reflection_v1alpha_reflection_proto_msgTypes[0].OneofWrappers = []any{ + (*ServerReflectionRequest_FileByFilename)(nil), + (*ServerReflectionRequest_FileContainingSymbol)(nil), + (*ServerReflectionRequest_FileContainingExtension)(nil), + (*ServerReflectionRequest_AllExtensionNumbersOfType)(nil), + (*ServerReflectionRequest_ListServices)(nil), + } + file_grpc_reflection_v1alpha_reflection_proto_msgTypes[2].OneofWrappers = []any{ + (*ServerReflectionResponse_FileDescriptorResponse)(nil), + (*ServerReflectionResponse_AllExtensionNumbersResponse)(nil), + (*ServerReflectionResponse_ListServicesResponse)(nil), + (*ServerReflectionResponse_ErrorResponse)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_grpc_reflection_v1alpha_reflection_proto_rawDesc), len(file_grpc_reflection_v1alpha_reflection_proto_rawDesc)), + NumEnums: 0, + NumMessages: 8, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_grpc_reflection_v1alpha_reflection_proto_goTypes, + DependencyIndexes: file_grpc_reflection_v1alpha_reflection_proto_depIdxs, + MessageInfos: file_grpc_reflection_v1alpha_reflection_proto_msgTypes, + }.Build() + File_grpc_reflection_v1alpha_reflection_proto = out.File + file_grpc_reflection_v1alpha_reflection_proto_goTypes = nil + file_grpc_reflection_v1alpha_reflection_proto_depIdxs = nil +} diff --git a/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go new file mode 100644 index 0000000000..cee004ab57 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/grpc_reflection_v1alpha/reflection_grpc.pb.go @@ -0,0 +1,135 @@ +// Copyright 2016 The gRPC 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. +// Service exported by server reflection + +// Warning: this entire file is deprecated. Use this instead: +// https://github.com/grpc/grpc-proto/blob/master/grpc/reflection/v1/reflection.proto + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.0 +// - protoc v5.27.1 +// grpc/reflection/v1alpha/reflection.proto is a deprecated file. + +package grpc_reflection_v1alpha + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + ServerReflection_ServerReflectionInfo_FullMethodName = "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo" +) + +// ServerReflectionClient is the client API for ServerReflection service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type ServerReflectionClient interface { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) +} + +type serverReflectionClient struct { + cc grpc.ClientConnInterface +} + +func NewServerReflectionClient(cc grpc.ClientConnInterface) ServerReflectionClient { + return &serverReflectionClient{cc} +} + +func (c *serverReflectionClient) ServerReflectionInfo(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &ServerReflection_ServiceDesc.Streams[0], ServerReflection_ServerReflectionInfo_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[ServerReflectionRequest, ServerReflectionResponse]{ClientStream: stream} + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoClient = grpc.BidiStreamingClient[ServerReflectionRequest, ServerReflectionResponse] + +// ServerReflectionServer is the server API for ServerReflection service. +// All implementations should embed UnimplementedServerReflectionServer +// for forward compatibility. +type ServerReflectionServer interface { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error +} + +// UnimplementedServerReflectionServer should be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedServerReflectionServer struct{} + +func (UnimplementedServerReflectionServer) ServerReflectionInfo(grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse]) error { + return status.Error(codes.Unimplemented, "method ServerReflectionInfo not implemented") +} +func (UnimplementedServerReflectionServer) testEmbeddedByValue() {} + +// UnsafeServerReflectionServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ServerReflectionServer will +// result in compilation errors. +type UnsafeServerReflectionServer interface { + mustEmbedUnimplementedServerReflectionServer() +} + +func RegisterServerReflectionServer(s grpc.ServiceRegistrar, srv ServerReflectionServer) { + // If the following call panics, it indicates UnimplementedServerReflectionServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ServerReflection_ServiceDesc, srv) +} + +func _ServerReflection_ServerReflectionInfo_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ServerReflectionServer).ServerReflectionInfo(&grpc.GenericServerStream[ServerReflectionRequest, ServerReflectionResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ServerReflection_ServerReflectionInfoServer = grpc.BidiStreamingServer[ServerReflectionRequest, ServerReflectionResponse] + +// ServerReflection_ServiceDesc is the grpc.ServiceDesc for ServerReflection service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ServerReflection_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.reflection.v1alpha.ServerReflection", + HandlerType: (*ServerReflectionServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "ServerReflectionInfo", + Handler: _ServerReflection_ServerReflectionInfo_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "grpc/reflection/v1alpha/reflection.proto", +} diff --git a/vendor/google.golang.org/grpc/reflection/internal/internal.go b/vendor/google.golang.org/grpc/reflection/internal/internal.go new file mode 100644 index 0000000000..902fc6d35c --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/internal/internal.go @@ -0,0 +1,436 @@ +/* + * + * Copyright 2024 gRPC 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. + * + */ + +// Package internal contains code that is shared by both reflection package and +// the test package. The packages are split in this way inorder to avoid +// dependency to deprecated package github.com/golang/protobuf. +package internal + +import ( + "io" + "sort" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + + v1reflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1" + v1reflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1" + v1alphareflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" + v1alphareflectionpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" +) + +// ServiceInfoProvider is an interface used to retrieve metadata about the +// services to expose. +type ServiceInfoProvider interface { + GetServiceInfo() map[string]grpc.ServiceInfo +} + +// ExtensionResolver is the interface used to query details about extensions. +// This interface is satisfied by protoregistry.GlobalTypes. +type ExtensionResolver interface { + protoregistry.ExtensionTypeResolver + RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool) +} + +// ServerReflectionServer is the server API for ServerReflection service. +type ServerReflectionServer struct { + v1alphareflectiongrpc.UnimplementedServerReflectionServer + S ServiceInfoProvider + DescResolver protodesc.Resolver + ExtResolver ExtensionResolver +} + +// FileDescWithDependencies returns a slice of serialized fileDescriptors in +// wire format ([]byte). The fileDescriptors will include fd and all the +// transitive dependencies of fd with names not in sentFileDescriptors. +func (s *ServerReflectionServer) FileDescWithDependencies(fd protoreflect.FileDescriptor, sentFileDescriptors map[string]bool) ([][]byte, error) { + if fd.IsPlaceholder() { + // If the given root file is a placeholder, treat it + // as missing instead of serializing it. + return nil, protoregistry.NotFound + } + var r [][]byte + queue := []protoreflect.FileDescriptor{fd} + for len(queue) > 0 { + currentfd := queue[0] + queue = queue[1:] + if currentfd.IsPlaceholder() { + // Skip any missing files in the dependency graph. + continue + } + if sent := sentFileDescriptors[currentfd.Path()]; len(r) == 0 || !sent { + sentFileDescriptors[currentfd.Path()] = true + fdProto := protodesc.ToFileDescriptorProto(currentfd) + currentfdEncoded, err := proto.Marshal(fdProto) + if err != nil { + return nil, err + } + r = append(r, currentfdEncoded) + } + for i := 0; i < currentfd.Imports().Len(); i++ { + queue = append(queue, currentfd.Imports().Get(i)) + } + } + return r, nil +} + +// FileDescEncodingContainingSymbol finds the file descriptor containing the +// given symbol, finds all of its previously unsent transitive dependencies, +// does marshalling on them, and returns the marshalled result. The given symbol +// can be a type, a service or a method. +func (s *ServerReflectionServer) FileDescEncodingContainingSymbol(name string, sentFileDescriptors map[string]bool) ([][]byte, error) { + d, err := s.DescResolver.FindDescriptorByName(protoreflect.FullName(name)) + if err != nil { + return nil, err + } + return s.FileDescWithDependencies(d.ParentFile(), sentFileDescriptors) +} + +// FileDescEncodingContainingExtension finds the file descriptor containing +// given extension, finds all of its previously unsent transitive dependencies, +// does marshalling on them, and returns the marshalled result. +func (s *ServerReflectionServer) FileDescEncodingContainingExtension(typeName string, extNum int32, sentFileDescriptors map[string]bool) ([][]byte, error) { + xt, err := s.ExtResolver.FindExtensionByNumber(protoreflect.FullName(typeName), protoreflect.FieldNumber(extNum)) + if err != nil { + return nil, err + } + return s.FileDescWithDependencies(xt.TypeDescriptor().ParentFile(), sentFileDescriptors) +} + +// AllExtensionNumbersForTypeName returns all extension numbers for the given type. +func (s *ServerReflectionServer) AllExtensionNumbersForTypeName(name string) ([]int32, error) { + var numbers []int32 + s.ExtResolver.RangeExtensionsByMessage(protoreflect.FullName(name), func(xt protoreflect.ExtensionType) bool { + numbers = append(numbers, int32(xt.TypeDescriptor().Number())) + return true + }) + sort.Slice(numbers, func(i, j int) bool { + return numbers[i] < numbers[j] + }) + if len(numbers) == 0 { + // maybe return an error if given type name is not known + if _, err := s.DescResolver.FindDescriptorByName(protoreflect.FullName(name)); err != nil { + return nil, err + } + } + return numbers, nil +} + +// ListServices returns the names of services this server exposes. +func (s *ServerReflectionServer) ListServices() []*v1reflectionpb.ServiceResponse { + serviceInfo := s.S.GetServiceInfo() + resp := make([]*v1reflectionpb.ServiceResponse, 0, len(serviceInfo)) + for svc := range serviceInfo { + resp = append(resp, &v1reflectionpb.ServiceResponse{Name: svc}) + } + sort.Slice(resp, func(i, j int) bool { + return resp[i].Name < resp[j].Name + }) + return resp +} + +// ServerReflectionInfo is the reflection service handler. +func (s *ServerReflectionServer) ServerReflectionInfo(stream v1reflectiongrpc.ServerReflection_ServerReflectionInfoServer) error { + sentFileDescriptors := make(map[string]bool) + for { + in, err := stream.Recv() + if err == io.EOF { + return nil + } + if err != nil { + return err + } + + out := &v1reflectionpb.ServerReflectionResponse{ + ValidHost: in.Host, + OriginalRequest: in, + } + switch req := in.MessageRequest.(type) { + case *v1reflectionpb.ServerReflectionRequest_FileByFilename: + var b [][]byte + fd, err := s.DescResolver.FindFileByPath(req.FileByFilename) + if err == nil { + b, err = s.FileDescWithDependencies(fd, sentFileDescriptors) + } + if err != nil { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &v1reflectionpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{FileDescriptorProto: b}, + } + } + case *v1reflectionpb.ServerReflectionRequest_FileContainingSymbol: + b, err := s.FileDescEncodingContainingSymbol(req.FileContainingSymbol, sentFileDescriptors) + if err != nil { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &v1reflectionpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{FileDescriptorProto: b}, + } + } + case *v1reflectionpb.ServerReflectionRequest_FileContainingExtension: + typeName := req.FileContainingExtension.ContainingType + extNum := req.FileContainingExtension.ExtensionNumber + b, err := s.FileDescEncodingContainingExtension(typeName, extNum, sentFileDescriptors) + if err != nil { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &v1reflectionpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{FileDescriptorProto: b}, + } + } + case *v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType: + extNums, err := s.AllExtensionNumbersForTypeName(req.AllExtensionNumbersOfType) + if err != nil { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &v1reflectionpb.ErrorResponse{ + ErrorCode: int32(codes.NotFound), + ErrorMessage: err.Error(), + }, + } + } else { + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse{ + AllExtensionNumbersResponse: &v1reflectionpb.ExtensionNumberResponse{ + BaseTypeName: req.AllExtensionNumbersOfType, + ExtensionNumber: extNums, + }, + } + } + case *v1reflectionpb.ServerReflectionRequest_ListServices: + out.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ListServicesResponse{ + ListServicesResponse: &v1reflectionpb.ListServiceResponse{ + Service: s.ListServices(), + }, + } + default: + return status.Errorf(codes.InvalidArgument, "invalid MessageRequest: %v", in.MessageRequest) + } + + if err := stream.Send(out); err != nil { + return err + } + } +} + +// V1ToV1AlphaResponse converts a v1 ServerReflectionResponse to a v1alpha. +func V1ToV1AlphaResponse(v1 *v1reflectionpb.ServerReflectionResponse) *v1alphareflectionpb.ServerReflectionResponse { + var v1alpha v1alphareflectionpb.ServerReflectionResponse + v1alpha.ValidHost = v1.ValidHost + if v1.OriginalRequest != nil { + v1alpha.OriginalRequest = V1ToV1AlphaRequest(v1.OriginalRequest) + } + switch mr := v1.MessageResponse.(type) { + case *v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse: + if mr != nil { + v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &v1alphareflectionpb.FileDescriptorResponse{ + FileDescriptorProto: mr.FileDescriptorResponse.GetFileDescriptorProto(), + }, + } + } + case *v1reflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse: + if mr != nil { + v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse{ + AllExtensionNumbersResponse: &v1alphareflectionpb.ExtensionNumberResponse{ + BaseTypeName: mr.AllExtensionNumbersResponse.GetBaseTypeName(), + ExtensionNumber: mr.AllExtensionNumbersResponse.GetExtensionNumber(), + }, + } + } + case *v1reflectionpb.ServerReflectionResponse_ListServicesResponse: + if mr != nil { + svcs := make([]*v1alphareflectionpb.ServiceResponse, len(mr.ListServicesResponse.GetService())) + for i, svc := range mr.ListServicesResponse.GetService() { + svcs[i] = &v1alphareflectionpb.ServiceResponse{ + Name: svc.GetName(), + } + } + v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_ListServicesResponse{ + ListServicesResponse: &v1alphareflectionpb.ListServiceResponse{ + Service: svcs, + }, + } + } + case *v1reflectionpb.ServerReflectionResponse_ErrorResponse: + if mr != nil { + v1alpha.MessageResponse = &v1alphareflectionpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &v1alphareflectionpb.ErrorResponse{ + ErrorCode: mr.ErrorResponse.GetErrorCode(), + ErrorMessage: mr.ErrorResponse.GetErrorMessage(), + }, + } + } + default: + // no value set + } + return &v1alpha +} + +// V1AlphaToV1Request converts a v1alpha ServerReflectionRequest to a v1. +func V1AlphaToV1Request(v1alpha *v1alphareflectionpb.ServerReflectionRequest) *v1reflectionpb.ServerReflectionRequest { + var v1 v1reflectionpb.ServerReflectionRequest + v1.Host = v1alpha.Host + switch mr := v1alpha.MessageRequest.(type) { + case *v1alphareflectionpb.ServerReflectionRequest_FileByFilename: + v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileByFilename{ + FileByFilename: mr.FileByFilename, + } + case *v1alphareflectionpb.ServerReflectionRequest_FileContainingSymbol: + v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileContainingSymbol{ + FileContainingSymbol: mr.FileContainingSymbol, + } + case *v1alphareflectionpb.ServerReflectionRequest_FileContainingExtension: + if mr.FileContainingExtension != nil { + v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_FileContainingExtension{ + FileContainingExtension: &v1reflectionpb.ExtensionRequest{ + ContainingType: mr.FileContainingExtension.GetContainingType(), + ExtensionNumber: mr.FileContainingExtension.GetExtensionNumber(), + }, + } + } + case *v1alphareflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType: + v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType{ + AllExtensionNumbersOfType: mr.AllExtensionNumbersOfType, + } + case *v1alphareflectionpb.ServerReflectionRequest_ListServices: + v1.MessageRequest = &v1reflectionpb.ServerReflectionRequest_ListServices{ + ListServices: mr.ListServices, + } + default: + // no value set + } + return &v1 +} + +// V1ToV1AlphaRequest converts a v1 ServerReflectionRequest to a v1alpha. +func V1ToV1AlphaRequest(v1 *v1reflectionpb.ServerReflectionRequest) *v1alphareflectionpb.ServerReflectionRequest { + var v1alpha v1alphareflectionpb.ServerReflectionRequest + v1alpha.Host = v1.Host + switch mr := v1.MessageRequest.(type) { + case *v1reflectionpb.ServerReflectionRequest_FileByFilename: + if mr != nil { + v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_FileByFilename{ + FileByFilename: mr.FileByFilename, + } + } + case *v1reflectionpb.ServerReflectionRequest_FileContainingSymbol: + if mr != nil { + v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_FileContainingSymbol{ + FileContainingSymbol: mr.FileContainingSymbol, + } + } + case *v1reflectionpb.ServerReflectionRequest_FileContainingExtension: + if mr != nil { + v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_FileContainingExtension{ + FileContainingExtension: &v1alphareflectionpb.ExtensionRequest{ + ContainingType: mr.FileContainingExtension.GetContainingType(), + ExtensionNumber: mr.FileContainingExtension.GetExtensionNumber(), + }, + } + } + case *v1reflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType: + if mr != nil { + v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_AllExtensionNumbersOfType{ + AllExtensionNumbersOfType: mr.AllExtensionNumbersOfType, + } + } + case *v1reflectionpb.ServerReflectionRequest_ListServices: + if mr != nil { + v1alpha.MessageRequest = &v1alphareflectionpb.ServerReflectionRequest_ListServices{ + ListServices: mr.ListServices, + } + } + default: + // no value set + } + return &v1alpha +} + +// V1AlphaToV1Response converts a v1alpha ServerReflectionResponse to a v1. +func V1AlphaToV1Response(v1alpha *v1alphareflectionpb.ServerReflectionResponse) *v1reflectionpb.ServerReflectionResponse { + var v1 v1reflectionpb.ServerReflectionResponse + v1.ValidHost = v1alpha.ValidHost + if v1alpha.OriginalRequest != nil { + v1.OriginalRequest = V1AlphaToV1Request(v1alpha.OriginalRequest) + } + switch mr := v1alpha.MessageResponse.(type) { + case *v1alphareflectionpb.ServerReflectionResponse_FileDescriptorResponse: + if mr != nil { + v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_FileDescriptorResponse{ + FileDescriptorResponse: &v1reflectionpb.FileDescriptorResponse{ + FileDescriptorProto: mr.FileDescriptorResponse.GetFileDescriptorProto(), + }, + } + } + case *v1alphareflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse: + if mr != nil { + v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_AllExtensionNumbersResponse{ + AllExtensionNumbersResponse: &v1reflectionpb.ExtensionNumberResponse{ + BaseTypeName: mr.AllExtensionNumbersResponse.GetBaseTypeName(), + ExtensionNumber: mr.AllExtensionNumbersResponse.GetExtensionNumber(), + }, + } + } + case *v1alphareflectionpb.ServerReflectionResponse_ListServicesResponse: + if mr != nil { + svcs := make([]*v1reflectionpb.ServiceResponse, len(mr.ListServicesResponse.GetService())) + for i, svc := range mr.ListServicesResponse.GetService() { + svcs[i] = &v1reflectionpb.ServiceResponse{ + Name: svc.GetName(), + } + } + v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ListServicesResponse{ + ListServicesResponse: &v1reflectionpb.ListServiceResponse{ + Service: svcs, + }, + } + } + case *v1alphareflectionpb.ServerReflectionResponse_ErrorResponse: + if mr != nil { + v1.MessageResponse = &v1reflectionpb.ServerReflectionResponse_ErrorResponse{ + ErrorResponse: &v1reflectionpb.ErrorResponse{ + ErrorCode: mr.ErrorResponse.GetErrorCode(), + ErrorMessage: mr.ErrorResponse.GetErrorMessage(), + }, + } + } + default: + // no value set + } + return &v1 +} diff --git a/vendor/google.golang.org/grpc/reflection/serverreflection.go b/vendor/google.golang.org/grpc/reflection/serverreflection.go new file mode 100644 index 0000000000..13a94e2dd2 --- /dev/null +++ b/vendor/google.golang.org/grpc/reflection/serverreflection.go @@ -0,0 +1,160 @@ +/* + * + * Copyright 2016 gRPC 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. + * + */ + +/* +Package reflection implements server reflection service. + +The service implemented is defined in: +https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto. + +To register server reflection on a gRPC server: + + import "google.golang.org/grpc/reflection" + + s := grpc.NewServer() + pb.RegisterYourOwnServer(s, &server{}) + + // Register reflection service on gRPC server. + reflection.Register(s) + + s.Serve(lis) +*/ +package reflection // import "google.golang.org/grpc/reflection" + +import ( + "google.golang.org/grpc" + "google.golang.org/grpc/reflection/internal" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + + v1reflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1" + v1alphareflectiongrpc "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" +) + +// GRPCServer is the interface provided by a gRPC server. It is implemented by +// *grpc.Server, but could also be implemented by other concrete types. It acts +// as a registry, for accumulating the services exposed by the server. +type GRPCServer interface { + grpc.ServiceRegistrar + ServiceInfoProvider +} + +var _ GRPCServer = (*grpc.Server)(nil) + +// Register registers the server reflection service on the given gRPC server. +// Both the v1 and v1alpha versions are registered. +func Register(s GRPCServer) { + svr := NewServerV1(ServerOptions{Services: s}) + v1alphareflectiongrpc.RegisterServerReflectionServer(s, asV1Alpha(svr)) + v1reflectiongrpc.RegisterServerReflectionServer(s, svr) +} + +// RegisterV1 registers only the v1 version of the server reflection service +// on the given gRPC server. Many clients may only support v1alpha so most +// users should use Register instead, at least until clients have upgraded. +func RegisterV1(s GRPCServer) { + svr := NewServerV1(ServerOptions{Services: s}) + v1reflectiongrpc.RegisterServerReflectionServer(s, svr) +} + +// ServiceInfoProvider is an interface used to retrieve metadata about the +// services to expose. +// +// The reflection service is only interested in the service names, but the +// signature is this way so that *grpc.Server implements it. So it is okay +// for a custom implementation to return zero values for the +// grpc.ServiceInfo values in the map. +// +// # Experimental +// +// Notice: This type is EXPERIMENTAL and may be changed or removed in a +// later release. +type ServiceInfoProvider interface { + GetServiceInfo() map[string]grpc.ServiceInfo +} + +// ExtensionResolver is the interface used to query details about extensions. +// This interface is satisfied by protoregistry.GlobalTypes. +// +// # Experimental +// +// Notice: This type is EXPERIMENTAL and may be changed or removed in a +// later release. +type ExtensionResolver interface { + protoregistry.ExtensionTypeResolver + RangeExtensionsByMessage(message protoreflect.FullName, f func(protoreflect.ExtensionType) bool) +} + +// ServerOptions represents the options used to construct a reflection server. +// +// # Experimental +// +// Notice: This type is EXPERIMENTAL and may be changed or removed in a +// later release. +type ServerOptions struct { + // The source of advertised RPC services. If not specified, the reflection + // server will report an empty list when asked to list services. + // + // This value will typically be a *grpc.Server. But the set of advertised + // services can be customized by wrapping a *grpc.Server or using an + // alternate implementation that returns a custom set of service names. + Services ServiceInfoProvider + // Optional resolver used to load descriptors. If not specified, + // protoregistry.GlobalFiles will be used. + DescriptorResolver protodesc.Resolver + // Optional resolver used to query for known extensions. If not specified, + // protoregistry.GlobalTypes will be used. + ExtensionResolver ExtensionResolver +} + +// NewServer returns a reflection server implementation using the given options. +// This can be used to customize behavior of the reflection service. Most usages +// should prefer to use Register instead. For backwards compatibility reasons, +// this returns the v1alpha version of the reflection server. For a v1 version +// of the reflection server, see NewServerV1. +// +// # Experimental +// +// Notice: This function is EXPERIMENTAL and may be changed or removed in a +// later release. +func NewServer(opts ServerOptions) v1alphareflectiongrpc.ServerReflectionServer { + return asV1Alpha(NewServerV1(opts)) +} + +// NewServerV1 returns a reflection server implementation using the given options. +// This can be used to customize behavior of the reflection service. Most usages +// should prefer to use Register instead. +// +// # Experimental +// +// Notice: This function is EXPERIMENTAL and may be changed or removed in a +// later release. +func NewServerV1(opts ServerOptions) v1reflectiongrpc.ServerReflectionServer { + if opts.DescriptorResolver == nil { + opts.DescriptorResolver = protoregistry.GlobalFiles + } + if opts.ExtensionResolver == nil { + opts.ExtensionResolver = protoregistry.GlobalTypes + } + return &internal.ServerReflectionServer{ + S: opts.Services, + DescResolver: opts.DescriptorResolver, + ExtResolver: opts.ExtensionResolver, + } +} diff --git a/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go b/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go index 2ef36bbcf9..ec63689e72 100644 --- a/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go +++ b/vendor/google.golang.org/protobuf/encoding/protodelim/protodelim.go @@ -10,6 +10,7 @@ import ( "encoding/binary" "fmt" "io" + "math" "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/errors" @@ -117,7 +118,13 @@ func (o UnmarshalOptions) UnmarshalFrom(r Reader, m proto.Message) error { if maxSize == 0 { maxSize = defaultMaxSize } - if maxSize != -1 && size > uint64(maxSize) { + if maxSize == -1 { + // No limit specified: Just check that size fits into an integer, + // otherwise the make([]byte, size) call below will panic. + if size > math.MaxInt { + return errors.Wrap(&SizeTooLargeError{Size: size, MaxSize: math.MaxInt}, "") + } + } else if size > uint64(maxSize) { return errors.Wrap(&SizeTooLargeError{Size: size, MaxSize: uint64(maxSize)}, "") } diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/decode.go b/vendor/google.golang.org/protobuf/encoding/protojson/decode.go index 737d6876d5..1d6608dc7d 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/decode.go @@ -365,6 +365,10 @@ func unmarshalInt(tok json.Token, bitSize int) (protoreflect.Value, bool) { if err != nil { return protoreflect.Value{}, false } + // Ensure there is no non-number content in this string. + if next, err := dec.Read(); err != nil || next.Kind() != json.EOF { + return protoreflect.Value{}, false + } return getInt(tok, bitSize) } return protoreflect.Value{}, false @@ -397,6 +401,10 @@ func unmarshalUint(tok json.Token, bitSize int) (protoreflect.Value, bool) { if err != nil { return protoreflect.Value{}, false } + // Ensure there is no non-number content in this string. + if next, err := dec.Read(); err != nil || next.Kind() != json.EOF { + return protoreflect.Value{}, false + } return getUint(tok, bitSize) } return protoreflect.Value{}, false @@ -447,6 +455,10 @@ func unmarshalFloat(tok json.Token, bitSize int) (protoreflect.Value, bool) { if err != nil { return protoreflect.Value{}, false } + // Ensure there is no non-number content in this string. + if next, err := dec.Read(); err != nil || next.Kind() != json.EOF { + return protoreflect.Value{}, false + } return getFloat(tok, bitSize) } return protoreflect.Value{}, false diff --git a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go index e9fe103943..d2eab46947 100644 --- a/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go +++ b/vendor/google.golang.org/protobuf/encoding/protojson/well_known_types.go @@ -52,7 +52,10 @@ func wellKnownTypeMarshaler(name protoreflect.FullName) marshalFunc { case genid.FieldMask_message_name: return encoder.marshalFieldMask case genid.Empty_message_name: - return encoder.marshalEmpty + // The spec explicitly specifies that the Empty message + // is not considered to have any special JSON mapping: + // https://protobuf.dev/programming-guides/json/#any + return nil } } return nil diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go index b53805056a..20ec09e194 100644 --- a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +++ b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go @@ -8,6 +8,7 @@ import ( "fmt" "unicode/utf8" + "google.golang.org/protobuf/encoding/protowire" "google.golang.org/protobuf/internal/encoding/messageset" "google.golang.org/protobuf/internal/encoding/text" "google.golang.org/protobuf/internal/errors" @@ -49,12 +50,19 @@ type UnmarshalOptions struct { protoregistry.MessageTypeResolver protoregistry.ExtensionTypeResolver } + + // RecursionLimit limits how deeply messages may be nested. + // If zero, a default limit is applied. + RecursionLimit int } // Unmarshal reads the given []byte and populates the given [proto.Message] // using options in the UnmarshalOptions object. // The provided message must be mutable (e.g., a non-nil pointer to a message). func (o UnmarshalOptions) Unmarshal(b []byte, m proto.Message) error { + if o.RecursionLimit == 0 { + o.RecursionLimit = protowire.DefaultRecursionLimit + } return o.unmarshal(b, m) } @@ -102,8 +110,14 @@ func (d decoder) syntaxError(pos int, f string, x ...any) error { return errors.New(head+f, x...) } +var errRecursionDepth = errors.New("exceeded maximum recursion depth") + // unmarshalMessage unmarshals into the given protoreflect.Message. func (d decoder) unmarshalMessage(m protoreflect.Message, checkDelims bool) error { + if d.opts.RecursionLimit--; d.opts.RecursionLimit < 0 { + return errRecursionDepth + } + messageDesc := m.Descriptor() if !flags.ProtoLegacy && messageset.IsMessageSet(messageDesc) { return errors.New("no support for proto1 MessageSets") @@ -437,6 +451,10 @@ func (d decoder) unmarshalList(fd protoreflect.FieldDescriptor, list protoreflec // unmarshalMap unmarshals into given protoreflect.Map. A map value is a // textproto message containing {key: , value: }. func (d decoder) unmarshalMap(fd protoreflect.FieldDescriptor, mmap protoreflect.Map) error { + if d.opts.RecursionLimit--; d.opts.RecursionLimit < 0 { + return errRecursionDepth + } + // Determine ahead whether map entry is a scalar type or a message type in // order to call the appropriate unmarshalMapValue func inside // unmarshalMapEntry. diff --git a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go index 87e46bd4df..0b0dfacbe5 100644 --- a/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +++ b/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go @@ -83,12 +83,13 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string { case protoreflect.FileImports: for i := 0; i < vs.Len(); i++ { var rs records - rv := reflect.ValueOf(vs.Get(i)) - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Path"), "Path"}, - {rv.MethodByName("Package"), "Package"}, - {rv.MethodByName("IsPublic"), "IsPublic"}, - {rv.MethodByName("IsWeak"), "IsWeak"}, + fi := vs.Get(i) + rv := reflect.ValueOf(fi) + rs.Append(rv, []attrAndName{ + {fi.Path(), "Path"}, + {fi.Package(), "Package"}, + {fi.IsPublic, "IsPublic"}, + {fi.IsWeak, "IsWeak"}, }...) ss = append(ss, "{"+rs.Join()+"}") } @@ -104,9 +105,9 @@ func formatListOpt(vs list, isRoot, allowMulti bool) string { } } -type methodAndName struct { - method reflect.Value - name string +type attrAndName struct { + attr any + name string } func FormatDesc(s fmt.State, r rune, t protoreflect.Descriptor) { @@ -126,58 +127,58 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record fu start = rt.Name() + "{" } - _, isFile := t.(protoreflect.FileDescriptor) + fd, isFile := t.(protoreflect.FileDescriptor) rs := records{ allowMulti: allowMulti, record: record, } if t.IsPlaceholder() { if isFile { - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Path"), "Path"}, - {rv.MethodByName("Package"), "Package"}, - {rv.MethodByName("IsPlaceholder"), "IsPlaceholder"}, + rs.Append(rv, []attrAndName{ + {fd.Path(), "Path"}, + {fd.Package(), "Package"}, + {fd.IsPlaceholder(), "IsPlaceholder"}, }...) } else { - rs.Append(rv, []methodAndName{ - {rv.MethodByName("FullName"), "FullName"}, - {rv.MethodByName("IsPlaceholder"), "IsPlaceholder"}, + rs.Append(rv, []attrAndName{ + {t.FullName(), "FullName"}, + {t.IsPlaceholder(), "IsPlaceholder"}, }...) } } else { switch { case isFile: - rs.Append(rv, methodAndName{rv.MethodByName("Syntax"), "Syntax"}) + rs.Append(rv, attrAndName{fd.Syntax(), "Syntax"}) case isRoot: - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Syntax"), "Syntax"}, - {rv.MethodByName("FullName"), "FullName"}, + rs.Append(rv, []attrAndName{ + {t.Syntax(), "Syntax"}, + {t.FullName(), "FullName"}, }...) default: - rs.Append(rv, methodAndName{rv.MethodByName("Name"), "Name"}) + rs.Append(rv, attrAndName{t.Name(), "Name"}) } switch t := t.(type) { case protoreflect.FieldDescriptor: - accessors := []methodAndName{ - {rv.MethodByName("Number"), "Number"}, - {rv.MethodByName("Cardinality"), "Cardinality"}, - {rv.MethodByName("Kind"), "Kind"}, - {rv.MethodByName("HasJSONName"), "HasJSONName"}, - {rv.MethodByName("JSONName"), "JSONName"}, - {rv.MethodByName("HasPresence"), "HasPresence"}, - {rv.MethodByName("IsExtension"), "IsExtension"}, - {rv.MethodByName("IsPacked"), "IsPacked"}, - {rv.MethodByName("IsWeak"), "IsWeak"}, - {rv.MethodByName("IsList"), "IsList"}, - {rv.MethodByName("IsMap"), "IsMap"}, - {rv.MethodByName("MapKey"), "MapKey"}, - {rv.MethodByName("MapValue"), "MapValue"}, - {rv.MethodByName("HasDefault"), "HasDefault"}, - {rv.MethodByName("Default"), "Default"}, - {rv.MethodByName("ContainingOneof"), "ContainingOneof"}, - {rv.MethodByName("ContainingMessage"), "ContainingMessage"}, - {rv.MethodByName("Message"), "Message"}, - {rv.MethodByName("Enum"), "Enum"}, + accessors := []attrAndName{ + {t.Number(), "Number"}, + {t.Cardinality(), "Cardinality"}, + {t.Kind(), "Kind"}, + {t.HasJSONName(), "HasJSONName"}, + {t.JSONName(), "JSONName"}, + {t.HasPresence(), "HasPresence"}, + {t.IsExtension(), "IsExtension"}, + {t.IsPacked(), "IsPacked"}, + {t.IsWeak(), "IsWeak"}, + {t.IsList(), "IsList"}, + {t.IsMap(), "IsMap"}, + {t.MapKey(), "MapKey"}, + {t.MapValue(), "MapValue"}, + {t.HasDefault(), "HasDefault"}, + {t.Default(), "Default"}, + {t.ContainingOneof(), "ContainingOneof"}, + {t.ContainingMessage(), "ContainingMessage"}, + {t.Message(), "Message"}, + {t.Enum(), "Enum"}, } for _, s := range accessors { switch s.name { @@ -223,58 +224,54 @@ func formatDescOpt(t protoreflect.Descriptor, isRoot, allowMulti bool, record fu } case protoreflect.FileDescriptor: - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Path"), "Path"}, - {rv.MethodByName("Package"), "Package"}, - {rv.MethodByName("Imports"), "Imports"}, - {rv.MethodByName("Messages"), "Messages"}, - {rv.MethodByName("Enums"), "Enums"}, - {rv.MethodByName("Extensions"), "Extensions"}, - {rv.MethodByName("Services"), "Services"}, + rs.Append(rv, []attrAndName{ + {t.Path(), "Path"}, + {t.Package(), "Package"}, + {t.Imports(), "Imports"}, + {t.Messages(), "Messages"}, + {t.Enums(), "Enums"}, + {t.Extensions(), "Extensions"}, + {t.Services(), "Services"}, }...) case protoreflect.MessageDescriptor: - rs.Append(rv, []methodAndName{ - {rv.MethodByName("IsMapEntry"), "IsMapEntry"}, - {rv.MethodByName("Fields"), "Fields"}, - {rv.MethodByName("Oneofs"), "Oneofs"}, - {rv.MethodByName("ReservedNames"), "ReservedNames"}, - {rv.MethodByName("ReservedRanges"), "ReservedRanges"}, - {rv.MethodByName("RequiredNumbers"), "RequiredNumbers"}, - {rv.MethodByName("ExtensionRanges"), "ExtensionRanges"}, - {rv.MethodByName("Messages"), "Messages"}, - {rv.MethodByName("Enums"), "Enums"}, - {rv.MethodByName("Extensions"), "Extensions"}, + rs.Append(rv, []attrAndName{ + {t.IsMapEntry(), "IsMapEntry"}, + {t.Fields(), "Fields"}, + {t.Oneofs(), "Oneofs"}, + {t.ReservedNames(), "ReservedNames"}, + {t.ReservedRanges(), "ReservedRanges"}, + {t.RequiredNumbers(), "RequiredNumbers"}, + {t.ExtensionRanges(), "ExtensionRanges"}, + {t.Messages(), "Messages"}, + {t.Enums(), "Enums"}, + {t.Extensions(), "Extensions"}, }...) case protoreflect.EnumDescriptor: - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Values"), "Values"}, - {rv.MethodByName("ReservedNames"), "ReservedNames"}, - {rv.MethodByName("ReservedRanges"), "ReservedRanges"}, - {rv.MethodByName("IsClosed"), "IsClosed"}, + rs.Append(rv, []attrAndName{ + {t.Values(), "Values"}, + {t.ReservedNames(), "ReservedNames"}, + {t.ReservedRanges(), "ReservedRanges"}, + {t.IsClosed(), "IsClosed"}, }...) case protoreflect.EnumValueDescriptor: - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Number"), "Number"}, - }...) + rs.Append(rv, attrAndName{t.Number(), "Number"}) case protoreflect.ServiceDescriptor: - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Methods"), "Methods"}, - }...) + rs.Append(rv, attrAndName{t.Methods(), "Methods"}) case protoreflect.MethodDescriptor: - rs.Append(rv, []methodAndName{ - {rv.MethodByName("Input"), "Input"}, - {rv.MethodByName("Output"), "Output"}, - {rv.MethodByName("IsStreamingClient"), "IsStreamingClient"}, - {rv.MethodByName("IsStreamingServer"), "IsStreamingServer"}, + rs.Append(rv, []attrAndName{ + {t.Input(), "Input"}, + {t.Output(), "Output"}, + {t.IsStreamingClient(), "IsStreamingClient"}, + {t.IsStreamingServer(), "IsStreamingServer"}, }...) } - if m := rv.MethodByName("GoType"); m.IsValid() { - rs.Append(rv, methodAndName{m, "GoType"}) + if m, ok := t.(interface{ GoType() reflect.Type }); ok { + rs.Append(rv, attrAndName{m.GoType(), "GoType"}) } } return start + rs.Join() + end @@ -297,68 +294,66 @@ func (rs *records) AppendRecs(fieldName string, newRecs [2]string) { rs.recs = append(rs.recs, newRecs) } -func (rs *records) Append(v reflect.Value, accessors ...methodAndName) { - for _, a := range accessors { - if rs.record != nil { - rs.record(a.name) - } - var rv reflect.Value - if a.method.IsValid() { - rv = a.method.Call(nil)[0] - } - if v.Kind() == reflect.Struct && !rv.IsValid() { - rv = v.FieldByName(a.name) - } - if !rv.IsValid() { - panic(fmt.Sprintf("unknown accessor: %v.%s", v.Type(), a.name)) - } - if _, ok := rv.Interface().(protoreflect.Value); ok { - rv = rv.MethodByName("Interface").Call(nil)[0] - if !rv.IsNil() { - rv = rv.Elem() - } - } +func (rs *records) Append(v reflect.Value, results ...attrAndName) { + for _, r := range results { + rs.appendAttribute(v, r.name, r.attr) + } +} - // Ignore zero values. - var isZero bool - switch rv.Kind() { - case reflect.Interface, reflect.Slice: - isZero = rv.IsNil() - case reflect.Bool: - isZero = rv.Bool() == false - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - isZero = rv.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - isZero = rv.Uint() == 0 - case reflect.String: - isZero = rv.String() == "" - } - if n, ok := rv.Interface().(list); ok { - isZero = n.Len() == 0 - } - if isZero { - continue +func (rs *records) appendAttribute(val reflect.Value, name string, attrVal any) { + if rs.record != nil { + rs.record(name) + } + if attrVal == nil { + return + } + rv := reflect.ValueOf(attrVal) + if _, ok := rv.Interface().(protoreflect.Value); ok { + rv = rv.MethodByName("Interface").Call(nil)[0] + if !rv.IsNil() { + rv = rv.Elem() } + } - // Format the value. - var s string - v := rv.Interface() - switch v := v.(type) { - case list: - s = formatListOpt(v, false, rs.allowMulti) - case protoreflect.FieldDescriptor, protoreflect.OneofDescriptor, protoreflect.EnumValueDescriptor, protoreflect.MethodDescriptor: - s = string(v.(protoreflect.Descriptor).Name()) - case protoreflect.Descriptor: - s = string(v.FullName()) - case string: - s = strconv.Quote(v) - case []byte: - s = fmt.Sprintf("%q", v) - default: - s = fmt.Sprint(v) - } - rs.recs = append(rs.recs, [2]string{a.name, s}) + // Ignore zero values. + var isZero bool + switch rv.Kind() { + case reflect.Interface, reflect.Slice: + isZero = rv.IsNil() + case reflect.Bool: + isZero = rv.Bool() == false + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + isZero = rv.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + isZero = rv.Uint() == 0 + case reflect.String: + isZero = rv.String() == "" + } + if n, ok := rv.Interface().(list); ok { + isZero = n.Len() == 0 + } + if isZero { + return + } + + // Format the value. + var s string + v := rv.Interface() + switch v := v.(type) { + case list: + s = formatListOpt(v, false, rs.allowMulti) + case protoreflect.FieldDescriptor, protoreflect.OneofDescriptor, protoreflect.EnumValueDescriptor, protoreflect.MethodDescriptor: + s = string(v.(protoreflect.Descriptor).Name()) + case protoreflect.Descriptor: + s = string(v.FullName()) + case string: + s = strconv.Quote(v) + case []byte: + s = fmt.Sprintf("%q", v) + default: + s = fmt.Sprint(v) } + rs.recs = append(rs.recs, [2]string{name, s}) } func (rs *records) Join() string { diff --git a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go index 669133d04d..c96e448346 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go @@ -32,7 +32,7 @@ var byteType = reflect.TypeOf(byte(0)) func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescriptors) protoreflect.FieldDescriptor { f := new(filedesc.Field) f.L0.ParentFile = filedesc.SurrogateProto2 - f.L1.EditionFeatures = f.L0.ParentFile.L1.EditionFeatures + packed := false for len(tag) > 0 { i := strings.IndexByte(tag, ',') if i < 0 { @@ -108,7 +108,7 @@ func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescri f.L1.StringName.InitJSON(jsonName) } case s == "packed": - f.L1.EditionFeatures.IsPacked = true + packed = true case strings.HasPrefix(s, "def="): // The default tag is special in that everything afterwards is the // default regardless of the presence of commas. @@ -121,6 +121,13 @@ func Unmarshal(tag string, goType reflect.Type, evs protoreflect.EnumValueDescri tag = strings.TrimPrefix(tag[i:], ",") } + // Update EditionFeatures after the loop and after we know whether this is + // a proto2 or proto3 field. + f.L1.EditionFeatures = f.L0.ParentFile.L1.EditionFeatures + if packed { + f.L1.EditionFeatures.IsPacked = true + } + // The generator uses the group message name instead of the field name. // We obtain the real field name by lowercasing the group name. if f.L1.Kind == protoreflect.GroupKind { diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go index 099b2bf451..9aa7a9bb77 100644 --- a/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +++ b/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go @@ -424,27 +424,34 @@ func (d *Decoder) parseFieldName() (tok Token, err error) { return Token{}, d.newSyntaxError("invalid field name: %s", errId(d.in)) } -// parseTypeName parses Any type URL or extension field name. The name is -// enclosed in [ and ] characters. The C++ parser does not handle many legal URL -// strings. This implementation is more liberal and allows for the pattern -// ^[-_a-zA-Z0-9]+([./][-_a-zA-Z0-9]+)*`). Whitespaces and comments are allowed -// in between [ ], '.', '/' and the sub names. +// parseTypeName parses an Any type URL or an extension field name. The name is +// enclosed in [ and ] characters. We allow almost arbitrary type URL prefixes, +// closely following the text-format spec [1,2]. We implement "ExtensionName | +// AnyName" as follows (with some exceptions for backwards compatibility): +// +// char = [-_a-zA-Z0-9] +// url_char = char | [.~!$&'()*+,;=] | "%", hex, hex +// +// Ident = char, { char } +// TypeName = Ident, { ".", Ident } ; +// UrlPrefix = url_char, { url_char | "/" } ; +// ExtensionName = "[", TypeName, "]" ; +// AnyName = "[", UrlPrefix, "/", TypeName, "]" ; +// +// Additionally, we allow arbitrary whitespace and comments between [ and ]. +// +// [1] https://protobuf.dev/reference/protobuf/textformat-spec/#characters +// [2] https://protobuf.dev/reference/protobuf/textformat-spec/#field-names func (d *Decoder) parseTypeName() (Token, error) { - startPos := len(d.orig) - len(d.in) // Use alias s to advance first in order to use d.in for error handling. - // Caller already checks for [ as first character. + // Caller already checks for [ as first character (d.in[0] == '['). s := consume(d.in[1:], 0) if len(s) == 0 { return Token{}, ErrUnexpectedEOF } + // Collect everything between [ and ] in name. var name []byte - for len(s) > 0 && isTypeNameChar(s[0]) { - name = append(name, s[0]) - s = s[1:] - } - s = consume(s, 0) - var closed bool for len(s) > 0 && !closed { switch { @@ -452,23 +459,20 @@ func (d *Decoder) parseTypeName() (Token, error) { s = s[1:] closed = true - case s[0] == '/', s[0] == '.': - if len(name) > 0 && (name[len(name)-1] == '/' || name[len(name)-1] == '.') { - return Token{}, d.newSyntaxError("invalid type URL/extension field name: %s", - d.orig[startPos:len(d.orig)-len(s)+1]) - } + case s[0] == '/' || isTypeNameChar(s[0]) || isUrlExtraChar(s[0]): name = append(name, s[0]) - s = s[1:] - s = consume(s, 0) - for len(s) > 0 && isTypeNameChar(s[0]) { - name = append(name, s[0]) - s = s[1:] + s = consume(s[1:], 0) + + // URL percent-encoded chars + case s[0] == '%': + if len(s) < 3 || !isHexChar(s[1]) || !isHexChar(s[2]) { + return Token{}, d.parseTypeNameError(s, 3) } - s = consume(s, 0) + name = append(name, s[0], s[1], s[2]) + s = consume(s[3:], 0) default: - return Token{}, d.newSyntaxError( - "invalid type URL/extension field name: %s", d.orig[startPos:len(d.orig)-len(s)+1]) + return Token{}, d.parseTypeNameError(s, 1) } } @@ -476,15 +480,38 @@ func (d *Decoder) parseTypeName() (Token, error) { return Token{}, ErrUnexpectedEOF } - // First character cannot be '.'. Last character cannot be '.' or '/'. - size := len(name) - if size == 0 || name[0] == '.' || name[size-1] == '.' || name[size-1] == '/' { - return Token{}, d.newSyntaxError("invalid type URL/extension field name: %s", - d.orig[startPos:len(d.orig)-len(s)]) + // Split collected name on last '/' into urlPrefix and typeName (if '/' is + // present). + typeName := name + if i := bytes.LastIndexByte(name, '/'); i != -1 { + urlPrefix := name[:i] + typeName = name[i+1:] + + // urlPrefix may be empty (for backwards compatibility). + // If non-empty, it must not start with '/'. + if len(urlPrefix) > 0 && urlPrefix[0] == '/' { + return Token{}, d.parseTypeNameError(s, 0) + } } + // typeName must not be empty (note: "" splits to [""]) and all identifier + // parts must not be empty. + for _, ident := range bytes.Split(typeName, []byte{'.'}) { + if len(ident) == 0 { + return Token{}, d.parseTypeNameError(s, 0) + } + } + + // typeName must not contain any percent-encoded or special URL chars. + for _, b := range typeName { + if b == '%' || (b != '.' && isUrlExtraChar(b)) { + return Token{}, d.parseTypeNameError(s, 0) + } + } + + startPos := len(d.orig) - len(d.in) + endPos := len(d.orig) - len(s) d.in = s - endPos := len(d.orig) - len(d.in) d.consume(0) return Token{ @@ -496,16 +523,32 @@ func (d *Decoder) parseTypeName() (Token, error) { }, nil } +func (d *Decoder) parseTypeNameError(s []byte, numUnconsumedChars int) error { + return d.newSyntaxError( + "invalid type URL/extension field name: %s", + d.in[:len(d.in)-len(s)+min(numUnconsumedChars, len(s))], + ) +} + +func isHexChar(b byte) bool { + return ('0' <= b && b <= '9') || + ('a' <= b && b <= 'f') || + ('A' <= b && b <= 'F') +} + func isTypeNameChar(b byte) bool { - return (b == '-' || b == '_' || + return b == '-' || b == '_' || ('0' <= b && b <= '9') || ('a' <= b && b <= 'z') || - ('A' <= b && b <= 'Z')) + ('A' <= b && b <= 'Z') } -func isWhiteSpace(b byte) bool { +// isUrlExtraChar complements isTypeNameChar with extra characters that we allow +// in URLs but not in type names. Note that '/' is not included so that it can +// be treated specially. +func isUrlExtraChar(b byte) bool { switch b { - case ' ', '\n', '\r', '\t': + case '.', '~', '!', '$', '&', '(', ')', '*', '+', ',', ';', '=': return true default: return false diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go index dbcf90b871..c775e5832f 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc.go @@ -32,6 +32,7 @@ const ( EditionProto3 Edition = 999 Edition2023 Edition = 1000 Edition2024 Edition = 1001 + EditionUnstable Edition = 9999 EditionUnsupported Edition = 100000 ) diff --git a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go index dd31faaeb0..78f02b1b49 100644 --- a/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +++ b/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go @@ -330,7 +330,6 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) { md.L1.Extensions.List[extensionIdx].unmarshalFull(v, sb) extensionIdx++ case genid.DescriptorProto_Options_field_number: - md.unmarshalOptions(v) rawOptions = appendOptions(rawOptions, v) } default: @@ -356,27 +355,6 @@ func (md *Message) unmarshalFull(b []byte, sb *strs.Builder) { md.L2.Options = md.L0.ParentFile.builder.optionsUnmarshaler(&descopts.Message, rawOptions) } -func (md *Message) unmarshalOptions(b []byte) { - for len(b) > 0 { - num, typ, n := protowire.ConsumeTag(b) - b = b[n:] - switch typ { - case protowire.VarintType: - v, m := protowire.ConsumeVarint(b) - b = b[m:] - switch num { - case genid.MessageOptions_MapEntry_field_number: - md.L1.IsMapEntry = protowire.DecodeBool(v) - case genid.MessageOptions_MessageSetWireFormat_field_number: - md.L1.IsMessageSet = protowire.DecodeBool(v) - } - default: - m := protowire.ConsumeFieldValue(num, typ, b) - b = b[m:] - } - } -} - func unmarshalMessageReservedRange(b []byte) (r [2]protoreflect.FieldNumber) { for len(b) > 0 { num, typ, n := protowire.ConsumeTag(b) diff --git a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go index 950a6a325a..65aaf4d210 100644 --- a/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +++ b/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go @@ -26,6 +26,7 @@ const ( Edition_EDITION_PROTO3_enum_value = 999 Edition_EDITION_2023_enum_value = 1000 Edition_EDITION_2024_enum_value = 1001 + Edition_EDITION_UNSTABLE_enum_value = 9999 Edition_EDITION_1_TEST_ONLY_enum_value = 1 Edition_EDITION_2_TEST_ONLY_enum_value = 2 Edition_EDITION_99997_TEST_ONLY_enum_value = 99997 diff --git a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go index 229c698013..4a3bf393ef 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +++ b/vendor/google.golang.org/protobuf/internal/impl/codec_map.go @@ -113,6 +113,9 @@ func sizeMap(mapv reflect.Value, mapi *mapInfo, f *coderFieldInfo, opts marshalO } func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { + if opts.depth--; opts.depth < 0 { + return out, errRecursionDepth + } if wtyp != protowire.BytesType { return out, errUnknown } @@ -170,6 +173,9 @@ func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo } func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) { + if opts.depth--; opts.depth < 0 { + return out, errRecursionDepth + } if wtyp != protowire.BytesType { return out, errUnknown } diff --git a/vendor/google.golang.org/protobuf/internal/impl/decode.go b/vendor/google.golang.org/protobuf/internal/impl/decode.go index e0dd21fa5f..1228b5c8c2 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/decode.go +++ b/vendor/google.golang.org/protobuf/internal/impl/decode.go @@ -102,8 +102,7 @@ var errUnknown = errors.New("unknown") func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) { mi.init() - opts.depth-- - if opts.depth < 0 { + if opts.depth--; opts.depth < 0 { return out, errRecursionDepth } if flags.ProtoLegacy && mi.isMessageSet { diff --git a/vendor/google.golang.org/protobuf/internal/impl/validate.go b/vendor/google.golang.org/protobuf/internal/impl/validate.go index 7b2995dde5..99a1eb95f7 100644 --- a/vendor/google.golang.org/protobuf/internal/impl/validate.go +++ b/vendor/google.golang.org/protobuf/internal/impl/validate.go @@ -68,9 +68,13 @@ func Validate(mt protoreflect.MessageType, in protoiface.UnmarshalInput) (out pr if in.Resolver == nil { in.Resolver = protoregistry.GlobalTypes } + if in.Depth == 0 { + in.Depth = protowire.DefaultRecursionLimit + } o, st := mi.validate(in.Buf, 0, unmarshalOptions{ flags: in.Flags, resolver: in.Resolver, + depth: in.Depth, }) if o.initialized { out.Flags |= protoiface.UnmarshalInitialized @@ -257,6 +261,9 @@ func (mi *MessageInfo) validate(b []byte, groupTag protowire.Number, opts unmars states[0].typ = validationTypeGroup states[0].endGroup = groupTag } + if opts.depth--; opts.depth < 0 { + return out, ValidationInvalid + } initialized := true start := len(b) State: @@ -451,6 +458,13 @@ State: mi: vi.mi, tail: b, }) + if vi.typ == validationTypeMessage || + vi.typ == validationTypeGroup || + vi.typ == validationTypeMap { + if opts.depth--; opts.depth < 0 { + return out, ValidationInvalid + } + } b = v continue State case validationTypeRepeatedVarint: @@ -499,6 +513,9 @@ State: mi: vi.mi, endGroup: num, }) + if opts.depth--; opts.depth < 0 { + return out, ValidationInvalid + } continue State case flags.ProtoLegacy && vi.typ == validationTypeMessageSetItem: typeid, v, n, err := messageset.ConsumeFieldValue(b, false) @@ -521,6 +538,13 @@ State: mi: xvi.mi, tail: b[n:], }) + if xvi.typ == validationTypeMessage || + xvi.typ == validationTypeGroup || + xvi.typ == validationTypeMap { + if opts.depth--; opts.depth < 0 { + return out, ValidationInvalid + } + } b = v continue State } @@ -547,12 +571,14 @@ State: switch st.typ { case validationTypeMessage, validationTypeGroup: numRequiredFields = int(st.mi.numRequiredFields) + opts.depth++ case validationTypeMap: // If this is a map field with a message value that contains // required fields, require that the value be present. if st.mi != nil && st.mi.numRequiredFields > 0 { numRequiredFields = 1 } + opts.depth++ } // If there are more than 64 required fields, this check will // always fail and we will report that the message is potentially diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go index 77de0f238c..bfb2cfdea5 100644 --- a/vendor/google.golang.org/protobuf/internal/version/version.go +++ b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -52,8 +52,8 @@ import ( const ( Major = 1 Minor = 36 - Patch = 10 - PreRelease = "" + Patch = 11 + PreRelease = "devel" ) // String formats the version string for this module in semver format. diff --git a/vendor/google.golang.org/protobuf/proto/decode.go b/vendor/google.golang.org/protobuf/proto/decode.go index 4cbf1aeaf7..889d8511d2 100644 --- a/vendor/google.golang.org/protobuf/proto/decode.go +++ b/vendor/google.golang.org/protobuf/proto/decode.go @@ -121,9 +121,8 @@ func (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out proto out, err = methods.Unmarshal(in) } else { - o.RecursionLimit-- - if o.RecursionLimit < 0 { - return out, errors.New("exceeded max recursion depth") + if o.RecursionLimit--; o.RecursionLimit < 0 { + return out, errRecursionDepth } err = o.unmarshalMessageSlow(b, m) } @@ -220,6 +219,9 @@ func (o UnmarshalOptions) unmarshalSingular(b []byte, wtyp protowire.Type, m pro } func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv protoreflect.Map, fd protoreflect.FieldDescriptor) (n int, err error) { + if o.RecursionLimit--; o.RecursionLimit < 0 { + return 0, errRecursionDepth + } if wtyp != protowire.BytesType { return 0, errUnknown } @@ -305,3 +307,5 @@ func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv proto var errUnknown = errors.New("BUG: internal error (unknown)") var errDecode = errors.New("cannot parse invalid wire-format data") + +var errRecursionDepth = errors.New("exceeded maximum recursion depth") diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go index 9196288e4a..40f17af4e3 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go @@ -108,7 +108,9 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot if f.L1.Path == "" { return nil, errors.New("file path must be populated") } - if f.L1.Syntax == protoreflect.Editions && (fd.GetEdition() < editionssupport.Minimum || fd.GetEdition() > editionssupport.Maximum) { + if f.L1.Syntax == protoreflect.Editions && + (fd.GetEdition() < editionssupport.Minimum || fd.GetEdition() > editionssupport.Maximum) && + fd.GetEdition() != descriptorpb.Edition_EDITION_UNSTABLE { // Allow cmd/protoc-gen-go/testdata to use any edition for easier // testing of upcoming edition features. if !strings.HasPrefix(fd.GetName(), "cmd/protoc-gen-go/testdata/") { @@ -152,6 +154,7 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot imp := &f.L2.Imports[i] imps.importPublic(imp.Imports()) } + optionImps := importSet{f.Path(): true} if len(fd.GetOptionDependency()) > 0 { optionImports := make(filedesc.FileImports, len(fd.GetOptionDependency())) for i, path := range fd.GetOptionDependency() { @@ -165,10 +168,12 @@ func (o FileOptions) New(fd *descriptorpb.FileDescriptorProto, r Resolver) (prot } imp.FileDescriptor = f - if imps[imp.Path()] { + if imps[imp.Path()] || optionImps[imp.Path()] { return nil, errors.New("already imported %q", path) } - imps[imp.Path()] = true + // This needs to be a separate map so that we don't recognize non-options + // symbols coming from option imports. + optionImps[imp.Path()] = true } f.L2.OptionImports = func() protoreflect.FileImports { return &optionImports diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go index c826ad0430..84a3228edb 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go @@ -201,6 +201,7 @@ func (r descsByName) initExtensionDeclarations(xds []*descriptorpb.FieldDescript return nil, err } x.L1.EditionFeatures = mergeEditionFeatures(parent, xd.GetOptions().GetFeatures()) + x.L2.IsProto3Optional = xd.GetProto3Optional() if opts := xd.GetOptions(); opts != nil { opts = proto.Clone(opts).(*descriptorpb.FieldOptions) x.L2.Options = func() protoreflect.ProtoMessage { return opts } diff --git a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go index 697a61b290..147b8c7398 100644 --- a/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go +++ b/vendor/google.golang.org/protobuf/reflect/protodesc/editions.go @@ -46,6 +46,8 @@ func toEditionProto(ed filedesc.Edition) descriptorpb.Edition { return descriptorpb.Edition_EDITION_2023 case filedesc.Edition2024: return descriptorpb.Edition_EDITION_2024 + case filedesc.EditionUnstable: + return descriptorpb.Edition_EDITION_UNSTABLE default: panic(fmt.Sprintf("unknown value for edition: %v", ed)) } @@ -58,7 +60,7 @@ func getFeatureSetFor(ed filedesc.Edition) *descriptorpb.FeatureSet { return def } edpb := toEditionProto(ed) - if defaults.GetMinimumEdition() > edpb || defaults.GetMaximumEdition() < edpb { + if (defaults.GetMinimumEdition() > edpb || defaults.GetMaximumEdition() < edpb) && edpb != descriptorpb.Edition_EDITION_UNSTABLE { // This should never happen protodesc.(FileOptions).New would fail when // initializing the file descriptor. // This most likely means the embedded defaults were not updated. diff --git a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go index 4eacb523c3..0b23faa957 100644 --- a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +++ b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go @@ -69,6 +69,8 @@ const ( // comparison. Edition_EDITION_2023 Edition = 1000 Edition_EDITION_2024 Edition = 1001 + // A placeholder edition for developing and testing unscheduled features. + Edition_EDITION_UNSTABLE Edition = 9999 // Placeholder editions for testing feature resolution. These should not be // used or relied on outside of tests. Edition_EDITION_1_TEST_ONLY Edition = 1 @@ -91,6 +93,7 @@ var ( 999: "EDITION_PROTO3", 1000: "EDITION_2023", 1001: "EDITION_2024", + 9999: "EDITION_UNSTABLE", 1: "EDITION_1_TEST_ONLY", 2: "EDITION_2_TEST_ONLY", 99997: "EDITION_99997_TEST_ONLY", @@ -105,6 +108,7 @@ var ( "EDITION_PROTO3": 999, "EDITION_2023": 1000, "EDITION_2024": 1001, + "EDITION_UNSTABLE": 9999, "EDITION_1_TEST_ONLY": 1, "EDITION_2_TEST_ONLY": 2, "EDITION_99997_TEST_ONLY": 99997, @@ -4793,11 +4797,11 @@ const file_google_protobuf_descriptor_proto_rawDesc = "" + "\x18EnumValueDescriptorProto\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" + "\x06number\x18\x02 \x01(\x05R\x06number\x12;\n" + - "\aoptions\x18\x03 \x01(\v2!.google.protobuf.EnumValueOptionsR\aoptions\"\xa7\x01\n" + + "\aoptions\x18\x03 \x01(\v2!.google.protobuf.EnumValueOptionsR\aoptions\"\xb5\x01\n" + "\x16ServiceDescriptorProto\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12>\n" + "\x06method\x18\x02 \x03(\v2&.google.protobuf.MethodDescriptorProtoR\x06method\x129\n" + - "\aoptions\x18\x03 \x01(\v2\x1f.google.protobuf.ServiceOptionsR\aoptions\"\x89\x02\n" + + "\aoptions\x18\x03 \x01(\v2\x1f.google.protobuf.ServiceOptionsR\aoptionsJ\x04\b\x04\x10\x05R\x06stream\"\x89\x02\n" + "\x15MethodDescriptorProto\x12\x12\n" + "\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" + "\n" + @@ -5033,14 +5037,15 @@ const file_google_protobuf_descriptor_proto_rawDesc = "" + "\bSemantic\x12\b\n" + "\x04NONE\x10\x00\x12\a\n" + "\x03SET\x10\x01\x12\t\n" + - "\x05ALIAS\x10\x02*\xa7\x02\n" + + "\x05ALIAS\x10\x02*\xbe\x02\n" + "\aEdition\x12\x13\n" + "\x0fEDITION_UNKNOWN\x10\x00\x12\x13\n" + "\x0eEDITION_LEGACY\x10\x84\a\x12\x13\n" + "\x0eEDITION_PROTO2\x10\xe6\a\x12\x13\n" + "\x0eEDITION_PROTO3\x10\xe7\a\x12\x11\n" + "\fEDITION_2023\x10\xe8\a\x12\x11\n" + - "\fEDITION_2024\x10\xe9\a\x12\x17\n" + + "\fEDITION_2024\x10\xe9\a\x12\x15\n" + + "\x10EDITION_UNSTABLE\x10\x8fN\x12\x17\n" + "\x13EDITION_1_TEST_ONLY\x10\x01\x12\x17\n" + "\x13EDITION_2_TEST_ONLY\x10\x02\x12\x1d\n" + "\x17EDITION_99997_TEST_ONLY\x10\x9d\x8d\x06\x12\x1d\n" + diff --git a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go index 06d584c14b..484c21fd53 100644 --- a/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go +++ b/vendor/google.golang.org/protobuf/types/known/timestamppb/timestamp.pb.go @@ -172,13 +172,14 @@ import ( // ) to obtain a formatter capable of generating timestamps in this format. type Timestamp struct { state protoimpl.MessageState `protogen:"open.v1"` - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. + // Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must + // be between -315576000000 and 315576000000 inclusive (which corresponds to + // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). Seconds int64 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"` - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 + // Non-negative fractions of a second at nanosecond resolution. This field is + // the nanosecond portion of the duration, not an alternative to seconds. + // Negative second values with fractions must still have non-negative nanos + // values that count forward in time. Must be between 0 and 999,999,999 // inclusive. Nanos int32 `protobuf:"varint,2,opt,name=nanos,proto3" json:"nanos,omitempty"` unknownFields protoimpl.UnknownFields diff --git a/vendor/k8s.io/api/admission/v1/generated.proto b/vendor/k8s.io/api/admission/v1/generated.proto index cd5c88badc..38a0fcea60 100644 --- a/vendor/k8s.io/api/admission/v1/generated.proto +++ b/vendor/k8s.io/api/admission/v1/generated.proto @@ -35,12 +35,15 @@ message AdmissionRequest { // otherwise identical (parallel requests, requests when earlier requests did not modify etc) // The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request. // It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging. + // +optional optional string uid = 1; // kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale) + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind kind = 2; // resource is the fully-qualified resource being requested (for example, v1.pods) + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionResource resource = 3; // subResource is the subresource being requested, if any (for example, "status" or "scale") @@ -90,9 +93,11 @@ message AdmissionRequest { // operation is the operation being performed. This may be different than the operation // requested. e.g. a patch can result in either a CREATE or UPDATE Operation. + // +optional optional string operation = 7; // userInfo is information about the requesting user + // +optional optional .k8s.io.api.authentication.v1.UserInfo userInfo = 8; // object is the object from the incoming request. @@ -121,9 +126,11 @@ message AdmissionRequest { message AdmissionResponse { // uid is an identifier for the individual request/response. // This must be copied over from the corresponding AdmissionRequest. + // +optional optional string uid = 1; // allowed indicates whether or not the admission request was permitted. + // +optional optional bool allowed = 2; // status is the result contains extra details into why an admission request was denied. diff --git a/vendor/k8s.io/api/admission/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/admission/v1/generated.protomessage.pb.go deleted file mode 100644 index 4e1ec547d6..0000000000 --- a/vendor/k8s.io/api/admission/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*AdmissionRequest) ProtoMessage() {} - -func (*AdmissionResponse) ProtoMessage() {} - -func (*AdmissionReview) ProtoMessage() {} diff --git a/vendor/k8s.io/api/admission/v1/types.go b/vendor/k8s.io/api/admission/v1/types.go index 395672c390..34cbf2f59b 100644 --- a/vendor/k8s.io/api/admission/v1/types.go +++ b/vendor/k8s.io/api/admission/v1/types.go @@ -43,10 +43,13 @@ type AdmissionRequest struct { // otherwise identical (parallel requests, requests when earlier requests did not modify etc) // The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request. // It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging. + // +optional UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"` // kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale) + // +optional Kind metav1.GroupVersionKind `json:"kind" protobuf:"bytes,2,opt,name=kind"` // resource is the fully-qualified resource being requested (for example, v1.pods) + // +optional Resource metav1.GroupVersionResource `json:"resource" protobuf:"bytes,3,opt,name=resource"` // subResource is the subresource being requested, if any (for example, "status" or "scale") // +optional @@ -91,8 +94,10 @@ type AdmissionRequest struct { Namespace string `json:"namespace,omitempty" protobuf:"bytes,6,opt,name=namespace"` // operation is the operation being performed. This may be different than the operation // requested. e.g. a patch can result in either a CREATE or UPDATE Operation. + // +optional Operation Operation `json:"operation" protobuf:"bytes,7,opt,name=operation"` // userInfo is information about the requesting user + // +optional UserInfo authenticationv1.UserInfo `json:"userInfo" protobuf:"bytes,8,opt,name=userInfo"` // object is the object from the incoming request. // +optional @@ -117,9 +122,11 @@ type AdmissionRequest struct { type AdmissionResponse struct { // uid is an identifier for the individual request/response. // This must be copied over from the corresponding AdmissionRequest. + // +optional UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"` // allowed indicates whether or not the admission request was permitted. + // +optional Allowed bool `json:"allowed" protobuf:"varint,2,opt,name=allowed"` // status is the result contains extra details into why an admission request was denied. diff --git a/vendor/k8s.io/api/admission/v1beta1/generated.proto b/vendor/k8s.io/api/admission/v1beta1/generated.proto index 5af234993a..9514719baf 100644 --- a/vendor/k8s.io/api/admission/v1beta1/generated.proto +++ b/vendor/k8s.io/api/admission/v1beta1/generated.proto @@ -35,12 +35,15 @@ message AdmissionRequest { // otherwise identical (parallel requests, requests when earlier requests did not modify etc) // The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request. // It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging. + // +optional optional string uid = 1; // kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale) + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionKind kind = 2; // resource is the fully-qualified resource being requested (for example, v1.pods) + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.GroupVersionResource resource = 3; // subResource is the subresource being requested, if any (for example, "status" or "scale") @@ -90,9 +93,11 @@ message AdmissionRequest { // operation is the operation being performed. This may be different than the operation // requested. e.g. a patch can result in either a CREATE or UPDATE Operation. + // +optional optional string operation = 7; // userInfo is information about the requesting user + // +optional optional .k8s.io.api.authentication.v1.UserInfo userInfo = 8; // object is the object from the incoming request. @@ -121,9 +126,11 @@ message AdmissionRequest { message AdmissionResponse { // uid is an identifier for the individual request/response. // This should be copied over from the corresponding AdmissionRequest. + // +optional optional string uid = 1; // allowed indicates whether or not the admission request was permitted. + // +optional optional bool allowed = 2; // status is the result contains extra details into why an admission request was denied. diff --git a/vendor/k8s.io/api/admission/v1beta1/types.go b/vendor/k8s.io/api/admission/v1beta1/types.go index 81941eb325..015dc8ba3e 100644 --- a/vendor/k8s.io/api/admission/v1beta1/types.go +++ b/vendor/k8s.io/api/admission/v1beta1/types.go @@ -47,10 +47,13 @@ type AdmissionRequest struct { // otherwise identical (parallel requests, requests when earlier requests did not modify etc) // The UID is meant to track the round trip (request/response) between the KAS and the WebHook, not the user request. // It is suitable for correlating log entries between the webhook and apiserver, for either auditing or debugging. + // +optional UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"` // kind is the fully-qualified type of object being submitted (for example, v1.Pod or autoscaling.v1.Scale) + // +optional Kind metav1.GroupVersionKind `json:"kind" protobuf:"bytes,2,opt,name=kind"` // resource is the fully-qualified resource being requested (for example, v1.pods) + // +optional Resource metav1.GroupVersionResource `json:"resource" protobuf:"bytes,3,opt,name=resource"` // subResource is the subresource being requested, if any (for example, "status" or "scale") // +optional @@ -95,8 +98,10 @@ type AdmissionRequest struct { Namespace string `json:"namespace,omitempty" protobuf:"bytes,6,opt,name=namespace"` // operation is the operation being performed. This may be different than the operation // requested. e.g. a patch can result in either a CREATE or UPDATE Operation. + // +optional Operation Operation `json:"operation" protobuf:"bytes,7,opt,name=operation"` // userInfo is information about the requesting user + // +optional UserInfo authenticationv1.UserInfo `json:"userInfo" protobuf:"bytes,8,opt,name=userInfo"` // object is the object from the incoming request. // +optional @@ -121,9 +126,11 @@ type AdmissionRequest struct { type AdmissionResponse struct { // uid is an identifier for the individual request/response. // This should be copied over from the corresponding AdmissionRequest. + // +optional UID types.UID `json:"uid" protobuf:"bytes,1,opt,name=uid"` // allowed indicates whether or not the admission request was permitted. + // +optional Allowed bool `json:"allowed" protobuf:"varint,2,opt,name=allowed"` // status is the result contains extra details into why an admission request was denied. diff --git a/vendor/k8s.io/api/admissionregistration/v1/generated.pb.go b/vendor/k8s.io/api/admissionregistration/v1/generated.pb.go index 91b2f1cbae..e2def5040c 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/generated.pb.go +++ b/vendor/k8s.io/api/admissionregistration/v1/generated.pb.go @@ -32,20 +32,38 @@ import ( strings "strings" ) +func (m *ApplyConfiguration) Reset() { *m = ApplyConfiguration{} } + func (m *AuditAnnotation) Reset() { *m = AuditAnnotation{} } func (m *ExpressionWarning) Reset() { *m = ExpressionWarning{} } +func (m *JSONPatch) Reset() { *m = JSONPatch{} } + func (m *MatchCondition) Reset() { *m = MatchCondition{} } func (m *MatchResources) Reset() { *m = MatchResources{} } +func (m *MutatingAdmissionPolicy) Reset() { *m = MutatingAdmissionPolicy{} } + +func (m *MutatingAdmissionPolicyBinding) Reset() { *m = MutatingAdmissionPolicyBinding{} } + +func (m *MutatingAdmissionPolicyBindingList) Reset() { *m = MutatingAdmissionPolicyBindingList{} } + +func (m *MutatingAdmissionPolicyBindingSpec) Reset() { *m = MutatingAdmissionPolicyBindingSpec{} } + +func (m *MutatingAdmissionPolicyList) Reset() { *m = MutatingAdmissionPolicyList{} } + +func (m *MutatingAdmissionPolicySpec) Reset() { *m = MutatingAdmissionPolicySpec{} } + func (m *MutatingWebhook) Reset() { *m = MutatingWebhook{} } func (m *MutatingWebhookConfiguration) Reset() { *m = MutatingWebhookConfiguration{} } func (m *MutatingWebhookConfigurationList) Reset() { *m = MutatingWebhookConfigurationList{} } +func (m *Mutation) Reset() { *m = Mutation{} } + func (m *NamedRuleWithOperations) Reset() { *m = NamedRuleWithOperations{} } func (m *ParamKind) Reset() { *m = ParamKind{} } @@ -86,6 +104,34 @@ func (m *Variable) Reset() { *m = Variable{} } func (m *WebhookClientConfig) Reset() { *m = WebhookClientConfig{} } +func (m *ApplyConfiguration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ApplyConfiguration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ApplyConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Expression) + copy(dAtA[i:], m.Expression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *AuditAnnotation) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -152,6 +198,34 @@ func (m *ExpressionWarning) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *JSONPatch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *JSONPatch) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *JSONPatch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Expression) + copy(dAtA[i:], m.Expression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *MatchCondition) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -267,7 +341,7 @@ func (m *MatchResources) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MutatingWebhook) Marshal() (dAtA []byte, err error) { +func (m *MutatingAdmissionPolicy) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -277,112 +351,18 @@ func (m *MutatingWebhook) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MutatingWebhook) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicy) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MutatingWebhook) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.MatchConditions) > 0 { - for iNdEx := len(m.MatchConditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MatchConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x62 - } - } - if m.ObjectSelector != nil { - { - size, err := m.ObjectSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a - } - if m.ReinvocationPolicy != nil { - i -= len(*m.ReinvocationPolicy) - copy(dAtA[i:], *m.ReinvocationPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ReinvocationPolicy))) - i-- - dAtA[i] = 0x52 - } - if m.MatchPolicy != nil { - i -= len(*m.MatchPolicy) - copy(dAtA[i:], *m.MatchPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.MatchPolicy))) - i-- - dAtA[i] = 0x4a - } - if len(m.AdmissionReviewVersions) > 0 { - for iNdEx := len(m.AdmissionReviewVersions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AdmissionReviewVersions[iNdEx]) - copy(dAtA[i:], m.AdmissionReviewVersions[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.AdmissionReviewVersions[iNdEx]))) - i-- - dAtA[i] = 0x42 - } - } - if m.TimeoutSeconds != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.TimeoutSeconds)) - i-- - dAtA[i] = 0x38 - } - if m.SideEffects != nil { - i -= len(*m.SideEffects) - copy(dAtA[i:], *m.SideEffects) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.SideEffects))) - i-- - dAtA[i] = 0x32 - } - if m.NamespaceSelector != nil { - { - size, err := m.NamespaceSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.FailurePolicy != nil { - i -= len(*m.FailurePolicy) - copy(dAtA[i:], *m.FailurePolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.FailurePolicy))) - i-- - dAtA[i] = 0x22 - } - if len(m.Rules) > 0 { - for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } { - size, err := m.ClientConfig.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -391,15 +371,20 @@ func (m *MutatingWebhook) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *MutatingWebhookConfiguration) Marshal() (dAtA []byte, err error) { +func (m *MutatingAdmissionPolicyBinding) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -409,30 +394,26 @@ func (m *MutatingWebhookConfiguration) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MutatingWebhookConfiguration) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyBinding) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MutatingWebhookConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Webhooks) > 0 { - for iNdEx := len(m.Webhooks) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Webhooks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 { size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -446,7 +427,7 @@ func (m *MutatingWebhookConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *MutatingWebhookConfigurationList) Marshal() (dAtA []byte, err error) { +func (m *MutatingAdmissionPolicyBindingList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -456,12 +437,12 @@ func (m *MutatingWebhookConfigurationList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MutatingWebhookConfigurationList) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyBindingList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MutatingWebhookConfigurationList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyBindingList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -493,7 +474,7 @@ func (m *MutatingWebhookConfigurationList) MarshalToSizedBuffer(dAtA []byte) (in return len(dAtA) - i, nil } -func (m *NamedRuleWithOperations) Marshal() (dAtA []byte, err error) { +func (m *MutatingAdmissionPolicyBindingSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -503,39 +484,49 @@ func (m *NamedRuleWithOperations) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *NamedRuleWithOperations) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyBindingSpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *NamedRuleWithOperations) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyBindingSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.RuleWithOperations.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.MatchResources != nil { + { + size, err := m.MatchResources.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0x12 - if len(m.ResourceNames) > 0 { - for iNdEx := len(m.ResourceNames) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ResourceNames[iNdEx]) - copy(dAtA[i:], m.ResourceNames[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceNames[iNdEx]))) - i-- - dAtA[i] = 0xa + if m.ParamRef != nil { + { + size, err := m.ParamRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } + i -= len(m.PolicyName) + copy(dAtA[i:], m.PolicyName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PolicyName))) + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ParamKind) Marshal() (dAtA []byte, err error) { +func (m *MutatingAdmissionPolicyList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -545,31 +536,45 @@ func (m *ParamKind) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ParamKind) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ParamKind) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicyList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0x12 - i -= len(m.APIVersion) - copy(dAtA[i:], m.APIVersion) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ParamRef) Marshal() (dAtA []byte, err error) { - size := m.Size() + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MutatingAdmissionPolicySpec) Marshal() (dAtA []byte, err error) { + size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { @@ -578,26 +583,73 @@ func (m *ParamRef) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ParamRef) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicySpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ParamRef) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingAdmissionPolicySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ParameterNotFoundAction != nil { - i -= len(*m.ParameterNotFoundAction) - copy(dAtA[i:], *m.ParameterNotFoundAction) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ParameterNotFoundAction))) + i -= len(m.ReinvocationPolicy) + copy(dAtA[i:], m.ReinvocationPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ReinvocationPolicy))) + i-- + dAtA[i] = 0x3a + if len(m.MatchConditions) > 0 { + for iNdEx := len(m.MatchConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MatchConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.FailurePolicy != nil { + i -= len(*m.FailurePolicy) + copy(dAtA[i:], *m.FailurePolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.FailurePolicy))) i-- - dAtA[i] = 0x22 + dAtA[i] = 0x2a } - if m.Selector != nil { + if len(m.Mutations) > 0 { + for iNdEx := len(m.Mutations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Mutations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Variables) > 0 { + for iNdEx := len(m.Variables) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Variables[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if m.MatchConstraints != nil { { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.MatchConstraints.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -605,22 +657,24 @@ func (m *ParamRef) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 + } + if m.ParamKind != nil { + { + size, err := m.ParamKind.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *Rule) Marshal() (dAtA []byte, err error) { +func (m *MutatingWebhook) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -630,54 +684,129 @@ func (m *Rule) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Rule) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingWebhook) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Rule) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingWebhook) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Scope != nil { - i -= len(*m.Scope) - copy(dAtA[i:], *m.Scope) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Scope))) + if len(m.MatchConditions) > 0 { + for iNdEx := len(m.MatchConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MatchConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + } + if m.ObjectSelector != nil { + { + size, err := m.ObjectSelector.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x5a } - if len(m.Resources) > 0 { - for iNdEx := len(m.Resources) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Resources[iNdEx]) - copy(dAtA[i:], m.Resources[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Resources[iNdEx]))) + if m.ReinvocationPolicy != nil { + i -= len(*m.ReinvocationPolicy) + copy(dAtA[i:], *m.ReinvocationPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ReinvocationPolicy))) + i-- + dAtA[i] = 0x52 + } + if m.MatchPolicy != nil { + i -= len(*m.MatchPolicy) + copy(dAtA[i:], *m.MatchPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.MatchPolicy))) + i-- + dAtA[i] = 0x4a + } + if len(m.AdmissionReviewVersions) > 0 { + for iNdEx := len(m.AdmissionReviewVersions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AdmissionReviewVersions[iNdEx]) + copy(dAtA[i:], m.AdmissionReviewVersions[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.AdmissionReviewVersions[iNdEx]))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x42 } } - if len(m.APIVersions) > 0 { - for iNdEx := len(m.APIVersions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.APIVersions[iNdEx]) - copy(dAtA[i:], m.APIVersions[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersions[iNdEx]))) - i-- - dAtA[i] = 0x12 + if m.TimeoutSeconds != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.TimeoutSeconds)) + i-- + dAtA[i] = 0x38 + } + if m.SideEffects != nil { + i -= len(*m.SideEffects) + copy(dAtA[i:], *m.SideEffects) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.SideEffects))) + i-- + dAtA[i] = 0x32 + } + if m.NamespaceSelector != nil { + { + size, err := m.NamespaceSelector.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a } - if len(m.APIGroups) > 0 { - for iNdEx := len(m.APIGroups) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.APIGroups[iNdEx]) - copy(dAtA[i:], m.APIGroups[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroups[iNdEx]))) + if m.FailurePolicy != nil { + i -= len(*m.FailurePolicy) + copy(dAtA[i:], *m.FailurePolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.FailurePolicy))) + i-- + dAtA[i] = 0x22 + } + if len(m.Rules) > 0 { + for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0xa + dAtA[i] = 0x1a + } + } + { + size, err := m.ClientConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *RuleWithOperations) Marshal() (dAtA []byte, err error) { +func (m *MutatingWebhookConfiguration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -687,84 +816,44 @@ func (m *RuleWithOperations) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RuleWithOperations) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingWebhookConfiguration) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RuleWithOperations) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingWebhookConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Rule.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - if len(m.Operations) > 0 { - for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Operations[iNdEx]) - copy(dAtA[i:], m.Operations[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Operations[iNdEx]))) + if len(m.Webhooks) > 0 { + for iNdEx := len(m.Webhooks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Webhooks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 } } - return len(dAtA) - i, nil -} - -func (m *ServiceReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ServiceReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ServiceReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Port != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) - i-- - dAtA[i] = 0x20 - } - if m.Path != nil { - i -= len(*m.Path) - copy(dAtA[i:], *m.Path) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Path))) - i-- - dAtA[i] = 0x1a + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - i -= len(m.Namespace) - copy(dAtA[i:], m.Namespace) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *TypeChecking) Marshal() (dAtA []byte, err error) { +func (m *MutatingWebhookConfigurationList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -774,20 +863,20 @@ func (m *TypeChecking) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *TypeChecking) MarshalTo(dAtA []byte) (int, error) { +func (m *MutatingWebhookConfigurationList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TypeChecking) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MutatingWebhookConfigurationList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ExpressionWarnings) > 0 { - for iNdEx := len(m.ExpressionWarnings) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ExpressionWarnings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -795,13 +884,23 @@ func (m *TypeChecking) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0xa + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingAdmissionPolicy) Marshal() (dAtA []byte, err error) { +func (m *Mutation) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -811,50 +910,49 @@ func (m *ValidatingAdmissionPolicy) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatingAdmissionPolicy) MarshalTo(dAtA []byte) (int, error) { +func (m *Mutation) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingAdmissionPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Mutation) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.JSONPatch != nil { + { + size, err := m.JSONPatch.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.ApplyConfiguration != nil { + { + size, err := m.ApplyConfiguration.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a } + i -= len(m.PatchType) + copy(dAtA[i:], m.PatchType) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PatchType))) i-- dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingAdmissionPolicyBinding) Marshal() (dAtA []byte, err error) { +func (m *NamedRuleWithOperations) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -864,18 +962,18 @@ func (m *ValidatingAdmissionPolicyBinding) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatingAdmissionPolicyBinding) MarshalTo(dAtA []byte) (int, error) { +func (m *NamedRuleWithOperations) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingAdmissionPolicyBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NamedRuleWithOperations) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RuleWithOperations.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -884,20 +982,19 @@ func (m *ValidatingAdmissionPolicyBinding) MarshalToSizedBuffer(dAtA []byte) (in } i-- dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.ResourceNames) > 0 { + for iNdEx := len(m.ResourceNames) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ResourceNames[iNdEx]) + copy(dAtA[i:], m.ResourceNames[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceNames[iNdEx]))) + i-- + dAtA[i] = 0xa } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingAdmissionPolicyBindingList) Marshal() (dAtA []byte, err error) { +func (m *ParamKind) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -907,44 +1004,30 @@ func (m *ValidatingAdmissionPolicyBindingList) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *ValidatingAdmissionPolicyBindingList) MarshalTo(dAtA []byte) (int, error) { +func (m *ParamKind) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingAdmissionPolicyBindingList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ParamKind) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + i -= len(m.Kind) + copy(dAtA[i:], m.Kind) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) + i-- + dAtA[i] = 0x12 + i -= len(m.APIVersion) + copy(dAtA[i:], m.APIVersion) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingAdmissionPolicyBindingSpec) Marshal() (dAtA []byte, err error) { +func (m *ParamRef) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -954,40 +1037,26 @@ func (m *ValidatingAdmissionPolicyBindingSpec) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *ValidatingAdmissionPolicyBindingSpec) MarshalTo(dAtA []byte) (int, error) { +func (m *ParamRef) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingAdmissionPolicyBindingSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ParamRef) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ValidationActions) > 0 { - for iNdEx := len(m.ValidationActions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ValidationActions[iNdEx]) - copy(dAtA[i:], m.ValidationActions[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.ValidationActions[iNdEx]))) - i-- - dAtA[i] = 0x22 - } - } - if m.MatchResources != nil { - { - size, err := m.MatchResources.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + if m.ParameterNotFoundAction != nil { + i -= len(*m.ParameterNotFoundAction) + copy(dAtA[i:], *m.ParameterNotFoundAction) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ParameterNotFoundAction))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } - if m.ParamRef != nil { + if m.Selector != nil { { - size, err := m.ParamRef.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -995,17 +1064,22 @@ func (m *ValidatingAdmissionPolicyBindingSpec) MarshalToSizedBuffer(dAtA []byte) i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a } - i -= len(m.PolicyName) - copy(dAtA[i:], m.PolicyName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PolicyName))) + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingAdmissionPolicyList) Marshal() (dAtA []byte, err error) { +func (m *Rule) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1015,44 +1089,54 @@ func (m *ValidatingAdmissionPolicyList) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatingAdmissionPolicyList) MarshalTo(dAtA []byte) (int, error) { +func (m *Rule) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingAdmissionPolicyList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Rule) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Scope != nil { + i -= len(*m.Scope) + copy(dAtA[i:], *m.Scope) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Scope))) + i-- + dAtA[i] = 0x22 + } + if len(m.Resources) > 0 { + for iNdEx := len(m.Resources) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Resources[iNdEx]) + copy(dAtA[i:], m.Resources[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Resources[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.APIVersions) > 0 { + for iNdEx := len(m.APIVersions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.APIVersions[iNdEx]) + copy(dAtA[i:], m.APIVersions[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersions[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.APIGroups) > 0 { + for iNdEx := len(m.APIGroups) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.APIGroups[iNdEx]) + copy(dAtA[i:], m.APIGroups[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroups[iNdEx]))) + i-- + dAtA[i] = 0xa } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingAdmissionPolicySpec) Marshal() (dAtA []byte, err error) { +func (m *RuleWithOperations) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1062,107 +1146,84 @@ func (m *ValidatingAdmissionPolicySpec) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatingAdmissionPolicySpec) MarshalTo(dAtA []byte) (int, error) { +func (m *RuleWithOperations) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingAdmissionPolicySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RuleWithOperations) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Variables) > 0 { - for iNdEx := len(m.Variables) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Variables[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if len(m.MatchConditions) > 0 { - for iNdEx := len(m.MatchConditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MatchConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 + { + size, err := m.Rule.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if len(m.AuditAnnotations) > 0 { - for iNdEx := len(m.AuditAnnotations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AuditAnnotations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + i-- + dAtA[i] = 0x12 + if len(m.Operations) > 0 { + for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Operations[iNdEx]) + copy(dAtA[i:], m.Operations[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Operations[iNdEx]))) i-- - dAtA[i] = 0x2a + dAtA[i] = 0xa } } - if m.FailurePolicy != nil { - i -= len(*m.FailurePolicy) - copy(dAtA[i:], *m.FailurePolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.FailurePolicy))) - i-- - dAtA[i] = 0x22 - } - if len(m.Validations) > 0 { - for iNdEx := len(m.Validations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Validations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } + return len(dAtA) - i, nil +} + +func (m *ServiceReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - if m.MatchConstraints != nil { - { - size, err := m.MatchConstraints.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + return dAtA[:n], nil +} + +func (m *ServiceReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ServiceReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Port != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Port)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x20 } - if m.ParamKind != nil { - { - size, err := m.ParamKind.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } + if m.Path != nil { + i -= len(*m.Path) + copy(dAtA[i:], *m.Path) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Path))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x1a } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + i -= len(m.Namespace) + copy(dAtA[i:], m.Namespace) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Namespace))) + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingAdmissionPolicyStatus) Marshal() (dAtA []byte, err error) { +func (m *TypeChecking) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1172,20 +1233,20 @@ func (m *ValidatingAdmissionPolicyStatus) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatingAdmissionPolicyStatus) MarshalTo(dAtA []byte) (int, error) { +func (m *TypeChecking) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingAdmissionPolicyStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *TypeChecking) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ExpressionWarnings) > 0 { + for iNdEx := len(m.ExpressionWarnings) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ExpressionWarnings[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1193,28 +1254,13 @@ func (m *ValidatingAdmissionPolicyStatus) MarshalToSizedBuffer(dAtA []byte) (int i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - } - } - if m.TypeChecking != nil { - { - size, err := m.TypeChecking.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + dAtA[i] = 0xa } - i-- - dAtA[i] = 0x12 } - i = encodeVarintGenerated(dAtA, i, uint64(m.ObservedGeneration)) - i-- - dAtA[i] = 0x8 return len(dAtA) - i, nil } -func (m *ValidatingWebhook) Marshal() (dAtA []byte, err error) { +func (m *ValidatingAdmissionPolicy) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1224,105 +1270,38 @@ func (m *ValidatingWebhook) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatingWebhook) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicy) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingWebhook) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.MatchConditions) > 0 { - for iNdEx := len(m.MatchConditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MatchConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x5a + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if m.ObjectSelector != nil { - { - size, err := m.ObjectSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x52 - } - if m.MatchPolicy != nil { - i -= len(*m.MatchPolicy) - copy(dAtA[i:], *m.MatchPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.MatchPolicy))) - i-- - dAtA[i] = 0x4a - } - if len(m.AdmissionReviewVersions) > 0 { - for iNdEx := len(m.AdmissionReviewVersions) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AdmissionReviewVersions[iNdEx]) - copy(dAtA[i:], m.AdmissionReviewVersions[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.AdmissionReviewVersions[iNdEx]))) - i-- - dAtA[i] = 0x42 - } - } - if m.TimeoutSeconds != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.TimeoutSeconds)) - i-- - dAtA[i] = 0x38 - } - if m.SideEffects != nil { - i -= len(*m.SideEffects) - copy(dAtA[i:], *m.SideEffects) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.SideEffects))) - i-- - dAtA[i] = 0x32 - } - if m.NamespaceSelector != nil { - { - size, err := m.NamespaceSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.FailurePolicy != nil { - i -= len(*m.FailurePolicy) - copy(dAtA[i:], *m.FailurePolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.FailurePolicy))) - i-- - dAtA[i] = 0x22 - } - if len(m.Rules) > 0 { - for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 { - size, err := m.ClientConfig.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1330,16 +1309,11 @@ func (m *ValidatingWebhook) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenerated(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *ValidatingWebhookConfiguration) Marshal() (dAtA []byte, err error) { +func (m *ValidatingAdmissionPolicyBinding) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1349,30 +1323,26 @@ func (m *ValidatingWebhookConfiguration) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ValidatingWebhookConfiguration) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyBinding) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingWebhookConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyBinding) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Webhooks) > 0 { - for iNdEx := len(m.Webhooks) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Webhooks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 { size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -1386,7 +1356,7 @@ func (m *ValidatingWebhookConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *ValidatingWebhookConfigurationList) Marshal() (dAtA []byte, err error) { +func (m *ValidatingAdmissionPolicyBindingList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1396,12 +1366,12 @@ func (m *ValidatingWebhookConfigurationList) Marshal() (dAtA []byte, err error) return dAtA[:n], nil } -func (m *ValidatingWebhookConfigurationList) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyBindingList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ValidatingWebhookConfigurationList) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyBindingList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -1433,7 +1403,7 @@ func (m *ValidatingWebhookConfigurationList) MarshalToSizedBuffer(dAtA []byte) ( return len(dAtA) - i, nil } -func (m *Validation) Marshal() (dAtA []byte, err error) { +func (m *ValidatingAdmissionPolicyBindingSpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1443,42 +1413,58 @@ func (m *Validation) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Validation) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyBindingSpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Validation) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyBindingSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i -= len(m.MessageExpression) - copy(dAtA[i:], m.MessageExpression) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MessageExpression))) - i-- - dAtA[i] = 0x22 - if m.Reason != nil { - i -= len(*m.Reason) - copy(dAtA[i:], *m.Reason) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Reason))) + if len(m.ValidationActions) > 0 { + for iNdEx := len(m.ValidationActions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ValidationActions[iNdEx]) + copy(dAtA[i:], m.ValidationActions[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ValidationActions[iNdEx]))) + i-- + dAtA[i] = 0x22 + } + } + if m.MatchResources != nil { + { + size, err := m.MatchResources.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x1a } - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x12 - i -= len(m.Expression) - copy(dAtA[i:], m.Expression) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + if m.ParamRef != nil { + { + size, err := m.ParamRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + i -= len(m.PolicyName) + copy(dAtA[i:], m.PolicyName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PolicyName))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *Variable) Marshal() (dAtA []byte, err error) { +func (m *ValidatingAdmissionPolicyList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1488,30 +1474,44 @@ func (m *Variable) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Variable) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyList) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Variable) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicyList) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - i -= len(m.Expression) - copy(dAtA[i:], m.Expression) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0xa return len(dAtA) - i, nil } -func (m *WebhookClientConfig) Marshal() (dAtA []byte, err error) { +func (m *ValidatingAdmissionPolicySpec) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1521,355 +1521,610 @@ func (m *WebhookClientConfig) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *WebhookClientConfig) MarshalTo(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicySpec) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *WebhookClientConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ValidatingAdmissionPolicySpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.URL != nil { - i -= len(*m.URL) - copy(dAtA[i:], *m.URL) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.URL))) - i-- - dAtA[i] = 0x1a + if len(m.Variables) > 0 { + for iNdEx := len(m.Variables) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Variables[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } } - if m.CABundle != nil { - i -= len(m.CABundle) - copy(dAtA[i:], m.CABundle) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.CABundle))) - i-- - dAtA[i] = 0x12 + if len(m.MatchConditions) > 0 { + for iNdEx := len(m.MatchConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MatchConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } } - if m.Service != nil { - { - size, err := m.Service.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.AuditAnnotations) > 0 { + for iNdEx := len(m.AuditAnnotations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.AuditAnnotations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a } + } + if m.FailurePolicy != nil { + i -= len(*m.FailurePolicy) + copy(dAtA[i:], *m.FailurePolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.FailurePolicy))) i-- - dAtA[i] = 0xa + dAtA[i] = 0x22 } - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ + if len(m.Validations) > 0 { + for iNdEx := len(m.Validations) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } - dAtA[offset] = uint8(v) - return base -} -func (m *AuditAnnotation) Size() (n int) { - if m == nil { - return 0 + if m.MatchConstraints != nil { + { + size, err := m.MatchConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - var l int - _ = l - l = len(m.Key) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.ValueExpression) - n += 1 + l + sovGenerated(uint64(l)) - return n + if m.ParamKind != nil { + { + size, err := m.ParamKind.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func (m *ExpressionWarning) Size() (n int) { - if m == nil { - return 0 +func (m *ValidatingAdmissionPolicyStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - var l int - _ = l - l = len(m.FieldRef) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Warning) - n += 1 + l + sovGenerated(uint64(l)) - return n + return dAtA[:n], nil } -func (m *MatchCondition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Expression) - n += 1 + l + sovGenerated(uint64(l)) - return n +func (m *ValidatingAdmissionPolicyStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MatchResources) Size() (n int) { - if m == nil { - return 0 - } +func (m *ValidatingAdmissionPolicyStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if m.NamespaceSelector != nil { - l = m.NamespaceSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ObjectSelector != nil { - l = m.ObjectSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.ResourceRules) > 0 { - for _, e := range m.ResourceRules { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a } } - if len(m.ExcludeResourceRules) > 0 { - for _, e := range m.ExcludeResourceRules { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if m.TypeChecking != nil { + { + size, err := m.TypeChecking.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 } - if m.MatchPolicy != nil { - l = len(*m.MatchPolicy) - n += 1 + l + sovGenerated(uint64(l)) - } - return n + i = encodeVarintGenerated(dAtA, i, uint64(m.ObservedGeneration)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil } -func (m *MutatingWebhook) Size() (n int) { - if m == nil { - return 0 +func (m *ValidatingWebhook) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ValidatingWebhook) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatingWebhook) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.ClientConfig.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Rules) > 0 { - for _, e := range m.Rules { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if len(m.MatchConditions) > 0 { + for iNdEx := len(m.MatchConditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MatchConditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a } } - if m.FailurePolicy != nil { - l = len(*m.FailurePolicy) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.NamespaceSelector != nil { - l = m.NamespaceSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.SideEffects != nil { - l = len(*m.SideEffects) - n += 1 + l + sovGenerated(uint64(l)) + if m.ObjectSelector != nil { + { + size, err := m.ObjectSelector.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x52 } - if m.TimeoutSeconds != nil { - n += 1 + sovGenerated(uint64(*m.TimeoutSeconds)) + if m.MatchPolicy != nil { + i -= len(*m.MatchPolicy) + copy(dAtA[i:], *m.MatchPolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.MatchPolicy))) + i-- + dAtA[i] = 0x4a } if len(m.AdmissionReviewVersions) > 0 { - for _, s := range m.AdmissionReviewVersions { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + for iNdEx := len(m.AdmissionReviewVersions) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AdmissionReviewVersions[iNdEx]) + copy(dAtA[i:], m.AdmissionReviewVersions[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.AdmissionReviewVersions[iNdEx]))) + i-- + dAtA[i] = 0x42 } } - if m.MatchPolicy != nil { - l = len(*m.MatchPolicy) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ReinvocationPolicy != nil { - l = len(*m.ReinvocationPolicy) - n += 1 + l + sovGenerated(uint64(l)) + if m.TimeoutSeconds != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.TimeoutSeconds)) + i-- + dAtA[i] = 0x38 } - if m.ObjectSelector != nil { - l = m.ObjectSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) + if m.SideEffects != nil { + i -= len(*m.SideEffects) + copy(dAtA[i:], *m.SideEffects) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.SideEffects))) + i-- + dAtA[i] = 0x32 } - if len(m.MatchConditions) > 0 { - for _, e := range m.MatchConditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + if m.NamespaceSelector != nil { + { + size, err := m.NamespaceSelector.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x2a } - return n -} - -func (m *MutatingWebhookConfiguration) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Webhooks) > 0 { - for _, e := range m.Webhooks { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } + if m.FailurePolicy != nil { + i -= len(*m.FailurePolicy) + copy(dAtA[i:], *m.FailurePolicy) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.FailurePolicy))) + i-- + dAtA[i] = 0x22 } - return n -} - -func (m *MutatingWebhookConfigurationList) Size() (n int) { - if m == nil { - return 0 + if len(m.Rules) > 0 { + for iNdEx := len(m.Rules) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Rules[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.ClientConfig.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *NamedRuleWithOperations) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ResourceNames) > 0 { - for _, s := range m.ResourceNames { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } +func (m *ValidatingWebhookConfiguration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = m.RuleWithOperations.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n + return dAtA[:n], nil } -func (m *ParamKind) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.APIVersion) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - return n +func (m *ValidatingWebhookConfiguration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ParamRef) Size() (n int) { - if m == nil { - return 0 - } +func (m *ValidatingWebhookConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - if m.Selector != nil { - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) + if len(m.Webhooks) > 0 { + for iNdEx := len(m.Webhooks) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Webhooks[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } } - if m.ParameterNotFoundAction != nil { - l = len(*m.ParameterNotFoundAction) - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *Rule) Size() (n int) { - if m == nil { - return 0 +func (m *ValidatingWebhookConfigurationList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } + return dAtA[:n], nil +} + +func (m *ValidatingWebhookConfigurationList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatingWebhookConfigurationList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.APIGroups) > 0 { - for _, s := range m.APIGroups { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.APIVersions) > 0 { - for _, s := range m.APIVersions { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } } - if len(m.Resources) > 0 { - for _, s := range m.Resources { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - if m.Scope != nil { - l = len(*m.Scope) - n += 1 + l + sovGenerated(uint64(l)) - } - return n + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } -func (m *RuleWithOperations) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Operations) > 0 { - for _, s := range m.Operations { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } +func (m *Validation) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - l = m.Rule.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n + return dAtA[:n], nil } -func (m *ServiceReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Namespace) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if m.Path != nil { - l = len(*m.Path) - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Port != nil { - n += 1 + sovGenerated(uint64(*m.Port)) - } - return n +func (m *Validation) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *TypeChecking) Size() (n int) { - if m == nil { - return 0 - } +func (m *Validation) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i var l int _ = l - if len(m.ExpressionWarnings) > 0 { - for _, e := range m.ExpressionWarnings { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } + i -= len(m.MessageExpression) + copy(dAtA[i:], m.MessageExpression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.MessageExpression))) + i-- + dAtA[i] = 0x22 + if m.Reason != nil { + i -= len(*m.Reason) + copy(dAtA[i:], *m.Reason) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Reason))) + i-- + dAtA[i] = 0x1a + } + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0x12 + i -= len(m.Expression) + copy(dAtA[i:], m.Expression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Variable) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Variable) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Variable) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Expression) + copy(dAtA[i:], m.Expression) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Expression))) + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WebhookClientConfig) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WebhookClientConfig) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WebhookClientConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.URL != nil { + i -= len(*m.URL) + copy(dAtA[i:], *m.URL) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.URL))) + i-- + dAtA[i] = 0x1a + } + if m.CABundle != nil { + i -= len(m.CABundle) + copy(dAtA[i:], m.CABundle) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.CABundle))) + i-- + dAtA[i] = 0x12 + } + if m.Service != nil { + { + size, err := m.Service.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ApplyConfiguration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *ValidatingAdmissionPolicy) Size() (n int) { +func (m *AuditAnnotation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.ValueExpression) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *ExpressionWarning) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FieldRef) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Warning) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *JSONPatch) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *MatchCondition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *MatchResources) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.NamespaceSelector != nil { + l = m.NamespaceSelector.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.ObjectSelector != nil { + l = m.ObjectSelector.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceRules) > 0 { + for _, e := range m.ResourceRules { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.ExcludeResourceRules) > 0 { + for _, e := range m.ExcludeResourceRules { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.MatchPolicy != nil { + l = len(*m.MatchPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *MutatingAdmissionPolicy) Size() (n int) { if m == nil { return 0 } @@ -1879,12 +2134,10 @@ func (m *ValidatingAdmissionPolicy) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = m.Spec.Size() n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *ValidatingAdmissionPolicyBinding) Size() (n int) { +func (m *MutatingAdmissionPolicyBinding) Size() (n int) { if m == nil { return 0 } @@ -1897,7 +2150,7 @@ func (m *ValidatingAdmissionPolicyBinding) Size() (n int) { return n } -func (m *ValidatingAdmissionPolicyBindingList) Size() (n int) { +func (m *MutatingAdmissionPolicyBindingList) Size() (n int) { if m == nil { return 0 } @@ -1914,7 +2167,7 @@ func (m *ValidatingAdmissionPolicyBindingList) Size() (n int) { return n } -func (m *ValidatingAdmissionPolicyBindingSpec) Size() (n int) { +func (m *MutatingAdmissionPolicyBindingSpec) Size() (n int) { if m == nil { return 0 } @@ -1930,16 +2183,10 @@ func (m *ValidatingAdmissionPolicyBindingSpec) Size() (n int) { l = m.MatchResources.Size() n += 1 + l + sovGenerated(uint64(l)) } - if len(m.ValidationActions) > 0 { - for _, s := range m.ValidationActions { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) - } - } return n } -func (m *ValidatingAdmissionPolicyList) Size() (n int) { +func (m *MutatingAdmissionPolicyList) Size() (n int) { if m == nil { return 0 } @@ -1956,7 +2203,7 @@ func (m *ValidatingAdmissionPolicyList) Size() (n int) { return n } -func (m *ValidatingAdmissionPolicySpec) Size() (n int) { +func (m *MutatingAdmissionPolicySpec) Size() (n int) { if m == nil { return 0 } @@ -1970,58 +2217,34 @@ func (m *ValidatingAdmissionPolicySpec) Size() (n int) { l = m.MatchConstraints.Size() n += 1 + l + sovGenerated(uint64(l)) } - if len(m.Validations) > 0 { - for _, e := range m.Validations { + if len(m.Variables) > 0 { + for _, e := range m.Variables { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } - if m.FailurePolicy != nil { - l = len(*m.FailurePolicy) - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.AuditAnnotations) > 0 { - for _, e := range m.AuditAnnotations { + if len(m.Mutations) > 0 { + for _, e := range m.Mutations { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } + if m.FailurePolicy != nil { + l = len(*m.FailurePolicy) + n += 1 + l + sovGenerated(uint64(l)) + } if len(m.MatchConditions) > 0 { for _, e := range m.MatchConditions { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } - if len(m.Variables) > 0 { - for _, e := range m.Variables { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } + l = len(m.ReinvocationPolicy) + n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *ValidatingAdmissionPolicyStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovGenerated(uint64(m.ObservedGeneration)) - if m.TypeChecking != nil { - l = m.TypeChecking.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *ValidatingWebhook) Size() (n int) { +func (m *MutatingWebhook) Size() (n int) { if m == nil { return 0 } @@ -2062,6 +2285,10 @@ func (m *ValidatingWebhook) Size() (n int) { l = len(*m.MatchPolicy) n += 1 + l + sovGenerated(uint64(l)) } + if m.ReinvocationPolicy != nil { + l = len(*m.ReinvocationPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } if m.ObjectSelector != nil { l = m.ObjectSelector.Size() n += 1 + l + sovGenerated(uint64(l)) @@ -2075,7 +2302,7 @@ func (m *ValidatingWebhook) Size() (n int) { return n } -func (m *ValidatingWebhookConfiguration) Size() (n int) { +func (m *MutatingWebhookConfiguration) Size() (n int) { if m == nil { return 0 } @@ -2092,7 +2319,7 @@ func (m *ValidatingWebhookConfiguration) Size() (n int) { return n } -func (m *ValidatingWebhookConfigurationList) Size() (n int) { +func (m *MutatingWebhookConfigurationList) Size() (n int) { if m == nil { return 0 } @@ -2109,500 +2336,1983 @@ func (m *ValidatingWebhookConfigurationList) Size() (n int) { return n } -func (m *Validation) Size() (n int) { +func (m *Mutation) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Expression) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) + l = len(m.PatchType) n += 1 + l + sovGenerated(uint64(l)) - if m.Reason != nil { - l = len(*m.Reason) + if m.ApplyConfiguration != nil { + l = m.ApplyConfiguration.Size() n += 1 + l + sovGenerated(uint64(l)) } - l = len(m.MessageExpression) + if m.JSONPatch != nil { + l = m.JSONPatch.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *NamedRuleWithOperations) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ResourceNames) > 0 { + for _, s := range m.ResourceNames { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + l = m.RuleWithOperations.Size() n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *Variable) Size() (n int) { +func (m *ParamKind) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Name) + l = len(m.APIVersion) n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Expression) + l = len(m.Kind) n += 1 + l + sovGenerated(uint64(l)) return n } -func (m *WebhookClientConfig) Size() (n int) { +func (m *ParamRef) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Service != nil { - l = m.Service.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.CABundle != nil { - l = len(m.CABundle) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Namespace) + n += 1 + l + sovGenerated(uint64(l)) + if m.Selector != nil { + l = m.Selector.Size() n += 1 + l + sovGenerated(uint64(l)) } - if m.URL != nil { - l = len(*m.URL) + if m.ParameterNotFoundAction != nil { + l = len(*m.ParameterNotFoundAction) n += 1 + l + sovGenerated(uint64(l)) } return n } -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *AuditAnnotation) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&AuditAnnotation{`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `ValueExpression:` + fmt.Sprintf("%v", this.ValueExpression) + `,`, - `}`, - }, "") - return s -} -func (this *ExpressionWarning) String() string { - if this == nil { - return "nil" +func (m *Rule) Size() (n int) { + if m == nil { + return 0 } - s := strings.Join([]string{`&ExpressionWarning{`, - `FieldRef:` + fmt.Sprintf("%v", this.FieldRef) + `,`, - `Warning:` + fmt.Sprintf("%v", this.Warning) + `,`, - `}`, - }, "") - return s -} -func (this *MatchCondition) String() string { - if this == nil { - return "nil" + var l int + _ = l + if len(m.APIGroups) > 0 { + for _, s := range m.APIGroups { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } } - s := strings.Join([]string{`&MatchCondition{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, - `}`, - }, "") - return s -} -func (this *MatchResources) String() string { - if this == nil { - return "nil" + if len(m.APIVersions) > 0 { + for _, s := range m.APIVersions { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForResourceRules := "[]NamedRuleWithOperations{" - for _, f := range this.ResourceRules { - repeatedStringForResourceRules += strings.Replace(strings.Replace(f.String(), "NamedRuleWithOperations", "NamedRuleWithOperations", 1), `&`, ``, 1) + "," + if len(m.Resources) > 0 { + for _, s := range m.Resources { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForResourceRules += "}" - repeatedStringForExcludeResourceRules := "[]NamedRuleWithOperations{" - for _, f := range this.ExcludeResourceRules { - repeatedStringForExcludeResourceRules += strings.Replace(strings.Replace(f.String(), "NamedRuleWithOperations", "NamedRuleWithOperations", 1), `&`, ``, 1) + "," + if m.Scope != nil { + l = len(*m.Scope) + n += 1 + l + sovGenerated(uint64(l)) } - repeatedStringForExcludeResourceRules += "}" - s := strings.Join([]string{`&MatchResources{`, - `NamespaceSelector:` + strings.Replace(fmt.Sprintf("%v", this.NamespaceSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `ObjectSelector:` + strings.Replace(fmt.Sprintf("%v", this.ObjectSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `ResourceRules:` + repeatedStringForResourceRules + `,`, - `ExcludeResourceRules:` + repeatedStringForExcludeResourceRules + `,`, - `MatchPolicy:` + valueToStringGenerated(this.MatchPolicy) + `,`, - `}`, - }, "") - return s + return n } -func (this *MutatingWebhook) String() string { - if this == nil { - return "nil" - } - repeatedStringForRules := "[]RuleWithOperations{" - for _, f := range this.Rules { - repeatedStringForRules += strings.Replace(strings.Replace(f.String(), "RuleWithOperations", "RuleWithOperations", 1), `&`, ``, 1) + "," + +func (m *RuleWithOperations) Size() (n int) { + if m == nil { + return 0 } - repeatedStringForRules += "}" - repeatedStringForMatchConditions := "[]MatchCondition{" - for _, f := range this.MatchConditions { - repeatedStringForMatchConditions += strings.Replace(strings.Replace(f.String(), "MatchCondition", "MatchCondition", 1), `&`, ``, 1) + "," + var l int + _ = l + if len(m.Operations) > 0 { + for _, s := range m.Operations { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForMatchConditions += "}" - s := strings.Join([]string{`&MutatingWebhook{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `ClientConfig:` + strings.Replace(strings.Replace(this.ClientConfig.String(), "WebhookClientConfig", "WebhookClientConfig", 1), `&`, ``, 1) + `,`, - `Rules:` + repeatedStringForRules + `,`, - `FailurePolicy:` + valueToStringGenerated(this.FailurePolicy) + `,`, - `NamespaceSelector:` + strings.Replace(fmt.Sprintf("%v", this.NamespaceSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `SideEffects:` + valueToStringGenerated(this.SideEffects) + `,`, - `TimeoutSeconds:` + valueToStringGenerated(this.TimeoutSeconds) + `,`, - `AdmissionReviewVersions:` + fmt.Sprintf("%v", this.AdmissionReviewVersions) + `,`, - `MatchPolicy:` + valueToStringGenerated(this.MatchPolicy) + `,`, - `ReinvocationPolicy:` + valueToStringGenerated(this.ReinvocationPolicy) + `,`, - `ObjectSelector:` + strings.Replace(fmt.Sprintf("%v", this.ObjectSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `MatchConditions:` + repeatedStringForMatchConditions + `,`, - `}`, - }, "") - return s + l = m.Rule.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n } -func (this *MutatingWebhookConfiguration) String() string { - if this == nil { - return "nil" + +func (m *ServiceReference) Size() (n int) { + if m == nil { + return 0 } - repeatedStringForWebhooks := "[]MutatingWebhook{" - for _, f := range this.Webhooks { - repeatedStringForWebhooks += strings.Replace(strings.Replace(f.String(), "MutatingWebhook", "MutatingWebhook", 1), `&`, ``, 1) + "," + var l int + _ = l + l = len(m.Namespace) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.Path != nil { + l = len(*m.Path) + n += 1 + l + sovGenerated(uint64(l)) } - repeatedStringForWebhooks += "}" - s := strings.Join([]string{`&MutatingWebhookConfiguration{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Webhooks:` + repeatedStringForWebhooks + `,`, - `}`, - }, "") - return s + if m.Port != nil { + n += 1 + sovGenerated(uint64(*m.Port)) + } + return n } -func (this *MutatingWebhookConfigurationList) String() string { - if this == nil { - return "nil" + +func (m *TypeChecking) Size() (n int) { + if m == nil { + return 0 } - repeatedStringForItems := "[]MutatingWebhookConfiguration{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "MutatingWebhookConfiguration", "MutatingWebhookConfiguration", 1), `&`, ``, 1) + "," + var l int + _ = l + if len(m.ExpressionWarnings) > 0 { + for _, e := range m.ExpressionWarnings { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForItems += "}" - s := strings.Join([]string{`&MutatingWebhookConfigurationList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s + return n } -func (this *NamedRuleWithOperations) String() string { - if this == nil { - return "nil" + +func (m *ValidatingAdmissionPolicy) Size() (n int) { + if m == nil { + return 0 } - s := strings.Join([]string{`&NamedRuleWithOperations{`, - `ResourceNames:` + fmt.Sprintf("%v", this.ResourceNames) + `,`, - `RuleWithOperations:` + strings.Replace(strings.Replace(this.RuleWithOperations.String(), "RuleWithOperations", "RuleWithOperations", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n } -func (this *ParamKind) String() string { - if this == nil { - return "nil" + +func (m *ValidatingAdmissionPolicyBinding) Size() (n int) { + if m == nil { + return 0 } - s := strings.Join([]string{`&ParamKind{`, - `APIVersion:` + fmt.Sprintf("%v", this.APIVersion) + `,`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `}`, - }, "") - return s + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n } -func (this *ParamRef) String() string { - if this == nil { - return "nil" + +func (m *ValidatingAdmissionPolicyBindingList) Size() (n int) { + if m == nil { + return 0 } - s := strings.Join([]string{`&ParamRef{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `ParameterNotFoundAction:` + valueToStringGenerated(this.ParameterNotFoundAction) + `,`, - `}`, - }, "") - return s -} -func (this *Rule) String() string { - if this == nil { - return "nil" + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } - s := strings.Join([]string{`&Rule{`, - `APIGroups:` + fmt.Sprintf("%v", this.APIGroups) + `,`, - `APIVersions:` + fmt.Sprintf("%v", this.APIVersions) + `,`, - `Resources:` + fmt.Sprintf("%v", this.Resources) + `,`, - `Scope:` + valueToStringGenerated(this.Scope) + `,`, - `}`, - }, "") - return s + return n } -func (this *RuleWithOperations) String() string { - if this == nil { - return "nil" + +func (m *ValidatingAdmissionPolicyBindingSpec) Size() (n int) { + if m == nil { + return 0 } - s := strings.Join([]string{`&RuleWithOperations{`, - `Operations:` + fmt.Sprintf("%v", this.Operations) + `,`, - `Rule:` + strings.Replace(strings.Replace(this.Rule.String(), "Rule", "Rule", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ServiceReference) String() string { - if this == nil { - return "nil" + var l int + _ = l + l = len(m.PolicyName) + n += 1 + l + sovGenerated(uint64(l)) + if m.ParamRef != nil { + l = m.ParamRef.Size() + n += 1 + l + sovGenerated(uint64(l)) } - s := strings.Join([]string{`&ServiceReference{`, - `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Path:` + valueToStringGenerated(this.Path) + `,`, - `Port:` + valueToStringGenerated(this.Port) + `,`, - `}`, - }, "") - return s -} -func (this *TypeChecking) String() string { - if this == nil { - return "nil" + if m.MatchResources != nil { + l = m.MatchResources.Size() + n += 1 + l + sovGenerated(uint64(l)) } - repeatedStringForExpressionWarnings := "[]ExpressionWarning{" - for _, f := range this.ExpressionWarnings { - repeatedStringForExpressionWarnings += strings.Replace(strings.Replace(f.String(), "ExpressionWarning", "ExpressionWarning", 1), `&`, ``, 1) + "," + if len(m.ValidationActions) > 0 { + for _, s := range m.ValidationActions { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForExpressionWarnings += "}" - s := strings.Join([]string{`&TypeChecking{`, - `ExpressionWarnings:` + repeatedStringForExpressionWarnings + `,`, - `}`, - }, "") - return s + return n } -func (this *ValidatingAdmissionPolicy) String() string { - if this == nil { - return "nil" + +func (m *ValidatingAdmissionPolicyList) Size() (n int) { + if m == nil { + return 0 } - s := strings.Join([]string{`&ValidatingAdmissionPolicy{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ValidatingAdmissionPolicySpec", "ValidatingAdmissionPolicySpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ValidatingAdmissionPolicyStatus", "ValidatingAdmissionPolicyStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ValidatingAdmissionPolicyBinding) String() string { - if this == nil { - return "nil" + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } - s := strings.Join([]string{`&ValidatingAdmissionPolicyBinding{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ValidatingAdmissionPolicyBindingSpec", "ValidatingAdmissionPolicyBindingSpec", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s + return n } -func (this *ValidatingAdmissionPolicyBindingList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]ValidatingAdmissionPolicyBinding{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ValidatingAdmissionPolicyBinding", "ValidatingAdmissionPolicyBinding", 1), `&`, ``, 1) + "," + +func (m *ValidatingAdmissionPolicySpec) Size() (n int) { + if m == nil { + return 0 } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ValidatingAdmissionPolicyBindingList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ValidatingAdmissionPolicyBindingSpec) String() string { - if this == nil { - return "nil" + var l int + _ = l + if m.ParamKind != nil { + l = m.ParamKind.Size() + n += 1 + l + sovGenerated(uint64(l)) } - s := strings.Join([]string{`&ValidatingAdmissionPolicyBindingSpec{`, - `PolicyName:` + fmt.Sprintf("%v", this.PolicyName) + `,`, - `ParamRef:` + strings.Replace(this.ParamRef.String(), "ParamRef", "ParamRef", 1) + `,`, - `MatchResources:` + strings.Replace(this.MatchResources.String(), "MatchResources", "MatchResources", 1) + `,`, - `ValidationActions:` + fmt.Sprintf("%v", this.ValidationActions) + `,`, - `}`, - }, "") - return s -} -func (this *ValidatingAdmissionPolicyList) String() string { - if this == nil { - return "nil" + if m.MatchConstraints != nil { + l = m.MatchConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) } - repeatedStringForItems := "[]ValidatingAdmissionPolicy{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ValidatingAdmissionPolicy", "ValidatingAdmissionPolicy", 1), `&`, ``, 1) + "," + if len(m.Validations) > 0 { + for _, e := range m.Validations { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ValidatingAdmissionPolicyList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *ValidatingAdmissionPolicySpec) String() string { - if this == nil { - return "nil" + if m.FailurePolicy != nil { + l = len(*m.FailurePolicy) + n += 1 + l + sovGenerated(uint64(l)) } - repeatedStringForValidations := "[]Validation{" - for _, f := range this.Validations { - repeatedStringForValidations += strings.Replace(strings.Replace(f.String(), "Validation", "Validation", 1), `&`, ``, 1) + "," + if len(m.AuditAnnotations) > 0 { + for _, e := range m.AuditAnnotations { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForValidations += "}" - repeatedStringForAuditAnnotations := "[]AuditAnnotation{" - for _, f := range this.AuditAnnotations { - repeatedStringForAuditAnnotations += strings.Replace(strings.Replace(f.String(), "AuditAnnotation", "AuditAnnotation", 1), `&`, ``, 1) + "," + if len(m.MatchConditions) > 0 { + for _, e := range m.MatchConditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForAuditAnnotations += "}" - repeatedStringForMatchConditions := "[]MatchCondition{" - for _, f := range this.MatchConditions { - repeatedStringForMatchConditions += strings.Replace(strings.Replace(f.String(), "MatchCondition", "MatchCondition", 1), `&`, ``, 1) + "," + if len(m.Variables) > 0 { + for _, e := range m.Variables { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } } - repeatedStringForMatchConditions += "}" - repeatedStringForVariables := "[]Variable{" - for _, f := range this.Variables { - repeatedStringForVariables += strings.Replace(strings.Replace(f.String(), "Variable", "Variable", 1), `&`, ``, 1) + "," + return n +} + +func (m *ValidatingAdmissionPolicyStatus) Size() (n int) { + if m == nil { + return 0 } - repeatedStringForVariables += "}" - s := strings.Join([]string{`&ValidatingAdmissionPolicySpec{`, - `ParamKind:` + strings.Replace(this.ParamKind.String(), "ParamKind", "ParamKind", 1) + `,`, - `MatchConstraints:` + strings.Replace(this.MatchConstraints.String(), "MatchResources", "MatchResources", 1) + `,`, - `Validations:` + repeatedStringForValidations + `,`, - `FailurePolicy:` + valueToStringGenerated(this.FailurePolicy) + `,`, - `AuditAnnotations:` + repeatedStringForAuditAnnotations + `,`, - `MatchConditions:` + repeatedStringForMatchConditions + `,`, - `Variables:` + repeatedStringForVariables + `,`, - `}`, - }, "") - return s + var l int + _ = l + n += 1 + sovGenerated(uint64(m.ObservedGeneration)) + if m.TypeChecking != nil { + l = m.TypeChecking.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n } -func (this *ValidatingAdmissionPolicyStatus) String() string { + +func (m *ValidatingWebhook) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = m.ClientConfig.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Rules) > 0 { + for _, e := range m.Rules { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.FailurePolicy != nil { + l = len(*m.FailurePolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.NamespaceSelector != nil { + l = m.NamespaceSelector.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.SideEffects != nil { + l = len(*m.SideEffects) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.TimeoutSeconds != nil { + n += 1 + sovGenerated(uint64(*m.TimeoutSeconds)) + } + if len(m.AdmissionReviewVersions) > 0 { + for _, s := range m.AdmissionReviewVersions { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.MatchPolicy != nil { + l = len(*m.MatchPolicy) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.ObjectSelector != nil { + l = m.ObjectSelector.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.MatchConditions) > 0 { + for _, e := range m.MatchConditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ValidatingWebhookConfiguration) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Webhooks) > 0 { + for _, e := range m.Webhooks { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ValidatingWebhookConfigurationList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *Validation) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Message) + n += 1 + l + sovGenerated(uint64(l)) + if m.Reason != nil { + l = len(*m.Reason) + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.MessageExpression) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Variable) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Expression) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *WebhookClientConfig) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Service != nil { + l = m.Service.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.CABundle != nil { + l = len(m.CABundle) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.URL != nil { + l = len(*m.URL) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ApplyConfiguration) String() string { if this == nil { return "nil" } - repeatedStringForConditions := "[]Condition{" - for _, f := range this.Conditions { - repeatedStringForConditions += fmt.Sprintf("%v", f) + "," - } - repeatedStringForConditions += "}" - s := strings.Join([]string{`&ValidatingAdmissionPolicyStatus{`, - `ObservedGeneration:` + fmt.Sprintf("%v", this.ObservedGeneration) + `,`, - `TypeChecking:` + strings.Replace(this.TypeChecking.String(), "TypeChecking", "TypeChecking", 1) + `,`, - `Conditions:` + repeatedStringForConditions + `,`, + s := strings.Join([]string{`&ApplyConfiguration{`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, `}`, }, "") return s } -func (this *ValidatingWebhook) String() string { +func (this *AuditAnnotation) String() string { if this == nil { return "nil" } - repeatedStringForRules := "[]RuleWithOperations{" - for _, f := range this.Rules { - repeatedStringForRules += strings.Replace(strings.Replace(f.String(), "RuleWithOperations", "RuleWithOperations", 1), `&`, ``, 1) + "," - } - repeatedStringForRules += "}" - repeatedStringForMatchConditions := "[]MatchCondition{" - for _, f := range this.MatchConditions { - repeatedStringForMatchConditions += strings.Replace(strings.Replace(f.String(), "MatchCondition", "MatchCondition", 1), `&`, ``, 1) + "," - } - repeatedStringForMatchConditions += "}" - s := strings.Join([]string{`&ValidatingWebhook{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `ClientConfig:` + strings.Replace(strings.Replace(this.ClientConfig.String(), "WebhookClientConfig", "WebhookClientConfig", 1), `&`, ``, 1) + `,`, - `Rules:` + repeatedStringForRules + `,`, - `FailurePolicy:` + valueToStringGenerated(this.FailurePolicy) + `,`, - `NamespaceSelector:` + strings.Replace(fmt.Sprintf("%v", this.NamespaceSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `SideEffects:` + valueToStringGenerated(this.SideEffects) + `,`, - `TimeoutSeconds:` + valueToStringGenerated(this.TimeoutSeconds) + `,`, - `AdmissionReviewVersions:` + fmt.Sprintf("%v", this.AdmissionReviewVersions) + `,`, - `MatchPolicy:` + valueToStringGenerated(this.MatchPolicy) + `,`, - `ObjectSelector:` + strings.Replace(fmt.Sprintf("%v", this.ObjectSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `MatchConditions:` + repeatedStringForMatchConditions + `,`, + s := strings.Join([]string{`&AuditAnnotation{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `ValueExpression:` + fmt.Sprintf("%v", this.ValueExpression) + `,`, `}`, }, "") return s } -func (this *ValidatingWebhookConfiguration) String() string { +func (this *ExpressionWarning) String() string { if this == nil { return "nil" } - repeatedStringForWebhooks := "[]ValidatingWebhook{" - for _, f := range this.Webhooks { - repeatedStringForWebhooks += strings.Replace(strings.Replace(f.String(), "ValidatingWebhook", "ValidatingWebhook", 1), `&`, ``, 1) + "," - } - repeatedStringForWebhooks += "}" - s := strings.Join([]string{`&ValidatingWebhookConfiguration{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Webhooks:` + repeatedStringForWebhooks + `,`, + s := strings.Join([]string{`&ExpressionWarning{`, + `FieldRef:` + fmt.Sprintf("%v", this.FieldRef) + `,`, + `Warning:` + fmt.Sprintf("%v", this.Warning) + `,`, `}`, }, "") return s } -func (this *ValidatingWebhookConfigurationList) String() string { +func (this *JSONPatch) String() string { if this == nil { return "nil" } - repeatedStringForItems := "[]ValidatingWebhookConfiguration{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ValidatingWebhookConfiguration", "ValidatingWebhookConfiguration", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&ValidatingWebhookConfigurationList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, + s := strings.Join([]string{`&JSONPatch{`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, `}`, }, "") return s } -func (this *Validation) String() string { +func (this *MatchCondition) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Validation{`, + s := strings.Join([]string{`&MatchCondition{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `Reason:` + valueToStringGenerated(this.Reason) + `,`, - `MessageExpression:` + fmt.Sprintf("%v", this.MessageExpression) + `,`, `}`, }, "") return s } -func (this *Variable) String() string { +func (this *MatchResources) String() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Variable{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, - `}`, - }, "") - return s -} -func (this *WebhookClientConfig) String() string { - if this == nil { - return "nil" + repeatedStringForResourceRules := "[]NamedRuleWithOperations{" + for _, f := range this.ResourceRules { + repeatedStringForResourceRules += strings.Replace(strings.Replace(f.String(), "NamedRuleWithOperations", "NamedRuleWithOperations", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceRules += "}" + repeatedStringForExcludeResourceRules := "[]NamedRuleWithOperations{" + for _, f := range this.ExcludeResourceRules { + repeatedStringForExcludeResourceRules += strings.Replace(strings.Replace(f.String(), "NamedRuleWithOperations", "NamedRuleWithOperations", 1), `&`, ``, 1) + "," + } + repeatedStringForExcludeResourceRules += "}" + s := strings.Join([]string{`&MatchResources{`, + `NamespaceSelector:` + strings.Replace(fmt.Sprintf("%v", this.NamespaceSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, + `ObjectSelector:` + strings.Replace(fmt.Sprintf("%v", this.ObjectSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, + `ResourceRules:` + repeatedStringForResourceRules + `,`, + `ExcludeResourceRules:` + repeatedStringForExcludeResourceRules + `,`, + `MatchPolicy:` + valueToStringGenerated(this.MatchPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *MutatingAdmissionPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MutatingAdmissionPolicy{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "MutatingAdmissionPolicySpec", "MutatingAdmissionPolicySpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *MutatingAdmissionPolicyBinding) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MutatingAdmissionPolicyBinding{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "MutatingAdmissionPolicyBindingSpec", "MutatingAdmissionPolicyBindingSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *MutatingAdmissionPolicyBindingList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]MutatingAdmissionPolicyBinding{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "MutatingAdmissionPolicyBinding", "MutatingAdmissionPolicyBinding", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&MutatingAdmissionPolicyBindingList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *MutatingAdmissionPolicyBindingSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&MutatingAdmissionPolicyBindingSpec{`, + `PolicyName:` + fmt.Sprintf("%v", this.PolicyName) + `,`, + `ParamRef:` + strings.Replace(this.ParamRef.String(), "ParamRef", "ParamRef", 1) + `,`, + `MatchResources:` + strings.Replace(this.MatchResources.String(), "MatchResources", "MatchResources", 1) + `,`, + `}`, + }, "") + return s +} +func (this *MutatingAdmissionPolicyList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]MutatingAdmissionPolicy{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "MutatingAdmissionPolicy", "MutatingAdmissionPolicy", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&MutatingAdmissionPolicyList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *MutatingAdmissionPolicySpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForVariables := "[]Variable{" + for _, f := range this.Variables { + repeatedStringForVariables += strings.Replace(strings.Replace(f.String(), "Variable", "Variable", 1), `&`, ``, 1) + "," + } + repeatedStringForVariables += "}" + repeatedStringForMutations := "[]Mutation{" + for _, f := range this.Mutations { + repeatedStringForMutations += strings.Replace(strings.Replace(f.String(), "Mutation", "Mutation", 1), `&`, ``, 1) + "," + } + repeatedStringForMutations += "}" + repeatedStringForMatchConditions := "[]MatchCondition{" + for _, f := range this.MatchConditions { + repeatedStringForMatchConditions += strings.Replace(strings.Replace(f.String(), "MatchCondition", "MatchCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForMatchConditions += "}" + s := strings.Join([]string{`&MutatingAdmissionPolicySpec{`, + `ParamKind:` + strings.Replace(this.ParamKind.String(), "ParamKind", "ParamKind", 1) + `,`, + `MatchConstraints:` + strings.Replace(this.MatchConstraints.String(), "MatchResources", "MatchResources", 1) + `,`, + `Variables:` + repeatedStringForVariables + `,`, + `Mutations:` + repeatedStringForMutations + `,`, + `FailurePolicy:` + valueToStringGenerated(this.FailurePolicy) + `,`, + `MatchConditions:` + repeatedStringForMatchConditions + `,`, + `ReinvocationPolicy:` + fmt.Sprintf("%v", this.ReinvocationPolicy) + `,`, + `}`, + }, "") + return s +} +func (this *MutatingWebhook) String() string { + if this == nil { + return "nil" + } + repeatedStringForRules := "[]RuleWithOperations{" + for _, f := range this.Rules { + repeatedStringForRules += strings.Replace(strings.Replace(f.String(), "RuleWithOperations", "RuleWithOperations", 1), `&`, ``, 1) + "," + } + repeatedStringForRules += "}" + repeatedStringForMatchConditions := "[]MatchCondition{" + for _, f := range this.MatchConditions { + repeatedStringForMatchConditions += strings.Replace(strings.Replace(f.String(), "MatchCondition", "MatchCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForMatchConditions += "}" + s := strings.Join([]string{`&MutatingWebhook{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ClientConfig:` + strings.Replace(strings.Replace(this.ClientConfig.String(), "WebhookClientConfig", "WebhookClientConfig", 1), `&`, ``, 1) + `,`, + `Rules:` + repeatedStringForRules + `,`, + `FailurePolicy:` + valueToStringGenerated(this.FailurePolicy) + `,`, + `NamespaceSelector:` + strings.Replace(fmt.Sprintf("%v", this.NamespaceSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, + `SideEffects:` + valueToStringGenerated(this.SideEffects) + `,`, + `TimeoutSeconds:` + valueToStringGenerated(this.TimeoutSeconds) + `,`, + `AdmissionReviewVersions:` + fmt.Sprintf("%v", this.AdmissionReviewVersions) + `,`, + `MatchPolicy:` + valueToStringGenerated(this.MatchPolicy) + `,`, + `ReinvocationPolicy:` + valueToStringGenerated(this.ReinvocationPolicy) + `,`, + `ObjectSelector:` + strings.Replace(fmt.Sprintf("%v", this.ObjectSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, + `MatchConditions:` + repeatedStringForMatchConditions + `,`, + `}`, + }, "") + return s +} +func (this *MutatingWebhookConfiguration) String() string { + if this == nil { + return "nil" + } + repeatedStringForWebhooks := "[]MutatingWebhook{" + for _, f := range this.Webhooks { + repeatedStringForWebhooks += strings.Replace(strings.Replace(f.String(), "MutatingWebhook", "MutatingWebhook", 1), `&`, ``, 1) + "," + } + repeatedStringForWebhooks += "}" + s := strings.Join([]string{`&MutatingWebhookConfiguration{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Webhooks:` + repeatedStringForWebhooks + `,`, + `}`, + }, "") + return s +} +func (this *MutatingWebhookConfigurationList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]MutatingWebhookConfiguration{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "MutatingWebhookConfiguration", "MutatingWebhookConfiguration", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&MutatingWebhookConfigurationList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *Mutation) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Mutation{`, + `PatchType:` + fmt.Sprintf("%v", this.PatchType) + `,`, + `ApplyConfiguration:` + strings.Replace(this.ApplyConfiguration.String(), "ApplyConfiguration", "ApplyConfiguration", 1) + `,`, + `JSONPatch:` + strings.Replace(this.JSONPatch.String(), "JSONPatch", "JSONPatch", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NamedRuleWithOperations) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NamedRuleWithOperations{`, + `ResourceNames:` + fmt.Sprintf("%v", this.ResourceNames) + `,`, + `RuleWithOperations:` + strings.Replace(strings.Replace(this.RuleWithOperations.String(), "RuleWithOperations", "RuleWithOperations", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ParamKind) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ParamKind{`, + `APIVersion:` + fmt.Sprintf("%v", this.APIVersion) + `,`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `}`, + }, "") + return s +} +func (this *ParamRef) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ParamRef{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, + `ParameterNotFoundAction:` + valueToStringGenerated(this.ParameterNotFoundAction) + `,`, + `}`, + }, "") + return s +} +func (this *Rule) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Rule{`, + `APIGroups:` + fmt.Sprintf("%v", this.APIGroups) + `,`, + `APIVersions:` + fmt.Sprintf("%v", this.APIVersions) + `,`, + `Resources:` + fmt.Sprintf("%v", this.Resources) + `,`, + `Scope:` + valueToStringGenerated(this.Scope) + `,`, + `}`, + }, "") + return s +} +func (this *RuleWithOperations) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&RuleWithOperations{`, + `Operations:` + fmt.Sprintf("%v", this.Operations) + `,`, + `Rule:` + strings.Replace(strings.Replace(this.Rule.String(), "Rule", "Rule", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ServiceReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ServiceReference{`, + `Namespace:` + fmt.Sprintf("%v", this.Namespace) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Path:` + valueToStringGenerated(this.Path) + `,`, + `Port:` + valueToStringGenerated(this.Port) + `,`, + `}`, + }, "") + return s +} +func (this *TypeChecking) String() string { + if this == nil { + return "nil" + } + repeatedStringForExpressionWarnings := "[]ExpressionWarning{" + for _, f := range this.ExpressionWarnings { + repeatedStringForExpressionWarnings += strings.Replace(strings.Replace(f.String(), "ExpressionWarning", "ExpressionWarning", 1), `&`, ``, 1) + "," + } + repeatedStringForExpressionWarnings += "}" + s := strings.Join([]string{`&TypeChecking{`, + `ExpressionWarnings:` + repeatedStringForExpressionWarnings + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingAdmissionPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ValidatingAdmissionPolicy{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ValidatingAdmissionPolicySpec", "ValidatingAdmissionPolicySpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ValidatingAdmissionPolicyStatus", "ValidatingAdmissionPolicyStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingAdmissionPolicyBinding) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ValidatingAdmissionPolicyBinding{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ValidatingAdmissionPolicyBindingSpec", "ValidatingAdmissionPolicyBindingSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingAdmissionPolicyBindingList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ValidatingAdmissionPolicyBinding{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ValidatingAdmissionPolicyBinding", "ValidatingAdmissionPolicyBinding", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ValidatingAdmissionPolicyBindingList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingAdmissionPolicyBindingSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ValidatingAdmissionPolicyBindingSpec{`, + `PolicyName:` + fmt.Sprintf("%v", this.PolicyName) + `,`, + `ParamRef:` + strings.Replace(this.ParamRef.String(), "ParamRef", "ParamRef", 1) + `,`, + `MatchResources:` + strings.Replace(this.MatchResources.String(), "MatchResources", "MatchResources", 1) + `,`, + `ValidationActions:` + fmt.Sprintf("%v", this.ValidationActions) + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingAdmissionPolicyList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ValidatingAdmissionPolicy{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ValidatingAdmissionPolicy", "ValidatingAdmissionPolicy", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ValidatingAdmissionPolicyList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingAdmissionPolicySpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForValidations := "[]Validation{" + for _, f := range this.Validations { + repeatedStringForValidations += strings.Replace(strings.Replace(f.String(), "Validation", "Validation", 1), `&`, ``, 1) + "," + } + repeatedStringForValidations += "}" + repeatedStringForAuditAnnotations := "[]AuditAnnotation{" + for _, f := range this.AuditAnnotations { + repeatedStringForAuditAnnotations += strings.Replace(strings.Replace(f.String(), "AuditAnnotation", "AuditAnnotation", 1), `&`, ``, 1) + "," + } + repeatedStringForAuditAnnotations += "}" + repeatedStringForMatchConditions := "[]MatchCondition{" + for _, f := range this.MatchConditions { + repeatedStringForMatchConditions += strings.Replace(strings.Replace(f.String(), "MatchCondition", "MatchCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForMatchConditions += "}" + repeatedStringForVariables := "[]Variable{" + for _, f := range this.Variables { + repeatedStringForVariables += strings.Replace(strings.Replace(f.String(), "Variable", "Variable", 1), `&`, ``, 1) + "," + } + repeatedStringForVariables += "}" + s := strings.Join([]string{`&ValidatingAdmissionPolicySpec{`, + `ParamKind:` + strings.Replace(this.ParamKind.String(), "ParamKind", "ParamKind", 1) + `,`, + `MatchConstraints:` + strings.Replace(this.MatchConstraints.String(), "MatchResources", "MatchResources", 1) + `,`, + `Validations:` + repeatedStringForValidations + `,`, + `FailurePolicy:` + valueToStringGenerated(this.FailurePolicy) + `,`, + `AuditAnnotations:` + repeatedStringForAuditAnnotations + `,`, + `MatchConditions:` + repeatedStringForMatchConditions + `,`, + `Variables:` + repeatedStringForVariables + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingAdmissionPolicyStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&ValidatingAdmissionPolicyStatus{`, + `ObservedGeneration:` + fmt.Sprintf("%v", this.ObservedGeneration) + `,`, + `TypeChecking:` + strings.Replace(this.TypeChecking.String(), "TypeChecking", "TypeChecking", 1) + `,`, + `Conditions:` + repeatedStringForConditions + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingWebhook) String() string { + if this == nil { + return "nil" + } + repeatedStringForRules := "[]RuleWithOperations{" + for _, f := range this.Rules { + repeatedStringForRules += strings.Replace(strings.Replace(f.String(), "RuleWithOperations", "RuleWithOperations", 1), `&`, ``, 1) + "," + } + repeatedStringForRules += "}" + repeatedStringForMatchConditions := "[]MatchCondition{" + for _, f := range this.MatchConditions { + repeatedStringForMatchConditions += strings.Replace(strings.Replace(f.String(), "MatchCondition", "MatchCondition", 1), `&`, ``, 1) + "," + } + repeatedStringForMatchConditions += "}" + s := strings.Join([]string{`&ValidatingWebhook{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ClientConfig:` + strings.Replace(strings.Replace(this.ClientConfig.String(), "WebhookClientConfig", "WebhookClientConfig", 1), `&`, ``, 1) + `,`, + `Rules:` + repeatedStringForRules + `,`, + `FailurePolicy:` + valueToStringGenerated(this.FailurePolicy) + `,`, + `NamespaceSelector:` + strings.Replace(fmt.Sprintf("%v", this.NamespaceSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, + `SideEffects:` + valueToStringGenerated(this.SideEffects) + `,`, + `TimeoutSeconds:` + valueToStringGenerated(this.TimeoutSeconds) + `,`, + `AdmissionReviewVersions:` + fmt.Sprintf("%v", this.AdmissionReviewVersions) + `,`, + `MatchPolicy:` + valueToStringGenerated(this.MatchPolicy) + `,`, + `ObjectSelector:` + strings.Replace(fmt.Sprintf("%v", this.ObjectSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, + `MatchConditions:` + repeatedStringForMatchConditions + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingWebhookConfiguration) String() string { + if this == nil { + return "nil" + } + repeatedStringForWebhooks := "[]ValidatingWebhook{" + for _, f := range this.Webhooks { + repeatedStringForWebhooks += strings.Replace(strings.Replace(f.String(), "ValidatingWebhook", "ValidatingWebhook", 1), `&`, ``, 1) + "," + } + repeatedStringForWebhooks += "}" + s := strings.Join([]string{`&ValidatingWebhookConfiguration{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Webhooks:` + repeatedStringForWebhooks + `,`, + `}`, + }, "") + return s +} +func (this *ValidatingWebhookConfigurationList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ValidatingWebhookConfiguration{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ValidatingWebhookConfiguration", "ValidatingWebhookConfiguration", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ValidatingWebhookConfigurationList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *Validation) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Validation{`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, + `Message:` + fmt.Sprintf("%v", this.Message) + `,`, + `Reason:` + valueToStringGenerated(this.Reason) + `,`, + `MessageExpression:` + fmt.Sprintf("%v", this.MessageExpression) + `,`, + `}`, + }, "") + return s +} +func (this *Variable) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Variable{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, + `}`, + }, "") + return s +} +func (this *WebhookClientConfig) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WebhookClientConfig{`, + `Service:` + strings.Replace(this.Service.String(), "ServiceReference", "ServiceReference", 1) + `,`, + `CABundle:` + valueToStringGenerated(this.CABundle) + `,`, + `URL:` + valueToStringGenerated(this.URL) + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ApplyConfiguration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ApplyConfiguration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ApplyConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expression = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AuditAnnotation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: AuditAnnotation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: AuditAnnotation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueExpression", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValueExpression = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ExpressionWarning) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ExpressionWarning: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ExpressionWarning: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FieldRef", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FieldRef = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Warning", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Warning = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *JSONPatch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: JSONPatch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: JSONPatch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expression = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MatchCondition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MatchCondition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MatchCondition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Expression = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MatchResources) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MatchResources: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MatchResources: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NamespaceSelector", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NamespaceSelector == nil { + m.NamespaceSelector = &v1.LabelSelector{} + } + if err := m.NamespaceSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectSelector", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ObjectSelector == nil { + m.ObjectSelector = &v1.LabelSelector{} + } + if err := m.ObjectSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceRules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceRules = append(m.ResourceRules, NamedRuleWithOperations{}) + if err := m.ResourceRules[len(m.ResourceRules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ExcludeResourceRules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ExcludeResourceRules = append(m.ExcludeResourceRules, NamedRuleWithOperations{}) + if err := m.ExcludeResourceRules[len(m.ExcludeResourceRules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MatchPolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := MatchPolicyType(dAtA[iNdEx:postIndex]) + m.MatchPolicy = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MutatingAdmissionPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MutatingAdmissionPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MutatingAdmissionPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - s := strings.Join([]string{`&WebhookClientConfig{`, - `Service:` + strings.Replace(this.Service.String(), "ServiceReference", "ServiceReference", 1) + `,`, - `CABundle:` + valueToStringGenerated(this.CABundle) + `,`, - `URL:` + valueToStringGenerated(this.URL) + `,`, - `}`, - }, "") - return s + return nil } -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" +func (m *MutatingAdmissionPolicyBinding) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MutatingAdmissionPolicyBinding: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MutatingAdmissionPolicyBinding: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *AuditAnnotation) Unmarshal(dAtA []byte) error { +func (m *MutatingAdmissionPolicyBindingList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2625,17 +4335,17 @@ func (m *AuditAnnotation) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AuditAnnotation: wiretype end group for non-group") + return fmt.Errorf("proto: MutatingAdmissionPolicyBindingList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AuditAnnotation: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MutatingAdmissionPolicyBindingList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2645,29 +4355,30 @@ func (m *AuditAnnotation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValueExpression", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2677,23 +4388,25 @@ func (m *AuditAnnotation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.ValueExpression = string(dAtA[iNdEx:postIndex]) + m.Items = append(m.Items, MutatingAdmissionPolicyBinding{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2716,7 +4429,7 @@ func (m *AuditAnnotation) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExpressionWarning) Unmarshal(dAtA []byte) error { +func (m *MutatingAdmissionPolicyBindingSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2739,15 +4452,15 @@ func (m *ExpressionWarning) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExpressionWarning: wiretype end group for non-group") + return fmt.Errorf("proto: MutatingAdmissionPolicyBindingSpec: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExpressionWarning: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MutatingAdmissionPolicyBindingSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FieldRef", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PolicyName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2775,13 +4488,49 @@ func (m *ExpressionWarning) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FieldRef = string(dAtA[iNdEx:postIndex]) + m.PolicyName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ParamRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ParamRef == nil { + m.ParamRef = &ParamRef{} + } + if err := m.ParamRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Warning", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MatchResources", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2791,23 +4540,27 @@ func (m *ExpressionWarning) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Warning = string(dAtA[iNdEx:postIndex]) + if m.MatchResources == nil { + m.MatchResources = &MatchResources{} + } + if err := m.MatchResources.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2830,7 +4583,7 @@ func (m *ExpressionWarning) Unmarshal(dAtA []byte) error { } return nil } -func (m *MatchCondition) Unmarshal(dAtA []byte) error { +func (m *MutatingAdmissionPolicyList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2853,17 +4606,17 @@ func (m *MatchCondition) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MatchCondition: wiretype end group for non-group") + return fmt.Errorf("proto: MutatingAdmissionPolicyList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MatchCondition: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MutatingAdmissionPolicyList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2873,29 +4626,30 @@ func (m *MatchCondition) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Expression", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -2905,23 +4659,25 @@ func (m *MatchCondition) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Expression = string(dAtA[iNdEx:postIndex]) + m.Items = append(m.Items, MutatingAdmissionPolicy{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -2944,7 +4700,7 @@ func (m *MatchCondition) Unmarshal(dAtA []byte) error { } return nil } -func (m *MatchResources) Unmarshal(dAtA []byte) error { +func (m *MutatingAdmissionPolicySpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2967,15 +4723,15 @@ func (m *MatchResources) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MatchResources: wiretype end group for non-group") + return fmt.Errorf("proto: MutatingAdmissionPolicySpec: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MatchResources: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MutatingAdmissionPolicySpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NamespaceSelector", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ParamKind", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3002,16 +4758,16 @@ func (m *MatchResources) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.NamespaceSelector == nil { - m.NamespaceSelector = &v1.LabelSelector{} + if m.ParamKind == nil { + m.ParamKind = &ParamKind{} } - if err := m.NamespaceSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.ParamKind.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectSelector", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MatchConstraints", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3038,16 +4794,16 @@ func (m *MatchResources) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ObjectSelector == nil { - m.ObjectSelector = &v1.LabelSelector{} + if m.MatchConstraints == nil { + m.MatchConstraints = &MatchResources{} } - if err := m.ObjectSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MatchConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceRules", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Variables", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3074,14 +4830,14 @@ func (m *MatchResources) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ResourceRules = append(m.ResourceRules, NamedRuleWithOperations{}) - if err := m.ResourceRules[len(m.ResourceRules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Variables = append(m.Variables, Variable{}) + if err := m.Variables[len(m.Variables)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExcludeResourceRules", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Mutations", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3108,14 +4864,81 @@ func (m *MatchResources) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ExcludeResourceRules = append(m.ExcludeResourceRules, NamedRuleWithOperations{}) - if err := m.ExcludeResourceRules[len(m.ExcludeResourceRules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Mutations = append(m.Mutations, Mutation{}) + if err := m.Mutations[len(m.Mutations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FailurePolicy", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := FailurePolicyType(dAtA[iNdEx:postIndex]) + m.FailurePolicy = &s + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MatchConditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MatchConditions = append(m.MatchConditions, MatchCondition{}) + if err := m.MatchConditions[len(m.MatchConditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchPolicy", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ReinvocationPolicy", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3143,8 +4966,7 @@ func (m *MatchResources) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - s := MatchPolicyType(dAtA[iNdEx:postIndex]) - m.MatchPolicy = &s + m.ReinvocationPolicy = ReinvocationPolicyType(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3840,6 +5662,160 @@ func (m *MutatingWebhookConfigurationList) Unmarshal(dAtA []byte) error { } return nil } +func (m *Mutation) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Mutation: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Mutation: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PatchType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PatchType = PatchType(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApplyConfiguration", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ApplyConfiguration == nil { + m.ApplyConfiguration = &ApplyConfiguration{} + } + if err := m.ApplyConfiguration.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field JSONPatch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.JSONPatch == nil { + m.JSONPatch = &JSONPatch{} + } + if err := m.JSONPatch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NamedRuleWithOperations) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/admissionregistration/v1/generated.proto b/vendor/k8s.io/api/admissionregistration/v1/generated.proto index e856e9eaf2..89c1475b2e 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/generated.proto +++ b/vendor/k8s.io/api/admissionregistration/v1/generated.proto @@ -28,6 +28,51 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; // Package-wide variables from generator "generated". option go_package = "k8s.io/api/admissionregistration/v1"; +// ApplyConfiguration defines the desired configuration values of an object. +message ApplyConfiguration { + // expression will be evaluated by CEL to create an apply configuration. + // ref: https://github.com/google/cel-spec + // + // Apply configurations are declared in CEL using object initialization. For example, this CEL expression + // returns an apply configuration to set a single field: + // + // Object{ + // spec: Object.spec{ + // serviceAccountName: "example" + // } + // } + // + // Apply configurations may not modify atomic structs, maps or arrays due to the risk of accidental deletion of + // values not included in the apply configuration. + // + // CEL expressions have access to the object types needed to create apply configurations: + // + // - 'Object' - CEL type of the resource object. + // - 'Object.' - CEL type of object field (such as 'Object.spec') + // - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + // + // CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + // + // - 'object' - The object from the incoming request. The value is null for DELETE requests. + // - 'oldObject' - The existing object. The value is null for CREATE requests. + // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + // - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + // For example, a variable named 'foo' can be accessed as 'variables.foo'. + // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + // request resource. + // + // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the + // object. No other metadata properties are accessible. + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Required. + optional string expression = 1; +} + // AuditAnnotation describes how to produce an audit annotation for an API request. message AuditAnnotation { // key specifies the audit annotation key. The audit annotation keys of @@ -67,20 +112,89 @@ message AuditAnnotation { // ExpressionWarning is a warning information that targets a specific expression. message ExpressionWarning { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" optional string fieldRef = 2; - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. optional string warning = 3; } +// JSONPatch defines a JSON Patch. +message JSONPatch { + // expression will be evaluated by CEL to create a [JSON patch](https://jsonpatch.com/). + // ref: https://github.com/google/cel-spec + // + // expression must return an array of JSONPatch values. + // + // For example, this CEL expression returns a JSON patch to conditionally modify a value: + // + // [ + // JSONPatch{op: "test", path: "/spec/example", value: "Red"}, + // JSONPatch{op: "replace", path: "/spec/example", value: "Green"} + // ] + // + // To define an object for the patch value, use Object types. For example: + // + // [ + // JSONPatch{ + // op: "add", + // path: "/spec/selector", + // value: Object.spec.selector{matchLabels: {"environment": "test"}} + // } + // ] + // + // To use strings containing '/' and '~' as JSONPatch path keys, use "jsonpatch.escapeKey". For example: + // + // [ + // JSONPatch{ + // op: "add", + // path: "/metadata/labels/" + jsonpatch.escapeKey("example.com/environment"), + // value: "test" + // }, + // ] + // + // CEL expressions have access to the types needed to create JSON patches and objects: + // + // - 'JSONPatch' - CEL type of JSON Patch operations. JSONPatch has the fields 'op', 'from', 'path' and 'value'. + // See [JSON patch](https://jsonpatch.com/) for more details. The 'value' field may be set to any of: string, + // integer, array, map or object. If set, the 'path' and 'from' fields must be set to a + // [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901/) string, where the 'jsonpatch.escapeKey()' CEL + // function may be used to escape path keys containing '/' and '~'. + // - 'Object' - CEL type of the resource object. + // - 'Object.' - CEL type of object field (such as 'Object.spec') + // - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + // + // CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + // + // - 'object' - The object from the incoming request. The value is null for DELETE requests. + // - 'oldObject' - The existing object. The value is null for CREATE requests. + // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + // - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + // For example, a variable named 'foo' can be accessed as 'variables.foo'. + // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + // request resource. + // + // CEL expressions have access to [Kubernetes CEL function libraries](https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries) + // as well as: + // + // - 'jsonpatch.escapeKey' - Performs JSONPatch key escaping. '~' and '/' are escaped as '~0' and `~1' respectively). + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Required. + optional string expression = 1; +} + // MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook. message MatchCondition { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -91,7 +205,7 @@ message MatchCondition { // Required. optional string name = 1; - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. @@ -112,7 +226,7 @@ message MatchCondition { // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +structType=atomic message MatchResources { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -158,7 +272,7 @@ message MatchResources { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 1; - // ObjectSelector decides whether to run the validation based on if the + // objectSelector decides whether to run the validation based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the cel validation, and // is considered to match if either object matches the selector. A null @@ -172,13 +286,13 @@ message MatchResources { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 2; - // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. + // resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. // The policy cares about an operation if it matches _any_ Rule. // +listType=atomic // +optional repeated NamedRuleWithOperations resourceRules = 3; - // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +listType=atomic // +optional @@ -202,20 +316,187 @@ message MatchResources { optional string matchPolicy = 7; } +// MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. +message MutatingAdmissionPolicy { + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the desired behavior of the MutatingAdmissionPolicy. + optional MutatingAdmissionPolicySpec spec = 2; +} + +// MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. +// MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators +// configure policies for clusters. +// +// For a given admission request, each binding will cause its policy to be +// evaluated N times, where N is 1 for policies/bindings that don't use +// params, otherwise N is the number of parameters selected by the binding. +// Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-cost-budget). +// +// Adding/removing policies, bindings, or params can not affect whether a +// given (policy, binding, param) combination is within its own CEL budget. +message MutatingAdmissionPolicyBinding { + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. + optional MutatingAdmissionPolicyBindingSpec spec = 2; +} + +// MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. +message MutatingAdmissionPolicyBindingList { + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // List of PolicyBinding. + repeated MutatingAdmissionPolicyBinding items = 2; +} + +// MutatingAdmissionPolicyBindingSpec defines the specification of the MutatingAdmissionPolicyBinding. +message MutatingAdmissionPolicyBindingSpec { + // policyName references a MutatingAdmissionPolicy name which the MutatingAdmissionPolicyBinding binds to. + // If the referenced resource does not exist, this binding is considered invalid and will be ignored + // Required. + optional string policyName = 1; + + // paramRef specifies the parameter resource used to configure the admission control policy. + // It should point to a resource of the type specified in spec.ParamKind of the bound MutatingAdmissionPolicy. + // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the MutatingAdmissionPolicy applied. + // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + // +optional + optional ParamRef paramRef = 2; + + // matchResources limits what resources match this binding and may be mutated by it. + // Note that if matchResources matches a resource, the resource must also match a policy's matchConstraints and + // matchConditions before the resource may be mutated. + // When matchResources is unset, it does not constrain resource matching, and only the policy's matchConstraints + // and matchConditions must match for the resource to be mutated. + // Additionally, matchResources.resourceRules are optional and do not constraint matching when unset. + // Note that this is differs from MutatingAdmissionPolicy matchConstraints, where resourceRules are required. + // The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + // '*' matches CREATE, UPDATE and CONNECT. + // +optional + optional MatchResources matchResources = 3; +} + +// MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. +message MutatingAdmissionPolicyList { + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // List of ValidatingAdmissionPolicy. + repeated MutatingAdmissionPolicy items = 2; +} + +// MutatingAdmissionPolicySpec defines the desired behavior of the admission policy. +message MutatingAdmissionPolicySpec { + // paramKind specifies the kind of resources used to parameterize this policy. + // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. + // If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. + // If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null. + // +optional + optional ParamKind paramKind = 1; + + // matchConstraints specifies what resources this policy is designed to validate. + // The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints. + // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API + // MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding. + // The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + // '*' matches CREATE, UPDATE and CONNECT. + // Required. + optional MatchResources matchConstraints = 2; + + // variables contain definitions of variables that can be used in composition of other expressions. + // Each variable is defined as a named CEL expression. + // The variables defined here will be available under `variables` in other expressions of the policy + // except matchConditions because matchConditions are evaluated before the rest of the policy. + // + // The expression of a variable can refer to other variables defined earlier in the list but not those after. + // Thus, variables must be sorted by the order of first appearance and acyclic. + // +listType=atomic + // +optional + repeated Variable variables = 3; + + // mutations contain operations to perform on matching objects. + // mutations may not be empty; a minimum of one mutation is required. + // mutations are evaluated in order, and are reinvoked according to + // the reinvocationPolicy. + // The mutations of a policy are invoked for each binding of this policy + // and reinvocation of mutations occurs on a per binding basis. + // + // +listType=atomic + // +optional + repeated Mutation mutations = 4; + + // failurePolicy defines how to handle failures for the admission policy. Failures can + // occur from CEL expression parse errors, type check errors, runtime errors and invalid + // or mis-configured policy definitions or bindings. + // + // A policy is invalid if paramKind refers to a non-existent Kind. + // A binding is invalid if paramRef.name refers to a non-existent resource. + // + // failurePolicy does not define how validations that evaluate to false are handled. + // + // Allowed values are Ignore or Fail. Defaults to Fail. + // +optional + optional string failurePolicy = 5; + + // matchConditions is a list of conditions that must be met for a request to be validated. + // Match conditions filter requests that have already been matched by the matchConstraints. + // An empty list of matchConditions matches all requests. + // There are a maximum of 64 match conditions allowed. + // + // If a parameter object is provided, it can be accessed via the `params` handle in the same + // manner as validation expressions. + // + // The exact matching logic is (in order): + // 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + // 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + // 3. If any matchCondition evaluates to an error (but none are FALSE): + // - If failurePolicy=Fail, reject the request + // - If failurePolicy=Ignore, the policy is skipped + // + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +optional + repeated MatchCondition matchConditions = 6; + + // reinvocationPolicy indicates whether mutations may be called multiple times per MutatingAdmissionPolicyBinding + // as part of a single admission evaluation. + // Allowed values are "Never" and "IfNeeded". + // + // Never: These mutations will not be called more than once per binding in a single admission evaluation. + // + // IfNeeded: These mutations may be invoked more than once per binding for a single admission request and there is no guarantee of + // order with respect to other admission plugins, admission webhooks, bindings of this policy and admission policies. Mutations are only + // reinvoked when mutations change the object after this mutation is invoked. + // Required. + optional string reinvocationPolicy = 7; +} + // MutatingWebhook describes an admission webhook and the resources and operations it applies to. message MutatingWebhook { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. optional string name = 1; - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required optional WebhookClientConfig clientConfig = 2; - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -224,7 +505,7 @@ message MutatingWebhook { // +listType=atomic repeated RuleWithOperations rules = 3; - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Fail. // +optional optional string failurePolicy = 4; @@ -246,7 +527,7 @@ message MutatingWebhook { // +optional optional string matchPolicy = 9; - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -292,7 +573,7 @@ message MutatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5; - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -306,7 +587,7 @@ message MutatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 11; - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -314,7 +595,7 @@ message MutatingWebhook { // sideEffects == Unknown or Some. optional string sideEffects = 6; - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -322,7 +603,7 @@ message MutatingWebhook { // +optional optional int32 timeoutSeconds = 7; - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -350,7 +631,7 @@ message MutatingWebhook { // +optional optional string reinvocationPolicy = 10; - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -372,11 +653,11 @@ message MutatingWebhook { // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. message MutatingWebhookConfiguration { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -387,7 +668,7 @@ message MutatingWebhookConfiguration { // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. message MutatingWebhookConfigurationList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -396,10 +677,30 @@ message MutatingWebhookConfigurationList { repeated MutatingWebhookConfiguration items = 2; } +// Mutation specifies the CEL expression which is used to apply the Mutation. +message Mutation { + // patchType indicates the patch strategy used. + // Allowed values are "ApplyConfiguration" and "JSONPatch". + // Required. + // + // +unionDiscriminator + optional string patchType = 2; + + // applyConfiguration defines the desired configuration values of an object. + // The configuration is applied to the admission object using + // [structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff). + // A CEL expression is used to create apply configuration. + optional ApplyConfiguration applyConfiguration = 3; + + // jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object. + // A CEL expression is used to create the JSON patch. + optional JSONPatch jsonPatch = 4; +} + // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. // +structType=atomic message NamedRuleWithOperations { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +listType=atomic // +optional repeated string resourceNames = 1; @@ -411,12 +712,12 @@ message NamedRuleWithOperations { // ParamKind is a tuple of Group Kind and Version. // +structType=atomic message ParamKind { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. optional string apiVersion = 1; - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. optional string kind = 2; } @@ -465,7 +766,7 @@ message ParamRef { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3; - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. @@ -481,19 +782,19 @@ message ParamRef { // Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended // to make sure that all the tuple expansions are valid. message Rule { - // APIGroups is the API groups the resources belong to. '*' is all groups. + // apiGroups is the API groups the resources belong to. '*' is all groups. // If '*' is present, the length of the slice must be one. // Required. // +listType=atomic repeated string apiGroups = 1; - // APIVersions is the API versions the resources belong to. '*' is all versions. + // apiVersions is the API versions the resources belong to. '*' is all versions. // If '*' is present, the length of the slice must be one. // Required. // +listType=atomic repeated string apiVersions = 2; - // Resources is a list of resources this rule applies to. + // resources is a list of resources this rule applies to. // // For example: // 'pods' means pods. @@ -527,7 +828,7 @@ message Rule { // RuleWithOperations is a tuple of Operations and Resources. It is recommended to make // sure that all the tuple expansions are valid. message RuleWithOperations { - // Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * + // operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * // for all of those operations and any future admission operations that are added. // If '*' is present, the length of the slice must be one. // Required. @@ -541,20 +842,20 @@ message RuleWithOperations { // ServiceReference holds a reference to Service.legacy.k8s.io message ServiceReference { - // `namespace` is the namespace of the service. + // namespace is the namespace of the service. // Required optional string namespace = 1; - // `name` is the name of the service. + // name is the name of the service. // Required optional string name = 2; - // `path` is an optional URL path which will be sent in any request to + // path is an optional URL path which will be sent in any request to // this service. // +optional optional string path = 3; - // If specified, the port on the service that hosting webhook. + // port is the port on the service that hosts the webhook. // Default to 443 for backward compatibility. // `port` should be a valid port number (1-65535, inclusive). // +optional @@ -564,7 +865,7 @@ message ServiceReference { // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy message TypeChecking { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. // +optional // +listType=atomic repeated ExpressionWarning expressionWarnings = 1; @@ -572,14 +873,14 @@ message TypeChecking { // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. message ValidatingAdmissionPolicy { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. optional ValidatingAdmissionPolicySpec spec = 2; - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. @@ -599,17 +900,18 @@ message ValidatingAdmissionPolicy { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. message ValidatingAdmissionPolicyBinding { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. + // +required optional ValidatingAdmissionPolicyBindingSpec spec = 2; } // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. message ValidatingAdmissionPolicyBindingList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -620,9 +922,11 @@ message ValidatingAdmissionPolicyBindingList { // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. message ValidatingAdmissionPolicyBindingSpec { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string policyName = 1; // paramRef specifies the parameter resource used to configure the admission control policy. @@ -632,7 +936,7 @@ message ValidatingAdmissionPolicyBindingSpec { // +optional optional ParamRef paramRef = 2; - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. @@ -680,12 +984,14 @@ message ValidatingAdmissionPolicyBindingSpec { // // Required. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required repeated string validationActions = 4; } // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. message ValidatingAdmissionPolicyList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -696,21 +1002,21 @@ message ValidatingAdmissionPolicyList { // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. message ValidatingAdmissionPolicySpec { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. // +optional optional ParamKind paramKind = 1; - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. optional MatchResources matchConstraints = 2; - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. // +listType=atomic @@ -741,7 +1047,7 @@ message ValidatingAdmissionPolicySpec { // +optional repeated AuditAnnotation auditAnnotations = 5; - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -763,7 +1069,7 @@ message ValidatingAdmissionPolicySpec { // +optional repeated MatchCondition matchConditions = 6; - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. @@ -780,16 +1086,16 @@ message ValidatingAdmissionPolicySpec { // ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. message ValidatingAdmissionPolicyStatus { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. // +optional optional int64 observedGeneration = 1; - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. // +optional optional TypeChecking typeChecking = 2; - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. // +optional // +listType=map // +listMapKey=type @@ -798,18 +1104,18 @@ message ValidatingAdmissionPolicyStatus { // ValidatingWebhook describes an admission webhook and the resources and operations it applies to. message ValidatingWebhook { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. optional string name = 1; - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required optional WebhookClientConfig clientConfig = 2; - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -818,7 +1124,7 @@ message ValidatingWebhook { // +listType=atomic repeated RuleWithOperations rules = 3; - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Fail. // +optional optional string failurePolicy = 4; @@ -840,7 +1146,7 @@ message ValidatingWebhook { // +optional optional string matchPolicy = 9; - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -886,7 +1192,7 @@ message ValidatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5; - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -900,7 +1206,7 @@ message ValidatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 10; - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -908,7 +1214,7 @@ message ValidatingWebhook { // sideEffects == Unknown or Some. optional string sideEffects = 6; - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -916,7 +1222,7 @@ message ValidatingWebhook { // +optional optional int32 timeoutSeconds = 7; - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -926,7 +1232,7 @@ message ValidatingWebhook { // +listType=atomic repeated string admissionReviewVersions = 8; - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -948,11 +1254,11 @@ message ValidatingWebhook { // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. message ValidatingWebhookConfiguration { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -963,7 +1269,7 @@ message ValidatingWebhookConfiguration { // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. message ValidatingWebhookConfigurationList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -974,7 +1280,7 @@ message ValidatingWebhookConfigurationList { // Validation specifies the CEL expression which is used to apply the validation. message Validation { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -1017,7 +1323,7 @@ message Validation { // Required. optional string Expression = 1; - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -1027,7 +1333,7 @@ message Validation { // +optional optional string message = 2; - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. @@ -1053,12 +1359,12 @@ message Validation { // Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. // +structType=atomic message Variable { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` optional string Name = 1; - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. optional string Expression = 2; } @@ -1066,7 +1372,7 @@ message Variable { // WebhookClientConfig contains the information to make a TLS // connection with the webhook message WebhookClientConfig { - // `url` gives the location of the webhook, in standard URL form + // url gives the location of the webhook, in standard URL form // (`scheme://host:port/path`). Exactly one of `url` or `service` // must be specified. // @@ -1095,7 +1401,7 @@ message WebhookClientConfig { // +optional optional string url = 3; - // `service` is a reference to the service for this webhook. Either + // service is a reference to the service for this webhook. Either // `service` or `url` must be specified. // // If the webhook is running within the cluster, then you should use `service`. @@ -1103,7 +1409,7 @@ message WebhookClientConfig { // +optional optional ServiceReference service = 1; - // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. // If unspecified, system trust roots on the apiserver are used. // +optional optional bytes caBundle = 2; diff --git a/vendor/k8s.io/api/admissionregistration/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/admissionregistration/v1/generated.protomessage.pb.go deleted file mode 100644 index 04a23c597c..0000000000 --- a/vendor/k8s.io/api/admissionregistration/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*AuditAnnotation) ProtoMessage() {} - -func (*ExpressionWarning) ProtoMessage() {} - -func (*MatchCondition) ProtoMessage() {} - -func (*MatchResources) ProtoMessage() {} - -func (*MutatingWebhook) ProtoMessage() {} - -func (*MutatingWebhookConfiguration) ProtoMessage() {} - -func (*MutatingWebhookConfigurationList) ProtoMessage() {} - -func (*NamedRuleWithOperations) ProtoMessage() {} - -func (*ParamKind) ProtoMessage() {} - -func (*ParamRef) ProtoMessage() {} - -func (*Rule) ProtoMessage() {} - -func (*RuleWithOperations) ProtoMessage() {} - -func (*ServiceReference) ProtoMessage() {} - -func (*TypeChecking) ProtoMessage() {} - -func (*ValidatingAdmissionPolicy) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBinding) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBindingList) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBindingSpec) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyList) ProtoMessage() {} - -func (*ValidatingAdmissionPolicySpec) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyStatus) ProtoMessage() {} - -func (*ValidatingWebhook) ProtoMessage() {} - -func (*ValidatingWebhookConfiguration) ProtoMessage() {} - -func (*ValidatingWebhookConfigurationList) ProtoMessage() {} - -func (*Validation) ProtoMessage() {} - -func (*Variable) ProtoMessage() {} - -func (*WebhookClientConfig) ProtoMessage() {} diff --git a/vendor/k8s.io/api/admissionregistration/v1/register.go b/vendor/k8s.io/api/admissionregistration/v1/register.go index da74379ce2..c1137d2bd4 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/register.go +++ b/vendor/k8s.io/api/admissionregistration/v1/register.go @@ -54,6 +54,10 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ValidatingAdmissionPolicyList{}, &ValidatingAdmissionPolicyBinding{}, &ValidatingAdmissionPolicyBindingList{}, + &MutatingAdmissionPolicy{}, + &MutatingAdmissionPolicyList{}, + &MutatingAdmissionPolicyBinding{}, + &MutatingAdmissionPolicyBindingList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/k8s.io/api/admissionregistration/v1/types.go b/vendor/k8s.io/api/admissionregistration/v1/types.go index 311c05c0ff..f7a07b6453 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/types.go +++ b/vendor/k8s.io/api/admissionregistration/v1/types.go @@ -23,19 +23,19 @@ import ( // Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended // to make sure that all the tuple expansions are valid. type Rule struct { - // APIGroups is the API groups the resources belong to. '*' is all groups. + // apiGroups is the API groups the resources belong to. '*' is all groups. // If '*' is present, the length of the slice must be one. // Required. // +listType=atomic APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,1,rep,name=apiGroups"` - // APIVersions is the API versions the resources belong to. '*' is all versions. + // apiVersions is the API versions the resources belong to. '*' is all versions. // If '*' is present, the length of the slice must be one. // Required. // +listType=atomic APIVersions []string `json:"apiVersions,omitempty" protobuf:"bytes,2,rep,name=apiVersions"` - // Resources is a list of resources this rule applies to. + // resources is a list of resources this rule applies to. // // For example: // 'pods' means pods. @@ -141,12 +141,12 @@ const ( // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicy struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. Spec ValidatingAdmissionPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. @@ -156,14 +156,14 @@ type ValidatingAdmissionPolicy struct { // ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. type ValidatingAdmissionPolicyStatus struct { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. // +optional TypeChecking *TypeChecking `json:"typeChecking,omitempty" protobuf:"bytes,2,opt,name=typeChecking"` - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. // +optional // +listType=map // +listMapKey=type @@ -176,7 +176,7 @@ type ValidatingAdmissionPolicyConditionType string // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy type TypeChecking struct { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. // +optional // +listType=atomic ExpressionWarnings []ExpressionWarning `json:"expressionWarnings,omitempty" protobuf:"bytes,1,rep,name=expressionWarnings"` @@ -184,11 +184,11 @@ type TypeChecking struct { // ExpressionWarning is a warning information that targets a specific expression. type ExpressionWarning struct { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" FieldRef string `json:"fieldRef" protobuf:"bytes,2,opt,name=fieldRef"` - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. Warning string `json:"warning" protobuf:"bytes,3,opt,name=warning"` @@ -200,7 +200,7 @@ type ExpressionWarning struct { // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -210,21 +210,21 @@ type ValidatingAdmissionPolicyList struct { // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. type ValidatingAdmissionPolicySpec struct { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. // +optional ParamKind *ParamKind `json:"paramKind,omitempty" protobuf:"bytes,1,rep,name=paramKind"` - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. MatchConstraints *MatchResources `json:"matchConstraints,omitempty" protobuf:"bytes,2,rep,name=matchConstraints"` - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. // +listType=atomic @@ -255,7 +255,7 @@ type ValidatingAdmissionPolicySpec struct { // +optional AuditAnnotations []AuditAnnotation `json:"auditAnnotations,omitempty" protobuf:"bytes,5,rep,name=auditAnnotations"` - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -277,7 +277,7 @@ type ValidatingAdmissionPolicySpec struct { // +optional MatchConditions []MatchCondition `json:"matchConditions,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,6,rep,name=matchConditions"` - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. @@ -295,19 +295,19 @@ type ValidatingAdmissionPolicySpec struct { // ParamKind is a tuple of Group Kind and Version. // +structType=atomic type ParamKind struct { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,1,rep,name=apiVersion"` - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. Kind string `json:"kind,omitempty" protobuf:"bytes,2,rep,name=kind"` } // Validation specifies the CEL expression which is used to apply the validation. type Validation struct { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -349,7 +349,7 @@ type Validation struct { // non-intersecting keys are appended, retaining their partial order. // Required. Expression string `json:"expression" protobuf:"bytes,1,opt,name=Expression"` - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -358,7 +358,7 @@ type Validation struct { // If unset, the message is "failed Expression: {Expression}". // +optional Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. @@ -383,12 +383,12 @@ type Validation struct { // Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. // +structType=atomic type Variable struct { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` Name string `json:"name" protobuf:"bytes,1,opt,name=Name"` - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. Expression string `json:"expression" protobuf:"bytes,2,opt,name=Expression"` } @@ -448,10 +448,11 @@ type AuditAnnotation struct { // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBinding struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. + // +required Spec ValidatingAdmissionPolicyBindingSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } @@ -461,7 +462,7 @@ type ValidatingAdmissionPolicyBinding struct { // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -471,9 +472,11 @@ type ValidatingAdmissionPolicyBindingList struct { // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingSpec struct { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required PolicyName string `json:"policyName,omitempty" protobuf:"bytes,1,rep,name=policyName"` // paramRef specifies the parameter resource used to configure the admission control policy. @@ -483,7 +486,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // +optional ParamRef *ParamRef `json:"paramRef,omitempty" protobuf:"bytes,2,rep,name=paramRef"` - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. @@ -531,6 +534,8 @@ type ValidatingAdmissionPolicyBindingSpec struct { // // Required. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required ValidationActions []ValidationAction `json:"validationActions,omitempty" protobuf:"bytes,4,rep,name=validationActions"` } @@ -579,7 +584,7 @@ type ParamRef struct { // +optional Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,3,rep,name=selector"` - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. @@ -597,7 +602,7 @@ type ParamRef struct { // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +structType=atomic type MatchResources struct { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -642,7 +647,7 @@ type MatchResources struct { // Default to the empty LabelSelector, which matches everything. // +optional NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,1,opt,name=namespaceSelector"` - // ObjectSelector decides whether to run the validation based on if the + // objectSelector decides whether to run the validation based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the cel validation, and // is considered to match if either object matches the selector. A null @@ -655,12 +660,12 @@ type MatchResources struct { // Default to the empty LabelSelector, which matches everything. // +optional ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty" protobuf:"bytes,2,opt,name=objectSelector"` - // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. + // resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. // The policy cares about an operation if it matches _any_ Rule. // +listType=atomic // +optional ResourceRules []NamedRuleWithOperations `json:"resourceRules,omitempty" protobuf:"bytes,3,rep,name=resourceRules"` - // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +listType=atomic // +optional @@ -704,7 +709,7 @@ const ( // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. // +structType=atomic type NamedRuleWithOperations struct { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +listType=atomic // +optional ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,1,rep,name=resourceNames"` @@ -720,10 +725,10 @@ type NamedRuleWithOperations struct { // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. type ValidatingWebhookConfiguration struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -738,7 +743,7 @@ type ValidatingWebhookConfiguration struct { // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. type ValidatingWebhookConfigurationList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -754,10 +759,10 @@ type ValidatingWebhookConfigurationList struct { // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. type MutatingWebhookConfiguration struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -772,7 +777,7 @@ type MutatingWebhookConfiguration struct { // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. type MutatingWebhookConfigurationList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -782,18 +787,18 @@ type MutatingWebhookConfigurationList struct { // ValidatingWebhook describes an admission webhook and the resources and operations it applies to. type ValidatingWebhook struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig WebhookClientConfig `json:"clientConfig" protobuf:"bytes,2,opt,name=clientConfig"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -802,7 +807,7 @@ type ValidatingWebhook struct { // +listType=atomic Rules []RuleWithOperations `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Fail. // +optional FailurePolicy *FailurePolicyType `json:"failurePolicy,omitempty" protobuf:"bytes,4,opt,name=failurePolicy,casttype=FailurePolicyType"` @@ -824,7 +829,7 @@ type ValidatingWebhook struct { // +optional MatchPolicy *MatchPolicyType `json:"matchPolicy,omitempty" protobuf:"bytes,9,opt,name=matchPolicy,casttype=MatchPolicyType"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -870,7 +875,7 @@ type ValidatingWebhook struct { // +optional NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,5,opt,name=namespaceSelector"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -884,7 +889,7 @@ type ValidatingWebhook struct { // +optional ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty" protobuf:"bytes,10,opt,name=objectSelector"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -892,7 +897,7 @@ type ValidatingWebhook struct { // sideEffects == Unknown or Some. SideEffects *SideEffectClass `json:"sideEffects" protobuf:"bytes,6,opt,name=sideEffects,casttype=SideEffectClass"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -900,7 +905,7 @@ type ValidatingWebhook struct { // +optional TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,7,opt,name=timeoutSeconds"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -910,7 +915,7 @@ type ValidatingWebhook struct { // +listType=atomic AdmissionReviewVersions []string `json:"admissionReviewVersions" protobuf:"bytes,8,rep,name=admissionReviewVersions"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -932,18 +937,18 @@ type ValidatingWebhook struct { // MutatingWebhook describes an admission webhook and the resources and operations it applies to. type MutatingWebhook struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig WebhookClientConfig `json:"clientConfig" protobuf:"bytes,2,opt,name=clientConfig"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -952,7 +957,7 @@ type MutatingWebhook struct { // +listType=atomic Rules []RuleWithOperations `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Fail. // +optional FailurePolicy *FailurePolicyType `json:"failurePolicy,omitempty" protobuf:"bytes,4,opt,name=failurePolicy,casttype=FailurePolicyType"` @@ -974,7 +979,7 @@ type MutatingWebhook struct { // +optional MatchPolicy *MatchPolicyType `json:"matchPolicy,omitempty" protobuf:"bytes,9,opt,name=matchPolicy,casttype=MatchPolicyType"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -1020,7 +1025,7 @@ type MutatingWebhook struct { // +optional NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,5,opt,name=namespaceSelector"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -1034,7 +1039,7 @@ type MutatingWebhook struct { // +optional ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty" protobuf:"bytes,11,opt,name=objectSelector"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -1042,7 +1047,7 @@ type MutatingWebhook struct { // sideEffects == Unknown or Some. SideEffects *SideEffectClass `json:"sideEffects" protobuf:"bytes,6,opt,name=sideEffects,casttype=SideEffectClass"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -1050,7 +1055,7 @@ type MutatingWebhook struct { // +optional TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,7,opt,name=timeoutSeconds"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -1078,7 +1083,7 @@ type MutatingWebhook struct { // +optional ReinvocationPolicy *ReinvocationPolicyType `json:"reinvocationPolicy,omitempty" protobuf:"bytes,10,opt,name=reinvocationPolicy,casttype=ReinvocationPolicyType"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -1098,6 +1103,335 @@ type MutatingWebhook struct { MatchConditions []MatchCondition `json:"matchConditions,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,12,opt,name=matchConditions"` } +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 + +// MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. +type MutatingAdmissionPolicy struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // spec defines the desired behavior of the MutatingAdmissionPolicy. + Spec MutatingAdmissionPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 + +// MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. +type MutatingAdmissionPolicyList struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // List of ValidatingAdmissionPolicy. + Items []MutatingAdmissionPolicy `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// MutatingAdmissionPolicySpec defines the desired behavior of the admission policy. +type MutatingAdmissionPolicySpec struct { + // paramKind specifies the kind of resources used to parameterize this policy. + // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. + // If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. + // If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null. + // +optional + ParamKind *ParamKind `json:"paramKind,omitempty" protobuf:"bytes,1,rep,name=paramKind"` + + // matchConstraints specifies what resources this policy is designed to validate. + // The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints. + // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API + // MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding. + // The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + // '*' matches CREATE, UPDATE and CONNECT. + // Required. + MatchConstraints *MatchResources `json:"matchConstraints,omitempty" protobuf:"bytes,2,rep,name=matchConstraints"` + + // variables contain definitions of variables that can be used in composition of other expressions. + // Each variable is defined as a named CEL expression. + // The variables defined here will be available under `variables` in other expressions of the policy + // except matchConditions because matchConditions are evaluated before the rest of the policy. + // + // The expression of a variable can refer to other variables defined earlier in the list but not those after. + // Thus, variables must be sorted by the order of first appearance and acyclic. + // +listType=atomic + // +optional + Variables []Variable `json:"variables,omitempty" protobuf:"bytes,3,rep,name=variables"` + + // mutations contain operations to perform on matching objects. + // mutations may not be empty; a minimum of one mutation is required. + // mutations are evaluated in order, and are reinvoked according to + // the reinvocationPolicy. + // The mutations of a policy are invoked for each binding of this policy + // and reinvocation of mutations occurs on a per binding basis. + // + // +listType=atomic + // +optional + Mutations []Mutation `json:"mutations,omitempty" protobuf:"bytes,4,rep,name=mutations"` + + // failurePolicy defines how to handle failures for the admission policy. Failures can + // occur from CEL expression parse errors, type check errors, runtime errors and invalid + // or mis-configured policy definitions or bindings. + // + // A policy is invalid if paramKind refers to a non-existent Kind. + // A binding is invalid if paramRef.name refers to a non-existent resource. + // + // failurePolicy does not define how validations that evaluate to false are handled. + // + // Allowed values are Ignore or Fail. Defaults to Fail. + // +optional + FailurePolicy *FailurePolicyType `json:"failurePolicy,omitempty" protobuf:"bytes,5,opt,name=failurePolicy,casttype=FailurePolicyType"` + + // matchConditions is a list of conditions that must be met for a request to be validated. + // Match conditions filter requests that have already been matched by the matchConstraints. + // An empty list of matchConditions matches all requests. + // There are a maximum of 64 match conditions allowed. + // + // If a parameter object is provided, it can be accessed via the `params` handle in the same + // manner as validation expressions. + // + // The exact matching logic is (in order): + // 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + // 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + // 3. If any matchCondition evaluates to an error (but none are FALSE): + // - If failurePolicy=Fail, reject the request + // - If failurePolicy=Ignore, the policy is skipped + // + // +patchMergeKey=name + // +patchStrategy=merge + // +listType=map + // +listMapKey=name + // +optional + MatchConditions []MatchCondition `json:"matchConditions,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,6,rep,name=matchConditions"` + + // reinvocationPolicy indicates whether mutations may be called multiple times per MutatingAdmissionPolicyBinding + // as part of a single admission evaluation. + // Allowed values are "Never" and "IfNeeded". + // + // Never: These mutations will not be called more than once per binding in a single admission evaluation. + // + // IfNeeded: These mutations may be invoked more than once per binding for a single admission request and there is no guarantee of + // order with respect to other admission plugins, admission webhooks, bindings of this policy and admission policies. Mutations are only + // reinvoked when mutations change the object after this mutation is invoked. + // Required. + ReinvocationPolicy ReinvocationPolicyType `json:"reinvocationPolicy,omitempty" protobuf:"bytes,7,opt,name=reinvocationPolicy,casttype=ReinvocationPolicyType"` +} + +// Mutation specifies the CEL expression which is used to apply the Mutation. +type Mutation struct { + // patchType indicates the patch strategy used. + // Allowed values are "ApplyConfiguration" and "JSONPatch". + // Required. + // + // +unionDiscriminator + PatchType PatchType `json:"patchType" protobuf:"bytes,2,opt,name=patchType,casttype=PatchType"` + + // applyConfiguration defines the desired configuration values of an object. + // The configuration is applied to the admission object using + // [structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff). + // A CEL expression is used to create apply configuration. + ApplyConfiguration *ApplyConfiguration `json:"applyConfiguration,omitempty" protobuf:"bytes,3,opt,name=applyConfiguration"` + + // jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object. + // A CEL expression is used to create the JSON patch. + JSONPatch *JSONPatch `json:"jsonPatch,omitempty" protobuf:"bytes,4,opt,name=jsonPatch"` +} + +// PatchType specifies the type of patch operation for a mutation. +// +enum +type PatchType string + +const ( + // ApplyConfiguration indicates that the mutation is using apply configuration to mutate the object. + PatchTypeApplyConfiguration PatchType = "ApplyConfiguration" + // JSONPatch indicates that the object is mutated through JSON Patch. + PatchTypeJSONPatch PatchType = "JSONPatch" +) + +// ApplyConfiguration defines the desired configuration values of an object. +type ApplyConfiguration struct { + // expression will be evaluated by CEL to create an apply configuration. + // ref: https://github.com/google/cel-spec + // + // Apply configurations are declared in CEL using object initialization. For example, this CEL expression + // returns an apply configuration to set a single field: + // + // Object{ + // spec: Object.spec{ + // serviceAccountName: "example" + // } + // } + // + // Apply configurations may not modify atomic structs, maps or arrays due to the risk of accidental deletion of + // values not included in the apply configuration. + // + // CEL expressions have access to the object types needed to create apply configurations: + // + // - 'Object' - CEL type of the resource object. + // - 'Object.' - CEL type of object field (such as 'Object.spec') + // - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + // + // CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + // + // - 'object' - The object from the incoming request. The value is null for DELETE requests. + // - 'oldObject' - The existing object. The value is null for CREATE requests. + // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + // - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + // For example, a variable named 'foo' can be accessed as 'variables.foo'. + // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + // request resource. + // + // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the + // object. No other metadata properties are accessible. + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Required. + Expression string `json:"expression,omitempty" protobuf:"bytes,1,opt,name=expression"` +} + +// JSONPatch defines a JSON Patch. +type JSONPatch struct { + // expression will be evaluated by CEL to create a [JSON patch](https://jsonpatch.com/). + // ref: https://github.com/google/cel-spec + // + // expression must return an array of JSONPatch values. + // + // For example, this CEL expression returns a JSON patch to conditionally modify a value: + // + // [ + // JSONPatch{op: "test", path: "/spec/example", value: "Red"}, + // JSONPatch{op: "replace", path: "/spec/example", value: "Green"} + // ] + // + // To define an object for the patch value, use Object types. For example: + // + // [ + // JSONPatch{ + // op: "add", + // path: "/spec/selector", + // value: Object.spec.selector{matchLabels: {"environment": "test"}} + // } + // ] + // + // To use strings containing '/' and '~' as JSONPatch path keys, use "jsonpatch.escapeKey". For example: + // + // [ + // JSONPatch{ + // op: "add", + // path: "/metadata/labels/" + jsonpatch.escapeKey("example.com/environment"), + // value: "test" + // }, + // ] + // + // CEL expressions have access to the types needed to create JSON patches and objects: + // + // - 'JSONPatch' - CEL type of JSON Patch operations. JSONPatch has the fields 'op', 'from', 'path' and 'value'. + // See [JSON patch](https://jsonpatch.com/) for more details. The 'value' field may be set to any of: string, + // integer, array, map or object. If set, the 'path' and 'from' fields must be set to a + // [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901/) string, where the 'jsonpatch.escapeKey()' CEL + // function may be used to escape path keys containing '/' and '~'. + // - 'Object' - CEL type of the resource object. + // - 'Object.' - CEL type of object field (such as 'Object.spec') + // - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + // + // CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + // + // - 'object' - The object from the incoming request. The value is null for DELETE requests. + // - 'oldObject' - The existing object. The value is null for CREATE requests. + // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + // - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + // For example, a variable named 'foo' can be accessed as 'variables.foo'. + // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + // request resource. + // + // CEL expressions have access to [Kubernetes CEL function libraries](https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries) + // as well as: + // + // - 'jsonpatch.escapeKey' - Performs JSONPatch key escaping. '~' and '/' are escaped as '~0' and `~1' respectively). + // + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Required. + Expression string `json:"expression,omitempty" protobuf:"bytes,1,opt,name=expression"` +} + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 + +// MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. +// MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators +// configure policies for clusters. +// +// For a given admission request, each binding will cause its policy to be +// evaluated N times, where N is 1 for policies/bindings that don't use +// params, otherwise N is the number of parameters selected by the binding. +// Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-cost-budget). +// +// Adding/removing policies, bindings, or params can not affect whether a +// given (policy, binding, param) combination is within its own CEL budget. +type MutatingAdmissionPolicyBinding struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. + Spec MutatingAdmissionPolicyBindingSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 + +// MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingList struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard list metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + // List of PolicyBinding. + Items []MutatingAdmissionPolicyBinding `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// MutatingAdmissionPolicyBindingSpec defines the specification of the MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingSpec struct { + // policyName references a MutatingAdmissionPolicy name which the MutatingAdmissionPolicyBinding binds to. + // If the referenced resource does not exist, this binding is considered invalid and will be ignored + // Required. + PolicyName string `json:"policyName,omitempty" protobuf:"bytes,1,rep,name=policyName"` + + // paramRef specifies the parameter resource used to configure the admission control policy. + // It should point to a resource of the type specified in spec.ParamKind of the bound MutatingAdmissionPolicy. + // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the MutatingAdmissionPolicy applied. + // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + // +optional + ParamRef *ParamRef `json:"paramRef,omitempty" protobuf:"bytes,2,rep,name=paramRef"` + + // matchResources limits what resources match this binding and may be mutated by it. + // Note that if matchResources matches a resource, the resource must also match a policy's matchConstraints and + // matchConditions before the resource may be mutated. + // When matchResources is unset, it does not constrain resource matching, and only the policy's matchConstraints + // and matchConditions must match for the resource to be mutated. + // Additionally, matchResources.resourceRules are optional and do not constraint matching when unset. + // Note that this is differs from MutatingAdmissionPolicy matchConstraints, where resourceRules are required. + // The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + // '*' matches CREATE, UPDATE and CONNECT. + // +optional + MatchResources *MatchResources `json:"matchResources,omitempty" protobuf:"bytes,3,rep,name=matchResources"` +} + // ReinvocationPolicyType specifies what type of policy is used when other admission plugins also perform // modifications. // +enum @@ -1116,7 +1450,7 @@ const ( // RuleWithOperations is a tuple of Operations and Resources. It is recommended to make // sure that all the tuple expansions are valid. type RuleWithOperations struct { - // Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * + // operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * // for all of those operations and any future admission operations that are added. // If '*' is present, the length of the slice must be one. // Required. @@ -1143,7 +1477,7 @@ const ( // WebhookClientConfig contains the information to make a TLS // connection with the webhook type WebhookClientConfig struct { - // `url` gives the location of the webhook, in standard URL form + // url gives the location of the webhook, in standard URL form // (`scheme://host:port/path`). Exactly one of `url` or `service` // must be specified. // @@ -1172,7 +1506,7 @@ type WebhookClientConfig struct { // +optional URL *string `json:"url,omitempty" protobuf:"bytes,3,opt,name=url"` - // `service` is a reference to the service for this webhook. Either + // service is a reference to the service for this webhook. Either // `service` or `url` must be specified. // // If the webhook is running within the cluster, then you should use `service`. @@ -1180,7 +1514,7 @@ type WebhookClientConfig struct { // +optional Service *ServiceReference `json:"service,omitempty" protobuf:"bytes,1,opt,name=service"` - // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. // If unspecified, system trust roots on the apiserver are used. // +optional CABundle []byte `json:"caBundle,omitempty" protobuf:"bytes,2,opt,name=caBundle"` @@ -1188,19 +1522,19 @@ type WebhookClientConfig struct { // ServiceReference holds a reference to Service.legacy.k8s.io type ServiceReference struct { - // `namespace` is the namespace of the service. + // namespace is the namespace of the service. // Required Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` - // `name` is the name of the service. + // name is the name of the service. // Required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` - // `path` is an optional URL path which will be sent in any request to + // path is an optional URL path which will be sent in any request to // this service. // +optional Path *string `json:"path,omitempty" protobuf:"bytes,3,opt,name=path"` - // If specified, the port on the service that hosting webhook. + // port is the port on the service that hosts the webhook. // Default to 443 for backward compatibility. // `port` should be a valid port number (1-65535, inclusive). // +optional @@ -1209,7 +1543,7 @@ type ServiceReference struct { // MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook. type MatchCondition struct { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -1220,7 +1554,7 @@ type MatchCondition struct { // Required. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. diff --git a/vendor/k8s.io/api/admissionregistration/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/admissionregistration/v1/types_swagger_doc_generated.go index f43139505d..182f8ad0f0 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/admissionregistration/v1/types_swagger_doc_generated.go @@ -27,6 +27,15 @@ package v1 // Those methods can be generated by using hack/update-codegen.sh // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. +var map_ApplyConfiguration = map[string]string{ + "": "ApplyConfiguration defines the desired configuration values of an object.", + "expression": "expression will be evaluated by CEL to create an apply configuration. ref: https://github.com/google/cel-spec\n\nApply configurations are declared in CEL using object initialization. For example, this CEL expression returns an apply configuration to set a single field:\n\n\tObject{\n\t spec: Object.spec{\n\t serviceAccountName: \"example\"\n\t }\n\t}\n\nApply configurations may not modify atomic structs, maps or arrays due to the risk of accidental deletion of values not included in the apply configuration.\n\nCEL expressions have access to the object types needed to create apply configurations:\n\n- 'Object' - CEL type of the resource object. - 'Object.' - CEL type of object field (such as 'Object.spec') - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers')\n\nCEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Required.", +} + +func (ApplyConfiguration) SwaggerDoc() map[string]string { + return map_ApplyConfiguration +} + var map_AuditAnnotation = map[string]string{ "": "AuditAnnotation describes how to produce an audit annotation for an API request.", "key": "key specifies the audit annotation key. The audit annotation keys of a ValidatingAdmissionPolicy must be unique. The key must be a qualified name ([A-Za-z0-9][-A-Za-z0-9_.]*) no more than 63 bytes in length.\n\nThe key is combined with the resource name of the ValidatingAdmissionPolicy to construct an audit annotation key: \"{ValidatingAdmissionPolicy name}/{key}\".\n\nIf an admission webhook uses the same resource name as this ValidatingAdmissionPolicy and the same audit annotation key, the annotation key will be identical. In this case, the first annotation written with the key will be included in the audit event and all subsequent annotations with the same key will be discarded.\n\nRequired.", @@ -39,18 +48,27 @@ func (AuditAnnotation) SwaggerDoc() map[string]string { var map_ExpressionWarning = map[string]string{ "": "ExpressionWarning is a warning information that targets a specific expression.", - "fieldRef": "The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"", - "warning": "The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.", + "fieldRef": "fieldRef is the path to the field that refers to the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"", + "warning": "warning contains the content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.", } func (ExpressionWarning) SwaggerDoc() map[string]string { return map_ExpressionWarning } +var map_JSONPatch = map[string]string{ + "": "JSONPatch defines a JSON Patch.", + "expression": "expression will be evaluated by CEL to create a [JSON patch](https://jsonpatch.com/). ref: https://github.com/google/cel-spec\n\nexpression must return an array of JSONPatch values.\n\nFor example, this CEL expression returns a JSON patch to conditionally modify a value:\n\n\t [\n\t JSONPatch{op: \"test\", path: \"/spec/example\", value: \"Red\"},\n\t JSONPatch{op: \"replace\", path: \"/spec/example\", value: \"Green\"}\n\t ]\n\nTo define an object for the patch value, use Object types. For example:\n\n\t [\n\t JSONPatch{\n\t op: \"add\",\n\t path: \"/spec/selector\",\n\t value: Object.spec.selector{matchLabels: {\"environment\": \"test\"}}\n\t }\n\t ]\n\nTo use strings containing '/' and '~' as JSONPatch path keys, use \"jsonpatch.escapeKey\". For example:\n\n\t [\n\t JSONPatch{\n\t op: \"add\",\n\t path: \"/metadata/labels/\" + jsonpatch.escapeKey(\"example.com/environment\"),\n\t value: \"test\"\n\t },\n\t ]\n\nCEL expressions have access to the types needed to create JSON patches and objects:\n\n- 'JSONPatch' - CEL type of JSON Patch operations. JSONPatch has the fields 'op', 'from', 'path' and 'value'.\n See [JSON patch](https://jsonpatch.com/) for more details. The 'value' field may be set to any of: string,\n integer, array, map or object. If set, the 'path' and 'from' fields must be set to a\n [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901/) string, where the 'jsonpatch.escapeKey()' CEL\n function may be used to escape path keys containing '/' and '~'.\n- 'Object' - CEL type of the resource object. - 'Object.' - CEL type of object field (such as 'Object.spec') - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers')\n\nCEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nCEL expressions have access to [Kubernetes CEL function libraries](https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries) as well as:\n\n- 'jsonpatch.escapeKey' - Performs JSONPatch key escaping. '~' and '/' are escaped as '~0' and `~1' respectively).\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Required.", +} + +func (JSONPatch) SwaggerDoc() map[string]string { + return map_JSONPatch +} + var map_MatchCondition = map[string]string{ "": "MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook.", - "name": "Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')\n\nRequired.", - "expression": "Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:\n\n'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\nDocumentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n\nRequired.", + "name": "name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')\n\nRequired.", + "expression": "expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:\n\n'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\nDocumentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n\nRequired.", } func (MatchCondition) SwaggerDoc() map[string]string { @@ -59,10 +77,10 @@ func (MatchCondition) SwaggerDoc() map[string]string { var map_MatchResources = map[string]string{ "": "MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", - "namespaceSelector": "NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", - "objectSelector": "ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", - "resourceRules": "ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule.", - "excludeResourceRules": "ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", + "namespaceSelector": "namespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + "objectSelector": "objectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", + "resourceRules": "resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule.", + "excludeResourceRules": "excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", "matchPolicy": "matchPolicy defines how the \"MatchResources\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.\n\nDefaults to \"Equivalent\"", } @@ -70,20 +88,86 @@ func (MatchResources) SwaggerDoc() map[string]string { return map_MatchResources } +var map_MutatingAdmissionPolicy = map[string]string{ + "": "MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the MutatingAdmissionPolicy.", +} + +func (MutatingAdmissionPolicy) SwaggerDoc() map[string]string { + return map_MutatingAdmissionPolicy +} + +var map_MutatingAdmissionPolicyBinding = map[string]string{ + "": "MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-cost-budget).\n\nAdding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the MutatingAdmissionPolicyBinding.", +} + +func (MutatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { + return map_MutatingAdmissionPolicyBinding +} + +var map_MutatingAdmissionPolicyBindingList = map[string]string{ + "": "MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding.", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "items": "List of PolicyBinding.", +} + +func (MutatingAdmissionPolicyBindingList) SwaggerDoc() map[string]string { + return map_MutatingAdmissionPolicyBindingList +} + +var map_MutatingAdmissionPolicyBindingSpec = map[string]string{ + "": "MutatingAdmissionPolicyBindingSpec defines the specification of the MutatingAdmissionPolicyBinding.", + "policyName": "policyName references a MutatingAdmissionPolicy name which the MutatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.", + "paramRef": "paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in spec.ParamKind of the bound MutatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the MutatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.", + "matchResources": "matchResources limits what resources match this binding and may be mutated by it. Note that if matchResources matches a resource, the resource must also match a policy's matchConstraints and matchConditions before the resource may be mutated. When matchResources is unset, it does not constrain resource matching, and only the policy's matchConstraints and matchConditions must match for the resource to be mutated. Additionally, matchResources.resourceRules are optional and do not constraint matching when unset. Note that this is differs from MutatingAdmissionPolicy matchConstraints, where resourceRules are required. The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. '*' matches CREATE, UPDATE and CONNECT.", +} + +func (MutatingAdmissionPolicyBindingSpec) SwaggerDoc() map[string]string { + return map_MutatingAdmissionPolicyBindingSpec +} + +var map_MutatingAdmissionPolicyList = map[string]string{ + "": "MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy.", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "items": "List of ValidatingAdmissionPolicy.", +} + +func (MutatingAdmissionPolicyList) SwaggerDoc() map[string]string { + return map_MutatingAdmissionPolicyList +} + +var map_MutatingAdmissionPolicySpec = map[string]string{ + "": "MutatingAdmissionPolicySpec defines the desired behavior of the admission policy.", + "paramKind": "paramKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null.", + "matchConstraints": "matchConstraints specifies what resources this policy is designed to validate. The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding. The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. '*' matches CREATE, UPDATE and CONNECT. Required.", + "variables": "variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except matchConditions because matchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, variables must be sorted by the order of first appearance and acyclic.", + "mutations": "mutations contain operations to perform on matching objects. mutations may not be empty; a minimum of one mutation is required. mutations are evaluated in order, and are reinvoked according to the reinvocationPolicy. The mutations of a policy are invoked for each binding of this policy and reinvocation of mutations occurs on a per binding basis.", + "failurePolicy": "failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.\n\nA policy is invalid if paramKind refers to a non-existent Kind. A binding is invalid if paramRef.name refers to a non-existent resource.\n\nfailurePolicy does not define how validations that evaluate to false are handled.\n\nAllowed values are Ignore or Fail. Defaults to Fail.", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the matchConstraints. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped", + "reinvocationPolicy": "reinvocationPolicy indicates whether mutations may be called multiple times per MutatingAdmissionPolicyBinding as part of a single admission evaluation. Allowed values are \"Never\" and \"IfNeeded\".\n\nNever: These mutations will not be called more than once per binding in a single admission evaluation.\n\nIfNeeded: These mutations may be invoked more than once per binding for a single admission request and there is no guarantee of order with respect to other admission plugins, admission webhooks, bindings of this policy and admission policies. Mutations are only reinvoked when mutations change the object after this mutation is invoked. Required.", +} + +func (MutatingAdmissionPolicySpec) SwaggerDoc() map[string]string { + return map_MutatingAdmissionPolicySpec +} + var map_MutatingWebhook = map[string]string{ "": "MutatingWebhook describes an admission webhook and the resources and operations it applies to.", - "name": "The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", - "clientConfig": "ClientConfig defines how to communicate with the hook. Required", - "rules": "Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", - "failurePolicy": "FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.", + "name": "name is the name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", + "clientConfig": "clientConfig defines how to communicate with the hook. Required", + "rules": "rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", + "failurePolicy": "failurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.", "matchPolicy": "matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.\n\nDefaults to \"Equivalent\"", - "namespaceSelector": "NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", - "objectSelector": "ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", - "sideEffects": "SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.", - "timeoutSeconds": "TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.", - "admissionReviewVersions": "AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.", + "namespaceSelector": "namespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + "objectSelector": "objectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", + "sideEffects": "sideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.", + "timeoutSeconds": "timeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.", + "admissionReviewVersions": "admissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.", "reinvocationPolicy": "reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. Allowed values are \"Never\" and \"IfNeeded\".\n\nNever: the webhook will not be called more than once in a single admission evaluation.\n\nIfNeeded: the webhook will be called at least one additional time as part of the admission evaluation if the object being admitted is modified by other admission plugins after the initial webhook call. Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. Note: * the number of additional invocations is not guaranteed to be exactly one. * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. * webhooks that use this option may be reordered to minimize the number of additional invocations. * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.\n\nDefaults to \"Never\".", - "matchConditions": "MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", } func (MutatingWebhook) SwaggerDoc() map[string]string { @@ -92,8 +176,8 @@ func (MutatingWebhook) SwaggerDoc() map[string]string { var map_MutatingWebhookConfiguration = map[string]string{ "": "MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "webhooks": "Webhooks is a list of webhooks and the affected resources and operations.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "webhooks": "webhooks is a list of webhooks and the affected resources and operations.", } func (MutatingWebhookConfiguration) SwaggerDoc() map[string]string { @@ -102,7 +186,7 @@ func (MutatingWebhookConfiguration) SwaggerDoc() map[string]string { var map_MutatingWebhookConfigurationList = map[string]string{ "": "MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of MutatingWebhookConfiguration.", } @@ -110,9 +194,20 @@ func (MutatingWebhookConfigurationList) SwaggerDoc() map[string]string { return map_MutatingWebhookConfigurationList } +var map_Mutation = map[string]string{ + "": "Mutation specifies the CEL expression which is used to apply the Mutation.", + "patchType": "patchType indicates the patch strategy used. Allowed values are \"ApplyConfiguration\" and \"JSONPatch\". Required.", + "applyConfiguration": "applyConfiguration defines the desired configuration values of an object. The configuration is applied to the admission object using [structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff). A CEL expression is used to create apply configuration.", + "jsonPatch": "jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object. A CEL expression is used to create the JSON patch.", +} + +func (Mutation) SwaggerDoc() map[string]string { + return map_Mutation +} + var map_NamedRuleWithOperations = map[string]string{ "": "NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", } func (NamedRuleWithOperations) SwaggerDoc() map[string]string { @@ -121,8 +216,8 @@ func (NamedRuleWithOperations) SwaggerDoc() map[string]string { var map_ParamKind = map[string]string{ "": "ParamKind is a tuple of Group Kind and Version.", - "apiVersion": "APIVersion is the API group version the resources belong to. In format of \"group/version\". Required.", - "kind": "Kind is the API kind the resources belong to. Required.", + "apiVersion": "apiVersion is the API group version the resources belong to. In format of \"group/version\". Required.", + "kind": "kind is the API kind the resources belong to. Required.", } func (ParamKind) SwaggerDoc() map[string]string { @@ -134,7 +229,7 @@ var map_ParamRef = map[string]string{ "name": "name is the name of the resource being referenced.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.\n\nA single parameter used for all admission requests can be configured by setting the `name` field, leaving `selector` blank, and setting namespace if `paramKind` is namespace-scoped.", "namespace": "namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields.\n\nA per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty.\n\n- If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error.\n\n- If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error.", "selector": "selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind.\n\nIf multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.", - "parameterNotFoundAction": "`parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny`\n\nRequired", + "parameterNotFoundAction": "parameterNotFoundAction controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny`\n\nRequired", } func (ParamRef) SwaggerDoc() map[string]string { @@ -143,9 +238,9 @@ func (ParamRef) SwaggerDoc() map[string]string { var map_Rule = map[string]string{ "": "Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended to make sure that all the tuple expansions are valid.", - "apiGroups": "APIGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required.", - "apiVersions": "APIVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required.", - "resources": "Resources is a list of resources this rule applies to.\n\nFor example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources.\n\nIf wildcard is present, the validation rule will ensure resources do not overlap with each other.\n\nDepending on the enclosing object, subresources might not be allowed. Required.", + "apiGroups": "apiGroups is the API groups the resources belong to. '*' is all groups. If '*' is present, the length of the slice must be one. Required.", + "apiVersions": "apiVersions is the API versions the resources belong to. '*' is all versions. If '*' is present, the length of the slice must be one. Required.", + "resources": "resources is a list of resources this rule applies to.\n\nFor example: 'pods' means pods. 'pods/log' means the log subresource of pods. '*' means all resources, but not subresources. 'pods/*' means all subresources of pods. '*/scale' means all scale subresources. '*/*' means all resources and their subresources.\n\nIf wildcard is present, the validation rule will ensure resources do not overlap with each other.\n\nDepending on the enclosing object, subresources might not be allowed. Required.", "scope": "scope specifies the scope of this rule. Valid values are \"Cluster\", \"Namespaced\", and \"*\" \"Cluster\" means that only cluster-scoped resources will match this rule. Namespace API objects are cluster-scoped. \"Namespaced\" means that only namespaced resources will match this rule. \"*\" means that there are no scope restrictions. Subresources match the scope of their parent resource. Default is \"*\".", } @@ -155,7 +250,7 @@ func (Rule) SwaggerDoc() map[string]string { var map_RuleWithOperations = map[string]string{ "": "RuleWithOperations is a tuple of Operations and Resources. It is recommended to make sure that all the tuple expansions are valid.", - "operations": "Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.", + "operations": "operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * for all of those operations and any future admission operations that are added. If '*' is present, the length of the slice must be one. Required.", } func (RuleWithOperations) SwaggerDoc() map[string]string { @@ -164,10 +259,10 @@ func (RuleWithOperations) SwaggerDoc() map[string]string { var map_ServiceReference = map[string]string{ "": "ServiceReference holds a reference to Service.legacy.k8s.io", - "namespace": "`namespace` is the namespace of the service. Required", - "name": "`name` is the name of the service. Required", - "path": "`path` is an optional URL path which will be sent in any request to this service.", - "port": "If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive).", + "namespace": "namespace is the namespace of the service. Required", + "name": "name is the name of the service. Required", + "path": "path is an optional URL path which will be sent in any request to this service.", + "port": "port is the port on the service that hosts the webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive).", } func (ServiceReference) SwaggerDoc() map[string]string { @@ -176,7 +271,7 @@ func (ServiceReference) SwaggerDoc() map[string]string { var map_TypeChecking = map[string]string{ "": "TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy", - "expressionWarnings": "The type checking warnings for each expression.", + "expressionWarnings": "expressionWarnings contains the type checking warnings for each expression.", } func (TypeChecking) SwaggerDoc() map[string]string { @@ -185,9 +280,9 @@ func (TypeChecking) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicy = map[string]string{ "": "ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the ValidatingAdmissionPolicy.", - "status": "The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the ValidatingAdmissionPolicy.", + "status": "status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.", } func (ValidatingAdmissionPolicy) SwaggerDoc() map[string]string { @@ -196,8 +291,8 @@ func (ValidatingAdmissionPolicy) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBinding = map[string]string{ "": "ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.\n\nThe CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the ValidatingAdmissionPolicyBinding.", } func (ValidatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { @@ -206,7 +301,7 @@ func (ValidatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBindingList = map[string]string{ "": "ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of PolicyBinding.", } @@ -216,9 +311,9 @@ func (ValidatingAdmissionPolicyBindingList) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBindingSpec = map[string]string{ "": "ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.", - "policyName": "PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.", + "policyName": "policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.", "paramRef": "paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.", - "matchResources": "MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.", + "matchResources": "matchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.", "validationActions": "validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions.\n\nFailures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.\n\nvalidationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action.\n\nThe supported actions values are:\n\n\"Deny\" specifies that a validation failure results in a denied request.\n\n\"Warn\" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses.\n\n\"Audit\" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `\"validation.policy.admission.k8s.io/validation_failure\": \"[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]\"`\n\nClients should expect to handle additional values by ignoring any values not recognized.\n\n\"Deny\" and \"Warn\" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.\n\nRequired.", } @@ -228,7 +323,7 @@ func (ValidatingAdmissionPolicyBindingSpec) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyList = map[string]string{ "": "ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of ValidatingAdmissionPolicy.", } @@ -238,13 +333,13 @@ func (ValidatingAdmissionPolicyList) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicySpec = map[string]string{ "": "ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.", - "paramKind": "ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.", - "matchConstraints": "MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.", - "validations": "Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.", + "paramKind": "paramKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.", + "matchConstraints": "matchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.", + "validations": "validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.", "failurePolicy": "failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.\n\nA policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource.\n\nfailurePolicy does not define how validations that evaluate to false are handled.\n\nWhen failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced.\n\nAllowed values are Ignore or Fail. Defaults to Fail.", "auditAnnotations": "auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required.", - "matchConditions": "MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped", - "variables": "Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped", + "variables": "variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.", } func (ValidatingAdmissionPolicySpec) SwaggerDoc() map[string]string { @@ -253,9 +348,9 @@ func (ValidatingAdmissionPolicySpec) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyStatus = map[string]string{ "": "ValidatingAdmissionPolicyStatus represents the status of an admission validation policy.", - "observedGeneration": "The generation observed by the controller.", - "typeChecking": "The results of type checking for each expression. Presence of this field indicates the completion of the type checking.", - "conditions": "The conditions represent the latest available observations of a policy's current state.", + "observedGeneration": "observedGeneration is the generation observed by the controller.", + "typeChecking": "typeChecking contains the results of type checking for each expression. Presence of this field indicates the completion of the type checking.", + "conditions": "conditions represent the latest available observations of a policy's current state.", } func (ValidatingAdmissionPolicyStatus) SwaggerDoc() map[string]string { @@ -264,17 +359,17 @@ func (ValidatingAdmissionPolicyStatus) SwaggerDoc() map[string]string { var map_ValidatingWebhook = map[string]string{ "": "ValidatingWebhook describes an admission webhook and the resources and operations it applies to.", - "name": "The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", - "clientConfig": "ClientConfig defines how to communicate with the hook. Required", - "rules": "Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", - "failurePolicy": "FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.", + "name": "name is the name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", + "clientConfig": "clientConfig defines how to communicate with the hook. Required", + "rules": "rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", + "failurePolicy": "failurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Fail.", "matchPolicy": "matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.\n\nDefaults to \"Equivalent\"", - "namespaceSelector": "NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", - "objectSelector": "ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", - "sideEffects": "SideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.", - "timeoutSeconds": "TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.", - "admissionReviewVersions": "AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.", - "matchConditions": "MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", + "namespaceSelector": "namespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + "objectSelector": "objectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", + "sideEffects": "sideEffects states whether this webhook has side effects. Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some.", + "timeoutSeconds": "timeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 10 seconds.", + "admissionReviewVersions": "admissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy.", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", } func (ValidatingWebhook) SwaggerDoc() map[string]string { @@ -283,8 +378,8 @@ func (ValidatingWebhook) SwaggerDoc() map[string]string { var map_ValidatingWebhookConfiguration = map[string]string{ "": "ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "webhooks": "Webhooks is a list of webhooks and the affected resources and operations.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "webhooks": "webhooks is a list of webhooks and the affected resources and operations.", } func (ValidatingWebhookConfiguration) SwaggerDoc() map[string]string { @@ -293,7 +388,7 @@ func (ValidatingWebhookConfiguration) SwaggerDoc() map[string]string { var map_ValidatingWebhookConfigurationList = map[string]string{ "": "ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of ValidatingWebhookConfiguration.", } @@ -303,9 +398,9 @@ func (ValidatingWebhookConfigurationList) SwaggerDoc() map[string]string { var map_Validation = map[string]string{ "": "Validation specifies the CEL expression which is used to apply the validation.", - "expression": "Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.", - "message": "Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".", - "reason": "Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.", + "expression": "expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.", + "message": "message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".", + "reason": "reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.", "messageExpression": "messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: \"object.x must be less than max (\"+string(params.max)+\")\"", } @@ -315,8 +410,8 @@ func (Validation) SwaggerDoc() map[string]string { var map_Variable = map[string]string{ "": "Variable is the definition of a variable that is used for composition. A variable is defined as a named expression.", - "name": "Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`", - "expression": "Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.", + "name": "name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`", + "expression": "expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.", } func (Variable) SwaggerDoc() map[string]string { @@ -325,9 +420,9 @@ func (Variable) SwaggerDoc() map[string]string { var map_WebhookClientConfig = map[string]string{ "": "WebhookClientConfig contains the information to make a TLS connection with the webhook", - "url": "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.", - "service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.", - "caBundle": "`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.", + "url": "url gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.", + "service": "service is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.", + "caBundle": "caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.", } func (WebhookClientConfig) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/admissionregistration/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/admissionregistration/v1/zz_generated.deepcopy.go index bfe599c1d3..afdbfd9143 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/admissionregistration/v1/zz_generated.deepcopy.go @@ -26,6 +26,22 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ApplyConfiguration) DeepCopyInto(out *ApplyConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplyConfiguration. +func (in *ApplyConfiguration) DeepCopy() *ApplyConfiguration { + if in == nil { + return nil + } + out := new(ApplyConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *AuditAnnotation) DeepCopyInto(out *AuditAnnotation) { *out = *in @@ -58,6 +74,22 @@ func (in *ExpressionWarning) DeepCopy() *ExpressionWarning { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JSONPatch) DeepCopyInto(out *JSONPatch) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JSONPatch. +func (in *JSONPatch) DeepCopy() *JSONPatch { + if in == nil { + return nil + } + out := new(JSONPatch) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MatchCondition) DeepCopyInto(out *MatchCondition) { *out = *in @@ -119,6 +151,200 @@ func (in *MatchResources) DeepCopy() *MatchResources { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicy) DeepCopyInto(out *MutatingAdmissionPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicy. +func (in *MutatingAdmissionPolicy) DeepCopy() *MutatingAdmissionPolicy { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MutatingAdmissionPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicyBinding) DeepCopyInto(out *MutatingAdmissionPolicyBinding) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicyBinding. +func (in *MutatingAdmissionPolicyBinding) DeepCopy() *MutatingAdmissionPolicyBinding { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicyBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MutatingAdmissionPolicyBinding) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicyBindingList) DeepCopyInto(out *MutatingAdmissionPolicyBindingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MutatingAdmissionPolicyBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicyBindingList. +func (in *MutatingAdmissionPolicyBindingList) DeepCopy() *MutatingAdmissionPolicyBindingList { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicyBindingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MutatingAdmissionPolicyBindingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicyBindingSpec) DeepCopyInto(out *MutatingAdmissionPolicyBindingSpec) { + *out = *in + if in.ParamRef != nil { + in, out := &in.ParamRef, &out.ParamRef + *out = new(ParamRef) + (*in).DeepCopyInto(*out) + } + if in.MatchResources != nil { + in, out := &in.MatchResources, &out.MatchResources + *out = new(MatchResources) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicyBindingSpec. +func (in *MutatingAdmissionPolicyBindingSpec) DeepCopy() *MutatingAdmissionPolicyBindingSpec { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicyBindingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicyList) DeepCopyInto(out *MutatingAdmissionPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MutatingAdmissionPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicyList. +func (in *MutatingAdmissionPolicyList) DeepCopy() *MutatingAdmissionPolicyList { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MutatingAdmissionPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicySpec) DeepCopyInto(out *MutatingAdmissionPolicySpec) { + *out = *in + if in.ParamKind != nil { + in, out := &in.ParamKind, &out.ParamKind + *out = new(ParamKind) + **out = **in + } + if in.MatchConstraints != nil { + in, out := &in.MatchConstraints, &out.MatchConstraints + *out = new(MatchResources) + (*in).DeepCopyInto(*out) + } + if in.Variables != nil { + in, out := &in.Variables, &out.Variables + *out = make([]Variable, len(*in)) + copy(*out, *in) + } + if in.Mutations != nil { + in, out := &in.Mutations, &out.Mutations + *out = make([]Mutation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.FailurePolicy != nil { + in, out := &in.FailurePolicy, &out.FailurePolicy + *out = new(FailurePolicyType) + **out = **in + } + if in.MatchConditions != nil { + in, out := &in.MatchConditions, &out.MatchConditions + *out = make([]MatchCondition, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicySpec. +func (in *MutatingAdmissionPolicySpec) DeepCopy() *MutatingAdmissionPolicySpec { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicySpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MutatingWebhook) DeepCopyInto(out *MutatingWebhook) { *out = *in @@ -254,6 +480,32 @@ func (in *MutatingWebhookConfigurationList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Mutation) DeepCopyInto(out *Mutation) { + *out = *in + if in.ApplyConfiguration != nil { + in, out := &in.ApplyConfiguration, &out.ApplyConfiguration + *out = new(ApplyConfiguration) + **out = **in + } + if in.JSONPatch != nil { + in, out := &in.JSONPatch, &out.JSONPatch + *out = new(JSONPatch) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Mutation. +func (in *Mutation) DeepCopy() *Mutation { + if in == nil { + return nil + } + out := new(Mutation) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NamedRuleWithOperations) DeepCopyInto(out *NamedRuleWithOperations) { *out = *in diff --git a/vendor/k8s.io/api/admissionregistration/v1/zz_generated.model_name.go b/vendor/k8s.io/api/admissionregistration/v1/zz_generated.model_name.go index 3264285cd0..b7baac8d1c 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/admissionregistration/v1/zz_generated.model_name.go @@ -21,6 +21,11 @@ limitations under the License. package v1 +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ApplyConfiguration) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.ApplyConfiguration" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in AuditAnnotation) OpenAPIModelName() string { return "io.k8s.api.admissionregistration.v1.AuditAnnotation" @@ -31,6 +36,11 @@ func (in ExpressionWarning) OpenAPIModelName() string { return "io.k8s.api.admissionregistration.v1.ExpressionWarning" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in JSONPatch) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.JSONPatch" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in MatchCondition) OpenAPIModelName() string { return "io.k8s.api.admissionregistration.v1.MatchCondition" @@ -41,6 +51,36 @@ func (in MatchResources) OpenAPIModelName() string { return "io.k8s.api.admissionregistration.v1.MatchResources" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in MutatingAdmissionPolicy) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in MutatingAdmissionPolicyBinding) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBinding" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in MutatingAdmissionPolicyBindingList) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBindingList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in MutatingAdmissionPolicyBindingSpec) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBindingSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in MutatingAdmissionPolicyList) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in MutatingAdmissionPolicySpec) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicySpec" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in MutatingWebhook) OpenAPIModelName() string { return "io.k8s.api.admissionregistration.v1.MutatingWebhook" @@ -56,6 +96,11 @@ func (in MutatingWebhookConfigurationList) OpenAPIModelName() string { return "io.k8s.api.admissionregistration.v1.MutatingWebhookConfigurationList" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Mutation) OpenAPIModelName() string { + return "io.k8s.api.admissionregistration.v1.Mutation" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in NamedRuleWithOperations) OpenAPIModelName() string { return "io.k8s.api.admissionregistration.v1.NamedRuleWithOperations" diff --git a/vendor/k8s.io/api/admissionregistration/v1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/admissionregistration/v1/zz_generated.prerelease-lifecycle.go index 0862bb1f2d..5fde55f151 100644 --- a/vendor/k8s.io/api/admissionregistration/v1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/admissionregistration/v1/zz_generated.prerelease-lifecycle.go @@ -21,6 +21,30 @@ limitations under the License. package v1 +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *MutatingAdmissionPolicy) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *MutatingAdmissionPolicyBinding) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *MutatingAdmissionPolicyBindingList) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *MutatingAdmissionPolicyList) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. func (in *MutatingWebhookConfiguration) APILifecycleIntroduced() (major, minor int) { diff --git a/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto b/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto index d23f21cc84..57c7cd2b1d 100644 --- a/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.proto @@ -113,12 +113,12 @@ message AuditAnnotation { // ExpressionWarning is a warning information that targets a specific expression. message ExpressionWarning { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" optional string fieldRef = 2; - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. optional string warning = 3; @@ -194,7 +194,7 @@ message JSONPatch { } message MatchCondition { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -205,7 +205,7 @@ message MatchCondition { // Required. optional string name = 1; - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. @@ -226,7 +226,7 @@ message MatchCondition { // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +structType=atomic message MatchResources { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -272,7 +272,7 @@ message MatchResources { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 1; - // ObjectSelector decides whether to run the policy based on if the + // objectSelector decides whether to run the policy based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the policy's expression (CEL), and // is considered to match if either object matches the selector. A null @@ -286,13 +286,13 @@ message MatchResources { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 2; - // ResourceRules describes what operations on what resources/subresources the admission policy matches. + // resourceRules describes what operations on what resources/subresources the admission policy matches. // The policy cares about an operation if it matches _any_ Rule. // +listType=atomic // +optional repeated NamedRuleWithOperations resourceRules = 3; - // ExcludeResourceRules describes what operations on what resources/subresources the policy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the policy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +listType=atomic // +optional @@ -319,11 +319,11 @@ message MatchResources { // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. message MutatingAdmissionPolicy { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the MutatingAdmissionPolicy. + // spec defines the desired behavior of the MutatingAdmissionPolicy. optional MutatingAdmissionPolicySpec spec = 2; } @@ -339,17 +339,17 @@ message MutatingAdmissionPolicy { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. message MutatingAdmissionPolicyBinding { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the MutatingAdmissionPolicyBinding. + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. optional MutatingAdmissionPolicyBindingSpec spec = 2; } // MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. message MutatingAdmissionPolicyBindingList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -387,7 +387,7 @@ message MutatingAdmissionPolicyBindingSpec { // MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. message MutatingAdmissionPolicyList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -507,7 +507,7 @@ message Mutation { // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. // +structType=atomic message NamedRuleWithOperations { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +listType=atomic // +optional repeated string resourceNames = 1; @@ -519,12 +519,12 @@ message NamedRuleWithOperations { // ParamKind is a tuple of Group Kind and Version. // +structType=atomic message ParamKind { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. optional string apiVersion = 1; - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. optional string kind = 2; } @@ -533,7 +533,7 @@ message ParamKind { // expressions of rules applied by a policy binding. // +structType=atomic message ParamRef { - // `name` is the name of the resource being referenced. + // name is the name of the resource being referenced. // // `name` and `selector` are mutually exclusive properties. If one is set, // the other must be unset. @@ -571,7 +571,7 @@ message ParamRef { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3; - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. @@ -587,7 +587,7 @@ message ParamRef { // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy message TypeChecking { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. // +optional // +listType=atomic repeated ExpressionWarning expressionWarnings = 1; @@ -595,14 +595,14 @@ message TypeChecking { // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. message ValidatingAdmissionPolicy { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. optional ValidatingAdmissionPolicySpec spec = 2; - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. @@ -622,17 +622,18 @@ message ValidatingAdmissionPolicy { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. message ValidatingAdmissionPolicyBinding { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. + // +required optional ValidatingAdmissionPolicyBindingSpec spec = 2; } // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. message ValidatingAdmissionPolicyBindingList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -643,9 +644,11 @@ message ValidatingAdmissionPolicyBindingList { // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. message ValidatingAdmissionPolicyBindingSpec { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string policyName = 1; // paramRef specifies the parameter resource used to configure the admission control policy. @@ -655,7 +658,7 @@ message ValidatingAdmissionPolicyBindingSpec { // +optional optional ParamRef paramRef = 2; - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. @@ -703,12 +706,14 @@ message ValidatingAdmissionPolicyBindingSpec { // // Required. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required repeated string validationActions = 4; } // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. message ValidatingAdmissionPolicyList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -719,21 +724,21 @@ message ValidatingAdmissionPolicyList { // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. message ValidatingAdmissionPolicySpec { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. // +optional optional ParamKind paramKind = 1; - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. optional MatchResources matchConstraints = 2; - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. // +listType=atomic @@ -764,7 +769,7 @@ message ValidatingAdmissionPolicySpec { // +optional repeated AuditAnnotation auditAnnotations = 5; - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -786,7 +791,7 @@ message ValidatingAdmissionPolicySpec { // +optional repeated MatchCondition matchConditions = 6; - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. @@ -803,16 +808,16 @@ message ValidatingAdmissionPolicySpec { // ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy. message ValidatingAdmissionPolicyStatus { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. // +optional optional int64 observedGeneration = 1; - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. // +optional optional TypeChecking typeChecking = 2; - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. // +optional // +listType=map // +listMapKey=type @@ -821,7 +826,7 @@ message ValidatingAdmissionPolicyStatus { // Validation specifies the CEL expression which is used to apply the validation. message Validation { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -864,7 +869,7 @@ message Validation { // Required. optional string Expression = 1; - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -874,7 +879,7 @@ message Validation { // +optional optional string message = 2; - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. @@ -899,12 +904,12 @@ message Validation { // Variable is the definition of a variable that is used for composition. message Variable { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` optional string Name = 1; - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. optional string Expression = 2; } diff --git a/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index 651a01f0b3..0000000000 --- a/vendor/k8s.io/api/admissionregistration/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*ApplyConfiguration) ProtoMessage() {} - -func (*AuditAnnotation) ProtoMessage() {} - -func (*ExpressionWarning) ProtoMessage() {} - -func (*JSONPatch) ProtoMessage() {} - -func (*MatchCondition) ProtoMessage() {} - -func (*MatchResources) ProtoMessage() {} - -func (*MutatingAdmissionPolicy) ProtoMessage() {} - -func (*MutatingAdmissionPolicyBinding) ProtoMessage() {} - -func (*MutatingAdmissionPolicyBindingList) ProtoMessage() {} - -func (*MutatingAdmissionPolicyBindingSpec) ProtoMessage() {} - -func (*MutatingAdmissionPolicyList) ProtoMessage() {} - -func (*MutatingAdmissionPolicySpec) ProtoMessage() {} - -func (*Mutation) ProtoMessage() {} - -func (*NamedRuleWithOperations) ProtoMessage() {} - -func (*ParamKind) ProtoMessage() {} - -func (*ParamRef) ProtoMessage() {} - -func (*TypeChecking) ProtoMessage() {} - -func (*ValidatingAdmissionPolicy) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBinding) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBindingList) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBindingSpec) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyList) ProtoMessage() {} - -func (*ValidatingAdmissionPolicySpec) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyStatus) ProtoMessage() {} - -func (*Validation) ProtoMessage() {} - -func (*Variable) ProtoMessage() {} diff --git a/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go b/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go index 459f7944c7..6a789b2d7f 100644 --- a/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go +++ b/vendor/k8s.io/api/admissionregistration/v1alpha1/types.go @@ -83,12 +83,12 @@ const ( // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicy struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. Spec ValidatingAdmissionPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. @@ -98,14 +98,14 @@ type ValidatingAdmissionPolicy struct { // ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyStatus struct { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. // +optional TypeChecking *TypeChecking `json:"typeChecking,omitempty" protobuf:"bytes,2,opt,name=typeChecking"` - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. // +optional // +listType=map // +listMapKey=type @@ -115,7 +115,7 @@ type ValidatingAdmissionPolicyStatus struct { // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy type TypeChecking struct { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. // +optional // +listType=atomic ExpressionWarnings []ExpressionWarning `json:"expressionWarnings,omitempty" protobuf:"bytes,1,rep,name=expressionWarnings"` @@ -123,11 +123,11 @@ type TypeChecking struct { // ExpressionWarning is a warning information that targets a specific expression. type ExpressionWarning struct { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" FieldRef string `json:"fieldRef" protobuf:"bytes,2,opt,name=fieldRef"` - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. Warning string `json:"warning" protobuf:"bytes,3,opt,name=warning"` @@ -139,7 +139,7 @@ type ExpressionWarning struct { // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -149,21 +149,21 @@ type ValidatingAdmissionPolicyList struct { // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. type ValidatingAdmissionPolicySpec struct { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. // +optional ParamKind *ParamKind `json:"paramKind,omitempty" protobuf:"bytes,1,rep,name=paramKind"` - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. MatchConstraints *MatchResources `json:"matchConstraints,omitempty" protobuf:"bytes,2,rep,name=matchConstraints"` - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. // +listType=atomic @@ -194,7 +194,7 @@ type ValidatingAdmissionPolicySpec struct { // +optional AuditAnnotations []AuditAnnotation `json:"auditAnnotations,omitempty" protobuf:"bytes,5,rep,name=auditAnnotations"` - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -216,7 +216,7 @@ type ValidatingAdmissionPolicySpec struct { // +optional MatchConditions []MatchCondition `json:"matchConditions,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,6,rep,name=matchConditions"` - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. @@ -236,19 +236,19 @@ type MatchCondition v1.MatchCondition // ParamKind is a tuple of Group Kind and Version. // +structType=atomic type ParamKind struct { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,1,rep,name=apiVersion"` - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. Kind string `json:"kind,omitempty" protobuf:"bytes,2,rep,name=kind"` } // Validation specifies the CEL expression which is used to apply the validation. type Validation struct { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -290,7 +290,7 @@ type Validation struct { // non-intersecting keys are appended, retaining their partial order. // Required. Expression string `json:"expression" protobuf:"bytes,1,opt,name=Expression"` - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -299,7 +299,7 @@ type Validation struct { // If unset, the message is "failed Expression: {Expression}". // +optional Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. @@ -323,12 +323,12 @@ type Validation struct { // Variable is the definition of a variable that is used for composition. type Variable struct { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` Name string `json:"name" protobuf:"bytes,1,opt,name=Name"` - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. Expression string `json:"expression" protobuf:"bytes,2,opt,name=Expression"` } @@ -388,10 +388,11 @@ type AuditAnnotation struct { // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBinding struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. + // +required Spec ValidatingAdmissionPolicyBindingSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } @@ -401,7 +402,7 @@ type ValidatingAdmissionPolicyBinding struct { // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -411,9 +412,11 @@ type ValidatingAdmissionPolicyBindingList struct { // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingSpec struct { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required PolicyName string `json:"policyName,omitempty" protobuf:"bytes,1,rep,name=policyName"` // paramRef specifies the parameter resource used to configure the admission control policy. @@ -423,7 +426,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // +optional ParamRef *ParamRef `json:"paramRef,omitempty" protobuf:"bytes,2,rep,name=paramRef"` - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. @@ -471,6 +474,8 @@ type ValidatingAdmissionPolicyBindingSpec struct { // // Required. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required ValidationActions []ValidationAction `json:"validationActions,omitempty" protobuf:"bytes,4,rep,name=validationActions"` } @@ -478,7 +483,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // expressions of rules applied by a policy binding. // +structType=atomic type ParamRef struct { - // `name` is the name of the resource being referenced. + // name is the name of the resource being referenced. // // `name` and `selector` are mutually exclusive properties. If one is set, // the other must be unset. @@ -516,7 +521,7 @@ type ParamRef struct { // +optional Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,3,rep,name=selector"` - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. @@ -534,7 +539,7 @@ type ParamRef struct { // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +structType=atomic type MatchResources struct { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -579,7 +584,7 @@ type MatchResources struct { // Default to the empty LabelSelector, which matches everything. // +optional NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,1,opt,name=namespaceSelector"` - // ObjectSelector decides whether to run the policy based on if the + // objectSelector decides whether to run the policy based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the policy's expression (CEL), and // is considered to match if either object matches the selector. A null @@ -592,12 +597,12 @@ type MatchResources struct { // Default to the empty LabelSelector, which matches everything. // +optional ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty" protobuf:"bytes,2,opt,name=objectSelector"` - // ResourceRules describes what operations on what resources/subresources the admission policy matches. + // resourceRules describes what operations on what resources/subresources the admission policy matches. // The policy cares about an operation if it matches _any_ Rule. // +listType=atomic // +optional ResourceRules []NamedRuleWithOperations `json:"resourceRules,omitempty" protobuf:"bytes,3,rep,name=resourceRules"` - // ExcludeResourceRules describes what operations on what resources/subresources the policy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the policy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +listType=atomic // +optional @@ -642,7 +647,7 @@ const ( // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. // +structType=atomic type NamedRuleWithOperations struct { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +listType=atomic // +optional ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,1,rep,name=resourceNames"` @@ -675,10 +680,10 @@ const ( // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicy struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the MutatingAdmissionPolicy. + // spec defines the desired behavior of the MutatingAdmissionPolicy. Spec MutatingAdmissionPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } @@ -688,7 +693,7 @@ type MutatingAdmissionPolicy struct { // MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. type MutatingAdmissionPolicyList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -963,10 +968,10 @@ const ( // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBinding struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the MutatingAdmissionPolicyBinding. + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. Spec MutatingAdmissionPolicyBindingSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } @@ -976,7 +981,7 @@ type MutatingAdmissionPolicyBinding struct { // MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. type MutatingAdmissionPolicyBindingList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/admissionregistration/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/admissionregistration/v1alpha1/types_swagger_doc_generated.go index 116e56e065..4b2b13bc4a 100644 --- a/vendor/k8s.io/api/admissionregistration/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/admissionregistration/v1alpha1/types_swagger_doc_generated.go @@ -48,8 +48,8 @@ func (AuditAnnotation) SwaggerDoc() map[string]string { var map_ExpressionWarning = map[string]string{ "": "ExpressionWarning is a warning information that targets a specific expression.", - "fieldRef": "The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"", - "warning": "The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.", + "fieldRef": "fieldRef is the path to the field that refers to the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"", + "warning": "warning contains the content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.", } func (ExpressionWarning) SwaggerDoc() map[string]string { @@ -67,10 +67,10 @@ func (JSONPatch) SwaggerDoc() map[string]string { var map_MatchResources = map[string]string{ "": "MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", - "namespaceSelector": "NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", - "objectSelector": "ObjectSelector decides whether to run the policy based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the policy's expression (CEL), and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", - "resourceRules": "ResourceRules describes what operations on what resources/subresources the admission policy matches. The policy cares about an operation if it matches _any_ Rule.", - "excludeResourceRules": "ExcludeResourceRules describes what operations on what resources/subresources the policy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", + "namespaceSelector": "namespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + "objectSelector": "objectSelector decides whether to run the policy based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the policy's expression (CEL), and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", + "resourceRules": "resourceRules describes what operations on what resources/subresources the admission policy matches. The policy cares about an operation if it matches _any_ Rule.", + "excludeResourceRules": "excludeResourceRules describes what operations on what resources/subresources the policy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", "matchPolicy": "matchPolicy defines how the \"MatchResources\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, the admission policy does not consider requests to apps/v1beta1 or extensions/v1beta1 API groups.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, the admission policy **does** consider requests made to apps/v1beta1 or extensions/v1beta1 API groups. The API server translates the request to a matched resource API if necessary.\n\nDefaults to \"Equivalent\"", } @@ -80,8 +80,8 @@ func (MatchResources) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicy = map[string]string{ "": "MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the MutatingAdmissionPolicy.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the MutatingAdmissionPolicy.", } func (MutatingAdmissionPolicy) SwaggerDoc() map[string]string { @@ -90,8 +90,8 @@ func (MutatingAdmissionPolicy) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicyBinding = map[string]string{ "": "MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-cost-budget).\n\nAdding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the MutatingAdmissionPolicyBinding.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the MutatingAdmissionPolicyBinding.", } func (MutatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { @@ -100,7 +100,7 @@ func (MutatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicyBindingList = map[string]string{ "": "MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of PolicyBinding.", } @@ -121,7 +121,7 @@ func (MutatingAdmissionPolicyBindingSpec) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicyList = map[string]string{ "": "MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of ValidatingAdmissionPolicy.", } @@ -157,7 +157,7 @@ func (Mutation) SwaggerDoc() map[string]string { var map_NamedRuleWithOperations = map[string]string{ "": "NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", } func (NamedRuleWithOperations) SwaggerDoc() map[string]string { @@ -166,8 +166,8 @@ func (NamedRuleWithOperations) SwaggerDoc() map[string]string { var map_ParamKind = map[string]string{ "": "ParamKind is a tuple of Group Kind and Version.", - "apiVersion": "APIVersion is the API group version the resources belong to. In format of \"group/version\". Required.", - "kind": "Kind is the API kind the resources belong to. Required.", + "apiVersion": "apiVersion is the API group version the resources belong to. In format of \"group/version\". Required.", + "kind": "kind is the API kind the resources belong to. Required.", } func (ParamKind) SwaggerDoc() map[string]string { @@ -176,10 +176,10 @@ func (ParamKind) SwaggerDoc() map[string]string { var map_ParamRef = map[string]string{ "": "ParamRef describes how to locate the params to be used as input to expressions of rules applied by a policy binding.", - "name": "`name` is the name of the resource being referenced.\n\n`name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.", + "name": "name is the name of the resource being referenced.\n\n`name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.", "namespace": "namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields.\n\nA per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty.\n\n- If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error.\n\n- If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error.", "selector": "selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind.\n\nIf multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.", - "parameterNotFoundAction": "`parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny` Default to `Deny`", + "parameterNotFoundAction": "parameterNotFoundAction controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny` Default to `Deny`", } func (ParamRef) SwaggerDoc() map[string]string { @@ -188,7 +188,7 @@ func (ParamRef) SwaggerDoc() map[string]string { var map_TypeChecking = map[string]string{ "": "TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy", - "expressionWarnings": "The type checking warnings for each expression.", + "expressionWarnings": "expressionWarnings contains the type checking warnings for each expression.", } func (TypeChecking) SwaggerDoc() map[string]string { @@ -197,9 +197,9 @@ func (TypeChecking) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicy = map[string]string{ "": "ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the ValidatingAdmissionPolicy.", - "status": "The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the ValidatingAdmissionPolicy.", + "status": "status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.", } func (ValidatingAdmissionPolicy) SwaggerDoc() map[string]string { @@ -208,8 +208,8 @@ func (ValidatingAdmissionPolicy) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBinding = map[string]string{ "": "ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.\n\nThe CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the ValidatingAdmissionPolicyBinding.", } func (ValidatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { @@ -218,7 +218,7 @@ func (ValidatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBindingList = map[string]string{ "": "ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of PolicyBinding.", } @@ -228,9 +228,9 @@ func (ValidatingAdmissionPolicyBindingList) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBindingSpec = map[string]string{ "": "ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.", - "policyName": "PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.", + "policyName": "policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.", "paramRef": "paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.", - "matchResources": "MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.", + "matchResources": "matchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.", "validationActions": "validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions.\n\nFailures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.\n\nvalidationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action.\n\nThe supported actions values are:\n\n\"Deny\" specifies that a validation failure results in a denied request.\n\n\"Warn\" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses.\n\n\"Audit\" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `\"validation.policy.admission.k8s.io/validation_failure\": \"[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]\"`\n\nClients should expect to handle additional values by ignoring any values not recognized.\n\n\"Deny\" and \"Warn\" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.\n\nRequired.", } @@ -240,7 +240,7 @@ func (ValidatingAdmissionPolicyBindingSpec) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyList = map[string]string{ "": "ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of ValidatingAdmissionPolicy.", } @@ -250,13 +250,13 @@ func (ValidatingAdmissionPolicyList) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicySpec = map[string]string{ "": "ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.", - "paramKind": "ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.", - "matchConstraints": "MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.", - "validations": "Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.", + "paramKind": "paramKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.", + "matchConstraints": "matchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.", + "validations": "validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.", "failurePolicy": "failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.\n\nA policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource.\n\nfailurePolicy does not define how validations that evaluate to false are handled.\n\nWhen failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced.\n\nAllowed values are Ignore or Fail. Defaults to Fail.", "auditAnnotations": "auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required.", - "matchConditions": "MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped", - "variables": "Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped", + "variables": "variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.", } func (ValidatingAdmissionPolicySpec) SwaggerDoc() map[string]string { @@ -265,9 +265,9 @@ func (ValidatingAdmissionPolicySpec) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyStatus = map[string]string{ "": "ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy.", - "observedGeneration": "The generation observed by the controller.", - "typeChecking": "The results of type checking for each expression. Presence of this field indicates the completion of the type checking.", - "conditions": "The conditions represent the latest available observations of a policy's current state.", + "observedGeneration": "observedGeneration is the generation observed by the controller.", + "typeChecking": "typeChecking contains the results of type checking for each expression. Presence of this field indicates the completion of the type checking.", + "conditions": "conditions represent the latest available observations of a policy's current state.", } func (ValidatingAdmissionPolicyStatus) SwaggerDoc() map[string]string { @@ -276,9 +276,9 @@ func (ValidatingAdmissionPolicyStatus) SwaggerDoc() map[string]string { var map_Validation = map[string]string{ "": "Validation specifies the CEL expression which is used to apply the validation.", - "expression": "Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.", - "message": "Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".", - "reason": "Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.", + "expression": "expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.", + "message": "message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".", + "reason": "reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.", "messageExpression": "messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: \"object.x must be less than max (\"+string(params.max)+\")\"", } @@ -288,8 +288,8 @@ func (Validation) SwaggerDoc() map[string]string { var map_Variable = map[string]string{ "": "Variable is the definition of a variable that is used for composition.", - "name": "Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`", - "expression": "Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.", + "name": "name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`", + "expression": "expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.", } func (Variable) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto b/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto index d184664e56..5fcb74f8ba 100644 --- a/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto +++ b/vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto @@ -113,12 +113,12 @@ message AuditAnnotation { // ExpressionWarning is a warning information that targets a specific expression. message ExpressionWarning { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" optional string fieldRef = 2; - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. optional string warning = 3; @@ -195,7 +195,7 @@ message JSONPatch { // MatchCondition represents a condition which must be fulfilled for a request to be sent to a webhook. message MatchCondition { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -206,7 +206,7 @@ message MatchCondition { // Required. optional string name = 1; - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. @@ -227,7 +227,7 @@ message MatchCondition { // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +structType=atomic message MatchResources { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -273,7 +273,7 @@ message MatchResources { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 1; - // ObjectSelector decides whether to run the validation based on if the + // objectSelector decides whether to run the validation based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the cel validation, and // is considered to match if either object matches the selector. A null @@ -287,13 +287,13 @@ message MatchResources { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 2; - // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. + // resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. // The policy cares about an operation if it matches _any_ Rule. // +listType=atomic // +optional repeated NamedRuleWithOperations resourceRules = 3; - // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +listType=atomic // +optional @@ -319,11 +319,11 @@ message MatchResources { // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. message MutatingAdmissionPolicy { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the MutatingAdmissionPolicy. + // spec defines the desired behavior of the MutatingAdmissionPolicy. optional MutatingAdmissionPolicySpec spec = 2; } @@ -339,17 +339,17 @@ message MutatingAdmissionPolicy { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. message MutatingAdmissionPolicyBinding { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the MutatingAdmissionPolicyBinding. + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. optional MutatingAdmissionPolicyBindingSpec spec = 2; } // MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. message MutatingAdmissionPolicyBindingList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -387,7 +387,7 @@ message MutatingAdmissionPolicyBindingSpec { // MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. message MutatingAdmissionPolicyList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -486,18 +486,18 @@ message MutatingAdmissionPolicySpec { // MutatingWebhook describes an admission webhook and the resources and operations it applies to. message MutatingWebhook { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. optional string name = 1; - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required optional WebhookClientConfig clientConfig = 2; - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -506,7 +506,7 @@ message MutatingWebhook { // +listType=atomic repeated .k8s.io.api.admissionregistration.v1.RuleWithOperations rules = 3; - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Ignore. // +optional optional string failurePolicy = 4; @@ -528,7 +528,7 @@ message MutatingWebhook { // +optional optional string matchPolicy = 9; - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -574,7 +574,7 @@ message MutatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5; - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -588,7 +588,7 @@ message MutatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 11; - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: Unknown, None, Some, NoneOnDryRun // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -597,7 +597,7 @@ message MutatingWebhook { // +optional optional string sideEffects = 6; - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -605,7 +605,7 @@ message MutatingWebhook { // +optional optional int32 timeoutSeconds = 7; - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -635,7 +635,7 @@ message MutatingWebhook { // +optional optional string reinvocationPolicy = 10; - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -658,11 +658,11 @@ message MutatingWebhook { // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 MutatingWebhookConfiguration instead. message MutatingWebhookConfiguration { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -673,7 +673,7 @@ message MutatingWebhookConfiguration { // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. message MutatingWebhookConfigurationList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -705,7 +705,7 @@ message Mutation { // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. // +structType=atomic message NamedRuleWithOperations { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +listType=atomic // +optional repeated string resourceNames = 1; @@ -717,12 +717,12 @@ message NamedRuleWithOperations { // ParamKind is a tuple of Group Kind and Version. // +structType=atomic message ParamKind { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. optional string apiVersion = 1; - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. optional string kind = 2; } @@ -771,7 +771,7 @@ message ParamRef { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3; - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. @@ -786,22 +786,22 @@ message ParamRef { // ServiceReference holds a reference to Service.legacy.k8s.io message ServiceReference { - // `namespace` is the namespace of the service. + // namespace is the namespace of the service. // Required optional string namespace = 1; - // `name` is the name of the service. + // name is the name of the service. // Required optional string name = 2; - // `path` is an optional URL path which will be sent in any request to + // path is an optional URL path which will be sent in any request to // this service. // +optional optional string path = 3; - // If specified, the port on the service that hosting webhook. + // port is the port on the service that hosts the webhook. // Default to 443 for backward compatibility. - // `port` should be a valid port number (1-65535, inclusive). + // port should be a valid port number (1-65535, inclusive). // +optional optional int32 port = 4; } @@ -809,7 +809,7 @@ message ServiceReference { // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy message TypeChecking { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. // +optional // +listType=atomic repeated ExpressionWarning expressionWarnings = 1; @@ -821,14 +821,14 @@ message TypeChecking { // +k8s:prerelease-lifecycle-gen:introduced=1.28 // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. message ValidatingAdmissionPolicy { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. optional ValidatingAdmissionPolicySpec spec = 2; - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. @@ -848,17 +848,18 @@ message ValidatingAdmissionPolicy { // Adding/removing policies, bindings, or params can not affect whether a // given (policy, binding, param) combination is within its own CEL budget. message ValidatingAdmissionPolicyBinding { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. + // +required optional ValidatingAdmissionPolicyBindingSpec spec = 2; } // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. message ValidatingAdmissionPolicyBindingList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -869,9 +870,11 @@ message ValidatingAdmissionPolicyBindingList { // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. message ValidatingAdmissionPolicyBindingSpec { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string policyName = 1; // paramRef specifies the parameter resource used to configure the admission control policy. @@ -881,7 +884,7 @@ message ValidatingAdmissionPolicyBindingSpec { // +optional optional ParamRef paramRef = 2; - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. @@ -929,6 +932,8 @@ message ValidatingAdmissionPolicyBindingSpec { // // Required. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required repeated string validationActions = 4; } @@ -936,7 +941,7 @@ message ValidatingAdmissionPolicyBindingSpec { // +k8s:prerelease-lifecycle-gen:introduced=1.28 // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. message ValidatingAdmissionPolicyList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -947,21 +952,21 @@ message ValidatingAdmissionPolicyList { // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. message ValidatingAdmissionPolicySpec { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. // +optional optional ParamKind paramKind = 1; - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. optional MatchResources matchConstraints = 2; - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. // +listType=atomic @@ -992,7 +997,7 @@ message ValidatingAdmissionPolicySpec { // +optional repeated AuditAnnotation auditAnnotations = 5; - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -1014,7 +1019,7 @@ message ValidatingAdmissionPolicySpec { // +optional repeated MatchCondition matchConditions = 6; - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. @@ -1031,16 +1036,16 @@ message ValidatingAdmissionPolicySpec { // ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. message ValidatingAdmissionPolicyStatus { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. // +optional optional int64 observedGeneration = 1; - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. // +optional optional TypeChecking typeChecking = 2; - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. // +optional // +listType=map // +listMapKey=type @@ -1049,18 +1054,18 @@ message ValidatingAdmissionPolicyStatus { // ValidatingWebhook describes an admission webhook and the resources and operations it applies to. message ValidatingWebhook { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. optional string name = 1; - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required optional WebhookClientConfig clientConfig = 2; - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -1069,7 +1074,7 @@ message ValidatingWebhook { // +listType=atomic repeated .k8s.io.api.admissionregistration.v1.RuleWithOperations rules = 3; - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Ignore. // +optional optional string failurePolicy = 4; @@ -1091,7 +1096,7 @@ message ValidatingWebhook { // +optional optional string matchPolicy = 9; - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -1137,7 +1142,7 @@ message ValidatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector namespaceSelector = 5; - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -1151,7 +1156,7 @@ message ValidatingWebhook { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector objectSelector = 10; - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: Unknown, None, Some, NoneOnDryRun // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -1161,7 +1166,7 @@ message ValidatingWebhook { // +listType=atomic optional string sideEffects = 6; - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -1169,7 +1174,7 @@ message ValidatingWebhook { // +optional optional int32 timeoutSeconds = 7; - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -1181,7 +1186,7 @@ message ValidatingWebhook { // +listType=atomic repeated string admissionReviewVersions = 8; - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -1204,11 +1209,11 @@ message ValidatingWebhook { // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration instead. message ValidatingWebhookConfiguration { - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -1219,7 +1224,7 @@ message ValidatingWebhookConfiguration { // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. message ValidatingWebhookConfigurationList { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; @@ -1230,7 +1235,7 @@ message ValidatingWebhookConfigurationList { // Validation specifies the CEL expression which is used to apply the validation. message Validation { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -1273,7 +1278,7 @@ message Validation { // Required. optional string Expression = 1; - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -1283,7 +1288,7 @@ message Validation { // +optional optional string message = 2; - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. @@ -1309,12 +1314,12 @@ message Validation { // Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. // +structType=atomic message Variable { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` optional string Name = 1; - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. optional string Expression = 2; } @@ -1322,7 +1327,7 @@ message Variable { // WebhookClientConfig contains the information to make a TLS // connection with the webhook message WebhookClientConfig { - // `url` gives the location of the webhook, in standard URL form + // url gives the location of the webhook, in standard URL form // (`scheme://host:port/path`). Exactly one of `url` or `service` // must be specified. // @@ -1351,7 +1356,7 @@ message WebhookClientConfig { // +optional optional string url = 3; - // `service` is a reference to the service for this webhook. Either + // service is a reference to the service for this webhook. Either // `service` or `url` must be specified. // // If the webhook is running within the cluster, then you should use `service`. @@ -1359,7 +1364,7 @@ message WebhookClientConfig { // +optional optional ServiceReference service = 1; - // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. // If unspecified, system trust roots on the apiserver are used. // +optional optional bytes caBundle = 2; diff --git a/vendor/k8s.io/api/admissionregistration/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/admissionregistration/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 67b85ac629..0000000000 --- a/vendor/k8s.io/api/admissionregistration/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,90 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*ApplyConfiguration) ProtoMessage() {} - -func (*AuditAnnotation) ProtoMessage() {} - -func (*ExpressionWarning) ProtoMessage() {} - -func (*JSONPatch) ProtoMessage() {} - -func (*MatchCondition) ProtoMessage() {} - -func (*MatchResources) ProtoMessage() {} - -func (*MutatingAdmissionPolicy) ProtoMessage() {} - -func (*MutatingAdmissionPolicyBinding) ProtoMessage() {} - -func (*MutatingAdmissionPolicyBindingList) ProtoMessage() {} - -func (*MutatingAdmissionPolicyBindingSpec) ProtoMessage() {} - -func (*MutatingAdmissionPolicyList) ProtoMessage() {} - -func (*MutatingAdmissionPolicySpec) ProtoMessage() {} - -func (*MutatingWebhook) ProtoMessage() {} - -func (*MutatingWebhookConfiguration) ProtoMessage() {} - -func (*MutatingWebhookConfigurationList) ProtoMessage() {} - -func (*Mutation) ProtoMessage() {} - -func (*NamedRuleWithOperations) ProtoMessage() {} - -func (*ParamKind) ProtoMessage() {} - -func (*ParamRef) ProtoMessage() {} - -func (*ServiceReference) ProtoMessage() {} - -func (*TypeChecking) ProtoMessage() {} - -func (*ValidatingAdmissionPolicy) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBinding) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBindingList) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyBindingSpec) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyList) ProtoMessage() {} - -func (*ValidatingAdmissionPolicySpec) ProtoMessage() {} - -func (*ValidatingAdmissionPolicyStatus) ProtoMessage() {} - -func (*ValidatingWebhook) ProtoMessage() {} - -func (*ValidatingWebhookConfiguration) ProtoMessage() {} - -func (*ValidatingWebhookConfigurationList) ProtoMessage() {} - -func (*Validation) ProtoMessage() {} - -func (*Variable) ProtoMessage() {} - -func (*WebhookClientConfig) ProtoMessage() {} diff --git a/vendor/k8s.io/api/admissionregistration/v1beta1/types.go b/vendor/k8s.io/api/admissionregistration/v1beta1/types.go index c7259d3d3e..734a606f4b 100644 --- a/vendor/k8s.io/api/admissionregistration/v1beta1/types.go +++ b/vendor/k8s.io/api/admissionregistration/v1beta1/types.go @@ -95,12 +95,12 @@ const ( // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicy struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. Spec ValidatingAdmissionPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. @@ -110,14 +110,14 @@ type ValidatingAdmissionPolicy struct { // ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. type ValidatingAdmissionPolicyStatus struct { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. // +optional TypeChecking *TypeChecking `json:"typeChecking,omitempty" protobuf:"bytes,2,opt,name=typeChecking"` - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. // +optional // +listType=map // +listMapKey=type @@ -130,7 +130,7 @@ type ValidatingAdmissionPolicyConditionType string // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy type TypeChecking struct { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. // +optional // +listType=atomic ExpressionWarnings []ExpressionWarning `json:"expressionWarnings,omitempty" protobuf:"bytes,1,rep,name=expressionWarnings"` @@ -138,11 +138,11 @@ type TypeChecking struct { // ExpressionWarning is a warning information that targets a specific expression. type ExpressionWarning struct { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" FieldRef string `json:"fieldRef" protobuf:"bytes,2,opt,name=fieldRef"` - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. Warning string `json:"warning" protobuf:"bytes,3,opt,name=warning"` @@ -153,7 +153,7 @@ type ExpressionWarning struct { // ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -163,21 +163,21 @@ type ValidatingAdmissionPolicyList struct { // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. type ValidatingAdmissionPolicySpec struct { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. // +optional ParamKind *ParamKind `json:"paramKind,omitempty" protobuf:"bytes,1,rep,name=paramKind"` - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. MatchConstraints *MatchResources `json:"matchConstraints,omitempty" protobuf:"bytes,2,rep,name=matchConstraints"` - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. // +listType=atomic @@ -208,7 +208,7 @@ type ValidatingAdmissionPolicySpec struct { // +optional AuditAnnotations []AuditAnnotation `json:"auditAnnotations,omitempty" protobuf:"bytes,5,rep,name=auditAnnotations"` - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -230,7 +230,7 @@ type ValidatingAdmissionPolicySpec struct { // +optional MatchConditions []MatchCondition `json:"matchConditions,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,6,rep,name=matchConditions"` - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. @@ -248,19 +248,19 @@ type ValidatingAdmissionPolicySpec struct { // ParamKind is a tuple of Group Kind and Version. // +structType=atomic type ParamKind struct { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,1,rep,name=apiVersion"` - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. Kind string `json:"kind,omitempty" protobuf:"bytes,2,rep,name=kind"` } // Validation specifies the CEL expression which is used to apply the validation. type Validation struct { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -302,7 +302,7 @@ type Validation struct { // non-intersecting keys are appended, retaining their partial order. // Required. Expression string `json:"expression" protobuf:"bytes,1,opt,name=Expression"` - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -311,7 +311,7 @@ type Validation struct { // If unset, the message is "failed Expression: {Expression}". // +optional Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"` - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. @@ -336,12 +336,12 @@ type Validation struct { // Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. // +structType=atomic type Variable struct { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` Name string `json:"name" protobuf:"bytes,1,opt,name=Name"` - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. Expression string `json:"expression" protobuf:"bytes,2,opt,name=Expression"` } @@ -401,10 +401,11 @@ type AuditAnnotation struct { // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBinding struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. + // +required Spec ValidatingAdmissionPolicyBindingSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } @@ -414,7 +415,7 @@ type ValidatingAdmissionPolicyBinding struct { // ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -424,9 +425,11 @@ type ValidatingAdmissionPolicyBindingList struct { // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingSpec struct { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required PolicyName string `json:"policyName,omitempty" protobuf:"bytes,1,rep,name=policyName"` // paramRef specifies the parameter resource used to configure the admission control policy. @@ -436,7 +439,7 @@ type ValidatingAdmissionPolicyBindingSpec struct { // +optional ParamRef *ParamRef `json:"paramRef,omitempty" protobuf:"bytes,2,rep,name=paramRef"` - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. @@ -484,6 +487,8 @@ type ValidatingAdmissionPolicyBindingSpec struct { // // Required. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required ValidationActions []ValidationAction `json:"validationActions,omitempty" protobuf:"bytes,4,rep,name=validationActions"` } @@ -532,7 +537,7 @@ type ParamRef struct { // +optional Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,3,rep,name=selector"` - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. @@ -550,7 +555,7 @@ type ParamRef struct { // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +structType=atomic type MatchResources struct { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -595,7 +600,7 @@ type MatchResources struct { // Default to the empty LabelSelector, which matches everything. // +optional NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,1,opt,name=namespaceSelector"` - // ObjectSelector decides whether to run the validation based on if the + // objectSelector decides whether to run the validation based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the cel validation, and // is considered to match if either object matches the selector. A null @@ -608,12 +613,12 @@ type MatchResources struct { // Default to the empty LabelSelector, which matches everything. // +optional ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty" protobuf:"bytes,2,opt,name=objectSelector"` - // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. + // resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. // The policy cares about an operation if it matches _any_ Rule. // +listType=atomic // +optional ResourceRules []NamedRuleWithOperations `json:"resourceRules,omitempty" protobuf:"bytes,3,rep,name=resourceRules"` - // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) // +listType=atomic // +optional @@ -657,7 +662,7 @@ const ( // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. // +structType=atomic type NamedRuleWithOperations struct { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. // +listType=atomic // +optional ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,1,rep,name=resourceNames"` @@ -677,10 +682,10 @@ type NamedRuleWithOperations struct { // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration instead. type ValidatingWebhookConfiguration struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -698,7 +703,7 @@ type ValidatingWebhookConfiguration struct { // ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration. type ValidatingWebhookConfigurationList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -718,10 +723,10 @@ type ValidatingWebhookConfigurationList struct { // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 MutatingWebhookConfiguration instead. type MutatingWebhookConfiguration struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. // +optional // +patchMergeKey=name // +patchStrategy=merge @@ -739,7 +744,7 @@ type MutatingWebhookConfiguration struct { // MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration. type MutatingWebhookConfigurationList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -749,18 +754,18 @@ type MutatingWebhookConfigurationList struct { // ValidatingWebhook describes an admission webhook and the resources and operations it applies to. type ValidatingWebhook struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig WebhookClientConfig `json:"clientConfig" protobuf:"bytes,2,opt,name=clientConfig"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -769,7 +774,7 @@ type ValidatingWebhook struct { // +listType=atomic Rules []RuleWithOperations `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Ignore. // +optional FailurePolicy *FailurePolicyType `json:"failurePolicy,omitempty" protobuf:"bytes,4,opt,name=failurePolicy,casttype=FailurePolicyType"` @@ -791,7 +796,7 @@ type ValidatingWebhook struct { // +optional MatchPolicy *MatchPolicyType `json:"matchPolicy,omitempty" protobuf:"bytes,9,opt,name=matchPolicy,casttype=MatchPolicyType"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -837,7 +842,7 @@ type ValidatingWebhook struct { // +optional NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,5,opt,name=namespaceSelector"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -851,7 +856,7 @@ type ValidatingWebhook struct { // +optional ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty" protobuf:"bytes,10,opt,name=objectSelector"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: Unknown, None, Some, NoneOnDryRun // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -861,7 +866,7 @@ type ValidatingWebhook struct { // +listType=atomic SideEffects *SideEffectClass `json:"sideEffects,omitempty" protobuf:"bytes,6,opt,name=sideEffects,casttype=SideEffectClass"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -869,7 +874,7 @@ type ValidatingWebhook struct { // +optional TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,7,opt,name=timeoutSeconds"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -881,7 +886,7 @@ type ValidatingWebhook struct { // +listType=atomic AdmissionReviewVersions []string `json:"admissionReviewVersions,omitempty" protobuf:"bytes,8,rep,name=admissionReviewVersions"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -903,18 +908,18 @@ type ValidatingWebhook struct { // MutatingWebhook describes an admission webhook and the resources and operations it applies to. type MutatingWebhook struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig WebhookClientConfig `json:"clientConfig" protobuf:"bytes,2,opt,name=clientConfig"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely @@ -923,7 +928,7 @@ type MutatingWebhook struct { // +listType=atomic Rules []RuleWithOperations `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Ignore. // +optional FailurePolicy *FailurePolicyType `json:"failurePolicy,omitempty" protobuf:"bytes,4,opt,name=failurePolicy,casttype=FailurePolicyType"` @@ -945,7 +950,7 @@ type MutatingWebhook struct { // +optional MatchPolicy *MatchPolicyType `json:"matchPolicy,omitempty" protobuf:"bytes,9,opt,name=matchPolicy,casttype=MatchPolicyType"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -991,7 +996,7 @@ type MutatingWebhook struct { // +optional NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,5,opt,name=namespaceSelector"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -1005,7 +1010,7 @@ type MutatingWebhook struct { // +optional ObjectSelector *metav1.LabelSelector `json:"objectSelector,omitempty" protobuf:"bytes,11,opt,name=objectSelector"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: Unknown, None, Some, NoneOnDryRun // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. @@ -1014,7 +1019,7 @@ type MutatingWebhook struct { // +optional SideEffects *SideEffectClass `json:"sideEffects,omitempty" protobuf:"bytes,6,opt,name=sideEffects,casttype=SideEffectClass"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. @@ -1022,7 +1027,7 @@ type MutatingWebhook struct { // +optional TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty" protobuf:"varint,7,opt,name=timeoutSeconds"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -1052,7 +1057,7 @@ type MutatingWebhook struct { // +optional ReinvocationPolicy *ReinvocationPolicyType `json:"reinvocationPolicy,omitempty" protobuf:"bytes,10,opt,name=reinvocationPolicy,casttype=ReinvocationPolicyType"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -1107,7 +1112,7 @@ const ( // WebhookClientConfig contains the information to make a TLS // connection with the webhook type WebhookClientConfig struct { - // `url` gives the location of the webhook, in standard URL form + // url gives the location of the webhook, in standard URL form // (`scheme://host:port/path`). Exactly one of `url` or `service` // must be specified. // @@ -1136,7 +1141,7 @@ type WebhookClientConfig struct { // +optional URL *string `json:"url,omitempty" protobuf:"bytes,3,opt,name=url"` - // `service` is a reference to the service for this webhook. Either + // service is a reference to the service for this webhook. Either // `service` or `url` must be specified. // // If the webhook is running within the cluster, then you should use `service`. @@ -1144,7 +1149,7 @@ type WebhookClientConfig struct { // +optional Service *ServiceReference `json:"service,omitempty" protobuf:"bytes,1,opt,name=service"` - // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. // If unspecified, system trust roots on the apiserver are used. // +optional CABundle []byte `json:"caBundle,omitempty" protobuf:"bytes,2,opt,name=caBundle"` @@ -1152,28 +1157,28 @@ type WebhookClientConfig struct { // ServiceReference holds a reference to Service.legacy.k8s.io type ServiceReference struct { - // `namespace` is the namespace of the service. + // namespace is the namespace of the service. // Required Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"` - // `name` is the name of the service. + // name is the name of the service. // Required Name string `json:"name" protobuf:"bytes,2,opt,name=name"` - // `path` is an optional URL path which will be sent in any request to + // path is an optional URL path which will be sent in any request to // this service. // +optional Path *string `json:"path,omitempty" protobuf:"bytes,3,opt,name=path"` - // If specified, the port on the service that hosting webhook. + // port is the port on the service that hosts the webhook. // Default to 443 for backward compatibility. - // `port` should be a valid port number (1-65535, inclusive). + // port should be a valid port number (1-65535, inclusive). // +optional Port *int32 `json:"port,omitempty" protobuf:"varint,4,opt,name=port"` } // MatchCondition represents a condition which must be fulfilled for a request to be sent to a webhook. type MatchCondition struct { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -1184,7 +1189,7 @@ type MatchCondition struct { // Required. Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. @@ -1204,24 +1209,26 @@ type MatchCondition struct { // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.34 +// +k8s:prerelease-lifecycle-gen:replacement=admissionregistration.k8s.io,v1,MutatingAdmissionPolicy // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicy struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the MutatingAdmissionPolicy. + // spec defines the desired behavior of the MutatingAdmissionPolicy. Spec MutatingAdmissionPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.34 +// +k8s:prerelease-lifecycle-gen:replacement=admissionregistration.k8s.io,v1,MutatingAdmissionPolicyList // MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy. type MutatingAdmissionPolicyList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` @@ -1467,6 +1474,7 @@ type JSONPatch struct { // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.34 +// +k8s:prerelease-lifecycle-gen:replacement=admissionregistration.k8s.io,v1,MutatingAdmissionPolicyBinding // MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. // MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators @@ -1481,20 +1489,21 @@ type JSONPatch struct { // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBinding struct { metav1.TypeMeta `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Specification of the desired behavior of the MutatingAdmissionPolicyBinding. + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. Spec MutatingAdmissionPolicyBindingSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.34 +// +k8s:prerelease-lifecycle-gen:replacement=admissionregistration.k8s.io,v1,MutatingAdmissionPolicyBindingList // MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding. type MutatingAdmissionPolicyBindingList struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds // +optional metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` diff --git a/vendor/k8s.io/api/admissionregistration/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/admissionregistration/v1beta1/types_swagger_doc_generated.go index 1a97c94729..0fcf37aa13 100644 --- a/vendor/k8s.io/api/admissionregistration/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/admissionregistration/v1beta1/types_swagger_doc_generated.go @@ -48,8 +48,8 @@ func (AuditAnnotation) SwaggerDoc() map[string]string { var map_ExpressionWarning = map[string]string{ "": "ExpressionWarning is a warning information that targets a specific expression.", - "fieldRef": "The path to the field that refers the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"", - "warning": "The content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.", + "fieldRef": "fieldRef is the path to the field that refers to the expression. For example, the reference to the expression of the first item of validations is \"spec.validations[0].expression\"", + "warning": "warning contains the content of type checking information in a human-readable form. Each line of the warning contains the type that the expression is checked against, followed by the type check error from the compiler.", } func (ExpressionWarning) SwaggerDoc() map[string]string { @@ -67,8 +67,8 @@ func (JSONPatch) SwaggerDoc() map[string]string { var map_MatchCondition = map[string]string{ "": "MatchCondition represents a condition which must be fulfilled for a request to be sent to a webhook.", - "name": "Name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')\n\nRequired.", - "expression": "Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:\n\n'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\nDocumentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n\nRequired.", + "name": "name is an identifier for this match condition, used for strategic merging of MatchConditions, as well as providing an identifier for logging purposes. A good name should be descriptive of the associated expression. Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]') with an optional DNS subdomain prefix and '/' (e.g. 'example.com/MyName')\n\nRequired.", + "expression": "expression represents the expression which will be evaluated by CEL. Must evaluate to bool. CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables:\n\n'object' - The object from the incoming request. The value is null for DELETE requests. 'oldObject' - The existing object. The value is null for CREATE requests. 'request' - Attributes of the admission request(/pkg/apis/admission/types.go#AdmissionRequest). 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\nDocumentation on CEL: https://kubernetes.io/docs/reference/using-api/cel/\n\nRequired.", } func (MatchCondition) SwaggerDoc() map[string]string { @@ -77,10 +77,10 @@ func (MatchCondition) SwaggerDoc() map[string]string { var map_MatchResources = map[string]string{ "": "MatchResources decides whether to run the admission control policy on an object based on whether it meets the match criteria. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", - "namespaceSelector": "NamespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", - "objectSelector": "ObjectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", - "resourceRules": "ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule.", - "excludeResourceRules": "ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", + "namespaceSelector": "namespaceSelector decides whether to run the admission control policy on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the policy.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the policy on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + "objectSelector": "objectSelector decides whether to run the validation based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the cel validation, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", + "resourceRules": "resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. The policy cares about an operation if it matches _any_ Rule.", + "excludeResourceRules": "excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. The exclude rules take precedence over include rules (if a resource matches both, it is excluded)", "matchPolicy": "matchPolicy defines how the \"MatchResources\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the ValidatingAdmissionPolicy.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the ValidatingAdmissionPolicy.\n\nDefaults to \"Equivalent\"", } @@ -90,8 +90,8 @@ func (MatchResources) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicy = map[string]string{ "": "MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the MutatingAdmissionPolicy.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the MutatingAdmissionPolicy.", } func (MutatingAdmissionPolicy) SwaggerDoc() map[string]string { @@ -100,8 +100,8 @@ func (MutatingAdmissionPolicy) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicyBinding = map[string]string{ "": "MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding. Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-cost-budget).\n\nAdding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the MutatingAdmissionPolicyBinding.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the MutatingAdmissionPolicyBinding.", } func (MutatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { @@ -110,7 +110,7 @@ func (MutatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicyBindingList = map[string]string{ "": "MutatingAdmissionPolicyBindingList is a list of MutatingAdmissionPolicyBinding.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of PolicyBinding.", } @@ -131,7 +131,7 @@ func (MutatingAdmissionPolicyBindingSpec) SwaggerDoc() map[string]string { var map_MutatingAdmissionPolicyList = map[string]string{ "": "MutatingAdmissionPolicyList is a list of MutatingAdmissionPolicy.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of ValidatingAdmissionPolicy.", } @@ -156,18 +156,18 @@ func (MutatingAdmissionPolicySpec) SwaggerDoc() map[string]string { var map_MutatingWebhook = map[string]string{ "": "MutatingWebhook describes an admission webhook and the resources and operations it applies to.", - "name": "The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", - "clientConfig": "ClientConfig defines how to communicate with the hook. Required", - "rules": "Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", - "failurePolicy": "FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.", + "name": "name is the name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", + "clientConfig": "clientConfig defines how to communicate with the hook. Required", + "rules": "rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", + "failurePolicy": "failurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.", "matchPolicy": "matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.\n\nDefaults to \"Exact\"", - "namespaceSelector": "NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", - "objectSelector": "ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", - "sideEffects": "SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.", - "timeoutSeconds": "TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 30 seconds.", - "admissionReviewVersions": "AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. Default to `['v1beta1']`.", + "namespaceSelector": "namespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + "objectSelector": "objectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", + "sideEffects": "sideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.", + "timeoutSeconds": "timeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 30 seconds.", + "admissionReviewVersions": "admissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. Default to `['v1beta1']`.", "reinvocationPolicy": "reinvocationPolicy indicates whether this webhook should be called multiple times as part of a single admission evaluation. Allowed values are \"Never\" and \"IfNeeded\".\n\nNever: the webhook will not be called more than once in a single admission evaluation.\n\nIfNeeded: the webhook will be called at least one additional time as part of the admission evaluation if the object being admitted is modified by other admission plugins after the initial webhook call. Webhooks that specify this option *must* be idempotent, able to process objects they previously admitted. Note: * the number of additional invocations is not guaranteed to be exactly one. * if additional invocations result in further modifications to the object, webhooks are not guaranteed to be invoked again. * webhooks that use this option may be reordered to minimize the number of additional invocations. * to validate an object after all mutations are guaranteed complete, use a validating admission webhook instead.\n\nDefaults to \"Never\".", - "matchConditions": "MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", } func (MutatingWebhook) SwaggerDoc() map[string]string { @@ -176,8 +176,8 @@ func (MutatingWebhook) SwaggerDoc() map[string]string { var map_MutatingWebhookConfiguration = map[string]string{ "": "MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 MutatingWebhookConfiguration instead.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "webhooks": "Webhooks is a list of webhooks and the affected resources and operations.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "webhooks": "webhooks is a list of webhooks and the affected resources and operations.", } func (MutatingWebhookConfiguration) SwaggerDoc() map[string]string { @@ -186,7 +186,7 @@ func (MutatingWebhookConfiguration) SwaggerDoc() map[string]string { var map_MutatingWebhookConfigurationList = map[string]string{ "": "MutatingWebhookConfigurationList is a list of MutatingWebhookConfiguration.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of MutatingWebhookConfiguration.", } @@ -207,7 +207,7 @@ func (Mutation) SwaggerDoc() map[string]string { var map_NamedRuleWithOperations = map[string]string{ "": "NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed.", } func (NamedRuleWithOperations) SwaggerDoc() map[string]string { @@ -216,8 +216,8 @@ func (NamedRuleWithOperations) SwaggerDoc() map[string]string { var map_ParamKind = map[string]string{ "": "ParamKind is a tuple of Group Kind and Version.", - "apiVersion": "APIVersion is the API group version the resources belong to. In format of \"group/version\". Required.", - "kind": "Kind is the API kind the resources belong to. Required.", + "apiVersion": "apiVersion is the API group version the resources belong to. In format of \"group/version\". Required.", + "kind": "kind is the API kind the resources belong to. Required.", } func (ParamKind) SwaggerDoc() map[string]string { @@ -229,7 +229,7 @@ var map_ParamRef = map[string]string{ "name": "name is the name of the resource being referenced.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.\n\nA single parameter used for all admission requests can be configured by setting the `name` field, leaving `selector` blank, and setting namespace if `paramKind` is namespace-scoped.", "namespace": "namespace is the namespace of the referenced resource. Allows limiting the search for params to a specific namespace. Applies to both `name` and `selector` fields.\n\nA per-namespace parameter may be used by specifying a namespace-scoped `paramKind` in the policy and leaving this field empty.\n\n- If `paramKind` is cluster-scoped, this field MUST be unset. Setting this field results in a configuration error.\n\n- If `paramKind` is namespace-scoped, the namespace of the object being evaluated for admission will be used when this field is left unset. Take care that if this is left empty the binding must not match any cluster-scoped resources, which will result in an error.", "selector": "selector can be used to match multiple param objects based on their labels. Supply selector: {} to match all resources of the ParamKind.\n\nIf multiple params are found, they are all evaluated with the policy expressions and the results are ANDed together.\n\nOne of `name` or `selector` must be set, but `name` and `selector` are mutually exclusive properties. If one is set, the other must be unset.", - "parameterNotFoundAction": "`parameterNotFoundAction` controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny`\n\nRequired", + "parameterNotFoundAction": "parameterNotFoundAction controls the behavior of the binding when the resource exists, and name or selector is valid, but there are no parameters matched by the binding. If the value is set to `Allow`, then no matched parameters will be treated as successful validation by the binding. If set to `Deny`, then no matched parameters will be subject to the `failurePolicy` of the policy.\n\nAllowed values are `Allow` or `Deny`\n\nRequired", } func (ParamRef) SwaggerDoc() map[string]string { @@ -238,10 +238,10 @@ func (ParamRef) SwaggerDoc() map[string]string { var map_ServiceReference = map[string]string{ "": "ServiceReference holds a reference to Service.legacy.k8s.io", - "namespace": "`namespace` is the namespace of the service. Required", - "name": "`name` is the name of the service. Required", - "path": "`path` is an optional URL path which will be sent in any request to this service.", - "port": "If specified, the port on the service that hosting webhook. Default to 443 for backward compatibility. `port` should be a valid port number (1-65535, inclusive).", + "namespace": "namespace is the namespace of the service. Required", + "name": "name is the name of the service. Required", + "path": "path is an optional URL path which will be sent in any request to this service.", + "port": "port is the port on the service that hosts the webhook. Default to 443 for backward compatibility. port should be a valid port number (1-65535, inclusive).", } func (ServiceReference) SwaggerDoc() map[string]string { @@ -250,7 +250,7 @@ func (ServiceReference) SwaggerDoc() map[string]string { var map_TypeChecking = map[string]string{ "": "TypeChecking contains results of type checking the expressions in the ValidatingAdmissionPolicy", - "expressionWarnings": "The type checking warnings for each expression.", + "expressionWarnings": "expressionWarnings contains the type checking warnings for each expression.", } func (TypeChecking) SwaggerDoc() map[string]string { @@ -259,9 +259,9 @@ func (TypeChecking) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicy = map[string]string{ "": "ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the ValidatingAdmissionPolicy.", - "status": "The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the ValidatingAdmissionPolicy.", + "status": "status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy behaves in the expected way. Populated by the system. Read-only.", } func (ValidatingAdmissionPolicy) SwaggerDoc() map[string]string { @@ -270,8 +270,8 @@ func (ValidatingAdmissionPolicy) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBinding = map[string]string{ "": "ValidatingAdmissionPolicyBinding binds the ValidatingAdmissionPolicy with paramerized resources. ValidatingAdmissionPolicyBinding and parameter CRDs together define how cluster administrators configure policies for clusters.\n\nFor a given admission request, each binding will cause its policy to be evaluated N times, where N is 1 for policies/bindings that don't use params, otherwise N is the number of parameters selected by the binding.\n\nThe CEL expressions of a policy must have a computed CEL cost below the maximum CEL budget. Each evaluation of the policy is given an independent CEL cost budget. Adding/removing policies, bindings, or params can not affect whether a given (policy, binding, param) combination is within its own CEL budget.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "spec": "Specification of the desired behavior of the ValidatingAdmissionPolicyBinding.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "spec": "spec defines the desired behavior of the ValidatingAdmissionPolicyBinding.", } func (ValidatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { @@ -280,7 +280,7 @@ func (ValidatingAdmissionPolicyBinding) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBindingList = map[string]string{ "": "ValidatingAdmissionPolicyBindingList is a list of ValidatingAdmissionPolicyBinding.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of PolicyBinding.", } @@ -290,9 +290,9 @@ func (ValidatingAdmissionPolicyBindingList) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyBindingSpec = map[string]string{ "": "ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding.", - "policyName": "PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.", + "policyName": "policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. If the referenced resource does not exist, this binding is considered invalid and will be ignored Required.", "paramRef": "paramRef specifies the parameter resource used to configure the admission control policy. It should point to a resource of the type specified in ParamKind of the bound ValidatingAdmissionPolicy. If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param.", - "matchResources": "MatchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.", + "matchResources": "matchResources declares what resources match this binding and will be validated by it. Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. If this is unset, all resources matched by the policy are validated by this binding When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. Note that this is differs from ValidatingAdmissionPolicy matchConstraints, where resourceRules are required.", "validationActions": "validationActions declares how Validations of the referenced ValidatingAdmissionPolicy are enforced. If a validation evaluates to false it is always enforced according to these actions.\n\nFailures defined by the ValidatingAdmissionPolicy's FailurePolicy are enforced according to these actions only if the FailurePolicy is set to Fail, otherwise the failures are ignored. This includes compilation errors, runtime errors and misconfigurations of the policy.\n\nvalidationActions is declared as a set of action values. Order does not matter. validationActions may not contain duplicates of the same action.\n\nThe supported actions values are:\n\n\"Deny\" specifies that a validation failure results in a denied request.\n\n\"Warn\" specifies that a validation failure is reported to the request client in HTTP Warning headers, with a warning code of 299. Warnings can be sent both for allowed or denied admission responses.\n\n\"Audit\" specifies that a validation failure is included in the published audit event for the request. The audit event will contain a `validation.policy.admission.k8s.io/validation_failure` audit annotation with a value containing the details of the validation failures, formatted as a JSON list of objects, each with the following fields: - message: The validation failure message string - policy: The resource name of the ValidatingAdmissionPolicy - binding: The resource name of the ValidatingAdmissionPolicyBinding - expressionIndex: The index of the failed validations in the ValidatingAdmissionPolicy - validationActions: The enforcement actions enacted for the validation failure Example audit annotation: `\"validation.policy.admission.k8s.io/validation_failure\": \"[{\"message\": \"Invalid value\", {\"policy\": \"policy.example.com\", {\"binding\": \"policybinding.example.com\", {\"expressionIndex\": \"1\", {\"validationActions\": [\"Audit\"]}]\"`\n\nClients should expect to handle additional values by ignoring any values not recognized.\n\n\"Deny\" and \"Warn\" may not be used together since this combination needlessly duplicates the validation failure both in the API response body and the HTTP warning headers.\n\nRequired.", } @@ -302,7 +302,7 @@ func (ValidatingAdmissionPolicyBindingSpec) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyList = map[string]string{ "": "ValidatingAdmissionPolicyList is a list of ValidatingAdmissionPolicy.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of ValidatingAdmissionPolicy.", } @@ -312,13 +312,13 @@ func (ValidatingAdmissionPolicyList) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicySpec = map[string]string{ "": "ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy.", - "paramKind": "ParamKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.", - "matchConstraints": "MatchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.", - "validations": "Validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.", + "paramKind": "paramKind specifies the kind of resources used to parameterize this policy. If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null.", + "matchConstraints": "matchConstraints specifies what resources this policy is designed to validate. The AdmissionPolicy cares about a request if it matches _all_ Constraints. However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. Required.", + "validations": "validations contain CEL expressions which is used to apply the validation. Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is required.", "failurePolicy": "failurePolicy defines how to handle failures for the admission policy. Failures can occur from CEL expression parse errors, type check errors, runtime errors and invalid or mis-configured policy definitions or bindings.\n\nA policy is invalid if spec.paramKind refers to a non-existent Kind. A binding is invalid if spec.paramRef.name refers to a non-existent resource.\n\nfailurePolicy does not define how validations that evaluate to false are handled.\n\nWhen failurePolicy is set to Fail, ValidatingAdmissionPolicyBinding validationActions define how failures are enforced.\n\nAllowed values are Ignore or Fail. Defaults to Fail.", "auditAnnotations": "auditAnnotations contains CEL expressions which are used to produce audit annotations for the audit event of the API request. validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is required.", - "matchConditions": "MatchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped", - "variables": "Variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be validated. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nIf a parameter object is provided, it can be accessed via the `params` handle in the same manner as validation expressions.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the policy is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the policy is skipped", + "variables": "variables contain definitions of variables that can be used in composition of other expressions. Each variable is defined as a named CEL expression. The variables defined here will be available under `variables` in other expressions of the policy except MatchConditions because MatchConditions are evaluated before the rest of the policy.\n\nThe expression of a variable can refer to other variables defined earlier in the list but not those after. Thus, Variables must be sorted by the order of first appearance and acyclic.", } func (ValidatingAdmissionPolicySpec) SwaggerDoc() map[string]string { @@ -327,9 +327,9 @@ func (ValidatingAdmissionPolicySpec) SwaggerDoc() map[string]string { var map_ValidatingAdmissionPolicyStatus = map[string]string{ "": "ValidatingAdmissionPolicyStatus represents the status of an admission validation policy.", - "observedGeneration": "The generation observed by the controller.", - "typeChecking": "The results of type checking for each expression. Presence of this field indicates the completion of the type checking.", - "conditions": "The conditions represent the latest available observations of a policy's current state.", + "observedGeneration": "observedGeneration is the generation observed by the controller.", + "typeChecking": "typeChecking contains the results of type checking for each expression. Presence of this field indicates the completion of the type checking.", + "conditions": "conditions represent the latest available observations of a policy's current state.", } func (ValidatingAdmissionPolicyStatus) SwaggerDoc() map[string]string { @@ -338,17 +338,17 @@ func (ValidatingAdmissionPolicyStatus) SwaggerDoc() map[string]string { var map_ValidatingWebhook = map[string]string{ "": "ValidatingWebhook describes an admission webhook and the resources and operations it applies to.", - "name": "The name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", - "clientConfig": "ClientConfig defines how to communicate with the hook. Required", - "rules": "Rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", - "failurePolicy": "FailurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.", + "name": "name is the name of the admission webhook. Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where \"imagepolicy\" is the name of the webhook, and kubernetes.io is the name of the organization. Required.", + "clientConfig": "clientConfig defines how to communicate with the hook. Required", + "rules": "rules describes what operations on what resources/subresources the webhook cares about. The webhook cares about an operation if it matches _any_ Rule. However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks from putting the cluster in a state which cannot be recovered from without completely disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects.", + "failurePolicy": "failurePolicy defines how unrecognized errors from the admission endpoint are handled - allowed values are Ignore or Fail. Defaults to Ignore.", "matchPolicy": "matchPolicy defines how the \"rules\" list is used to match incoming requests. Allowed values are \"Exact\" or \"Equivalent\".\n\n- Exact: match a request only if it exactly matches a specified rule. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, but \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would not be sent to the webhook.\n\n- Equivalent: match a request if modifies a resource listed in rules, even via another API group or version. For example, if deployments can be modified via apps/v1, apps/v1beta1, and extensions/v1beta1, and \"rules\" only included `apiGroups:[\"apps\"], apiVersions:[\"v1\"], resources: [\"deployments\"]`, a request to apps/v1beta1 or extensions/v1beta1 would be converted to apps/v1 and sent to the webhook.\n\nDefaults to \"Exact\"", - "namespaceSelector": "NamespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", - "objectSelector": "ObjectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", - "sideEffects": "SideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.", - "timeoutSeconds": "TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 30 seconds.", - "admissionReviewVersions": "AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. Default to `['v1beta1']`.", - "matchConditions": "MatchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", + "namespaceSelector": "namespaceSelector decides whether to run the webhook on an object based on whether the namespace for that object matches the selector. If the object itself is a namespace, the matching is performed on object.metadata.labels. If the object is another cluster scoped resource, it never skips the webhook.\n\nFor example, to run the webhook on any objects whose namespace is not associated with \"runlevel\" of \"0\" or \"1\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"runlevel\",\n \"operator\": \"NotIn\",\n \"values\": [\n \"0\",\n \"1\"\n ]\n }\n ]\n}\n\nIf instead you want to only run the webhook on any objects whose namespace is associated with the \"environment\" of \"prod\" or \"staging\"; you will set the selector as follows: \"namespaceSelector\": {\n \"matchExpressions\": [\n {\n \"key\": \"environment\",\n \"operator\": \"In\",\n \"values\": [\n \"prod\",\n \"staging\"\n ]\n }\n ]\n}\n\nSee https://kubernetes.io/docs/concepts/overview/working-with-objects/labels for more examples of label selectors.\n\nDefault to the empty LabelSelector, which matches everything.", + "objectSelector": "objectSelector decides whether to run the webhook based on if the object has matching labels. objectSelector is evaluated against both the oldObject and newObject that would be sent to the webhook, and is considered to match if either object matches the selector. A null object (oldObject in the case of create, or newObject in the case of delete) or an object that cannot have labels (like a DeploymentRollback or a PodProxyOptions object) is not considered to match. Use the object selector only if the webhook is opt-in, because end users may skip the admission webhook by setting the labels. Default to the empty LabelSelector, which matches everything.", + "sideEffects": "sideEffects states whether this webhook has side effects. Acceptable values are: Unknown, None, Some, NoneOnDryRun Webhooks with side effects MUST implement a reconciliation system, since a request may be rejected by a future step in the admission chain and the side effects therefore need to be undone. Requests with the dryRun attribute will be auto-rejected if they match a webhook with sideEffects == Unknown or Some. Defaults to Unknown.", + "timeoutSeconds": "timeoutSeconds specifies the timeout for this webhook. After the timeout passes, the webhook call will be ignored or the API call will fail based on the failure policy. The timeout value must be between 1 and 30 seconds. Default to 30 seconds.", + "admissionReviewVersions": "admissionReviewVersions is an ordered list of preferred `AdmissionReview` versions the Webhook expects. API server will try to use first version in the list which it supports. If none of the versions specified in this list supported by API server, validation will fail for this object. If a persisted webhook configuration specifies allowed versions and does not include any versions known to the API Server, calls to the webhook will fail and be subject to the failure policy. Default to `['v1beta1']`.", + "matchConditions": "matchConditions is a list of conditions that must be met for a request to be sent to this webhook. Match conditions filter requests that have already been matched by the rules, namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. There are a maximum of 64 match conditions allowed.\n\nThe exact matching logic is (in order):\n 1. If ANY matchCondition evaluates to FALSE, the webhook is skipped.\n 2. If ALL matchConditions evaluate to TRUE, the webhook is called.\n 3. If any matchCondition evaluates to an error (but none are FALSE):\n - If failurePolicy=Fail, reject the request\n - If failurePolicy=Ignore, the error is ignored and the webhook is skipped", } func (ValidatingWebhook) SwaggerDoc() map[string]string { @@ -357,8 +357,8 @@ func (ValidatingWebhook) SwaggerDoc() map[string]string { var map_ValidatingWebhookConfiguration = map[string]string{ "": "ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration instead.", - "metadata": "Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", - "webhooks": "Webhooks is a list of webhooks and the affected resources and operations.", + "metadata": "metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.", + "webhooks": "webhooks is a list of webhooks and the affected resources and operations.", } func (ValidatingWebhookConfiguration) SwaggerDoc() map[string]string { @@ -367,7 +367,7 @@ func (ValidatingWebhookConfiguration) SwaggerDoc() map[string]string { var map_ValidatingWebhookConfigurationList = map[string]string{ "": "ValidatingWebhookConfigurationList is a list of ValidatingWebhookConfiguration.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", "items": "List of ValidatingWebhookConfiguration.", } @@ -377,9 +377,9 @@ func (ValidatingWebhookConfigurationList) SwaggerDoc() map[string]string { var map_Validation = map[string]string{ "": "Validation specifies the CEL expression which is used to apply the validation.", - "expression": "Expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.", - "message": "Message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".", - "reason": "Reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.", + "expression": "expression represents the expression which will be evaluated by CEL. ref: https://github.com/google/cel-spec CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables:\n\n- 'object' - The object from the incoming request. The value is null for DELETE requests. - 'oldObject' - The existing object. The value is null for CREATE requests. - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. - 'variables' - Map of composited variables, from its name to its lazily evaluated value.\n For example, a variable named 'foo' can be accessed as 'variables.foo'.\n- 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request.\n See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz\n- 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the\n request resource.\n\nThe `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the object. No other metadata properties are accessible.\n\nOnly property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. Accessible property names are escaped according to the following rules when accessed in the expression: - '__' escapes to '__underscores__' - '.' escapes to '__dot__' - '-' escapes to '__dash__' - '/' escapes to '__slash__' - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are:\n\t \"true\", \"false\", \"null\", \"in\", \"as\", \"break\", \"const\", \"continue\", \"else\", \"for\", \"function\", \"if\",\n\t \"import\", \"let\", \"loop\", \"package\", \"namespace\", \"return\".\nExamples:\n - Expression accessing a property named \"namespace\": {\"Expression\": \"object.__namespace__ > 0\"}\n - Expression accessing a property named \"x-prop\": {\"Expression\": \"object.x__dash__prop > 0\"}\n - Expression accessing a property named \"redact__d\": {\"Expression\": \"object.redact__underscores__d > 0\"}\n\nEquality on arrays with list type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type:\n - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and\n non-intersecting elements in `Y` are appended, retaining their partial order.\n - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values\n are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with\n non-intersecting keys are appended, retaining their partial order.\nRequired.", + "message": "message represents the message displayed when validation fails. The message is required if the Expression contains line breaks. The message must not contain line breaks. If unset, the message is \"failed rule: {Rule}\". e.g. \"must be a URL with the host matching spec.host\" If the Expression contains line breaks. Message is required. The message must not contain line breaks. If unset, the message is \"failed Expression: {Expression}\".", + "reason": "reason represents a machine-readable description of why this validation failed. If this is the first validation in the list to fail, this reason, as well as the corresponding HTTP response code, are used in the HTTP response to the client. The currently supported reasons are: \"Unauthorized\", \"Forbidden\", \"Invalid\", \"RequestEntityTooLarge\". If not set, StatusReasonInvalid is used in the response to the client.", "messageExpression": "messageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If both message and messageExpression are present on a validation, then messageExpression will be used if validation fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the `expression` except for 'authorizer' and 'authorizer.requestResource'. Example: \"object.x must be less than max (\"+string(params.max)+\")\"", } @@ -389,8 +389,8 @@ func (Validation) SwaggerDoc() map[string]string { var map_Variable = map[string]string{ "": "Variable is the definition of a variable that is used for composition. A variable is defined as a named expression.", - "name": "Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`", - "expression": "Expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.", + "name": "name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. The variable can be accessed in other expressions through `variables` For example, if name is \"foo\", the variable will be available as `variables.foo`", + "expression": "expression is the expression that will be evaluated as the value of the variable. The CEL expression has access to the same identifiers as the CEL expressions in Validation.", } func (Variable) SwaggerDoc() map[string]string { @@ -399,9 +399,9 @@ func (Variable) SwaggerDoc() map[string]string { var map_WebhookClientConfig = map[string]string{ "": "WebhookClientConfig contains the information to make a TLS connection with the webhook", - "url": "`url` gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.", - "service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.", - "caBundle": "`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.", + "url": "url gives the location of the webhook, in standard URL form (`scheme://host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.", + "service": "service is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.", + "caBundle": "caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. If unspecified, system trust roots on the apiserver are used.", } func (WebhookClientConfig) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.prerelease-lifecycle.go index 4fc0596b34..80064734ee 100644 --- a/vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.prerelease-lifecycle.go @@ -37,6 +37,12 @@ func (in *MutatingAdmissionPolicy) APILifecycleDeprecated() (major, minor int) { return 1, 37 } +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *MutatingAdmissionPolicy) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1", Kind: "MutatingAdmissionPolicy"} +} + // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *MutatingAdmissionPolicy) APILifecycleRemoved() (major, minor int) { @@ -55,6 +61,12 @@ func (in *MutatingAdmissionPolicyBinding) APILifecycleDeprecated() (major, minor return 1, 37 } +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *MutatingAdmissionPolicyBinding) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1", Kind: "MutatingAdmissionPolicyBinding"} +} + // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *MutatingAdmissionPolicyBinding) APILifecycleRemoved() (major, minor int) { @@ -73,6 +85,12 @@ func (in *MutatingAdmissionPolicyBindingList) APILifecycleDeprecated() (major, m return 1, 37 } +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *MutatingAdmissionPolicyBindingList) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1", Kind: "MutatingAdmissionPolicyBindingList"} +} + // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *MutatingAdmissionPolicyBindingList) APILifecycleRemoved() (major, minor int) { @@ -91,6 +109,12 @@ func (in *MutatingAdmissionPolicyList) APILifecycleDeprecated() (major, minor in return 1, 37 } +// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. +// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. +func (in *MutatingAdmissionPolicyList) APILifecycleReplacement() schema.GroupVersionKind { + return schema.GroupVersionKind{Group: "admissionregistration.k8s.io", Version: "v1", Kind: "MutatingAdmissionPolicyList"} +} + // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *MutatingAdmissionPolicyList) APILifecycleRemoved() (major, minor int) { diff --git a/vendor/k8s.io/api/apidiscovery/v2/generated.proto b/vendor/k8s.io/api/apidiscovery/v2/generated.proto index 62f2d7f2c1..7f58048e17 100644 --- a/vendor/k8s.io/api/apidiscovery/v2/generated.proto +++ b/vendor/k8s.io/api/apidiscovery/v2/generated.proto @@ -32,7 +32,7 @@ option go_package = "k8s.io/api/apidiscovery/v2"; // It contains a list of APIVersionDiscovery that holds a list of APIResourceDiscovery types served for a version. // Versions are in descending order of preference, with the first version being the preferred entry. message APIGroupDiscovery { - // Standard object's metadata. + // metadata is standard object's metadata. // The only field completed will be name. For instance, resourceVersion will be empty. // name is the name of the API group whose discovery information is presented here. // name is allowed to be "" to represent the legacy, ungroupified resources. diff --git a/vendor/k8s.io/api/apidiscovery/v2/generated.protomessage.pb.go b/vendor/k8s.io/api/apidiscovery/v2/generated.protomessage.pb.go deleted file mode 100644 index 35fe0d2a8a..0000000000 --- a/vendor/k8s.io/api/apidiscovery/v2/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v2 - -func (*APIGroupDiscovery) ProtoMessage() {} - -func (*APIGroupDiscoveryList) ProtoMessage() {} - -func (*APIResourceDiscovery) ProtoMessage() {} - -func (*APISubresourceDiscovery) ProtoMessage() {} - -func (*APIVersionDiscovery) ProtoMessage() {} diff --git a/vendor/k8s.io/api/apidiscovery/v2/types.go b/vendor/k8s.io/api/apidiscovery/v2/types.go index 449679b61d..761bb6990b 100644 --- a/vendor/k8s.io/api/apidiscovery/v2/types.go +++ b/vendor/k8s.io/api/apidiscovery/v2/types.go @@ -45,7 +45,7 @@ type APIGroupDiscoveryList struct { // Versions are in descending order of preference, with the first version being the preferred entry. type APIGroupDiscovery struct { v1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is standard object's metadata. // The only field completed will be name. For instance, resourceVersion will be empty. // name is the name of the API group whose discovery information is presented here. // name is allowed to be "" to represent the legacy, ungroupified resources. diff --git a/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto b/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto index e9ae88072a..f81449e6a9 100644 --- a/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto +++ b/vendor/k8s.io/api/apidiscovery/v2beta1/generated.proto @@ -32,7 +32,7 @@ option go_package = "k8s.io/api/apidiscovery/v2beta1"; // It contains a list of APIVersionDiscovery that holds a list of APIResourceDiscovery types served for a version. // Versions are in descending order of preference, with the first version being the preferred entry. message APIGroupDiscovery { - // Standard object's metadata. + // metadata is standard object's metadata. // The only field completed will be name. For instance, resourceVersion will be empty. // name is the name of the API group whose discovery information is presented here. // name is allowed to be "" to represent the legacy, ungroupified resources. diff --git a/vendor/k8s.io/api/apidiscovery/v2beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/apidiscovery/v2beta1/generated.protomessage.pb.go deleted file mode 100644 index 0998c461bb..0000000000 --- a/vendor/k8s.io/api/apidiscovery/v2beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v2beta1 - -func (*APIGroupDiscovery) ProtoMessage() {} - -func (*APIGroupDiscoveryList) ProtoMessage() {} - -func (*APIResourceDiscovery) ProtoMessage() {} - -func (*APISubresourceDiscovery) ProtoMessage() {} - -func (*APIVersionDiscovery) ProtoMessage() {} diff --git a/vendor/k8s.io/api/apidiscovery/v2beta1/types.go b/vendor/k8s.io/api/apidiscovery/v2beta1/types.go index 8342937730..306264da4d 100644 --- a/vendor/k8s.io/api/apidiscovery/v2beta1/types.go +++ b/vendor/k8s.io/api/apidiscovery/v2beta1/types.go @@ -51,7 +51,7 @@ type APIGroupDiscoveryList struct { // Versions are in descending order of preference, with the first version being the preferred entry. type APIGroupDiscovery struct { v1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is standard object's metadata. // The only field completed will be name. For instance, resourceVersion will be empty. // name is the name of the API group whose discovery information is presented here. // name is allowed to be "" to represent the legacy, ungroupified resources. diff --git a/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto b/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto index 8a77860720..e8f8c339df 100644 --- a/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto @@ -31,59 +31,69 @@ option go_package = "k8s.io/api/apiserverinternal/v1alpha1"; // An API server instance reports the version it can decode and the version it // encodes objects to when persisting objects in the backend. message ServerStorageVersion { - // The ID of the reporting API server. + // apiServerID is the ID of the reporting API server. + // +required optional string apiServerID = 1; - // The API server encodes the object to this version when persisting it in + // encodingVersion the API server encodes the object to when persisting it in // the backend (e.g., etcd). + // +required optional string encodingVersion = 2; + // decodableVersions are the encoding versions the API server can handle to decode. // The API server can decode objects encoded in these versions. // The encodingVersion must be included in the decodableVersions. // +listType=set + // +required repeated string decodableVersions = 3; - // The API server can serve these versions. + // servedVersions lists all versions the API server can serve. // DecodableVersions must include all ServedVersions. // +listType=set + // +optional repeated string servedVersions = 4; } // Storage version of a specific resource. message StorageVersion { + // metadata is the standard object metadata. // The name is .. + // +required optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec is an empty spec. It is here to comply with Kubernetes API style. + // spec is an empty spec. It is here to comply with Kubernetes API style. + // +optional optional StorageVersionSpec spec = 2; - // API server instances report the version they can decode and the version they + // status on the version the API server instance can decode from and // encode objects to when persisting objects in the backend. + // +optional optional StorageVersionStatus status = 3; } // Describes the state of the storageVersion at a certain point. message StorageVersionCondition { - // Type of the condition. + // type of the condition. // +required optional string type = 1; - // Status of the condition, one of True, False, Unknown. + // status of the condition, one of True, False, Unknown. // +required optional string status = 2; - // If set, this represents the .metadata.generation that the condition was set based upon. + // observedGeneration represents the .metadata.generation that the condition was set based upon, if field is set. // +optional optional int64 observedGeneration = 3; - // Last time the condition transitioned from one status to another. + // lastTransitionTime is the last time the condition transitioned from one status to another. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 4; - // The reason for the condition's last transition. + // reason for the condition's last transition. // +required optional string reason = 5; - // A human readable message indicating details about the transition. + // message is a human readable string indicating details about the transition. // +required optional string message = 6; } @@ -106,20 +116,21 @@ message StorageVersionSpec { // API server instances report the versions they can decode and the version they // encode objects to when persisting objects in the backend. message StorageVersionStatus { - // The reported versions per API server instance. + // storageVersions lists the reported versions per API server instance. // +optional // +listType=map // +listMapKey=apiServerID repeated ServerStorageVersion storageVersions = 1; - // If all API server instances agree on the same encoding storage version, - // then this field is set to that version. Otherwise this field is left empty. + // commonEncodingVersion is set to an encoding storage version if all API server + // instances share that same version. If they don't share one storage version, this + // field is left empty. // API servers should finish updating its storageVersionStatus entry before // serving write operations, so that this field will be in sync with the reality. // +optional optional string commonEncodingVersion = 2; - // The latest available observations of the storageVersion's state. + // conditions lists the latest available observations of the storageVersion's state. // +optional // +listType=map // +listMapKey=type diff --git a/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index b0839952b2..0000000000 --- a/vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,34 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*ServerStorageVersion) ProtoMessage() {} - -func (*StorageVersion) ProtoMessage() {} - -func (*StorageVersionCondition) ProtoMessage() {} - -func (*StorageVersionList) ProtoMessage() {} - -func (*StorageVersionSpec) ProtoMessage() {} - -func (*StorageVersionStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go b/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go index 31a419abf1..69c21fd3c4 100644 --- a/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go +++ b/vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go @@ -27,14 +27,18 @@ import ( // Storage version of a specific resource. type StorageVersion struct { metav1.TypeMeta `json:",inline"` + // metadata is the standard object metadata. // The name is .. + // +required metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec is an empty spec. It is here to comply with Kubernetes API style. + // spec is an empty spec. It is here to comply with Kubernetes API style. + // +optional Spec StorageVersionSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // API server instances report the version they can decode and the version they + // status on the version the API server instance can decode from and // encode objects to when persisting objects in the backend. + // +optional Status StorageVersionStatus `json:"status" protobuf:"bytes,3,opt,name=status"` } @@ -44,19 +48,20 @@ type StorageVersionSpec struct{} // API server instances report the versions they can decode and the version they // encode objects to when persisting objects in the backend. type StorageVersionStatus struct { - // The reported versions per API server instance. + // storageVersions lists the reported versions per API server instance. // +optional // +listType=map // +listMapKey=apiServerID StorageVersions []ServerStorageVersion `json:"storageVersions,omitempty" protobuf:"bytes,1,opt,name=storageVersions"` - // If all API server instances agree on the same encoding storage version, - // then this field is set to that version. Otherwise this field is left empty. + // commonEncodingVersion is set to an encoding storage version if all API server + // instances share that same version. If they don't share one storage version, this + // field is left empty. // API servers should finish updating its storageVersionStatus entry before // serving write operations, so that this field will be in sync with the reality. // +optional CommonEncodingVersion *string `json:"commonEncodingVersion,omitempty" protobuf:"bytes,2,opt,name=commonEncodingVersion"` - // The latest available observations of the storageVersion's state. + // conditions lists the latest available observations of the storageVersion's state. // +optional // +listType=map // +listMapKey=type @@ -66,21 +71,26 @@ type StorageVersionStatus struct { // An API server instance reports the version it can decode and the version it // encodes objects to when persisting objects in the backend. type ServerStorageVersion struct { - // The ID of the reporting API server. + // apiServerID is the ID of the reporting API server. + // +required APIServerID string `json:"apiServerID,omitempty" protobuf:"bytes,1,opt,name=apiServerID"` - // The API server encodes the object to this version when persisting it in + // encodingVersion the API server encodes the object to when persisting it in // the backend (e.g., etcd). + // +required EncodingVersion string `json:"encodingVersion,omitempty" protobuf:"bytes,2,opt,name=encodingVersion"` + // decodableVersions are the encoding versions the API server can handle to decode. // The API server can decode objects encoded in these versions. // The encodingVersion must be included in the decodableVersions. // +listType=set + // +required DecodableVersions []string `json:"decodableVersions,omitempty" protobuf:"bytes,3,opt,name=decodableVersions"` - // The API server can serve these versions. + // servedVersions lists all versions the API server can serve. // DecodableVersions must include all ServedVersions. // +listType=set + // +optional ServedVersions []string `json:"servedVersions,omitempty" protobuf:"bytes,4,opt,name=servedVersions"` } @@ -101,21 +111,22 @@ const ( // Describes the state of the storageVersion at a certain point. type StorageVersionCondition struct { - // Type of the condition. + // type of the condition. // +required Type StorageVersionConditionType `json:"type" protobuf:"bytes,1,opt,name=type"` - // Status of the condition, one of True, False, Unknown. + // status of the condition, one of True, False, Unknown. // +required Status ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"` - // If set, this represents the .metadata.generation that the condition was set based upon. + // observedGeneration represents the .metadata.generation that the condition was set based upon, if field is set. // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"` - // Last time the condition transitioned from one status to another. + // lastTransitionTime is the last time the condition transitioned from one status to another. + // +optional LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"` - // The reason for the condition's last transition. + // reason for the condition's last transition. // +required Reason string `json:"reason" protobuf:"bytes,5,opt,name=reason"` - // A human readable message indicating details about the transition. + // message is a human readable string indicating details about the transition. // +required Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` } diff --git a/vendor/k8s.io/api/apiserverinternal/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/apiserverinternal/v1alpha1/types_swagger_doc_generated.go index 6fd1c3ebe8..b74035e500 100644 --- a/vendor/k8s.io/api/apiserverinternal/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/apiserverinternal/v1alpha1/types_swagger_doc_generated.go @@ -29,10 +29,10 @@ package v1alpha1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_ServerStorageVersion = map[string]string{ "": "An API server instance reports the version it can decode and the version it encodes objects to when persisting objects in the backend.", - "apiServerID": "The ID of the reporting API server.", - "encodingVersion": "The API server encodes the object to this version when persisting it in the backend (e.g., etcd).", - "decodableVersions": "The API server can decode objects encoded in these versions. The encodingVersion must be included in the decodableVersions.", - "servedVersions": "The API server can serve these versions. DecodableVersions must include all ServedVersions.", + "apiServerID": "apiServerID is the ID of the reporting API server.", + "encodingVersion": "encodingVersion the API server encodes the object to when persisting it in the backend (e.g., etcd).", + "decodableVersions": "decodableVersions are the encoding versions the API server can handle to decode. The API server can decode objects encoded in these versions. The encodingVersion must be included in the decodableVersions.", + "servedVersions": "servedVersions lists all versions the API server can serve. DecodableVersions must include all ServedVersions.", } func (ServerStorageVersion) SwaggerDoc() map[string]string { @@ -41,9 +41,9 @@ func (ServerStorageVersion) SwaggerDoc() map[string]string { var map_StorageVersion = map[string]string{ "": "Storage version of a specific resource.", - "metadata": "The name is ..", - "spec": "Spec is an empty spec. It is here to comply with Kubernetes API style.", - "status": "API server instances report the version they can decode and the version they encode objects to when persisting objects in the backend.", + "metadata": "metadata is the standard object metadata. The name is ..", + "spec": "spec is an empty spec. It is here to comply with Kubernetes API style.", + "status": "status on the version the API server instance can decode from and encode objects to when persisting objects in the backend.", } func (StorageVersion) SwaggerDoc() map[string]string { @@ -52,12 +52,12 @@ func (StorageVersion) SwaggerDoc() map[string]string { var map_StorageVersionCondition = map[string]string{ "": "Describes the state of the storageVersion at a certain point.", - "type": "Type of the condition.", - "status": "Status of the condition, one of True, False, Unknown.", - "observedGeneration": "If set, this represents the .metadata.generation that the condition was set based upon.", - "lastTransitionTime": "Last time the condition transitioned from one status to another.", - "reason": "The reason for the condition's last transition.", - "message": "A human readable message indicating details about the transition.", + "type": "type of the condition.", + "status": "status of the condition, one of True, False, Unknown.", + "observedGeneration": "observedGeneration represents the .metadata.generation that the condition was set based upon, if field is set.", + "lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another.", + "reason": "reason for the condition's last transition.", + "message": "message is a human readable string indicating details about the transition.", } func (StorageVersionCondition) SwaggerDoc() map[string]string { @@ -84,9 +84,9 @@ func (StorageVersionSpec) SwaggerDoc() map[string]string { var map_StorageVersionStatus = map[string]string{ "": "API server instances report the versions they can decode and the version they encode objects to when persisting objects in the backend.", - "storageVersions": "The reported versions per API server instance.", - "commonEncodingVersion": "If all API server instances agree on the same encoding storage version, then this field is set to that version. Otherwise this field is left empty. API servers should finish updating its storageVersionStatus entry before serving write operations, so that this field will be in sync with the reality.", - "conditions": "The latest available observations of the storageVersion's state.", + "storageVersions": "storageVersions lists the reported versions per API server instance.", + "commonEncodingVersion": "commonEncodingVersion is set to an encoding storage version if all API server instances share that same version. If they don't share one storage version, this field is left empty. API servers should finish updating its storageVersionStatus entry before serving write operations, so that this field will be in sync with the reality.", + "conditions": "conditions lists the latest available observations of the storageVersion's state.", } func (StorageVersionStatus) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/apps/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/apps/v1/generated.protomessage.pb.go deleted file mode 100644 index f9faa4e13a..0000000000 --- a/vendor/k8s.io/api/apps/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,82 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*ControllerRevision) ProtoMessage() {} - -func (*ControllerRevisionList) ProtoMessage() {} - -func (*DaemonSet) ProtoMessage() {} - -func (*DaemonSetCondition) ProtoMessage() {} - -func (*DaemonSetList) ProtoMessage() {} - -func (*DaemonSetSpec) ProtoMessage() {} - -func (*DaemonSetStatus) ProtoMessage() {} - -func (*DaemonSetUpdateStrategy) ProtoMessage() {} - -func (*Deployment) ProtoMessage() {} - -func (*DeploymentCondition) ProtoMessage() {} - -func (*DeploymentList) ProtoMessage() {} - -func (*DeploymentSpec) ProtoMessage() {} - -func (*DeploymentStatus) ProtoMessage() {} - -func (*DeploymentStrategy) ProtoMessage() {} - -func (*ReplicaSet) ProtoMessage() {} - -func (*ReplicaSetCondition) ProtoMessage() {} - -func (*ReplicaSetList) ProtoMessage() {} - -func (*ReplicaSetSpec) ProtoMessage() {} - -func (*ReplicaSetStatus) ProtoMessage() {} - -func (*RollingUpdateDaemonSet) ProtoMessage() {} - -func (*RollingUpdateDeployment) ProtoMessage() {} - -func (*RollingUpdateStatefulSetStrategy) ProtoMessage() {} - -func (*StatefulSet) ProtoMessage() {} - -func (*StatefulSetCondition) ProtoMessage() {} - -func (*StatefulSetList) ProtoMessage() {} - -func (*StatefulSetOrdinals) ProtoMessage() {} - -func (*StatefulSetPersistentVolumeClaimRetentionPolicy) ProtoMessage() {} - -func (*StatefulSetSpec) ProtoMessage() {} - -func (*StatefulSetStatus) ProtoMessage() {} - -func (*StatefulSetUpdateStrategy) ProtoMessage() {} diff --git a/vendor/k8s.io/api/apps/v1beta1/generated.proto b/vendor/k8s.io/api/apps/v1beta1/generated.proto index b47d61e209..c6f0628e0c 100644 --- a/vendor/k8s.io/api/apps/v1beta1/generated.proto +++ b/vendor/k8s.io/api/apps/v1beta1/generated.proto @@ -318,9 +318,9 @@ message Scale { message ScaleSpec { // replicas is the number of observed instances of the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 optional int32 replicas = 1; } diff --git a/vendor/k8s.io/api/apps/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/apps/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 3127ea3cae..0000000000 --- a/vendor/k8s.io/api/apps/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*ControllerRevision) ProtoMessage() {} - -func (*ControllerRevisionList) ProtoMessage() {} - -func (*Deployment) ProtoMessage() {} - -func (*DeploymentCondition) ProtoMessage() {} - -func (*DeploymentList) ProtoMessage() {} - -func (*DeploymentRollback) ProtoMessage() {} - -func (*DeploymentSpec) ProtoMessage() {} - -func (*DeploymentStatus) ProtoMessage() {} - -func (*DeploymentStrategy) ProtoMessage() {} - -func (*RollbackConfig) ProtoMessage() {} - -func (*RollingUpdateDeployment) ProtoMessage() {} - -func (*RollingUpdateStatefulSetStrategy) ProtoMessage() {} - -func (*Scale) ProtoMessage() {} - -func (*ScaleSpec) ProtoMessage() {} - -func (*ScaleStatus) ProtoMessage() {} - -func (*StatefulSet) ProtoMessage() {} - -func (*StatefulSetCondition) ProtoMessage() {} - -func (*StatefulSetList) ProtoMessage() {} - -func (*StatefulSetOrdinals) ProtoMessage() {} - -func (*StatefulSetPersistentVolumeClaimRetentionPolicy) ProtoMessage() {} - -func (*StatefulSetSpec) ProtoMessage() {} - -func (*StatefulSetStatus) ProtoMessage() {} - -func (*StatefulSetUpdateStrategy) ProtoMessage() {} diff --git a/vendor/k8s.io/api/apps/v1beta1/types.go b/vendor/k8s.io/api/apps/v1beta1/types.go index b1e6b33683..4e67338e36 100644 --- a/vendor/k8s.io/api/apps/v1beta1/types.go +++ b/vendor/k8s.io/api/apps/v1beta1/types.go @@ -33,9 +33,9 @@ const ( type ScaleSpec struct { // replicas is the number of observed instances of the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } @@ -63,7 +63,7 @@ type ScaleStatus struct { // +k8s:prerelease-lifecycle-gen:deprecated=1.8 // +k8s:prerelease-lifecycle-gen:removed=1.16 // +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v1,Scale -// +k8s:isSubresource=/scale +// +k8s:isSubresource="/scale" // Scale represents a scaling request for a resource. type Scale struct { diff --git a/vendor/k8s.io/api/apps/v1beta2/generated.proto b/vendor/k8s.io/api/apps/v1beta2/generated.proto index 1cdd0a43f7..d680c9663e 100644 --- a/vendor/k8s.io/api/apps/v1beta2/generated.proto +++ b/vendor/k8s.io/api/apps/v1beta2/generated.proto @@ -616,9 +616,9 @@ message Scale { message ScaleSpec { // desired number of instances for the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 optional int32 replicas = 1; } diff --git a/vendor/k8s.io/api/apps/v1beta2/generated.protomessage.pb.go b/vendor/k8s.io/api/apps/v1beta2/generated.protomessage.pb.go deleted file mode 100644 index 18582bf290..0000000000 --- a/vendor/k8s.io/api/apps/v1beta2/generated.protomessage.pb.go +++ /dev/null @@ -1,88 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta2 - -func (*ControllerRevision) ProtoMessage() {} - -func (*ControllerRevisionList) ProtoMessage() {} - -func (*DaemonSet) ProtoMessage() {} - -func (*DaemonSetCondition) ProtoMessage() {} - -func (*DaemonSetList) ProtoMessage() {} - -func (*DaemonSetSpec) ProtoMessage() {} - -func (*DaemonSetStatus) ProtoMessage() {} - -func (*DaemonSetUpdateStrategy) ProtoMessage() {} - -func (*Deployment) ProtoMessage() {} - -func (*DeploymentCondition) ProtoMessage() {} - -func (*DeploymentList) ProtoMessage() {} - -func (*DeploymentSpec) ProtoMessage() {} - -func (*DeploymentStatus) ProtoMessage() {} - -func (*DeploymentStrategy) ProtoMessage() {} - -func (*ReplicaSet) ProtoMessage() {} - -func (*ReplicaSetCondition) ProtoMessage() {} - -func (*ReplicaSetList) ProtoMessage() {} - -func (*ReplicaSetSpec) ProtoMessage() {} - -func (*ReplicaSetStatus) ProtoMessage() {} - -func (*RollingUpdateDaemonSet) ProtoMessage() {} - -func (*RollingUpdateDeployment) ProtoMessage() {} - -func (*RollingUpdateStatefulSetStrategy) ProtoMessage() {} - -func (*Scale) ProtoMessage() {} - -func (*ScaleSpec) ProtoMessage() {} - -func (*ScaleStatus) ProtoMessage() {} - -func (*StatefulSet) ProtoMessage() {} - -func (*StatefulSetCondition) ProtoMessage() {} - -func (*StatefulSetList) ProtoMessage() {} - -func (*StatefulSetOrdinals) ProtoMessage() {} - -func (*StatefulSetPersistentVolumeClaimRetentionPolicy) ProtoMessage() {} - -func (*StatefulSetSpec) ProtoMessage() {} - -func (*StatefulSetStatus) ProtoMessage() {} - -func (*StatefulSetUpdateStrategy) ProtoMessage() {} diff --git a/vendor/k8s.io/api/apps/v1beta2/types.go b/vendor/k8s.io/api/apps/v1beta2/types.go index 18c74a4aa6..d4d4a7e0dc 100644 --- a/vendor/k8s.io/api/apps/v1beta2/types.go +++ b/vendor/k8s.io/api/apps/v1beta2/types.go @@ -35,9 +35,9 @@ const ( type ScaleSpec struct { // desired number of instances for the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } @@ -66,7 +66,7 @@ type ScaleStatus struct { // +k8s:prerelease-lifecycle-gen:deprecated=1.9 // +k8s:prerelease-lifecycle-gen:removed=1.16 // +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v1,Scale -// +k8s:isSubresource=/scale +// +k8s:isSubresource="/scale" // Scale represents a scaling request for a resource. type Scale struct { diff --git a/vendor/k8s.io/api/authentication/v1/generated.proto b/vendor/k8s.io/api/authentication/v1/generated.proto index ae9763576c..82ff7c3c51 100644 --- a/vendor/k8s.io/api/authentication/v1/generated.proto +++ b/vendor/k8s.io/api/authentication/v1/generated.proto @@ -30,19 +30,19 @@ option go_package = "k8s.io/api/authentication/v1"; // BoundObjectReference is a reference to an object that a token is bound to. message BoundObjectReference { - // Kind of the referent. Valid kinds are 'Pod' and 'Secret'. + // kind of the referent. Valid kinds are 'Pod' and 'Secret'. // +optional optional string kind = 1; - // API version of the referent. + // apiVersion is API version of the referent. // +optional optional string apiVersion = 2; - // Name of the referent. + // name of the referent. // +optional optional string name = 3; - // UID of the referent. + // uid of the referent. // +optional optional string uID = 4; } @@ -60,55 +60,58 @@ message ExtraValue { // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. message SelfSubjectReview { - // Standard object's metadata. + // metadata is standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Status is filled in by the server with the user attributes. + // status is filled in by the server with the user attributes. + // +optional optional SelfSubjectReviewStatus status = 2; } // SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. message SelfSubjectReviewStatus { - // User attributes of the user making this request. + // userInfo is a set of attributes belonging to the user making this request. // +optional optional UserInfo userInfo = 1; } // TokenRequest requests a token for a given service account. message TokenRequest { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated + // +optional optional TokenRequestSpec spec = 2; - // Status is filled in by the server and indicates whether the token can be authenticated. + // status is filled in by the server and indicates whether the token can be authenticated. // +optional optional TokenRequestStatus status = 3; } // TokenRequestSpec contains client provided parameters of a token request. message TokenRequestSpec { - // Audiences are the intendend audiences of the token. A recipient of a + // audiences are the intendend audiences of the token. A recipient of a // token must identify themself with an identifier in the list of // audiences of the token, and otherwise should reject the token. A // token issued for multiple audiences may be used to authenticate // against any of the audiences listed but implies a high degree of // trust between the target audiences. + // +optional // +listType=atomic repeated string audiences = 1; - // ExpirationSeconds is the requested duration of validity of the request. The + // expirationSeconds is the requested duration of validity of the request. The // token issuer may return a token with a different validity duration so a // client needs to check the 'expiration' field in a response. // +optional optional int64 expirationSeconds = 4; - // BoundObjectRef is a reference to an object that the token will be bound to. + // boundObjectRef is a reference to an object that the token will be bound to. // The token will only be valid for as long as the bound object exists. // NOTE: The API server's TokenReview endpoint will validate the // BoundObjectRef, but other audiences may not. Keep ExpirationSeconds @@ -119,10 +122,12 @@ message TokenRequestSpec { // TokenRequestStatus is the result of a token request. message TokenRequestStatus { - // Token is the opaque bearer token. + // token is the opaque bearer token. + // +optional optional string token = 1; - // ExpirationTimestamp is the time of expiration of the returned token. + // expirationTimestamp is the time of expiration of the returned token. + // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time expirationTimestamp = 2; } @@ -130,26 +135,27 @@ message TokenRequestStatus { // Note: TokenReview requests may be cached by the webhook token authenticator // plugin in the kube-apiserver. message TokenReview { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated + // +required optional TokenReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the request can be authenticated. + // status is filled in by the server and indicates whether the request can be authenticated. // +optional optional TokenReviewStatus status = 3; } // TokenReviewSpec is a description of the token authentication request. message TokenReviewSpec { - // Token is the opaque bearer token. - // +optional + // token is the opaque bearer token. + // +required optional string token = 1; - // Audiences is a list of the identifiers that the resource server presented + // audiences is a list of the identifiers that the resource server presented // with the token identifies as. Audience-aware token authenticators will // verify that the token was intended for at least one of the audiences in // this list. If no audiences are provided, the audience will default to the @@ -161,15 +167,15 @@ message TokenReviewSpec { // TokenReviewStatus is the result of the token authentication request. message TokenReviewStatus { - // Authenticated indicates that the token was associated with a known user. + // authenticated indicates that the token was associated with a known user. // +optional optional bool authenticated = 1; - // User is the UserInfo associated with the provided token. + // user is the UserInfo associated with the provided token. // +optional optional UserInfo user = 2; - // Audiences are audience identifiers chosen by the authenticator that are + // audiences are audience identifiers chosen by the authenticator that are // compatible with both the TokenReview and token. An identifier is any // identifier in the intersection of the TokenReviewSpec audiences and the // token's audiences. A client of the TokenReview API that sets the @@ -182,7 +188,7 @@ message TokenReviewStatus { // +listType=atomic repeated string audiences = 4; - // Error indicates that the token couldn't be checked + // error indicates that the token couldn't be checked // +optional optional string error = 3; } @@ -190,22 +196,22 @@ message TokenReviewStatus { // UserInfo holds the information about the user needed to implement the // user.Info interface. message UserInfo { - // The name that uniquely identifies this user among all active users. + // username is the name that uniquely identifies this user among all active users. // +optional optional string username = 1; - // A unique value that identifies this user across time. If this user is + // uid is a unique value that identifies this user across time. If this user is // deleted and another user by the same name is added, they will have // different UIDs. // +optional optional string uid = 2; - // The names of groups this user is a part of. + // groups is the names of groups this user is a part of. // +optional // +listType=atomic repeated string groups = 3; - // Any additional information provided by the authenticator. + // extra is any additional information provided by the authenticator. // +optional map extra = 4; } diff --git a/vendor/k8s.io/api/authentication/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/authentication/v1/generated.protomessage.pb.go deleted file mode 100644 index 7003a80843..0000000000 --- a/vendor/k8s.io/api/authentication/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,44 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*BoundObjectReference) ProtoMessage() {} - -func (*ExtraValue) ProtoMessage() {} - -func (*SelfSubjectReview) ProtoMessage() {} - -func (*SelfSubjectReviewStatus) ProtoMessage() {} - -func (*TokenRequest) ProtoMessage() {} - -func (*TokenRequestSpec) ProtoMessage() {} - -func (*TokenRequestStatus) ProtoMessage() {} - -func (*TokenReview) ProtoMessage() {} - -func (*TokenReviewSpec) ProtoMessage() {} - -func (*TokenReviewStatus) ProtoMessage() {} - -func (*UserInfo) ProtoMessage() {} diff --git a/vendor/k8s.io/api/authentication/v1/types.go b/vendor/k8s.io/api/authentication/v1/types.go index 2dc0707c4f..c28bded50a 100644 --- a/vendor/k8s.io/api/authentication/v1/types.go +++ b/vendor/k8s.io/api/authentication/v1/types.go @@ -52,25 +52,26 @@ const ( // plugin in the kube-apiserver. type TokenReview struct { metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated + // +required Spec TokenReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the request can be authenticated. + // status is filled in by the server and indicates whether the request can be authenticated. // +optional Status TokenReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // TokenReviewSpec is a description of the token authentication request. type TokenReviewSpec struct { - // Token is the opaque bearer token. - // +optional + // token is the opaque bearer token. + // +required Token string `json:"token,omitempty" protobuf:"bytes,1,opt,name=token"` - // Audiences is a list of the identifiers that the resource server presented + // audiences is a list of the identifiers that the resource server presented // with the token identifies as. Audience-aware token authenticators will // verify that the token was intended for at least one of the audiences in // this list. If no audiences are provided, the audience will default to the @@ -82,13 +83,13 @@ type TokenReviewSpec struct { // TokenReviewStatus is the result of the token authentication request. type TokenReviewStatus struct { - // Authenticated indicates that the token was associated with a known user. + // authenticated indicates that the token was associated with a known user. // +optional Authenticated bool `json:"authenticated,omitempty" protobuf:"varint,1,opt,name=authenticated"` - // User is the UserInfo associated with the provided token. + // user is the UserInfo associated with the provided token. // +optional User UserInfo `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"` - // Audiences are audience identifiers chosen by the authenticator that are + // audiences are audience identifiers chosen by the authenticator that are // compatible with both the TokenReview and token. An identifier is any // identifier in the intersection of the TokenReviewSpec audiences and the // token's audiences. A client of the TokenReview API that sets the @@ -100,7 +101,7 @@ type TokenReviewStatus struct { // +optional // +listType=atomic Audiences []string `json:"audiences,omitempty" protobuf:"bytes,4,rep,name=audiences"` - // Error indicates that the token couldn't be checked + // error indicates that the token couldn't be checked // +optional Error string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"` } @@ -108,19 +109,19 @@ type TokenReviewStatus struct { // UserInfo holds the information about the user needed to implement the // user.Info interface. type UserInfo struct { - // The name that uniquely identifies this user among all active users. + // username is the name that uniquely identifies this user among all active users. // +optional Username string `json:"username,omitempty" protobuf:"bytes,1,opt,name=username"` - // A unique value that identifies this user across time. If this user is + // uid is a unique value that identifies this user across time. If this user is // deleted and another user by the same name is added, they will have // different UIDs. // +optional UID string `json:"uid,omitempty" protobuf:"bytes,2,opt,name=uid"` - // The names of groups this user is a part of. + // groups is the names of groups this user is a part of. // +optional // +listType=atomic Groups []string `json:"groups,omitempty" protobuf:"bytes,3,rep,name=groups"` - // Any additional information provided by the authenticator. + // extra is any additional information provided by the authenticator. // +optional Extra map[string]ExtraValue `json:"extra,omitempty" protobuf:"bytes,4,rep,name=extra"` } @@ -140,37 +141,39 @@ func (t ExtraValue) String() string { // TokenRequest requests a token for a given service account. type TokenRequest struct { metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated + // +optional Spec TokenRequestSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the token can be authenticated. + // status is filled in by the server and indicates whether the token can be authenticated. // +optional Status TokenRequestStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // TokenRequestSpec contains client provided parameters of a token request. type TokenRequestSpec struct { - // Audiences are the intendend audiences of the token. A recipient of a + // audiences are the intendend audiences of the token. A recipient of a // token must identify themself with an identifier in the list of // audiences of the token, and otherwise should reject the token. A // token issued for multiple audiences may be used to authenticate // against any of the audiences listed but implies a high degree of // trust between the target audiences. + // +optional // +listType=atomic Audiences []string `json:"audiences" protobuf:"bytes,1,rep,name=audiences"` - // ExpirationSeconds is the requested duration of validity of the request. The + // expirationSeconds is the requested duration of validity of the request. The // token issuer may return a token with a different validity duration so a // client needs to check the 'expiration' field in a response. // +optional ExpirationSeconds *int64 `json:"expirationSeconds" protobuf:"varint,4,opt,name=expirationSeconds"` - // BoundObjectRef is a reference to an object that the token will be bound to. + // boundObjectRef is a reference to an object that the token will be bound to. // The token will only be valid for as long as the bound object exists. // NOTE: The API server's TokenReview endpoint will validate the // BoundObjectRef, but other audiences may not. Keep ExpirationSeconds @@ -181,25 +184,27 @@ type TokenRequestSpec struct { // TokenRequestStatus is the result of a token request. type TokenRequestStatus struct { - // Token is the opaque bearer token. + // token is the opaque bearer token. + // +optional Token string `json:"token" protobuf:"bytes,1,opt,name=token"` - // ExpirationTimestamp is the time of expiration of the returned token. + // expirationTimestamp is the time of expiration of the returned token. + // +optional ExpirationTimestamp metav1.Time `json:"expirationTimestamp" protobuf:"bytes,2,opt,name=expirationTimestamp"` } // BoundObjectReference is a reference to an object that a token is bound to. type BoundObjectReference struct { - // Kind of the referent. Valid kinds are 'Pod' and 'Secret'. + // kind of the referent. Valid kinds are 'Pod' and 'Secret'. // +optional Kind string `json:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"` - // API version of the referent. + // apiVersion is API version of the referent. // +optional APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"` - // Name of the referent. + // name of the referent. // +optional Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"` - // UID of the referent. + // uid of the referent. // +optional UID types.UID `json:"uid,omitempty" protobuf:"bytes,4,opt,name=uID,casttype=k8s.io/apimachinery/pkg/types.UID"` } @@ -215,17 +220,18 @@ type BoundObjectReference struct { // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. type SelfSubjectReview struct { metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Status is filled in by the server with the user attributes. + // status is filled in by the server with the user attributes. + // +optional Status SelfSubjectReviewStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` } // SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. type SelfSubjectReviewStatus struct { - // User attributes of the user making this request. + // userInfo is a set of attributes belonging to the user making this request. // +optional UserInfo UserInfo `json:"userInfo,omitempty" protobuf:"bytes,1,opt,name=userInfo"` } diff --git a/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go index ebfd4852c0..ea3acbb681 100644 --- a/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go @@ -29,10 +29,10 @@ package v1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_BoundObjectReference = map[string]string{ "": "BoundObjectReference is a reference to an object that a token is bound to.", - "kind": "Kind of the referent. Valid kinds are 'Pod' and 'Secret'.", - "apiVersion": "API version of the referent.", - "name": "Name of the referent.", - "uid": "UID of the referent.", + "kind": "kind of the referent. Valid kinds are 'Pod' and 'Secret'.", + "apiVersion": "apiVersion is API version of the referent.", + "name": "name of the referent.", + "uid": "uid of the referent.", } func (BoundObjectReference) SwaggerDoc() map[string]string { @@ -41,8 +41,8 @@ func (BoundObjectReference) SwaggerDoc() map[string]string { var map_SelfSubjectReview = map[string]string{ "": "SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "status": "Status is filled in by the server with the user attributes.", + "metadata": "metadata is standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "status": "status is filled in by the server with the user attributes.", } func (SelfSubjectReview) SwaggerDoc() map[string]string { @@ -51,7 +51,7 @@ func (SelfSubjectReview) SwaggerDoc() map[string]string { var map_SelfSubjectReviewStatus = map[string]string{ "": "SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user.", - "userInfo": "User attributes of the user making this request.", + "userInfo": "userInfo is a set of attributes belonging to the user making this request.", } func (SelfSubjectReviewStatus) SwaggerDoc() map[string]string { @@ -60,9 +60,9 @@ func (SelfSubjectReviewStatus) SwaggerDoc() map[string]string { var map_TokenRequest = map[string]string{ "": "TokenRequest requests a token for a given service account.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated", - "status": "Status is filled in by the server and indicates whether the token can be authenticated.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated", + "status": "status is filled in by the server and indicates whether the token can be authenticated.", } func (TokenRequest) SwaggerDoc() map[string]string { @@ -71,9 +71,9 @@ func (TokenRequest) SwaggerDoc() map[string]string { var map_TokenRequestSpec = map[string]string{ "": "TokenRequestSpec contains client provided parameters of a token request.", - "audiences": "Audiences are the intendend audiences of the token. A recipient of a token must identify themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences.", - "expirationSeconds": "ExpirationSeconds is the requested duration of validity of the request. The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response.", - "boundObjectRef": "BoundObjectRef is a reference to an object that the token will be bound to. The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation.", + "audiences": "audiences are the intendend audiences of the token. A recipient of a token must identify themself with an identifier in the list of audiences of the token, and otherwise should reject the token. A token issued for multiple audiences may be used to authenticate against any of the audiences listed but implies a high degree of trust between the target audiences.", + "expirationSeconds": "expirationSeconds is the requested duration of validity of the request. The token issuer may return a token with a different validity duration so a client needs to check the 'expiration' field in a response.", + "boundObjectRef": "boundObjectRef is a reference to an object that the token will be bound to. The token will only be valid for as long as the bound object exists. NOTE: The API server's TokenReview endpoint will validate the BoundObjectRef, but other audiences may not. Keep ExpirationSeconds small if you want prompt revocation.", } func (TokenRequestSpec) SwaggerDoc() map[string]string { @@ -82,8 +82,8 @@ func (TokenRequestSpec) SwaggerDoc() map[string]string { var map_TokenRequestStatus = map[string]string{ "": "TokenRequestStatus is the result of a token request.", - "token": "Token is the opaque bearer token.", - "expirationTimestamp": "ExpirationTimestamp is the time of expiration of the returned token.", + "token": "token is the opaque bearer token.", + "expirationTimestamp": "expirationTimestamp is the time of expiration of the returned token.", } func (TokenRequestStatus) SwaggerDoc() map[string]string { @@ -92,9 +92,9 @@ func (TokenRequestStatus) SwaggerDoc() map[string]string { var map_TokenReview = map[string]string{ "": "TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated", - "status": "Status is filled in by the server and indicates whether the request can be authenticated.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated", + "status": "status is filled in by the server and indicates whether the request can be authenticated.", } func (TokenReview) SwaggerDoc() map[string]string { @@ -103,8 +103,8 @@ func (TokenReview) SwaggerDoc() map[string]string { var map_TokenReviewSpec = map[string]string{ "": "TokenReviewSpec is a description of the token authentication request.", - "token": "Token is the opaque bearer token.", - "audiences": "Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.", + "token": "token is the opaque bearer token.", + "audiences": "audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.", } func (TokenReviewSpec) SwaggerDoc() map[string]string { @@ -113,10 +113,10 @@ func (TokenReviewSpec) SwaggerDoc() map[string]string { var map_TokenReviewStatus = map[string]string{ "": "TokenReviewStatus is the result of the token authentication request.", - "authenticated": "Authenticated indicates that the token was associated with a known user.", - "user": "User is the UserInfo associated with the provided token.", - "audiences": "Audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.", - "error": "Error indicates that the token couldn't be checked", + "authenticated": "authenticated indicates that the token was associated with a known user.", + "user": "user is the UserInfo associated with the provided token.", + "audiences": "audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.", + "error": "error indicates that the token couldn't be checked", } func (TokenReviewStatus) SwaggerDoc() map[string]string { @@ -125,10 +125,10 @@ func (TokenReviewStatus) SwaggerDoc() map[string]string { var map_UserInfo = map[string]string{ "": "UserInfo holds the information about the user needed to implement the user.Info interface.", - "username": "The name that uniquely identifies this user among all active users.", - "uid": "A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.", - "groups": "The names of groups this user is a part of.", - "extra": "Any additional information provided by the authenticator.", + "username": "username is the name that uniquely identifies this user among all active users.", + "uid": "uid is a unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.", + "groups": "groups is the names of groups this user is a part of.", + "extra": "extra is any additional information provided by the authenticator.", } func (UserInfo) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/authentication/v1alpha1/generated.proto b/vendor/k8s.io/api/authentication/v1alpha1/generated.proto index 4585e5cdd3..2bf836d730 100644 --- a/vendor/k8s.io/api/authentication/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/authentication/v1alpha1/generated.proto @@ -33,18 +33,19 @@ option go_package = "k8s.io/api/authentication/v1alpha1"; // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. message SelfSubjectReview { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Status is filled in by the server with the user attributes. + // status is filled in by the server with the user attributes. + // +optional optional SelfSubjectReviewStatus status = 2; } // SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. message SelfSubjectReviewStatus { - // User attributes of the user making this request. + // userInfo is a set of attributes belonging to the user making this request. // +optional optional .k8s.io.api.authentication.v1.UserInfo userInfo = 1; } diff --git a/vendor/k8s.io/api/authentication/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/authentication/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index d0e9c4e564..0000000000 --- a/vendor/k8s.io/api/authentication/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*SelfSubjectReview) ProtoMessage() {} - -func (*SelfSubjectReviewStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/authentication/v1alpha1/types.go b/vendor/k8s.io/api/authentication/v1alpha1/types.go index 1ee3612fbc..7e02470c96 100644 --- a/vendor/k8s.io/api/authentication/v1alpha1/types.go +++ b/vendor/k8s.io/api/authentication/v1alpha1/types.go @@ -32,17 +32,18 @@ import ( // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. type SelfSubjectReview struct { metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Status is filled in by the server with the user attributes. + // status is filled in by the server with the user attributes. + // +optional Status SelfSubjectReviewStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` } // SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. type SelfSubjectReviewStatus struct { - // User attributes of the user making this request. + // userInfo is a set of attributes belonging to the user making this request. // +optional UserInfo v1.UserInfo `json:"userInfo,omitempty" protobuf:"bytes,1,opt,name=userInfo"` } diff --git a/vendor/k8s.io/api/authentication/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/authentication/v1alpha1/types_swagger_doc_generated.go index 1ffcc99e7d..95ce0287cf 100644 --- a/vendor/k8s.io/api/authentication/v1alpha1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/authentication/v1alpha1/types_swagger_doc_generated.go @@ -29,8 +29,8 @@ package v1alpha1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_SelfSubjectReview = map[string]string{ "": "SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "status": "Status is filled in by the server with the user attributes.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "status": "status is filled in by the server with the user attributes.", } func (SelfSubjectReview) SwaggerDoc() map[string]string { @@ -39,7 +39,7 @@ func (SelfSubjectReview) SwaggerDoc() map[string]string { var map_SelfSubjectReviewStatus = map[string]string{ "": "SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user.", - "userInfo": "User attributes of the user making this request.", + "userInfo": "userInfo is a set of attributes belonging to the user making this request.", } func (SelfSubjectReviewStatus) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/authentication/v1beta1/generated.proto b/vendor/k8s.io/api/authentication/v1beta1/generated.proto index d0f6fe4402..999c65156d 100644 --- a/vendor/k8s.io/api/authentication/v1beta1/generated.proto +++ b/vendor/k8s.io/api/authentication/v1beta1/generated.proto @@ -42,18 +42,19 @@ message ExtraValue { // When using impersonation, users will receive the user info of the user being impersonated. If impersonation or // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. message SelfSubjectReview { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Status is filled in by the server with the user attributes. + // status is filled in by the server with the user attributes. + // +optional optional SelfSubjectReviewStatus status = 2; } // SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. message SelfSubjectReviewStatus { - // User attributes of the user making this request. + // userInfo is a set of attributes belonging to the user making this request. // +optional optional .k8s.io.api.authentication.v1.UserInfo userInfo = 1; } @@ -62,26 +63,27 @@ message SelfSubjectReviewStatus { // Note: TokenReview requests may be cached by the webhook token authenticator // plugin in the kube-apiserver. message TokenReview { - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated + // +required optional TokenReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the token can be authenticated. + // status is filled in by the server and indicates whether the token can be authenticated. // +optional optional TokenReviewStatus status = 3; } // TokenReviewSpec is a description of the token authentication request. message TokenReviewSpec { - // Token is the opaque bearer token. - // +optional + // token is the opaque bearer token. + // +required optional string token = 1; - // Audiences is a list of the identifiers that the resource server presented + // audiences is a list of the identifiers that the resource server presented // with the token identifies as. Audience-aware token authenticators will // verify that the token was intended for at least one of the audiences in // this list. If no audiences are provided, the audience will default to the @@ -93,15 +95,15 @@ message TokenReviewSpec { // TokenReviewStatus is the result of the token authentication request. message TokenReviewStatus { - // Authenticated indicates that the token was associated with a known user. + // authenticated indicates that the token was associated with a known user. // +optional optional bool authenticated = 1; - // User is the UserInfo associated with the provided token. + // user is the UserInfo associated with the provided token. // +optional optional UserInfo user = 2; - // Audiences are audience identifiers chosen by the authenticator that are + // audiences are audience identifiers chosen by the authenticator that are // compatible with both the TokenReview and token. An identifier is any // identifier in the intersection of the TokenReviewSpec audiences and the // token's audiences. A client of the TokenReview API that sets the @@ -114,7 +116,7 @@ message TokenReviewStatus { // +listType=atomic repeated string audiences = 4; - // Error indicates that the token couldn't be checked + // error indicates that the token couldn't be checked // +optional optional string error = 3; } @@ -122,22 +124,22 @@ message TokenReviewStatus { // UserInfo holds the information about the user needed to implement the // user.Info interface. message UserInfo { - // The name that uniquely identifies this user among all active users. + // username is the name that uniquely identifies this user among all active users. // +optional optional string username = 1; - // A unique value that identifies this user across time. If this user is + // uid is a unique value that identifies this user across time. If this user is // deleted and another user by the same name is added, they will have // different UIDs. // +optional optional string uid = 2; - // The names of groups this user is a part of. + // groups is the names of groups this user is a part of. // +optional // +listType=atomic repeated string groups = 3; - // Any additional information provided by the authenticator. + // extra is any additional information provided by the authenticator. // +optional map extra = 4; } diff --git a/vendor/k8s.io/api/authentication/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/authentication/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index a55034da99..0000000000 --- a/vendor/k8s.io/api/authentication/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*ExtraValue) ProtoMessage() {} - -func (*SelfSubjectReview) ProtoMessage() {} - -func (*SelfSubjectReviewStatus) ProtoMessage() {} - -func (*TokenReview) ProtoMessage() {} - -func (*TokenReviewSpec) ProtoMessage() {} - -func (*TokenReviewStatus) ProtoMessage() {} - -func (*UserInfo) ProtoMessage() {} diff --git a/vendor/k8s.io/api/authentication/v1beta1/types.go b/vendor/k8s.io/api/authentication/v1beta1/types.go index 8038ef7d34..33dacdb723 100644 --- a/vendor/k8s.io/api/authentication/v1beta1/types.go +++ b/vendor/k8s.io/api/authentication/v1beta1/types.go @@ -36,25 +36,26 @@ import ( // plugin in the kube-apiserver. type TokenReview struct { metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated + // +required Spec TokenReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the token can be authenticated. + // status is filled in by the server and indicates whether the token can be authenticated. // +optional Status TokenReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // TokenReviewSpec is a description of the token authentication request. type TokenReviewSpec struct { - // Token is the opaque bearer token. - // +optional + // token is the opaque bearer token. + // +required Token string `json:"token,omitempty" protobuf:"bytes,1,opt,name=token"` - // Audiences is a list of the identifiers that the resource server presented + // audiences is a list of the identifiers that the resource server presented // with the token identifies as. Audience-aware token authenticators will // verify that the token was intended for at least one of the audiences in // this list. If no audiences are provided, the audience will default to the @@ -66,13 +67,13 @@ type TokenReviewSpec struct { // TokenReviewStatus is the result of the token authentication request. type TokenReviewStatus struct { - // Authenticated indicates that the token was associated with a known user. + // authenticated indicates that the token was associated with a known user. // +optional Authenticated bool `json:"authenticated,omitempty" protobuf:"varint,1,opt,name=authenticated"` - // User is the UserInfo associated with the provided token. + // user is the UserInfo associated with the provided token. // +optional User UserInfo `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"` - // Audiences are audience identifiers chosen by the authenticator that are + // audiences are audience identifiers chosen by the authenticator that are // compatible with both the TokenReview and token. An identifier is any // identifier in the intersection of the TokenReviewSpec audiences and the // token's audiences. A client of the TokenReview API that sets the @@ -84,7 +85,7 @@ type TokenReviewStatus struct { // +optional // +listType=atomic Audiences []string `json:"audiences,omitempty" protobuf:"bytes,4,rep,name=audiences"` - // Error indicates that the token couldn't be checked + // error indicates that the token couldn't be checked // +optional Error string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"` } @@ -92,19 +93,19 @@ type TokenReviewStatus struct { // UserInfo holds the information about the user needed to implement the // user.Info interface. type UserInfo struct { - // The name that uniquely identifies this user among all active users. + // username is the name that uniquely identifies this user among all active users. // +optional Username string `json:"username,omitempty" protobuf:"bytes,1,opt,name=username"` - // A unique value that identifies this user across time. If this user is + // uid is a unique value that identifies this user across time. If this user is // deleted and another user by the same name is added, they will have // different UIDs. // +optional UID string `json:"uid,omitempty" protobuf:"bytes,2,opt,name=uid"` - // The names of groups this user is a part of. + // groups is the names of groups this user is a part of. // +optional // +listType=atomic Groups []string `json:"groups,omitempty" protobuf:"bytes,3,rep,name=groups"` - // Any additional information provided by the authenticator. + // extra is any additional information provided by the authenticator. // +optional Extra map[string]ExtraValue `json:"extra,omitempty" protobuf:"bytes,4,rep,name=extra"` } @@ -129,17 +130,18 @@ func (t ExtraValue) String() string { // request header authentication is used, any extra keys will have their case ignored and returned as lowercase. type SelfSubjectReview struct { metav1.TypeMeta `json:",inline"` - // Standard object's metadata. + // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Status is filled in by the server with the user attributes. + // status is filled in by the server with the user attributes. + // +optional Status SelfSubjectReviewStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"` } // SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user. type SelfSubjectReviewStatus struct { - // User attributes of the user making this request. + // userInfo is a set of attributes belonging to the user making this request. // +optional UserInfo v1.UserInfo `json:"userInfo,omitempty" protobuf:"bytes,1,opt,name=userInfo"` } diff --git a/vendor/k8s.io/api/authentication/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/authentication/v1beta1/types_swagger_doc_generated.go index d6644f2cf9..31dadf968e 100644 --- a/vendor/k8s.io/api/authentication/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/authentication/v1beta1/types_swagger_doc_generated.go @@ -29,8 +29,8 @@ package v1beta1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_SelfSubjectReview = map[string]string{ "": "SelfSubjectReview contains the user information that the kube-apiserver has about the user making this request. When using impersonation, users will receive the user info of the user being impersonated. If impersonation or request header authentication is used, any extra keys will have their case ignored and returned as lowercase.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "status": "Status is filled in by the server with the user attributes.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "status": "status is filled in by the server with the user attributes.", } func (SelfSubjectReview) SwaggerDoc() map[string]string { @@ -39,7 +39,7 @@ func (SelfSubjectReview) SwaggerDoc() map[string]string { var map_SelfSubjectReviewStatus = map[string]string{ "": "SelfSubjectReviewStatus is filled by the kube-apiserver and sent back to a user.", - "userInfo": "User attributes of the user making this request.", + "userInfo": "userInfo is a set of attributes belonging to the user making this request.", } func (SelfSubjectReviewStatus) SwaggerDoc() map[string]string { @@ -48,9 +48,9 @@ func (SelfSubjectReviewStatus) SwaggerDoc() map[string]string { var map_TokenReview = map[string]string{ "": "TokenReview attempts to authenticate a token to a known user. Note: TokenReview requests may be cached by the webhook token authenticator plugin in the kube-apiserver.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated", - "status": "Status is filled in by the server and indicates whether the token can be authenticated.", + "metadata": "metadata is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated", + "status": "status is filled in by the server and indicates whether the token can be authenticated.", } func (TokenReview) SwaggerDoc() map[string]string { @@ -59,8 +59,8 @@ func (TokenReview) SwaggerDoc() map[string]string { var map_TokenReviewSpec = map[string]string{ "": "TokenReviewSpec is a description of the token authentication request.", - "token": "Token is the opaque bearer token.", - "audiences": "Audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.", + "token": "token is the opaque bearer token.", + "audiences": "audiences is a list of the identifiers that the resource server presented with the token identifies as. Audience-aware token authenticators will verify that the token was intended for at least one of the audiences in this list. If no audiences are provided, the audience will default to the audience of the Kubernetes apiserver.", } func (TokenReviewSpec) SwaggerDoc() map[string]string { @@ -69,10 +69,10 @@ func (TokenReviewSpec) SwaggerDoc() map[string]string { var map_TokenReviewStatus = map[string]string{ "": "TokenReviewStatus is the result of the token authentication request.", - "authenticated": "Authenticated indicates that the token was associated with a known user.", - "user": "User is the UserInfo associated with the provided token.", - "audiences": "Audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.", - "error": "Error indicates that the token couldn't be checked", + "authenticated": "authenticated indicates that the token was associated with a known user.", + "user": "user is the UserInfo associated with the provided token.", + "audiences": "audiences are audience identifiers chosen by the authenticator that are compatible with both the TokenReview and token. An identifier is any identifier in the intersection of the TokenReviewSpec audiences and the token's audiences. A client of the TokenReview API that sets the spec.audiences field should validate that a compatible audience identifier is returned in the status.audiences field to ensure that the TokenReview server is audience aware. If a TokenReview returns an empty status.audience field where status.authenticated is \"true\", the token is valid against the audience of the Kubernetes API server.", + "error": "error indicates that the token couldn't be checked", } func (TokenReviewStatus) SwaggerDoc() map[string]string { @@ -81,10 +81,10 @@ func (TokenReviewStatus) SwaggerDoc() map[string]string { var map_UserInfo = map[string]string{ "": "UserInfo holds the information about the user needed to implement the user.Info interface.", - "username": "The name that uniquely identifies this user among all active users.", - "uid": "A unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.", - "groups": "The names of groups this user is a part of.", - "extra": "Any additional information provided by the authenticator.", + "username": "username is the name that uniquely identifies this user among all active users.", + "uid": "uid is a unique value that identifies this user across time. If this user is deleted and another user by the same name is added, they will have different UIDs.", + "groups": "groups is the names of groups this user is a part of.", + "extra": "extra is any additional information provided by the authenticator.", } func (UserInfo) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/authorization/v1/generated.proto b/vendor/k8s.io/api/authorization/v1/generated.proto index ff529c969e..c47449f911 100644 --- a/vendor/k8s.io/api/authorization/v1/generated.proto +++ b/vendor/k8s.io/api/authorization/v1/generated.proto @@ -95,38 +95,38 @@ message LabelSelectorAttributes { // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions // checking. message LocalSubjectAccessReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace + // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace // you made the request against. If empty, it is defaulted. optional SubjectAccessReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional optional SubjectAccessReviewStatus status = 3; } // NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface message NonResourceAttributes { - // Path is the URL path of the request + // path is the URL path of the request // +optional optional string path = 1; - // Verb is the standard HTTP verb + // verb is the standard HTTP verb // +optional optional string verb = 2; } // NonResourceRule holds information that describes a rule for the non-resource message NonResourceRule { - // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. + // verbs is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. // +listType=atomic repeated string verbs = 1; - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, // final step in the path. "*" means all. // +optional // +listType=atomic @@ -135,34 +135,34 @@ message NonResourceRule { // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface message ResourceAttributes { - // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces + // namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces // "" (empty) is defaulted for LocalSubjectAccessReviews // "" (empty) is empty for cluster-scoped resources // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview // +optional optional string namespace = 1; - // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. // +optional optional string verb = 2; - // Group is the API Group of the Resource. "*" means all. + // group is the API Group of the Resource. "*" means all. // +optional optional string group = 3; - // Version is the API Version of the Resource. "*" means all. + // version is the API Version of the Resource. "*" means all. // +optional optional string version = 4; - // Resource is one of the existing resource types. "*" means all. + // resource is one of the existing resource types. "*" means all. // +optional optional string resource = 5; - // Subresource is one of the existing resource types. "" means none. + // subresource is one of the existing resource types. "" means none. // +optional optional string subresource = 6; - // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + // name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. // +optional optional string name = 7; @@ -178,23 +178,23 @@ message ResourceAttributes { // ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, // may contain duplicates, and possibly be incomplete. message ResourceRule { - // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verbs is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. // +listType=atomic repeated string verbs = 1; - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "*" means all. // +optional // +listType=atomic repeated string apiGroups = 2; - // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. + // resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups. // +optional // +listType=atomic repeated string resources = 3; - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. // +optional // +listType=atomic repeated string resourceNames = 4; @@ -204,27 +204,27 @@ message ResourceRule { // spec.namespace means "in all namespaces". Self is a special case, because users should always be able // to check whether they can perform an action message SelfSubjectAccessReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated. user and groups must be empty + // spec holds information about the request being evaluated. user and groups must be empty optional SelfSubjectAccessReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional optional SubjectAccessReviewStatus status = 3; } -// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set message SelfSubjectAccessReviewSpec { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional optional ResourceAttributes resourceAttributes = 1; - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional optional NonResourceAttributes nonResourceAttributes = 2; } @@ -236,88 +236,88 @@ message SelfSubjectAccessReviewSpec { // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. message SelfSubjectRulesReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated. + // spec holds information about the request being evaluated. optional SelfSubjectRulesReviewSpec spec = 2; - // Status is filled in by the server and indicates the set of actions a user can perform. + // status is filled in by the server and indicates the set of actions a user can perform. // +optional optional SubjectRulesReviewStatus status = 3; } // SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview. message SelfSubjectRulesReviewSpec { - // Namespace to evaluate rules for. Required. + // namespace to evaluate rules for. Required. optional string namespace = 1; } // SubjectAccessReview checks whether or not a user or group can perform an action. message SubjectAccessReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated optional SubjectAccessReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional optional SubjectAccessReviewStatus status = 3; } -// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set message SubjectAccessReviewSpec { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional optional ResourceAttributes resourceAttributes = 1; - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional optional NonResourceAttributes nonResourceAttributes = 2; - // User is the user you're testing for. + // user is the user you're testing for. // If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups // +optional optional string user = 3; - // Groups is the groups you're testing for. + // groups is the groups you're testing for. // +optional // +listType=atomic repeated string groups = 4; - // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer + // extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer // it needs a reflection here. // +optional map extra = 5; - // UID information about the requesting user. + // uid information about the requesting user. // +optional optional string uid = 6; } // SubjectAccessReviewStatus message SubjectAccessReviewStatus { - // Allowed is required. True if the action would be allowed, false otherwise. + // allowed is required. True if the action would be allowed, false otherwise. optional bool allowed = 1; - // Denied is optional. True if the action would be denied, otherwise + // denied is optional. True if the action would be denied, otherwise // false. If both allowed is false and denied is false, then the // authorizer has no opinion on whether to authorize the action. Denied // may not be true if Allowed is true. // +optional optional bool denied = 4; - // Reason is optional. It indicates why a request was allowed or denied. + // reason is optional. It indicates why a request was allowed or denied. // +optional optional string reason = 2; - // EvaluationError is an indication that some error occurred during the authorization check. + // evaluationError is an indication that some error occurred during the authorization check. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request. // +optional @@ -329,21 +329,21 @@ message SubjectAccessReviewStatus { // Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, // even if that list is incomplete. message SubjectRulesReviewStatus { - // ResourceRules is the list of actions the subject is allowed to perform on resources. + // resourceRules is the list of actions the subject is allowed to perform on resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic repeated ResourceRule resourceRules = 1; - // NonResourceRules is the list of actions the subject is allowed to perform on non-resources. + // nonResourceRules is the list of actions the subject is allowed to perform on non-resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic repeated NonResourceRule nonResourceRules = 2; - // Incomplete is true when the rules returned by this call are incomplete. This is most commonly + // incomplete is true when the rules returned by this call are incomplete. This is most commonly // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation. optional bool incomplete = 3; - // EvaluationError can appear in combination with Rules. It indicates an error occurred during + // evaluationError can appear in combination with Rules. It indicates an error occurred during // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that // ResourceRules and/or NonResourceRules may be incomplete. // +optional diff --git a/vendor/k8s.io/api/authorization/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/authorization/v1/generated.protomessage.pb.go deleted file mode 100644 index dc1e1028c0..0000000000 --- a/vendor/k8s.io/api/authorization/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,54 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*ExtraValue) ProtoMessage() {} - -func (*FieldSelectorAttributes) ProtoMessage() {} - -func (*LabelSelectorAttributes) ProtoMessage() {} - -func (*LocalSubjectAccessReview) ProtoMessage() {} - -func (*NonResourceAttributes) ProtoMessage() {} - -func (*NonResourceRule) ProtoMessage() {} - -func (*ResourceAttributes) ProtoMessage() {} - -func (*ResourceRule) ProtoMessage() {} - -func (*SelfSubjectAccessReview) ProtoMessage() {} - -func (*SelfSubjectAccessReviewSpec) ProtoMessage() {} - -func (*SelfSubjectRulesReview) ProtoMessage() {} - -func (*SelfSubjectRulesReviewSpec) ProtoMessage() {} - -func (*SubjectAccessReview) ProtoMessage() {} - -func (*SubjectAccessReviewSpec) ProtoMessage() {} - -func (*SubjectAccessReviewStatus) ProtoMessage() {} - -func (*SubjectRulesReviewStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/authorization/v1/types.go b/vendor/k8s.io/api/authorization/v1/types.go index 251e776b02..dcc9b0f853 100644 --- a/vendor/k8s.io/api/authorization/v1/types.go +++ b/vendor/k8s.io/api/authorization/v1/types.go @@ -31,15 +31,15 @@ import ( // SubjectAccessReview checks whether or not a user or group can perform an action. type SubjectAccessReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated Spec SubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } @@ -55,15 +55,15 @@ type SubjectAccessReview struct { // to check whether they can perform an action type SelfSubjectAccessReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated. user and groups must be empty + // spec holds information about the request being evaluated. user and groups must be empty Spec SelfSubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } @@ -78,44 +78,44 @@ type SelfSubjectAccessReview struct { // checking. type LocalSubjectAccessReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace + // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace // you made the request against. If empty, it is defaulted. Spec SubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface type ResourceAttributes struct { - // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces + // namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces // "" (empty) is defaulted for LocalSubjectAccessReviews // "" (empty) is empty for cluster-scoped resources // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` - // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. // +optional Verb string `json:"verb,omitempty" protobuf:"bytes,2,opt,name=verb"` - // Group is the API Group of the Resource. "*" means all. + // group is the API Group of the Resource. "*" means all. // +optional Group string `json:"group,omitempty" protobuf:"bytes,3,opt,name=group"` - // Version is the API Version of the Resource. "*" means all. + // version is the API Version of the Resource. "*" means all. // +optional Version string `json:"version,omitempty" protobuf:"bytes,4,opt,name=version"` - // Resource is one of the existing resource types. "*" means all. + // resource is one of the existing resource types. "*" means all. // +optional Resource string `json:"resource,omitempty" protobuf:"bytes,5,opt,name=resource"` - // Subresource is one of the existing resource types. "" means none. + // subresource is one of the existing resource types. "" means none. // +optional Subresource string `json:"subresource,omitempty" protobuf:"bytes,6,opt,name=subresource"` - // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + // name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. // +optional Name string `json:"name,omitempty" protobuf:"bytes,7,opt,name=name"` // fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it. @@ -182,37 +182,37 @@ type FieldSelectorAttributes struct { // NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface type NonResourceAttributes struct { - // Path is the URL path of the request + // path is the URL path of the request // +optional Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` - // Verb is the standard HTTP verb + // verb is the standard HTTP verb // +optional Verb string `json:"verb,omitempty" protobuf:"bytes,2,opt,name=verb"` } -// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set type SubjectAccessReviewSpec struct { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` - // User is the user you're testing for. + // user is the user you're testing for. // If you specify "User" but not "Groups", then is it interpreted as "What if User were not a member of any groups // +optional User string `json:"user,omitempty" protobuf:"bytes,3,opt,name=user"` - // Groups is the groups you're testing for. + // groups is the groups you're testing for. // +optional // +listType=atomic Groups []string `json:"groups,omitempty" protobuf:"bytes,4,rep,name=groups"` - // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer + // extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer // it needs a reflection here. // +optional Extra map[string]ExtraValue `json:"extra,omitempty" protobuf:"bytes,5,rep,name=extra"` - // UID information about the requesting user. + // uid information about the requesting user. // +optional UID string `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid"` } @@ -226,31 +226,31 @@ func (t ExtraValue) String() string { return fmt.Sprintf("%v", []string(t)) } -// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set type SelfSubjectAccessReviewSpec struct { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` } // SubjectAccessReviewStatus type SubjectAccessReviewStatus struct { - // Allowed is required. True if the action would be allowed, false otherwise. + // allowed is required. True if the action would be allowed, false otherwise. Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"` - // Denied is optional. True if the action would be denied, otherwise + // denied is optional. True if the action would be denied, otherwise // false. If both allowed is false and denied is false, then the // authorizer has no opinion on whether to authorize the action. Denied // may not be true if Allowed is true. // +optional Denied bool `json:"denied,omitempty" protobuf:"varint,4,opt,name=denied"` - // Reason is optional. It indicates why a request was allowed or denied. + // reason is optional. It indicates why a request was allowed or denied. // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"` - // EvaluationError is an indication that some error occurred during the authorization check. + // evaluationError is an indication that some error occurred during the authorization check. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request. // +optional @@ -271,22 +271,22 @@ type SubjectAccessReviewStatus struct { // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. type SelfSubjectRulesReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated. + // spec holds information about the request being evaluated. Spec SelfSubjectRulesReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates the set of actions a user can perform. + // status is filled in by the server and indicates the set of actions a user can perform. // +optional Status SubjectRulesReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview. type SelfSubjectRulesReviewSpec struct { - // Namespace to evaluate rules for. Required. + // namespace to evaluate rules for. Required. Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` } @@ -295,18 +295,18 @@ type SelfSubjectRulesReviewSpec struct { // Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, // even if that list is incomplete. type SubjectRulesReviewStatus struct { - // ResourceRules is the list of actions the subject is allowed to perform on resources. + // resourceRules is the list of actions the subject is allowed to perform on resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic ResourceRules []ResourceRule `json:"resourceRules" protobuf:"bytes,1,rep,name=resourceRules"` - // NonResourceRules is the list of actions the subject is allowed to perform on non-resources. + // nonResourceRules is the list of actions the subject is allowed to perform on non-resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic NonResourceRules []NonResourceRule `json:"nonResourceRules" protobuf:"bytes,2,rep,name=nonResourceRules"` - // Incomplete is true when the rules returned by this call are incomplete. This is most commonly + // incomplete is true when the rules returned by this call are incomplete. This is most commonly // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation. Incomplete bool `json:"incomplete" protobuf:"bytes,3,rep,name=incomplete"` - // EvaluationError can appear in combination with Rules. It indicates an error occurred during + // evaluationError can appear in combination with Rules. It indicates an error occurred during // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that // ResourceRules and/or NonResourceRules may be incomplete. // +optional @@ -316,21 +316,21 @@ type SubjectRulesReviewStatus struct { // ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, // may contain duplicates, and possibly be incomplete. type ResourceRule struct { - // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verbs is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. // +listType=atomic Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "*" means all. // +optional // +listType=atomic APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"` - // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. + // resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups. // +optional // +listType=atomic Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. // +optional // +listType=atomic ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"` @@ -338,11 +338,11 @@ type ResourceRule struct { // NonResourceRule holds information that describes a rule for the non-resource type NonResourceRule struct { - // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. + // verbs is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. // +listType=atomic Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, // final step in the path. "*" means all. // +optional // +listType=atomic diff --git a/vendor/k8s.io/api/authorization/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/authorization/v1/types_swagger_doc_generated.go index 29d0aa8463..0b3ae19a59 100644 --- a/vendor/k8s.io/api/authorization/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/authorization/v1/types_swagger_doc_generated.go @@ -49,9 +49,9 @@ func (LabelSelectorAttributes) SwaggerDoc() map[string]string { var map_LocalSubjectAccessReview = map[string]string{ "": "LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.", - "status": "Status is filled in by the server and indicates whether the request is allowed or not", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.", + "status": "status is filled in by the server and indicates whether the request is allowed or not", } func (LocalSubjectAccessReview) SwaggerDoc() map[string]string { @@ -60,8 +60,8 @@ func (LocalSubjectAccessReview) SwaggerDoc() map[string]string { var map_NonResourceAttributes = map[string]string{ "": "NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface", - "path": "Path is the URL path of the request", - "verb": "Verb is the standard HTTP verb", + "path": "path is the URL path of the request", + "verb": "verb is the standard HTTP verb", } func (NonResourceAttributes) SwaggerDoc() map[string]string { @@ -70,8 +70,8 @@ func (NonResourceAttributes) SwaggerDoc() map[string]string { var map_NonResourceRule = map[string]string{ "": "NonResourceRule holds information that describes a rule for the non-resource", - "verbs": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.", - "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.", + "verbs": "verbs is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.", + "nonResourceURLs": "nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.", } func (NonResourceRule) SwaggerDoc() map[string]string { @@ -80,13 +80,13 @@ func (NonResourceRule) SwaggerDoc() map[string]string { var map_ResourceAttributes = map[string]string{ "": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface", - "namespace": "Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview", - "verb": "Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", - "group": "Group is the API Group of the Resource. \"*\" means all.", - "version": "Version is the API Version of the Resource. \"*\" means all.", - "resource": "Resource is one of the existing resource types. \"*\" means all.", - "subresource": "Subresource is one of the existing resource types. \"\" means none.", - "name": "Name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.", + "namespace": "namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview", + "verb": "verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", + "group": "group is the API Group of the Resource. \"*\" means all.", + "version": "version is the API Version of the Resource. \"*\" means all.", + "resource": "resource is one of the existing resource types. \"*\" means all.", + "subresource": "subresource is one of the existing resource types. \"\" means none.", + "name": "name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.", "fieldSelector": "fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it.", "labelSelector": "labelSelector describes the limitation on access based on labels. It can only limit access, not broaden it.", } @@ -97,10 +97,10 @@ func (ResourceAttributes) SwaggerDoc() map[string]string { var map_ResourceRule = map[string]string{ "": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", - "verbs": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", - "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.", - "resources": "Resources is a list of resources this rule applies to. \"*\" means all in the specified apiGroups.\n \"*/foo\" represents the subresource 'foo' for all resources in the specified apiGroups.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.", + "verbs": "verbs is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", + "apiGroups": "apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.", + "resources": "resources is a list of resources this rule applies to. \"*\" means all in the specified apiGroups.\n \"*/foo\" represents the subresource 'foo' for all resources in the specified apiGroups.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.", } func (ResourceRule) SwaggerDoc() map[string]string { @@ -109,9 +109,9 @@ func (ResourceRule) SwaggerDoc() map[string]string { var map_SelfSubjectAccessReview = map[string]string{ "": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated. user and groups must be empty", - "status": "Status is filled in by the server and indicates whether the request is allowed or not", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated. user and groups must be empty", + "status": "status is filled in by the server and indicates whether the request is allowed or not", } func (SelfSubjectAccessReview) SwaggerDoc() map[string]string { @@ -119,9 +119,9 @@ func (SelfSubjectAccessReview) SwaggerDoc() map[string]string { } var map_SelfSubjectAccessReviewSpec = map[string]string{ - "": "SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", - "resourceAttributes": "ResourceAuthorizationAttributes describes information for a resource access request", - "nonResourceAttributes": "NonResourceAttributes describes information for a non-resource access request", + "": "SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes and nonResourceAttributes must be set", + "resourceAttributes": "resourceAttributes describes information for a resource access request", + "nonResourceAttributes": "nonResourceAttributes describes information for a non-resource access request", } func (SelfSubjectAccessReviewSpec) SwaggerDoc() map[string]string { @@ -130,9 +130,9 @@ func (SelfSubjectAccessReviewSpec) SwaggerDoc() map[string]string { var map_SelfSubjectRulesReview = map[string]string{ "": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated.", - "status": "Status is filled in by the server and indicates the set of actions a user can perform.", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated.", + "status": "status is filled in by the server and indicates the set of actions a user can perform.", } func (SelfSubjectRulesReview) SwaggerDoc() map[string]string { @@ -141,7 +141,7 @@ func (SelfSubjectRulesReview) SwaggerDoc() map[string]string { var map_SelfSubjectRulesReviewSpec = map[string]string{ "": "SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview.", - "namespace": "Namespace to evaluate rules for. Required.", + "namespace": "namespace to evaluate rules for. Required.", } func (SelfSubjectRulesReviewSpec) SwaggerDoc() map[string]string { @@ -150,9 +150,9 @@ func (SelfSubjectRulesReviewSpec) SwaggerDoc() map[string]string { var map_SubjectAccessReview = map[string]string{ "": "SubjectAccessReview checks whether or not a user or group can perform an action.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated", - "status": "Status is filled in by the server and indicates whether the request is allowed or not", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated", + "status": "status is filled in by the server and indicates whether the request is allowed or not", } func (SubjectAccessReview) SwaggerDoc() map[string]string { @@ -160,13 +160,13 @@ func (SubjectAccessReview) SwaggerDoc() map[string]string { } var map_SubjectAccessReviewSpec = map[string]string{ - "": "SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", - "resourceAttributes": "ResourceAuthorizationAttributes describes information for a resource access request", - "nonResourceAttributes": "NonResourceAttributes describes information for a non-resource access request", - "user": "User is the user you're testing for. If you specify \"User\" but not \"Groups\", then is it interpreted as \"What if User were not a member of any groups", - "groups": "Groups is the groups you're testing for.", - "extra": "Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.", - "uid": "UID information about the requesting user.", + "": "SubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes and nonResourceAttributes must be set", + "resourceAttributes": "resourceAttributes describes information for a resource access request", + "nonResourceAttributes": "nonResourceAttributes describes information for a non-resource access request", + "user": "user is the user you're testing for. If you specify \"User\" but not \"Groups\", then is it interpreted as \"What if User were not a member of any groups", + "groups": "groups is the groups you're testing for.", + "extra": "extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.", + "uid": "uid information about the requesting user.", } func (SubjectAccessReviewSpec) SwaggerDoc() map[string]string { @@ -175,10 +175,10 @@ func (SubjectAccessReviewSpec) SwaggerDoc() map[string]string { var map_SubjectAccessReviewStatus = map[string]string{ "": "SubjectAccessReviewStatus", - "allowed": "Allowed is required. True if the action would be allowed, false otherwise.", - "denied": "Denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true.", - "reason": "Reason is optional. It indicates why a request was allowed or denied.", - "evaluationError": "EvaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.", + "allowed": "allowed is required. True if the action would be allowed, false otherwise.", + "denied": "denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true.", + "reason": "reason is optional. It indicates why a request was allowed or denied.", + "evaluationError": "evaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.", } func (SubjectAccessReviewStatus) SwaggerDoc() map[string]string { @@ -187,10 +187,10 @@ func (SubjectAccessReviewStatus) SwaggerDoc() map[string]string { var map_SubjectRulesReviewStatus = map[string]string{ "": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.", - "resourceRules": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", - "nonResourceRules": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", - "incomplete": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.", - "evaluationError": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.", + "resourceRules": "resourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", + "nonResourceRules": "nonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", + "incomplete": "incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.", + "evaluationError": "evaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.", } func (SubjectRulesReviewStatus) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/authorization/v1beta1/generated.proto b/vendor/k8s.io/api/authorization/v1beta1/generated.proto index 8738768b89..8095ab4dbb 100644 --- a/vendor/k8s.io/api/authorization/v1beta1/generated.proto +++ b/vendor/k8s.io/api/authorization/v1beta1/generated.proto @@ -42,38 +42,38 @@ message ExtraValue { // Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions // checking. message LocalSubjectAccessReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace + // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace // you made the request against. If empty, it is defaulted. optional SubjectAccessReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional optional SubjectAccessReviewStatus status = 3; } // NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface message NonResourceAttributes { - // Path is the URL path of the request + // path is the URL path of the request // +optional optional string path = 1; - // Verb is the standard HTTP verb + // verb is the standard HTTP verb // +optional optional string verb = 2; } // NonResourceRule holds information that describes a rule for the non-resource message NonResourceRule { - // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. + // verbs is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. // +listType=atomic repeated string verbs = 1; - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, // final step in the path. "*" means all. // +optional // +listType=atomic @@ -82,34 +82,34 @@ message NonResourceRule { // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface message ResourceAttributes { - // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces + // namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces // "" (empty) is defaulted for LocalSubjectAccessReviews // "" (empty) is empty for cluster-scoped resources // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview // +optional optional string namespace = 1; - // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. // +optional optional string verb = 2; - // Group is the API Group of the Resource. "*" means all. + // group is the API Group of the Resource. "*" means all. // +optional optional string group = 3; - // Version is the API Version of the Resource. "*" means all. + // version is the API Version of the Resource. "*" means all. // +optional optional string version = 4; - // Resource is one of the existing resource types. "*" means all. + // resource is one of the existing resource types. "*" means all. // +optional optional string resource = 5; - // Subresource is one of the existing resource types. "" means none. + // subresource is one of the existing resource types. "" means none. // +optional optional string subresource = 6; - // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + // name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. // +optional optional string name = 7; @@ -125,23 +125,23 @@ message ResourceAttributes { // ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, // may contain duplicates, and possibly be incomplete. message ResourceRule { - // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verbs is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. // +listType=atomic repeated string verbs = 1; - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "*" means all. // +optional // +listType=atomic repeated string apiGroups = 2; - // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. + // resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups. // +optional // +listType=atomic repeated string resources = 3; - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. // +optional // +listType=atomic repeated string resourceNames = 4; @@ -151,27 +151,27 @@ message ResourceRule { // spec.namespace means "in all namespaces". Self is a special case, because users should always be able // to check whether they can perform an action message SelfSubjectAccessReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated. user and groups must be empty + // spec holds information about the request being evaluated. user and groups must be empty optional SelfSubjectAccessReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional optional SubjectAccessReviewStatus status = 3; } -// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set message SelfSubjectAccessReviewSpec { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional optional ResourceAttributes resourceAttributes = 1; - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional optional NonResourceAttributes nonResourceAttributes = 2; } @@ -183,88 +183,88 @@ message SelfSubjectAccessReviewSpec { // drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. message SelfSubjectRulesReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated. + // spec holds information about the request being evaluated. optional SelfSubjectRulesReviewSpec spec = 2; - // Status is filled in by the server and indicates the set of actions a user can perform. + // status is filled in by the server and indicates the set of actions a user can perform. // +optional optional SubjectRulesReviewStatus status = 3; } // SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview. message SelfSubjectRulesReviewSpec { - // Namespace to evaluate rules for. Required. + // namespace to evaluate rules for. Required. optional string namespace = 1; } // SubjectAccessReview checks whether or not a user or group can perform an action. message SubjectAccessReview { - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated optional SubjectAccessReviewSpec spec = 2; - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional optional SubjectAccessReviewStatus status = 3; } -// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set message SubjectAccessReviewSpec { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional optional ResourceAttributes resourceAttributes = 1; - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional optional NonResourceAttributes nonResourceAttributes = 2; - // User is the user you're testing for. + // user is the user you're testing for. // If you specify "User" but not "Group", then is it interpreted as "What if User were not a member of any groups // +optional optional string user = 3; - // Groups is the groups you're testing for. + // group is the groups you're testing for. // +optional // +listType=atomic repeated string group = 4; - // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer + // extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer // it needs a reflection here. // +optional map extra = 5; - // UID information about the requesting user. + // uid information about the requesting user. // +optional optional string uid = 6; } // SubjectAccessReviewStatus message SubjectAccessReviewStatus { - // Allowed is required. True if the action would be allowed, false otherwise. + // allowed is required. True if the action would be allowed, false otherwise. optional bool allowed = 1; - // Denied is optional. True if the action would be denied, otherwise + // denied is optional. True if the action would be denied, otherwise // false. If both allowed is false and denied is false, then the // authorizer has no opinion on whether to authorize the action. Denied // may not be true if Allowed is true. // +optional optional bool denied = 4; - // Reason is optional. It indicates why a request was allowed or denied. + // reason is optional. It indicates why a request was allowed or denied. // +optional optional string reason = 2; - // EvaluationError is an indication that some error occurred during the authorization check. + // evaluationError is an indication that some error occurred during the authorization check. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request. // +optional @@ -276,21 +276,21 @@ message SubjectAccessReviewStatus { // Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, // even if that list is incomplete. message SubjectRulesReviewStatus { - // ResourceRules is the list of actions the subject is allowed to perform on resources. + // resourceRules is the list of actions the subject is allowed to perform on resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic repeated ResourceRule resourceRules = 1; - // NonResourceRules is the list of actions the subject is allowed to perform on non-resources. + // nonResourceRules is the list of actions the subject is allowed to perform on non-resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic repeated NonResourceRule nonResourceRules = 2; - // Incomplete is true when the rules returned by this call are incomplete. This is most commonly + // incomplete is true when the rules returned by this call are incomplete. This is most commonly // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation. optional bool incomplete = 3; - // EvaluationError can appear in combination with Rules. It indicates an error occurred during + // evaluationError can appear in combination with Rules. It indicates an error occurred during // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that // ResourceRules and/or NonResourceRules may be incomplete. // +optional diff --git a/vendor/k8s.io/api/authorization/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/authorization/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 69af1b6c93..0000000000 --- a/vendor/k8s.io/api/authorization/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,50 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*ExtraValue) ProtoMessage() {} - -func (*LocalSubjectAccessReview) ProtoMessage() {} - -func (*NonResourceAttributes) ProtoMessage() {} - -func (*NonResourceRule) ProtoMessage() {} - -func (*ResourceAttributes) ProtoMessage() {} - -func (*ResourceRule) ProtoMessage() {} - -func (*SelfSubjectAccessReview) ProtoMessage() {} - -func (*SelfSubjectAccessReviewSpec) ProtoMessage() {} - -func (*SelfSubjectRulesReview) ProtoMessage() {} - -func (*SelfSubjectRulesReviewSpec) ProtoMessage() {} - -func (*SubjectAccessReview) ProtoMessage() {} - -func (*SubjectAccessReviewSpec) ProtoMessage() {} - -func (*SubjectAccessReviewStatus) ProtoMessage() {} - -func (*SubjectRulesReviewStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/authorization/v1beta1/types.go b/vendor/k8s.io/api/authorization/v1beta1/types.go index 8b8e5a9867..204559fd20 100644 --- a/vendor/k8s.io/api/authorization/v1beta1/types.go +++ b/vendor/k8s.io/api/authorization/v1beta1/types.go @@ -34,15 +34,15 @@ import ( // SubjectAccessReview checks whether or not a user or group can perform an action. type SubjectAccessReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated + // spec holds information about the request being evaluated Spec SubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } @@ -60,15 +60,15 @@ type SubjectAccessReview struct { // to check whether they can perform an action type SelfSubjectAccessReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated. user and groups must be empty + // spec holds information about the request being evaluated. user and groups must be empty Spec SelfSubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } @@ -85,44 +85,44 @@ type SelfSubjectAccessReview struct { // checking. type LocalSubjectAccessReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace + // spec holds information about the request being evaluated. spec.namespace must be equal to the namespace // you made the request against. If empty, it is defaulted. Spec SubjectAccessReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates whether the request is allowed or not + // status is filled in by the server and indicates whether the request is allowed or not // +optional Status SubjectAccessReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface type ResourceAttributes struct { - // Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces + // namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces // "" (empty) is defaulted for LocalSubjectAccessReviews // "" (empty) is empty for cluster-scoped resources // "" (empty) means "all" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` - // Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. "*" means all. // +optional Verb string `json:"verb,omitempty" protobuf:"bytes,2,opt,name=verb"` - // Group is the API Group of the Resource. "*" means all. + // group is the API Group of the Resource. "*" means all. // +optional Group string `json:"group,omitempty" protobuf:"bytes,3,opt,name=group"` - // Version is the API Version of the Resource. "*" means all. + // version is the API Version of the Resource. "*" means all. // +optional Version string `json:"version,omitempty" protobuf:"bytes,4,opt,name=version"` - // Resource is one of the existing resource types. "*" means all. + // resource is one of the existing resource types. "*" means all. // +optional Resource string `json:"resource,omitempty" protobuf:"bytes,5,opt,name=resource"` - // Subresource is one of the existing resource types. "" means none. + // subresource is one of the existing resource types. "" means none. // +optional Subresource string `json:"subresource,omitempty" protobuf:"bytes,6,opt,name=subresource"` - // Name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. + // name is the name of the resource being requested for a "get" or deleted for a "delete". "" (empty) means all. // +optional Name string `json:"name,omitempty" protobuf:"bytes,7,opt,name=name"` // fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it. @@ -135,37 +135,37 @@ type ResourceAttributes struct { // NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface type NonResourceAttributes struct { - // Path is the URL path of the request + // path is the URL path of the request // +optional Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"` - // Verb is the standard HTTP verb + // verb is the standard HTTP verb // +optional Verb string `json:"verb,omitempty" protobuf:"bytes,2,opt,name=verb"` } -// SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set type SubjectAccessReviewSpec struct { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` - // User is the user you're testing for. + // user is the user you're testing for. // If you specify "User" but not "Group", then is it interpreted as "What if User were not a member of any groups // +optional User string `json:"user,omitempty" protobuf:"bytes,3,opt,name=user"` - // Groups is the groups you're testing for. + // group is the groups you're testing for. // +optional // +listType=atomic Groups []string `json:"group,omitempty" protobuf:"bytes,4,rep,name=group"` - // Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer + // extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer // it needs a reflection here. // +optional Extra map[string]ExtraValue `json:"extra,omitempty" protobuf:"bytes,5,rep,name=extra"` - // UID information about the requesting user. + // uid information about the requesting user. // +optional UID string `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid"` } @@ -179,31 +179,31 @@ func (t ExtraValue) String() string { return fmt.Sprintf("%v", []string(t)) } -// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes -// and NonResourceAuthorizationAttributes must be set +// SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes +// and nonResourceAttributes must be set type SelfSubjectAccessReviewSpec struct { - // ResourceAuthorizationAttributes describes information for a resource access request + // resourceAttributes describes information for a resource access request // +optional ResourceAttributes *ResourceAttributes `json:"resourceAttributes,omitempty" protobuf:"bytes,1,opt,name=resourceAttributes"` - // NonResourceAttributes describes information for a non-resource access request + // nonResourceAttributes describes information for a non-resource access request // +optional NonResourceAttributes *NonResourceAttributes `json:"nonResourceAttributes,omitempty" protobuf:"bytes,2,opt,name=nonResourceAttributes"` } // SubjectAccessReviewStatus type SubjectAccessReviewStatus struct { - // Allowed is required. True if the action would be allowed, false otherwise. + // allowed is required. True if the action would be allowed, false otherwise. Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"` - // Denied is optional. True if the action would be denied, otherwise + // denied is optional. True if the action would be denied, otherwise // false. If both allowed is false and denied is false, then the // authorizer has no opinion on whether to authorize the action. Denied // may not be true if Allowed is true. // +optional Denied bool `json:"denied,omitempty" protobuf:"varint,4,opt,name=denied"` - // Reason is optional. It indicates why a request was allowed or denied. + // reason is optional. It indicates why a request was allowed or denied. // +optional Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"` - // EvaluationError is an indication that some error occurred during the authorization check. + // evaluationError is an indication that some error occurred during the authorization check. // It is entirely possible to get an error and be able to continue determine authorization status in spite of it. // For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request. // +optional @@ -226,22 +226,22 @@ type SubjectAccessReviewStatus struct { // SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server. type SelfSubjectRulesReview struct { metav1.TypeMeta `json:",inline"` - // Standard list metadata. + // metadata is the standard list metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - // Spec holds information about the request being evaluated. + // spec holds information about the request being evaluated. Spec SelfSubjectRulesReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` - // Status is filled in by the server and indicates the set of actions a user can perform. + // status is filled in by the server and indicates the set of actions a user can perform. // +optional Status SubjectRulesReviewStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` } // SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview. type SelfSubjectRulesReviewSpec struct { - // Namespace to evaluate rules for. Required. + // namespace to evaluate rules for. Required. Namespace string `json:"namespace,omitempty" protobuf:"bytes,1,opt,name=namespace"` } @@ -250,18 +250,18 @@ type SelfSubjectRulesReviewSpec struct { // Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, // even if that list is incomplete. type SubjectRulesReviewStatus struct { - // ResourceRules is the list of actions the subject is allowed to perform on resources. + // resourceRules is the list of actions the subject is allowed to perform on resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic ResourceRules []ResourceRule `json:"resourceRules" protobuf:"bytes,1,rep,name=resourceRules"` - // NonResourceRules is the list of actions the subject is allowed to perform on non-resources. + // nonResourceRules is the list of actions the subject is allowed to perform on non-resources. // The list ordering isn't significant, may contain duplicates, and possibly be incomplete. // +listType=atomic NonResourceRules []NonResourceRule `json:"nonResourceRules" protobuf:"bytes,2,rep,name=nonResourceRules"` - // Incomplete is true when the rules returned by this call are incomplete. This is most commonly + // incomplete is true when the rules returned by this call are incomplete. This is most commonly // encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation. Incomplete bool `json:"incomplete" protobuf:"bytes,3,rep,name=incomplete"` - // EvaluationError can appear in combination with Rules. It indicates an error occurred during + // evaluationError can appear in combination with Rules. It indicates an error occurred during // rule evaluation, such as an authorizer that doesn't support rule evaluation, and that // ResourceRules and/or NonResourceRules may be incomplete. // +optional @@ -271,21 +271,21 @@ type SubjectRulesReviewStatus struct { // ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, // may contain duplicates, and possibly be incomplete. type ResourceRule struct { - // Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. + // verbs is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. "*" means all. // +listType=atomic Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of + // apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of // the enumerated resources in any API group will be allowed. "*" means all. // +optional // +listType=atomic APIGroups []string `json:"apiGroups,omitempty" protobuf:"bytes,2,rep,name=apiGroups"` - // Resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. + // resources is a list of resources this rule applies to. "*" means all in the specified apiGroups. // "*/foo" represents the subresource 'foo' for all resources in the specified apiGroups. // +optional // +listType=atomic Resources []string `json:"resources,omitempty" protobuf:"bytes,3,rep,name=resources"` - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. "*" means all. // +optional // +listType=atomic ResourceNames []string `json:"resourceNames,omitempty" protobuf:"bytes,4,rep,name=resourceNames"` @@ -293,11 +293,11 @@ type ResourceRule struct { // NonResourceRule holds information that describes a rule for the non-resource type NonResourceRule struct { - // Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. + // verbs is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. "*" means all. // +listType=atomic Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` - // NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, + // nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, // final step in the path. "*" means all. // +optional // +listType=atomic diff --git a/vendor/k8s.io/api/authorization/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/authorization/v1beta1/types_swagger_doc_generated.go index bb1352a2d9..5667187c9d 100644 --- a/vendor/k8s.io/api/authorization/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/authorization/v1beta1/types_swagger_doc_generated.go @@ -29,9 +29,9 @@ package v1beta1 // AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. var map_LocalSubjectAccessReview = map[string]string{ "": "LocalSubjectAccessReview checks whether or not a user or group can perform an action in a given namespace. Having a namespace scoped resource makes it much easier to grant namespace scoped policy that includes permissions checking.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.", - "status": "Status is filled in by the server and indicates whether the request is allowed or not", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated. spec.namespace must be equal to the namespace you made the request against. If empty, it is defaulted.", + "status": "status is filled in by the server and indicates whether the request is allowed or not", } func (LocalSubjectAccessReview) SwaggerDoc() map[string]string { @@ -40,8 +40,8 @@ func (LocalSubjectAccessReview) SwaggerDoc() map[string]string { var map_NonResourceAttributes = map[string]string{ "": "NonResourceAttributes includes the authorization attributes available for non-resource requests to the Authorizer interface", - "path": "Path is the URL path of the request", - "verb": "Verb is the standard HTTP verb", + "path": "path is the URL path of the request", + "verb": "verb is the standard HTTP verb", } func (NonResourceAttributes) SwaggerDoc() map[string]string { @@ -50,8 +50,8 @@ func (NonResourceAttributes) SwaggerDoc() map[string]string { var map_NonResourceRule = map[string]string{ "": "NonResourceRule holds information that describes a rule for the non-resource", - "verbs": "Verb is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.", - "nonResourceURLs": "NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.", + "verbs": "verbs is a list of kubernetes non-resource API verbs, like: get, post, put, delete, patch, head, options. \"*\" means all.", + "nonResourceURLs": "nonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path. \"*\" means all.", } func (NonResourceRule) SwaggerDoc() map[string]string { @@ -60,13 +60,13 @@ func (NonResourceRule) SwaggerDoc() map[string]string { var map_ResourceAttributes = map[string]string{ "": "ResourceAttributes includes the authorization attributes available for resource requests to the Authorizer interface", - "namespace": "Namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview", - "verb": "Verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", - "group": "Group is the API Group of the Resource. \"*\" means all.", - "version": "Version is the API Version of the Resource. \"*\" means all.", - "resource": "Resource is one of the existing resource types. \"*\" means all.", - "subresource": "Subresource is one of the existing resource types. \"\" means none.", - "name": "Name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.", + "namespace": "namespace is the namespace of the action being requested. Currently, there is no distinction between no namespace and all namespaces \"\" (empty) is defaulted for LocalSubjectAccessReviews \"\" (empty) is empty for cluster-scoped resources \"\" (empty) means \"all\" for namespace scoped resources from a SubjectAccessReview or SelfSubjectAccessReview", + "verb": "verb is a kubernetes resource API verb, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", + "group": "group is the API Group of the Resource. \"*\" means all.", + "version": "version is the API Version of the Resource. \"*\" means all.", + "resource": "resource is one of the existing resource types. \"*\" means all.", + "subresource": "subresource is one of the existing resource types. \"\" means none.", + "name": "name is the name of the resource being requested for a \"get\" or deleted for a \"delete\". \"\" (empty) means all.", "fieldSelector": "fieldSelector describes the limitation on access based on field. It can only limit access, not broaden it.", "labelSelector": "labelSelector describes the limitation on access based on labels. It can only limit access, not broaden it.", } @@ -77,10 +77,10 @@ func (ResourceAttributes) SwaggerDoc() map[string]string { var map_ResourceRule = map[string]string{ "": "ResourceRule is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", - "verbs": "Verb is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", - "apiGroups": "APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.", - "resources": "Resources is a list of resources this rule applies to. \"*\" means all in the specified apiGroups.\n \"*/foo\" represents the subresource 'foo' for all resources in the specified apiGroups.", - "resourceNames": "ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.", + "verbs": "verbs is a list of kubernetes resource API verbs, like: get, list, watch, create, update, delete, proxy. \"*\" means all.", + "apiGroups": "apiGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. \"*\" means all.", + "resources": "resources is a list of resources this rule applies to. \"*\" means all in the specified apiGroups.\n \"*/foo\" represents the subresource 'foo' for all resources in the specified apiGroups.", + "resourceNames": "resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. \"*\" means all.", } func (ResourceRule) SwaggerDoc() map[string]string { @@ -89,9 +89,9 @@ func (ResourceRule) SwaggerDoc() map[string]string { var map_SelfSubjectAccessReview = map[string]string{ "": "SelfSubjectAccessReview checks whether or the current user can perform an action. Not filling in a spec.namespace means \"in all namespaces\". Self is a special case, because users should always be able to check whether they can perform an action", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated. user and groups must be empty", - "status": "Status is filled in by the server and indicates whether the request is allowed or not", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated. user and groups must be empty", + "status": "status is filled in by the server and indicates whether the request is allowed or not", } func (SelfSubjectAccessReview) SwaggerDoc() map[string]string { @@ -99,9 +99,9 @@ func (SelfSubjectAccessReview) SwaggerDoc() map[string]string { } var map_SelfSubjectAccessReviewSpec = map[string]string{ - "": "SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", - "resourceAttributes": "ResourceAuthorizationAttributes describes information for a resource access request", - "nonResourceAttributes": "NonResourceAttributes describes information for a non-resource access request", + "": "SelfSubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes and nonResourceAttributes must be set", + "resourceAttributes": "resourceAttributes describes information for a resource access request", + "nonResourceAttributes": "nonResourceAttributes describes information for a non-resource access request", } func (SelfSubjectAccessReviewSpec) SwaggerDoc() map[string]string { @@ -110,9 +110,9 @@ func (SelfSubjectAccessReviewSpec) SwaggerDoc() map[string]string { var map_SelfSubjectRulesReview = map[string]string{ "": "SelfSubjectRulesReview enumerates the set of actions the current user can perform within a namespace. The returned list of actions may be incomplete depending on the server's authorization mode, and any errors experienced during the evaluation. SelfSubjectRulesReview should be used by UIs to show/hide actions, or to quickly let an end user reason about their permissions. It should NOT Be used by external systems to drive authorization decisions as this raises confused deputy, cache lifetime/revocation, and correctness concerns. SubjectAccessReview, and LocalAccessReview are the correct way to defer authorization decisions to the API server.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated.", - "status": "Status is filled in by the server and indicates the set of actions a user can perform.", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated.", + "status": "status is filled in by the server and indicates the set of actions a user can perform.", } func (SelfSubjectRulesReview) SwaggerDoc() map[string]string { @@ -121,7 +121,7 @@ func (SelfSubjectRulesReview) SwaggerDoc() map[string]string { var map_SelfSubjectRulesReviewSpec = map[string]string{ "": "SelfSubjectRulesReviewSpec defines the specification for SelfSubjectRulesReview.", - "namespace": "Namespace to evaluate rules for. Required.", + "namespace": "namespace to evaluate rules for. Required.", } func (SelfSubjectRulesReviewSpec) SwaggerDoc() map[string]string { @@ -130,9 +130,9 @@ func (SelfSubjectRulesReviewSpec) SwaggerDoc() map[string]string { var map_SubjectAccessReview = map[string]string{ "": "SubjectAccessReview checks whether or not a user or group can perform an action.", - "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "Spec holds information about the request being evaluated", - "status": "Status is filled in by the server and indicates whether the request is allowed or not", + "metadata": "metadata is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "spec holds information about the request being evaluated", + "status": "status is filled in by the server and indicates whether the request is allowed or not", } func (SubjectAccessReview) SwaggerDoc() map[string]string { @@ -140,13 +140,13 @@ func (SubjectAccessReview) SwaggerDoc() map[string]string { } var map_SubjectAccessReviewSpec = map[string]string{ - "": "SubjectAccessReviewSpec is a description of the access request. Exactly one of ResourceAuthorizationAttributes and NonResourceAuthorizationAttributes must be set", - "resourceAttributes": "ResourceAuthorizationAttributes describes information for a resource access request", - "nonResourceAttributes": "NonResourceAttributes describes information for a non-resource access request", - "user": "User is the user you're testing for. If you specify \"User\" but not \"Group\", then is it interpreted as \"What if User were not a member of any groups", - "group": "Groups is the groups you're testing for.", - "extra": "Extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.", - "uid": "UID information about the requesting user.", + "": "SubjectAccessReviewSpec is a description of the access request. Exactly one of resourceAttributes and nonResourceAttributes must be set", + "resourceAttributes": "resourceAttributes describes information for a resource access request", + "nonResourceAttributes": "nonResourceAttributes describes information for a non-resource access request", + "user": "user is the user you're testing for. If you specify \"User\" but not \"Group\", then is it interpreted as \"What if User were not a member of any groups", + "group": "group is the groups you're testing for.", + "extra": "extra corresponds to the user.Info.GetExtra() method from the authenticator. Since that is input to the authorizer it needs a reflection here.", + "uid": "uid information about the requesting user.", } func (SubjectAccessReviewSpec) SwaggerDoc() map[string]string { @@ -155,10 +155,10 @@ func (SubjectAccessReviewSpec) SwaggerDoc() map[string]string { var map_SubjectAccessReviewStatus = map[string]string{ "": "SubjectAccessReviewStatus", - "allowed": "Allowed is required. True if the action would be allowed, false otherwise.", - "denied": "Denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true.", - "reason": "Reason is optional. It indicates why a request was allowed or denied.", - "evaluationError": "EvaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.", + "allowed": "allowed is required. True if the action would be allowed, false otherwise.", + "denied": "denied is optional. True if the action would be denied, otherwise false. If both allowed is false and denied is false, then the authorizer has no opinion on whether to authorize the action. Denied may not be true if Allowed is true.", + "reason": "reason is optional. It indicates why a request was allowed or denied.", + "evaluationError": "evaluationError is an indication that some error occurred during the authorization check. It is entirely possible to get an error and be able to continue determine authorization status in spite of it. For instance, RBAC can be missing a role, but enough roles are still present and bound to reason about the request.", } func (SubjectAccessReviewStatus) SwaggerDoc() map[string]string { @@ -167,10 +167,10 @@ func (SubjectAccessReviewStatus) SwaggerDoc() map[string]string { var map_SubjectRulesReviewStatus = map[string]string{ "": "SubjectRulesReviewStatus contains the result of a rules check. This check can be incomplete depending on the set of authorizers the server is configured with and any errors experienced during evaluation. Because authorization rules are additive, if a rule appears in a list it's safe to assume the subject has that permission, even if that list is incomplete.", - "resourceRules": "ResourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", - "nonResourceRules": "NonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", - "incomplete": "Incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.", - "evaluationError": "EvaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.", + "resourceRules": "resourceRules is the list of actions the subject is allowed to perform on resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", + "nonResourceRules": "nonResourceRules is the list of actions the subject is allowed to perform on non-resources. The list ordering isn't significant, may contain duplicates, and possibly be incomplete.", + "incomplete": "incomplete is true when the rules returned by this call are incomplete. This is most commonly encountered when an authorizer, such as an external authorizer, doesn't support rules evaluation.", + "evaluationError": "evaluationError can appear in combination with Rules. It indicates an error occurred during rule evaluation, such as an authorizer that doesn't support rule evaluation, and that ResourceRules and/or NonResourceRules may be incomplete.", } func (SubjectRulesReviewStatus) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/autoscaling/v1/generated.proto b/vendor/k8s.io/api/autoscaling/v1/generated.proto index a17d7989db..6ef1facb6a 100644 --- a/vendor/k8s.io/api/autoscaling/v1/generated.proto +++ b/vendor/k8s.io/api/autoscaling/v1/generated.proto @@ -148,7 +148,7 @@ message HorizontalPodAutoscaler { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional + // +required optional HorizontalPodAutoscalerSpec spec = 2; // status is the current information about the autoscaler. @@ -202,9 +202,15 @@ message HorizontalPodAutoscalerSpec { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 optional int32 minReplicas = 2; // maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:minimum=1 optional int32 maxReplicas = 3; // targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; @@ -472,9 +478,9 @@ message Scale { message ScaleSpec { // replicas is the desired number of instances for the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 optional int32 replicas = 1; } diff --git a/vendor/k8s.io/api/autoscaling/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/autoscaling/v1/generated.protomessage.pb.go deleted file mode 100644 index 7b073f92c3..0000000000 --- a/vendor/k8s.io/api/autoscaling/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*ContainerResourceMetricSource) ProtoMessage() {} - -func (*ContainerResourceMetricStatus) ProtoMessage() {} - -func (*CrossVersionObjectReference) ProtoMessage() {} - -func (*ExternalMetricSource) ProtoMessage() {} - -func (*ExternalMetricStatus) ProtoMessage() {} - -func (*HorizontalPodAutoscaler) ProtoMessage() {} - -func (*HorizontalPodAutoscalerCondition) ProtoMessage() {} - -func (*HorizontalPodAutoscalerList) ProtoMessage() {} - -func (*HorizontalPodAutoscalerSpec) ProtoMessage() {} - -func (*HorizontalPodAutoscalerStatus) ProtoMessage() {} - -func (*MetricSpec) ProtoMessage() {} - -func (*MetricStatus) ProtoMessage() {} - -func (*ObjectMetricSource) ProtoMessage() {} - -func (*ObjectMetricStatus) ProtoMessage() {} - -func (*PodsMetricSource) ProtoMessage() {} - -func (*PodsMetricStatus) ProtoMessage() {} - -func (*ResourceMetricSource) ProtoMessage() {} - -func (*ResourceMetricStatus) ProtoMessage() {} - -func (*Scale) ProtoMessage() {} - -func (*ScaleSpec) ProtoMessage() {} - -func (*ScaleStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/autoscaling/v1/types.go b/vendor/k8s.io/api/autoscaling/v1/types.go index e1e8809fe9..97222afc08 100644 --- a/vendor/k8s.io/api/autoscaling/v1/types.go +++ b/vendor/k8s.io/api/autoscaling/v1/types.go @@ -47,9 +47,15 @@ type HorizontalPodAutoscalerSpec struct { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"` // maxReplicas is the upper limit for the number of pods that can be set by the autoscaler; cannot be smaller than MinReplicas. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:minimum=1 MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"` // targetCPUUtilizationPercentage is the target average CPU utilization (represented as a percentage of requested CPU) over all the pods; @@ -93,7 +99,7 @@ type HorizontalPodAutoscaler struct { metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec defines the behaviour of autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional + // +required Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // status is the current information about the autoscaler. @@ -117,7 +123,7 @@ type HorizontalPodAutoscalerList struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.2 -// +k8s:isSubresource=/scale +// +k8s:isSubresource="/scale" // Scale represents a scaling request for a resource. type Scale struct { @@ -139,9 +145,9 @@ type Scale struct { type ScaleSpec struct { // replicas is the desired number of instances for the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } @@ -408,6 +414,8 @@ const ( // ScalingLimited indicates that the calculated scale based on metrics would be above or // below the range for the HPA, and has thus been capped. ScalingLimited HorizontalPodAutoscalerConditionType = "ScalingLimited" + // ScaledToZero indicates that the HPA controller scaled the workload to zero. + ScaledToZero HorizontalPodAutoscalerConditionType = "ScaledToZero" ) // HorizontalPodAutoscalerCondition describes the state of diff --git a/vendor/k8s.io/api/autoscaling/v2/generated.proto b/vendor/k8s.io/api/autoscaling/v2/generated.proto index a007676a7d..f56b8c749d 100644 --- a/vendor/k8s.io/api/autoscaling/v2/generated.proto +++ b/vendor/k8s.io/api/autoscaling/v2/generated.proto @@ -175,7 +175,7 @@ message HorizontalPodAutoscaler { // spec is the specification for the behaviour of the autoscaler. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional + // +required optional HorizontalPodAutoscalerSpec spec = 2; // status is the current information about the autoscaler. @@ -248,10 +248,16 @@ message HorizontalPodAutoscalerSpec { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 optional int32 minReplicas = 2; // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. // It cannot be less that minReplicas. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:minimum=1 optional int32 maxReplicas = 3; // metrics contains the specifications for which to use to calculate the diff --git a/vendor/k8s.io/api/autoscaling/v2/generated.protomessage.pb.go b/vendor/k8s.io/api/autoscaling/v2/generated.protomessage.pb.go deleted file mode 100644 index 0a73d526bc..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2/generated.protomessage.pb.go +++ /dev/null @@ -1,70 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v2 - -func (*ContainerResourceMetricSource) ProtoMessage() {} - -func (*ContainerResourceMetricStatus) ProtoMessage() {} - -func (*CrossVersionObjectReference) ProtoMessage() {} - -func (*ExternalMetricSource) ProtoMessage() {} - -func (*ExternalMetricStatus) ProtoMessage() {} - -func (*HPAScalingPolicy) ProtoMessage() {} - -func (*HPAScalingRules) ProtoMessage() {} - -func (*HorizontalPodAutoscaler) ProtoMessage() {} - -func (*HorizontalPodAutoscalerBehavior) ProtoMessage() {} - -func (*HorizontalPodAutoscalerCondition) ProtoMessage() {} - -func (*HorizontalPodAutoscalerList) ProtoMessage() {} - -func (*HorizontalPodAutoscalerSpec) ProtoMessage() {} - -func (*HorizontalPodAutoscalerStatus) ProtoMessage() {} - -func (*MetricIdentifier) ProtoMessage() {} - -func (*MetricSpec) ProtoMessage() {} - -func (*MetricStatus) ProtoMessage() {} - -func (*MetricTarget) ProtoMessage() {} - -func (*MetricValueStatus) ProtoMessage() {} - -func (*ObjectMetricSource) ProtoMessage() {} - -func (*ObjectMetricStatus) ProtoMessage() {} - -func (*PodsMetricSource) ProtoMessage() {} - -func (*PodsMetricStatus) ProtoMessage() {} - -func (*ResourceMetricSource) ProtoMessage() {} - -func (*ResourceMetricStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/autoscaling/v2/types.go b/vendor/k8s.io/api/autoscaling/v2/types.go index 03a06dc8b4..ad10169a01 100644 --- a/vendor/k8s.io/api/autoscaling/v2/types.go +++ b/vendor/k8s.io/api/autoscaling/v2/types.go @@ -40,7 +40,7 @@ type HorizontalPodAutoscaler struct { // spec is the specification for the behaviour of the autoscaler. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional + // +required Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // status is the current information about the autoscaler. @@ -59,10 +59,16 @@ type HorizontalPodAutoscalerSpec struct { // metric is configured. Scaling is active as long as at least one metric value is // available. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:ifEnabled(HPAScaleToZero)=+k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:ifDisabled(HPAScaleToZero)=+k8s:minimum=1 MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"` // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. // It cannot be less that minReplicas. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:minimum=1 MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"` // metrics contains the specifications for which to use to calculate the @@ -444,6 +450,8 @@ const ( // ScalingLimited indicates that the calculated scale based on metrics would be above or // below the range for the HPA, and has thus been capped. ScalingLimited HorizontalPodAutoscalerConditionType = "ScalingLimited" + // ScaledToZero indicates that the HPA controller scaled the workload to zero. + ScaledToZero HorizontalPodAutoscalerConditionType = "ScaledToZero" ) // HorizontalPodAutoscalerCondition describes the state of diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/generated.pb.go b/vendor/k8s.io/api/autoscaling/v2beta1/generated.pb.go deleted file mode 100644 index b3b535adc7..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/generated.pb.go +++ /dev/null @@ -1,5106 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: k8s.io/api/autoscaling/v2beta1/generated.proto - -package v2beta1 - -import ( - fmt "fmt" - - io "io" - - k8s_io_api_core_v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -func (m *ContainerResourceMetricSource) Reset() { *m = ContainerResourceMetricSource{} } - -func (m *ContainerResourceMetricStatus) Reset() { *m = ContainerResourceMetricStatus{} } - -func (m *CrossVersionObjectReference) Reset() { *m = CrossVersionObjectReference{} } - -func (m *ExternalMetricSource) Reset() { *m = ExternalMetricSource{} } - -func (m *ExternalMetricStatus) Reset() { *m = ExternalMetricStatus{} } - -func (m *HorizontalPodAutoscaler) Reset() { *m = HorizontalPodAutoscaler{} } - -func (m *HorizontalPodAutoscalerCondition) Reset() { *m = HorizontalPodAutoscalerCondition{} } - -func (m *HorizontalPodAutoscalerList) Reset() { *m = HorizontalPodAutoscalerList{} } - -func (m *HorizontalPodAutoscalerSpec) Reset() { *m = HorizontalPodAutoscalerSpec{} } - -func (m *HorizontalPodAutoscalerStatus) Reset() { *m = HorizontalPodAutoscalerStatus{} } - -func (m *MetricSpec) Reset() { *m = MetricSpec{} } - -func (m *MetricStatus) Reset() { *m = MetricStatus{} } - -func (m *ObjectMetricSource) Reset() { *m = ObjectMetricSource{} } - -func (m *ObjectMetricStatus) Reset() { *m = ObjectMetricStatus{} } - -func (m *PodsMetricSource) Reset() { *m = PodsMetricSource{} } - -func (m *PodsMetricStatus) Reset() { *m = PodsMetricStatus{} } - -func (m *ResourceMetricSource) Reset() { *m = ResourceMetricSource{} } - -func (m *ResourceMetricStatus) Reset() { *m = ResourceMetricStatus{} } - -func (m *ContainerResourceMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerResourceMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerResourceMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Container) - copy(dAtA[i:], m.Container) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Container))) - i-- - dAtA[i] = 0x22 - if m.TargetAverageValue != nil { - { - size, err := m.TargetAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.TargetAverageUtilization != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.TargetAverageUtilization)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ContainerResourceMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerResourceMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerResourceMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Container) - copy(dAtA[i:], m.Container) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Container))) - i-- - dAtA[i] = 0x22 - { - size, err := m.CurrentAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.CurrentAverageUtilization != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.CurrentAverageUtilization)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CrossVersionObjectReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CrossVersionObjectReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CrossVersionObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.APIVersion) - copy(dAtA[i:], m.APIVersion) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion))) - i-- - dAtA[i] = 0x1a - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ExternalMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExternalMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExternalMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TargetAverageValue != nil { - { - size, err := m.TargetAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.TargetValue != nil { - { - size, err := m.TargetValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.MetricSelector != nil { - { - size, err := m.MetricSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.MetricName) - copy(dAtA[i:], m.MetricName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ExternalMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExternalMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExternalMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.CurrentAverageValue != nil { - { - size, err := m.CurrentAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - { - size, err := m.CurrentValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.MetricSelector != nil { - { - size, err := m.MetricSelector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.MetricName) - copy(dAtA[i:], m.MetricName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscaler) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscaler) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscaler) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerCondition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerCondition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x2a - i -= len(m.Reason) - copy(dAtA[i:], m.Reason) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) - i-- - dAtA[i] = 0x22 - { - size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0x12 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Metrics) > 0 { - for iNdEx := len(m.Metrics) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Metrics[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - i = encodeVarintGenerated(dAtA, i, uint64(m.MaxReplicas)) - i-- - dAtA[i] = 0x18 - if m.MinReplicas != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinReplicas)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ScaleTargetRef.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.CurrentMetrics) > 0 { - for iNdEx := len(m.CurrentMetrics) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CurrentMetrics[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - i = encodeVarintGenerated(dAtA, i, uint64(m.DesiredReplicas)) - i-- - dAtA[i] = 0x20 - i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentReplicas)) - i-- - dAtA[i] = 0x18 - if m.LastScaleTime != nil { - { - size, err := m.LastScaleTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ObservedGeneration != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ObservedGeneration)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MetricSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContainerResource != nil { - { - size, err := m.ContainerResource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.External != nil { - { - size, err := m.External.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Resource != nil { - { - size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Pods != nil { - { - size, err := m.Pods.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContainerResource != nil { - { - size, err := m.ContainerResource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.External != nil { - { - size, err := m.External.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Resource != nil { - { - size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Pods != nil { - { - size, err := m.Pods.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ObjectMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ObjectMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AverageValue != nil { - { - size, err := m.AverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Selector != nil { - { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - { - size, err := m.TargetValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.MetricName) - copy(dAtA[i:], m.MetricName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) - i-- - dAtA[i] = 0x12 - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ObjectMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ObjectMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AverageValue != nil { - { - size, err := m.AverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Selector != nil { - { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - { - size, err := m.CurrentValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.MetricName) - copy(dAtA[i:], m.MetricName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) - i-- - dAtA[i] = 0x12 - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodsMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodsMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodsMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Selector != nil { - { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size, err := m.TargetAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.MetricName) - copy(dAtA[i:], m.MetricName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodsMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodsMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodsMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Selector != nil { - { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - { - size, err := m.CurrentAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.MetricName) - copy(dAtA[i:], m.MetricName) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.MetricName))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ResourceMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResourceMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResourceMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.TargetAverageValue != nil { - { - size, err := m.TargetAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.TargetAverageUtilization != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.TargetAverageUtilization)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ResourceMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResourceMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResourceMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.CurrentAverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.CurrentAverageUtilization != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.CurrentAverageUtilization)) - i-- - dAtA[i] = 0x10 - } - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ContainerResourceMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if m.TargetAverageUtilization != nil { - n += 1 + sovGenerated(uint64(*m.TargetAverageUtilization)) - } - if m.TargetAverageValue != nil { - l = m.TargetAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - l = len(m.Container) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ContainerResourceMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if m.CurrentAverageUtilization != nil { - n += 1 + sovGenerated(uint64(*m.CurrentAverageUtilization)) - } - l = m.CurrentAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Container) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *CrossVersionObjectReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.APIVersion) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ExternalMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MetricName) - n += 1 + l + sovGenerated(uint64(l)) - if m.MetricSelector != nil { - l = m.MetricSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.TargetValue != nil { - l = m.TargetValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.TargetAverageValue != nil { - l = m.TargetAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ExternalMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MetricName) - n += 1 + l + sovGenerated(uint64(l)) - if m.MetricSelector != nil { - l = m.MetricSelector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - l = m.CurrentValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.CurrentAverageValue != nil { - l = m.CurrentAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *HorizontalPodAutoscaler) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *HorizontalPodAutoscalerCondition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Status) - n += 1 + l + sovGenerated(uint64(l)) - l = m.LastTransitionTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Reason) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *HorizontalPodAutoscalerList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *HorizontalPodAutoscalerSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ScaleTargetRef.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.MinReplicas != nil { - n += 1 + sovGenerated(uint64(*m.MinReplicas)) - } - n += 1 + sovGenerated(uint64(m.MaxReplicas)) - if len(m.Metrics) > 0 { - for _, e := range m.Metrics { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *HorizontalPodAutoscalerStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObservedGeneration != nil { - n += 1 + sovGenerated(uint64(*m.ObservedGeneration)) - } - if m.LastScaleTime != nil { - l = m.LastScaleTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - n += 1 + sovGenerated(uint64(m.CurrentReplicas)) - n += 1 + sovGenerated(uint64(m.DesiredReplicas)) - if len(m.CurrentMetrics) > 0 { - for _, e := range m.CurrentMetrics { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *MetricSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Pods != nil { - l = m.Pods.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Resource != nil { - l = m.Resource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.External != nil { - l = m.External.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ContainerResource != nil { - l = m.ContainerResource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *MetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Pods != nil { - l = m.Pods.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Resource != nil { - l = m.Resource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.External != nil { - l = m.External.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ContainerResource != nil { - l = m.ContainerResource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ObjectMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Target.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.MetricName) - n += 1 + l + sovGenerated(uint64(l)) - l = m.TargetValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Selector != nil { - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.AverageValue != nil { - l = m.AverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ObjectMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Target.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.MetricName) - n += 1 + l + sovGenerated(uint64(l)) - l = m.CurrentValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Selector != nil { - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.AverageValue != nil { - l = m.AverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *PodsMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MetricName) - n += 1 + l + sovGenerated(uint64(l)) - l = m.TargetAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Selector != nil { - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *PodsMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MetricName) - n += 1 + l + sovGenerated(uint64(l)) - l = m.CurrentAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.Selector != nil { - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ResourceMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if m.TargetAverageUtilization != nil { - n += 1 + sovGenerated(uint64(*m.TargetAverageUtilization)) - } - if m.TargetAverageValue != nil { - l = m.TargetAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *ResourceMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if m.CurrentAverageUtilization != nil { - n += 1 + sovGenerated(uint64(*m.CurrentAverageUtilization)) - } - l = m.CurrentAverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ContainerResourceMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerResourceMetricSource{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `TargetAverageUtilization:` + valueToStringGenerated(this.TargetAverageUtilization) + `,`, - `TargetAverageValue:` + strings.Replace(fmt.Sprintf("%v", this.TargetAverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `Container:` + fmt.Sprintf("%v", this.Container) + `,`, - `}`, - }, "") - return s -} -func (this *ContainerResourceMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerResourceMetricStatus{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `CurrentAverageUtilization:` + valueToStringGenerated(this.CurrentAverageUtilization) + `,`, - `CurrentAverageValue:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CurrentAverageValue), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, - `Container:` + fmt.Sprintf("%v", this.Container) + `,`, - `}`, - }, "") - return s -} -func (this *CrossVersionObjectReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CrossVersionObjectReference{`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `APIVersion:` + fmt.Sprintf("%v", this.APIVersion) + `,`, - `}`, - }, "") - return s -} -func (this *ExternalMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExternalMetricSource{`, - `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, - `MetricSelector:` + strings.Replace(fmt.Sprintf("%v", this.MetricSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `TargetValue:` + strings.Replace(fmt.Sprintf("%v", this.TargetValue), "Quantity", "resource.Quantity", 1) + `,`, - `TargetAverageValue:` + strings.Replace(fmt.Sprintf("%v", this.TargetAverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ExternalMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExternalMetricStatus{`, - `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, - `MetricSelector:` + strings.Replace(fmt.Sprintf("%v", this.MetricSelector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `CurrentValue:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CurrentValue), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, - `CurrentAverageValue:` + strings.Replace(fmt.Sprintf("%v", this.CurrentAverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscaler) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&HorizontalPodAutoscaler{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "HorizontalPodAutoscalerSpec", "HorizontalPodAutoscalerSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "HorizontalPodAutoscalerStatus", "HorizontalPodAutoscalerStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerCondition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&HorizontalPodAutoscalerCondition{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, - `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]HorizontalPodAutoscaler{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "HorizontalPodAutoscaler", "HorizontalPodAutoscaler", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&HorizontalPodAutoscalerList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForMetrics := "[]MetricSpec{" - for _, f := range this.Metrics { - repeatedStringForMetrics += strings.Replace(strings.Replace(f.String(), "MetricSpec", "MetricSpec", 1), `&`, ``, 1) + "," - } - repeatedStringForMetrics += "}" - s := strings.Join([]string{`&HorizontalPodAutoscalerSpec{`, - `ScaleTargetRef:` + strings.Replace(strings.Replace(this.ScaleTargetRef.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, - `MinReplicas:` + valueToStringGenerated(this.MinReplicas) + `,`, - `MaxReplicas:` + fmt.Sprintf("%v", this.MaxReplicas) + `,`, - `Metrics:` + repeatedStringForMetrics + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForCurrentMetrics := "[]MetricStatus{" - for _, f := range this.CurrentMetrics { - repeatedStringForCurrentMetrics += strings.Replace(strings.Replace(f.String(), "MetricStatus", "MetricStatus", 1), `&`, ``, 1) + "," - } - repeatedStringForCurrentMetrics += "}" - repeatedStringForConditions := "[]HorizontalPodAutoscalerCondition{" - for _, f := range this.Conditions { - repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "HorizontalPodAutoscalerCondition", "HorizontalPodAutoscalerCondition", 1), `&`, ``, 1) + "," - } - repeatedStringForConditions += "}" - s := strings.Join([]string{`&HorizontalPodAutoscalerStatus{`, - `ObservedGeneration:` + valueToStringGenerated(this.ObservedGeneration) + `,`, - `LastScaleTime:` + strings.Replace(fmt.Sprintf("%v", this.LastScaleTime), "Time", "v1.Time", 1) + `,`, - `CurrentReplicas:` + fmt.Sprintf("%v", this.CurrentReplicas) + `,`, - `DesiredReplicas:` + fmt.Sprintf("%v", this.DesiredReplicas) + `,`, - `CurrentMetrics:` + repeatedStringForCurrentMetrics + `,`, - `Conditions:` + repeatedStringForConditions + `,`, - `}`, - }, "") - return s -} -func (this *MetricSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricSpec{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Object:` + strings.Replace(this.Object.String(), "ObjectMetricSource", "ObjectMetricSource", 1) + `,`, - `Pods:` + strings.Replace(this.Pods.String(), "PodsMetricSource", "PodsMetricSource", 1) + `,`, - `Resource:` + strings.Replace(this.Resource.String(), "ResourceMetricSource", "ResourceMetricSource", 1) + `,`, - `External:` + strings.Replace(this.External.String(), "ExternalMetricSource", "ExternalMetricSource", 1) + `,`, - `ContainerResource:` + strings.Replace(this.ContainerResource.String(), "ContainerResourceMetricSource", "ContainerResourceMetricSource", 1) + `,`, - `}`, - }, "") - return s -} -func (this *MetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricStatus{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Object:` + strings.Replace(this.Object.String(), "ObjectMetricStatus", "ObjectMetricStatus", 1) + `,`, - `Pods:` + strings.Replace(this.Pods.String(), "PodsMetricStatus", "PodsMetricStatus", 1) + `,`, - `Resource:` + strings.Replace(this.Resource.String(), "ResourceMetricStatus", "ResourceMetricStatus", 1) + `,`, - `External:` + strings.Replace(this.External.String(), "ExternalMetricStatus", "ExternalMetricStatus", 1) + `,`, - `ContainerResource:` + strings.Replace(this.ContainerResource.String(), "ContainerResourceMetricStatus", "ContainerResourceMetricStatus", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ObjectMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ObjectMetricSource{`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, - `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, - `TargetValue:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.TargetValue), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, - `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ObjectMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ObjectMetricStatus{`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, - `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, - `CurrentValue:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CurrentValue), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, - `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `}`, - }, "") - return s -} -func (this *PodsMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodsMetricSource{`, - `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, - `TargetAverageValue:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.TargetAverageValue), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, - `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `}`, - }, "") - return s -} -func (this *PodsMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodsMetricStatus{`, - `MetricName:` + fmt.Sprintf("%v", this.MetricName) + `,`, - `CurrentAverageValue:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CurrentAverageValue), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, - `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ResourceMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ResourceMetricSource{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `TargetAverageUtilization:` + valueToStringGenerated(this.TargetAverageUtilization) + `,`, - `TargetAverageValue:` + strings.Replace(fmt.Sprintf("%v", this.TargetAverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `}`, - }, "") - return s -} -func (this *ResourceMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ResourceMetricStatus{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `CurrentAverageUtilization:` + valueToStringGenerated(this.CurrentAverageUtilization) + `,`, - `CurrentAverageValue:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.CurrentAverageValue), "Quantity", "resource.Quantity", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *ContainerResourceMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerResourceMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerResourceMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetAverageUtilization", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TargetAverageUtilization = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TargetAverageValue == nil { - m.TargetAverageValue = &resource.Quantity{} - } - if err := m.TargetAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Container = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerResourceMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerResourceMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerResourceMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentAverageUtilization", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CurrentAverageUtilization = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrentAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Container = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CrossVersionObjectReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CrossVersionObjectReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CrossVersionObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field APIVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.APIVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExternalMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExternalMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExternalMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MetricName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetricSelector == nil { - m.MetricSelector = &v1.LabelSelector{} - } - if err := m.MetricSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TargetValue == nil { - m.TargetValue = &resource.Quantity{} - } - if err := m.TargetValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TargetAverageValue == nil { - m.TargetAverageValue = &resource.Quantity{} - } - if err := m.TargetAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExternalMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExternalMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExternalMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MetricName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricSelector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MetricSelector == nil { - m.MetricSelector = &v1.LabelSelector{} - } - if err := m.MetricSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrentValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.CurrentAverageValue == nil { - m.CurrentAverageValue = &resource.Quantity{} - } - if err := m.CurrentAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscaler) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscaler: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscaler: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerCondition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerCondition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerCondition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = HorizontalPodAutoscalerConditionType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = k8s_io_api_core_v1.ConditionStatus(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, HorizontalPodAutoscaler{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ScaleTargetRef", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ScaleTargetRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinReplicas", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinReplicas = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxReplicas", wireType) - } - m.MaxReplicas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxReplicas |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metrics", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metrics = append(m.Metrics, MetricSpec{}) - if err := m.Metrics[len(m.Metrics)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ObservedGeneration = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastScaleTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LastScaleTime == nil { - m.LastScaleTime = &v1.Time{} - } - if err := m.LastScaleTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentReplicas", wireType) - } - m.CurrentReplicas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CurrentReplicas |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DesiredReplicas", wireType) - } - m.DesiredReplicas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DesiredReplicas |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentMetrics", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CurrentMetrics = append(m.CurrentMetrics, MetricStatus{}) - if err := m.CurrentMetrics[len(m.CurrentMetrics)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Conditions = append(m.Conditions, HorizontalPodAutoscalerCondition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = MetricSourceType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Object == nil { - m.Object = &ObjectMetricSource{} - } - if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pods == nil { - m.Pods = &PodsMetricSource{} - } - if err := m.Pods.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Resource == nil { - m.Resource = &ResourceMetricSource{} - } - if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field External", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.External == nil { - m.External = &ExternalMetricSource{} - } - if err := m.External.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerResource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerResource == nil { - m.ContainerResource = &ContainerResourceMetricSource{} - } - if err := m.ContainerResource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = MetricSourceType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Object == nil { - m.Object = &ObjectMetricStatus{} - } - if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pods == nil { - m.Pods = &PodsMetricStatus{} - } - if err := m.Pods.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Resource == nil { - m.Resource = &ResourceMetricStatus{} - } - if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field External", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.External == nil { - m.External = &ExternalMetricStatus{} - } - if err := m.External.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerResource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerResource == nil { - m.ContainerResource = &ContainerResourceMetricStatus{} - } - if err := m.ContainerResource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ObjectMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MetricName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TargetValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Selector == nil { - m.Selector = &v1.LabelSelector{} - } - if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AverageValue == nil { - m.AverageValue = &resource.Quantity{} - } - if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ObjectMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MetricName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrentValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Selector == nil { - m.Selector = &v1.LabelSelector{} - } - if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AverageValue == nil { - m.AverageValue = &resource.Quantity{} - } - if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodsMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodsMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodsMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MetricName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.TargetAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Selector == nil { - m.Selector = &v1.LabelSelector{} - } - if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodsMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodsMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodsMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MetricName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MetricName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrentAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Selector == nil { - m.Selector = &v1.LabelSelector{} - } - if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResourceMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResourceMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetAverageUtilization", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.TargetAverageUtilization = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.TargetAverageValue == nil { - m.TargetAverageValue = &resource.Quantity{} - } - if err := m.TargetAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResourceMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResourceMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentAverageUtilization", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.CurrentAverageUtilization = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentAverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrentAverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/generated.proto b/vendor/k8s.io/api/autoscaling/v2beta1/generated.proto deleted file mode 100644 index 4b71732ab9..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/generated.proto +++ /dev/null @@ -1,474 +0,0 @@ -/* -Copyright 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. -*/ - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package k8s.io.api.autoscaling.v2beta1; - -import "k8s.io/api/core/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "k8s.io/api/autoscaling/v2beta1"; - -// ContainerResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -message ContainerResourceMetricSource { - // name is the name of the resource in question. - optional string name = 1; - - // targetAverageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // +optional - optional int32 targetAverageUtilization = 2; - - // targetAverageValue is the target value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 3; - - // container is the name of the container in the pods of the scaling target - optional string container = 4; -} - -// ContainerResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing a single container in each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -message ContainerResourceMetricStatus { - // name is the name of the resource in question. - optional string name = 1; - - // currentAverageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. It will only be - // present if `targetAverageValue` was set in the corresponding metric - // specification. - // +optional - optional int32 currentAverageUtilization = 2; - - // currentAverageValue is the current value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // It will always be set, regardless of the corresponding metric specification. - optional .k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 3; - - // container is the name of the container in the pods of the scaling target - optional string container = 4; -} - -// CrossVersionObjectReference contains enough information to let you identify the referred resource. -message CrossVersionObjectReference { - // Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - optional string kind = 1; - - // Name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - optional string name = 2; - - // API version of the referent - // +optional - optional string apiVersion = 3; -} - -// ExternalMetricSource indicates how to scale on a metric not associated with -// any Kubernetes object (for example length of queue in cloud -// messaging service, or QPS from loadbalancer running outside of cluster). -// Exactly one "target" type should be set. -message ExternalMetricSource { - // metricName is the name of the metric in question. - optional string metricName = 1; - - // metricSelector is used to identify a specific time series - // within a given metric. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector metricSelector = 2; - - // targetValue is the target value of the metric (as a quantity). - // Mutually exclusive with TargetAverageValue. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3; - - // targetAverageValue is the target per-pod value of global metric (as a quantity). - // Mutually exclusive with TargetValue. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 4; -} - -// ExternalMetricStatus indicates the current value of a global metric -// not associated with any Kubernetes object. -message ExternalMetricStatus { - // metricName is the name of a metric used for autoscaling in - // metric system. - optional string metricName = 1; - - // metricSelector is used to identify a specific time series - // within a given metric. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector metricSelector = 2; - - // currentValue is the current value of the metric (as a quantity) - optional .k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3; - - // currentAverageValue is the current value of metric averaged over autoscaled pods. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 4; -} - -// HorizontalPodAutoscaler is the configuration for a horizontal pod -// autoscaler, which automatically manages the replica count of any resource -// implementing the scale subresource based on the metrics specified. -message HorizontalPodAutoscaler { - // metadata is the standard object metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // spec is the specification for the behaviour of the autoscaler. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional - optional HorizontalPodAutoscalerSpec spec = 2; - - // status is the current information about the autoscaler. - // +optional - optional HorizontalPodAutoscalerStatus status = 3; -} - -// HorizontalPodAutoscalerCondition describes the state of -// a HorizontalPodAutoscaler at a certain point. -message HorizontalPodAutoscalerCondition { - // type describes the current condition - optional string type = 1; - - // status is the status of the condition (True, False, Unknown) - optional string status = 2; - - // lastTransitionTime is the last time the condition transitioned from - // one status to another - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; - - // reason is the reason for the condition's last transition. - // +optional - optional string reason = 4; - - // message is a human-readable explanation containing details about - // the transition - // +optional - optional string message = 5; -} - -// HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects. -message HorizontalPodAutoscalerList { - // metadata is the standard list metadata. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - // items is the list of horizontal pod autoscaler objects. - repeated HorizontalPodAutoscaler items = 2; -} - -// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. -message HorizontalPodAutoscalerSpec { - // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics - // should be collected, as well as to actually change the replica count. - optional CrossVersionObjectReference scaleTargetRef = 1; - - // minReplicas is the lower limit for the number of replicas to which the autoscaler - // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the - // alpha feature gate HPAScaleToZero is enabled and at least one Object or External - // metric is configured. Scaling is active as long as at least one metric value is - // available. - // +optional - optional int32 minReplicas = 2; - - // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. - // It cannot be less that minReplicas. - optional int32 maxReplicas = 3; - - // metrics contains the specifications for which to use to calculate the - // desired replica count (the maximum replica count across all metrics will - // be used). The desired replica count is calculated multiplying the - // ratio between the target value and the current value by the current - // number of pods. Ergo, metrics used must decrease as the pod count is - // increased, and vice-versa. See the individual metric source types for - // more information about how each type of metric must respond. - // +optional - // +listType=atomic - repeated MetricSpec metrics = 4; -} - -// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. -message HorizontalPodAutoscalerStatus { - // observedGeneration is the most recent generation observed by this autoscaler. - // +optional - optional int64 observedGeneration = 1; - - // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, - // used by the autoscaler to control how often the number of pods is changed. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScaleTime = 2; - - // currentReplicas is current number of replicas of pods managed by this autoscaler, - // as last seen by the autoscaler. - optional int32 currentReplicas = 3; - - // desiredReplicas is the desired number of replicas of pods managed by this autoscaler, - // as last calculated by the autoscaler. - optional int32 desiredReplicas = 4; - - // currentMetrics is the last read state of the metrics used by this autoscaler. - // +optional - // +listType=atomic - repeated MetricStatus currentMetrics = 5; - - // conditions is the set of conditions required for this autoscaler to scale its target, - // and indicates whether or not those conditions are met. - // +optional - // +listType=atomic - repeated HorizontalPodAutoscalerCondition conditions = 6; -} - -// MetricSpec specifies how to scale based on a single metric -// (only `type` and one other matching field should be set at once). -message MetricSpec { - // type is the type of metric source. It should be one of "ContainerResource", - // "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. - optional string type = 1; - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - optional ObjectMetricSource object = 2; - - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - optional PodsMetricSource pods = 3; - - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - optional ResourceMetricSource resource = 4; - - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in - // each pod of the current scale target (e.g. CPU or memory). Such metrics are - // built in to Kubernetes, and have special scaling options on top of those - // available to normal per-pod metrics using the "pods" source. - // +optional - optional ContainerResourceMetricSource containerResource = 7; - - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - optional ExternalMetricSource external = 5; -} - -// MetricStatus describes the last-read state of a single metric. -message MetricStatus { - // type is the type of metric source. It will be one of "ContainerResource", - // "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. - optional string type = 1; - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - optional ObjectMetricStatus object = 2; - - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - optional PodsMetricStatus pods = 3; - - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - optional ResourceMetricStatus resource = 4; - - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - optional ContainerResourceMetricStatus containerResource = 7; - - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - optional ExternalMetricStatus external = 5; -} - -// ObjectMetricSource indicates how to scale on a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -message ObjectMetricSource { - // target is the described Kubernetes object. - optional CrossVersionObjectReference target = 1; - - // metricName is the name of the metric in question. - optional string metricName = 2; - - // targetValue is the target value of the metric (as a quantity). - optional .k8s.io.apimachinery.pkg.api.resource.Quantity targetValue = 3; - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping - // When unset, just the metricName will be used to gather metrics. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 4; - - // averageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5; -} - -// ObjectMetricStatus indicates the current value of a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -message ObjectMetricStatus { - // target is the described Kubernetes object. - optional CrossVersionObjectReference target = 1; - - // metricName is the name of the metric in question. - optional string metricName = 2; - - // currentValue is the current value of the metric (as a quantity). - optional .k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3; - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set in the ObjectMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 4; - - // averageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 5; -} - -// PodsMetricSource indicates how to scale on a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -// The values will be averaged together before being compared to the target -// value. -message PodsMetricSource { - // metricName is the name of the metric in question - optional string metricName = 1; - - // targetAverageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - optional .k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 2; - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping - // When unset, just the metricName will be used to gather metrics. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3; -} - -// PodsMetricStatus indicates the current value of a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -message PodsMetricStatus { - // metricName is the name of the metric in question - optional string metricName = 1; - - // currentAverageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - optional .k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 2; - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set in the PodsMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 3; -} - -// ResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -message ResourceMetricSource { - // name is the name of the resource in question. - optional string name = 1; - - // targetAverageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // +optional - optional int32 targetAverageUtilization = 2; - - // targetAverageValue is the target value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity targetAverageValue = 3; -} - -// ResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -message ResourceMetricStatus { - // name is the name of the resource in question. - optional string name = 1; - - // currentAverageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. It will only be - // present if `targetAverageValue` was set in the corresponding metric - // specification. - // +optional - optional int32 currentAverageUtilization = 2; - - // currentAverageValue is the current value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // It will always be set, regardless of the corresponding metric specification. - optional .k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 3; -} - diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/autoscaling/v2beta1/generated.protomessage.pb.go deleted file mode 100644 index ab1fe8c8b2..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,58 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v2beta1 - -func (*ContainerResourceMetricSource) ProtoMessage() {} - -func (*ContainerResourceMetricStatus) ProtoMessage() {} - -func (*CrossVersionObjectReference) ProtoMessage() {} - -func (*ExternalMetricSource) ProtoMessage() {} - -func (*ExternalMetricStatus) ProtoMessage() {} - -func (*HorizontalPodAutoscaler) ProtoMessage() {} - -func (*HorizontalPodAutoscalerCondition) ProtoMessage() {} - -func (*HorizontalPodAutoscalerList) ProtoMessage() {} - -func (*HorizontalPodAutoscalerSpec) ProtoMessage() {} - -func (*HorizontalPodAutoscalerStatus) ProtoMessage() {} - -func (*MetricSpec) ProtoMessage() {} - -func (*MetricStatus) ProtoMessage() {} - -func (*ObjectMetricSource) ProtoMessage() {} - -func (*ObjectMetricStatus) ProtoMessage() {} - -func (*PodsMetricSource) ProtoMessage() {} - -func (*PodsMetricStatus) ProtoMessage() {} - -func (*ResourceMetricSource) ProtoMessage() {} - -func (*ResourceMetricStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/types.go b/vendor/k8s.io/api/autoscaling/v2beta1/types.go deleted file mode 100644 index c3abdd9bd9..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/types.go +++ /dev/null @@ -1,486 +0,0 @@ -/* -Copyright 2016 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. -*/ - -package v2beta1 - -import ( - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// CrossVersionObjectReference contains enough information to let you identify the referred resource. -type CrossVersionObjectReference struct { - // Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` - // Name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - Name string `json:"name" protobuf:"bytes,2,opt,name=name"` - // API version of the referent - // +optional - APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"` -} - -// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. -type HorizontalPodAutoscalerSpec struct { - // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics - // should be collected, as well as to actually change the replica count. - ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef" protobuf:"bytes,1,opt,name=scaleTargetRef"` - // minReplicas is the lower limit for the number of replicas to which the autoscaler - // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the - // alpha feature gate HPAScaleToZero is enabled and at least one Object or External - // metric is configured. Scaling is active as long as at least one metric value is - // available. - // +optional - MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"` - // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. - // It cannot be less that minReplicas. - MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"` - // metrics contains the specifications for which to use to calculate the - // desired replica count (the maximum replica count across all metrics will - // be used). The desired replica count is calculated multiplying the - // ratio between the target value and the current value by the current - // number of pods. Ergo, metrics used must decrease as the pod count is - // increased, and vice-versa. See the individual metric source types for - // more information about how each type of metric must respond. - // +optional - // +listType=atomic - Metrics []MetricSpec `json:"metrics,omitempty" protobuf:"bytes,4,rep,name=metrics"` -} - -// MetricSourceType indicates the type of metric. -type MetricSourceType string - -const ( - // ObjectMetricSourceType is a metric describing a kubernetes object - // (for example, hits-per-second on an Ingress object). - ObjectMetricSourceType MetricSourceType = "Object" - // PodsMetricSourceType is a metric describing each pod in the current scale - // target (for example, transactions-processed-per-second). The values - // will be averaged together before being compared to the target value. - PodsMetricSourceType MetricSourceType = "Pods" - // ResourceMetricSourceType is a resource metric known to Kubernetes, as - // specified in requests and limits, describing each pod in the current - // scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics (the "pods" source). - ResourceMetricSourceType MetricSourceType = "Resource" - // ContainerResourceMetricSourceType is a resource metric known to Kubernetes, as - // specified in requests and limits, describing a single container in each pod in the current - // scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics (the "pods" source). - ContainerResourceMetricSourceType MetricSourceType = "ContainerResource" - // ExternalMetricSourceType is a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - ExternalMetricSourceType MetricSourceType = "External" -) - -// MetricSpec specifies how to scale based on a single metric -// (only `type` and one other matching field should be set at once). -type MetricSpec struct { - // type is the type of metric source. It should be one of "ContainerResource", - // "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. - Type MetricSourceType `json:"type" protobuf:"bytes,1,name=type"` - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - Object *ObjectMetricSource `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - Pods *PodsMetricSource `json:"pods,omitempty" protobuf:"bytes,3,opt,name=pods"` - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - Resource *ResourceMetricSource `json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"` - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in - // each pod of the current scale target (e.g. CPU or memory). Such metrics are - // built in to Kubernetes, and have special scaling options on top of those - // available to normal per-pod metrics using the "pods" source. - // +optional - ContainerResource *ContainerResourceMetricSource `json:"containerResource,omitempty" protobuf:"bytes,7,opt,name=containerResource"` - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - External *ExternalMetricSource `json:"external,omitempty" protobuf:"bytes,5,opt,name=external"` -} - -// ObjectMetricSource indicates how to scale on a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricSource struct { - // target is the described Kubernetes object. - Target CrossVersionObjectReference `json:"target" protobuf:"bytes,1,name=target"` - - // metricName is the name of the metric in question. - MetricName string `json:"metricName" protobuf:"bytes,2,name=metricName"` - // targetValue is the target value of the metric (as a quantity). - TargetValue resource.Quantity `json:"targetValue" protobuf:"bytes,3,name=targetValue"` - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping - // When unset, just the metricName will be used to gather metrics. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,4,name=selector"` - // averageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,5,name=averageValue"` -} - -// PodsMetricSource indicates how to scale on a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -// The values will be averaged together before being compared to the target -// value. -type PodsMetricSource struct { - // metricName is the name of the metric in question - MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` - // targetAverageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - TargetAverageValue resource.Quantity `json:"targetAverageValue" protobuf:"bytes,2,name=targetAverageValue"` - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping - // When unset, just the metricName will be used to gather metrics. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,3,name=selector"` -} - -// ResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ResourceMetricSource struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - // targetAverageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // +optional - TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty" protobuf:"varint,2,opt,name=targetAverageUtilization"` - // targetAverageValue is the target value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // +optional - TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"` -} - -// ContainerResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ContainerResourceMetricSource struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - // targetAverageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // +optional - TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty" protobuf:"varint,2,opt,name=targetAverageUtilization"` - // targetAverageValue is the target value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // +optional - TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"` - // container is the name of the container in the pods of the scaling target - Container string `json:"container" protobuf:"bytes,4,opt,name=container"` -} - -// ExternalMetricSource indicates how to scale on a metric not associated with -// any Kubernetes object (for example length of queue in cloud -// messaging service, or QPS from loadbalancer running outside of cluster). -// Exactly one "target" type should be set. -type ExternalMetricSource struct { - // metricName is the name of the metric in question. - MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` - // metricSelector is used to identify a specific time series - // within a given metric. - // +optional - MetricSelector *metav1.LabelSelector `json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"` - // targetValue is the target value of the metric (as a quantity). - // Mutually exclusive with TargetAverageValue. - // +optional - TargetValue *resource.Quantity `json:"targetValue,omitempty" protobuf:"bytes,3,opt,name=targetValue"` - // targetAverageValue is the target per-pod value of global metric (as a quantity). - // Mutually exclusive with TargetValue. - // +optional - TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty" protobuf:"bytes,4,opt,name=targetAverageValue"` -} - -// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. -type HorizontalPodAutoscalerStatus struct { - // observedGeneration is the most recent generation observed by this autoscaler. - // +optional - ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` - - // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, - // used by the autoscaler to control how often the number of pods is changed. - // +optional - LastScaleTime *metav1.Time `json:"lastScaleTime,omitempty" protobuf:"bytes,2,opt,name=lastScaleTime"` - - // currentReplicas is current number of replicas of pods managed by this autoscaler, - // as last seen by the autoscaler. - CurrentReplicas int32 `json:"currentReplicas" protobuf:"varint,3,opt,name=currentReplicas"` - - // desiredReplicas is the desired number of replicas of pods managed by this autoscaler, - // as last calculated by the autoscaler. - DesiredReplicas int32 `json:"desiredReplicas" protobuf:"varint,4,opt,name=desiredReplicas"` - - // currentMetrics is the last read state of the metrics used by this autoscaler. - // +optional - // +listType=atomic - CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` - - // conditions is the set of conditions required for this autoscaler to scale its target, - // and indicates whether or not those conditions are met. - // +optional - // +listType=atomic - Conditions []HorizontalPodAutoscalerCondition `json:"conditions" protobuf:"bytes,6,rep,name=conditions"` -} - -// HorizontalPodAutoscalerConditionType are the valid conditions of -// a HorizontalPodAutoscaler. -type HorizontalPodAutoscalerConditionType string - -const ( - // ScalingActive indicates that the HPA controller is able to scale if necessary: - // it's correctly configured, can fetch the desired metrics, and isn't disabled. - ScalingActive HorizontalPodAutoscalerConditionType = "ScalingActive" - // AbleToScale indicates a lack of transient issues which prevent scaling from occurring, - // such as being in a backoff window, or being unable to access/update the target scale. - AbleToScale HorizontalPodAutoscalerConditionType = "AbleToScale" - // ScalingLimited indicates that the calculated scale based on metrics would be above or - // below the range for the HPA, and has thus been capped. - ScalingLimited HorizontalPodAutoscalerConditionType = "ScalingLimited" -) - -// HorizontalPodAutoscalerCondition describes the state of -// a HorizontalPodAutoscaler at a certain point. -type HorizontalPodAutoscalerCondition struct { - // type describes the current condition - Type HorizontalPodAutoscalerConditionType `json:"type" protobuf:"bytes,1,name=type"` - // status is the status of the condition (True, False, Unknown) - Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,name=status"` - // lastTransitionTime is the last time the condition transitioned from - // one status to another - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` - // reason is the reason for the condition's last transition. - // +optional - Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` - // message is a human-readable explanation containing details about - // the transition - // +optional - Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` -} - -// MetricStatus describes the last-read state of a single metric. -type MetricStatus struct { - // type is the type of metric source. It will be one of "ContainerResource", - // "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. - Type MetricSourceType `json:"type" protobuf:"bytes,1,name=type"` - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - Object *ObjectMetricStatus `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - Pods *PodsMetricStatus `json:"pods,omitempty" protobuf:"bytes,3,opt,name=pods"` - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - Resource *ResourceMetricStatus `json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"` - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - ContainerResource *ContainerResourceMetricStatus `json:"containerResource,omitempty" protobuf:"bytes,7,opt,name=containerResource"` - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - External *ExternalMetricStatus `json:"external,omitempty" protobuf:"bytes,5,opt,name=external"` -} - -// ObjectMetricStatus indicates the current value of a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricStatus struct { - // target is the described Kubernetes object. - Target CrossVersionObjectReference `json:"target" protobuf:"bytes,1,name=target"` - - // metricName is the name of the metric in question. - MetricName string `json:"metricName" protobuf:"bytes,2,name=metricName"` - // currentValue is the current value of the metric (as a quantity). - CurrentValue resource.Quantity `json:"currentValue" protobuf:"bytes,3,name=currentValue"` - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set in the ObjectMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,4,name=selector"` - // averageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,5,name=averageValue"` -} - -// PodsMetricStatus indicates the current value of a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -type PodsMetricStatus struct { - // metricName is the name of the metric in question - MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` - // currentAverageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - CurrentAverageValue resource.Quantity `json:"currentAverageValue" protobuf:"bytes,2,name=currentAverageValue"` - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set in the PodsMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,3,name=selector"` -} - -// ResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ResourceMetricStatus struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - // currentAverageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. It will only be - // present if `targetAverageValue` was set in the corresponding metric - // specification. - // +optional - CurrentAverageUtilization *int32 `json:"currentAverageUtilization,omitempty" protobuf:"bytes,2,opt,name=currentAverageUtilization"` - // currentAverageValue is the current value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // It will always be set, regardless of the corresponding metric specification. - CurrentAverageValue resource.Quantity `json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"` -} - -// ContainerResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing a single container in each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ContainerResourceMetricStatus struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - // currentAverageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. It will only be - // present if `targetAverageValue` was set in the corresponding metric - // specification. - // +optional - CurrentAverageUtilization *int32 `json:"currentAverageUtilization,omitempty" protobuf:"bytes,2,opt,name=currentAverageUtilization"` - // currentAverageValue is the current value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // It will always be set, regardless of the corresponding metric specification. - CurrentAverageValue resource.Quantity `json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"` - // container is the name of the container in the pods of the scaling target - Container string `json:"container" protobuf:"bytes,4,opt,name=container"` -} - -// ExternalMetricStatus indicates the current value of a global metric -// not associated with any Kubernetes object. -type ExternalMetricStatus struct { - // metricName is the name of a metric used for autoscaling in - // metric system. - MetricName string `json:"metricName" protobuf:"bytes,1,name=metricName"` - // metricSelector is used to identify a specific time series - // within a given metric. - // +optional - MetricSelector *metav1.LabelSelector `json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"` - // currentValue is the current value of the metric (as a quantity) - CurrentValue resource.Quantity `json:"currentValue" protobuf:"bytes,3,name=currentValue"` - // currentAverageValue is the current value of metric averaged over autoscaled pods. - // +optional - CurrentAverageValue *resource.Quantity `json:"currentAverageValue,omitempty" protobuf:"bytes,4,opt,name=currentAverageValue"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:prerelease-lifecycle-gen:introduced=1.8 -// +k8s:prerelease-lifecycle-gen:deprecated=1.22 -// +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v2,HorizontalPodAutoscaler - -// HorizontalPodAutoscaler is the configuration for a horizontal pod -// autoscaler, which automatically manages the replica count of any resource -// implementing the scale subresource based on the metrics specified. -type HorizontalPodAutoscaler struct { - metav1.TypeMeta `json:",inline"` - // metadata is the standard object metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // spec is the specification for the behaviour of the autoscaler. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional - Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // status is the current information about the autoscaler. - // +optional - Status HorizontalPodAutoscalerStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:prerelease-lifecycle-gen:introduced=1.8 -// +k8s:prerelease-lifecycle-gen:deprecated=1.22 -// +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v2beta2,HorizontalPodAutoscalerList - -// HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects. -type HorizontalPodAutoscalerList struct { - metav1.TypeMeta `json:",inline"` - // metadata is the standard list metadata. - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of horizontal pod autoscaler objects. - Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go deleted file mode 100644 index c7c72bf356..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go +++ /dev/null @@ -1,247 +0,0 @@ -/* -Copyright 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. -*/ - -package v2beta1 - -// This file contains a collection of methods that can be used from go-restful to -// generate Swagger API documentation for its models. Please read this PR for more -// information on the implementation: https://github.com/emicklei/go-restful/pull/215 -// -// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if -// they are on one line! For multiple line or blocks that you want to ignore use ---. -// Any context after a --- is ignored. -// -// Those methods can be generated by using hack/update-codegen.sh - -// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. -var map_ContainerResourceMetricSource = map[string]string{ - "": "ContainerResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. Only one \"target\" type should be set.", - "name": "name is the name of the resource in question.", - "targetAverageUtilization": "targetAverageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.", - "targetAverageValue": "targetAverageValue is the target value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the \"pods\" metric source type.", - "container": "container is the name of the container in the pods of the scaling target", -} - -func (ContainerResourceMetricSource) SwaggerDoc() map[string]string { - return map_ContainerResourceMetricSource -} - -var map_ContainerResourceMetricStatus = map[string]string{ - "": "ContainerResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "name": "name is the name of the resource in question.", - "currentAverageUtilization": "currentAverageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. It will only be present if `targetAverageValue` was set in the corresponding metric specification.", - "currentAverageValue": "currentAverageValue is the current value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the \"pods\" metric source type. It will always be set, regardless of the corresponding metric specification.", - "container": "container is the name of the container in the pods of the scaling target", -} - -func (ContainerResourceMetricStatus) SwaggerDoc() map[string]string { - return map_ContainerResourceMetricStatus -} - -var map_CrossVersionObjectReference = map[string]string{ - "": "CrossVersionObjectReference contains enough information to let you identify the referred resource.", - "kind": "Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "name": "Name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", - "apiVersion": "API version of the referent", -} - -func (CrossVersionObjectReference) SwaggerDoc() map[string]string { - return map_CrossVersionObjectReference -} - -var map_ExternalMetricSource = map[string]string{ - "": "ExternalMetricSource indicates how to scale on a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster). Exactly one \"target\" type should be set.", - "metricName": "metricName is the name of the metric in question.", - "metricSelector": "metricSelector is used to identify a specific time series within a given metric.", - "targetValue": "targetValue is the target value of the metric (as a quantity). Mutually exclusive with TargetAverageValue.", - "targetAverageValue": "targetAverageValue is the target per-pod value of global metric (as a quantity). Mutually exclusive with TargetValue.", -} - -func (ExternalMetricSource) SwaggerDoc() map[string]string { - return map_ExternalMetricSource -} - -var map_ExternalMetricStatus = map[string]string{ - "": "ExternalMetricStatus indicates the current value of a global metric not associated with any Kubernetes object.", - "metricName": "metricName is the name of a metric used for autoscaling in metric system.", - "metricSelector": "metricSelector is used to identify a specific time series within a given metric.", - "currentValue": "currentValue is the current value of the metric (as a quantity)", - "currentAverageValue": "currentAverageValue is the current value of metric averaged over autoscaled pods.", -} - -func (ExternalMetricStatus) SwaggerDoc() map[string]string { - return map_ExternalMetricStatus -} - -var map_HorizontalPodAutoscaler = map[string]string{ - "": "HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified.", - "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "spec is the specification for the behaviour of the autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.", - "status": "status is the current information about the autoscaler.", -} - -func (HorizontalPodAutoscaler) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscaler -} - -var map_HorizontalPodAutoscalerCondition = map[string]string{ - "": "HorizontalPodAutoscalerCondition describes the state of a HorizontalPodAutoscaler at a certain point.", - "type": "type describes the current condition", - "status": "status is the status of the condition (True, False, Unknown)", - "lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another", - "reason": "reason is the reason for the condition's last transition.", - "message": "message is a human-readable explanation containing details about the transition", -} - -func (HorizontalPodAutoscalerCondition) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerCondition -} - -var map_HorizontalPodAutoscalerList = map[string]string{ - "": "HorizontalPodAutoscaler is a list of horizontal pod autoscaler objects.", - "metadata": "metadata is the standard list metadata.", - "items": "items is the list of horizontal pod autoscaler objects.", -} - -func (HorizontalPodAutoscalerList) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerList -} - -var map_HorizontalPodAutoscalerSpec = map[string]string{ - "": "HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.", - "scaleTargetRef": "scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count.", - "minReplicas": "minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.", - "maxReplicas": "maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that minReplicas.", - "metrics": "metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond.", -} - -func (HorizontalPodAutoscalerSpec) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerSpec -} - -var map_HorizontalPodAutoscalerStatus = map[string]string{ - "": "HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.", - "observedGeneration": "observedGeneration is the most recent generation observed by this autoscaler.", - "lastScaleTime": "lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, used by the autoscaler to control how often the number of pods is changed.", - "currentReplicas": "currentReplicas is current number of replicas of pods managed by this autoscaler, as last seen by the autoscaler.", - "desiredReplicas": "desiredReplicas is the desired number of replicas of pods managed by this autoscaler, as last calculated by the autoscaler.", - "currentMetrics": "currentMetrics is the last read state of the metrics used by this autoscaler.", - "conditions": "conditions is the set of conditions required for this autoscaler to scale its target, and indicates whether or not those conditions are met.", -} - -func (HorizontalPodAutoscalerStatus) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerStatus -} - -var map_MetricSpec = map[string]string{ - "": "MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once).", - "type": "type is the type of metric source. It should be one of \"ContainerResource\", \"External\", \"Object\", \"Pods\" or \"Resource\", each mapping to a matching field in the object.", - "object": "object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).", - "pods": "pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", - "resource": "resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "containerResource": "container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "external": "external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).", -} - -func (MetricSpec) SwaggerDoc() map[string]string { - return map_MetricSpec -} - -var map_MetricStatus = map[string]string{ - "": "MetricStatus describes the last-read state of a single metric.", - "type": "type is the type of metric source. It will be one of \"ContainerResource\", \"External\", \"Object\", \"Pods\" or \"Resource\", each corresponds to a matching field in the object.", - "object": "object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).", - "pods": "pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", - "resource": "resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "containerResource": "container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "external": "external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).", -} - -func (MetricStatus) SwaggerDoc() map[string]string { - return map_MetricStatus -} - -var map_ObjectMetricSource = map[string]string{ - "": "ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", - "target": "target is the described Kubernetes object.", - "metricName": "metricName is the name of the metric in question.", - "targetValue": "targetValue is the target value of the metric (as a quantity).", - "selector": "selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping When unset, just the metricName will be used to gather metrics.", - "averageValue": "averageValue is the target value of the average of the metric across all relevant pods (as a quantity)", -} - -func (ObjectMetricSource) SwaggerDoc() map[string]string { - return map_ObjectMetricSource -} - -var map_ObjectMetricStatus = map[string]string{ - "": "ObjectMetricStatus indicates the current value of a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", - "target": "target is the described Kubernetes object.", - "metricName": "metricName is the name of the metric in question.", - "currentValue": "currentValue is the current value of the metric (as a quantity).", - "selector": "selector is the string-encoded form of a standard kubernetes label selector for the given metric When set in the ObjectMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics.", - "averageValue": "averageValue is the current value of the average of the metric across all relevant pods (as a quantity)", -} - -func (ObjectMetricStatus) SwaggerDoc() map[string]string { - return map_ObjectMetricStatus -} - -var map_PodsMetricSource = map[string]string{ - "": "PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", - "metricName": "metricName is the name of the metric in question", - "targetAverageValue": "targetAverageValue is the target value of the average of the metric across all relevant pods (as a quantity)", - "selector": "selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping When unset, just the metricName will be used to gather metrics.", -} - -func (PodsMetricSource) SwaggerDoc() map[string]string { - return map_PodsMetricSource -} - -var map_PodsMetricStatus = map[string]string{ - "": "PodsMetricStatus indicates the current value of a metric describing each pod in the current scale target (for example, transactions-processed-per-second).", - "metricName": "metricName is the name of the metric in question", - "currentAverageValue": "currentAverageValue is the current value of the average of the metric across all relevant pods (as a quantity)", - "selector": "selector is the string-encoded form of a standard kubernetes label selector for the given metric When set in the PodsMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics.", -} - -func (PodsMetricStatus) SwaggerDoc() map[string]string { - return map_PodsMetricStatus -} - -var map_ResourceMetricSource = map[string]string{ - "": "ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. Only one \"target\" type should be set.", - "name": "name is the name of the resource in question.", - "targetAverageUtilization": "targetAverageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.", - "targetAverageValue": "targetAverageValue is the target value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the \"pods\" metric source type.", -} - -func (ResourceMetricSource) SwaggerDoc() map[string]string { - return map_ResourceMetricSource -} - -var map_ResourceMetricStatus = map[string]string{ - "": "ResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "name": "name is the name of the resource in question.", - "currentAverageUtilization": "currentAverageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. It will only be present if `targetAverageValue` was set in the corresponding metric specification.", - "currentAverageValue": "currentAverageValue is the current value of the average of the resource metric across all relevant pods, as a raw value (instead of as a percentage of the request), similar to the \"pods\" metric source type. It will always be set, regardless of the corresponding metric specification.", -} - -func (ResourceMetricStatus) SwaggerDoc() map[string]string { - return map_ResourceMetricStatus -} - -// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go b/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go deleted file mode 100644 index 610e81f81a..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go +++ /dev/null @@ -1,525 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v2beta1 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerResourceMetricSource) DeepCopyInto(out *ContainerResourceMetricSource) { - *out = *in - if in.TargetAverageUtilization != nil { - in, out := &in.TargetAverageUtilization, &out.TargetAverageUtilization - *out = new(int32) - **out = **in - } - if in.TargetAverageValue != nil { - in, out := &in.TargetAverageValue, &out.TargetAverageValue - x := (*in).DeepCopy() - *out = &x - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourceMetricSource. -func (in *ContainerResourceMetricSource) DeepCopy() *ContainerResourceMetricSource { - if in == nil { - return nil - } - out := new(ContainerResourceMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerResourceMetricStatus) DeepCopyInto(out *ContainerResourceMetricStatus) { - *out = *in - if in.CurrentAverageUtilization != nil { - in, out := &in.CurrentAverageUtilization, &out.CurrentAverageUtilization - *out = new(int32) - **out = **in - } - out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourceMetricStatus. -func (in *ContainerResourceMetricStatus) DeepCopy() *ContainerResourceMetricStatus { - if in == nil { - return nil - } - out := new(ContainerResourceMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrossVersionObjectReference. -func (in *CrossVersionObjectReference) DeepCopy() *CrossVersionObjectReference { - if in == nil { - return nil - } - out := new(CrossVersionObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExternalMetricSource) DeepCopyInto(out *ExternalMetricSource) { - *out = *in - if in.MetricSelector != nil { - in, out := &in.MetricSelector, &out.MetricSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.TargetValue != nil { - in, out := &in.TargetValue, &out.TargetValue - x := (*in).DeepCopy() - *out = &x - } - if in.TargetAverageValue != nil { - in, out := &in.TargetAverageValue, &out.TargetAverageValue - x := (*in).DeepCopy() - *out = &x - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricSource. -func (in *ExternalMetricSource) DeepCopy() *ExternalMetricSource { - if in == nil { - return nil - } - out := new(ExternalMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExternalMetricStatus) DeepCopyInto(out *ExternalMetricStatus) { - *out = *in - if in.MetricSelector != nil { - in, out := &in.MetricSelector, &out.MetricSelector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - out.CurrentValue = in.CurrentValue.DeepCopy() - if in.CurrentAverageValue != nil { - in, out := &in.CurrentAverageValue, &out.CurrentAverageValue - x := (*in).DeepCopy() - *out = &x - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricStatus. -func (in *ExternalMetricStatus) DeepCopy() *ExternalMetricStatus { - if in == nil { - return nil - } - out := new(ExternalMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscaler) DeepCopyInto(out *HorizontalPodAutoscaler) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscaler. -func (in *HorizontalPodAutoscaler) DeepCopy() *HorizontalPodAutoscaler { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscaler) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HorizontalPodAutoscaler) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerCondition) DeepCopyInto(out *HorizontalPodAutoscalerCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerCondition. -func (in *HorizontalPodAutoscalerCondition) DeepCopy() *HorizontalPodAutoscalerCondition { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerList) DeepCopyInto(out *HorizontalPodAutoscalerList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]HorizontalPodAutoscaler, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerList. -func (in *HorizontalPodAutoscalerList) DeepCopy() *HorizontalPodAutoscalerList { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HorizontalPodAutoscalerList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerSpec) DeepCopyInto(out *HorizontalPodAutoscalerSpec) { - *out = *in - out.ScaleTargetRef = in.ScaleTargetRef - if in.MinReplicas != nil { - in, out := &in.MinReplicas, &out.MinReplicas - *out = new(int32) - **out = **in - } - if in.Metrics != nil { - in, out := &in.Metrics, &out.Metrics - *out = make([]MetricSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerSpec. -func (in *HorizontalPodAutoscalerSpec) DeepCopy() *HorizontalPodAutoscalerSpec { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerStatus) DeepCopyInto(out *HorizontalPodAutoscalerStatus) { - *out = *in - if in.ObservedGeneration != nil { - in, out := &in.ObservedGeneration, &out.ObservedGeneration - *out = new(int64) - **out = **in - } - if in.LastScaleTime != nil { - in, out := &in.LastScaleTime, &out.LastScaleTime - *out = (*in).DeepCopy() - } - if in.CurrentMetrics != nil { - in, out := &in.CurrentMetrics, &out.CurrentMetrics - *out = make([]MetricStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]HorizontalPodAutoscalerCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerStatus. -func (in *HorizontalPodAutoscalerStatus) DeepCopy() *HorizontalPodAutoscalerStatus { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricSpec) DeepCopyInto(out *MetricSpec) { - *out = *in - if in.Object != nil { - in, out := &in.Object, &out.Object - *out = new(ObjectMetricSource) - (*in).DeepCopyInto(*out) - } - if in.Pods != nil { - in, out := &in.Pods, &out.Pods - *out = new(PodsMetricSource) - (*in).DeepCopyInto(*out) - } - if in.Resource != nil { - in, out := &in.Resource, &out.Resource - *out = new(ResourceMetricSource) - (*in).DeepCopyInto(*out) - } - if in.ContainerResource != nil { - in, out := &in.ContainerResource, &out.ContainerResource - *out = new(ContainerResourceMetricSource) - (*in).DeepCopyInto(*out) - } - if in.External != nil { - in, out := &in.External, &out.External - *out = new(ExternalMetricSource) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricSpec. -func (in *MetricSpec) DeepCopy() *MetricSpec { - if in == nil { - return nil - } - out := new(MetricSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricStatus) DeepCopyInto(out *MetricStatus) { - *out = *in - if in.Object != nil { - in, out := &in.Object, &out.Object - *out = new(ObjectMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.Pods != nil { - in, out := &in.Pods, &out.Pods - *out = new(PodsMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.Resource != nil { - in, out := &in.Resource, &out.Resource - *out = new(ResourceMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.ContainerResource != nil { - in, out := &in.ContainerResource, &out.ContainerResource - *out = new(ContainerResourceMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.External != nil { - in, out := &in.External, &out.External - *out = new(ExternalMetricStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricStatus. -func (in *MetricStatus) DeepCopy() *MetricStatus { - if in == nil { - return nil - } - out := new(MetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) { - *out = *in - out.Target = in.Target - out.TargetValue = in.TargetValue.DeepCopy() - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.AverageValue != nil { - in, out := &in.AverageValue, &out.AverageValue - x := (*in).DeepCopy() - *out = &x - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMetricSource. -func (in *ObjectMetricSource) DeepCopy() *ObjectMetricSource { - if in == nil { - return nil - } - out := new(ObjectMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { - *out = *in - out.Target = in.Target - out.CurrentValue = in.CurrentValue.DeepCopy() - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - if in.AverageValue != nil { - in, out := &in.AverageValue, &out.AverageValue - x := (*in).DeepCopy() - *out = &x - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMetricStatus. -func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { - if in == nil { - return nil - } - out := new(ObjectMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { - *out = *in - out.TargetAverageValue = in.TargetAverageValue.DeepCopy() - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodsMetricSource. -func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { - if in == nil { - return nil - } - out := new(PodsMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { - *out = *in - out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodsMetricStatus. -func (in *PodsMetricStatus) DeepCopy() *PodsMetricStatus { - if in == nil { - return nil - } - out := new(PodsMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource) { - *out = *in - if in.TargetAverageUtilization != nil { - in, out := &in.TargetAverageUtilization, &out.TargetAverageUtilization - *out = new(int32) - **out = **in - } - if in.TargetAverageValue != nil { - in, out := &in.TargetAverageValue, &out.TargetAverageValue - x := (*in).DeepCopy() - *out = &x - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceMetricSource. -func (in *ResourceMetricSource) DeepCopy() *ResourceMetricSource { - if in == nil { - return nil - } - out := new(ResourceMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceMetricStatus) DeepCopyInto(out *ResourceMetricStatus) { - *out = *in - if in.CurrentAverageUtilization != nil { - in, out := &in.CurrentAverageUtilization, &out.CurrentAverageUtilization - *out = new(int32) - **out = **in - } - out.CurrentAverageValue = in.CurrentAverageValue.DeepCopy() - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceMetricStatus. -func (in *ResourceMetricStatus) DeepCopy() *ResourceMetricStatus { - if in == nil { - return nil - } - out := new(ResourceMetricStatus) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.model_name.go b/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.model_name.go deleted file mode 100644 index 2b8674e651..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.model_name.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by openapi-gen. DO NOT EDIT. - -package v2beta1 - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ContainerResourceMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ContainerResourceMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ContainerResourceMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ContainerResourceMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in CrossVersionObjectReference) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ExternalMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ExternalMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ExternalMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ExternalMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscaler) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscaler" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerCondition) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerCondition" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerList) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerList" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerSpec) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerSpec" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in MetricSpec) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.MetricSpec" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in MetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.MetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ObjectMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ObjectMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ObjectMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ObjectMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodsMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.PodsMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodsMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.PodsMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ResourceMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ResourceMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ResourceMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta1.ResourceMetricStatus" -} diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.prerelease-lifecycle.go deleted file mode 100644 index 3437454ee3..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.prerelease-lifecycle.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by prerelease-lifecycle-gen. DO NOT EDIT. - -package v2beta1 - -import ( - schema "k8s.io/apimachinery/pkg/runtime/schema" -) - -// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. -func (in *HorizontalPodAutoscaler) APILifecycleIntroduced() (major, minor int) { - return 1, 8 -} - -// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. -func (in *HorizontalPodAutoscaler) APILifecycleDeprecated() (major, minor int) { - return 1, 22 -} - -// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. -// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. -func (in *HorizontalPodAutoscaler) APILifecycleReplacement() schema.GroupVersionKind { - return schema.GroupVersionKind{Group: "autoscaling", Version: "v2", Kind: "HorizontalPodAutoscaler"} -} - -// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. -func (in *HorizontalPodAutoscaler) APILifecycleRemoved() (major, minor int) { - return 1, 25 -} - -// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. -func (in *HorizontalPodAutoscalerList) APILifecycleIntroduced() (major, minor int) { - return 1, 8 -} - -// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. -func (in *HorizontalPodAutoscalerList) APILifecycleDeprecated() (major, minor int) { - return 1, 22 -} - -// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. -// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. -func (in *HorizontalPodAutoscalerList) APILifecycleReplacement() schema.GroupVersionKind { - return schema.GroupVersionKind{Group: "autoscaling", Version: "v2beta2", Kind: "HorizontalPodAutoscalerList"} -} - -// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. -func (in *HorizontalPodAutoscalerList) APILifecycleRemoved() (major, minor int) { - return 1, 25 -} diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/generated.pb.go b/vendor/k8s.io/api/autoscaling/v2beta2/generated.pb.go deleted file mode 100644 index 87c8738678..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/generated.pb.go +++ /dev/null @@ -1,5817 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: k8s.io/api/autoscaling/v2beta2/generated.proto - -package v2beta2 - -import ( - fmt "fmt" - - io "io" - - k8s_io_api_core_v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -func (m *ContainerResourceMetricSource) Reset() { *m = ContainerResourceMetricSource{} } - -func (m *ContainerResourceMetricStatus) Reset() { *m = ContainerResourceMetricStatus{} } - -func (m *CrossVersionObjectReference) Reset() { *m = CrossVersionObjectReference{} } - -func (m *ExternalMetricSource) Reset() { *m = ExternalMetricSource{} } - -func (m *ExternalMetricStatus) Reset() { *m = ExternalMetricStatus{} } - -func (m *HPAScalingPolicy) Reset() { *m = HPAScalingPolicy{} } - -func (m *HPAScalingRules) Reset() { *m = HPAScalingRules{} } - -func (m *HorizontalPodAutoscaler) Reset() { *m = HorizontalPodAutoscaler{} } - -func (m *HorizontalPodAutoscalerBehavior) Reset() { *m = HorizontalPodAutoscalerBehavior{} } - -func (m *HorizontalPodAutoscalerCondition) Reset() { *m = HorizontalPodAutoscalerCondition{} } - -func (m *HorizontalPodAutoscalerList) Reset() { *m = HorizontalPodAutoscalerList{} } - -func (m *HorizontalPodAutoscalerSpec) Reset() { *m = HorizontalPodAutoscalerSpec{} } - -func (m *HorizontalPodAutoscalerStatus) Reset() { *m = HorizontalPodAutoscalerStatus{} } - -func (m *MetricIdentifier) Reset() { *m = MetricIdentifier{} } - -func (m *MetricSpec) Reset() { *m = MetricSpec{} } - -func (m *MetricStatus) Reset() { *m = MetricStatus{} } - -func (m *MetricTarget) Reset() { *m = MetricTarget{} } - -func (m *MetricValueStatus) Reset() { *m = MetricValueStatus{} } - -func (m *ObjectMetricSource) Reset() { *m = ObjectMetricSource{} } - -func (m *ObjectMetricStatus) Reset() { *m = ObjectMetricStatus{} } - -func (m *PodsMetricSource) Reset() { *m = PodsMetricSource{} } - -func (m *PodsMetricStatus) Reset() { *m = PodsMetricStatus{} } - -func (m *ResourceMetricSource) Reset() { *m = ResourceMetricSource{} } - -func (m *ResourceMetricStatus) Reset() { *m = ResourceMetricStatus{} } - -func (m *ContainerResourceMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerResourceMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerResourceMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Container) - copy(dAtA[i:], m.Container) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Container))) - i-- - dAtA[i] = 0x1a - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ContainerResourceMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ContainerResourceMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ContainerResourceMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Container) - copy(dAtA[i:], m.Container) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Container))) - i-- - dAtA[i] = 0x1a - { - size, err := m.Current.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *CrossVersionObjectReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *CrossVersionObjectReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CrossVersionObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.APIVersion) - copy(dAtA[i:], m.APIVersion) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIVersion))) - i-- - dAtA[i] = 0x1a - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x12 - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ExternalMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExternalMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExternalMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Metric.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ExternalMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ExternalMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ExternalMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Current.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Metric.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HPAScalingPolicy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HPAScalingPolicy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HPAScalingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i = encodeVarintGenerated(dAtA, i, uint64(m.PeriodSeconds)) - i-- - dAtA[i] = 0x18 - i = encodeVarintGenerated(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x10 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HPAScalingRules) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HPAScalingRules) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HPAScalingRules) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.StabilizationWindowSeconds != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.StabilizationWindowSeconds)) - i-- - dAtA[i] = 0x18 - } - if len(m.Policies) > 0 { - for iNdEx := len(m.Policies) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Policies[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.SelectPolicy != nil { - i -= len(*m.SelectPolicy) - copy(dAtA[i:], *m.SelectPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.SelectPolicy))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscaler) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscaler) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscaler) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerBehavior) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerBehavior) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerBehavior) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ScaleDown != nil { - { - size, err := m.ScaleDown.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ScaleUp != nil { - { - size, err := m.ScaleUp.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerCondition) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerCondition) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerCondition) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Message) - copy(dAtA[i:], m.Message) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Message))) - i-- - dAtA[i] = 0x2a - i -= len(m.Reason) - copy(dAtA[i:], m.Reason) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Reason))) - i-- - dAtA[i] = 0x22 - { - size, err := m.LastTransitionTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.Status) - copy(dAtA[i:], m.Status) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Status))) - i-- - dAtA[i] = 0x12 - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Behavior != nil { - { - size, err := m.Behavior.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if len(m.Metrics) > 0 { - for iNdEx := len(m.Metrics) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Metrics[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - i = encodeVarintGenerated(dAtA, i, uint64(m.MaxReplicas)) - i-- - dAtA[i] = 0x18 - if m.MinReplicas != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.MinReplicas)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.ScaleTargetRef.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *HorizontalPodAutoscalerStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HorizontalPodAutoscalerStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *HorizontalPodAutoscalerStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Conditions) > 0 { - for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.CurrentMetrics) > 0 { - for iNdEx := len(m.CurrentMetrics) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CurrentMetrics[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - i = encodeVarintGenerated(dAtA, i, uint64(m.DesiredReplicas)) - i-- - dAtA[i] = 0x20 - i = encodeVarintGenerated(dAtA, i, uint64(m.CurrentReplicas)) - i-- - dAtA[i] = 0x18 - if m.LastScaleTime != nil { - { - size, err := m.LastScaleTime.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.ObservedGeneration != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.ObservedGeneration)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MetricIdentifier) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricIdentifier) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricIdentifier) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Selector != nil { - { - size, err := m.Selector.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MetricSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContainerResource != nil { - { - size, err := m.ContainerResource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.External != nil { - { - size, err := m.External.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Resource != nil { - { - size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Pods != nil { - { - size, err := m.Pods.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ContainerResource != nil { - { - size, err := m.ContainerResource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - if m.External != nil { - { - size, err := m.External.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if m.Resource != nil { - { - size, err := m.Resource.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Pods != nil { - { - size, err := m.Pods.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Object != nil { - { - size, err := m.Object.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MetricTarget) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricTarget) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricTarget) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AverageUtilization != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.AverageUtilization)) - i-- - dAtA[i] = 0x20 - } - if m.AverageValue != nil { - { - size, err := m.AverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Value != nil { - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MetricValueStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MetricValueStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MetricValueStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AverageUtilization != nil { - i = encodeVarintGenerated(dAtA, i, uint64(*m.AverageUtilization)) - i-- - dAtA[i] = 0x18 - } - if m.AverageValue != nil { - { - size, err := m.AverageValue.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.Value != nil { - { - size, err := m.Value.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ObjectMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ObjectMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Metric.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.DescribedObject.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ObjectMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ObjectMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ObjectMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.DescribedObject.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - { - size, err := m.Current.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Metric.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodsMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodsMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodsMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Metric.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodsMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodsMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodsMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Current.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.Metric.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ResourceMetricSource) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResourceMetricSource) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResourceMetricSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Target.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ResourceMetricStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResourceMetricStatus) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ResourceMetricStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Current.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *ContainerResourceMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.Target.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Container) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ContainerResourceMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.Current.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Container) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *CrossVersionObjectReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.APIVersion) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ExternalMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Metric.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Target.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ExternalMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Metric.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Current.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *HPAScalingPolicy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.Value)) - n += 1 + sovGenerated(uint64(m.PeriodSeconds)) - return n -} - -func (m *HPAScalingRules) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SelectPolicy != nil { - l = len(*m.SelectPolicy) - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.Policies) > 0 { - for _, e := range m.Policies { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if m.StabilizationWindowSeconds != nil { - n += 1 + sovGenerated(uint64(*m.StabilizationWindowSeconds)) - } - return n -} - -func (m *HorizontalPodAutoscaler) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Status.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *HorizontalPodAutoscalerBehavior) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ScaleUp != nil { - l = m.ScaleUp.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ScaleDown != nil { - l = m.ScaleDown.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *HorizontalPodAutoscalerCondition) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Status) - n += 1 + l + sovGenerated(uint64(l)) - l = m.LastTransitionTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Reason) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Message) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *HorizontalPodAutoscalerList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *HorizontalPodAutoscalerSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ScaleTargetRef.Size() - n += 1 + l + sovGenerated(uint64(l)) - if m.MinReplicas != nil { - n += 1 + sovGenerated(uint64(*m.MinReplicas)) - } - n += 1 + sovGenerated(uint64(m.MaxReplicas)) - if len(m.Metrics) > 0 { - for _, e := range m.Metrics { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if m.Behavior != nil { - l = m.Behavior.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *HorizontalPodAutoscalerStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ObservedGeneration != nil { - n += 1 + sovGenerated(uint64(*m.ObservedGeneration)) - } - if m.LastScaleTime != nil { - l = m.LastScaleTime.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - n += 1 + sovGenerated(uint64(m.CurrentReplicas)) - n += 1 + sovGenerated(uint64(m.DesiredReplicas)) - if len(m.CurrentMetrics) > 0 { - for _, e := range m.CurrentMetrics { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - if len(m.Conditions) > 0 { - for _, e := range m.Conditions { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *MetricIdentifier) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - if m.Selector != nil { - l = m.Selector.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *MetricSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Pods != nil { - l = m.Pods.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Resource != nil { - l = m.Resource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.External != nil { - l = m.External.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ContainerResource != nil { - l = m.ContainerResource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *MetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - if m.Object != nil { - l = m.Object.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Pods != nil { - l = m.Pods.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Resource != nil { - l = m.Resource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.External != nil { - l = m.External.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.ContainerResource != nil { - l = m.ContainerResource.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *MetricTarget) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Type) - n += 1 + l + sovGenerated(uint64(l)) - if m.Value != nil { - l = m.Value.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.AverageValue != nil { - l = m.AverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.AverageUtilization != nil { - n += 1 + sovGenerated(uint64(*m.AverageUtilization)) - } - return n -} - -func (m *MetricValueStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Value != nil { - l = m.Value.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.AverageValue != nil { - l = m.AverageValue.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.AverageUtilization != nil { - n += 1 + sovGenerated(uint64(*m.AverageUtilization)) - } - return n -} - -func (m *ObjectMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.DescribedObject.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Target.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Metric.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ObjectMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Metric.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Current.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.DescribedObject.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodsMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Metric.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Target.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodsMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Metric.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Current.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ResourceMetricSource) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.Target.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *ResourceMetricStatus) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.Current.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ContainerResourceMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerResourceMetricSource{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "MetricTarget", "MetricTarget", 1), `&`, ``, 1) + `,`, - `Container:` + fmt.Sprintf("%v", this.Container) + `,`, - `}`, - }, "") - return s -} -func (this *ContainerResourceMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ContainerResourceMetricStatus{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Current:` + strings.Replace(strings.Replace(this.Current.String(), "MetricValueStatus", "MetricValueStatus", 1), `&`, ``, 1) + `,`, - `Container:` + fmt.Sprintf("%v", this.Container) + `,`, - `}`, - }, "") - return s -} -func (this *CrossVersionObjectReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&CrossVersionObjectReference{`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `APIVersion:` + fmt.Sprintf("%v", this.APIVersion) + `,`, - `}`, - }, "") - return s -} -func (this *ExternalMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExternalMetricSource{`, - `Metric:` + strings.Replace(strings.Replace(this.Metric.String(), "MetricIdentifier", "MetricIdentifier", 1), `&`, ``, 1) + `,`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "MetricTarget", "MetricTarget", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ExternalMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExternalMetricStatus{`, - `Metric:` + strings.Replace(strings.Replace(this.Metric.String(), "MetricIdentifier", "MetricIdentifier", 1), `&`, ``, 1) + `,`, - `Current:` + strings.Replace(strings.Replace(this.Current.String(), "MetricValueStatus", "MetricValueStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *HPAScalingPolicy) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&HPAScalingPolicy{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `PeriodSeconds:` + fmt.Sprintf("%v", this.PeriodSeconds) + `,`, - `}`, - }, "") - return s -} -func (this *HPAScalingRules) String() string { - if this == nil { - return "nil" - } - repeatedStringForPolicies := "[]HPAScalingPolicy{" - for _, f := range this.Policies { - repeatedStringForPolicies += strings.Replace(strings.Replace(f.String(), "HPAScalingPolicy", "HPAScalingPolicy", 1), `&`, ``, 1) + "," - } - repeatedStringForPolicies += "}" - s := strings.Join([]string{`&HPAScalingRules{`, - `SelectPolicy:` + valueToStringGenerated(this.SelectPolicy) + `,`, - `Policies:` + repeatedStringForPolicies + `,`, - `StabilizationWindowSeconds:` + valueToStringGenerated(this.StabilizationWindowSeconds) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscaler) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&HorizontalPodAutoscaler{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "HorizontalPodAutoscalerSpec", "HorizontalPodAutoscalerSpec", 1), `&`, ``, 1) + `,`, - `Status:` + strings.Replace(strings.Replace(this.Status.String(), "HorizontalPodAutoscalerStatus", "HorizontalPodAutoscalerStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerBehavior) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&HorizontalPodAutoscalerBehavior{`, - `ScaleUp:` + strings.Replace(this.ScaleUp.String(), "HPAScalingRules", "HPAScalingRules", 1) + `,`, - `ScaleDown:` + strings.Replace(this.ScaleDown.String(), "HPAScalingRules", "HPAScalingRules", 1) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerCondition) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&HorizontalPodAutoscalerCondition{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Status:` + fmt.Sprintf("%v", this.Status) + `,`, - `LastTransitionTime:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.LastTransitionTime), "Time", "v1.Time", 1), `&`, ``, 1) + `,`, - `Reason:` + fmt.Sprintf("%v", this.Reason) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]HorizontalPodAutoscaler{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "HorizontalPodAutoscaler", "HorizontalPodAutoscaler", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&HorizontalPodAutoscalerList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForMetrics := "[]MetricSpec{" - for _, f := range this.Metrics { - repeatedStringForMetrics += strings.Replace(strings.Replace(f.String(), "MetricSpec", "MetricSpec", 1), `&`, ``, 1) + "," - } - repeatedStringForMetrics += "}" - s := strings.Join([]string{`&HorizontalPodAutoscalerSpec{`, - `ScaleTargetRef:` + strings.Replace(strings.Replace(this.ScaleTargetRef.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, - `MinReplicas:` + valueToStringGenerated(this.MinReplicas) + `,`, - `MaxReplicas:` + fmt.Sprintf("%v", this.MaxReplicas) + `,`, - `Metrics:` + repeatedStringForMetrics + `,`, - `Behavior:` + strings.Replace(this.Behavior.String(), "HorizontalPodAutoscalerBehavior", "HorizontalPodAutoscalerBehavior", 1) + `,`, - `}`, - }, "") - return s -} -func (this *HorizontalPodAutoscalerStatus) String() string { - if this == nil { - return "nil" - } - repeatedStringForCurrentMetrics := "[]MetricStatus{" - for _, f := range this.CurrentMetrics { - repeatedStringForCurrentMetrics += strings.Replace(strings.Replace(f.String(), "MetricStatus", "MetricStatus", 1), `&`, ``, 1) + "," - } - repeatedStringForCurrentMetrics += "}" - repeatedStringForConditions := "[]HorizontalPodAutoscalerCondition{" - for _, f := range this.Conditions { - repeatedStringForConditions += strings.Replace(strings.Replace(f.String(), "HorizontalPodAutoscalerCondition", "HorizontalPodAutoscalerCondition", 1), `&`, ``, 1) + "," - } - repeatedStringForConditions += "}" - s := strings.Join([]string{`&HorizontalPodAutoscalerStatus{`, - `ObservedGeneration:` + valueToStringGenerated(this.ObservedGeneration) + `,`, - `LastScaleTime:` + strings.Replace(fmt.Sprintf("%v", this.LastScaleTime), "Time", "v1.Time", 1) + `,`, - `CurrentReplicas:` + fmt.Sprintf("%v", this.CurrentReplicas) + `,`, - `DesiredReplicas:` + fmt.Sprintf("%v", this.DesiredReplicas) + `,`, - `CurrentMetrics:` + repeatedStringForCurrentMetrics + `,`, - `Conditions:` + repeatedStringForConditions + `,`, - `}`, - }, "") - return s -} -func (this *MetricIdentifier) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricIdentifier{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Selector:` + strings.Replace(fmt.Sprintf("%v", this.Selector), "LabelSelector", "v1.LabelSelector", 1) + `,`, - `}`, - }, "") - return s -} -func (this *MetricSpec) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricSpec{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Object:` + strings.Replace(this.Object.String(), "ObjectMetricSource", "ObjectMetricSource", 1) + `,`, - `Pods:` + strings.Replace(this.Pods.String(), "PodsMetricSource", "PodsMetricSource", 1) + `,`, - `Resource:` + strings.Replace(this.Resource.String(), "ResourceMetricSource", "ResourceMetricSource", 1) + `,`, - `External:` + strings.Replace(this.External.String(), "ExternalMetricSource", "ExternalMetricSource", 1) + `,`, - `ContainerResource:` + strings.Replace(this.ContainerResource.String(), "ContainerResourceMetricSource", "ContainerResourceMetricSource", 1) + `,`, - `}`, - }, "") - return s -} -func (this *MetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricStatus{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Object:` + strings.Replace(this.Object.String(), "ObjectMetricStatus", "ObjectMetricStatus", 1) + `,`, - `Pods:` + strings.Replace(this.Pods.String(), "PodsMetricStatus", "PodsMetricStatus", 1) + `,`, - `Resource:` + strings.Replace(this.Resource.String(), "ResourceMetricStatus", "ResourceMetricStatus", 1) + `,`, - `External:` + strings.Replace(this.External.String(), "ExternalMetricStatus", "ExternalMetricStatus", 1) + `,`, - `ContainerResource:` + strings.Replace(this.ContainerResource.String(), "ContainerResourceMetricStatus", "ContainerResourceMetricStatus", 1) + `,`, - `}`, - }, "") - return s -} -func (this *MetricTarget) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricTarget{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Value:` + strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "resource.Quantity", 1) + `,`, - `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `AverageUtilization:` + valueToStringGenerated(this.AverageUtilization) + `,`, - `}`, - }, "") - return s -} -func (this *MetricValueStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&MetricValueStatus{`, - `Value:` + strings.Replace(fmt.Sprintf("%v", this.Value), "Quantity", "resource.Quantity", 1) + `,`, - `AverageValue:` + strings.Replace(fmt.Sprintf("%v", this.AverageValue), "Quantity", "resource.Quantity", 1) + `,`, - `AverageUtilization:` + valueToStringGenerated(this.AverageUtilization) + `,`, - `}`, - }, "") - return s -} -func (this *ObjectMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ObjectMetricSource{`, - `DescribedObject:` + strings.Replace(strings.Replace(this.DescribedObject.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "MetricTarget", "MetricTarget", 1), `&`, ``, 1) + `,`, - `Metric:` + strings.Replace(strings.Replace(this.Metric.String(), "MetricIdentifier", "MetricIdentifier", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ObjectMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ObjectMetricStatus{`, - `Metric:` + strings.Replace(strings.Replace(this.Metric.String(), "MetricIdentifier", "MetricIdentifier", 1), `&`, ``, 1) + `,`, - `Current:` + strings.Replace(strings.Replace(this.Current.String(), "MetricValueStatus", "MetricValueStatus", 1), `&`, ``, 1) + `,`, - `DescribedObject:` + strings.Replace(strings.Replace(this.DescribedObject.String(), "CrossVersionObjectReference", "CrossVersionObjectReference", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *PodsMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodsMetricSource{`, - `Metric:` + strings.Replace(strings.Replace(this.Metric.String(), "MetricIdentifier", "MetricIdentifier", 1), `&`, ``, 1) + `,`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "MetricTarget", "MetricTarget", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *PodsMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodsMetricStatus{`, - `Metric:` + strings.Replace(strings.Replace(this.Metric.String(), "MetricIdentifier", "MetricIdentifier", 1), `&`, ``, 1) + `,`, - `Current:` + strings.Replace(strings.Replace(this.Current.String(), "MetricValueStatus", "MetricValueStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ResourceMetricSource) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ResourceMetricSource{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Target:` + strings.Replace(strings.Replace(this.Target.String(), "MetricTarget", "MetricTarget", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *ResourceMetricStatus) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ResourceMetricStatus{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Current:` + strings.Replace(strings.Replace(this.Current.String(), "MetricValueStatus", "MetricValueStatus", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *ContainerResourceMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerResourceMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerResourceMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Container = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ContainerResourceMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContainerResourceMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContainerResourceMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Current.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Container", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Container = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CrossVersionObjectReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CrossVersionObjectReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CrossVersionObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field APIVersion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.APIVersion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExternalMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExternalMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExternalMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Metric.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ExternalMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExternalMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExternalMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Metric.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Current.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HPAScalingPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HPAScalingPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HPAScalingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = HPAScalingPolicyType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PeriodSeconds", wireType) - } - m.PeriodSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PeriodSeconds |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HPAScalingRules) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HPAScalingRules: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HPAScalingRules: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SelectPolicy", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := ScalingPolicySelect(dAtA[iNdEx:postIndex]) - m.SelectPolicy = &s - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Policies", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Policies = append(m.Policies, HPAScalingPolicy{}) - if err := m.Policies[len(m.Policies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StabilizationWindowSeconds", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.StabilizationWindowSeconds = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscaler) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscaler: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscaler: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerBehavior) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerBehavior: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerBehavior: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ScaleUp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ScaleUp == nil { - m.ScaleUp = &HPAScalingRules{} - } - if err := m.ScaleUp.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ScaleDown", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ScaleDown == nil { - m.ScaleDown = &HPAScalingRules{} - } - if err := m.ScaleDown.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerCondition) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerCondition: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerCondition: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = HorizontalPodAutoscalerConditionType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Status = k8s_io_api_core_v1.ConditionStatus(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastTransitionTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.LastTransitionTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Reason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Reason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, HorizontalPodAutoscaler{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ScaleTargetRef", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ScaleTargetRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinReplicas", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.MinReplicas = &v - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxReplicas", wireType) - } - m.MaxReplicas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxReplicas |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metrics", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metrics = append(m.Metrics, MetricSpec{}) - if err := m.Metrics[len(m.Metrics)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Behavior", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Behavior == nil { - m.Behavior = &HorizontalPodAutoscalerBehavior{} - } - if err := m.Behavior.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HorizontalPodAutoscalerStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HorizontalPodAutoscalerStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HorizontalPodAutoscalerStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ObservedGeneration = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastScaleTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.LastScaleTime == nil { - m.LastScaleTime = &v1.Time{} - } - if err := m.LastScaleTime.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentReplicas", wireType) - } - m.CurrentReplicas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CurrentReplicas |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DesiredReplicas", wireType) - } - m.DesiredReplicas = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DesiredReplicas |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrentMetrics", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CurrentMetrics = append(m.CurrentMetrics, MetricStatus{}) - if err := m.CurrentMetrics[len(m.CurrentMetrics)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Conditions = append(m.Conditions, HorizontalPodAutoscalerCondition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricIdentifier) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricIdentifier: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricIdentifier: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Selector == nil { - m.Selector = &v1.LabelSelector{} - } - if err := m.Selector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = MetricSourceType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Object == nil { - m.Object = &ObjectMetricSource{} - } - if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pods == nil { - m.Pods = &PodsMetricSource{} - } - if err := m.Pods.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Resource == nil { - m.Resource = &ResourceMetricSource{} - } - if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field External", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.External == nil { - m.External = &ExternalMetricSource{} - } - if err := m.External.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerResource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerResource == nil { - m.ContainerResource = &ContainerResourceMetricSource{} - } - if err := m.ContainerResource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = MetricSourceType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Object", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Object == nil { - m.Object = &ObjectMetricStatus{} - } - if err := m.Object.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pods", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Pods == nil { - m.Pods = &PodsMetricStatus{} - } - if err := m.Pods.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Resource == nil { - m.Resource = &ResourceMetricStatus{} - } - if err := m.Resource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field External", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.External == nil { - m.External = &ExternalMetricStatus{} - } - if err := m.External.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerResource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ContainerResource == nil { - m.ContainerResource = &ContainerResourceMetricStatus{} - } - if err := m.ContainerResource.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricTarget) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricTarget: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricTarget: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Type = MetricTargetType(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Value == nil { - m.Value = &resource.Quantity{} - } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AverageValue == nil { - m.AverageValue = &resource.Quantity{} - } - if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AverageUtilization", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AverageUtilization = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MetricValueStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MetricValueStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MetricValueStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Value == nil { - m.Value = &resource.Quantity{} - } - if err := m.Value.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AverageValue", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.AverageValue == nil { - m.AverageValue = &resource.Quantity{} - } - if err := m.AverageValue.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AverageUtilization", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AverageUtilization = &v - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ObjectMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DescribedObject", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DescribedObject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Metric.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ObjectMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ObjectMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ObjectMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Metric.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Current.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DescribedObject", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.DescribedObject.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodsMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodsMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodsMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Metric.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodsMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodsMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodsMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metric", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Metric.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Current.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResourceMetricSource) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResourceMetricSource: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceMetricSource: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Target", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Target.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResourceMetricStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResourceMetricStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceMetricStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Current", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Current.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/generated.proto b/vendor/k8s.io/api/autoscaling/v2beta2/generated.proto deleted file mode 100644 index 941d9752ae..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/generated.proto +++ /dev/null @@ -1,493 +0,0 @@ -/* -Copyright 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. -*/ - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package k8s.io.api.autoscaling.v2beta2; - -import "k8s.io/api/core/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "k8s.io/api/autoscaling/v2beta2"; - -// ContainerResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -message ContainerResourceMetricSource { - // name is the name of the resource in question. - optional string name = 1; - - // target specifies the target value for the given metric - optional MetricTarget target = 2; - - // container is the name of the container in the pods of the scaling target - optional string container = 3; -} - -// ContainerResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing a single container in each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -message ContainerResourceMetricStatus { - // name is the name of the resource in question. - optional string name = 1; - - // current contains the current value for the given metric - optional MetricValueStatus current = 2; - - // container is the name of the container in the pods of the scaling target - optional string container = 3; -} - -// CrossVersionObjectReference contains enough information to let you identify the referred resource. -message CrossVersionObjectReference { - // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - optional string kind = 1; - - // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - optional string name = 2; - - // apiVersion is the API version of the referent - // +optional - optional string apiVersion = 3; -} - -// ExternalMetricSource indicates how to scale on a metric not associated with -// any Kubernetes object (for example length of queue in cloud -// messaging service, or QPS from loadbalancer running outside of cluster). -message ExternalMetricSource { - // metric identifies the target metric by name and selector - optional MetricIdentifier metric = 1; - - // target specifies the target value for the given metric - optional MetricTarget target = 2; -} - -// ExternalMetricStatus indicates the current value of a global metric -// not associated with any Kubernetes object. -message ExternalMetricStatus { - // metric identifies the target metric by name and selector - optional MetricIdentifier metric = 1; - - // current contains the current value for the given metric - optional MetricValueStatus current = 2; -} - -// HPAScalingPolicy is a single policy which must hold true for a specified past interval. -message HPAScalingPolicy { - // type is used to specify the scaling policy. - optional string type = 1; - - // value contains the amount of change which is permitted by the policy. - // It must be greater than zero - optional int32 value = 2; - - // periodSeconds specifies the window of time for which the policy should hold true. - // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). - optional int32 periodSeconds = 3; -} - -// HPAScalingRules configures the scaling behavior for one direction. -// These Rules are applied after calculating DesiredReplicas from metrics for the HPA. -// They can limit the scaling velocity by specifying scaling policies. -// They can prevent flapping by specifying the stabilization window, so that the -// number of replicas is not set instantly, instead, the safest value from the stabilization -// window is chosen. -message HPAScalingRules { - // stabilizationWindowSeconds is the number of seconds for which past recommendations should be - // considered while scaling up or scaling down. - // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). - // If not set, use the default values: - // - For scale up: 0 (i.e. no stabilization is done). - // - For scale down: 300 (i.e. the stabilization window is 300 seconds long). - // +optional - optional int32 stabilizationWindowSeconds = 3; - - // selectPolicy is used to specify which policy should be used. - // If not set, the default value MaxPolicySelect is used. - // +optional - optional string selectPolicy = 1; - - // policies is a list of potential scaling polices which can be used during scaling. - // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid - // +optional - // +listType=atomic - repeated HPAScalingPolicy policies = 2; -} - -// HorizontalPodAutoscaler is the configuration for a horizontal pod -// autoscaler, which automatically manages the replica count of any resource -// implementing the scale subresource based on the metrics specified. -message HorizontalPodAutoscaler { - // metadata is the standard object metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // spec is the specification for the behaviour of the autoscaler. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional - optional HorizontalPodAutoscalerSpec spec = 2; - - // status is the current information about the autoscaler. - // +optional - optional HorizontalPodAutoscalerStatus status = 3; -} - -// HorizontalPodAutoscalerBehavior configures the scaling behavior of the target -// in both Up and Down directions (scaleUp and scaleDown fields respectively). -message HorizontalPodAutoscalerBehavior { - // scaleUp is scaling policy for scaling Up. - // If not set, the default value is the higher of: - // * increase no more than 4 pods per 60 seconds - // * double the number of pods per 60 seconds - // No stabilization is used. - // +optional - optional HPAScalingRules scaleUp = 1; - - // scaleDown is scaling policy for scaling Down. - // If not set, the default value is to allow to scale down to minReplicas pods, with a - // 300 second stabilization window (i.e., the highest recommendation for - // the last 300sec is used). - // +optional - optional HPAScalingRules scaleDown = 2; -} - -// HorizontalPodAutoscalerCondition describes the state of -// a HorizontalPodAutoscaler at a certain point. -message HorizontalPodAutoscalerCondition { - // type describes the current condition - optional string type = 1; - - // status is the status of the condition (True, False, Unknown) - optional string status = 2; - - // lastTransitionTime is the last time the condition transitioned from - // one status to another - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3; - - // reason is the reason for the condition's last transition. - // +optional - optional string reason = 4; - - // message is a human-readable explanation containing details about - // the transition - // +optional - optional string message = 5; -} - -// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. -message HorizontalPodAutoscalerList { - // metadata is the standard list metadata. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - // items is the list of horizontal pod autoscaler objects. - repeated HorizontalPodAutoscaler items = 2; -} - -// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. -message HorizontalPodAutoscalerSpec { - // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics - // should be collected, as well as to actually change the replica count. - optional CrossVersionObjectReference scaleTargetRef = 1; - - // minReplicas is the lower limit for the number of replicas to which the autoscaler - // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the - // alpha feature gate HPAScaleToZero is enabled and at least one Object or External - // metric is configured. Scaling is active as long as at least one metric value is - // available. - // +optional - optional int32 minReplicas = 2; - - // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. - // It cannot be less that minReplicas. - optional int32 maxReplicas = 3; - - // metrics contains the specifications for which to use to calculate the - // desired replica count (the maximum replica count across all metrics will - // be used). The desired replica count is calculated multiplying the - // ratio between the target value and the current value by the current - // number of pods. Ergo, metrics used must decrease as the pod count is - // increased, and vice-versa. See the individual metric source types for - // more information about how each type of metric must respond. - // If not set, the default metric will be set to 80% average CPU utilization. - // +optional - // +listType=atomic - repeated MetricSpec metrics = 4; - - // behavior configures the scaling behavior of the target - // in both Up and Down directions (scaleUp and scaleDown fields respectively). - // If not set, the default HPAScalingRules for scale up and scale down are used. - // +optional - optional HorizontalPodAutoscalerBehavior behavior = 5; -} - -// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. -message HorizontalPodAutoscalerStatus { - // observedGeneration is the most recent generation observed by this autoscaler. - // +optional - optional int64 observedGeneration = 1; - - // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, - // used by the autoscaler to control how often the number of pods is changed. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time lastScaleTime = 2; - - // currentReplicas is current number of replicas of pods managed by this autoscaler, - // as last seen by the autoscaler. - optional int32 currentReplicas = 3; - - // desiredReplicas is the desired number of replicas of pods managed by this autoscaler, - // as last calculated by the autoscaler. - optional int32 desiredReplicas = 4; - - // currentMetrics is the last read state of the metrics used by this autoscaler. - // +optional - // +listType=atomic - repeated MetricStatus currentMetrics = 5; - - // conditions is the set of conditions required for this autoscaler to scale its target, - // and indicates whether or not those conditions are met. - // +optional - // +listType=atomic - repeated HorizontalPodAutoscalerCondition conditions = 6; -} - -// MetricIdentifier defines the name and optionally selector for a metric -message MetricIdentifier { - // name is the name of the given metric - optional string name = 1; - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 2; -} - -// MetricSpec specifies how to scale based on a single metric -// (only `type` and one other matching field should be set at once). -message MetricSpec { - // type is the type of metric source. It should be one of "ContainerResource", "External", - // "Object", "Pods" or "Resource", each mapping to a matching field in the object. - optional string type = 1; - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - optional ObjectMetricSource object = 2; - - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - optional PodsMetricSource pods = 3; - - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - optional ResourceMetricSource resource = 4; - - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in - // each pod of the current scale target (e.g. CPU or memory). Such metrics are - // built in to Kubernetes, and have special scaling options on top of those - // available to normal per-pod metrics using the "pods" source. - // +optional - optional ContainerResourceMetricSource containerResource = 7; - - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - optional ExternalMetricSource external = 5; -} - -// MetricStatus describes the last-read state of a single metric. -message MetricStatus { - // type is the type of metric source. It will be one of "ContainerResource", "External", - // "Object", "Pods" or "Resource", each corresponds to a matching field in the object. - optional string type = 1; - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - optional ObjectMetricStatus object = 2; - - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - optional PodsMetricStatus pods = 3; - - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - optional ResourceMetricStatus resource = 4; - - // containerResource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - optional ContainerResourceMetricStatus containerResource = 7; - - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - optional ExternalMetricStatus external = 5; -} - -// MetricTarget defines the target value, average value, or average utilization of a specific metric -message MetricTarget { - // type represents whether the metric type is Utilization, Value, or AverageValue - optional string type = 1; - - // value is the target value of the metric (as a quantity). - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity value = 2; - - // averageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 3; - - // averageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // Currently only valid for Resource metric source type - // +optional - optional int32 averageUtilization = 4; -} - -// MetricValueStatus holds the current value for a metric -message MetricValueStatus { - // value is the current value of the metric (as a quantity). - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity value = 1; - - // averageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - optional .k8s.io.apimachinery.pkg.api.resource.Quantity averageValue = 2; - - // averageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // +optional - optional int32 averageUtilization = 3; -} - -// ObjectMetricSource indicates how to scale on a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -message ObjectMetricSource { - optional CrossVersionObjectReference describedObject = 1; - - // target specifies the target value for the given metric - optional MetricTarget target = 2; - - // metric identifies the target metric by name and selector - optional MetricIdentifier metric = 3; -} - -// ObjectMetricStatus indicates the current value of a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -message ObjectMetricStatus { - // metric identifies the target metric by name and selector - optional MetricIdentifier metric = 1; - - // current contains the current value for the given metric - optional MetricValueStatus current = 2; - - optional CrossVersionObjectReference describedObject = 3; -} - -// PodsMetricSource indicates how to scale on a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -// The values will be averaged together before being compared to the target -// value. -message PodsMetricSource { - // metric identifies the target metric by name and selector - optional MetricIdentifier metric = 1; - - // target specifies the target value for the given metric - optional MetricTarget target = 2; -} - -// PodsMetricStatus indicates the current value of a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -message PodsMetricStatus { - // metric identifies the target metric by name and selector - optional MetricIdentifier metric = 1; - - // current contains the current value for the given metric - optional MetricValueStatus current = 2; -} - -// ResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -message ResourceMetricSource { - // name is the name of the resource in question. - optional string name = 1; - - // target specifies the target value for the given metric - optional MetricTarget target = 2; -} - -// ResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -message ResourceMetricStatus { - // name is the name of the resource in question. - optional string name = 1; - - // current contains the current value for the given metric - optional MetricValueStatus current = 2; -} - diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/generated.protomessage.pb.go b/vendor/k8s.io/api/autoscaling/v2beta2/generated.protomessage.pb.go deleted file mode 100644 index 6064b1eb02..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/generated.protomessage.pb.go +++ /dev/null @@ -1,70 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v2beta2 - -func (*ContainerResourceMetricSource) ProtoMessage() {} - -func (*ContainerResourceMetricStatus) ProtoMessage() {} - -func (*CrossVersionObjectReference) ProtoMessage() {} - -func (*ExternalMetricSource) ProtoMessage() {} - -func (*ExternalMetricStatus) ProtoMessage() {} - -func (*HPAScalingPolicy) ProtoMessage() {} - -func (*HPAScalingRules) ProtoMessage() {} - -func (*HorizontalPodAutoscaler) ProtoMessage() {} - -func (*HorizontalPodAutoscalerBehavior) ProtoMessage() {} - -func (*HorizontalPodAutoscalerCondition) ProtoMessage() {} - -func (*HorizontalPodAutoscalerList) ProtoMessage() {} - -func (*HorizontalPodAutoscalerSpec) ProtoMessage() {} - -func (*HorizontalPodAutoscalerStatus) ProtoMessage() {} - -func (*MetricIdentifier) ProtoMessage() {} - -func (*MetricSpec) ProtoMessage() {} - -func (*MetricStatus) ProtoMessage() {} - -func (*MetricTarget) ProtoMessage() {} - -func (*MetricValueStatus) ProtoMessage() {} - -func (*ObjectMetricSource) ProtoMessage() {} - -func (*ObjectMetricStatus) ProtoMessage() {} - -func (*PodsMetricSource) ProtoMessage() {} - -func (*PodsMetricStatus) ProtoMessage() {} - -func (*ResourceMetricSource) ProtoMessage() {} - -func (*ResourceMetricStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/types.go b/vendor/k8s.io/api/autoscaling/v2beta2/types.go deleted file mode 100644 index bc9677b147..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/types.go +++ /dev/null @@ -1,578 +0,0 @@ -/* -Copyright 2018 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. -*/ - -// +k8s:openapi-gen=true - -package v2beta2 - -import ( - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/resource" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:prerelease-lifecycle-gen:introduced=1.12 -// +k8s:prerelease-lifecycle-gen:deprecated=1.23 -// +k8s:prerelease-lifecycle-gen:replacement=autoscaling,v2,HorizontalPodAutoscaler - -// HorizontalPodAutoscaler is the configuration for a horizontal pod -// autoscaler, which automatically manages the replica count of any resource -// implementing the scale subresource based on the metrics specified. -type HorizontalPodAutoscaler struct { - metav1.TypeMeta `json:",inline"` - // metadata is the standard object metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // spec is the specification for the behaviour of the autoscaler. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - // +optional - Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` - - // status is the current information about the autoscaler. - // +optional - Status HorizontalPodAutoscalerStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` -} - -// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. -type HorizontalPodAutoscalerSpec struct { - // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics - // should be collected, as well as to actually change the replica count. - ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef" protobuf:"bytes,1,opt,name=scaleTargetRef"` - // minReplicas is the lower limit for the number of replicas to which the autoscaler - // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the - // alpha feature gate HPAScaleToZero is enabled and at least one Object or External - // metric is configured. Scaling is active as long as at least one metric value is - // available. - // +optional - MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"` - - // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. - // It cannot be less that minReplicas. - MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"` - - // metrics contains the specifications for which to use to calculate the - // desired replica count (the maximum replica count across all metrics will - // be used). The desired replica count is calculated multiplying the - // ratio between the target value and the current value by the current - // number of pods. Ergo, metrics used must decrease as the pod count is - // increased, and vice-versa. See the individual metric source types for - // more information about how each type of metric must respond. - // If not set, the default metric will be set to 80% average CPU utilization. - // +optional - // +listType=atomic - Metrics []MetricSpec `json:"metrics,omitempty" protobuf:"bytes,4,rep,name=metrics"` - - // behavior configures the scaling behavior of the target - // in both Up and Down directions (scaleUp and scaleDown fields respectively). - // If not set, the default HPAScalingRules for scale up and scale down are used. - // +optional - Behavior *HorizontalPodAutoscalerBehavior `json:"behavior,omitempty" protobuf:"bytes,5,opt,name=behavior"` -} - -// CrossVersionObjectReference contains enough information to let you identify the referred resource. -type CrossVersionObjectReference struct { - // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` - - // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - Name string `json:"name" protobuf:"bytes,2,opt,name=name"` - - // apiVersion is the API version of the referent - // +optional - APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"` -} - -// MetricSpec specifies how to scale based on a single metric -// (only `type` and one other matching field should be set at once). -type MetricSpec struct { - // type is the type of metric source. It should be one of "ContainerResource", "External", - // "Object", "Pods" or "Resource", each mapping to a matching field in the object. - Type MetricSourceType `json:"type" protobuf:"bytes,1,name=type"` - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - Object *ObjectMetricSource `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` - - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - Pods *PodsMetricSource `json:"pods,omitempty" protobuf:"bytes,3,opt,name=pods"` - - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - Resource *ResourceMetricSource `json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"` - - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in - // each pod of the current scale target (e.g. CPU or memory). Such metrics are - // built in to Kubernetes, and have special scaling options on top of those - // available to normal per-pod metrics using the "pods" source. - // +optional - ContainerResource *ContainerResourceMetricSource `json:"containerResource,omitempty" protobuf:"bytes,7,opt,name=containerResource"` - - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - External *ExternalMetricSource `json:"external,omitempty" protobuf:"bytes,5,opt,name=external"` -} - -// HorizontalPodAutoscalerBehavior configures the scaling behavior of the target -// in both Up and Down directions (scaleUp and scaleDown fields respectively). -type HorizontalPodAutoscalerBehavior struct { - // scaleUp is scaling policy for scaling Up. - // If not set, the default value is the higher of: - // * increase no more than 4 pods per 60 seconds - // * double the number of pods per 60 seconds - // No stabilization is used. - // +optional - ScaleUp *HPAScalingRules `json:"scaleUp,omitempty" protobuf:"bytes,1,opt,name=scaleUp"` - - // scaleDown is scaling policy for scaling Down. - // If not set, the default value is to allow to scale down to minReplicas pods, with a - // 300 second stabilization window (i.e., the highest recommendation for - // the last 300sec is used). - // +optional - ScaleDown *HPAScalingRules `json:"scaleDown,omitempty" protobuf:"bytes,2,opt,name=scaleDown"` -} - -// ScalingPolicySelect is used to specify which policy should be used while scaling in a certain direction -type ScalingPolicySelect string - -const ( - // MaxPolicySelect selects the policy with the highest possible change. - MaxPolicySelect ScalingPolicySelect = "Max" - // MinPolicySelect selects the policy with the lowest possible change. - MinPolicySelect ScalingPolicySelect = "Min" - // DisabledPolicySelect disables the scaling in this direction. - DisabledPolicySelect ScalingPolicySelect = "Disabled" -) - -// HPAScalingRules configures the scaling behavior for one direction. -// These Rules are applied after calculating DesiredReplicas from metrics for the HPA. -// They can limit the scaling velocity by specifying scaling policies. -// They can prevent flapping by specifying the stabilization window, so that the -// number of replicas is not set instantly, instead, the safest value from the stabilization -// window is chosen. -type HPAScalingRules struct { - // stabilizationWindowSeconds is the number of seconds for which past recommendations should be - // considered while scaling up or scaling down. - // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). - // If not set, use the default values: - // - For scale up: 0 (i.e. no stabilization is done). - // - For scale down: 300 (i.e. the stabilization window is 300 seconds long). - // +optional - StabilizationWindowSeconds *int32 `json:"stabilizationWindowSeconds,omitempty" protobuf:"varint,3,opt,name=stabilizationWindowSeconds"` - - // selectPolicy is used to specify which policy should be used. - // If not set, the default value MaxPolicySelect is used. - // +optional - SelectPolicy *ScalingPolicySelect `json:"selectPolicy,omitempty" protobuf:"bytes,1,opt,name=selectPolicy"` - - // policies is a list of potential scaling polices which can be used during scaling. - // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid - // +optional - // +listType=atomic - Policies []HPAScalingPolicy `json:"policies,omitempty" protobuf:"bytes,2,rep,name=policies"` -} - -// HPAScalingPolicyType is the type of the policy which could be used while making scaling decisions. -type HPAScalingPolicyType string - -const ( - // PodsScalingPolicy is a policy used to specify a change in absolute number of pods. - PodsScalingPolicy HPAScalingPolicyType = "Pods" - // PercentScalingPolicy is a policy used to specify a relative amount of change with respect to - // the current number of pods. - PercentScalingPolicy HPAScalingPolicyType = "Percent" -) - -// HPAScalingPolicy is a single policy which must hold true for a specified past interval. -type HPAScalingPolicy struct { - // type is used to specify the scaling policy. - Type HPAScalingPolicyType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=HPAScalingPolicyType"` - - // value contains the amount of change which is permitted by the policy. - // It must be greater than zero - Value int32 `json:"value" protobuf:"varint,2,opt,name=value"` - - // periodSeconds specifies the window of time for which the policy should hold true. - // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). - PeriodSeconds int32 `json:"periodSeconds" protobuf:"varint,3,opt,name=periodSeconds"` -} - -// MetricSourceType indicates the type of metric. -type MetricSourceType string - -const ( - // ObjectMetricSourceType is a metric describing a kubernetes object - // (for example, hits-per-second on an Ingress object). - ObjectMetricSourceType MetricSourceType = "Object" - // PodsMetricSourceType is a metric describing each pod in the current scale - // target (for example, transactions-processed-per-second). The values - // will be averaged together before being compared to the target value. - PodsMetricSourceType MetricSourceType = "Pods" - // ResourceMetricSourceType is a resource metric known to Kubernetes, as - // specified in requests and limits, describing each pod in the current - // scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics (the "pods" source). - ResourceMetricSourceType MetricSourceType = "Resource" - // ContainerResourceMetricSourceType is a resource metric known to Kubernetes, as - // specified in requests and limits, describing a single container in each pod in the current - // scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics (the "pods" source). - ContainerResourceMetricSourceType MetricSourceType = "ContainerResource" - // ExternalMetricSourceType is a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - ExternalMetricSourceType MetricSourceType = "External" -) - -// ObjectMetricSource indicates how to scale on a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricSource struct { - DescribedObject CrossVersionObjectReference `json:"describedObject" protobuf:"bytes,1,name=describedObject"` - // target specifies the target value for the given metric - Target MetricTarget `json:"target" protobuf:"bytes,2,name=target"` - - // metric identifies the target metric by name and selector - Metric MetricIdentifier `json:"metric" protobuf:"bytes,3,name=metric"` -} - -// PodsMetricSource indicates how to scale on a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -// The values will be averaged together before being compared to the target -// value. -type PodsMetricSource struct { - // metric identifies the target metric by name and selector - Metric MetricIdentifier `json:"metric" protobuf:"bytes,1,name=metric"` - - // target specifies the target value for the given metric - Target MetricTarget `json:"target" protobuf:"bytes,2,name=target"` -} - -// ResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ResourceMetricSource struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - - // target specifies the target value for the given metric - Target MetricTarget `json:"target" protobuf:"bytes,2,name=target"` -} - -// ContainerResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ContainerResourceMetricSource struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - - // target specifies the target value for the given metric - Target MetricTarget `json:"target" protobuf:"bytes,2,name=target"` - - // container is the name of the container in the pods of the scaling target - Container string `json:"container" protobuf:"bytes,3,opt,name=container"` -} - -// ExternalMetricSource indicates how to scale on a metric not associated with -// any Kubernetes object (for example length of queue in cloud -// messaging service, or QPS from loadbalancer running outside of cluster). -type ExternalMetricSource struct { - // metric identifies the target metric by name and selector - Metric MetricIdentifier `json:"metric" protobuf:"bytes,1,name=metric"` - - // target specifies the target value for the given metric - Target MetricTarget `json:"target" protobuf:"bytes,2,name=target"` -} - -// MetricIdentifier defines the name and optionally selector for a metric -type MetricIdentifier struct { - // name is the name of the given metric - Name string `json:"name" protobuf:"bytes,1,name=name"` - - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - // +optional - Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,name=selector"` -} - -// MetricTarget defines the target value, average value, or average utilization of a specific metric -type MetricTarget struct { - // type represents whether the metric type is Utilization, Value, or AverageValue - Type MetricTargetType `json:"type" protobuf:"bytes,1,name=type"` - - // value is the target value of the metric (as a quantity). - // +optional - Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"` - - // averageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,3,opt,name=averageValue"` - - // averageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // Currently only valid for Resource metric source type - // +optional - AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,4,opt,name=averageUtilization"` -} - -// MetricTargetType specifies the type of metric being targeted, and should be either -// "Value", "AverageValue", or "Utilization" -type MetricTargetType string - -const ( - // UtilizationMetricType declares a MetricTarget is an AverageUtilization value - UtilizationMetricType MetricTargetType = "Utilization" - // ValueMetricType declares a MetricTarget is a raw value - ValueMetricType MetricTargetType = "Value" - // AverageValueMetricType declares a MetricTarget is an - AverageValueMetricType MetricTargetType = "AverageValue" -) - -// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. -type HorizontalPodAutoscalerStatus struct { - // observedGeneration is the most recent generation observed by this autoscaler. - // +optional - ObservedGeneration *int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"` - - // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, - // used by the autoscaler to control how often the number of pods is changed. - // +optional - LastScaleTime *metav1.Time `json:"lastScaleTime,omitempty" protobuf:"bytes,2,opt,name=lastScaleTime"` - - // currentReplicas is current number of replicas of pods managed by this autoscaler, - // as last seen by the autoscaler. - CurrentReplicas int32 `json:"currentReplicas" protobuf:"varint,3,opt,name=currentReplicas"` - - // desiredReplicas is the desired number of replicas of pods managed by this autoscaler, - // as last calculated by the autoscaler. - DesiredReplicas int32 `json:"desiredReplicas" protobuf:"varint,4,opt,name=desiredReplicas"` - - // currentMetrics is the last read state of the metrics used by this autoscaler. - // +optional - // +listType=atomic - CurrentMetrics []MetricStatus `json:"currentMetrics" protobuf:"bytes,5,rep,name=currentMetrics"` - - // conditions is the set of conditions required for this autoscaler to scale its target, - // and indicates whether or not those conditions are met. - // +optional - // +listType=atomic - Conditions []HorizontalPodAutoscalerCondition `json:"conditions" protobuf:"bytes,6,rep,name=conditions"` -} - -// HorizontalPodAutoscalerConditionType are the valid conditions of -// a HorizontalPodAutoscaler. -type HorizontalPodAutoscalerConditionType string - -const ( - // ScalingActive indicates that the HPA controller is able to scale if necessary: - // it's correctly configured, can fetch the desired metrics, and isn't disabled. - ScalingActive HorizontalPodAutoscalerConditionType = "ScalingActive" - // AbleToScale indicates a lack of transient issues which prevent scaling from occurring, - // such as being in a backoff window, or being unable to access/update the target scale. - AbleToScale HorizontalPodAutoscalerConditionType = "AbleToScale" - // ScalingLimited indicates that the calculated scale based on metrics would be above or - // below the range for the HPA, and has thus been capped. - ScalingLimited HorizontalPodAutoscalerConditionType = "ScalingLimited" -) - -// HorizontalPodAutoscalerCondition describes the state of -// a HorizontalPodAutoscaler at a certain point. -type HorizontalPodAutoscalerCondition struct { - // type describes the current condition - Type HorizontalPodAutoscalerConditionType `json:"type" protobuf:"bytes,1,name=type"` - - // status is the status of the condition (True, False, Unknown) - Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,name=status"` - - // lastTransitionTime is the last time the condition transitioned from - // one status to another - // +optional - LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"` - - // reason is the reason for the condition's last transition. - // +optional - Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"` - - // message is a human-readable explanation containing details about - // the transition - // +optional - Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"` -} - -// MetricStatus describes the last-read state of a single metric. -type MetricStatus struct { - // type is the type of metric source. It will be one of "ContainerResource", "External", - // "Object", "Pods" or "Resource", each corresponds to a matching field in the object. - Type MetricSourceType `json:"type" protobuf:"bytes,1,name=type"` - - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - // +optional - Object *ObjectMetricStatus `json:"object,omitempty" protobuf:"bytes,2,opt,name=object"` - - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - // +optional - Pods *PodsMetricStatus `json:"pods,omitempty" protobuf:"bytes,3,opt,name=pods"` - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - Resource *ResourceMetricStatus `json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"` - - // containerResource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - // +optional - ContainerResource *ContainerResourceMetricStatus `json:"containerResource,omitempty" protobuf:"bytes,7,opt,name=containerResource"` - - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - // +optional - External *ExternalMetricStatus `json:"external,omitempty" protobuf:"bytes,5,opt,name=external"` -} - -// ObjectMetricStatus indicates the current value of a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricStatus struct { - // metric identifies the target metric by name and selector - Metric MetricIdentifier `json:"metric" protobuf:"bytes,1,name=metric"` - - // current contains the current value for the given metric - Current MetricValueStatus `json:"current" protobuf:"bytes,2,name=current"` - - DescribedObject CrossVersionObjectReference `json:"describedObject" protobuf:"bytes,3,name=describedObject"` -} - -// PodsMetricStatus indicates the current value of a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -type PodsMetricStatus struct { - // metric identifies the target metric by name and selector - Metric MetricIdentifier `json:"metric" protobuf:"bytes,1,name=metric"` - - // current contains the current value for the given metric - Current MetricValueStatus `json:"current" protobuf:"bytes,2,name=current"` -} - -// ResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ResourceMetricStatus struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - - // current contains the current value for the given metric - Current MetricValueStatus `json:"current" protobuf:"bytes,2,name=current"` -} - -// ContainerResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing a single container in each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ContainerResourceMetricStatus struct { - // name is the name of the resource in question. - Name v1.ResourceName `json:"name" protobuf:"bytes,1,name=name"` - - // current contains the current value for the given metric - Current MetricValueStatus `json:"current" protobuf:"bytes,2,name=current"` - - // container is the name of the container in the pods of the scaling target - Container string `json:"container" protobuf:"bytes,3,opt,name=container"` -} - -// ExternalMetricStatus indicates the current value of a global metric -// not associated with any Kubernetes object. -type ExternalMetricStatus struct { - // metric identifies the target metric by name and selector - Metric MetricIdentifier `json:"metric" protobuf:"bytes,1,name=metric"` - - // current contains the current value for the given metric - Current MetricValueStatus `json:"current" protobuf:"bytes,2,name=current"` -} - -// MetricValueStatus holds the current value for a metric -type MetricValueStatus struct { - // value is the current value of the metric (as a quantity). - // +optional - Value *resource.Quantity `json:"value,omitempty" protobuf:"bytes,1,opt,name=value"` - - // averageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - // +optional - AverageValue *resource.Quantity `json:"averageValue,omitempty" protobuf:"bytes,2,opt,name=averageValue"` - - // averageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // +optional - AverageUtilization *int32 `json:"averageUtilization,omitempty" protobuf:"bytes,3,opt,name=averageUtilization"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +k8s:prerelease-lifecycle-gen:introduced=1.12 -// +k8s:prerelease-lifecycle-gen:deprecated=1.22 - -// HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects. -type HorizontalPodAutoscalerList struct { - metav1.TypeMeta `json:",inline"` - // metadata is the standard list metadata. - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of horizontal pod autoscaler objects. - Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"` -} diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/types_swagger_doc_generated.go b/vendor/k8s.io/api/autoscaling/v2beta2/types_swagger_doc_generated.go deleted file mode 100644 index 5d4bb86b83..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/types_swagger_doc_generated.go +++ /dev/null @@ -1,297 +0,0 @@ -/* -Copyright 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. -*/ - -package v2beta2 - -// This file contains a collection of methods that can be used from go-restful to -// generate Swagger API documentation for its models. Please read this PR for more -// information on the implementation: https://github.com/emicklei/go-restful/pull/215 -// -// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if -// they are on one line! For multiple line or blocks that you want to ignore use ---. -// Any context after a --- is ignored. -// -// Those methods can be generated by using hack/update-codegen.sh - -// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. -var map_ContainerResourceMetricSource = map[string]string{ - "": "ContainerResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. Only one \"target\" type should be set.", - "name": "name is the name of the resource in question.", - "target": "target specifies the target value for the given metric", - "container": "container is the name of the container in the pods of the scaling target", -} - -func (ContainerResourceMetricSource) SwaggerDoc() map[string]string { - return map_ContainerResourceMetricSource -} - -var map_ContainerResourceMetricStatus = map[string]string{ - "": "ContainerResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "name": "name is the name of the resource in question.", - "current": "current contains the current value for the given metric", - "container": "container is the name of the container in the pods of the scaling target", -} - -func (ContainerResourceMetricStatus) SwaggerDoc() map[string]string { - return map_ContainerResourceMetricStatus -} - -var map_CrossVersionObjectReference = map[string]string{ - "": "CrossVersionObjectReference contains enough information to let you identify the referred resource.", - "kind": "kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", - "name": "name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names", - "apiVersion": "apiVersion is the API version of the referent", -} - -func (CrossVersionObjectReference) SwaggerDoc() map[string]string { - return map_CrossVersionObjectReference -} - -var map_ExternalMetricSource = map[string]string{ - "": "ExternalMetricSource indicates how to scale on a metric not associated with any Kubernetes object (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).", - "metric": "metric identifies the target metric by name and selector", - "target": "target specifies the target value for the given metric", -} - -func (ExternalMetricSource) SwaggerDoc() map[string]string { - return map_ExternalMetricSource -} - -var map_ExternalMetricStatus = map[string]string{ - "": "ExternalMetricStatus indicates the current value of a global metric not associated with any Kubernetes object.", - "metric": "metric identifies the target metric by name and selector", - "current": "current contains the current value for the given metric", -} - -func (ExternalMetricStatus) SwaggerDoc() map[string]string { - return map_ExternalMetricStatus -} - -var map_HPAScalingPolicy = map[string]string{ - "": "HPAScalingPolicy is a single policy which must hold true for a specified past interval.", - "type": "type is used to specify the scaling policy.", - "value": "value contains the amount of change which is permitted by the policy. It must be greater than zero", - "periodSeconds": "periodSeconds specifies the window of time for which the policy should hold true. PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min).", -} - -func (HPAScalingPolicy) SwaggerDoc() map[string]string { - return map_HPAScalingPolicy -} - -var map_HPAScalingRules = map[string]string{ - "": "HPAScalingRules configures the scaling behavior for one direction. These Rules are applied after calculating DesiredReplicas from metrics for the HPA. They can limit the scaling velocity by specifying scaling policies. They can prevent flapping by specifying the stabilization window, so that the number of replicas is not set instantly, instead, the safest value from the stabilization window is chosen.", - "stabilizationWindowSeconds": "stabilizationWindowSeconds is the number of seconds for which past recommendations should be considered while scaling up or scaling down. StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). If not set, use the default values: - For scale up: 0 (i.e. no stabilization is done). - For scale down: 300 (i.e. the stabilization window is 300 seconds long).", - "selectPolicy": "selectPolicy is used to specify which policy should be used. If not set, the default value MaxPolicySelect is used.", - "policies": "policies is a list of potential scaling polices which can be used during scaling. At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid", -} - -func (HPAScalingRules) SwaggerDoc() map[string]string { - return map_HPAScalingRules -} - -var map_HorizontalPodAutoscaler = map[string]string{ - "": "HorizontalPodAutoscaler is the configuration for a horizontal pod autoscaler, which automatically manages the replica count of any resource implementing the scale subresource based on the metrics specified.", - "metadata": "metadata is the standard object metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "spec": "spec is the specification for the behaviour of the autoscaler. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.", - "status": "status is the current information about the autoscaler.", -} - -func (HorizontalPodAutoscaler) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscaler -} - -var map_HorizontalPodAutoscalerBehavior = map[string]string{ - "": "HorizontalPodAutoscalerBehavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively).", - "scaleUp": "scaleUp is scaling policy for scaling Up. If not set, the default value is the higher of:\n * increase no more than 4 pods per 60 seconds\n * double the number of pods per 60 seconds\nNo stabilization is used.", - "scaleDown": "scaleDown is scaling policy for scaling Down. If not set, the default value is to allow to scale down to minReplicas pods, with a 300 second stabilization window (i.e., the highest recommendation for the last 300sec is used).", -} - -func (HorizontalPodAutoscalerBehavior) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerBehavior -} - -var map_HorizontalPodAutoscalerCondition = map[string]string{ - "": "HorizontalPodAutoscalerCondition describes the state of a HorizontalPodAutoscaler at a certain point.", - "type": "type describes the current condition", - "status": "status is the status of the condition (True, False, Unknown)", - "lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another", - "reason": "reason is the reason for the condition's last transition.", - "message": "message is a human-readable explanation containing details about the transition", -} - -func (HorizontalPodAutoscalerCondition) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerCondition -} - -var map_HorizontalPodAutoscalerList = map[string]string{ - "": "HorizontalPodAutoscalerList is a list of horizontal pod autoscaler objects.", - "metadata": "metadata is the standard list metadata.", - "items": "items is the list of horizontal pod autoscaler objects.", -} - -func (HorizontalPodAutoscalerList) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerList -} - -var map_HorizontalPodAutoscalerSpec = map[string]string{ - "": "HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler.", - "scaleTargetRef": "scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics should be collected, as well as to actually change the replica count.", - "minReplicas": "minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the alpha feature gate HPAScaleToZero is enabled and at least one Object or External metric is configured. Scaling is active as long as at least one metric value is available.", - "maxReplicas": "maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. It cannot be less that minReplicas.", - "metrics": "metrics contains the specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization.", - "behavior": "behavior configures the scaling behavior of the target in both Up and Down directions (scaleUp and scaleDown fields respectively). If not set, the default HPAScalingRules for scale up and scale down are used.", -} - -func (HorizontalPodAutoscalerSpec) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerSpec -} - -var map_HorizontalPodAutoscalerStatus = map[string]string{ - "": "HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.", - "observedGeneration": "observedGeneration is the most recent generation observed by this autoscaler.", - "lastScaleTime": "lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, used by the autoscaler to control how often the number of pods is changed.", - "currentReplicas": "currentReplicas is current number of replicas of pods managed by this autoscaler, as last seen by the autoscaler.", - "desiredReplicas": "desiredReplicas is the desired number of replicas of pods managed by this autoscaler, as last calculated by the autoscaler.", - "currentMetrics": "currentMetrics is the last read state of the metrics used by this autoscaler.", - "conditions": "conditions is the set of conditions required for this autoscaler to scale its target, and indicates whether or not those conditions are met.", -} - -func (HorizontalPodAutoscalerStatus) SwaggerDoc() map[string]string { - return map_HorizontalPodAutoscalerStatus -} - -var map_MetricIdentifier = map[string]string{ - "": "MetricIdentifier defines the name and optionally selector for a metric", - "name": "name is the name of the given metric", - "selector": "selector is the string-encoded form of a standard kubernetes label selector for the given metric When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. When unset, just the metricName will be used to gather metrics.", -} - -func (MetricIdentifier) SwaggerDoc() map[string]string { - return map_MetricIdentifier -} - -var map_MetricSpec = map[string]string{ - "": "MetricSpec specifies how to scale based on a single metric (only `type` and one other matching field should be set at once).", - "type": "type is the type of metric source. It should be one of \"ContainerResource\", \"External\", \"Object\", \"Pods\" or \"Resource\", each mapping to a matching field in the object.", - "object": "object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).", - "pods": "pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", - "resource": "resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "containerResource": "container resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod of the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "external": "external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).", -} - -func (MetricSpec) SwaggerDoc() map[string]string { - return map_MetricSpec -} - -var map_MetricStatus = map[string]string{ - "": "MetricStatus describes the last-read state of a single metric.", - "type": "type is the type of metric source. It will be one of \"ContainerResource\", \"External\", \"Object\", \"Pods\" or \"Resource\", each corresponds to a matching field in the object.", - "object": "object refers to a metric describing a single kubernetes object (for example, hits-per-second on an Ingress object).", - "pods": "pods refers to a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", - "resource": "resource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "containerResource": "containerResource refers to a resource metric (such as those specified in requests and limits) known to Kubernetes describing a single container in each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "external": "external refers to a global metric that is not associated with any Kubernetes object. It allows autoscaling based on information coming from components running outside of cluster (for example length of queue in cloud messaging service, or QPS from loadbalancer running outside of cluster).", -} - -func (MetricStatus) SwaggerDoc() map[string]string { - return map_MetricStatus -} - -var map_MetricTarget = map[string]string{ - "": "MetricTarget defines the target value, average value, or average utilization of a specific metric", - "type": "type represents whether the metric type is Utilization, Value, or AverageValue", - "value": "value is the target value of the metric (as a quantity).", - "averageValue": "averageValue is the target value of the average of the metric across all relevant pods (as a quantity)", - "averageUtilization": "averageUtilization is the target value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods. Currently only valid for Resource metric source type", -} - -func (MetricTarget) SwaggerDoc() map[string]string { - return map_MetricTarget -} - -var map_MetricValueStatus = map[string]string{ - "": "MetricValueStatus holds the current value for a metric", - "value": "value is the current value of the metric (as a quantity).", - "averageValue": "averageValue is the current value of the average of the metric across all relevant pods (as a quantity)", - "averageUtilization": "averageUtilization is the current value of the average of the resource metric across all relevant pods, represented as a percentage of the requested value of the resource for the pods.", -} - -func (MetricValueStatus) SwaggerDoc() map[string]string { - return map_MetricValueStatus -} - -var map_ObjectMetricSource = map[string]string{ - "": "ObjectMetricSource indicates how to scale on a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", - "target": "target specifies the target value for the given metric", - "metric": "metric identifies the target metric by name and selector", -} - -func (ObjectMetricSource) SwaggerDoc() map[string]string { - return map_ObjectMetricSource -} - -var map_ObjectMetricStatus = map[string]string{ - "": "ObjectMetricStatus indicates the current value of a metric describing a kubernetes object (for example, hits-per-second on an Ingress object).", - "metric": "metric identifies the target metric by name and selector", - "current": "current contains the current value for the given metric", -} - -func (ObjectMetricStatus) SwaggerDoc() map[string]string { - return map_ObjectMetricStatus -} - -var map_PodsMetricSource = map[string]string{ - "": "PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.", - "metric": "metric identifies the target metric by name and selector", - "target": "target specifies the target value for the given metric", -} - -func (PodsMetricSource) SwaggerDoc() map[string]string { - return map_PodsMetricSource -} - -var map_PodsMetricStatus = map[string]string{ - "": "PodsMetricStatus indicates the current value of a metric describing each pod in the current scale target (for example, transactions-processed-per-second).", - "metric": "metric identifies the target metric by name and selector", - "current": "current contains the current value for the given metric", -} - -func (PodsMetricStatus) SwaggerDoc() map[string]string { - return map_PodsMetricStatus -} - -var map_ResourceMetricSource = map[string]string{ - "": "ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. Only one \"target\" type should be set.", - "name": "name is the name of the resource in question.", - "target": "target specifies the target value for the given metric", -} - -func (ResourceMetricSource) SwaggerDoc() map[string]string { - return map_ResourceMetricSource -} - -var map_ResourceMetricStatus = map[string]string{ - "": "ResourceMetricStatus indicates the current value of a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source.", - "name": "name is the name of the resource in question.", - "current": "current contains the current value for the given metric", -} - -func (ResourceMetricStatus) SwaggerDoc() map[string]string { - return map_ResourceMetricStatus -} - -// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.deepcopy.go b/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.deepcopy.go deleted file mode 100644 index 49838843c0..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.deepcopy.go +++ /dev/null @@ -1,610 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v2beta2 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerResourceMetricSource) DeepCopyInto(out *ContainerResourceMetricSource) { - *out = *in - in.Target.DeepCopyInto(&out.Target) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourceMetricSource. -func (in *ContainerResourceMetricSource) DeepCopy() *ContainerResourceMetricSource { - if in == nil { - return nil - } - out := new(ContainerResourceMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ContainerResourceMetricStatus) DeepCopyInto(out *ContainerResourceMetricStatus) { - *out = *in - in.Current.DeepCopyInto(&out.Current) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourceMetricStatus. -func (in *ContainerResourceMetricStatus) DeepCopy() *ContainerResourceMetricStatus { - if in == nil { - return nil - } - out := new(ContainerResourceMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CrossVersionObjectReference. -func (in *CrossVersionObjectReference) DeepCopy() *CrossVersionObjectReference { - if in == nil { - return nil - } - out := new(CrossVersionObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExternalMetricSource) DeepCopyInto(out *ExternalMetricSource) { - *out = *in - in.Metric.DeepCopyInto(&out.Metric) - in.Target.DeepCopyInto(&out.Target) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricSource. -func (in *ExternalMetricSource) DeepCopy() *ExternalMetricSource { - if in == nil { - return nil - } - out := new(ExternalMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ExternalMetricStatus) DeepCopyInto(out *ExternalMetricStatus) { - *out = *in - in.Metric.DeepCopyInto(&out.Metric) - in.Current.DeepCopyInto(&out.Current) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExternalMetricStatus. -func (in *ExternalMetricStatus) DeepCopy() *ExternalMetricStatus { - if in == nil { - return nil - } - out := new(ExternalMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HPAScalingPolicy) DeepCopyInto(out *HPAScalingPolicy) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HPAScalingPolicy. -func (in *HPAScalingPolicy) DeepCopy() *HPAScalingPolicy { - if in == nil { - return nil - } - out := new(HPAScalingPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HPAScalingRules) DeepCopyInto(out *HPAScalingRules) { - *out = *in - if in.StabilizationWindowSeconds != nil { - in, out := &in.StabilizationWindowSeconds, &out.StabilizationWindowSeconds - *out = new(int32) - **out = **in - } - if in.SelectPolicy != nil { - in, out := &in.SelectPolicy, &out.SelectPolicy - *out = new(ScalingPolicySelect) - **out = **in - } - if in.Policies != nil { - in, out := &in.Policies, &out.Policies - *out = make([]HPAScalingPolicy, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HPAScalingRules. -func (in *HPAScalingRules) DeepCopy() *HPAScalingRules { - if in == nil { - return nil - } - out := new(HPAScalingRules) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscaler) DeepCopyInto(out *HorizontalPodAutoscaler) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscaler. -func (in *HorizontalPodAutoscaler) DeepCopy() *HorizontalPodAutoscaler { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscaler) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HorizontalPodAutoscaler) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerBehavior) DeepCopyInto(out *HorizontalPodAutoscalerBehavior) { - *out = *in - if in.ScaleUp != nil { - in, out := &in.ScaleUp, &out.ScaleUp - *out = new(HPAScalingRules) - (*in).DeepCopyInto(*out) - } - if in.ScaleDown != nil { - in, out := &in.ScaleDown, &out.ScaleDown - *out = new(HPAScalingRules) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerBehavior. -func (in *HorizontalPodAutoscalerBehavior) DeepCopy() *HorizontalPodAutoscalerBehavior { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerBehavior) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerCondition) DeepCopyInto(out *HorizontalPodAutoscalerCondition) { - *out = *in - in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerCondition. -func (in *HorizontalPodAutoscalerCondition) DeepCopy() *HorizontalPodAutoscalerCondition { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerList) DeepCopyInto(out *HorizontalPodAutoscalerList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]HorizontalPodAutoscaler, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerList. -func (in *HorizontalPodAutoscalerList) DeepCopy() *HorizontalPodAutoscalerList { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *HorizontalPodAutoscalerList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerSpec) DeepCopyInto(out *HorizontalPodAutoscalerSpec) { - *out = *in - out.ScaleTargetRef = in.ScaleTargetRef - if in.MinReplicas != nil { - in, out := &in.MinReplicas, &out.MinReplicas - *out = new(int32) - **out = **in - } - if in.Metrics != nil { - in, out := &in.Metrics, &out.Metrics - *out = make([]MetricSpec, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Behavior != nil { - in, out := &in.Behavior, &out.Behavior - *out = new(HorizontalPodAutoscalerBehavior) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerSpec. -func (in *HorizontalPodAutoscalerSpec) DeepCopy() *HorizontalPodAutoscalerSpec { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *HorizontalPodAutoscalerStatus) DeepCopyInto(out *HorizontalPodAutoscalerStatus) { - *out = *in - if in.ObservedGeneration != nil { - in, out := &in.ObservedGeneration, &out.ObservedGeneration - *out = new(int64) - **out = **in - } - if in.LastScaleTime != nil { - in, out := &in.LastScaleTime, &out.LastScaleTime - *out = (*in).DeepCopy() - } - if in.CurrentMetrics != nil { - in, out := &in.CurrentMetrics, &out.CurrentMetrics - *out = make([]MetricStatus, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - if in.Conditions != nil { - in, out := &in.Conditions, &out.Conditions - *out = make([]HorizontalPodAutoscalerCondition, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HorizontalPodAutoscalerStatus. -func (in *HorizontalPodAutoscalerStatus) DeepCopy() *HorizontalPodAutoscalerStatus { - if in == nil { - return nil - } - out := new(HorizontalPodAutoscalerStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricIdentifier) DeepCopyInto(out *MetricIdentifier) { - *out = *in - if in.Selector != nil { - in, out := &in.Selector, &out.Selector - *out = new(v1.LabelSelector) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricIdentifier. -func (in *MetricIdentifier) DeepCopy() *MetricIdentifier { - if in == nil { - return nil - } - out := new(MetricIdentifier) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricSpec) DeepCopyInto(out *MetricSpec) { - *out = *in - if in.Object != nil { - in, out := &in.Object, &out.Object - *out = new(ObjectMetricSource) - (*in).DeepCopyInto(*out) - } - if in.Pods != nil { - in, out := &in.Pods, &out.Pods - *out = new(PodsMetricSource) - (*in).DeepCopyInto(*out) - } - if in.Resource != nil { - in, out := &in.Resource, &out.Resource - *out = new(ResourceMetricSource) - (*in).DeepCopyInto(*out) - } - if in.ContainerResource != nil { - in, out := &in.ContainerResource, &out.ContainerResource - *out = new(ContainerResourceMetricSource) - (*in).DeepCopyInto(*out) - } - if in.External != nil { - in, out := &in.External, &out.External - *out = new(ExternalMetricSource) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricSpec. -func (in *MetricSpec) DeepCopy() *MetricSpec { - if in == nil { - return nil - } - out := new(MetricSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricStatus) DeepCopyInto(out *MetricStatus) { - *out = *in - if in.Object != nil { - in, out := &in.Object, &out.Object - *out = new(ObjectMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.Pods != nil { - in, out := &in.Pods, &out.Pods - *out = new(PodsMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.Resource != nil { - in, out := &in.Resource, &out.Resource - *out = new(ResourceMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.ContainerResource != nil { - in, out := &in.ContainerResource, &out.ContainerResource - *out = new(ContainerResourceMetricStatus) - (*in).DeepCopyInto(*out) - } - if in.External != nil { - in, out := &in.External, &out.External - *out = new(ExternalMetricStatus) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricStatus. -func (in *MetricStatus) DeepCopy() *MetricStatus { - if in == nil { - return nil - } - out := new(MetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricTarget) DeepCopyInto(out *MetricTarget) { - *out = *in - if in.Value != nil { - in, out := &in.Value, &out.Value - x := (*in).DeepCopy() - *out = &x - } - if in.AverageValue != nil { - in, out := &in.AverageValue, &out.AverageValue - x := (*in).DeepCopy() - *out = &x - } - if in.AverageUtilization != nil { - in, out := &in.AverageUtilization, &out.AverageUtilization - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricTarget. -func (in *MetricTarget) DeepCopy() *MetricTarget { - if in == nil { - return nil - } - out := new(MetricTarget) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *MetricValueStatus) DeepCopyInto(out *MetricValueStatus) { - *out = *in - if in.Value != nil { - in, out := &in.Value, &out.Value - x := (*in).DeepCopy() - *out = &x - } - if in.AverageValue != nil { - in, out := &in.AverageValue, &out.AverageValue - x := (*in).DeepCopy() - *out = &x - } - if in.AverageUtilization != nil { - in, out := &in.AverageUtilization, &out.AverageUtilization - *out = new(int32) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricValueStatus. -func (in *MetricValueStatus) DeepCopy() *MetricValueStatus { - if in == nil { - return nil - } - out := new(MetricValueStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ObjectMetricSource) DeepCopyInto(out *ObjectMetricSource) { - *out = *in - out.DescribedObject = in.DescribedObject - in.Target.DeepCopyInto(&out.Target) - in.Metric.DeepCopyInto(&out.Metric) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMetricSource. -func (in *ObjectMetricSource) DeepCopy() *ObjectMetricSource { - if in == nil { - return nil - } - out := new(ObjectMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ObjectMetricStatus) DeepCopyInto(out *ObjectMetricStatus) { - *out = *in - in.Metric.DeepCopyInto(&out.Metric) - in.Current.DeepCopyInto(&out.Current) - out.DescribedObject = in.DescribedObject - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectMetricStatus. -func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus { - if in == nil { - return nil - } - out := new(ObjectMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) { - *out = *in - in.Metric.DeepCopyInto(&out.Metric) - in.Target.DeepCopyInto(&out.Target) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodsMetricSource. -func (in *PodsMetricSource) DeepCopy() *PodsMetricSource { - if in == nil { - return nil - } - out := new(PodsMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodsMetricStatus) DeepCopyInto(out *PodsMetricStatus) { - *out = *in - in.Metric.DeepCopyInto(&out.Metric) - in.Current.DeepCopyInto(&out.Current) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodsMetricStatus. -func (in *PodsMetricStatus) DeepCopy() *PodsMetricStatus { - if in == nil { - return nil - } - out := new(PodsMetricStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource) { - *out = *in - in.Target.DeepCopyInto(&out.Target) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceMetricSource. -func (in *ResourceMetricSource) DeepCopy() *ResourceMetricSource { - if in == nil { - return nil - } - out := new(ResourceMetricSource) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ResourceMetricStatus) DeepCopyInto(out *ResourceMetricStatus) { - *out = *in - in.Current.DeepCopyInto(&out.Current) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceMetricStatus. -func (in *ResourceMetricStatus) DeepCopy() *ResourceMetricStatus { - if in == nil { - return nil - } - out := new(ResourceMetricStatus) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.model_name.go b/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.model_name.go deleted file mode 100644 index 20e8a854c6..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.model_name.go +++ /dev/null @@ -1,142 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by openapi-gen. DO NOT EDIT. - -package v2beta2 - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ContainerResourceMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ContainerResourceMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ContainerResourceMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ContainerResourceMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in CrossVersionObjectReference) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.CrossVersionObjectReference" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ExternalMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ExternalMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ExternalMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ExternalMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HPAScalingPolicy) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HPAScalingPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HPAScalingRules) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HPAScalingRules" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscaler) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerBehavior) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerBehavior" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerCondition) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerCondition" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerList) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerList" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerSpec) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerSpec" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in HorizontalPodAutoscalerStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in MetricIdentifier) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.MetricIdentifier" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in MetricSpec) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.MetricSpec" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in MetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.MetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in MetricTarget) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.MetricTarget" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in MetricValueStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.MetricValueStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ObjectMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ObjectMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ObjectMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ObjectMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodsMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.PodsMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodsMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.PodsMetricStatus" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ResourceMetricSource) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ResourceMetricSource" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in ResourceMetricStatus) OpenAPIModelName() string { - return "io.k8s.api.autoscaling.v2beta2.ResourceMetricStatus" -} diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.prerelease-lifecycle.go deleted file mode 100644 index 6d1c2504ab..0000000000 --- a/vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.prerelease-lifecycle.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by prerelease-lifecycle-gen. DO NOT EDIT. - -package v2beta2 - -import ( - schema "k8s.io/apimachinery/pkg/runtime/schema" -) - -// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. -func (in *HorizontalPodAutoscaler) APILifecycleIntroduced() (major, minor int) { - return 1, 12 -} - -// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. -func (in *HorizontalPodAutoscaler) APILifecycleDeprecated() (major, minor int) { - return 1, 23 -} - -// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type. -// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=,," tags in types.go. -func (in *HorizontalPodAutoscaler) APILifecycleReplacement() schema.GroupVersionKind { - return schema.GroupVersionKind{Group: "autoscaling", Version: "v2", Kind: "HorizontalPodAutoscaler"} -} - -// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. -func (in *HorizontalPodAutoscaler) APILifecycleRemoved() (major, minor int) { - return 1, 26 -} - -// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. -func (in *HorizontalPodAutoscalerList) APILifecycleIntroduced() (major, minor int) { - return 1, 12 -} - -// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. -func (in *HorizontalPodAutoscalerList) APILifecycleDeprecated() (major, minor int) { - return 1, 22 -} - -// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. -// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. -func (in *HorizontalPodAutoscalerList) APILifecycleRemoved() (major, minor int) { - return 1, 25 -} diff --git a/vendor/k8s.io/api/batch/v1/generated.proto b/vendor/k8s.io/api/batch/v1/generated.proto index ca8248ff5b..5c35012852 100644 --- a/vendor/k8s.io/api/batch/v1/generated.proto +++ b/vendor/k8s.io/api/batch/v1/generated.proto @@ -38,7 +38,7 @@ message CronJob { // Specification of the desired behavior of a cron job, including the schedule. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional CronJobSpec spec = 2; // Current status of a cron job. @@ -61,6 +61,8 @@ message CronJobList { // CronJobSpec describes how the job execution will look like and when it will actually run. message CronJobSpec { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string schedule = 1; // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. diff --git a/vendor/k8s.io/api/batch/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/batch/v1/generated.protomessage.pb.go deleted file mode 100644 index 82928e07d1..0000000000 --- a/vendor/k8s.io/api/batch/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,56 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*CronJob) ProtoMessage() {} - -func (*CronJobList) ProtoMessage() {} - -func (*CronJobSpec) ProtoMessage() {} - -func (*CronJobStatus) ProtoMessage() {} - -func (*Job) ProtoMessage() {} - -func (*JobCondition) ProtoMessage() {} - -func (*JobList) ProtoMessage() {} - -func (*JobSpec) ProtoMessage() {} - -func (*JobStatus) ProtoMessage() {} - -func (*JobTemplateSpec) ProtoMessage() {} - -func (*PodFailurePolicy) ProtoMessage() {} - -func (*PodFailurePolicyOnExitCodesRequirement) ProtoMessage() {} - -func (*PodFailurePolicyOnPodConditionsPattern) ProtoMessage() {} - -func (*PodFailurePolicyRule) ProtoMessage() {} - -func (*SuccessPolicy) ProtoMessage() {} - -func (*SuccessPolicyRule) ProtoMessage() {} - -func (*UncountedTerminatedPods) ProtoMessage() {} diff --git a/vendor/k8s.io/api/batch/v1/types.go b/vendor/k8s.io/api/batch/v1/types.go index 26d0ee6dc4..d4894e2ef6 100644 --- a/vendor/k8s.io/api/batch/v1/types.go +++ b/vendor/k8s.io/api/batch/v1/types.go @@ -686,7 +686,7 @@ type CronJob struct { // Specification of the desired behavior of a cron job, including the schedule. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec CronJobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Current status of a cron job. @@ -715,6 +715,8 @@ type CronJobList struct { type CronJobSpec struct { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"` // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. diff --git a/vendor/k8s.io/api/batch/v1beta1/generated.proto b/vendor/k8s.io/api/batch/v1beta1/generated.proto index 6dd322128d..47000470c6 100644 --- a/vendor/k8s.io/api/batch/v1beta1/generated.proto +++ b/vendor/k8s.io/api/batch/v1beta1/generated.proto @@ -39,7 +39,7 @@ message CronJob { // Specification of the desired behavior of a cron job, including the schedule. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional CronJobSpec spec = 2; // Current status of a cron job. @@ -62,6 +62,8 @@ message CronJobList { // CronJobSpec describes how the job execution will look like and when it will actually run. message CronJobSpec { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string schedule = 1; // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. diff --git a/vendor/k8s.io/api/batch/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/batch/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 57520d7aff..0000000000 --- a/vendor/k8s.io/api/batch/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*CronJob) ProtoMessage() {} - -func (*CronJobList) ProtoMessage() {} - -func (*CronJobSpec) ProtoMessage() {} - -func (*CronJobStatus) ProtoMessage() {} - -func (*JobTemplateSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/batch/v1beta1/types.go b/vendor/k8s.io/api/batch/v1beta1/types.go index 976752a926..9e1a1b4704 100644 --- a/vendor/k8s.io/api/batch/v1beta1/types.go +++ b/vendor/k8s.io/api/batch/v1beta1/types.go @@ -52,7 +52,7 @@ type CronJob struct { // Specification of the desired behavior of a cron job, including the schedule. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec CronJobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` // Current status of a cron job. @@ -84,6 +84,8 @@ type CronJobList struct { type CronJobSpec struct { // The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"` // The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. diff --git a/vendor/k8s.io/api/certificates/v1/generated.proto b/vendor/k8s.io/api/certificates/v1/generated.proto index a689f3e892..a334db4e18 100644 --- a/vendor/k8s.io/api/certificates/v1/generated.proto +++ b/vendor/k8s.io/api/certificates/v1/generated.proto @@ -39,8 +39,8 @@ option go_package = "k8s.io/api/certificates/v1"; // This API can be used to request client certificates to authenticate to kube-apiserver // (with the "kubernetes.io/kube-apiserver-client" signerName), // or to obtain certificates from custom non-Kubernetes signers. -// +k8s:supportsSubresource=/status -// +k8s:supportsSubresource=/approval +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/approval" message CertificateSigningRequest { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -204,12 +204,12 @@ message CertificateSigningRequestStatus { // +listType=map // +listMapKey=type // +optional - // +k8s:listType=map - // +k8s:listMapKey=type - // +k8s:customUnique - // +k8s:optional - // +k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type + // +k8s:alpha(since: "1.36")=+k8s:customUnique + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember repeated CertificateSigningRequestCondition conditions = 1; // certificate is populated with an issued certificate by the signer after an Approved condition is present. diff --git a/vendor/k8s.io/api/certificates/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/certificates/v1/generated.protomessage.pb.go deleted file mode 100644 index 527630582c..0000000000 --- a/vendor/k8s.io/api/certificates/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,34 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*CertificateSigningRequest) ProtoMessage() {} - -func (*CertificateSigningRequestCondition) ProtoMessage() {} - -func (*CertificateSigningRequestList) ProtoMessage() {} - -func (*CertificateSigningRequestSpec) ProtoMessage() {} - -func (*CertificateSigningRequestStatus) ProtoMessage() {} - -func (*ExtraValue) ProtoMessage() {} diff --git a/vendor/k8s.io/api/certificates/v1/types.go b/vendor/k8s.io/api/certificates/v1/types.go index 8cd56e6db7..9a86af13a8 100644 --- a/vendor/k8s.io/api/certificates/v1/types.go +++ b/vendor/k8s.io/api/certificates/v1/types.go @@ -39,8 +39,8 @@ import ( // This API can be used to request client certificates to authenticate to kube-apiserver // (with the "kubernetes.io/kube-apiserver-client" signerName), // or to obtain certificates from custom non-Kubernetes signers. -// +k8s:supportsSubresource=/status -// +k8s:supportsSubresource=/approval +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/approval" type CertificateSigningRequest struct { metav1.TypeMeta `json:",inline"` // +optional @@ -179,12 +179,12 @@ type CertificateSigningRequestStatus struct { // +listType=map // +listMapKey=type // +optional - // +k8s:listType=map - // +k8s:listMapKey=type - // +k8s:customUnique - // +k8s:optional - // +k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type + // +k8s:alpha(since: "1.36")=+k8s:customUnique + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember Conditions []CertificateSigningRequestCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"` // certificate is populated with an issued certificate by the signer after an Approved condition is present. diff --git a/vendor/k8s.io/api/certificates/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/certificates/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index 81dd80e28a..0000000000 --- a/vendor/k8s.io/api/certificates/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*ClusterTrustBundle) ProtoMessage() {} - -func (*ClusterTrustBundleList) ProtoMessage() {} - -func (*ClusterTrustBundleSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/certificates/v1beta1/generated.pb.go b/vendor/k8s.io/api/certificates/v1beta1/generated.pb.go index 5a8b8f2d13..f375246a4b 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/generated.pb.go +++ b/vendor/k8s.io/api/certificates/v1beta1/generated.pb.go @@ -642,6 +642,13 @@ func (m *PodCertificateRequestSpec) MarshalToSizedBuffer(dAtA []byte) (int, erro _ = i var l int _ = l + if m.StubPKCS10Request != nil { + i -= len(m.StubPKCS10Request) + copy(dAtA[i:], m.StubPKCS10Request) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.StubPKCS10Request))) + i-- + dAtA[i] = 0x62 + } if len(m.UnverifiedUserAnnotations) > 0 { keysForUnverifiedUserAnnotations := make([]string, 0, len(m.UnverifiedUserAnnotations)) for k := range m.UnverifiedUserAnnotations { @@ -1058,6 +1065,10 @@ func (m *PodCertificateRequestSpec) Size() (n int) { n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } + if m.StubPKCS10Request != nil { + l = len(m.StubPKCS10Request) + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -1274,6 +1285,7 @@ func (this *PodCertificateRequestSpec) String() string { `PKIXPublicKey:` + valueToStringGenerated(this.PKIXPublicKey) + `,`, `ProofOfPossession:` + valueToStringGenerated(this.ProofOfPossession) + `,`, `UnverifiedUserAnnotations:` + mapStringForUnverifiedUserAnnotations + `,`, + `StubPKCS10Request:` + valueToStringGenerated(this.StubPKCS10Request) + `,`, `}`, }, "") return s @@ -3490,6 +3502,40 @@ func (m *PodCertificateRequestSpec) Unmarshal(dAtA []byte) error { } m.UnverifiedUserAnnotations[mapkey] = mapvalue iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StubPKCS10Request", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StubPKCS10Request = append(m.StubPKCS10Request[:0], dAtA[iNdEx:postIndex]...) + if m.StubPKCS10Request == nil { + m.StubPKCS10Request = []byte{} + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/certificates/v1beta1/generated.proto b/vendor/k8s.io/api/certificates/v1beta1/generated.proto index a8ffad4727..cc46dee16d 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/generated.proto +++ b/vendor/k8s.io/api/certificates/v1beta1/generated.proto @@ -30,8 +30,8 @@ import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; option go_package = "k8s.io/api/certificates/v1beta1"; // Describes a certificate signing request -// +k8s:supportsSubresource=/status -// +k8s:supportsSubresource=/approval +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/approval" message CertificateSigningRequest { // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; @@ -183,12 +183,12 @@ message CertificateSigningRequestStatus { // +listType=map // +listMapKey=type // +optional - // +k8s:listType=map - // +k8s:listMapKey=type - // +k8s:customUnique - // +k8s:optional - // +k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type + // +k8s:alpha(since: "1.36")=+k8s:customUnique + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember repeated CertificateSigningRequestCondition conditions = 1; // If request was approved, the controller will place the issued certificate here. @@ -289,6 +289,7 @@ message PodCertificateRequest { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // spec contains the details about the certificate being requested. + // +required optional PodCertificateRequestSpec spec = 2; // status contains the issued certificate, and a standard set of conditions. @@ -369,8 +370,7 @@ message PodCertificateRequestSpec { // +default=86400 optional int32 maxExpirationSeconds = 8; - // pkixPublicKey is the PKIX-serialized public key the signer will issue the - // certificate to. + // The PKIX-serialized public key the signer will issue the certificate to. // // The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, // or ED25519. Note that this list may be expanded in the future. @@ -382,11 +382,16 @@ message PodCertificateRequestSpec { // "UnsupportedKeyType". It may also suggest a key type that it does support // in the message field. // - // +required + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. Signer + // implementations should extract the public key from the StubPKCS10Request + // field. + // + // +optional optional bytes pkixPublicKey = 9; - // proofOfPossession proves that the requesting kubelet holds the private - // key corresponding to pkixPublicKey. + // A proof that the requesting kubelet holds the private key corresponding + // to pkixPublicKey. // // It is contructed by signing the ASCII bytes of the pod's UID using // `pkixPublicKey`. @@ -403,12 +408,35 @@ message PodCertificateRequestSpec { // golang library function crypto/ecdsa.SignASN1) // // If the key is an ED25519 key, the the signature is as described by the - // [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by - // the golang library crypto/ed25519.Sign). + // [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the + // golang library crypto/ed25519.Sign). // - // +required + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. + // + // +optional optional bytes proofOfPossession = 10; + // A PKCS#10 certificate signing request (DER-serialized) generated by + // Kubelet using the subject private key. + // + // Most signer implementations will ignore the contents of the CSR except to + // extract the subject public key. The API server automatically verifies the + // CSR signature during admission, so the signer does not need to repeat the + // verification. CSRs generated by kubelet are completely empty. + // + // The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + // ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + // the future. + // + // Signer implementations do not need to support all key types supported by + // kube-apiserver and kubelet. If a signer does not support the key type + // used for a given PodCertificateRequest, it must deny the request by + // setting a status.conditions entry with a type of "Denied" and a reason of + // "UnsupportedKeyType". It may also suggest a key type that it does support + // in the message field. + optional bytes stubPKCS10Request = 12; + // unverifiedUserAnnotations allow pod authors to pass additional information to // the signer implementation. Kubernetes does not restrict or validate this // metadata in any way. diff --git a/vendor/k8s.io/api/certificates/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/certificates/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 00ba7faaeb..0000000000 --- a/vendor/k8s.io/api/certificates/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,48 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*CertificateSigningRequest) ProtoMessage() {} - -func (*CertificateSigningRequestCondition) ProtoMessage() {} - -func (*CertificateSigningRequestList) ProtoMessage() {} - -func (*CertificateSigningRequestSpec) ProtoMessage() {} - -func (*CertificateSigningRequestStatus) ProtoMessage() {} - -func (*ClusterTrustBundle) ProtoMessage() {} - -func (*ClusterTrustBundleList) ProtoMessage() {} - -func (*ClusterTrustBundleSpec) ProtoMessage() {} - -func (*ExtraValue) ProtoMessage() {} - -func (*PodCertificateRequest) ProtoMessage() {} - -func (*PodCertificateRequestList) ProtoMessage() {} - -func (*PodCertificateRequestSpec) ProtoMessage() {} - -func (*PodCertificateRequestStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/certificates/v1beta1/types.go b/vendor/k8s.io/api/certificates/v1beta1/types.go index acfabbfe9f..e8ffa41e6d 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/types.go +++ b/vendor/k8s.io/api/certificates/v1beta1/types.go @@ -32,8 +32,8 @@ import ( // +k8s:prerelease-lifecycle-gen:replacement=certificates.k8s.io,v1,CertificateSigningRequest // Describes a certificate signing request -// +k8s:supportsSubresource=/status -// +k8s:supportsSubresource=/approval +// +k8s:supportsSubresource="/status" +// +k8s:supportsSubresource="/approval" type CertificateSigningRequest struct { metav1.TypeMeta `json:",inline"` // +optional @@ -177,12 +177,12 @@ type CertificateSigningRequestStatus struct { // +listType=map // +listMapKey=type // +optional - // +k8s:listType=map - // +k8s:listMapKey=type - // +k8s:customUnique - // +k8s:optional - // +k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember - // +k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=type + // +k8s:alpha(since: "1.36")=+k8s:customUnique + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Approved")=+k8s:zeroOrOneOfMember + // +k8s:alpha(since: "1.36")=+k8s:item(type: "Denied")=+k8s:zeroOrOneOfMember Conditions []CertificateSigningRequestCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"` // If request was approved, the controller will place the issued certificate here. @@ -273,6 +273,7 @@ const ( // +genclient // +genclient:nonNamespaced // +k8s:prerelease-lifecycle-gen:introduced=1.33 +// +k8s:prerelease-lifecycle-gen:deprecated=1.37 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterTrustBundle is a cluster-scoped container for X.509 trust anchors @@ -340,6 +341,7 @@ type ClusterTrustBundleSpec struct { } // +k8s:prerelease-lifecycle-gen:introduced=1.33 +// +k8s:prerelease-lifecycle-gen:deprecated=1.37 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // ClusterTrustBundleList is a collection of ClusterTrustBundle objects @@ -372,6 +374,7 @@ type PodCertificateRequest struct { metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec contains the details about the certificate being requested. + // +required Spec PodCertificateRequestSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // status contains the issued certificate, and a standard set of conditions. @@ -438,8 +441,7 @@ type PodCertificateRequestSpec struct { // +default=86400 MaxExpirationSeconds *int32 `json:"maxExpirationSeconds,omitempty" protobuf:"varint,8,opt,name=maxExpirationSeconds"` - // pkixPublicKey is the PKIX-serialized public key the signer will issue the - // certificate to. + // The PKIX-serialized public key the signer will issue the certificate to. // // The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, // or ED25519. Note that this list may be expanded in the future. @@ -451,11 +453,16 @@ type PodCertificateRequestSpec struct { // "UnsupportedKeyType". It may also suggest a key type that it does support // in the message field. // - // +required + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. Signer + // implementations should extract the public key from the StubPKCS10Request + // field. + // + // +optional PKIXPublicKey []byte `json:"pkixPublicKey" protobuf:"bytes,9,opt,name=pkixPublicKey"` - // proofOfPossession proves that the requesting kubelet holds the private - // key corresponding to pkixPublicKey. + // A proof that the requesting kubelet holds the private key corresponding + // to pkixPublicKey. // // It is contructed by signing the ASCII bytes of the pod's UID using // `pkixPublicKey`. @@ -472,12 +479,35 @@ type PodCertificateRequestSpec struct { // golang library function crypto/ecdsa.SignASN1) // // If the key is an ED25519 key, the the signature is as described by the - // [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by - // the golang library crypto/ed25519.Sign). + // [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the + // golang library crypto/ed25519.Sign). // - // +required + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. + // + // +optional ProofOfPossession []byte `json:"proofOfPossession" protobuf:"bytes,10,opt,name=proofOfPossession"` + // A PKCS#10 certificate signing request (DER-serialized) generated by + // Kubelet using the subject private key. + // + // Most signer implementations will ignore the contents of the CSR except to + // extract the subject public key. The API server automatically verifies the + // CSR signature during admission, so the signer does not need to repeat the + // verification. CSRs generated by kubelet are completely empty. + // + // The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + // ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + // the future. + // + // Signer implementations do not need to support all key types supported by + // kube-apiserver and kubelet. If a signer does not support the key type + // used for a given PodCertificateRequest, it must deny the request by + // setting a status.conditions entry with a type of "Denied" and a reason of + // "UnsupportedKeyType". It may also suggest a key type that it does support + // in the message field. + StubPKCS10Request []byte `json:"stubPKCS10Request" protobuf:"bytes,12,opt,name=stubPKCS10Request"` + // unverifiedUserAnnotations allow pod authors to pass additional information to // the signer implementation. Kubernetes does not restrict or validate this // metadata in any way. diff --git a/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go index bd829fb216..cad8768a59 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go @@ -136,8 +136,9 @@ var map_PodCertificateRequestSpec = map[string]string{ "nodeName": "nodeName is the name of the node the pod is assigned to.", "nodeUID": "nodeUID is the UID of the node the pod is assigned to.", "maxExpirationSeconds": "maxExpirationSeconds is the maximum lifetime permitted for the certificate.\n\nIf omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver will reject values shorter than 3600 (1 hour). The maximum allowable value is 7862400 (91 days).\n\nThe signer implementation is then free to issue a certificate with any lifetime *shorter* than MaxExpirationSeconds, but no shorter than 3600 seconds (1 hour). This constraint is enforced by kube-apiserver. `kubernetes.io` signers will never issue certificates with a lifetime longer than 24 hours.", - "pkixPublicKey": "pkixPublicKey is the PKIX-serialized public key the signer will issue the certificate to.\n\nThe key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.\n\nSigner implementations do not need to support all key types supported by kube-apiserver and kubelet. If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of \"Denied\" and a reason of \"UnsupportedKeyType\". It may also suggest a key type that it does support in the message field.", - "proofOfPossession": "proofOfPossession proves that the requesting kubelet holds the private key corresponding to pkixPublicKey.\n\nIt is contructed by signing the ASCII bytes of the pod's UID using `pkixPublicKey`.\n\nkube-apiserver validates the proof of possession during creation of the PodCertificateRequest.\n\nIf the key is an RSA key, then the signature is over the ASCII bytes of the pod UID, using RSASSA-PSS from RFC 8017 (as implemented by the golang function crypto/rsa.SignPSS with nil options).\n\nIf the key is an ECDSA key, then the signature is as described by [SEC 1, Version 2.0](https://www.secg.org/sec1-v2.pdf) (as implemented by the golang library function crypto/ecdsa.SignASN1)\n\nIf the key is an ED25519 key, the the signature is as described by the [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the golang library crypto/ed25519.Sign).", + "pkixPublicKey": "The PKIX-serialized public key the signer will issue the certificate to.\n\nThe key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.\n\nSigner implementations do not need to support all key types supported by kube-apiserver and kubelet. If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of \"Denied\" and a reason of \"UnsupportedKeyType\". It may also suggest a key type that it does support in the message field.\n\nDeprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty. Signer implementations should extract the public key from the StubPKCS10Request field.", + "proofOfPossession": "A proof that the requesting kubelet holds the private key corresponding to pkixPublicKey.\n\nIt is contructed by signing the ASCII bytes of the pod's UID using `pkixPublicKey`.\n\nkube-apiserver validates the proof of possession during creation of the PodCertificateRequest.\n\nIf the key is an RSA key, then the signature is over the ASCII bytes of the pod UID, using RSASSA-PSS from RFC 8017 (as implemented by the golang function crypto/rsa.SignPSS with nil options).\n\nIf the key is an ECDSA key, then the signature is as described by [SEC 1, Version 2.0](https://www.secg.org/sec1-v2.pdf) (as implemented by the golang library function crypto/ecdsa.SignASN1)\n\nIf the key is an ED25519 key, the the signature is as described by the [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the golang library crypto/ed25519.Sign).\n\nDeprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty.", + "stubPKCS10Request": "A PKCS#10 certificate signing request (DER-serialized) generated by Kubelet using the subject private key.\n\nMost signer implementations will ignore the contents of the CSR except to extract the subject public key. The API server automatically verifies the CSR signature during admission, so the signer does not need to repeat the verification. CSRs generated by kubelet are completely empty.\n\nThe subject public key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future.\n\nSigner implementations do not need to support all key types supported by kube-apiserver and kubelet. If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of \"Denied\" and a reason of \"UnsupportedKeyType\". It may also suggest a key type that it does support in the message field.", "unverifiedUserAnnotations": "unverifiedUserAnnotations allow pod authors to pass additional information to the signer implementation. Kubernetes does not restrict or validate this metadata in any way.\n\nEntries are subject to the same validation as object metadata annotations, with the addition that all keys must be domain-prefixed. No restrictions are placed on values, except an overall size limitation on the entire field.\n\nSigners should document the keys and values they support. Signers should deny requests that contain keys they do not recognize.", } diff --git a/vendor/k8s.io/api/certificates/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/api/certificates/v1beta1/zz_generated.deepcopy.go index 20b5c2a242..417b8a3e65 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/certificates/v1beta1/zz_generated.deepcopy.go @@ -364,6 +364,11 @@ func (in *PodCertificateRequestSpec) DeepCopyInto(out *PodCertificateRequestSpec *out = make([]byte, len(*in)) copy(*out, *in) } + if in.StubPKCS10Request != nil { + in, out := &in.StubPKCS10Request, &out.StubPKCS10Request + *out = make([]byte, len(*in)) + copy(*out, *in) + } if in.UnverifiedUserAnnotations != nil { in, out := &in.UnverifiedUserAnnotations, &out.UnverifiedUserAnnotations *out = make(map[string]string, len(*in)) diff --git a/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go index f95e329e2d..d541ffb005 100644 --- a/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go @@ -82,13 +82,13 @@ func (in *ClusterTrustBundle) APILifecycleIntroduced() (major, minor int) { // APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. func (in *ClusterTrustBundle) APILifecycleDeprecated() (major, minor int) { - return 1, 36 + return 1, 37 } // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *ClusterTrustBundle) APILifecycleRemoved() (major, minor int) { - return 1, 39 + return 1, 40 } // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. @@ -100,13 +100,13 @@ func (in *ClusterTrustBundleList) APILifecycleIntroduced() (major, minor int) { // APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. func (in *ClusterTrustBundleList) APILifecycleDeprecated() (major, minor int) { - return 1, 36 + return 1, 37 } // APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. func (in *ClusterTrustBundleList) APILifecycleRemoved() (major, minor int) { - return 1, 39 + return 1, 40 } // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. diff --git a/vendor/k8s.io/api/coordination/v1alpha2/generated.proto b/vendor/k8s.io/api/coordination/v1alpha2/generated.proto index 250c6113ec..379fcf0d5d 100644 --- a/vendor/k8s.io/api/coordination/v1alpha2/generated.proto +++ b/vendor/k8s.io/api/coordination/v1alpha2/generated.proto @@ -38,7 +38,7 @@ message LeaseCandidate { // spec contains the specification of the Lease. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional LeaseCandidateSpec spec = 2; } diff --git a/vendor/k8s.io/api/coordination/v1alpha2/generated.protomessage.pb.go b/vendor/k8s.io/api/coordination/v1alpha2/generated.protomessage.pb.go deleted file mode 100644 index 9374326229..0000000000 --- a/vendor/k8s.io/api/coordination/v1alpha2/generated.protomessage.pb.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha2 - -func (*LeaseCandidate) ProtoMessage() {} - -func (*LeaseCandidateList) ProtoMessage() {} - -func (*LeaseCandidateSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/coordination/v1alpha2/types.go b/vendor/k8s.io/api/coordination/v1alpha2/types.go index 13e1deb067..f8a6d33af1 100644 --- a/vendor/k8s.io/api/coordination/v1alpha2/types.go +++ b/vendor/k8s.io/api/coordination/v1alpha2/types.go @@ -35,7 +35,7 @@ type LeaseCandidate struct { // spec contains the specification of the Lease. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec LeaseCandidateSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } diff --git a/vendor/k8s.io/api/coordination/v1beta1/generated.proto b/vendor/k8s.io/api/coordination/v1beta1/generated.proto index 7ca043f528..74df40c64f 100644 --- a/vendor/k8s.io/api/coordination/v1beta1/generated.proto +++ b/vendor/k8s.io/api/coordination/v1beta1/generated.proto @@ -50,7 +50,7 @@ message LeaseCandidate { // spec contains the specification of the Lease. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional LeaseCandidateSpec spec = 2; } diff --git a/vendor/k8s.io/api/coordination/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/coordination/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index a1a88e55ff..0000000000 --- a/vendor/k8s.io/api/coordination/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,34 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*Lease) ProtoMessage() {} - -func (*LeaseCandidate) ProtoMessage() {} - -func (*LeaseCandidateList) ProtoMessage() {} - -func (*LeaseCandidateSpec) ProtoMessage() {} - -func (*LeaseList) ProtoMessage() {} - -func (*LeaseSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/coordination/v1beta1/types.go b/vendor/k8s.io/api/coordination/v1beta1/types.go index 781d29efce..ba6d6aa095 100644 --- a/vendor/k8s.io/api/coordination/v1beta1/types.go +++ b/vendor/k8s.io/api/coordination/v1beta1/types.go @@ -106,7 +106,7 @@ type LeaseCandidate struct { // spec contains the specification of the Lease. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec LeaseCandidateSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } diff --git a/vendor/k8s.io/api/core/v1/generated.pb.go b/vendor/k8s.io/api/core/v1/generated.pb.go index b7de1bea54..0fcbd5edf7 100644 --- a/vendor/k8s.io/api/core/v1/generated.pb.go +++ b/vendor/k8s.io/api/core/v1/generated.pb.go @@ -196,6 +196,8 @@ func (m *ISCSIVolumeSource) Reset() { *m = ISCSIVolumeSource{} } func (m *ImageVolumeSource) Reset() { *m = ImageVolumeSource{} } +func (m *ImageVolumeStatus) Reset() { *m = ImageVolumeStatus{} } + func (m *KeyToPath) Reset() { *m = KeyToPath{} } func (m *Lifecycle) Reset() { *m = Lifecycle{} } @@ -242,6 +244,8 @@ func (m *NodeAddress) Reset() { *m = NodeAddress{} } func (m *NodeAffinity) Reset() { *m = NodeAffinity{} } +func (m *NodeAllocatableResourceClaimStatus) Reset() { *m = NodeAllocatableResourceClaimStatus{} } + func (m *NodeCondition) Reset() { *m = NodeCondition{} } func (m *NodeConfigSource) Reset() { *m = NodeConfigSource{} } @@ -346,6 +350,8 @@ func (m *PodResourceClaimStatus) Reset() { *m = PodResourceClaimStatus{} } func (m *PodSchedulingGate) Reset() { *m = PodSchedulingGate{} } +func (m *PodSchedulingGroup) Reset() { *m = PodSchedulingGroup{} } + func (m *PodSecurityContext) Reset() { *m = PodSecurityContext{} } func (m *PodSignature) Reset() { *m = PodSignature{} } @@ -504,14 +510,14 @@ func (m *VolumeResourceRequirements) Reset() { *m = VolumeResourceRequirements{} func (m *VolumeSource) Reset() { *m = VolumeSource{} } +func (m *VolumeStatus) Reset() { *m = VolumeStatus{} } + func (m *VsphereVirtualDiskVolumeSource) Reset() { *m = VsphereVirtualDiskVolumeSource{} } func (m *WeightedPodAffinityTerm) Reset() { *m = WeightedPodAffinityTerm{} } func (m *WindowsSecurityContextOptions) Reset() { *m = WindowsSecurityContextOptions{} } -func (m *WorkloadReference) Reset() { *m = WorkloadReference{} } - func (m *AWSElasticBlockStoreVolumeSource) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5155,6 +5161,34 @@ func (m *ImageVolumeSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ImageVolumeStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ImageVolumeStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ImageVolumeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.ImageRef) + copy(dAtA[i:], m.ImageRef) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ImageRef))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *KeyToPath) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -6291,6 +6325,72 @@ func (m *NodeAffinity) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *NodeAllocatableResourceClaimStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableResourceClaimStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Resources) > 0 { + keysForResources := make([]string, 0, len(m.Resources)) + for k := range m.Resources { + keysForResources = append(keysForResources, string(k)) + } + sort.Strings(keysForResources) + for iNdEx := len(keysForResources) - 1; iNdEx >= 0; iNdEx-- { + v := m.Resources[ResourceName(keysForResources[iNdEx])] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(keysForResources[iNdEx]) + copy(dAtA[i:], keysForResources[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForResources[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if len(m.Containers) > 0 { + for iNdEx := len(m.Containers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Containers[iNdEx]) + copy(dAtA[i:], m.Containers[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Containers[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + i -= len(m.ResourceClaimName) + copy(dAtA[i:], m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ResourceClaimName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *NodeCondition) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -9446,6 +9546,36 @@ func (m *PodSchedulingGate) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PodSchedulingGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodSchedulingGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodSchedulingGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PodGroupName != nil { + i -= len(*m.PodGroupName) + copy(dAtA[i:], *m.PodGroupName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PodGroupName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *PodSecurityContext) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -9639,9 +9769,9 @@ func (m *PodSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.WorkloadRef != nil { + if m.SchedulingGroup != nil { { - size, err := m.WorkloadRef.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.SchedulingGroup.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -9651,7 +9781,7 @@ func (m *PodSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2 i-- - dAtA[i] = 0xd2 + dAtA[i] = 0xda } if m.HostnameOverride != nil { i -= len(*m.HostnameOverride) @@ -10150,6 +10280,22 @@ func (m *PodStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NodeAllocatableResourceClaimStatuses) > 0 { + for iNdEx := len(m.NodeAllocatableResourceClaimStatuses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.NodeAllocatableResourceClaimStatuses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xaa + } + } if m.Resources != nil { { size, err := m.Resources.MarshalToSizedBuffer(dAtA[:i]) @@ -11532,6 +11678,13 @@ func (m *ResourceHealth) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.Message != nil { + i -= len(*m.Message) + copy(dAtA[i:], *m.Message) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Message))) + i-- + dAtA[i] = 0x32 + } i -= len(m.Health) copy(dAtA[i:], m.Health) i = encodeVarintGenerated(dAtA, i, uint64(len(m.Health))) @@ -14149,6 +14302,18 @@ func (m *VolumeMountStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.VolumeStatus != nil { + { + size, err := m.VolumeStatus.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } if m.RecursiveReadOnly != nil { i -= len(*m.RecursiveReadOnly) copy(dAtA[i:], *m.RecursiveReadOnly) @@ -14801,6 +14966,41 @@ func (m *VolumeSource) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *VolumeStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VolumeStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VolumeStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Image != nil { + { + size, err := m.Image.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *VsphereVirtualDiskVolumeSource) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -14934,44 +15134,6 @@ func (m *WindowsSecurityContextOptions) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *WorkloadReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WorkloadReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WorkloadReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.PodGroupReplicaKey) - copy(dAtA[i:], m.PodGroupReplicaKey) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodGroupReplicaKey))) - i-- - dAtA[i] = 0x1a - i -= len(m.PodGroup) - copy(dAtA[i:], m.PodGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodGroup))) - i-- - dAtA[i] = 0x12 - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset @@ -16706,6 +16868,17 @@ func (m *ImageVolumeSource) Size() (n int) { return n } +func (m *ImageVolumeStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ImageRef) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *KeyToPath) Size() (n int) { if m == nil { return 0 @@ -17123,6 +17296,32 @@ func (m *NodeAffinity) Size() (n int) { return n } +func (m *NodeAllocatableResourceClaimStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Containers) > 0 { + for _, s := range m.Containers { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Resources) > 0 { + for k, v := range m.Resources { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } + return n +} + func (m *NodeCondition) Size() (n int) { if m == nil { return 0 @@ -18296,6 +18495,19 @@ func (m *PodSchedulingGate) Size() (n int) { return n } +func (m *PodSchedulingGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PodGroupName != nil { + l = len(*m.PodGroupName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *PodSecurityContext) Size() (n int) { if m == nil { return 0 @@ -18535,8 +18747,8 @@ func (m *PodSpec) Size() (n int) { l = len(*m.HostnameOverride) n += 2 + l + sovGenerated(uint64(l)) } - if m.WorkloadRef != nil { - l = m.WorkloadRef.Size() + if m.SchedulingGroup != nil { + l = m.SchedulingGroup.Size() n += 2 + l + sovGenerated(uint64(l)) } return n @@ -18628,6 +18840,12 @@ func (m *PodStatus) Size() (n int) { l = m.Resources.Size() n += 2 + l + sovGenerated(uint64(l)) } + if len(m.NodeAllocatableResourceClaimStatuses) > 0 { + for _, e := range m.NodeAllocatableResourceClaimStatuses { + l = e.Size() + n += 2 + l + sovGenerated(uint64(l)) + } + } return n } @@ -19052,6 +19270,10 @@ func (m *ResourceHealth) Size() (n int) { n += 1 + l + sovGenerated(uint64(l)) l = len(m.Health) n += 1 + l + sovGenerated(uint64(l)) + if m.Message != nil { + l = len(*m.Message) + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -20041,6 +20263,10 @@ func (m *VolumeMountStatus) Size() (n int) { l = len(*m.RecursiveReadOnly) n += 1 + l + sovGenerated(uint64(l)) } + if m.VolumeStatus != nil { + l = m.VolumeStatus.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -20246,6 +20472,19 @@ func (m *VolumeSource) Size() (n int) { return n } +func (m *VolumeStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Image != nil { + l = m.Image.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *VsphereVirtualDiskVolumeSource) Size() (n int) { if m == nil { return 0 @@ -20299,21 +20538,6 @@ func (m *WindowsSecurityContextOptions) Size() (n int) { return n } -func (m *WorkloadReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.PodGroup) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.PodGroupReplicaKey) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - func sovGenerated(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -21595,6 +21819,16 @@ func (this *ImageVolumeSource) String() string { }, "") return s } +func (this *ImageVolumeStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ImageVolumeStatus{`, + `ImageRef:` + fmt.Sprintf("%v", this.ImageRef) + `,`, + `}`, + }, "") + return s +} func (this *KeyToPath) String() string { if this == nil { return "nil" @@ -21951,6 +22185,28 @@ func (this *NodeAffinity) String() string { }, "") return s } +func (this *NodeAllocatableResourceClaimStatus) String() string { + if this == nil { + return "nil" + } + keysForResources := make([]string, 0, len(this.Resources)) + for k := range this.Resources { + keysForResources = append(keysForResources, string(k)) + } + sort.Strings(keysForResources) + mapStringForResources := "map[ResourceName]resource.Quantity{" + for _, k := range keysForResources { + mapStringForResources += fmt.Sprintf("%v: %v,", k, this.Resources[ResourceName(k)]) + } + mapStringForResources += "}" + s := strings.Join([]string{`&NodeAllocatableResourceClaimStatus{`, + `ResourceClaimName:` + fmt.Sprintf("%v", this.ResourceClaimName) + `,`, + `Containers:` + fmt.Sprintf("%v", this.Containers) + `,`, + `Resources:` + mapStringForResources + `,`, + `}`, + }, "") + return s +} func (this *NodeCondition) String() string { if this == nil { return "nil" @@ -22800,6 +23056,16 @@ func (this *PodSchedulingGate) String() string { }, "") return s } +func (this *PodSchedulingGroup) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodSchedulingGroup{`, + `PodGroupName:` + valueToStringGenerated(this.PodGroupName) + `,`, + `}`, + }, "") + return s +} func (this *PodSecurityContext) String() string { if this == nil { return "nil" @@ -22958,7 +23224,7 @@ func (this *PodSpec) String() string { `ResourceClaims:` + repeatedStringForResourceClaims + `,`, `Resources:` + strings.Replace(this.Resources.String(), "ResourceRequirements", "ResourceRequirements", 1) + `,`, `HostnameOverride:` + valueToStringGenerated(this.HostnameOverride) + `,`, - `WorkloadRef:` + strings.Replace(this.WorkloadRef.String(), "WorkloadReference", "WorkloadReference", 1) + `,`, + `SchedulingGroup:` + strings.Replace(this.SchedulingGroup.String(), "PodSchedulingGroup", "PodSchedulingGroup", 1) + `,`, `}`, }, "") return s @@ -23002,6 +23268,11 @@ func (this *PodStatus) String() string { repeatedStringForHostIPs += strings.Replace(strings.Replace(f.String(), "HostIP", "HostIP", 1), `&`, ``, 1) + "," } repeatedStringForHostIPs += "}" + repeatedStringForNodeAllocatableResourceClaimStatuses := "[]NodeAllocatableResourceClaimStatus{" + for _, f := range this.NodeAllocatableResourceClaimStatuses { + repeatedStringForNodeAllocatableResourceClaimStatuses += strings.Replace(strings.Replace(f.String(), "NodeAllocatableResourceClaimStatus", "NodeAllocatableResourceClaimStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForNodeAllocatableResourceClaimStatuses += "}" keysForAllocatedResources := make([]string, 0, len(this.AllocatedResources)) for k := range this.AllocatedResources { keysForAllocatedResources = append(keysForAllocatedResources, string(k)) @@ -23033,6 +23304,7 @@ func (this *PodStatus) String() string { `ExtendedResourceClaimStatus:` + strings.Replace(this.ExtendedResourceClaimStatus.String(), "PodExtendedResourceClaimStatus", "PodExtendedResourceClaimStatus", 1) + `,`, `AllocatedResources:` + mapStringForAllocatedResources + `,`, `Resources:` + strings.Replace(this.Resources.String(), "ResourceRequirements", "ResourceRequirements", 1) + `,`, + `NodeAllocatableResourceClaimStatuses:` + repeatedStringForNodeAllocatableResourceClaimStatuses + `,`, `}`, }, "") return s @@ -23365,6 +23637,7 @@ func (this *ResourceHealth) String() string { s := strings.Join([]string{`&ResourceHealth{`, `ResourceID:` + fmt.Sprintf("%v", this.ResourceID) + `,`, `Health:` + fmt.Sprintf("%v", this.Health) + `,`, + `Message:` + valueToStringGenerated(this.Message) + `,`, `}`, }, "") return s @@ -24118,6 +24391,7 @@ func (this *VolumeMountStatus) String() string { `MountPath:` + fmt.Sprintf("%v", this.MountPath) + `,`, `ReadOnly:` + fmt.Sprintf("%v", this.ReadOnly) + `,`, `RecursiveReadOnly:` + valueToStringGenerated(this.RecursiveReadOnly) + `,`, + `VolumeStatus:` + strings.Replace(this.VolumeStatus.String(), "VolumeStatus", "VolumeStatus", 1) + `,`, `}`, }, "") return s @@ -24217,6 +24491,16 @@ func (this *VolumeSource) String() string { }, "") return s } +func (this *VolumeStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&VolumeStatus{`, + `Image:` + strings.Replace(this.Image.String(), "ImageVolumeStatus", "ImageVolumeStatus", 1) + `,`, + `}`, + }, "") + return s +} func (this *VsphereVirtualDiskVolumeSource) String() string { if this == nil { return "nil" @@ -24254,18 +24538,6 @@ func (this *WindowsSecurityContextOptions) String() string { }, "") return s } -func (this *WorkloadReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&WorkloadReference{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `PodGroup:` + fmt.Sprintf("%v", this.PodGroup) + `,`, - `PodGroupReplicaKey:` + fmt.Sprintf("%v", this.PodGroupReplicaKey) + `,`, - `}`, - }, "") - return s -} func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -39166,6 +39438,88 @@ func (m *ImageVolumeSource) Unmarshal(dAtA []byte) error { } return nil } +func (m *ImageVolumeStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ImageVolumeStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ImageVolumeStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ImageRef", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ImageRef = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *KeyToPath) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -42742,6 +43096,249 @@ func (m *NodeAffinity) Unmarshal(dAtA []byte) error { } return nil } +func (m *NodeAllocatableResourceClaimStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeAllocatableResourceClaimStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeAllocatableResourceClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaimName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Containers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Containers = append(m.Containers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Resources == nil { + m.Resources = make(map[ResourceName]resource.Quantity) + } + var mapkey ResourceName + mapvalue := &resource.Quantity{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = ResourceName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &resource.Quantity{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Resources[ResourceName(mapkey)] = *mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NodeCondition) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -52496,7 +53093,155 @@ func (m *PodResourceClaim) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimTemplateName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimTemplateName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodResourceClaimStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodResourceClaimStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodResourceClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) } @@ -52529,39 +53274,6 @@ func (m *PodResourceClaim) Unmarshal(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.ResourceClaimName = &s iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimTemplateName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ResourceClaimTemplateName = &s - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -52583,7 +53295,7 @@ func (m *PodResourceClaim) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodResourceClaimStatus) Unmarshal(dAtA []byte) error { +func (m *PodSchedulingGate) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -52606,10 +53318,10 @@ func (m *PodResourceClaimStatus) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodResourceClaimStatus: wiretype end group for non-group") + return fmt.Errorf("proto: PodSchedulingGate: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodResourceClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodSchedulingGate: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -52644,39 +53356,6 @@ func (m *PodResourceClaimStatus) Unmarshal(dAtA []byte) error { } m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ResourceClaimName = &s - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -52698,7 +53377,7 @@ func (m *PodResourceClaimStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *PodSchedulingGate) Unmarshal(dAtA []byte) error { +func (m *PodSchedulingGroup) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -52721,15 +53400,15 @@ func (m *PodSchedulingGate) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PodSchedulingGate: wiretype end group for non-group") + return fmt.Errorf("proto: PodSchedulingGroup: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PodSchedulingGate: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PodSchedulingGroup: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -52757,7 +53436,8 @@ func (m *PodSchedulingGate) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + s := string(dAtA[iNdEx:postIndex]) + m.PodGroupName = &s iNdEx = postIndex default: iNdEx = preIndex @@ -54801,9 +55481,9 @@ func (m *PodSpec) Unmarshal(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.HostnameOverride = &s iNdEx = postIndex - case 42: + case 43: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WorkloadRef", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingGroup", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -54830,10 +55510,10 @@ func (m *PodSpec) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.WorkloadRef == nil { - m.WorkloadRef = &WorkloadReference{} + if m.SchedulingGroup == nil { + m.SchedulingGroup = &PodSchedulingGroup{} } - if err := m.WorkloadRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.SchedulingGroup.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -55637,6 +56317,40 @@ func (m *PodStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 21: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResourceClaimStatuses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NodeAllocatableResourceClaimStatuses = append(m.NodeAllocatableResourceClaimStatuses, NodeAllocatableResourceClaimStatus{}) + if err := m.NodeAllocatableResourceClaimStatuses[len(m.NodeAllocatableResourceClaimStatuses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -59194,13 +59908,159 @@ func (m *ResourceClaim) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Request = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ResourceFieldSelector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceFieldSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceFieldSelector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContainerName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContainerName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Resource = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Request", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Divisor", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -59210,23 +60070,24 @@ func (m *ResourceClaim) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Request = string(dAtA[iNdEx:postIndex]) + if err := m.Divisor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -59249,7 +60110,7 @@ func (m *ResourceClaim) Unmarshal(dAtA []byte) error { } return nil } -func (m *ResourceFieldSelector) Unmarshal(dAtA []byte) error { +func (m *ResourceHealth) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -59272,15 +60133,15 @@ func (m *ResourceFieldSelector) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ResourceFieldSelector: wiretype end group for non-group") + return fmt.Errorf("proto: ResourceHealth: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceFieldSelector: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResourceHealth: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ContainerName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ResourceID", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -59308,126 +60169,11 @@ func (m *ResourceFieldSelector) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ContainerName = string(dAtA[iNdEx:postIndex]) + m.ResourceID = ResourceID(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Resource", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Resource = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Divisor", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Divisor.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResourceHealth) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResourceHealth: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResourceHealth: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ResourceID", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -59455,11 +60201,11 @@ func (m *ResourceHealth) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ResourceID = ResourceID(dAtA[iNdEx:postIndex]) + m.Health = ResourceHealthStatus(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Health", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -59487,7 +60233,8 @@ func (m *ResourceHealth) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Health = ResourceHealthStatus(dAtA[iNdEx:postIndex]) + s := string(dAtA[iNdEx:postIndex]) + m.Message = &s iNdEx = postIndex default: iNdEx = preIndex @@ -68123,6 +68870,42 @@ func (m *VolumeMountStatus) Unmarshal(dAtA []byte) error { s := RecursiveReadOnlyMode(dAtA[iNdEx:postIndex]) m.RecursiveReadOnly = &s iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VolumeStatus", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VolumeStatus == nil { + m.VolumeStatus = &VolumeStatus{} + } + if err := m.VolumeStatus.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -69690,16 +70473,88 @@ func (m *VolumeSource) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PortworxVolume == nil { - m.PortworxVolume = &PortworxVolumeSource{} + if m.PortworxVolume == nil { + m.PortworxVolume = &PortworxVolumeSource{} + } + if err := m.PortworxVolume.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 25: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ScaleIO", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ScaleIO == nil { + m.ScaleIO = &ScaleIOVolumeSource{} + } + if err := m.ScaleIO.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 26: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Projected", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Projected == nil { + m.Projected = &ProjectedVolumeSource{} } - if err := m.PortworxVolume.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Projected.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 25: + case 27: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ScaleIO", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field StorageOS", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -69726,16 +70581,16 @@ func (m *VolumeSource) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ScaleIO == nil { - m.ScaleIO = &ScaleIOVolumeSource{} + if m.StorageOS == nil { + m.StorageOS = &StorageOSVolumeSource{} } - if err := m.ScaleIO.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.StorageOS.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 26: + case 28: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Projected", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CSI", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -69762,16 +70617,16 @@ func (m *VolumeSource) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Projected == nil { - m.Projected = &ProjectedVolumeSource{} + if m.CSI == nil { + m.CSI = &CSIVolumeSource{} } - if err := m.Projected.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CSI.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 27: + case 29: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StorageOS", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Ephemeral", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -69798,16 +70653,16 @@ func (m *VolumeSource) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.StorageOS == nil { - m.StorageOS = &StorageOSVolumeSource{} + if m.Ephemeral == nil { + m.Ephemeral = &EphemeralVolumeSource{} } - if err := m.StorageOS.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Ephemeral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 28: + case 30: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CSI", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -69834,50 +70689,64 @@ func (m *VolumeSource) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.CSI == nil { - m.CSI = &CSIVolumeSource{} + if m.Image == nil { + m.Image = &ImageVolumeSource{} } - if err := m.CSI.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Image.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 29: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ephemeral", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err } - postIndex := iNdEx + msglen - if postIndex < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGenerated } - if postIndex > l { + if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - if m.Ephemeral == nil { - m.Ephemeral = &EphemeralVolumeSource{} + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VolumeStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated } - if err := m.Ephemeral.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if iNdEx >= l { + return io.ErrUnexpectedEOF } - iNdEx = postIndex - case 30: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VolumeStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VolumeStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Image", wireType) } @@ -69907,7 +70776,7 @@ func (m *VolumeSource) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Image == nil { - m.Image = &ImageVolumeSource{} + m.Image = &ImageVolumeStatus{} } if err := m.Image.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -70384,152 +71253,6 @@ func (m *WindowsSecurityContextOptions) Unmarshal(dAtA []byte) error { } return nil } -func (m *WorkloadReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WorkloadReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WorkloadReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodGroup", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PodGroup = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodGroupReplicaKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PodGroupReplicaKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipGenerated(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/core/v1/generated.proto b/vendor/k8s.io/api/core/v1/generated.proto index 570b4d3438..ba4f80e5ec 100644 --- a/vendor/k8s.io/api/core/v1/generated.proto +++ b/vendor/k8s.io/api/core/v1/generated.proto @@ -1132,7 +1132,6 @@ message ContainerStatus { // AllocatedResources represents the compute resources allocated for this container by the // node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission // and after successfully admitting desired pod resize. - // +featureGate=InPlacePodVerticalScalingAllocatedStatus // +optional map allocatedResources = 10; @@ -2275,6 +2274,16 @@ message ImageVolumeSource { optional string pullPolicy = 2; } +// ImageVolumeStatus represents the image-based volume status. +message ImageVolumeStatus { + // ImageRef is the digest of the image used for this volume. + // It should have a value that's similar to the pod's status.containerStatuses[i].imageID. + // The ImageRef length should not exceed 256 characters. + // +kubebuilder:validation:MaxLength=256 + // +required + optional string imageRef = 1; +} + // Maps a string key to a path within a volume. message KeyToPath { // key is the key to project. @@ -2677,6 +2686,22 @@ message NodeAffinity { repeated PreferredSchedulingTerm preferredDuringSchedulingIgnoredDuringExecution = 2; } +// NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA. +message NodeAllocatableResourceClaimStatus { + // ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation. + // +required + optional string resourceClaimName = 1; + + // Containers lists the names of all containers in this pod that reference the claim. + // +optional + // +listType=set + repeated string containers = 2; + + // Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim. + // +required + map resources = 3; +} + // NodeCondition contains condition information for a node. message NodeCondition { // Type of node condition. @@ -2812,7 +2837,6 @@ message NodeRuntimeHandlerFeatures { optional bool recursiveReadOnlyMounts = 1; // UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes. - // +featureGate=UserNamespacesSupport // +optional optional bool userNamespaces = 2; } @@ -2974,7 +2998,6 @@ message NodeStatus { optional NodeConfigStatus config = 11; // The available runtime handlers. - // +featureGate=UserNamespacesSupport // +optional // +listType=atomic repeated NodeRuntimeHandler runtimeHandlers = 12; @@ -3528,8 +3551,7 @@ message PersistentVolumeSource { // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. // +optional optional PortworxVolumeSource portworxVolume = 18; @@ -3918,8 +3940,6 @@ message PodCondition { optional string type = 1; // If set, this represents the .metadata.generation that the pod condition was set based upon. - // The PodObservedGenerationTracking feature gate must be enabled to use this field. - // +featureGate=PodObservedGenerationTracking // +optional optional int64 observedGeneration = 7; @@ -4153,6 +4173,14 @@ message PodReadinessGate { // // It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. // Containers that need access to the ResourceClaim reference it with this name. +// +// When the DRAWorkloadResourceClaims feature gate is enabled and this Pod +// belongs to a PodGroup, a PodResourceClaim is matched to a +// PodGroupResourceClaim if all of their fields are equal (Name, +// ResourceClaimName, and ResourceClaimTemplateName). A matched claim references +// a single ResourceClaim shared across all Pods in the PodGroup, reserved for +// the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual +// Pods. message PodResourceClaim { // Name uniquely identifies this resource claim inside the pod. // This must be a DNS_LABEL. @@ -4174,6 +4202,16 @@ message PodResourceClaim { // generated component, will be used to form a unique name for the // ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. // + // When the DRAWorkloadResourceClaims feature gate is enabled and the pod + // belongs to a PodGroup that defines a PodGroupResourceClaim with the same + // Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the + // ResourceClaim generated for the PodGroup. All pods in the group that + // define an equivalent PodResourceClaim matching the + // PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same + // generated ResourceClaim. ResourceClaims generated for a PodGroup are + // owned by the PodGroup and their lifecycles are tied to the PodGroup + // instead of any individual pod. + // // This field is immutable and no changes will be made to the // corresponding ResourceClaim by the control plane after creating the // ResourceClaim. @@ -4193,9 +4231,16 @@ message PodResourceClaimStatus { optional string name = 1; // ResourceClaimName is the name of the ResourceClaim that was - // generated for the Pod in the namespace of the Pod. If this is - // unset, then generating a ResourceClaim was not necessary. The - // pod.spec.resourceClaims entry can be ignored in this case. + // generated for the Pod in the namespace of the Pod. + // + // When the DRAWorkloadResourceClaims feature is enabled and the + // corresponding PodResourceClaim matches a PodGroupResourceClaim + // made by the Pod's PodGroup, then this is the name of the + // ResourceClaim generated and reserved for the PodGroup. + // + // If this is unset, then generating a ResourceClaim was not + // necessary. The pod.spec.resourceClaims entry can be ignored in + // this case. // // +optional optional string resourceClaimName = 2; @@ -4208,6 +4253,20 @@ message PodSchedulingGate { optional string name = 1; } +// PodSchedulingGroup identifies the runtime scheduling group instance that a Pod belongs to. +// The scheduler uses this information to apply workload-aware scheduling semantics. +// Exactly one field must be specified. +// +union +message PodSchedulingGroup { + // PodGroupName specifies the name of the standalone PodGroup object + // that represents the runtime instance of this group. + // Must be a DNS subdomain. + // + // +optional + // +oneOf=GroupSelection + optional string podGroupName = 1; +} + // PodSecurityContext holds pod-level security attributes and common container settings. // Some fields are also present in container.securityContext. Field values of // container.securityContext take precedence over field values of PodSecurityContext. @@ -4669,7 +4728,6 @@ message PodSpec { // When set to false, a new userns is created for the pod. Setting false is useful for // mitigating container breakout vulnerabilities even allowing users to run their // containers as root without actually having root privileges on the host. - // This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature. // +k8s:conversion-gen=false // +optional optional bool hostUsers = 37; @@ -4735,17 +4793,22 @@ message PodSpec { // +optional optional string hostnameOverride = 41; - // WorkloadRef provides a reference to the Workload object that this Pod belongs to. - // This field is used by the scheduler to identify the PodGroup and apply the - // correct group scheduling policies. The Workload object referenced - // by this field may not exist at the time the Pod is created. - // This field is immutable, but a Workload object with the same name - // may be recreated with different policies. Doing this during pod scheduling + // SchedulingGroup provides a reference to the immediate scheduling runtime + // grouping object that this Pod belongs to. + // This field is used by the scheduler to identify the group and apply the + // correct group scheduling policies. The association with a group also + // impacts other lifecycle aspects of a Pod that are relevant in a wider context + // of scheduling like preemption, resource attachment, etc. If not specified, + // the Pod is treated as a single unit in all of these aspects. + // The group object referenced by this field may not exist at the time the + // Pod is created. + // This field is immutable, but a group object with the same name may be + // recreated with different policies. Doing this during pod scheduling // may result in the placement not conforming to the expected policies. // // +featureGate=GenericWorkload // +optional - optional WorkloadReference workloadRef = 42; + optional PodSchedulingGroup schedulingGroup = 43; } // PodStatus represents information about the status of a pod. Status may trail the actual @@ -4754,7 +4817,6 @@ message PodSpec { message PodStatus { // If set, this represents the .metadata.generation that the pod status was set based upon. // The PodObservedGenerationTracking feature gate must be enabled to use this field. - // +featureGate=PodObservedGenerationTracking // +optional optional int64 observedGeneration = 17; @@ -4923,6 +4985,16 @@ message PodStatus { // +featureGate=InPlacePodLevelResourcesVerticalScaling // +optional optional ResourceRequirements resources = 20; + + // NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources + // that were allocated for this pod through DRA claims. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // +featureGate=DRANodeAllocatableResources + // +optional + // +listType=atomic + repeated NodeAllocatableResourceClaimStatus nodeAllocatableResourceClaimStatuses = 21; } // PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded @@ -5300,8 +5372,8 @@ message ReplicationController { // be the same as the Pod(s) that the replication controller manages. // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines the specification of the desired behavior of the replication controller. @@ -5358,18 +5430,18 @@ message ReplicationControllerSpec { // Defaults to 1. // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=1 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 optional int32 replicas = 1; // Minimum number of seconds for which a newly created pod should be ready // without any of its container crashing, for it to be considered available. // Defaults to 0 (pod will be considered available as soon as it is ready) // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 optional int32 minReadySeconds = 4; // Selector is a label query over pods that should match the Replicas count. @@ -5468,6 +5540,12 @@ message ResourceHealth { // // In future we may want to introduce the PermanentlyUnhealthy Status. optional string health = 2; + + // Message provides human-readable context for Health (e.g. "ECC error count exceeded threshold"). + // This field is populated by the kubelet when ResourceHealthStatusMessage is enabled if the DRA plugin returns a message, and is null otherwise. + // +featureGate=ResourceHealthStatusMessage + // +optional + optional string message = 6; } // ResourceQuota sets aggregate quota restrictions enforced per namespace @@ -5970,7 +6048,6 @@ message SecurityContext { // procMount denotes the type of proc mount to use for the containers. // The default value is Default which uses the container runtime defaults for // readonly paths and masked paths. - // This requires the ProcMountType feature flag to be enabled. // Note that this field cannot be set when spec.os.name is windows. // +optional optional string procMount = 9; @@ -6885,6 +6962,11 @@ message VolumeMountStatus { // depending on the mount result. // +optional optional string recursiveReadOnly = 4; + + // volumeStatus represents volume-type-specific status about the mounted + // volume. + // +optional + optional VolumeStatus volumeStatus = 5; } // VolumeNodeAffinity defines constraints that limit what nodes this volume can be accessed from. @@ -7126,8 +7208,7 @@ message VolumeSource { // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. // +optional optional PortworxVolumeSource portworxVolume = 24; @@ -7184,14 +7265,22 @@ message VolumeSource { // A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. // The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. // The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. - // The volume will be mounted read-only (ro) and non-executable files (noexec). + // The volume will be mounted read-only (ro). // Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. // The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. - // +featureGate=ImageVolume // +optional optional ImageVolumeSource image = 30; } +// VolumeStatus represents the status of a mounted volume. +// At most one of its members must be specified. +message VolumeStatus { + // image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + // +featureGate=ImageVolumeWithDigest + // +optional + optional ImageVolumeStatus image = 1; +} + // Represents a vSphere volume resource. message VsphereVirtualDiskVolumeSource { // volumePath is the path that identifies vSphere volume vmdk @@ -7249,33 +7338,3 @@ message WindowsSecurityContextOptions { optional bool hostProcess = 4; } -// WorkloadReference identifies the Workload object and PodGroup membership -// that a Pod belongs to. The scheduler uses this information to apply -// workload-aware scheduling semantics. -message WorkloadReference { - // Name defines the name of the Workload object this Pod belongs to. - // Workload must be in the same namespace as the Pod. - // If it doesn't match any existing Workload, the Pod will remain unschedulable - // until a Workload object is created and observed by the kube-scheduler. - // It must be a DNS subdomain. - // - // +required - optional string name = 1; - - // PodGroup is the name of the PodGroup within the Workload that this Pod - // belongs to. If it doesn't match any existing PodGroup within the Workload, - // the Pod will remain unschedulable until the Workload object is recreated - // and observed by the kube-scheduler. It must be a DNS label. - // - // +required - optional string podGroup = 2; - - // PodGroupReplicaKey specifies the replica key of the PodGroup to which this - // Pod belongs. It is used to distinguish pods belonging to different replicas - // of the same pod group. The pod group policy is applied separately to each replica. - // When set, it must be a DNS label. - // - // +optional - optional string podGroupReplicaKey = 3; -} - diff --git a/vendor/k8s.io/api/core/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/core/v1/generated.protomessage.pb.go deleted file mode 100644 index cf74ffa088..0000000000 --- a/vendor/k8s.io/api/core/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,498 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*AWSElasticBlockStoreVolumeSource) ProtoMessage() {} - -func (*Affinity) ProtoMessage() {} - -func (*AppArmorProfile) ProtoMessage() {} - -func (*AttachedVolume) ProtoMessage() {} - -func (*AvoidPods) ProtoMessage() {} - -func (*AzureDiskVolumeSource) ProtoMessage() {} - -func (*AzureFilePersistentVolumeSource) ProtoMessage() {} - -func (*AzureFileVolumeSource) ProtoMessage() {} - -func (*Binding) ProtoMessage() {} - -func (*CSIPersistentVolumeSource) ProtoMessage() {} - -func (*CSIVolumeSource) ProtoMessage() {} - -func (*Capabilities) ProtoMessage() {} - -func (*CephFSPersistentVolumeSource) ProtoMessage() {} - -func (*CephFSVolumeSource) ProtoMessage() {} - -func (*CinderPersistentVolumeSource) ProtoMessage() {} - -func (*CinderVolumeSource) ProtoMessage() {} - -func (*ClientIPConfig) ProtoMessage() {} - -func (*ClusterTrustBundleProjection) ProtoMessage() {} - -func (*ComponentCondition) ProtoMessage() {} - -func (*ComponentStatus) ProtoMessage() {} - -func (*ComponentStatusList) ProtoMessage() {} - -func (*ConfigMap) ProtoMessage() {} - -func (*ConfigMapEnvSource) ProtoMessage() {} - -func (*ConfigMapKeySelector) ProtoMessage() {} - -func (*ConfigMapList) ProtoMessage() {} - -func (*ConfigMapNodeConfigSource) ProtoMessage() {} - -func (*ConfigMapProjection) ProtoMessage() {} - -func (*ConfigMapVolumeSource) ProtoMessage() {} - -func (*Container) ProtoMessage() {} - -func (*ContainerExtendedResourceRequest) ProtoMessage() {} - -func (*ContainerImage) ProtoMessage() {} - -func (*ContainerPort) ProtoMessage() {} - -func (*ContainerResizePolicy) ProtoMessage() {} - -func (*ContainerRestartRule) ProtoMessage() {} - -func (*ContainerRestartRuleOnExitCodes) ProtoMessage() {} - -func (*ContainerState) ProtoMessage() {} - -func (*ContainerStateRunning) ProtoMessage() {} - -func (*ContainerStateTerminated) ProtoMessage() {} - -func (*ContainerStateWaiting) ProtoMessage() {} - -func (*ContainerStatus) ProtoMessage() {} - -func (*ContainerUser) ProtoMessage() {} - -func (*DaemonEndpoint) ProtoMessage() {} - -func (*DownwardAPIProjection) ProtoMessage() {} - -func (*DownwardAPIVolumeFile) ProtoMessage() {} - -func (*DownwardAPIVolumeSource) ProtoMessage() {} - -func (*EmptyDirVolumeSource) ProtoMessage() {} - -func (*EndpointAddress) ProtoMessage() {} - -func (*EndpointPort) ProtoMessage() {} - -func (*EndpointSubset) ProtoMessage() {} - -func (*Endpoints) ProtoMessage() {} - -func (*EndpointsList) ProtoMessage() {} - -func (*EnvFromSource) ProtoMessage() {} - -func (*EnvVar) ProtoMessage() {} - -func (*EnvVarSource) ProtoMessage() {} - -func (*EphemeralContainer) ProtoMessage() {} - -func (*EphemeralContainerCommon) ProtoMessage() {} - -func (*EphemeralVolumeSource) ProtoMessage() {} - -func (*Event) ProtoMessage() {} - -func (*EventList) ProtoMessage() {} - -func (*EventSeries) ProtoMessage() {} - -func (*EventSource) ProtoMessage() {} - -func (*ExecAction) ProtoMessage() {} - -func (*FCVolumeSource) ProtoMessage() {} - -func (*FileKeySelector) ProtoMessage() {} - -func (*FlexPersistentVolumeSource) ProtoMessage() {} - -func (*FlexVolumeSource) ProtoMessage() {} - -func (*FlockerVolumeSource) ProtoMessage() {} - -func (*GCEPersistentDiskVolumeSource) ProtoMessage() {} - -func (*GRPCAction) ProtoMessage() {} - -func (*GitRepoVolumeSource) ProtoMessage() {} - -func (*GlusterfsPersistentVolumeSource) ProtoMessage() {} - -func (*GlusterfsVolumeSource) ProtoMessage() {} - -func (*HTTPGetAction) ProtoMessage() {} - -func (*HTTPHeader) ProtoMessage() {} - -func (*HostAlias) ProtoMessage() {} - -func (*HostIP) ProtoMessage() {} - -func (*HostPathVolumeSource) ProtoMessage() {} - -func (*ISCSIPersistentVolumeSource) ProtoMessage() {} - -func (*ISCSIVolumeSource) ProtoMessage() {} - -func (*ImageVolumeSource) ProtoMessage() {} - -func (*KeyToPath) ProtoMessage() {} - -func (*Lifecycle) ProtoMessage() {} - -func (*LifecycleHandler) ProtoMessage() {} - -func (*LimitRange) ProtoMessage() {} - -func (*LimitRangeItem) ProtoMessage() {} - -func (*LimitRangeList) ProtoMessage() {} - -func (*LimitRangeSpec) ProtoMessage() {} - -func (*LinuxContainerUser) ProtoMessage() {} - -func (*List) ProtoMessage() {} - -func (*LoadBalancerIngress) ProtoMessage() {} - -func (*LoadBalancerStatus) ProtoMessage() {} - -func (*LocalObjectReference) ProtoMessage() {} - -func (*LocalVolumeSource) ProtoMessage() {} - -func (*ModifyVolumeStatus) ProtoMessage() {} - -func (*NFSVolumeSource) ProtoMessage() {} - -func (*Namespace) ProtoMessage() {} - -func (*NamespaceCondition) ProtoMessage() {} - -func (*NamespaceList) ProtoMessage() {} - -func (*NamespaceSpec) ProtoMessage() {} - -func (*NamespaceStatus) ProtoMessage() {} - -func (*Node) ProtoMessage() {} - -func (*NodeAddress) ProtoMessage() {} - -func (*NodeAffinity) ProtoMessage() {} - -func (*NodeCondition) ProtoMessage() {} - -func (*NodeConfigSource) ProtoMessage() {} - -func (*NodeConfigStatus) ProtoMessage() {} - -func (*NodeDaemonEndpoints) ProtoMessage() {} - -func (*NodeFeatures) ProtoMessage() {} - -func (*NodeList) ProtoMessage() {} - -func (*NodeProxyOptions) ProtoMessage() {} - -func (*NodeRuntimeHandler) ProtoMessage() {} - -func (*NodeRuntimeHandlerFeatures) ProtoMessage() {} - -func (*NodeSelector) ProtoMessage() {} - -func (*NodeSelectorRequirement) ProtoMessage() {} - -func (*NodeSelectorTerm) ProtoMessage() {} - -func (*NodeSpec) ProtoMessage() {} - -func (*NodeStatus) ProtoMessage() {} - -func (*NodeSwapStatus) ProtoMessage() {} - -func (*NodeSystemInfo) ProtoMessage() {} - -func (*ObjectFieldSelector) ProtoMessage() {} - -func (*ObjectReference) ProtoMessage() {} - -func (*PersistentVolume) ProtoMessage() {} - -func (*PersistentVolumeClaim) ProtoMessage() {} - -func (*PersistentVolumeClaimCondition) ProtoMessage() {} - -func (*PersistentVolumeClaimList) ProtoMessage() {} - -func (*PersistentVolumeClaimSpec) ProtoMessage() {} - -func (*PersistentVolumeClaimStatus) ProtoMessage() {} - -func (*PersistentVolumeClaimTemplate) ProtoMessage() {} - -func (*PersistentVolumeClaimVolumeSource) ProtoMessage() {} - -func (*PersistentVolumeList) ProtoMessage() {} - -func (*PersistentVolumeSource) ProtoMessage() {} - -func (*PersistentVolumeSpec) ProtoMessage() {} - -func (*PersistentVolumeStatus) ProtoMessage() {} - -func (*PhotonPersistentDiskVolumeSource) ProtoMessage() {} - -func (*Pod) ProtoMessage() {} - -func (*PodAffinity) ProtoMessage() {} - -func (*PodAffinityTerm) ProtoMessage() {} - -func (*PodAntiAffinity) ProtoMessage() {} - -func (*PodAttachOptions) ProtoMessage() {} - -func (*PodCertificateProjection) ProtoMessage() {} - -func (*PodCondition) ProtoMessage() {} - -func (*PodDNSConfig) ProtoMessage() {} - -func (*PodDNSConfigOption) ProtoMessage() {} - -func (*PodExecOptions) ProtoMessage() {} - -func (*PodExtendedResourceClaimStatus) ProtoMessage() {} - -func (*PodIP) ProtoMessage() {} - -func (*PodList) ProtoMessage() {} - -func (*PodLogOptions) ProtoMessage() {} - -func (*PodOS) ProtoMessage() {} - -func (*PodPortForwardOptions) ProtoMessage() {} - -func (*PodProxyOptions) ProtoMessage() {} - -func (*PodReadinessGate) ProtoMessage() {} - -func (*PodResourceClaim) ProtoMessage() {} - -func (*PodResourceClaimStatus) ProtoMessage() {} - -func (*PodSchedulingGate) ProtoMessage() {} - -func (*PodSecurityContext) ProtoMessage() {} - -func (*PodSignature) ProtoMessage() {} - -func (*PodSpec) ProtoMessage() {} - -func (*PodStatus) ProtoMessage() {} - -func (*PodStatusResult) ProtoMessage() {} - -func (*PodTemplate) ProtoMessage() {} - -func (*PodTemplateList) ProtoMessage() {} - -func (*PodTemplateSpec) ProtoMessage() {} - -func (*PortStatus) ProtoMessage() {} - -func (*PortworxVolumeSource) ProtoMessage() {} - -func (*Preconditions) ProtoMessage() {} - -func (*PreferAvoidPodsEntry) ProtoMessage() {} - -func (*PreferredSchedulingTerm) ProtoMessage() {} - -func (*Probe) ProtoMessage() {} - -func (*ProbeHandler) ProtoMessage() {} - -func (*ProjectedVolumeSource) ProtoMessage() {} - -func (*QuobyteVolumeSource) ProtoMessage() {} - -func (*RBDPersistentVolumeSource) ProtoMessage() {} - -func (*RBDVolumeSource) ProtoMessage() {} - -func (*RangeAllocation) ProtoMessage() {} - -func (*ReplicationController) ProtoMessage() {} - -func (*ReplicationControllerCondition) ProtoMessage() {} - -func (*ReplicationControllerList) ProtoMessage() {} - -func (*ReplicationControllerSpec) ProtoMessage() {} - -func (*ReplicationControllerStatus) ProtoMessage() {} - -func (*ResourceClaim) ProtoMessage() {} - -func (*ResourceFieldSelector) ProtoMessage() {} - -func (*ResourceHealth) ProtoMessage() {} - -func (*ResourceQuota) ProtoMessage() {} - -func (*ResourceQuotaList) ProtoMessage() {} - -func (*ResourceQuotaSpec) ProtoMessage() {} - -func (*ResourceQuotaStatus) ProtoMessage() {} - -func (*ResourceRequirements) ProtoMessage() {} - -func (*ResourceStatus) ProtoMessage() {} - -func (*SELinuxOptions) ProtoMessage() {} - -func (*ScaleIOPersistentVolumeSource) ProtoMessage() {} - -func (*ScaleIOVolumeSource) ProtoMessage() {} - -func (*ScopeSelector) ProtoMessage() {} - -func (*ScopedResourceSelectorRequirement) ProtoMessage() {} - -func (*SeccompProfile) ProtoMessage() {} - -func (*Secret) ProtoMessage() {} - -func (*SecretEnvSource) ProtoMessage() {} - -func (*SecretKeySelector) ProtoMessage() {} - -func (*SecretList) ProtoMessage() {} - -func (*SecretProjection) ProtoMessage() {} - -func (*SecretReference) ProtoMessage() {} - -func (*SecretVolumeSource) ProtoMessage() {} - -func (*SecurityContext) ProtoMessage() {} - -func (*SerializedReference) ProtoMessage() {} - -func (*Service) ProtoMessage() {} - -func (*ServiceAccount) ProtoMessage() {} - -func (*ServiceAccountList) ProtoMessage() {} - -func (*ServiceAccountTokenProjection) ProtoMessage() {} - -func (*ServiceList) ProtoMessage() {} - -func (*ServicePort) ProtoMessage() {} - -func (*ServiceProxyOptions) ProtoMessage() {} - -func (*ServiceSpec) ProtoMessage() {} - -func (*ServiceStatus) ProtoMessage() {} - -func (*SessionAffinityConfig) ProtoMessage() {} - -func (*SleepAction) ProtoMessage() {} - -func (*StorageOSPersistentVolumeSource) ProtoMessage() {} - -func (*StorageOSVolumeSource) ProtoMessage() {} - -func (*Sysctl) ProtoMessage() {} - -func (*TCPSocketAction) ProtoMessage() {} - -func (*Taint) ProtoMessage() {} - -func (*Toleration) ProtoMessage() {} - -func (*TopologySelectorLabelRequirement) ProtoMessage() {} - -func (*TopologySelectorTerm) ProtoMessage() {} - -func (*TopologySpreadConstraint) ProtoMessage() {} - -func (*TypedLocalObjectReference) ProtoMessage() {} - -func (*TypedObjectReference) ProtoMessage() {} - -func (*Volume) ProtoMessage() {} - -func (*VolumeDevice) ProtoMessage() {} - -func (*VolumeMount) ProtoMessage() {} - -func (*VolumeMountStatus) ProtoMessage() {} - -func (*VolumeNodeAffinity) ProtoMessage() {} - -func (*VolumeProjection) ProtoMessage() {} - -func (*VolumeResourceRequirements) ProtoMessage() {} - -func (*VolumeSource) ProtoMessage() {} - -func (*VsphereVirtualDiskVolumeSource) ProtoMessage() {} - -func (*WeightedPodAffinityTerm) ProtoMessage() {} - -func (*WindowsSecurityContextOptions) ProtoMessage() {} - -func (*WorkloadReference) ProtoMessage() {} diff --git a/vendor/k8s.io/api/core/v1/types.go b/vendor/k8s.io/api/core/v1/types.go index 705c82083c..ac0494f3c5 100644 --- a/vendor/k8s.io/api/core/v1/types.go +++ b/vendor/k8s.io/api/core/v1/types.go @@ -161,8 +161,7 @@ type VolumeSource struct { Projected *ProjectedVolumeSource `json:"projected,omitempty" protobuf:"bytes,26,opt,name=projected"` // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. // +optional PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,24,opt,name=portworxVolume"` // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. @@ -214,10 +213,9 @@ type VolumeSource struct { // A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. // The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. // The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. - // The volume will be mounted read-only (ro) and non-executable files (noexec). + // The volume will be mounted read-only (ro). // Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. // The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. - // +featureGate=ImageVolume // +optional Image *ImageVolumeSource `json:"image,omitempty" protobuf:"bytes,30,opt,name=image"` } @@ -325,8 +323,7 @@ type PersistentVolumeSource struct { PhotonPersistentDisk *PhotonPersistentDiskVolumeSource `json:"photonPersistentDisk,omitempty" protobuf:"bytes,17,opt,name=photonPersistentDisk"` // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. // +optional PortworxVolume *PortworxVolumeSource `json:"portworxVolume,omitempty" protobuf:"bytes,18,opt,name=portworxVolume"` // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. @@ -672,6 +669,17 @@ const ( PersistentVolumeClaimVolumeModifyVolumeError PersistentVolumeClaimConditionType = "ModifyVolumeError" // Volume is being modified PersistentVolumeClaimVolumeModifyingVolume PersistentVolumeClaimConditionType = "ModifyingVolume" + + // PersistentVolumeClaimUnused indicates whether the PVC is currently not in use by any Pod. + // When status is True, the PVC is not referenced by any non-terminal Pod. + // The lastTransitionTime indicates when the PVC last transitioned to being unused. + // + // Both in-use time and unused time duration indicated by this condition may be shorter or + // slightly longer than actual in-use time or unused time because of processing delays or + // when this feature was enabled in the cluster. + // + // Requires PersistentVolumeClaimUnusedSinceTime alpha featuregate + PersistentVolumeClaimUnused PersistentVolumeClaimConditionType = "Unused" ) // +enum @@ -3363,7 +3371,6 @@ type ContainerStatus struct { // AllocatedResources represents the compute resources allocated for this container by the // node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission // and after successfully admitting desired pod resize. - // +featureGate=InPlacePodVerticalScalingAllocatedStatus // +optional AllocatedResources ResourceList `json:"allocatedResources,omitempty" protobuf:"bytes,10,rep,name=allocatedResources,casttype=ResourceList,castkey=ResourceName"` // Resources represents the compute resource requests and limits that have been successfully @@ -3421,6 +3428,10 @@ const ( ResourceHealthStatusUnknown ResourceHealthStatus = "Unknown" ) +// ResourceHealthMessageMaxLength is the maximum length for ResourceHealth.Message field. +// Messages longer than this will be truncated with "..." appended. +const ResourceHealthMessageMaxLength = 1024 + // ResourceID is calculated based on the source of this resource health information. // For DevicePlugin: // @@ -3448,6 +3459,11 @@ type ResourceHealth struct { // // In future we may want to introduce the PermanentlyUnhealthy Status. Health ResourceHealthStatus `json:"health,omitempty" protobuf:"bytes,2,name=health"` + // Message provides human-readable context for Health (e.g. "ECC error count exceeded threshold"). + // This field is populated by the kubelet when ResourceHealthStatusMessage is enabled if the DRA plugin returns a message, and is null otherwise. + // +featureGate=ResourceHealthStatusMessage + // +optional + Message *string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` } // ContainerUser represents user identity information @@ -3575,8 +3591,6 @@ type PodCondition struct { // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions Type PodConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=PodConditionType"` // If set, this represents the .metadata.generation that the pod condition was set based upon. - // The PodObservedGenerationTracking feature gate must be enabled to use this field. - // +featureGate=PodObservedGenerationTracking // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,7,opt,name=observedGeneration"` // Status is the status of the condition. @@ -3623,6 +3637,29 @@ type VolumeMountStatus struct { // depending on the mount result. // +optional RecursiveReadOnly *RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty" protobuf:"bytes,4,opt,name=recursiveReadOnly,casttype=RecursiveReadOnlyMode"` + // volumeStatus represents volume-type-specific status about the mounted + // volume. + // +optional + VolumeStatus *VolumeStatus `json:"volumeStatus,omitempty" protobuf:"bytes,5,opt,name=volumeStatus"` +} + +// VolumeStatus represents the status of a mounted volume. +// At most one of its members must be specified. +type VolumeStatus struct { + // image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + // +featureGate=ImageVolumeWithDigest + // +optional + Image *ImageVolumeStatus `json:"image,omitempty" protobuf:"bytes,1,opt,name=image"` +} + +// ImageVolumeStatus represents the image-based volume status. +type ImageVolumeStatus struct { + // ImageRef is the digest of the image used for this volume. + // It should have a value that's similar to the pod's status.containerStatuses[i].imageID. + // The ImageRef length should not exceed 256 characters. + // +kubebuilder:validation:MaxLength=256 + // +required + ImageRef string `json:"imageRef,omitempty" protobuf:"bytes,1,opt,name=imageRef"` } // RestartPolicy describes how the container should be restarted. @@ -4378,7 +4415,6 @@ type PodSpec struct { // When set to false, a new userns is created for the pod. Setting false is useful for // mitigating container breakout vulnerabilities even allowing users to run their // containers as root without actually having root privileges on the host. - // This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature. // +k8s:conversion-gen=false // +optional HostUsers *bool `json:"hostUsers,omitempty" protobuf:"bytes,37,opt,name=hostUsers"` @@ -4440,17 +4476,27 @@ type PodSpec struct { // +featureGate=HostnameOverride // +optional HostnameOverride *string `json:"hostnameOverride,omitempty" protobuf:"bytes,41,opt,name=hostnameOverride"` - // WorkloadRef provides a reference to the Workload object that this Pod belongs to. - // This field is used by the scheduler to identify the PodGroup and apply the - // correct group scheduling policies. The Workload object referenced - // by this field may not exist at the time the Pod is created. - // This field is immutable, but a Workload object with the same name - // may be recreated with different policies. Doing this during pod scheduling + + // WorkloadRef is tombstoned to show why 42 is a reserved protobuf tag. + // This field got replaced with the SchedulingGroup field in Kubernetes 1.36. + // WorkloadRef *WorkloadReference `json:"workloadRef,omitempty" protobuf:"bytes,42,opt,name=workloadRef"` + + // SchedulingGroup provides a reference to the immediate scheduling runtime + // grouping object that this Pod belongs to. + // This field is used by the scheduler to identify the group and apply the + // correct group scheduling policies. The association with a group also + // impacts other lifecycle aspects of a Pod that are relevant in a wider context + // of scheduling like preemption, resource attachment, etc. If not specified, + // the Pod is treated as a single unit in all of these aspects. + // The group object referenced by this field may not exist at the time the + // Pod is created. + // This field is immutable, but a group object with the same name may be + // recreated with different policies. Doing this during pod scheduling // may result in the placement not conforming to the expected policies. // // +featureGate=GenericWorkload // +optional - WorkloadRef *WorkloadReference `json:"workloadRef,omitempty" protobuf:"bytes,42,opt,name=workloadRef"` + SchedulingGroup *PodSchedulingGroup `json:"schedulingGroup,omitempty" protobuf:"bytes,43,opt,name=schedulingGroup"` } // PodResourceClaim references exactly one ResourceClaim, either directly @@ -4459,6 +4505,14 @@ type PodSpec struct { // // It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. // Containers that need access to the ResourceClaim reference it with this name. +// +// When the DRAWorkloadResourceClaims feature gate is enabled and this Pod +// belongs to a PodGroup, a PodResourceClaim is matched to a +// PodGroupResourceClaim if all of their fields are equal (Name, +// ResourceClaimName, and ResourceClaimTemplateName). A matched claim references +// a single ResourceClaim shared across all Pods in the PodGroup, reserved for +// the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual +// Pods. type PodResourceClaim struct { // Name uniquely identifies this resource claim inside the pod. // This must be a DNS_LABEL. @@ -4485,6 +4539,16 @@ type PodResourceClaim struct { // generated component, will be used to form a unique name for the // ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. // + // When the DRAWorkloadResourceClaims feature gate is enabled and the pod + // belongs to a PodGroup that defines a PodGroupResourceClaim with the same + // Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the + // ResourceClaim generated for the PodGroup. All pods in the group that + // define an equivalent PodResourceClaim matching the + // PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same + // generated ResourceClaim. ResourceClaims generated for a PodGroup are + // owned by the PodGroup and their lifecycles are tied to the PodGroup + // instead of any individual pod. + // // This field is immutable and no changes will be made to the // corresponding ResourceClaim by the control plane after creating the // ResourceClaim. @@ -4504,9 +4568,16 @@ type PodResourceClaimStatus struct { Name string `json:"name" protobuf:"bytes,1,name=name"` // ResourceClaimName is the name of the ResourceClaim that was - // generated for the Pod in the namespace of the Pod. If this is - // unset, then generating a ResourceClaim was not necessary. The - // pod.spec.resourceClaims entry can be ignored in this case. + // generated for the Pod in the namespace of the Pod. + // + // When the DRAWorkloadResourceClaims feature is enabled and the + // corresponding PodResourceClaim matches a PodGroupResourceClaim + // made by the Pod's PodGroup, then this is the name of the + // ResourceClaim generated and reserved for the PodGroup. + // + // If this is unset, then generating a ResourceClaim was not + // necessary. The pod.spec.resourceClaims entry can be ignored in + // this case. // // +optional ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` @@ -4562,34 +4633,18 @@ type PodSchedulingGate struct { Name string `json:"name" protobuf:"bytes,1,opt,name=name"` } -// WorkloadReference identifies the Workload object and PodGroup membership -// that a Pod belongs to. The scheduler uses this information to apply -// workload-aware scheduling semantics. -type WorkloadReference struct { - // Name defines the name of the Workload object this Pod belongs to. - // Workload must be in the same namespace as the Pod. - // If it doesn't match any existing Workload, the Pod will remain unschedulable - // until a Workload object is created and observed by the kube-scheduler. - // It must be a DNS subdomain. - // - // +required - Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - - // PodGroup is the name of the PodGroup within the Workload that this Pod - // belongs to. If it doesn't match any existing PodGroup within the Workload, - // the Pod will remain unschedulable until the Workload object is recreated - // and observed by the kube-scheduler. It must be a DNS label. - // - // +required - PodGroup string `json:"podGroup" protobuf:"bytes,2,opt,name=podGroup"` - - // PodGroupReplicaKey specifies the replica key of the PodGroup to which this - // Pod belongs. It is used to distinguish pods belonging to different replicas - // of the same pod group. The pod group policy is applied separately to each replica. - // When set, it must be a DNS label. +// PodSchedulingGroup identifies the runtime scheduling group instance that a Pod belongs to. +// The scheduler uses this information to apply workload-aware scheduling semantics. +// Exactly one field must be specified. +// +union +type PodSchedulingGroup struct { + // PodGroupName specifies the name of the standalone PodGroup object + // that represents the runtime instance of this group. + // Must be a DNS subdomain. // // +optional - PodGroupReplicaKey string `json:"podGroupReplicaKey,omitempty" protobuf:"bytes,3,opt,name=podGroupReplicaKey"` + // +oneOf=GroupSelection + PodGroupName *string `json:"podGroupName,omitempty" protobuf:"bytes,1,opt,name=podGroupName"` } // +enum @@ -5251,7 +5306,6 @@ type EphemeralContainer struct { type PodStatus struct { // If set, this represents the .metadata.generation that the pod status was set based upon. // The PodObservedGenerationTracking feature gate must be enabled to use this field. - // +featureGate=PodObservedGenerationTracking // +optional ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,17,opt,name=observedGeneration"` // The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. @@ -5414,6 +5468,16 @@ type PodStatus struct { // +featureGate=InPlacePodLevelResourcesVerticalScaling // +optional Resources *ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,20,opt,name=resources"` + + // NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources + // that were allocated for this pod through DRA claims. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // +featureGate=DRANodeAllocatableResources + // +optional + // +listType=atomic + NodeAllocatableResourceClaimStatuses []NodeAllocatableResourceClaimStatus `json:"nodeAllocatableResourceClaimStatuses,omitempty" protobuf:"bytes,21,rep,name=nodeAllocatableResourceClaimStatuses"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -5533,18 +5597,18 @@ type ReplicationControllerSpec struct { // Defaults to 1. // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#what-is-a-replicationcontroller // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=1 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` // Minimum number of seconds for which a newly created pod should be ready // without any of its container crashing, for it to be considered available. // Defaults to 0 (pod will be considered available as soon as it is ready) // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"` // Selector is a label query over pods that should match the Replicas count. @@ -5634,7 +5698,7 @@ type ReplicationControllerCondition struct { // +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.0 -// +k8s:supportsSubresource=/scale +// +k8s:supportsSubresource="/scale" // ReplicationController represents the configuration of a replication controller. type ReplicationController struct { @@ -5644,8 +5708,8 @@ type ReplicationController struct { // be the same as the Pod(s) that the replication controller manages. // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines the specification of the desired behavior of the replication controller. @@ -6585,7 +6649,6 @@ type NodeRuntimeHandlerFeatures struct { // +optional RecursiveReadOnlyMounts *bool `json:"recursiveReadOnlyMounts,omitempty" protobuf:"varint,1,opt,name=recursiveReadOnlyMounts"` // UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes. - // +featureGate=UserNamespacesSupport // +optional UserNamespaces *bool `json:"userNamespaces,omitempty" protobuf:"varint,2,opt,name=userNamespaces"` } @@ -6756,7 +6819,6 @@ type NodeStatus struct { // +optional Config *NodeConfigStatus `json:"config,omitempty" protobuf:"bytes,11,opt,name=config"` // The available runtime handlers. - // +featureGate=UserNamespacesSupport // +optional // +listType=atomic RuntimeHandlers []NodeRuntimeHandler `json:"runtimeHandlers,omitempty" protobuf:"bytes,12,rep,name=runtimeHandlers"` @@ -8247,7 +8309,6 @@ type SecurityContext struct { // procMount denotes the type of proc mount to use for the containers. // The default value is Default which uses the container runtime defaults for // readonly paths and masked paths. - // This requires the ProcMountType feature flag to be enabled. // Note that this field cannot be set when spec.os.name is windows. // +optional ProcMount *ProcMountType `json:"procMount,omitempty" protobuf:"bytes,9,opt,name=procMount"` @@ -8452,3 +8513,17 @@ type ImageVolumeSource struct { // +optional PullPolicy PullPolicy `json:"pullPolicy,omitempty" protobuf:"bytes,2,opt,name=pullPolicy,casttype=PullPolicy"` } + +// NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA. +type NodeAllocatableResourceClaimStatus struct { + // ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation. + // +required + ResourceClaimName string `json:"resourceClaimName" protobuf:"bytes,1,opt,name=resourceClaimName"` + // Containers lists the names of all containers in this pod that reference the claim. + // +optional + // +listType=set + Containers []string `json:"containers,omitempty" protobuf:"bytes,2,rep,name=containers"` + // Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim. + // +required + Resources map[ResourceName]resource.Quantity `json:"resources" protobuf:"bytes,3,rep,name=resources"` +} diff --git a/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go index 0f5e44e917..97eb5ceec3 100644 --- a/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go @@ -992,6 +992,15 @@ func (ImageVolumeSource) SwaggerDoc() map[string]string { return map_ImageVolumeSource } +var map_ImageVolumeStatus = map[string]string{ + "": "ImageVolumeStatus represents the image-based volume status.", + "imageRef": "ImageRef is the digest of the image used for this volume. It should have a value that's similar to the pod's status.containerStatuses[i].imageID. The ImageRef length should not exceed 256 characters.", +} + +func (ImageVolumeStatus) SwaggerDoc() map[string]string { + return map_ImageVolumeStatus +} + var map_KeyToPath = map[string]string{ "": "Maps a string key to a path within a volume.", "key": "key is the key to project.", @@ -1225,6 +1234,17 @@ func (NodeAffinity) SwaggerDoc() map[string]string { return map_NodeAffinity } +var map_NodeAllocatableResourceClaimStatus = map[string]string{ + "": "NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA.", + "resourceClaimName": "ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation.", + "containers": "Containers lists the names of all containers in this pod that reference the claim.", + "resources": "Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim.", +} + +func (NodeAllocatableResourceClaimStatus) SwaggerDoc() map[string]string { + return map_NodeAllocatableResourceClaimStatus +} + var map_NodeCondition = map[string]string{ "": "NodeCondition contains condition information for a node.", "type": "Type of node condition.", @@ -1565,7 +1585,7 @@ var map_PersistentVolumeSource = map[string]string{ "quobyte": "quobyte represents a Quobyte mount on the host that shares a pod's lifetime. Deprecated: Quobyte is deprecated and the in-tree quobyte type is no longer supported.", "azureDisk": "azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type are redirected to the disk.csi.azure.com CSI driver.", "photonPersistentDisk": "photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported.", - "portworxVolume": "portworxVolume represents a portworx volume attached and mounted on kubelets host machine. Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate is on.", + "portworxVolume": "portworxVolume represents a portworx volume attached and mounted on kubelets host machine. Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type are redirected to the pxd.portworx.com CSI driver.", "scaleIO": "scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported.", "local": "local represents directly-attached storage with node affinity", "storageos": "storageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod. Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported. More info: https://examples.k8s.io/volumes/storageos/README.md", @@ -1691,7 +1711,7 @@ func (PodCertificateProjection) SwaggerDoc() map[string]string { var map_PodCondition = map[string]string{ "": "PodCondition contains details for the current condition of this pod.", "type": "Type is the type of the condition. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", - "observedGeneration": "If set, this represents the .metadata.generation that the pod condition was set based upon. The PodObservedGenerationTracking feature gate must be enabled to use this field.", + "observedGeneration": "If set, this represents the .metadata.generation that the pod condition was set based upon.", "status": "Status is the status of the condition. Can be True, False, Unknown. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", "lastProbeTime": "Last time we probed the condition.", "lastTransitionTime": "Last time the condition transitioned from one status to another.", @@ -1822,10 +1842,10 @@ func (PodReadinessGate) SwaggerDoc() map[string]string { } var map_PodResourceClaim = map[string]string{ - "": "PodResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the pod.\n\nIt adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name.", + "": "PodResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the pod.\n\nIt adds a name to it that uniquely identifies the ResourceClaim inside the Pod. Containers that need access to the ResourceClaim reference it with this name.\n\nWhen the DRAWorkloadResourceClaims feature gate is enabled and this Pod belongs to a PodGroup, a PodResourceClaim is matched to a PodGroupResourceClaim if all of their fields are equal (Name, ResourceClaimName, and ResourceClaimTemplateName). A matched claim references a single ResourceClaim shared across all Pods in the PodGroup, reserved for the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual Pods.", "name": "Name uniquely identifies this resource claim inside the pod. This must be a DNS_LABEL.", "resourceClaimName": "ResourceClaimName is the name of a ResourceClaim object in the same namespace as this pod.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", - "resourceClaimTemplateName": "ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The pod name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", + "resourceClaimTemplateName": "ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this pod.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this pod. When this pod is deleted, the ResourceClaim will also be deleted. The pod name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses.\n\nWhen the DRAWorkloadResourceClaims feature gate is enabled and the pod belongs to a PodGroup that defines a PodGroupResourceClaim with the same Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the ResourceClaim generated for the PodGroup. All pods in the group that define an equivalent PodResourceClaim matching the PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same generated ResourceClaim. ResourceClaims generated for a PodGroup are owned by the PodGroup and their lifecycles are tied to the PodGroup instead of any individual pod.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", } func (PodResourceClaim) SwaggerDoc() map[string]string { @@ -1835,7 +1855,7 @@ func (PodResourceClaim) SwaggerDoc() map[string]string { var map_PodResourceClaimStatus = map[string]string{ "": "PodResourceClaimStatus is stored in the PodStatus for each PodResourceClaim which references a ResourceClaimTemplate. It stores the generated name for the corresponding ResourceClaim.", "name": "Name uniquely identifies this resource claim inside the pod. This must match the name of an entry in pod.spec.resourceClaims, which implies that the string must be a DNS_LABEL.", - "resourceClaimName": "ResourceClaimName is the name of the ResourceClaim that was generated for the Pod in the namespace of the Pod. If this is unset, then generating a ResourceClaim was not necessary. The pod.spec.resourceClaims entry can be ignored in this case.", + "resourceClaimName": "ResourceClaimName is the name of the ResourceClaim that was generated for the Pod in the namespace of the Pod.\n\nWhen the DRAWorkloadResourceClaims feature is enabled and the corresponding PodResourceClaim matches a PodGroupResourceClaim made by the Pod's PodGroup, then this is the name of the ResourceClaim generated and reserved for the PodGroup.\n\nIf this is unset, then generating a ResourceClaim was not necessary. The pod.spec.resourceClaims entry can be ignored in this case.", } func (PodResourceClaimStatus) SwaggerDoc() map[string]string { @@ -1851,6 +1871,15 @@ func (PodSchedulingGate) SwaggerDoc() map[string]string { return map_PodSchedulingGate } +var map_PodSchedulingGroup = map[string]string{ + "": "PodSchedulingGroup identifies the runtime scheduling group instance that a Pod belongs to. The scheduler uses this information to apply workload-aware scheduling semantics. Exactly one field must be specified.", + "podGroupName": "PodGroupName specifies the name of the standalone PodGroup object that represents the runtime instance of this group. Must be a DNS subdomain.", +} + +func (PodSchedulingGroup) SwaggerDoc() map[string]string { + return map_PodSchedulingGroup +} + var map_PodSecurityContext = map[string]string{ "": "PodSecurityContext holds pod-level security attributes and common container settings. Some fields are also present in container.securityContext. Field values of container.securityContext take precedence over field values of PodSecurityContext.", "seLinuxOptions": "The SELinux context to be applied to all containers. If unspecified, the container runtime will allocate a random SELinux context for each container. May also be set in SecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence for that container. Note that this field cannot be set when spec.os.name is windows.", @@ -1919,12 +1948,12 @@ var map_PodSpec = map[string]string{ "topologySpreadConstraints": "TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed.", "setHostnameAsFQDN": "If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default). In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname). In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN. If a pod does not have FQDN, this has no effect. Default to false.", "os": "Specifies the OS of the containers in the pod. Some pod and container fields are restricted if this is set.\n\nIf the OS field is set to linux, the following fields must be unset: -securityContext.windowsOptions\n\nIf the OS field is set to windows, following fields must be unset: - spec.hostPID - spec.hostIPC - spec.hostUsers - spec.resources - spec.securityContext.appArmorProfile - spec.securityContext.seLinuxOptions - spec.securityContext.seccompProfile - spec.securityContext.fsGroup - spec.securityContext.fsGroupChangePolicy - spec.securityContext.sysctls - spec.shareProcessNamespace - spec.securityContext.runAsUser - spec.securityContext.runAsGroup - spec.securityContext.supplementalGroups - spec.securityContext.supplementalGroupsPolicy - spec.containers[*].securityContext.appArmorProfile - spec.containers[*].securityContext.seLinuxOptions - spec.containers[*].securityContext.seccompProfile - spec.containers[*].securityContext.capabilities - spec.containers[*].securityContext.readOnlyRootFilesystem - spec.containers[*].securityContext.privileged - spec.containers[*].securityContext.allowPrivilegeEscalation - spec.containers[*].securityContext.procMount - spec.containers[*].securityContext.runAsUser - spec.containers[*].securityContext.runAsGroup", - "hostUsers": "Use the host's user namespace. Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host. This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature.", + "hostUsers": "Use the host's user namespace. Optional: Default to true. If set to true or not present, the pod will be run in the host user namespace, useful for when the pod needs a feature only available to the host user namespace, such as loading a kernel module with CAP_SYS_MODULE. When set to false, a new userns is created for the pod. Setting false is useful for mitigating container breakout vulnerabilities even allowing users to run their containers as root without actually having root privileges on the host.", "schedulingGates": "SchedulingGates is an opaque list of values that if specified will block scheduling the pod. If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the scheduler will not attempt to schedule the pod.\n\nSchedulingGates can only be set at pod creation time, and be removed only afterwards.", "resourceClaims": "ResourceClaims defines which ResourceClaims must be allocated and reserved before the Pod is allowed to start. The resources will be made available to those containers which consume them by name.\n\nThis is a stable field but requires that the DynamicResourceAllocation feature gate is enabled.\n\nThis field is immutable.", "resources": "Resources is the total amount of CPU and Memory resources required by all containers in the pod. It supports specifying Requests and Limits for \"cpu\", \"memory\" and \"hugepages-\" resource names only. ResourceClaims are not supported.\n\nThis field enables fine-grained control over resource allocation for the entire pod, allowing resource sharing among containers in a pod.\n\nThis is an alpha field and requires enabling the PodLevelResources feature gate.", "hostnameOverride": "HostnameOverride specifies an explicit override for the pod's hostname as perceived by the pod. This field only specifies the pod's hostname and does not affect its DNS records. When this field is set to a non-empty string: - It takes precedence over the values set in `hostname` and `subdomain`. - The Pod's hostname will be set to this value. - `setHostnameAsFQDN` must be nil or set to false. - `hostNetwork` must be set to false.\n\nThis field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. Requires the HostnameOverride feature gate to be enabled.", - "workloadRef": "WorkloadRef provides a reference to the Workload object that this Pod belongs to. This field is used by the scheduler to identify the PodGroup and apply the correct group scheduling policies. The Workload object referenced by this field may not exist at the time the Pod is created. This field is immutable, but a Workload object with the same name may be recreated with different policies. Doing this during pod scheduling may result in the placement not conforming to the expected policies.", + "schedulingGroup": "SchedulingGroup provides a reference to the immediate scheduling runtime grouping object that this Pod belongs to. This field is used by the scheduler to identify the group and apply the correct group scheduling policies. The association with a group also impacts other lifecycle aspects of a Pod that are relevant in a wider context of scheduling like preemption, resource attachment, etc. If not specified, the Pod is treated as a single unit in all of these aspects. The group object referenced by this field may not exist at the time the Pod is created. This field is immutable, but a group object with the same name may be recreated with different policies. Doing this during pod scheduling may result in the placement not conforming to the expected policies.", } func (PodSpec) SwaggerDoc() map[string]string { @@ -1932,27 +1961,28 @@ func (PodSpec) SwaggerDoc() map[string]string { } var map_PodStatus = map[string]string{ - "": "PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.", - "observedGeneration": "If set, this represents the .metadata.generation that the pod status was set based upon. The PodObservedGenerationTracking feature gate must be enabled to use this field.", - "phase": "The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod's status. There are five possible phase values:\n\nPending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase", - "conditions": "Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", - "message": "A human readable message indicating details about why the pod is in this condition.", - "reason": "A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted'", - "nominatedNodeName": "nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.", - "hostIP": "hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will not be updated even if there is a node is assigned to pod", - "hostIPs": "hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must match the hostIP field. This list is empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will not be updated even if there is a node is assigned to this pod.", - "podIP": "podIP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.", - "podIPs": "podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet.", - "startTime": "RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.", - "initContainerStatuses": "Statuses of init containers in this pod. The most recent successful non-restartable init container will have ready = true, the most recently started container will have startTime set. Each init container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status", - "containerStatuses": "Statuses of containers in this pod. Each container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", - "qosClass": "The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes", - "ephemeralContainerStatuses": "Statuses for any ephemeral containers that have run in this pod. Each ephemeral container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", - "resize": "Status of resources resize desired for pod's containers. It is empty if no resources resize is pending. Any changes to container resources will automatically set this to \"Proposed\" Deprecated: Resize status is moved to two pod conditions PodResizePending and PodResizeInProgress. PodResizePending will track states where the spec has been resized, but the Kubelet has not yet allocated the resources. PodResizeInProgress will track in-progress resizes, and should be present whenever allocated resources != acknowledged resources.", - "resourceClaimStatuses": "Status of resource claims.", - "extendedResourceClaimStatus": "Status of extended resource claim backed by DRA.", - "allocatedResources": "AllocatedResources is the total requests allocated for this pod by the node. If pod-level requests are not set, this will be the total requests aggregated across containers in the pod.", - "resources": "Resources represents the compute resource requests and limits that have been applied at the pod level if pod-level requests or limits are set in PodSpec.Resources", + "": "PodStatus represents information about the status of a pod. Status may trail the actual state of a system, especially if the node that hosts the pod cannot contact the control plane.", + "observedGeneration": "If set, this represents the .metadata.generation that the pod status was set based upon. The PodObservedGenerationTracking feature gate must be enabled to use this field.", + "phase": "The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The conditions array, the reason and message fields, and the individual container status arrays contain more detail about the pod's status. There are five possible phase values:\n\nPending: The pod has been accepted by the Kubernetes system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while. Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting. Succeeded: All containers in the pod have terminated in success, and will not be restarted. Failed: All containers in the pod have terminated, and at least one container has terminated in failure. The container either exited with non-zero status or was terminated by the system. Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod.\n\nMore info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-phase", + "conditions": "Current service state of pod. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions", + "message": "A human readable message indicating details about why the pod is in this condition.", + "reason": "A brief CamelCase message indicating details about why the pod is in this state. e.g. 'Evicted'", + "nominatedNodeName": "nominatedNodeName is set only when this pod preempts other pods on the node, but it cannot be scheduled right away as preemption victims receive their graceful termination periods. This field does not guarantee that the pod will be scheduled on this node. Scheduler may decide to place the pod elsewhere if other nodes become available sooner. Scheduler may also decide to give the resources on this node to a higher priority pod that is created after preemption. As a result, this field may be different than PodSpec.nodeName when the pod is scheduled.", + "hostIP": "hostIP holds the IP address of the host to which the pod is assigned. Empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns mean that HostIP will not be updated even if there is a node is assigned to pod", + "hostIPs": "hostIPs holds the IP addresses allocated to the host. If this field is specified, the first entry must match the hostIP field. This list is empty if the pod has not started yet. A pod can be assigned to a node that has a problem in kubelet which in turns means that HostIPs will not be updated even if there is a node is assigned to this pod.", + "podIP": "podIP address allocated to the pod. Routable at least within the cluster. Empty if not yet allocated.", + "podIPs": "podIPs holds the IP addresses allocated to the pod. If this field is specified, the 0th entry must match the podIP field. Pods may be allocated at most 1 value for each of IPv4 and IPv6. This list is empty if no IPs have been allocated yet.", + "startTime": "RFC 3339 date and time at which the object was acknowledged by the Kubelet. This is before the Kubelet pulled the container image(s) for the pod.", + "initContainerStatuses": "Statuses of init containers in this pod. The most recent successful non-restartable init container will have ready = true, the most recently started container will have startTime set. Each init container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-and-container-status", + "containerStatuses": "Statuses of containers in this pod. Each container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", + "qosClass": "The Quality of Service (QOS) classification assigned to the pod based on resource requirements See PodQOSClass type for available QOS classes More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#quality-of-service-classes", + "ephemeralContainerStatuses": "Statuses for any ephemeral containers that have run in this pod. Each ephemeral container in the pod should have at most one status in this list, and all statuses should be for containers in the pod. However this is not enforced. If a status for a non-existent container is present in the list, or the list has duplicate names, the behavior of various Kubernetes components is not defined and those statuses might be ignored. More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-and-container-status", + "resize": "Status of resources resize desired for pod's containers. It is empty if no resources resize is pending. Any changes to container resources will automatically set this to \"Proposed\" Deprecated: Resize status is moved to two pod conditions PodResizePending and PodResizeInProgress. PodResizePending will track states where the spec has been resized, but the Kubelet has not yet allocated the resources. PodResizeInProgress will track in-progress resizes, and should be present whenever allocated resources != acknowledged resources.", + "resourceClaimStatuses": "Status of resource claims.", + "extendedResourceClaimStatus": "Status of extended resource claim backed by DRA.", + "allocatedResources": "AllocatedResources is the total requests allocated for this pod by the node. If pod-level requests are not set, this will be the total requests aggregated across containers in the pod.", + "resources": "Resources represents the compute resource requests and limits that have been applied at the pod level if pod-level requests or limits are set in PodSpec.Resources", + "nodeAllocatableResourceClaimStatuses": "NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources that were allocated for this pod through DRA claims. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages.", } func (PodStatus) SwaggerDoc() map[string]string { @@ -2230,6 +2260,7 @@ var map_ResourceHealth = map[string]string{ "": "ResourceHealth represents the health of a resource. It has the latest device health information. This is a part of KEP https://kep.k8s.io/4680.", "resourceID": "ResourceID is the unique identifier of the resource. See the ResourceID type for more information.", "health": "Health of the resource. can be one of:\n - Healthy: operates as normal\n - Unhealthy: reported unhealthy. We consider this a temporary health issue\n since we do not have a mechanism today to distinguish\n temporary and permanent issues.\n - Unknown: The status cannot be determined.\n For example, Device Plugin got unregistered and hasn't been re-registered since.\n\nIn future we may want to introduce the PermanentlyUnhealthy Status.", + "message": "Message provides human-readable context for Health (e.g. \"ECC error count exceeded threshold\"). This field is populated by the kubelet when ResourceHealthStatusMessage is enabled if the DRA plugin returns a message, and is null otherwise.", } func (ResourceHealth) SwaggerDoc() map[string]string { @@ -2462,7 +2493,7 @@ var map_SecurityContext = map[string]string{ "runAsNonRoot": "Indicates that the container must run as a non-root user. If true, the Kubelet will validate the image at runtime to ensure that it does not run as UID 0 (root) and fail to start the container if it does. If unset or false, no such validation will be performed. May also be set in PodSecurityContext. If set in both SecurityContext and PodSecurityContext, the value specified in SecurityContext takes precedence.", "readOnlyRootFilesystem": "Whether this container has a read-only root filesystem. Default is false. Note that this field cannot be set when spec.os.name is windows.", "allowPrivilegeEscalation": "AllowPrivilegeEscalation controls whether a process can gain more privileges than its parent process. This bool directly controls if the no_new_privs flag will be set on the container process. AllowPrivilegeEscalation is true always when the container is: 1) run as Privileged 2) has CAP_SYS_ADMIN Note that this field cannot be set when spec.os.name is windows.", - "procMount": "procMount denotes the type of proc mount to use for the containers. The default value is Default which uses the container runtime defaults for readonly paths and masked paths. This requires the ProcMountType feature flag to be enabled. Note that this field cannot be set when spec.os.name is windows.", + "procMount": "procMount denotes the type of proc mount to use for the containers. The default value is Default which uses the container runtime defaults for readonly paths and masked paths. Note that this field cannot be set when spec.os.name is windows.", "seccompProfile": "The seccomp options to use by this container. If seccomp options are provided at both the pod & container level, the container options override the pod options. Note that this field cannot be set when spec.os.name is windows.", "appArmorProfile": "appArmorProfile is the AppArmor options to use by this container. If set, this profile overrides the pod's appArmorProfile. Note that this field cannot be set when spec.os.name is windows.", } @@ -2782,6 +2813,7 @@ var map_VolumeMountStatus = map[string]string{ "mountPath": "MountPath corresponds to the original VolumeMount.", "readOnly": "ReadOnly corresponds to the original VolumeMount.", "recursiveReadOnly": "RecursiveReadOnly must be set to Disabled, Enabled, or unspecified (for non-readonly mounts). An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, depending on the mount result.", + "volumeStatus": "volumeStatus represents volume-type-specific status about the mounted volume.", } func (VolumeMountStatus) SwaggerDoc() map[string]string { @@ -2847,18 +2879,27 @@ var map_VolumeSource = map[string]string{ "azureDisk": "azureDisk represents an Azure Data Disk mount on the host and bind mount to the pod. Deprecated: AzureDisk is deprecated. All operations for the in-tree azureDisk type are redirected to the disk.csi.azure.com CSI driver.", "photonPersistentDisk": "photonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine. Deprecated: PhotonPersistentDisk is deprecated and the in-tree photonPersistentDisk type is no longer supported.", "projected": "projected items for all in one resources secrets, configmaps, and downward API", - "portworxVolume": "portworxVolume represents a portworx volume attached and mounted on kubelets host machine. Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate is on.", + "portworxVolume": "portworxVolume represents a portworx volume attached and mounted on kubelets host machine. Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type are redirected to the pxd.portworx.com CSI driver.", "scaleIO": "scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported.", "storageos": "storageOS represents a StorageOS volume attached and mounted on Kubernetes nodes. Deprecated: StorageOS is deprecated and the in-tree storageos type is no longer supported.", "csi": "csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers.", "ephemeral": "ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed.\n\nUse this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity\n tracking are needed,\nc) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through\n a PersistentVolumeClaim (see EphemeralVolumeSource for more\n information on the connection between this volume type\n and PersistentVolumeClaim).\n\nUse PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod.\n\nUse CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information.\n\nA pod can use both types of ephemeral volumes and persistent volumes at the same time.", - "image": "image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided:\n\n- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.\n\nThe volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro) and non-executable files (noexec). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.", + "image": "image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. The volume is resolved at pod startup depending on which PullPolicy value is provided:\n\n- Always: the kubelet always attempts to pull the reference. Container creation will fail If the pull fails. - Never: the kubelet never pulls the reference and only uses a local image or artifact. Container creation will fail if the reference isn't present. - IfNotPresent: the kubelet pulls if the reference isn't already present on disk. Container creation will fail if the reference isn't present and the pull fails.\n\nThe volume gets re-resolved if the pod gets deleted and recreated, which means that new remote content will become available on pod recreation. A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. The volume will be mounted read-only (ro). Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type.", } func (VolumeSource) SwaggerDoc() map[string]string { return map_VolumeSource } +var map_VolumeStatus = map[string]string{ + "": "VolumeStatus represents the status of a mounted volume. At most one of its members must be specified.", + "image": "image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine.", +} + +func (VolumeStatus) SwaggerDoc() map[string]string { + return map_VolumeStatus +} + var map_VsphereVirtualDiskVolumeSource = map[string]string{ "": "Represents a vSphere volume resource.", "volumePath": "volumePath is the path that identifies vSphere volume vmdk", @@ -2893,15 +2934,4 @@ func (WindowsSecurityContextOptions) SwaggerDoc() map[string]string { return map_WindowsSecurityContextOptions } -var map_WorkloadReference = map[string]string{ - "": "WorkloadReference identifies the Workload object and PodGroup membership that a Pod belongs to. The scheduler uses this information to apply workload-aware scheduling semantics.", - "name": "Name defines the name of the Workload object this Pod belongs to. Workload must be in the same namespace as the Pod. If it doesn't match any existing Workload, the Pod will remain unschedulable until a Workload object is created and observed by the kube-scheduler. It must be a DNS subdomain.", - "podGroup": "PodGroup is the name of the PodGroup within the Workload that this Pod belongs to. If it doesn't match any existing PodGroup within the Workload, the Pod will remain unschedulable until the Workload object is recreated and observed by the kube-scheduler. It must be a DNS label.", - "podGroupReplicaKey": "PodGroupReplicaKey specifies the replica key of the PodGroup to which this Pod belongs. It is used to distinguish pods belonging to different replicas of the same pod group. The pod group policy is applied separately to each replica. When set, it must be a DNS label.", -} - -func (WorkloadReference) SwaggerDoc() map[string]string { - return map_WorkloadReference -} - // AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go index 15bc2ee033..10af6c17d2 100644 --- a/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go @@ -22,6 +22,7 @@ limitations under the License. package v1 import ( + resource "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" types "k8s.io/apimachinery/pkg/types" @@ -2170,6 +2171,22 @@ func (in *ImageVolumeSource) DeepCopy() *ImageVolumeSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageVolumeStatus) DeepCopyInto(out *ImageVolumeStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageVolumeStatus. +func (in *ImageVolumeStatus) DeepCopy() *ImageVolumeStatus { + if in == nil { + return nil + } + out := new(ImageVolumeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeyToPath) DeepCopyInto(out *KeyToPath) { *out = *in @@ -2760,6 +2777,34 @@ func (in *NodeAffinity) DeepCopy() *NodeAffinity { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResourceClaimStatus) DeepCopyInto(out *NodeAllocatableResourceClaimStatus) { + *out = *in + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make(map[ResourceName]resource.Quantity, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceClaimStatus. +func (in *NodeAllocatableResourceClaimStatus) DeepCopy() *NodeAllocatableResourceClaimStatus { + if in == nil { + return nil + } + out := new(NodeAllocatableResourceClaimStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeCondition) DeepCopyInto(out *NodeCondition) { *out = *in @@ -4299,6 +4344,27 @@ func (in *PodSchedulingGate) DeepCopy() *PodSchedulingGate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodSchedulingGroup) DeepCopyInto(out *PodSchedulingGroup) { + *out = *in + if in.PodGroupName != nil { + in, out := &in.PodGroupName, &out.PodGroupName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSchedulingGroup. +func (in *PodSchedulingGroup) DeepCopy() *PodSchedulingGroup { + if in == nil { + return nil + } + out := new(PodSchedulingGroup) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodSecurityContext) DeepCopyInto(out *PodSecurityContext) { *out = *in @@ -4569,10 +4635,10 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) { *out = new(string) **out = **in } - if in.WorkloadRef != nil { - in, out := &in.WorkloadRef, &out.WorkloadRef - *out = new(WorkloadReference) - **out = **in + if in.SchedulingGroup != nil { + in, out := &in.SchedulingGroup, &out.SchedulingGroup + *out = new(PodSchedulingGroup) + (*in).DeepCopyInto(*out) } return } @@ -4656,6 +4722,13 @@ func (in *PodStatus) DeepCopyInto(out *PodStatus) { *out = new(ResourceRequirements) (*in).DeepCopyInto(*out) } + if in.NodeAllocatableResourceClaimStatuses != nil { + in, out := &in.NodeAllocatableResourceClaimStatuses, &out.NodeAllocatableResourceClaimStatuses + *out = make([]NodeAllocatableResourceClaimStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -5222,6 +5295,11 @@ func (in *ResourceFieldSelector) DeepCopy() *ResourceFieldSelector { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceHealth) DeepCopyInto(out *ResourceHealth) { *out = *in + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } return } @@ -5422,7 +5500,9 @@ func (in *ResourceStatus) DeepCopyInto(out *ResourceStatus) { if in.Resources != nil { in, out := &in.Resources, &out.Resources *out = make([]ResourceHealth, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } return } @@ -6529,6 +6609,11 @@ func (in *VolumeMountStatus) DeepCopyInto(out *VolumeMountStatus) { *out = new(RecursiveReadOnlyMode) **out = **in } + if in.VolumeStatus != nil { + in, out := &in.VolumeStatus, &out.VolumeStatus + *out = new(VolumeStatus) + (*in).DeepCopyInto(*out) + } return } @@ -6805,6 +6890,27 @@ func (in *VolumeSource) DeepCopy() *VolumeSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeStatus) DeepCopyInto(out *VolumeStatus) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageVolumeStatus) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeStatus. +func (in *VolumeStatus) DeepCopy() *VolumeStatus { + if in == nil { + return nil + } + out := new(VolumeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VsphereVirtualDiskVolumeSource) DeepCopyInto(out *VsphereVirtualDiskVolumeSource) { *out = *in @@ -6873,19 +6979,3 @@ func (in *WindowsSecurityContextOptions) DeepCopy() *WindowsSecurityContextOptio in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadReference) DeepCopyInto(out *WorkloadReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadReference. -func (in *WorkloadReference) DeepCopy() *WorkloadReference { - if in == nil { - return nil - } - out := new(WorkloadReference) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/k8s.io/api/core/v1/zz_generated.model_name.go b/vendor/k8s.io/api/core/v1/zz_generated.model_name.go index 523bb3a852..8e79ad909e 100644 --- a/vendor/k8s.io/api/core/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/core/v1/zz_generated.model_name.go @@ -421,6 +421,11 @@ func (in ImageVolumeSource) OpenAPIModelName() string { return "io.k8s.api.core.v1.ImageVolumeSource" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ImageVolumeStatus) OpenAPIModelName() string { + return "io.k8s.api.core.v1.ImageVolumeStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in KeyToPath) OpenAPIModelName() string { return "io.k8s.api.core.v1.KeyToPath" @@ -536,6 +541,11 @@ func (in NodeAffinity) OpenAPIModelName() string { return "io.k8s.api.core.v1.NodeAffinity" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableResourceClaimStatus) OpenAPIModelName() string { + return "io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in NodeCondition) OpenAPIModelName() string { return "io.k8s.api.core.v1.NodeCondition" @@ -796,6 +806,11 @@ func (in PodSchedulingGate) OpenAPIModelName() string { return "io.k8s.api.core.v1.PodSchedulingGate" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodSchedulingGroup) OpenAPIModelName() string { + return "io.k8s.api.core.v1.PodSchedulingGroup" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in PodSecurityContext) OpenAPIModelName() string { return "io.k8s.api.core.v1.PodSecurityContext" @@ -1191,6 +1206,11 @@ func (in VolumeSource) OpenAPIModelName() string { return "io.k8s.api.core.v1.VolumeSource" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in VolumeStatus) OpenAPIModelName() string { + return "io.k8s.api.core.v1.VolumeStatus" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in VsphereVirtualDiskVolumeSource) OpenAPIModelName() string { return "io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource" @@ -1205,8 +1225,3 @@ func (in WeightedPodAffinityTerm) OpenAPIModelName() string { func (in WindowsSecurityContextOptions) OpenAPIModelName() string { return "io.k8s.api.core.v1.WindowsSecurityContextOptions" } - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in WorkloadReference) OpenAPIModelName() string { - return "io.k8s.api.core.v1.WorkloadReference" -} diff --git a/vendor/k8s.io/api/discovery/v1/generated.proto b/vendor/k8s.io/api/discovery/v1/generated.proto index 97582a1b2a..edbc4304b1 100644 --- a/vendor/k8s.io/api/discovery/v1/generated.proto +++ b/vendor/k8s.io/api/discovery/v1/generated.proto @@ -38,6 +38,9 @@ message Endpoint { // controller will always have exactly 1 address. No semantics are defined for // additional addresses beyond the first, and kube-proxy does not look at them. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 repeated string addresses = 1; // conditions contains information about the current status of the endpoint. @@ -181,11 +184,16 @@ message EndpointSlice { // The EndpointSlice controller only generates, and kube-proxy only processes, // slices of addressType "IPv4" and "IPv6". No semantics are defined for // the "FQDN" type. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable optional string addressType = 4; // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. + // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Endpoint endpoints = 2; // ports specifies the list of network ports exposed by each endpoint in diff --git a/vendor/k8s.io/api/discovery/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/discovery/v1/generated.protomessage.pb.go deleted file mode 100644 index 9e246b87b8..0000000000 --- a/vendor/k8s.io/api/discovery/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*Endpoint) ProtoMessage() {} - -func (*EndpointConditions) ProtoMessage() {} - -func (*EndpointHints) ProtoMessage() {} - -func (*EndpointPort) ProtoMessage() {} - -func (*EndpointSlice) ProtoMessage() {} - -func (*EndpointSliceList) ProtoMessage() {} - -func (*ForNode) ProtoMessage() {} - -func (*ForZone) ProtoMessage() {} diff --git a/vendor/k8s.io/api/discovery/v1/types.go b/vendor/k8s.io/api/discovery/v1/types.go index ca78ce3869..c291ed85dd 100644 --- a/vendor/k8s.io/api/discovery/v1/types.go +++ b/vendor/k8s.io/api/discovery/v1/types.go @@ -48,11 +48,16 @@ type EndpointSlice struct { // The EndpointSlice controller only generates, and kube-proxy only processes, // slices of addressType "IPv4" and "IPv6". No semantics are defined for // the "FQDN" type. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"` // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. + // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"` // ports specifies the list of network ports exposed by each endpoint in @@ -68,6 +73,7 @@ type EndpointSlice struct { // AddressType represents the type of address referred to by an endpoint. // +enum +// +k8s:alpha(since: "1.36")=+k8s:enum type AddressType string const ( @@ -90,6 +96,9 @@ type Endpoint struct { // controller will always have exactly 1 address. No semantics are defined for // additional addresses beyond the first, and kube-proxy does not look at them. // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"` // conditions contains information about the current status of the endpoint. diff --git a/vendor/k8s.io/api/discovery/v1beta1/generated.proto b/vendor/k8s.io/api/discovery/v1beta1/generated.proto index 7b9d983b83..9b6edb1479 100644 --- a/vendor/k8s.io/api/discovery/v1beta1/generated.proto +++ b/vendor/k8s.io/api/discovery/v1beta1/generated.proto @@ -38,6 +38,9 @@ message Endpoint { // 100. These are all assumed to be fungible and clients may choose to only // use the first element. Refer to: https://issue.k8s.io/106267 // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 repeated string addresses = 1; // conditions contains information about the current status of the endpoint. @@ -167,11 +170,15 @@ message EndpointSlice { // * IPv4: Represents an IPv4 Address. // * IPv6: Represents an IPv6 Address. // * FQDN: Represents a Fully Qualified Domain Name. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable optional string addressType = 4; // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Endpoint endpoints = 2; // ports specifies the list of network ports exposed by each endpoint in diff --git a/vendor/k8s.io/api/discovery/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/discovery/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 6e60bb139e..0000000000 --- a/vendor/k8s.io/api/discovery/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*Endpoint) ProtoMessage() {} - -func (*EndpointConditions) ProtoMessage() {} - -func (*EndpointHints) ProtoMessage() {} - -func (*EndpointPort) ProtoMessage() {} - -func (*EndpointSlice) ProtoMessage() {} - -func (*EndpointSliceList) ProtoMessage() {} - -func (*ForNode) ProtoMessage() {} - -func (*ForZone) ProtoMessage() {} diff --git a/vendor/k8s.io/api/discovery/v1beta1/types.go b/vendor/k8s.io/api/discovery/v1beta1/types.go index 11ec1b3968..1334194d2a 100644 --- a/vendor/k8s.io/api/discovery/v1beta1/types.go +++ b/vendor/k8s.io/api/discovery/v1beta1/types.go @@ -45,11 +45,15 @@ type EndpointSlice struct { // * IPv4: Represents an IPv4 Address. // * IPv6: Represents an IPv6 Address. // * FQDN: Represents a Fully Qualified Domain Name. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"` // endpoints is a list of unique endpoints in this slice. Each slice may // include a maximum of 1000 endpoints. // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"` // ports specifies the list of network ports exposed by each endpoint in @@ -63,6 +67,8 @@ type EndpointSlice struct { } // AddressType represents the type of address referred to by an endpoint. +// +enum +// +k8s:alpha(since: "1.36")=+k8s:enum type AddressType string const ( @@ -85,6 +91,9 @@ type Endpoint struct { // 100. These are all assumed to be fungible and clients may choose to only // use the first element. Refer to: https://issue.k8s.io/106267 // +listType=set + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxItems=100 Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"` // conditions contains information about the current status of the endpoint. diff --git a/vendor/k8s.io/api/events/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/events/v1/generated.protomessage.pb.go deleted file mode 100644 index 09ff231dac..0000000000 --- a/vendor/k8s.io/api/events/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*Event) ProtoMessage() {} - -func (*EventList) ProtoMessage() {} - -func (*EventSeries) ProtoMessage() {} diff --git a/vendor/k8s.io/api/extensions/v1beta1/generated.proto b/vendor/k8s.io/api/extensions/v1beta1/generated.proto index c664c71bd2..f090306686 100644 --- a/vendor/k8s.io/api/extensions/v1beta1/generated.proto +++ b/vendor/k8s.io/api/extensions/v1beta1/generated.proto @@ -428,6 +428,8 @@ message HTTPIngressRuleValue { message IPBlock { // CIDR is a string representing the IP Block // Valid examples are "192.168.1.0/24" or "2001:db8::/64" + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string cidr = 1; // Except is a slice of CIDRs that should not be included within an IP Block @@ -686,6 +688,7 @@ message NetworkPolicyEgressRule { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyPeer to = 2; } @@ -708,6 +711,7 @@ message NetworkPolicyIngressRule { // traffic matches at least one item in the from list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyPeer from = 2; } @@ -746,6 +750,7 @@ message NetworkPolicyPeer { // IPBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional IPBlock ipBlock = 3; } @@ -789,6 +794,7 @@ message NetworkPolicySpec { // (and serves solely to ensure that the pods it selects are isolated by default). // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyIngressRule ingress = 2; // List of egress rules to be applied to the selected pods. Outgoing traffic is @@ -800,6 +806,7 @@ message NetworkPolicySpec { // This field is beta-level in 1.8 // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyEgressRule egress = 3; // List of rule types that the NetworkPolicy relates to. @@ -1039,9 +1046,9 @@ message Scale { message ScaleSpec { // desired number of instances for the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 optional int32 replicas = 1; } diff --git a/vendor/k8s.io/api/extensions/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/extensions/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index ef18ae2996..0000000000 --- a/vendor/k8s.io/api/extensions/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*DaemonSet) ProtoMessage() {} - -func (*DaemonSetCondition) ProtoMessage() {} - -func (*DaemonSetList) ProtoMessage() {} - -func (*DaemonSetSpec) ProtoMessage() {} - -func (*DaemonSetStatus) ProtoMessage() {} - -func (*DaemonSetUpdateStrategy) ProtoMessage() {} - -func (*Deployment) ProtoMessage() {} - -func (*DeploymentCondition) ProtoMessage() {} - -func (*DeploymentList) ProtoMessage() {} - -func (*DeploymentRollback) ProtoMessage() {} - -func (*DeploymentSpec) ProtoMessage() {} - -func (*DeploymentStatus) ProtoMessage() {} - -func (*DeploymentStrategy) ProtoMessage() {} - -func (*HTTPIngressPath) ProtoMessage() {} - -func (*HTTPIngressRuleValue) ProtoMessage() {} - -func (*IPBlock) ProtoMessage() {} - -func (*Ingress) ProtoMessage() {} - -func (*IngressBackend) ProtoMessage() {} - -func (*IngressList) ProtoMessage() {} - -func (*IngressLoadBalancerIngress) ProtoMessage() {} - -func (*IngressLoadBalancerStatus) ProtoMessage() {} - -func (*IngressPortStatus) ProtoMessage() {} - -func (*IngressRule) ProtoMessage() {} - -func (*IngressRuleValue) ProtoMessage() {} - -func (*IngressSpec) ProtoMessage() {} - -func (*IngressStatus) ProtoMessage() {} - -func (*IngressTLS) ProtoMessage() {} - -func (*NetworkPolicy) ProtoMessage() {} - -func (*NetworkPolicyEgressRule) ProtoMessage() {} - -func (*NetworkPolicyIngressRule) ProtoMessage() {} - -func (*NetworkPolicyList) ProtoMessage() {} - -func (*NetworkPolicyPeer) ProtoMessage() {} - -func (*NetworkPolicyPort) ProtoMessage() {} - -func (*NetworkPolicySpec) ProtoMessage() {} - -func (*ReplicaSet) ProtoMessage() {} - -func (*ReplicaSetCondition) ProtoMessage() {} - -func (*ReplicaSetList) ProtoMessage() {} - -func (*ReplicaSetSpec) ProtoMessage() {} - -func (*ReplicaSetStatus) ProtoMessage() {} - -func (*RollbackConfig) ProtoMessage() {} - -func (*RollingUpdateDaemonSet) ProtoMessage() {} - -func (*RollingUpdateDeployment) ProtoMessage() {} - -func (*Scale) ProtoMessage() {} - -func (*ScaleSpec) ProtoMessage() {} - -func (*ScaleStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/extensions/v1beta1/types.go b/vendor/k8s.io/api/extensions/v1beta1/types.go index c0d8b4f959..09d143ea60 100644 --- a/vendor/k8s.io/api/extensions/v1beta1/types.go +++ b/vendor/k8s.io/api/extensions/v1beta1/types.go @@ -27,9 +27,9 @@ import ( type ScaleSpec struct { // desired number of instances for the scaled object. // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +default=0 - // +k8s:minimum=0 + // +k8s:alpha(since: "1.36")=+k8s:minimum=0 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"` } @@ -57,7 +57,7 @@ type ScaleStatus struct { // +k8s:prerelease-lifecycle-gen:introduced=1.1 // +k8s:prerelease-lifecycle-gen:deprecated=1.2 // +k8s:prerelease-lifecycle-gen:removed=1.16 -// +k8s:isSubresource=/scale +// +k8s:isSubresource="/scale" // represents a scaling request for a resource. type Scale struct { @@ -1106,6 +1106,7 @@ type NetworkPolicySpec struct { // (and serves solely to ensure that the pods it selects are isolated by default). // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"` // List of egress rules to be applied to the selected pods. Outgoing traffic is @@ -1117,6 +1118,7 @@ type NetworkPolicySpec struct { // This field is beta-level in 1.8 // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Egress []NetworkPolicyEgressRule `json:"egress,omitempty" protobuf:"bytes,3,rep,name=egress"` // List of rule types that the NetworkPolicy relates to. @@ -1153,6 +1155,7 @@ type NetworkPolicyIngressRule struct { // traffic matches at least one item in the from list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"` } @@ -1177,6 +1180,7 @@ type NetworkPolicyEgressRule struct { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional To []NetworkPolicyPeer `json:"to,omitempty" protobuf:"bytes,2,rep,name=to"` } @@ -1209,6 +1213,8 @@ type NetworkPolicyPort struct { type IPBlock struct { // CIDR is a string representing the IP Block // Valid examples are "192.168.1.0/24" or "2001:db8::/64" + // +required + // +k8s:alpha(since: "1.36")=+k8s:required CIDR string `json:"cidr" protobuf:"bytes,1,name=cidr"` // Except is a slice of CIDRs that should not be included within an IP Block // Valid examples are "192.168.1.0/24" or "2001:db8::/64" @@ -1241,6 +1247,7 @@ type NetworkPolicyPeer struct { // IPBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional IPBlock *IPBlock `json:"ipBlock,omitempty" protobuf:"bytes,3,rep,name=ipBlock"` } diff --git a/vendor/k8s.io/api/extensions/v1beta1/zz_generated.validations.go b/vendor/k8s.io/api/extensions/v1beta1/zz_generated.validations.go index f4f0e317a7..d504d5452e 100644 --- a/vendor/k8s.io/api/extensions/v1beta1/zz_generated.validations.go +++ b/vendor/k8s.io/api/extensions/v1beta1/zz_generated.validations.go @@ -25,6 +25,7 @@ import ( context "context" fmt "fmt" + equality "k8s.io/apimachinery/pkg/api/equality" operation "k8s.io/apimachinery/pkg/api/operation" safe "k8s.io/apimachinery/pkg/api/safe" validate "k8s.io/apimachinery/pkg/api/validate" @@ -37,6 +38,14 @@ func init() { localSchemeBuilder.Register(RegisterValidations) } // RegisterValidations adds validation functions to the given scheme. // Public to allow building arbitrary schemes. func RegisterValidations(scheme *runtime.Scheme) error { + // type NetworkPolicy + scheme.AddValidationFunc((*NetworkPolicy)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { + switch op.Request.SubresourcePath() { + case "/": + return Validate_NetworkPolicy(ctx, op, nil /* fldPath */, obj.(*NetworkPolicy), safe.Cast[*NetworkPolicy](oldObj)) + } + return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} + }) // type Scale scheme.AddValidationFunc((*Scale)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { switch op.Request.SubresourcePath() { @@ -48,6 +57,187 @@ func RegisterValidations(scheme *runtime.Scheme) error { return nil } +// Validate_IPBlock validates an instance of IPBlock according +// to declarative validation rules in the API schema. +func Validate_IPBlock(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *IPBlock) (errs field.ErrorList) { + // field IPBlock.CIDR + errs = append(errs, + func(fldPath *field.Path, obj, oldObj *string, oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { + return nil + } + // call field-attached validations + earlyReturn := false + if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { + errs = append(errs, e...) + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + return + }(fldPath.Child("cidr"), &obj.CIDR, safe.Field(oldObj, func(oldObj *IPBlock) *string { return &oldObj.CIDR }), oldObj != nil)...) + + // field IPBlock.Except has no validation + return errs +} + +// Validate_NetworkPolicy validates an instance of NetworkPolicy according +// to declarative validation rules in the API schema. +func Validate_NetworkPolicy(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicy) (errs field.ErrorList) { + // field NetworkPolicy.TypeMeta has no validation + // field NetworkPolicy.ObjectMeta has no validation + + // field NetworkPolicy.Spec + errs = append(errs, + func(fldPath *field.Path, obj, oldObj *NetworkPolicySpec, oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + // call the type's validation function + errs = append(errs, Validate_NetworkPolicySpec(ctx, op, fldPath, obj, oldObj)...) + return + }(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *NetworkPolicy) *NetworkPolicySpec { return &oldObj.Spec }), oldObj != nil)...) + + return errs +} + +// Validate_NetworkPolicyEgressRule validates an instance of NetworkPolicyEgressRule according +// to declarative validation rules in the API schema. +func Validate_NetworkPolicyEgressRule(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicyEgressRule) (errs field.ErrorList) { + // field NetworkPolicyEgressRule.Ports has no validation + + // field NetworkPolicyEgressRule.To + errs = append(errs, + func(fldPath *field.Path, obj, oldObj []NetworkPolicyPeer, oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyPeer)...) + return + }(fldPath.Child("to"), obj.To, safe.Field(oldObj, func(oldObj *NetworkPolicyEgressRule) []NetworkPolicyPeer { return oldObj.To }), oldObj != nil)...) + + return errs +} + +// Validate_NetworkPolicyIngressRule validates an instance of NetworkPolicyIngressRule according +// to declarative validation rules in the API schema. +func Validate_NetworkPolicyIngressRule(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicyIngressRule) (errs field.ErrorList) { + // field NetworkPolicyIngressRule.Ports has no validation + + // field NetworkPolicyIngressRule.From + errs = append(errs, + func(fldPath *field.Path, obj, oldObj []NetworkPolicyPeer, oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyPeer)...) + return + }(fldPath.Child("from"), obj.From, safe.Field(oldObj, func(oldObj *NetworkPolicyIngressRule) []NetworkPolicyPeer { return oldObj.From }), oldObj != nil)...) + + return errs +} + +// Validate_NetworkPolicyPeer validates an instance of NetworkPolicyPeer according +// to declarative validation rules in the API schema. +func Validate_NetworkPolicyPeer(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicyPeer) (errs field.ErrorList) { + // field NetworkPolicyPeer.PodSelector has no validation + // field NetworkPolicyPeer.NamespaceSelector has no validation + + // field NetworkPolicyPeer.IPBlock + errs = append(errs, + func(fldPath *field.Path, obj, oldObj *IPBlock, oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // call the type's validation function + errs = append(errs, Validate_IPBlock(ctx, op, fldPath, obj, oldObj)...) + return + }(fldPath.Child("ipBlock"), obj.IPBlock, safe.Field(oldObj, func(oldObj *NetworkPolicyPeer) *IPBlock { return oldObj.IPBlock }), oldObj != nil)...) + + return errs +} + +// Validate_NetworkPolicySpec validates an instance of NetworkPolicySpec according +// to declarative validation rules in the API schema. +func Validate_NetworkPolicySpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *NetworkPolicySpec) (errs field.ErrorList) { + // field NetworkPolicySpec.PodSelector has no validation + + // field NetworkPolicySpec.Ingress + errs = append(errs, + func(fldPath *field.Path, obj, oldObj []NetworkPolicyIngressRule, oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyIngressRule)...) + return + }(fldPath.Child("ingress"), obj.Ingress, safe.Field(oldObj, func(oldObj *NetworkPolicySpec) []NetworkPolicyIngressRule { return oldObj.Ingress }), oldObj != nil)...) + + // field NetworkPolicySpec.Egress + errs = append(errs, + func(fldPath *field.Path, obj, oldObj []NetworkPolicyEgressRule, oldValueCorrelated bool) (errs field.ErrorList) { + // don't revalidate unchanged data + if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { + return nil + } + // call field-attached validations + earlyReturn := false + if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { + earlyReturn = true + } + if earlyReturn { + return // do not proceed + } + // iterate the list and call the type's validation function + errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_NetworkPolicyEgressRule)...) + return + }(fldPath.Child("egress"), obj.Egress, safe.Field(oldObj, func(oldObj *NetworkPolicySpec) []NetworkPolicyEgressRule { return oldObj.Egress }), oldObj != nil)...) + + // field NetworkPolicySpec.PolicyTypes has no validation + return errs +} + // Validate_Scale validates an instance of Scale according // to declarative validation rules in the API schema. func Validate_Scale(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *Scale) (errs field.ErrorList) { @@ -76,13 +266,12 @@ func Validate_ScaleSpec(ctx context.Context, op operation.Operation, fldPath *fi // field ScaleSpec.Replicas errs = append(errs, func(fldPath *field.Path, obj, oldObj *int32, oldValueCorrelated bool) (errs field.ErrorList) { - // optional value-type fields with zero-value defaults are purely documentation // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations - errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0)...) + errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0).MarkAlpha()...) return }(fldPath.Child("replicas"), &obj.Replicas, safe.Field(oldObj, func(oldObj *ScaleSpec) *int32 { return &oldObj.Replicas }), oldObj != nil)...) diff --git a/vendor/k8s.io/api/flowcontrol/v1/generated.proto b/vendor/k8s.io/api/flowcontrol/v1/generated.proto index 33a135889e..eb9186d013 100644 --- a/vendor/k8s.io/api/flowcontrol/v1/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1/generated.proto @@ -179,11 +179,16 @@ message LimitResponse { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden optional QueuingConfiguration queuing = 2; } @@ -367,11 +372,16 @@ message PriorityLevelConfigurationSpec { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -380,6 +390,9 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden optional ExemptPriorityLevelConfiguration exempt = 3; } diff --git a/vendor/k8s.io/api/flowcontrol/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/flowcontrol/v1/generated.protomessage.pb.go deleted file mode 100644 index 51612dee82..0000000000 --- a/vendor/k8s.io/api/flowcontrol/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*ExemptPriorityLevelConfiguration) ProtoMessage() {} - -func (*FlowDistinguisherMethod) ProtoMessage() {} - -func (*FlowSchema) ProtoMessage() {} - -func (*FlowSchemaCondition) ProtoMessage() {} - -func (*FlowSchemaList) ProtoMessage() {} - -func (*FlowSchemaSpec) ProtoMessage() {} - -func (*FlowSchemaStatus) ProtoMessage() {} - -func (*GroupSubject) ProtoMessage() {} - -func (*LimitResponse) ProtoMessage() {} - -func (*LimitedPriorityLevelConfiguration) ProtoMessage() {} - -func (*NonResourcePolicyRule) ProtoMessage() {} - -func (*PolicyRulesWithSubjects) ProtoMessage() {} - -func (*PriorityLevelConfiguration) ProtoMessage() {} - -func (*PriorityLevelConfigurationCondition) ProtoMessage() {} - -func (*PriorityLevelConfigurationList) ProtoMessage() {} - -func (*PriorityLevelConfigurationReference) ProtoMessage() {} - -func (*PriorityLevelConfigurationSpec) ProtoMessage() {} - -func (*PriorityLevelConfigurationStatus) ProtoMessage() {} - -func (*QueuingConfiguration) ProtoMessage() {} - -func (*ResourcePolicyRule) ProtoMessage() {} - -func (*ServiceAccountSubject) ProtoMessage() {} - -func (*Subject) ProtoMessage() {} - -func (*UserSubject) ProtoMessage() {} diff --git a/vendor/k8s.io/api/flowcontrol/v1/types.go b/vendor/k8s.io/api/flowcontrol/v1/types.go index ad72bcee22..4a40bdca42 100644 --- a/vendor/k8s.io/api/flowcontrol/v1/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1/types.go @@ -429,11 +429,16 @@ type PriorityLevelConfigurationSpec struct { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -442,6 +447,9 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -566,11 +574,16 @@ type LimitResponse struct { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto b/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto index 61ed3833ae..8a701a6100 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto @@ -177,11 +177,16 @@ message LimitResponse { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden optional QueuingConfiguration queuing = 2; } @@ -360,11 +365,16 @@ message PriorityLevelConfigurationSpec { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -373,6 +383,9 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden optional ExemptPriorityLevelConfiguration exempt = 3; } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/flowcontrol/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 9d2059597a..0000000000 --- a/vendor/k8s.io/api/flowcontrol/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*ExemptPriorityLevelConfiguration) ProtoMessage() {} - -func (*FlowDistinguisherMethod) ProtoMessage() {} - -func (*FlowSchema) ProtoMessage() {} - -func (*FlowSchemaCondition) ProtoMessage() {} - -func (*FlowSchemaList) ProtoMessage() {} - -func (*FlowSchemaSpec) ProtoMessage() {} - -func (*FlowSchemaStatus) ProtoMessage() {} - -func (*GroupSubject) ProtoMessage() {} - -func (*LimitResponse) ProtoMessage() {} - -func (*LimitedPriorityLevelConfiguration) ProtoMessage() {} - -func (*NonResourcePolicyRule) ProtoMessage() {} - -func (*PolicyRulesWithSubjects) ProtoMessage() {} - -func (*PriorityLevelConfiguration) ProtoMessage() {} - -func (*PriorityLevelConfigurationCondition) ProtoMessage() {} - -func (*PriorityLevelConfigurationList) ProtoMessage() {} - -func (*PriorityLevelConfigurationReference) ProtoMessage() {} - -func (*PriorityLevelConfigurationSpec) ProtoMessage() {} - -func (*PriorityLevelConfigurationStatus) ProtoMessage() {} - -func (*QueuingConfiguration) ProtoMessage() {} - -func (*ResourcePolicyRule) ProtoMessage() {} - -func (*ServiceAccountSubject) ProtoMessage() {} - -func (*Subject) ProtoMessage() {} - -func (*UserSubject) ProtoMessage() {} diff --git a/vendor/k8s.io/api/flowcontrol/v1beta1/types.go b/vendor/k8s.io/api/flowcontrol/v1beta1/types.go index abc3e42009..0de6ea940e 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta1/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta1/types.go @@ -431,11 +431,16 @@ type PriorityLevelConfigurationSpec struct { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -444,6 +449,9 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -563,11 +571,16 @@ type LimitResponse struct { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto b/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto index d6073fc925..371b90a5cd 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto @@ -177,11 +177,16 @@ message LimitResponse { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden optional QueuingConfiguration queuing = 2; } @@ -360,11 +365,16 @@ message PriorityLevelConfigurationSpec { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -373,6 +383,9 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden optional ExemptPriorityLevelConfiguration exempt = 3; } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta2/generated.protomessage.pb.go b/vendor/k8s.io/api/flowcontrol/v1beta2/generated.protomessage.pb.go deleted file mode 100644 index 672834e9fa..0000000000 --- a/vendor/k8s.io/api/flowcontrol/v1beta2/generated.protomessage.pb.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta2 - -func (*ExemptPriorityLevelConfiguration) ProtoMessage() {} - -func (*FlowDistinguisherMethod) ProtoMessage() {} - -func (*FlowSchema) ProtoMessage() {} - -func (*FlowSchemaCondition) ProtoMessage() {} - -func (*FlowSchemaList) ProtoMessage() {} - -func (*FlowSchemaSpec) ProtoMessage() {} - -func (*FlowSchemaStatus) ProtoMessage() {} - -func (*GroupSubject) ProtoMessage() {} - -func (*LimitResponse) ProtoMessage() {} - -func (*LimitedPriorityLevelConfiguration) ProtoMessage() {} - -func (*NonResourcePolicyRule) ProtoMessage() {} - -func (*PolicyRulesWithSubjects) ProtoMessage() {} - -func (*PriorityLevelConfiguration) ProtoMessage() {} - -func (*PriorityLevelConfigurationCondition) ProtoMessage() {} - -func (*PriorityLevelConfigurationList) ProtoMessage() {} - -func (*PriorityLevelConfigurationReference) ProtoMessage() {} - -func (*PriorityLevelConfigurationSpec) ProtoMessage() {} - -func (*PriorityLevelConfigurationStatus) ProtoMessage() {} - -func (*QueuingConfiguration) ProtoMessage() {} - -func (*ResourcePolicyRule) ProtoMessage() {} - -func (*ServiceAccountSubject) ProtoMessage() {} - -func (*Subject) ProtoMessage() {} - -func (*UserSubject) ProtoMessage() {} diff --git a/vendor/k8s.io/api/flowcontrol/v1beta2/types.go b/vendor/k8s.io/api/flowcontrol/v1beta2/types.go index c66cb173f4..2f82a6823b 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta2/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta2/types.go @@ -431,11 +431,16 @@ type PriorityLevelConfigurationSpec struct { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -444,6 +449,9 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -563,11 +571,16 @@ type LimitResponse struct { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto b/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto index c6504d4353..7e11de2a28 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto +++ b/vendor/k8s.io/api/flowcontrol/v1beta3/generated.proto @@ -179,11 +179,16 @@ message LimitResponse { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden optional QueuingConfiguration queuing = 2; } @@ -362,11 +367,16 @@ message PriorityLevelConfigurationSpec { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator optional string type = 1; // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden optional LimitedPriorityLevelConfiguration limited = 2; // `exempt` specifies how requests are handled for an exempt priority level. @@ -375,6 +385,9 @@ message PriorityLevelConfigurationSpec { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden optional ExemptPriorityLevelConfiguration exempt = 3; } diff --git a/vendor/k8s.io/api/flowcontrol/v1beta3/generated.protomessage.pb.go b/vendor/k8s.io/api/flowcontrol/v1beta3/generated.protomessage.pb.go deleted file mode 100644 index 20407c045c..0000000000 --- a/vendor/k8s.io/api/flowcontrol/v1beta3/generated.protomessage.pb.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta3 - -func (*ExemptPriorityLevelConfiguration) ProtoMessage() {} - -func (*FlowDistinguisherMethod) ProtoMessage() {} - -func (*FlowSchema) ProtoMessage() {} - -func (*FlowSchemaCondition) ProtoMessage() {} - -func (*FlowSchemaList) ProtoMessage() {} - -func (*FlowSchemaSpec) ProtoMessage() {} - -func (*FlowSchemaStatus) ProtoMessage() {} - -func (*GroupSubject) ProtoMessage() {} - -func (*LimitResponse) ProtoMessage() {} - -func (*LimitedPriorityLevelConfiguration) ProtoMessage() {} - -func (*NonResourcePolicyRule) ProtoMessage() {} - -func (*PolicyRulesWithSubjects) ProtoMessage() {} - -func (*PriorityLevelConfiguration) ProtoMessage() {} - -func (*PriorityLevelConfigurationCondition) ProtoMessage() {} - -func (*PriorityLevelConfigurationList) ProtoMessage() {} - -func (*PriorityLevelConfigurationReference) ProtoMessage() {} - -func (*PriorityLevelConfigurationSpec) ProtoMessage() {} - -func (*PriorityLevelConfigurationStatus) ProtoMessage() {} - -func (*QueuingConfiguration) ProtoMessage() {} - -func (*ResourcePolicyRule) ProtoMessage() {} - -func (*ServiceAccountSubject) ProtoMessage() {} - -func (*Subject) ProtoMessage() {} - -func (*UserSubject) ProtoMessage() {} diff --git a/vendor/k8s.io/api/flowcontrol/v1beta3/types.go b/vendor/k8s.io/api/flowcontrol/v1beta3/types.go index 0ffc22a236..26b67629ce 100644 --- a/vendor/k8s.io/api/flowcontrol/v1beta3/types.go +++ b/vendor/k8s.io/api/flowcontrol/v1beta3/types.go @@ -447,11 +447,16 @@ type PriorityLevelConfigurationSpec struct { // capacity is made available exclusively to this priority level. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"` // `limited` specifies how requests are handled for a Limited priority level. // This field must be non-empty if and only if `type` is `"Limited"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:forbidden Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"` // `exempt` specifies how requests are handled for an exempt priority level. @@ -460,6 +465,9 @@ type PriorityLevelConfigurationSpec struct { // If empty and `type` is `"Exempt"` then the default values // for `ExemptPriorityLevelConfiguration` apply. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Exempt")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Limited")=+k8s:forbidden Exempt *ExemptPriorityLevelConfiguration `json:"exempt,omitempty" protobuf:"bytes,3,opt,name=exempt"` } @@ -579,11 +587,16 @@ type LimitResponse struct { // are rejected. // Required. // +unionDiscriminator + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:discriminator Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"` // `queuing` holds the configuration parameters for queuing. // This field may be non-empty only if `type` is `"Queue"`. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:member("Queue")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:member("Reject")=+k8s:forbidden Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"` } diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto b/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto index 5ea5c0ec8e..03b1ac45c0 100644 --- a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.proto @@ -36,6 +36,7 @@ message ImageReview { optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec holds information about the pod being evaluated + // +optional optional ImageReviewSpec spec = 2; // Status is filled in by the backend and indicates whether the pod should be allowed. @@ -71,6 +72,7 @@ message ImageReviewSpec { // ImageReviewStatus is the result of the review for the pod creation request. message ImageReviewStatus { // Allowed indicates that all images were allowed to be run. + // +optional optional bool allowed = 1; // Reason should be empty unless Allowed is false in which case it diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index 215f52a377..0000000000 --- a/vendor/k8s.io/api/imagepolicy/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*ImageReview) ProtoMessage() {} - -func (*ImageReviewContainerSpec) ProtoMessage() {} - -func (*ImageReviewSpec) ProtoMessage() {} - -func (*ImageReviewStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go b/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go index 19ac2b536f..cc8f4cf89f 100644 --- a/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go +++ b/vendor/k8s.io/api/imagepolicy/v1alpha1/types.go @@ -34,6 +34,7 @@ type ImageReview struct { metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec holds information about the pod being evaluated + // +optional Spec ImageReviewSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // Status is filled in by the backend and indicates whether the pod should be allowed. @@ -68,6 +69,7 @@ type ImageReviewContainerSpec struct { // ImageReviewStatus is the result of the review for the pod creation request. type ImageReviewStatus struct { // Allowed indicates that all images were allowed to be run. + // +optional Allowed bool `json:"allowed" protobuf:"varint,1,opt,name=allowed"` // Reason should be empty unless Allowed is false in which case it // may contain a short description of what is wrong. Kubernetes diff --git a/vendor/k8s.io/api/networking/v1/generated.proto b/vendor/k8s.io/api/networking/v1/generated.proto index 16a2792aa6..26dcfdfcc3 100644 --- a/vendor/k8s.io/api/networking/v1/generated.proto +++ b/vendor/k8s.io/api/networking/v1/generated.proto @@ -87,7 +87,7 @@ message IPAddress { // spec is the desired state of the IPAddress. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional IPAddressSpec spec = 2; } @@ -107,6 +107,8 @@ message IPAddressSpec { // ParentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable optional ParentReference parentRef = 1; } @@ -116,6 +118,8 @@ message IPAddressSpec { message IPBlock { // cidr is a string representing the IPBlock // Valid examples are "192.168.1.0/24" or "2001:db8::/64" + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string cidr = 1; // except is a slice of CIDRs that should not be included within an IPBlock @@ -199,9 +203,13 @@ message IngressClassParametersReference { optional string aPIGroup = 1; // kind is the type of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string kind = 2; // name is the name of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; // scope represents if this refers to a cluster or namespace scoped resource. @@ -230,6 +238,7 @@ message IngressClassSpec { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional IngressClassParametersReference parameters = 2; } @@ -446,6 +455,7 @@ message NetworkPolicyEgressRule { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyPeer to = 2; } @@ -468,6 +478,7 @@ message NetworkPolicyIngressRule { // allows traffic only if the traffic matches at least one item in the from list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyPeer from = 2; } @@ -506,6 +517,7 @@ message NetworkPolicyPeer { // ipBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional IPBlock ipBlock = 3; } @@ -551,6 +563,7 @@ message NetworkPolicySpec { // solely to ensure that the pods it selects are isolated by default) // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyIngressRule ingress = 2; // egress is a list of egress rules to be applied to the selected pods. Outgoing traffic @@ -562,6 +575,7 @@ message NetworkPolicySpec { // This field is beta-level in 1.8 // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated NetworkPolicyEgressRule egress = 3; // policyTypes is a list of rule types that the NetworkPolicy relates to. @@ -587,6 +601,7 @@ message ParentReference { // Resource is the resource of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string resource = 2; // Namespace is the namespace of the object being referenced. @@ -595,6 +610,7 @@ message ParentReference { // Name is the name of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 4; } diff --git a/vendor/k8s.io/api/networking/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/networking/v1/generated.protomessage.pb.go deleted file mode 100644 index 54918d47e7..0000000000 --- a/vendor/k8s.io/api/networking/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*HTTPIngressPath) ProtoMessage() {} - -func (*HTTPIngressRuleValue) ProtoMessage() {} - -func (*IPAddress) ProtoMessage() {} - -func (*IPAddressList) ProtoMessage() {} - -func (*IPAddressSpec) ProtoMessage() {} - -func (*IPBlock) ProtoMessage() {} - -func (*Ingress) ProtoMessage() {} - -func (*IngressBackend) ProtoMessage() {} - -func (*IngressClass) ProtoMessage() {} - -func (*IngressClassList) ProtoMessage() {} - -func (*IngressClassParametersReference) ProtoMessage() {} - -func (*IngressClassSpec) ProtoMessage() {} - -func (*IngressList) ProtoMessage() {} - -func (*IngressLoadBalancerIngress) ProtoMessage() {} - -func (*IngressLoadBalancerStatus) ProtoMessage() {} - -func (*IngressPortStatus) ProtoMessage() {} - -func (*IngressRule) ProtoMessage() {} - -func (*IngressRuleValue) ProtoMessage() {} - -func (*IngressServiceBackend) ProtoMessage() {} - -func (*IngressSpec) ProtoMessage() {} - -func (*IngressStatus) ProtoMessage() {} - -func (*IngressTLS) ProtoMessage() {} - -func (*NetworkPolicy) ProtoMessage() {} - -func (*NetworkPolicyEgressRule) ProtoMessage() {} - -func (*NetworkPolicyIngressRule) ProtoMessage() {} - -func (*NetworkPolicyList) ProtoMessage() {} - -func (*NetworkPolicyPeer) ProtoMessage() {} - -func (*NetworkPolicyPort) ProtoMessage() {} - -func (*NetworkPolicySpec) ProtoMessage() {} - -func (*ParentReference) ProtoMessage() {} - -func (*ServiceBackendPort) ProtoMessage() {} - -func (*ServiceCIDR) ProtoMessage() {} - -func (*ServiceCIDRList) ProtoMessage() {} - -func (*ServiceCIDRSpec) ProtoMessage() {} - -func (*ServiceCIDRStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/networking/v1/types.go b/vendor/k8s.io/api/networking/v1/types.go index 7d9a4fc94c..a0e737ee15 100644 --- a/vendor/k8s.io/api/networking/v1/types.go +++ b/vendor/k8s.io/api/networking/v1/types.go @@ -77,6 +77,7 @@ type NetworkPolicySpec struct { // solely to ensure that the pods it selects are isolated by default) // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"` // egress is a list of egress rules to be applied to the selected pods. Outgoing traffic @@ -88,6 +89,7 @@ type NetworkPolicySpec struct { // This field is beta-level in 1.8 // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Egress []NetworkPolicyEgressRule `json:"egress,omitempty" protobuf:"bytes,3,rep,name=egress"` // policyTypes is a list of rule types that the NetworkPolicy relates to. @@ -124,6 +126,7 @@ type NetworkPolicyIngressRule struct { // allows traffic only if the traffic matches at least one item in the from list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"` } @@ -147,6 +150,7 @@ type NetworkPolicyEgressRule struct { // allows traffic only if the traffic matches at least one item in the to list. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional To []NetworkPolicyPeer `json:"to,omitempty" protobuf:"bytes,2,rep,name=to"` } @@ -178,6 +182,8 @@ type NetworkPolicyPort struct { type IPBlock struct { // cidr is a string representing the IPBlock // Valid examples are "192.168.1.0/24" or "2001:db8::/64" + // +required + // +k8s:alpha(since: "1.36")=+k8s:required CIDR string `json:"cidr" protobuf:"bytes,1,name=cidr"` // except is a slice of CIDRs that should not be included within an IPBlock @@ -212,6 +218,7 @@ type NetworkPolicyPeer struct { // ipBlock defines policy on a particular IPBlock. If this field is set then // neither of the other fields can be. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional IPBlock *IPBlock `json:"ipBlock,omitempty" protobuf:"bytes,3,rep,name=ipBlock"` } @@ -583,6 +590,7 @@ type IngressClassSpec struct { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Parameters *IngressClassParametersReference `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"` } @@ -605,9 +613,13 @@ type IngressClassParametersReference struct { APIGroup *string `json:"apiGroup,omitempty" protobuf:"bytes,1,opt,name=aPIGroup"` // kind is the type of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` // name is the name of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // scope represents if this refers to a cluster or namespace scoped resource. @@ -657,7 +669,7 @@ type IPAddress struct { metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec is the desired state of the IPAddress. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec IPAddressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } @@ -666,6 +678,8 @@ type IPAddressSpec struct { // ParentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable ParentRef *ParentReference `json:"parentRef,omitempty" protobuf:"bytes,1,opt,name=parentRef"` } @@ -676,12 +690,14 @@ type ParentReference struct { Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"` // Resource is the resource of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required Resource string `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"` // Namespace is the namespace of the object being referenced. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` // Name is the name of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name,omitempty" protobuf:"bytes,4,opt,name=name"` } diff --git a/vendor/k8s.io/api/networking/v1beta1/generated.proto b/vendor/k8s.io/api/networking/v1beta1/generated.proto index 3368dcaec3..a6944d6034 100644 --- a/vendor/k8s.io/api/networking/v1beta1/generated.proto +++ b/vendor/k8s.io/api/networking/v1beta1/generated.proto @@ -88,7 +88,7 @@ message IPAddress { // spec is the desired state of the IPAddress. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required optional IPAddressSpec spec = 2; } @@ -108,6 +108,8 @@ message IPAddressSpec { // ParentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable optional ParentReference parentRef = 1; } @@ -186,9 +188,13 @@ message IngressClassParametersReference { optional string aPIGroup = 1; // kind is the type of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string kind = 2; // name is the name of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; // scope represents if this refers to a cluster or namespace scoped resource. @@ -216,6 +222,7 @@ message IngressClassSpec { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional IngressClassParametersReference parameters = 2; } @@ -397,6 +404,7 @@ message ParentReference { // Resource is the resource of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string resource = 2; // Namespace is the namespace of the object being referenced. @@ -405,6 +413,7 @@ message ParentReference { // Name is the name of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 4; } diff --git a/vendor/k8s.io/api/networking/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/networking/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index abd29cba98..0000000000 --- a/vendor/k8s.io/api/networking/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*HTTPIngressPath) ProtoMessage() {} - -func (*HTTPIngressRuleValue) ProtoMessage() {} - -func (*IPAddress) ProtoMessage() {} - -func (*IPAddressList) ProtoMessage() {} - -func (*IPAddressSpec) ProtoMessage() {} - -func (*Ingress) ProtoMessage() {} - -func (*IngressBackend) ProtoMessage() {} - -func (*IngressClass) ProtoMessage() {} - -func (*IngressClassList) ProtoMessage() {} - -func (*IngressClassParametersReference) ProtoMessage() {} - -func (*IngressClassSpec) ProtoMessage() {} - -func (*IngressList) ProtoMessage() {} - -func (*IngressLoadBalancerIngress) ProtoMessage() {} - -func (*IngressLoadBalancerStatus) ProtoMessage() {} - -func (*IngressPortStatus) ProtoMessage() {} - -func (*IngressRule) ProtoMessage() {} - -func (*IngressRuleValue) ProtoMessage() {} - -func (*IngressSpec) ProtoMessage() {} - -func (*IngressStatus) ProtoMessage() {} - -func (*IngressTLS) ProtoMessage() {} - -func (*ParentReference) ProtoMessage() {} - -func (*ServiceCIDR) ProtoMessage() {} - -func (*ServiceCIDRList) ProtoMessage() {} - -func (*ServiceCIDRSpec) ProtoMessage() {} - -func (*ServiceCIDRStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/networking/v1beta1/types.go b/vendor/k8s.io/api/networking/v1beta1/types.go index cd7126a5a8..7cd9b2b58b 100644 --- a/vendor/k8s.io/api/networking/v1beta1/types.go +++ b/vendor/k8s.io/api/networking/v1beta1/types.go @@ -368,6 +368,7 @@ type IngressClassSpec struct { // configuration for the controller. This is optional if the controller does // not require extra parameters. // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Parameters *IngressClassParametersReference `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"` } @@ -390,9 +391,13 @@ type IngressClassParametersReference struct { APIGroup *string `json:"apiGroup,omitempty" protobuf:"bytes,1,opt,name=aPIGroup"` // kind is the type of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` // name is the name of resource being referenced. + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // scope represents if this refers to a cluster or namespace scoped resource. @@ -442,7 +447,7 @@ type IPAddress struct { metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // spec is the desired state of the IPAddress. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status - // +optional + // +required Spec IPAddressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` } @@ -451,6 +456,8 @@ type IPAddressSpec struct { // ParentRef references the resource that an IPAddress is attached to. // An IPAddress must reference a parent object. // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable ParentRef *ParentReference `json:"parentRef,omitempty" protobuf:"bytes,1,opt,name=parentRef"` } @@ -461,12 +468,14 @@ type ParentReference struct { Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"` // Resource is the resource of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required Resource string `json:"resource,omitempty" protobuf:"bytes,2,opt,name=resource"` // Namespace is the namespace of the object being referenced. // +optional Namespace string `json:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"` // Name is the name of the object being referenced. // +required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name,omitempty" protobuf:"bytes,4,opt,name=name"` } diff --git a/vendor/k8s.io/api/node/v1/generated.proto b/vendor/k8s.io/api/node/v1/generated.proto index e6b8852ec1..4d77c9b781 100644 --- a/vendor/k8s.io/api/node/v1/generated.proto +++ b/vendor/k8s.io/api/node/v1/generated.proto @@ -59,6 +59,10 @@ message RuntimeClass { // in a pod. // The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. + // +required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:required optional string handler = 2; // overhead represents the resource overhead associated with running a pod for a diff --git a/vendor/k8s.io/api/node/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/node/v1/generated.protomessage.pb.go deleted file mode 100644 index 97072dfa1e..0000000000 --- a/vendor/k8s.io/api/node/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*Overhead) ProtoMessage() {} - -func (*RuntimeClass) ProtoMessage() {} - -func (*RuntimeClassList) ProtoMessage() {} - -func (*Scheduling) ProtoMessage() {} diff --git a/vendor/k8s.io/api/node/v1/types.go b/vendor/k8s.io/api/node/v1/types.go index 169862ea94..c2ea739dc8 100644 --- a/vendor/k8s.io/api/node/v1/types.go +++ b/vendor/k8s.io/api/node/v1/types.go @@ -50,6 +50,10 @@ type RuntimeClass struct { // in a pod. // The Handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. + // +required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:required Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"` // overhead represents the resource overhead associated with running a pod for a diff --git a/vendor/k8s.io/api/node/v1alpha1/generated.proto b/vendor/k8s.io/api/node/v1alpha1/generated.proto index bc68718d90..c50b639065 100644 --- a/vendor/k8s.io/api/node/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/node/v1alpha1/generated.proto @@ -51,6 +51,7 @@ message RuntimeClass { // spec represents specification of the RuntimeClass // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +required optional RuntimeClassSpec spec = 2; } @@ -80,6 +81,10 @@ message RuntimeClassSpec { // in a pod. // The runtimeHandler must be lowercase, conform to the DNS Label (RFC 1123) // requirements, and is immutable. + // +required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:required optional string runtimeHandler = 1; // overhead represents the resource overhead associated with running a pod for a diff --git a/vendor/k8s.io/api/node/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/node/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index acd3b604ee..0000000000 --- a/vendor/k8s.io/api/node/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*Overhead) ProtoMessage() {} - -func (*RuntimeClass) ProtoMessage() {} - -func (*RuntimeClassList) ProtoMessage() {} - -func (*RuntimeClassSpec) ProtoMessage() {} - -func (*Scheduling) ProtoMessage() {} diff --git a/vendor/k8s.io/api/node/v1alpha1/types.go b/vendor/k8s.io/api/node/v1alpha1/types.go index bf9e284bf7..3521335b07 100644 --- a/vendor/k8s.io/api/node/v1alpha1/types.go +++ b/vendor/k8s.io/api/node/v1alpha1/types.go @@ -41,6 +41,7 @@ type RuntimeClass struct { // spec represents specification of the RuntimeClass // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status + // +required Spec RuntimeClassSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -59,6 +60,10 @@ type RuntimeClassSpec struct { // in a pod. // The runtimeHandler must be lowercase, conform to the DNS Label (RFC 1123) // requirements, and is immutable. + // +required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:required RuntimeHandler string `json:"runtimeHandler" protobuf:"bytes,1,opt,name=runtimeHandler"` // overhead represents the resource overhead associated with running a pod for a diff --git a/vendor/k8s.io/api/node/v1beta1/generated.proto b/vendor/k8s.io/api/node/v1beta1/generated.proto index 497027e033..073a185e2c 100644 --- a/vendor/k8s.io/api/node/v1beta1/generated.proto +++ b/vendor/k8s.io/api/node/v1beta1/generated.proto @@ -59,6 +59,10 @@ message RuntimeClass { // in a pod. // The handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. + // +required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:required optional string handler = 2; // overhead represents the resource overhead associated with running a pod for a diff --git a/vendor/k8s.io/api/node/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/node/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index dfe8e29d95..0000000000 --- a/vendor/k8s.io/api/node/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*Overhead) ProtoMessage() {} - -func (*RuntimeClass) ProtoMessage() {} - -func (*RuntimeClassList) ProtoMessage() {} - -func (*Scheduling) ProtoMessage() {} diff --git a/vendor/k8s.io/api/node/v1beta1/types.go b/vendor/k8s.io/api/node/v1beta1/types.go index 74ecca26ad..145e138663 100644 --- a/vendor/k8s.io/api/node/v1beta1/types.go +++ b/vendor/k8s.io/api/node/v1beta1/types.go @@ -51,6 +51,10 @@ type RuntimeClass struct { // in a pod. // The handler must be lowercase, conform to the DNS Label (RFC 1123) requirements, // and is immutable. + // +required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-short-name" + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:required Handler string `json:"handler" protobuf:"bytes,2,opt,name=handler"` // overhead represents the resource overhead associated with running a pod for a diff --git a/vendor/k8s.io/api/policy/v1/generated.proto b/vendor/k8s.io/api/policy/v1/generated.proto index 9534890723..704cc10b7d 100644 --- a/vendor/k8s.io/api/policy/v1/generated.proto +++ b/vendor/k8s.io/api/policy/v1/generated.proto @@ -142,15 +142,19 @@ message PodDisruptionBudgetStatus { map disruptedPods = 2; // Number of pod disruptions that are currently allowed. + // +optional optional int32 disruptionsAllowed = 3; // current number of healthy pods + // +optional optional int32 currentHealthy = 4; // minimum desired number of healthy pods + // +optional optional int32 desiredHealthy = 5; // total number of pods counted by this disruption budget + // +optional optional int32 expectedPods = 6; // Conditions contain conditions for PDB. The disruption controller sets the diff --git a/vendor/k8s.io/api/policy/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/policy/v1/generated.protomessage.pb.go deleted file mode 100644 index 2ede217639..0000000000 --- a/vendor/k8s.io/api/policy/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*Eviction) ProtoMessage() {} - -func (*PodDisruptionBudget) ProtoMessage() {} - -func (*PodDisruptionBudgetList) ProtoMessage() {} - -func (*PodDisruptionBudgetSpec) ProtoMessage() {} - -func (*PodDisruptionBudgetStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/policy/v1/types.go b/vendor/k8s.io/api/policy/v1/types.go index 4e74367894..ebf349e317 100644 --- a/vendor/k8s.io/api/policy/v1/types.go +++ b/vendor/k8s.io/api/policy/v1/types.go @@ -117,15 +117,19 @@ type PodDisruptionBudgetStatus struct { DisruptedPods map[string]metav1.Time `json:"disruptedPods,omitempty" protobuf:"bytes,2,rep,name=disruptedPods"` // Number of pod disruptions that are currently allowed. + // +optional DisruptionsAllowed int32 `json:"disruptionsAllowed" protobuf:"varint,3,opt,name=disruptionsAllowed"` // current number of healthy pods + // +optional CurrentHealthy int32 `json:"currentHealthy" protobuf:"varint,4,opt,name=currentHealthy"` // minimum desired number of healthy pods + // +optional DesiredHealthy int32 `json:"desiredHealthy" protobuf:"varint,5,opt,name=desiredHealthy"` // total number of pods counted by this disruption budget + // +optional ExpectedPods int32 `json:"expectedPods" protobuf:"varint,6,opt,name=expectedPods"` // Conditions contain conditions for PDB. The disruption controller sets the diff --git a/vendor/k8s.io/api/policy/v1beta1/generated.proto b/vendor/k8s.io/api/policy/v1beta1/generated.proto index e0cbe00f1c..a8200a2d78 100644 --- a/vendor/k8s.io/api/policy/v1beta1/generated.proto +++ b/vendor/k8s.io/api/policy/v1beta1/generated.proto @@ -142,15 +142,19 @@ message PodDisruptionBudgetStatus { map disruptedPods = 2; // Number of pod disruptions that are currently allowed. + // +optional optional int32 disruptionsAllowed = 3; // current number of healthy pods + // +optional optional int32 currentHealthy = 4; // minimum desired number of healthy pods + // +optional optional int32 desiredHealthy = 5; // total number of pods counted by this disruption budget + // +optional optional int32 expectedPods = 6; // Conditions contain conditions for PDB. The disruption controller sets the diff --git a/vendor/k8s.io/api/policy/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/policy/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 01e0847fce..0000000000 --- a/vendor/k8s.io/api/policy/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*Eviction) ProtoMessage() {} - -func (*PodDisruptionBudget) ProtoMessage() {} - -func (*PodDisruptionBudgetList) ProtoMessage() {} - -func (*PodDisruptionBudgetSpec) ProtoMessage() {} - -func (*PodDisruptionBudgetStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/api/policy/v1beta1/types.go b/vendor/k8s.io/api/policy/v1beta1/types.go index 9bba454f94..354c22a3d0 100644 --- a/vendor/k8s.io/api/policy/v1beta1/types.go +++ b/vendor/k8s.io/api/policy/v1beta1/types.go @@ -114,15 +114,19 @@ type PodDisruptionBudgetStatus struct { DisruptedPods map[string]metav1.Time `json:"disruptedPods,omitempty" protobuf:"bytes,2,rep,name=disruptedPods"` // Number of pod disruptions that are currently allowed. + // +optional DisruptionsAllowed int32 `json:"disruptionsAllowed" protobuf:"varint,3,opt,name=disruptionsAllowed"` // current number of healthy pods + // +optional CurrentHealthy int32 `json:"currentHealthy" protobuf:"varint,4,opt,name=currentHealthy"` // minimum desired number of healthy pods + // +optional DesiredHealthy int32 `json:"desiredHealthy" protobuf:"varint,5,opt,name=desiredHealthy"` // total number of pods counted by this disruption budget + // +optional ExpectedPods int32 `json:"expectedPods" protobuf:"varint,6,opt,name=expectedPods"` // Conditions contain conditions for PDB. The disruption controller sets the diff --git a/vendor/k8s.io/api/rbac/v1/generated.proto b/vendor/k8s.io/api/rbac/v1/generated.proto index 56869814ec..7b4ec2afc1 100644 --- a/vendor/k8s.io/api/rbac/v1/generated.proto +++ b/vendor/k8s.io/api/rbac/v1/generated.proto @@ -46,6 +46,7 @@ message ClusterRole { // Rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated PolicyRule rules = 2; // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. @@ -65,11 +66,13 @@ message ClusterRoleBinding { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Subject subjects = 2; // RoleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. + // +required optional RoleRef roleRef = 3; } @@ -98,6 +101,8 @@ message ClusterRoleList { message PolicyRule { // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic + // +required + // +k8s:alpha(since: "1.36")=+k8s:required repeated string verbs = 1; // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of @@ -133,6 +138,7 @@ message Role { // Rules holds all the PolicyRules for this Role // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated PolicyRule rules = 2; } @@ -147,11 +153,13 @@ message RoleBinding { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Subject subjects = 2; // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. + // +required optional RoleRef roleRef = 3; } @@ -179,14 +187,16 @@ message RoleList { // +structType=atomic message RoleRef { // APIGroup is the group for the resource being referenced + // +optional optional string apiGroup = 1; // Kind is the type of resource being referenced + // +required optional string kind = 2; // Name is the name of resource being referenced // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; } @@ -196,6 +206,7 @@ message RoleRef { message Subject { // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + // +required optional string kind = 1; // APIGroup holds the API group of the referenced subject. @@ -206,7 +217,7 @@ message Subject { // Name of the object being referenced. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty diff --git a/vendor/k8s.io/api/rbac/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/rbac/v1/generated.protomessage.pb.go deleted file mode 100644 index 6e29e012fa..0000000000 --- a/vendor/k8s.io/api/rbac/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*AggregationRule) ProtoMessage() {} - -func (*ClusterRole) ProtoMessage() {} - -func (*ClusterRoleBinding) ProtoMessage() {} - -func (*ClusterRoleBindingList) ProtoMessage() {} - -func (*ClusterRoleList) ProtoMessage() {} - -func (*PolicyRule) ProtoMessage() {} - -func (*Role) ProtoMessage() {} - -func (*RoleBinding) ProtoMessage() {} - -func (*RoleBindingList) ProtoMessage() {} - -func (*RoleList) ProtoMessage() {} - -func (*RoleRef) ProtoMessage() {} - -func (*Subject) ProtoMessage() {} diff --git a/vendor/k8s.io/api/rbac/v1/types.go b/vendor/k8s.io/api/rbac/v1/types.go index 2fde11b306..d3bb6d1a9c 100644 --- a/vendor/k8s.io/api/rbac/v1/types.go +++ b/vendor/k8s.io/api/rbac/v1/types.go @@ -49,6 +49,8 @@ const ( type PolicyRule struct { // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of @@ -79,6 +81,7 @@ type PolicyRule struct { type Subject struct { // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + // +required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` // APIGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. @@ -87,7 +90,7 @@ type Subject struct { APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,2,opt,name=apiGroup"` // Name of the object being referenced. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. @@ -99,12 +102,14 @@ type Subject struct { // +structType=atomic type RoleRef struct { // APIGroup is the group for the resource being referenced + // +optional APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` // Kind is the type of resource being referenced + // +required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` // Name is the name of resource being referenced // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` } @@ -122,6 +127,7 @@ type Role struct { // Rules holds all the PolicyRules for this Role // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` } @@ -141,11 +147,13 @@ type RoleBinding struct { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. + // +required RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -192,6 +200,7 @@ type ClusterRole struct { // Rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. @@ -226,11 +235,13 @@ type ClusterRoleBinding struct { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` // RoleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. // This field is immutable. + // +required RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } diff --git a/vendor/k8s.io/api/rbac/v1alpha1/generated.proto b/vendor/k8s.io/api/rbac/v1alpha1/generated.proto index f787f3976e..9551d11921 100644 --- a/vendor/k8s.io/api/rbac/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/rbac/v1alpha1/generated.proto @@ -47,6 +47,7 @@ message ClusterRole { // Rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated PolicyRule rules = 2; // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. @@ -67,10 +68,12 @@ message ClusterRoleBinding { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Subject subjects = 2; // RoleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required optional RoleRef roleRef = 3; } @@ -101,6 +104,8 @@ message ClusterRoleList { message PolicyRule { // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic + // +required + // +k8s:alpha(since: "1.36")=+k8s:required repeated string verbs = 1; // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of @@ -137,6 +142,7 @@ message Role { // Rules holds all the PolicyRules for this Role // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated PolicyRule rules = 2; } @@ -152,10 +158,12 @@ message RoleBinding { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Subject subjects = 2; // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required optional RoleRef roleRef = 3; } @@ -184,14 +192,16 @@ message RoleList { // RoleRef contains information that points to the role being used message RoleRef { // APIGroup is the group for the resource being referenced + // +optional optional string apiGroup = 1; // Kind is the type of resource being referenced + // +required optional string kind = 2; // Name is the name of resource being referenced // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; } @@ -200,6 +210,7 @@ message RoleRef { message Subject { // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + // +required optional string kind = 1; // APIVersion holds the API group and version of the referenced subject. @@ -211,7 +222,7 @@ message Subject { // Name of the object being referenced. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty diff --git a/vendor/k8s.io/api/rbac/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/rbac/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index 20f8d575ea..0000000000 --- a/vendor/k8s.io/api/rbac/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*AggregationRule) ProtoMessage() {} - -func (*ClusterRole) ProtoMessage() {} - -func (*ClusterRoleBinding) ProtoMessage() {} - -func (*ClusterRoleBindingList) ProtoMessage() {} - -func (*ClusterRoleList) ProtoMessage() {} - -func (*PolicyRule) ProtoMessage() {} - -func (*Role) ProtoMessage() {} - -func (*RoleBinding) ProtoMessage() {} - -func (*RoleBindingList) ProtoMessage() {} - -func (*RoleList) ProtoMessage() {} - -func (*RoleRef) ProtoMessage() {} - -func (*Subject) ProtoMessage() {} diff --git a/vendor/k8s.io/api/rbac/v1alpha1/types.go b/vendor/k8s.io/api/rbac/v1alpha1/types.go index a0d52ee4fc..4ff4c06015 100644 --- a/vendor/k8s.io/api/rbac/v1alpha1/types.go +++ b/vendor/k8s.io/api/rbac/v1alpha1/types.go @@ -49,6 +49,8 @@ const ( type PolicyRule struct { // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of @@ -78,6 +80,7 @@ type PolicyRule struct { type Subject struct { // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + // +required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` // APIVersion holds the API group and version of the referenced subject. // Defaults to "v1" for ServiceAccount subjects. @@ -87,7 +90,7 @@ type Subject struct { APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"` // Name of the object being referenced. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. @@ -98,12 +101,14 @@ type Subject struct { // RoleRef contains information that points to the role being used type RoleRef struct { // APIGroup is the group for the resource being referenced + // +optional APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` // Kind is the type of resource being referenced + // +required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` // Name is the name of resource being referenced // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` } @@ -121,6 +126,7 @@ type Role struct { // Rules holds all the PolicyRules for this Role // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` } @@ -140,10 +146,12 @@ type RoleBinding struct { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -190,6 +198,7 @@ type ClusterRole struct { // Rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. @@ -224,10 +233,12 @@ type ClusterRoleBinding struct { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` // RoleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } diff --git a/vendor/k8s.io/api/rbac/v1beta1/generated.proto b/vendor/k8s.io/api/rbac/v1beta1/generated.proto index cac7b413e8..326f312ec4 100644 --- a/vendor/k8s.io/api/rbac/v1beta1/generated.proto +++ b/vendor/k8s.io/api/rbac/v1beta1/generated.proto @@ -47,6 +47,7 @@ message ClusterRole { // Rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated PolicyRule rules = 2; // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. @@ -67,10 +68,12 @@ message ClusterRoleBinding { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Subject subjects = 2; // RoleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required optional RoleRef roleRef = 3; } @@ -101,6 +104,8 @@ message ClusterRoleList { message PolicyRule { // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic + // +required + // +k8s:alpha(since: "1.36")=+k8s:required repeated string verbs = 1; // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of @@ -138,6 +143,7 @@ message Role { // Rules holds all the PolicyRules for this Role // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated PolicyRule rules = 2; } @@ -153,10 +159,12 @@ message RoleBinding { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional repeated Subject subjects = 2; // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required optional RoleRef roleRef = 3; } @@ -185,14 +193,16 @@ message RoleList { // RoleRef contains information that points to the role being used message RoleRef { // APIGroup is the group for the resource being referenced + // +optional optional string apiGroup = 1; // Kind is the type of resource being referenced + // +required optional string kind = 2; // Name is the name of resource being referenced // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; } @@ -201,6 +211,7 @@ message RoleRef { message Subject { // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + // +required optional string kind = 1; // APIGroup holds the API group of the referenced subject. @@ -211,7 +222,7 @@ message Subject { // Name of the object being referenced. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string name = 3; // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty diff --git a/vendor/k8s.io/api/rbac/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/rbac/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index b298968367..0000000000 --- a/vendor/k8s.io/api/rbac/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*AggregationRule) ProtoMessage() {} - -func (*ClusterRole) ProtoMessage() {} - -func (*ClusterRoleBinding) ProtoMessage() {} - -func (*ClusterRoleBindingList) ProtoMessage() {} - -func (*ClusterRoleList) ProtoMessage() {} - -func (*PolicyRule) ProtoMessage() {} - -func (*Role) ProtoMessage() {} - -func (*RoleBinding) ProtoMessage() {} - -func (*RoleBindingList) ProtoMessage() {} - -func (*RoleList) ProtoMessage() {} - -func (*RoleRef) ProtoMessage() {} - -func (*Subject) ProtoMessage() {} diff --git a/vendor/k8s.io/api/rbac/v1beta1/types.go b/vendor/k8s.io/api/rbac/v1beta1/types.go index 861e33c975..c653d071fe 100644 --- a/vendor/k8s.io/api/rbac/v1beta1/types.go +++ b/vendor/k8s.io/api/rbac/v1beta1/types.go @@ -49,6 +49,8 @@ const ( type PolicyRule struct { // Verbs is a list of Verbs that apply to ALL the ResourceKinds contained in this rule. '*' represents all verbs. // +listType=atomic + // +required + // +k8s:alpha(since: "1.36")=+k8s:required Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"` // APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of @@ -79,6 +81,7 @@ type PolicyRule struct { type Subject struct { // Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount". // If the Authorizer does not recognized the kind value, the Authorizer should report an error. + // +required Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"` // APIGroup holds the API group of the referenced subject. // Defaults to "" for ServiceAccount subjects. @@ -87,7 +90,7 @@ type Subject struct { APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,2,opt,name=apiGroup"` // Name of the object being referenced. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` // Namespace of the referenced object. If the object kind is non-namespace, such as "User" or "Group", and this value is not empty // the Authorizer should report an error. @@ -98,12 +101,14 @@ type Subject struct { // RoleRef contains information that points to the role being used type RoleRef struct { // APIGroup is the group for the resource being referenced + // +optional APIGroup string `json:"apiGroup" protobuf:"bytes,1,opt,name=apiGroup"` // Kind is the type of resource being referenced + // +required Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` // Name is the name of resource being referenced // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Name string `json:"name" protobuf:"bytes,3,opt,name=name"` } @@ -125,6 +130,7 @@ type Role struct { // Rules holds all the PolicyRules for this Role // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` } @@ -148,10 +154,12 @@ type RoleBinding struct { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` // RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } @@ -210,6 +218,7 @@ type ClusterRole struct { // Rules holds all the PolicyRules for this ClusterRole // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Rules []PolicyRule `json:"rules" protobuf:"bytes,2,rep,name=rules"` // AggregationRule is an optional field that describes how to build the Rules for this ClusterRole. // If AggregationRule is set, then the Rules are controller managed and direct changes to Rules will be @@ -247,10 +256,12 @@ type ClusterRoleBinding struct { // Subjects holds references to the objects the role applies to. // +optional // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional Subjects []Subject `json:"subjects,omitempty" protobuf:"bytes,2,rep,name=subjects"` // RoleRef can only reference a ClusterRole in the global namespace. // If the RoleRef cannot be resolved, the Authorizer must return an error. + // +required RoleRef RoleRef `json:"roleRef" protobuf:"bytes,3,opt,name=roleRef"` } diff --git a/vendor/k8s.io/api/resource/v1/generated.pb.go b/vendor/k8s.io/api/resource/v1/generated.pb.go index e690204905..f59e829057 100644 --- a/vendor/k8s.io/api/resource/v1/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1/generated.pb.go @@ -25,6 +25,7 @@ import ( io "io" "sort" + k8s_io_api_core_v1 "k8s.io/api/core/v1" v11 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -97,6 +98,8 @@ func (m *ExactDeviceRequest) Reset() { *m = ExactDeviceRequest{} } func (m *NetworkDeviceData) Reset() { *m = NetworkDeviceData{} } +func (m *NodeAllocatableResourceMapping) Reset() { *m = NodeAllocatableResourceMapping{} } + func (m *OpaqueDeviceConfiguration) Reset() { *m = OpaqueDeviceConfiguration{} } func (m *ResourceClaim) Reset() { *m = ResourceClaim{} } @@ -573,6 +576,35 @@ func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NodeAllocatableResourceMappings) > 0 { + keysForNodeAllocatableResourceMappings := make([]string, 0, len(m.NodeAllocatableResourceMappings)) + for k := range m.NodeAllocatableResourceMappings { + keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + } + sort.Strings(keysForNodeAllocatableResourceMappings) + for iNdEx := len(keysForNodeAllocatableResourceMappings) - 1; iNdEx >= 0; iNdEx-- { + v := m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResourceMappings[iNdEx])] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(keysForNodeAllocatableResourceMappings[iNdEx]) + copy(dAtA[i:], keysForNodeAllocatableResourceMappings[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResourceMappings[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x6a + } + } if m.AllowMultipleAllocations != nil { i-- if *m.AllowMultipleAllocations { @@ -852,6 +884,43 @@ func (m *DeviceAttribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.VersionValues) > 0 { + for iNdEx := len(m.VersionValues) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.VersionValues[iNdEx]) + copy(dAtA[i:], m.VersionValues[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.VersionValues[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if len(m.StringValues) > 0 { + for iNdEx := len(m.StringValues) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StringValues[iNdEx]) + copy(dAtA[i:], m.StringValues[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.StringValues[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if len(m.BoolValues) > 0 { + for iNdEx := len(m.BoolValues) - 1; iNdEx >= 0; iNdEx-- { + i-- + if m.BoolValues[iNdEx] { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + } + if len(m.IntValues) > 0 { + for iNdEx := len(m.IntValues) - 1; iNdEx >= 0; iNdEx-- { + i = encodeVarintGenerated(dAtA, i, uint64(m.IntValues[iNdEx])) + i-- + dAtA[i] = 0x30 + } + } if m.VersionValue != nil { i -= len(*m.VersionValue) copy(dAtA[i:], *m.VersionValue) @@ -1872,6 +1941,48 @@ func (m *NetworkDeviceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableResourceMapping) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllocationMultiplier != nil { + { + size, err := m.AllocationMultiplier.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.CapacityKey != nil { + i -= len(*m.CapacityKey) + copy(dAtA[i:], *m.CapacityKey) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.CapacityKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2745,6 +2856,15 @@ func (m *Device) Size() (n int) { if m.AllowMultipleAllocations != nil { n += 2 } + if len(m.NodeAllocatableResourceMappings) > 0 { + for k, v := range m.NodeAllocatableResourceMappings { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } return n } @@ -2808,6 +2928,26 @@ func (m *DeviceAttribute) Size() (n int) { l = len(*m.VersionValue) n += 1 + l + sovGenerated(uint64(l)) } + if len(m.IntValues) > 0 { + for _, e := range m.IntValues { + n += 1 + sovGenerated(uint64(e)) + } + } + if len(m.BoolValues) > 0 { + n += 2 * len(m.BoolValues) + } + if len(m.StringValues) > 0 { + for _, s := range m.StringValues { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.VersionValues) > 0 { + for _, s := range m.VersionValues { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3200,6 +3340,23 @@ func (m *NetworkDeviceData) Size() (n int) { return n } +func (m *NodeAllocatableResourceMapping) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CapacityKey != nil { + l = len(*m.CapacityKey) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.AllocationMultiplier != nil { + l = m.AllocationMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *OpaqueDeviceConfiguration) Size() (n int) { if m == nil { return 0 @@ -3586,6 +3743,16 @@ func (this *Device) String() string { mapStringForCapacity += fmt.Sprintf("%v: %v,", k, this.Capacity[QualifiedName(k)]) } mapStringForCapacity += "}" + keysForNodeAllocatableResourceMappings := make([]string, 0, len(this.NodeAllocatableResourceMappings)) + for k := range this.NodeAllocatableResourceMappings { + keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + } + sort.Strings(keysForNodeAllocatableResourceMappings) + mapStringForNodeAllocatableResourceMappings := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping{" + for _, k := range keysForNodeAllocatableResourceMappings { + mapStringForNodeAllocatableResourceMappings += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(k)]) + } + mapStringForNodeAllocatableResourceMappings += "}" s := strings.Join([]string{`&Device{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Attributes:` + mapStringForAttributes + `,`, @@ -3599,6 +3766,7 @@ func (this *Device) String() string { `BindingConditions:` + fmt.Sprintf("%v", this.BindingConditions) + `,`, `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `AllowMultipleAllocations:` + valueToStringGenerated(this.AllowMultipleAllocations) + `,`, + `NodeAllocatableResourceMappings:` + mapStringForNodeAllocatableResourceMappings + `,`, `}`, }, "") return s @@ -3645,6 +3813,10 @@ func (this *DeviceAttribute) String() string { `BoolValue:` + valueToStringGenerated(this.BoolValue) + `,`, `StringValue:` + valueToStringGenerated(this.StringValue) + `,`, `VersionValue:` + valueToStringGenerated(this.VersionValue) + `,`, + `IntValues:` + fmt.Sprintf("%v", this.IntValues) + `,`, + `BoolValues:` + fmt.Sprintf("%v", this.BoolValues) + `,`, + `StringValues:` + fmt.Sprintf("%v", this.StringValues) + `,`, + `VersionValues:` + fmt.Sprintf("%v", this.VersionValues) + `,`, `}`, }, "") return s @@ -3939,6 +4111,17 @@ func (this *NetworkDeviceData) String() string { }, "") return s } +func (this *NodeAllocatableResourceMapping) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableResourceMapping{`, + `CapacityKey:` + valueToStringGenerated(this.CapacityKey) + `,`, + `AllocationMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.AllocationMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} func (this *OpaqueDeviceConfiguration) String() string { if this == nil { return "nil" @@ -6027,6 +6210,135 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.AllowMultipleAllocations = &b + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResourceMappings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NodeAllocatableResourceMappings == nil { + m.NodeAllocatableResourceMappings = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping) + } + var mapkey k8s_io_api_core_v1.ResourceName + mapvalue := &NodeAllocatableResourceMapping{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &NodeAllocatableResourceMapping{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -6449,6 +6761,216 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.VersionValue = &s iNdEx = postIndex + case 6: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IntValues = append(m.IntValues, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.IntValues) == 0 { + m.IntValues = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IntValues = append(m.IntValues, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field IntValues", wireType) + } + case 7: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.BoolValues) == 0 { + m.BoolValues = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValues", wireType) + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringValues", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StringValues = append(m.StringValues, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionValues", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VersionValues = append(m.VersionValues, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9518,6 +10040,125 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } return nil } +func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeAllocatableResourceMapping: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeAllocatableResourceMapping: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CapacityKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := QualifiedName(dAtA[iNdEx:postIndex]) + m.CapacityKey = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllocationMultiplier", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AllocationMultiplier == nil { + m.AllocationMultiplier = &resource.Quantity{} + } + if err := m.AllocationMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *OpaqueDeviceConfiguration) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/resource/v1/generated.proto b/vendor/k8s.io/api/resource/v1/generated.proto index c254137c43..8bacfd846f 100644 --- a/vendor/k8s.io/api/resource/v1/generated.proto +++ b/vendor/k8s.io/api/resource/v1/generated.proto @@ -65,8 +65,8 @@ message AllocatedDeviceStatus { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid optional string shareID = 7; // Conditions contains the latest observation of the device's state. @@ -90,7 +90,7 @@ message AllocatedDeviceStatus { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional NetworkDeviceData networkData = 6; } @@ -110,7 +110,7 @@ message AllocationResult { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. // // +optional @@ -169,6 +169,14 @@ message CELDeviceSelector { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. @@ -307,8 +315,8 @@ message CounterSet { // It must be a DNS label. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name optional string name = 1; // Counters defines the set of counters for this CounterSet @@ -317,6 +325,8 @@ message CounterSet { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -335,6 +345,7 @@ message Device { // The maximum number of attributes and capacities combined is 32. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional map attributes = 2; // Capacity defines the set of capacities for this device. @@ -355,13 +366,13 @@ message Device { // device is 2. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=counterSet + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:maxItems=2 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 repeated DeviceCounterConsumption consumesCounters = 4; // NodeName identifies the node where the device is available. @@ -402,12 +413,13 @@ message Device { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceTaint taints = 8; // BindsToNode indicates if the usage of an allocation involving this device @@ -415,7 +427,7 @@ message Device { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional @@ -431,14 +443,14 @@ message Device { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingConditions = 10; // BindingFailureConditions defines the conditions for binding failure. @@ -449,14 +461,14 @@ message Device { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingFailureConditions = 11; // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -467,6 +479,21 @@ message Device { // +optional // +featureGate=DRAConsumableCapacity optional bool allowMultipleAllocations = 12; + + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + // +optional + // +featureGate=DRANodeAllocatableResources + map nodeAllocatableResourceMappings = 13; } // DeviceAllocationConfiguration gets embedded in an AllocationResult. @@ -476,7 +503,7 @@ message DeviceAllocationConfiguration { // or from a claim. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string source = 1; // Requests lists the names of requests where the configuration applies. @@ -488,10 +515,10 @@ message DeviceAllocationConfiguration { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 2; optional DeviceConfiguration deviceConfiguration = 3; @@ -503,8 +530,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceRequestAllocationResult results = 1; // This field is a combination of all the claim and class configuration parameters. @@ -517,8 +544,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=64 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 repeated DeviceAllocationConfiguration config = 2; } @@ -527,31 +554,79 @@ message DeviceAttribute { // IntValue is a number. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional int64 int = 2; // BoolValue is a true/false value. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional bool bool = 3; // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional string string = 4; // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional string version = 5; + + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated int64 ints = 6; + + // BoolValues is a non-empty list of true/false values. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated bool bools = 7; + + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated string strings = 8; + + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated string versions = 9; } // DeviceCapacity describes a quantity associated with a device. @@ -587,11 +662,11 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceRequest requests = 1; // These constraints must be satisfied by the set of devices that get @@ -599,8 +674,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceConstraint constraints = 2; // This field holds configuration for multiple potential drivers which @@ -609,8 +684,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceClaimConfiguration config = 3; } @@ -625,10 +700,10 @@ message DeviceClaimConfiguration { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 1; optional DeviceConfiguration deviceConfiguration = 2; @@ -638,14 +713,11 @@ message DeviceClaimConfiguration { // device configuration and selectors. It can be referenced in // the device requests of a claim to apply these presets. // Cluster scoped. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. message DeviceClass { // Standard object metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines what can be allocated and how to configure it. @@ -681,8 +753,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 1; // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -693,8 +765,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceClassConfiguration config = 2; // ExtendedResourceName is the extended resource name for the devices of this class. @@ -706,11 +778,11 @@ message DeviceClassSpec { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:optional - // +k8s:format=k8s-extended-resource-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name optional string extendedResourceName = 4; } @@ -722,7 +794,7 @@ message DeviceConfiguration { // // +optional // +oneOf=ConfigurationType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional OpaqueDeviceConfiguration opaque = 1; } @@ -740,10 +812,10 @@ message DeviceConstraint { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 1; // MatchAttribute requires that all devices in question have this @@ -757,17 +829,27 @@ message DeviceConstraint { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as single-element lists for backward compatibility. + // // Must include the domain qualifier. // // +optional // +oneOf=ConstraintType - // +k8s:optional - // +k8s:format=k8s-resource-fully-qualified-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name optional string matchAttribute = 2; // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device @@ -789,8 +871,8 @@ message DeviceCounterConsumption { // counters defined will be consumed. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name optional string counterSet = 1; // Counters defines the counters that will be consumed by the device. @@ -798,6 +880,8 @@ message DeviceCounterConsumption { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -827,7 +911,7 @@ message DeviceRequest { // // +optional // +oneOf=deviceRequestType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional ExactDeviceRequest exactly = 2; // FirstAvailable contains subrequests, of which exactly one will be @@ -848,11 +932,11 @@ message DeviceRequest { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 repeated DeviceSubRequest firstAvailable = 3; } @@ -877,8 +961,9 @@ message DeviceRequestAllocationResult { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:format=k8s-long-name-caseless - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 optional string driver = 2; // This name together with the driver name and the device name field @@ -888,8 +973,8 @@ message DeviceRequestAllocationResult { // DNS sub-domains separated by slashes. // // +required - // +k8s:required - // +k8s:format=k8s-resource-pool-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name optional string pool = 3; // Device references one device instance via its name in the driver's @@ -902,8 +987,7 @@ message DeviceRequestAllocationResult { // administrative access. See the corresponding request field // for a definition of mode. // - // This is an alpha field and requires enabling the DRAAdminAccess - // feature gate. Admin access is disabled if this field is unset or + // Admin access is disabled if this field is unset or // set to false, otherwise it is enabled. // // +optional @@ -915,38 +999,39 @@ message DeviceRequestAllocationResult { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 6; // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingConditions = 7; // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingFailureConditions = 8; // ShareID uniquely identifies an individual allocation share of the device, @@ -956,8 +1041,8 @@ message DeviceRequestAllocationResult { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid optional string shareID = 9; // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1014,8 +1099,8 @@ message DeviceSubRequest { // to reference. // // +required - // +k8s:required - // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name optional string deviceClassName = 2; // Selectors define criteria which must be satisfied by a specific @@ -1025,8 +1110,8 @@ message DeviceSubRequest { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -1048,6 +1133,7 @@ message DeviceSubRequest { // requests with unknown modes. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1072,12 +1158,13 @@ message DeviceSubRequest { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1124,12 +1211,21 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string effect = 3; - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time timeAdded = 4; } @@ -1142,8 +1238,8 @@ message DeviceToleration { // Must be a label name. // // +optional - // +k8s:optional - // +k8s:format=k8s-label-key + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key optional string key = 1; // Operator represents a key's relationship to the value. @@ -1153,6 +1249,7 @@ message DeviceToleration { // // +optional // +default="Equal" + // +k8s:alpha(since: "1.36")=+k8s:optional optional string operator = 2; // Value is the taint value the toleration matches to. @@ -1166,6 +1263,7 @@ message DeviceToleration { // When specified, allowed values are NoSchedule and NoExecute. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string effect = 4; // TolerationSeconds represents the period of time the toleration (which must be @@ -1203,8 +1301,8 @@ message ExactDeviceRequest { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 2; // AllocationMode and its related fields define how devices are allocated @@ -1227,7 +1325,7 @@ message ExactDeviceRequest { // requests with unknown modes. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string allocationMode = 3; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1243,8 +1341,7 @@ message ExactDeviceRequest { // all ordinary claims to the device with respect to access modes and // any resource allocations. // - // This is an alpha field and requires enabling the DRAAdminAccess - // feature gate. Admin access is disabled if this field is unset or + // Admin access is disabled if this field is unset or // set to false, otherwise it is enabled. // // +optional @@ -1266,12 +1363,13 @@ message ExactDeviceRequest { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1300,11 +1398,11 @@ message NetworkDeviceData { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 optional string interfaceName = 1; // IPs lists the network addresses assigned to the device's network interface. @@ -1315,22 +1413,60 @@ message NetworkDeviceData { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 repeated string ips = 2; // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=128 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 optional string hardwareAddress = 3; } +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +message NodeAllocatableResourceMapping { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + // +optional + optional string capacityKey = 1; + + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity allocationMultiplier = 2; +} + // OpaqueDeviceConfiguration contains configuration parameters for a driver // in a format defined by the driver vendor. message OpaqueDeviceConfiguration { @@ -1344,8 +1480,9 @@ message OpaqueDeviceConfiguration { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:required - // +k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 optional string driver = 1; // Parameters can contain arbitrary data. It is the responsibility of @@ -1364,9 +1501,6 @@ message OpaqueDeviceConfiguration { // with specific properties, this is how that request is expressed. The status // stanza tracks whether this claim has been satisfied and what specific // resources have been allocated. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. message ResourceClaim { // Standard object metadata // +optional @@ -1374,7 +1508,7 @@ message ResourceClaim { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:immutable optional ResourceClaimSpec spec = 2; // Status describes whether the claim is ready to use and what has been allocated. @@ -1429,8 +1563,8 @@ message ResourceClaimStatus { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:optional - // +k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify optional AllocationResult allocation = 1; // ReservedFor indicates which entities are currently allowed to use @@ -1458,10 +1592,10 @@ message ResourceClaimStatus { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=uid - // +k8s:maxItems=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid + // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 repeated ResourceClaimConsumerReference reservedFor = 2; // Devices contains the status of each device allocated for this @@ -1469,25 +1603,22 @@ message ResourceClaimStatus { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:listType=map - // +k8s:listMapKey=driver - // +k8s:listMapKey=device - // +k8s:listMapKey=pool - // +k8s:listMapKey=shareID + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID repeated AllocatedDeviceStatus devices = 4; } // ResourceClaimTemplate is used to produce ResourceClaim objects. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. message ResourceClaimTemplate { // Standard object metadata // +optional @@ -1583,9 +1714,6 @@ message ResourcePool { // // For resources that are not local to a node, the node name is not set. Instead, // the driver may use a node selector to specify where the devices are available. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. message ResourceSlice { // Standard object metadata // +optional @@ -1594,6 +1722,7 @@ message ResourceSlice { // Contains the information published by the driver. // // Changing the spec automatically increments the metadata.generation number. + // +required optional ResourceSliceSpec spec = 2; } @@ -1668,7 +1797,7 @@ message ResourceSliceSpec { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +zeroOrOneOf=ResourceSliceType repeated Device devices = 6; @@ -1694,14 +1823,14 @@ message ResourceSliceSpec { // The maximum number of counter sets is 8. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 repeated CounterSet sharedCounters = 8; } diff --git a/vendor/k8s.io/api/resource/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/resource/v1/generated.protomessage.pb.go deleted file mode 100644 index 97035a9360..0000000000 --- a/vendor/k8s.io/api/resource/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*AllocatedDeviceStatus) ProtoMessage() {} - -func (*AllocationResult) ProtoMessage() {} - -func (*CELDeviceSelector) ProtoMessage() {} - -func (*CapacityRequestPolicy) ProtoMessage() {} - -func (*CapacityRequestPolicyRange) ProtoMessage() {} - -func (*CapacityRequirements) ProtoMessage() {} - -func (*Counter) ProtoMessage() {} - -func (*CounterSet) ProtoMessage() {} - -func (*Device) ProtoMessage() {} - -func (*DeviceAllocationConfiguration) ProtoMessage() {} - -func (*DeviceAllocationResult) ProtoMessage() {} - -func (*DeviceAttribute) ProtoMessage() {} - -func (*DeviceCapacity) ProtoMessage() {} - -func (*DeviceClaim) ProtoMessage() {} - -func (*DeviceClaimConfiguration) ProtoMessage() {} - -func (*DeviceClass) ProtoMessage() {} - -func (*DeviceClassConfiguration) ProtoMessage() {} - -func (*DeviceClassList) ProtoMessage() {} - -func (*DeviceClassSpec) ProtoMessage() {} - -func (*DeviceConfiguration) ProtoMessage() {} - -func (*DeviceConstraint) ProtoMessage() {} - -func (*DeviceCounterConsumption) ProtoMessage() {} - -func (*DeviceRequest) ProtoMessage() {} - -func (*DeviceRequestAllocationResult) ProtoMessage() {} - -func (*DeviceSelector) ProtoMessage() {} - -func (*DeviceSubRequest) ProtoMessage() {} - -func (*DeviceTaint) ProtoMessage() {} - -func (*DeviceToleration) ProtoMessage() {} - -func (*ExactDeviceRequest) ProtoMessage() {} - -func (*NetworkDeviceData) ProtoMessage() {} - -func (*OpaqueDeviceConfiguration) ProtoMessage() {} - -func (*ResourceClaim) ProtoMessage() {} - -func (*ResourceClaimConsumerReference) ProtoMessage() {} - -func (*ResourceClaimList) ProtoMessage() {} - -func (*ResourceClaimSpec) ProtoMessage() {} - -func (*ResourceClaimStatus) ProtoMessage() {} - -func (*ResourceClaimTemplate) ProtoMessage() {} - -func (*ResourceClaimTemplateList) ProtoMessage() {} - -func (*ResourceClaimTemplateSpec) ProtoMessage() {} - -func (*ResourcePool) ProtoMessage() {} - -func (*ResourceSlice) ProtoMessage() {} - -func (*ResourceSliceList) ProtoMessage() {} - -func (*ResourceSliceSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/resource/v1/types.go b/vendor/k8s.io/api/resource/v1/types.go index 29b4a5fbac..27d5eff29c 100644 --- a/vendor/k8s.io/api/resource/v1/types.go +++ b/vendor/k8s.io/api/resource/v1/types.go @@ -35,6 +35,11 @@ const ( // special ResourceClaim. Its single valid value is "true". // This is used only inside the scheduler. ExtendedResourceClaimAnnotation = "resource.kubernetes.io/extended-resource-claim" + // PodResourceClaimAnnotation is the annotation set on template-generated + // ResourceClaims by the ResourceClaim controller. Its value is the + // spec.resourceClaims[].name of the Pod or PodGroup for which the claim was + // generated. The Pod and its PodGroup are guaranteed to use the same name. + PodResourceClaimAnnotation = "resource.kubernetes.io/pod-claim-name" // Resource device class prefix is for generating implicit extended resource // name for a device class when its ExtendedResourceName field is not // specified. The generated name is this prefix + the device class name. @@ -42,6 +47,23 @@ const ( // in pod.Spec.Resources.Requests, in that case, a valid name has to be specified // explicitly in device class. ResourceDeviceClassPrefix string = "deviceclass.resource.kubernetes.io/" + + // The constants below are all related to synthetic authorization checks for resourceclaims.status writes. + + // SubresourceBinding is the synthetic subresource used for authorization + // of updates to status.allocation and status.reservedFor. + SubresourceBinding = "binding" + // SubresourceDriver is the synthetic subresource used for per-driver + // authorization of updates to status.devices. + SubresourceDriver = "driver" + // VerbPrefixAssociatedNode is the verb prefix for requests from a service account + // on the same node as the claim's allocation. The full verb is + // "associated-node:", e.g. "associated-node:update". + VerbPrefixAssociatedNode = "associated-node:" + // VerbPrefixArbitraryNode is the verb prefix for requests not associated + // with a specific node (controllers, etc.). The full verb is + // "arbitrary-node:", e.g. "arbitrary-node:update". + VerbPrefixArbitraryNode = "arbitrary-node:" ) // +genclient @@ -70,9 +92,6 @@ const ( // // For resources that are not local to a node, the node name is not set. Instead, // the driver may use a node selector to specify where the devices are available. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type ResourceSlice struct { metav1.TypeMeta `json:",inline"` // Standard object metadata @@ -82,6 +101,7 @@ type ResourceSlice struct { // Contains the information published by the driver. // // Changing the spec automatically increments the metadata.generation number. + // +required Spec ResourceSliceSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -155,7 +175,7 @@ type ResourceSliceSpec struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +zeroOrOneOf=ResourceSliceType Devices []Device `json:"devices,omitempty" protobuf:"bytes,6,name=devices"` @@ -181,14 +201,14 @@ type ResourceSliceSpec struct { // The maximum number of counter sets is 8. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 SharedCounters []CounterSet `json:"sharedCounters,omitempty" protobuf:"bytes,8,name=sharedCounters"` } @@ -205,8 +225,8 @@ type CounterSet struct { // It must be a DNS label. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name Name string `json:"name" protobuf:"bytes,1,name=name"` // Counters defines the set of counters for this CounterSet @@ -215,6 +235,8 @@ type CounterSet struct { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,name=counters"` } @@ -261,7 +283,14 @@ type ResourcePool struct { const ResourceSliceMaxSharedCapacity = 128 const ResourceSliceMaxDevices = 128 -const ResourceSliceMaxDevicesWithTaintsOrConsumesCounters = 64 + +// ResourceSliceMaxDevicesWithAdvancedFeatures defines the maximum number of devices in a ResourceSlice +// if any of those devices uses advanced features: +// - device taints (DRADeviceTaints feature gate) +// - consuming counters (DRAPartitionableDevices feature gate) +// - list attributes (DRAListTypeAttributes feature gate) +const ResourceSliceMaxDevicesWithAdvancedFeatures = 64 + const PoolNameMaxLength = validation.DNS1123SubdomainMaxLength // Same as for a single node name. const BindingConditionsMaxSize = 4 const BindingFailureConditionsMaxSize = 4 @@ -298,6 +327,7 @@ type Device struct { // The maximum number of attributes and capacities combined is 32. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Attributes map[QualifiedName]DeviceAttribute `json:"attributes,omitempty" protobuf:"bytes,2,rep,name=attributes"` // Capacity defines the set of capacities for this device. @@ -318,13 +348,13 @@ type Device struct { // device is 2. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=counterSet + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:maxItems=2 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 ConsumesCounters []DeviceCounterConsumption `json:"consumesCounters,omitempty" protobuf:"bytes,4,rep,name=consumesCounters"` // NodeName identifies the node where the device is available. @@ -365,12 +395,13 @@ type Device struct { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Taints []DeviceTaint `json:"taints,omitempty" protobuf:"bytes,8,rep,name=taints"` // BindsToNode indicates if the usage of an allocation involving this device @@ -378,7 +409,7 @@ type Device struct { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional @@ -394,14 +425,14 @@ type Device struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,10,rep,name=bindingConditions"` // BindingFailureConditions defines the conditions for binding failure. @@ -412,14 +443,14 @@ type Device struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,11,rep,name=bindingFailureConditions"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -430,6 +461,59 @@ type Device struct { // +optional // +featureGate=DRAConsumableCapacity AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty" protobuf:"bytes,12,opt,name=allowMultipleAllocations"` + + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + // +optional + // +featureGate=DRANodeAllocatableResources + NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,13,opt,name=nodeAllocatableResourceMappings"` +} + +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +type NodeAllocatableResourceMapping struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + // +optional + CapacityKey *QualifiedName `json:"capacityKey,omitempty" protobuf:"bytes,1,opt,name=capacityKey"` + + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty" protobuf:"bytes,2,opt,name=allocationMultiplier"` } // DeviceCounterConsumption defines a set of counters that @@ -439,8 +523,8 @@ type DeviceCounterConsumption struct { // counters defined will be consumed. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name CounterSet string `json:"counterSet" protobuf:"bytes,1,opt,name=counterSet"` // Counters defines the counters that will be consumed by the device. @@ -448,6 +532,8 @@ type DeviceCounterConsumption struct { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,opt,name=counters"` } @@ -568,6 +654,10 @@ type CapacityRequestPolicyRange struct { // Limit for the sum of the number of entries in both attributes and capacity. const ResourceSliceMaxAttributesAndCapacitiesPerDevice = 32 +// Limit per device for the total number of string, version, bool or int values +// in list and non-list attributes. +const ResourceSliceMaxAttributeValuesPerDevice = 48 + // QualifiedName is the name of a device attribute or capacity. // // Attributes and capacities are defined either by the owner of the specific @@ -607,31 +697,79 @@ type DeviceAttribute struct { // IntValue is a number. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember IntValue *int64 `json:"int,omitempty" protobuf:"varint,2,opt,name=int"` // BoolValue is a true/false value. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember BoolValue *bool `json:"bool,omitempty" protobuf:"varint,3,opt,name=bool"` // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember StringValue *string `json:"string,omitempty" protobuf:"bytes,4,opt,name=string"` // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember VersionValue *string `json:"version,omitempty" protobuf:"bytes,5,opt,name=version"` + + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + IntValues []int64 `json:"ints,omitempty" protobuf:"varint,6,opt,name=ints"` + + // BoolValues is a non-empty list of true/false values. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + BoolValues []bool `json:"bools,omitempty" protobuf:"varint,7,opt,name=bools"` + + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + StringValues []string `json:"strings,omitempty" protobuf:"bytes,8,opt,name=strings"` + + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + VersionValues []string `json:"versions,omitempty" protobuf:"bytes,9,opt,name=versions"` } // DeviceAttributeMaxValueLength is the maximum length of a string or version attribute value. @@ -666,7 +804,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -682,9 +820,18 @@ type DeviceTaint struct { // which will enable adding new enums within a single release without // ratcheting. - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional TimeAdded *metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"` @@ -696,7 +843,7 @@ type DeviceTaint struct { } // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceTaintEffect string const ( @@ -729,16 +876,13 @@ type ResourceSliceList struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.34 -// +k8s:supportsSubresource=/status +// +k8s:supportsSubresource="/status" // ResourceClaim describes a request for access to resources in the cluster, // for use by workloads. For example, if a workload needs an accelerator device // with specific properties, this is how that request is expressed. The status // stanza tracks whether this claim has been satisfied and what specific // resources have been allocated. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type ResourceClaim struct { metav1.TypeMeta `json:",inline"` // Standard object metadata @@ -747,7 +891,7 @@ type ResourceClaim struct { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:immutable Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` // Status describes whether the claim is ready to use and what has been allocated. @@ -775,11 +919,11 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []DeviceRequest `json:"requests" protobuf:"bytes,1,name=requests"` // These constraints must be satisfied by the set of devices that get @@ -787,8 +931,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Constraints []DeviceConstraint `json:"constraints,omitempty" protobuf:"bytes,2,opt,name=constraints"` // This field holds configuration for multiple potential drivers which @@ -797,8 +941,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Config []DeviceClaimConfiguration `json:"config,omitempty" protobuf:"bytes,3,opt,name=config"` // Potential future extension, ignored by older schedulers. This is @@ -849,7 +993,7 @@ type DeviceRequest struct { // // +optional // +oneOf=deviceRequestType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional Exactly *ExactDeviceRequest `json:"exactly,omitempty" protobuf:"bytes,2,name=exactly"` // FirstAvailable contains subrequests, of which exactly one will be @@ -870,11 +1014,11 @@ type DeviceRequest struct { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 FirstAvailable []DeviceSubRequest `json:"firstAvailable,omitempty" protobuf:"bytes,3,name=firstAvailable"` } @@ -902,8 +1046,8 @@ type ExactDeviceRequest struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,2,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -926,7 +1070,7 @@ type ExactDeviceRequest struct { // requests with unknown modes. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,3,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -942,8 +1086,7 @@ type ExactDeviceRequest struct { // all ordinary claims to the device with respect to access modes and // any resource allocations. // - // This is an alpha field and requires enabling the DRAAdminAccess - // feature gate. Admin access is disabled if this field is unset or + // Admin access is disabled if this field is unset or // set to false, otherwise it is enabled. // // +optional @@ -965,12 +1108,13 @@ type ExactDeviceRequest struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1022,8 +1166,8 @@ type DeviceSubRequest struct { // to reference. // // +required - // +k8s:required - // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name DeviceClassName string `json:"deviceClassName" protobuf:"bytes,2,name=deviceClassName"` // Selectors define criteria which must be satisfied by a specific @@ -1033,8 +1177,8 @@ type DeviceSubRequest struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1056,6 +1200,7 @@ type DeviceSubRequest struct { // requests with unknown modes. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1080,12 +1225,13 @@ type DeviceSubRequest struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1142,7 +1288,7 @@ const ( ) // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceAllocationMode string // Valid [DeviceRequest.CountMode] values. @@ -1211,6 +1357,14 @@ type CELDeviceSelector struct { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. @@ -1261,10 +1415,10 @@ type DeviceConstraint struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` // MatchAttribute requires that all devices in question have this @@ -1278,12 +1432,17 @@ type DeviceConstraint struct { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as single-element lists for backward compatibility. + // // Must include the domain qualifier. // // +optional // +oneOf=ConstraintType - // +k8s:optional - // +k8s:format=k8s-resource-fully-qualified-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name MatchAttribute *FullyQualifiedName `json:"matchAttribute,omitempty" protobuf:"bytes,2,opt,name=matchAttribute"` // Potential future extension, not part of the current design: @@ -1299,6 +1458,11 @@ type DeviceConstraint struct { // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device @@ -1324,10 +1488,10 @@ type DeviceClaimConfiguration struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` DeviceConfiguration `json:",inline" protobuf:"bytes,2,name=deviceConfiguration"` @@ -1341,7 +1505,7 @@ type DeviceConfiguration struct { // // +optional // +oneOf=ConfigurationType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional Opaque *OpaqueDeviceConfiguration `json:"opaque,omitempty" protobuf:"bytes,1,opt,name=opaque"` } @@ -1358,8 +1522,9 @@ type OpaqueDeviceConfiguration struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:required - // +k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 Driver string `json:"driver" protobuf:"bytes,1,name=driver"` // Parameters can contain arbitrary data. It is the responsibility of @@ -1385,8 +1550,8 @@ type DeviceToleration struct { // Must be a label name. // // +optional - // +k8s:optional - // +k8s:format=k8s-label-key + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` // Operator represents a key's relationship to the value. @@ -1396,6 +1561,7 @@ type DeviceToleration struct { // // +optional // +default="Equal" + // +k8s:alpha(since: "1.36")=+k8s:optional Operator DeviceTolerationOperator `json:"operator,omitempty" protobuf:"bytes,2,opt,name=operator,casttype=DeviceTolerationOperator"` // Value is the taint value the toleration matches to. @@ -1409,6 +1575,7 @@ type DeviceToleration struct { // When specified, allowed values are NoSchedule and NoExecute. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Effect DeviceTaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=DeviceTaintEffect"` // TolerationSeconds represents the period of time the toleration (which must be @@ -1425,7 +1592,7 @@ type DeviceToleration struct { // A toleration operator is the set of operators that can be used in a toleration. // // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceTolerationOperator string const ( @@ -1439,8 +1606,8 @@ type ResourceClaimStatus struct { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:optional - // +k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,1,opt,name=allocation"` // ReservedFor indicates which entities are currently allowed to use @@ -1468,10 +1635,10 @@ type ResourceClaimStatus struct { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=uid - // +k8s:maxItems=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid + // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 ReservedFor []ResourceClaimConsumerReference `json:"reservedFor,omitempty" protobuf:"bytes,2,opt,name=reservedFor" patchStrategy:"merge" patchMergeKey:"uid"` // DeallocationRequested is tombstoned since Kubernetes 1.32 where @@ -1484,18 +1651,18 @@ type ResourceClaimStatus struct { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:listType=map - // +k8s:listMapKey=driver - // +k8s:listMapKey=device - // +k8s:listMapKey=pool - // +k8s:listMapKey=shareID + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"` } @@ -1544,7 +1711,7 @@ type AllocationResult struct { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. // // +optional @@ -1558,8 +1725,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Results []DeviceRequestAllocationResult `json:"results,omitempty" protobuf:"bytes,1,opt,name=results"` // This field is a combination of all the claim and class configuration parameters. @@ -1572,8 +1739,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=64 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 Config []DeviceAllocationConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` } @@ -1602,8 +1769,9 @@ type DeviceRequestAllocationResult struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:format=k8s-long-name-caseless - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 Driver string `json:"driver" protobuf:"bytes,2,name=driver"` // This name together with the driver name and the device name field @@ -1613,8 +1781,8 @@ type DeviceRequestAllocationResult struct { // DNS sub-domains separated by slashes. // // +required - // +k8s:required - // +k8s:format=k8s-resource-pool-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name Pool string `json:"pool" protobuf:"bytes,3,name=pool"` // Device references one device instance via its name in the driver's @@ -1627,8 +1795,7 @@ type DeviceRequestAllocationResult struct { // administrative access. See the corresponding request field // for a definition of mode. // - // This is an alpha field and requires enabling the DRAAdminAccess - // feature gate. Admin access is disabled if this field is unset or + // Admin access is disabled if this field is unset or // set to false, otherwise it is enabled. // // +optional @@ -1640,38 +1807,39 @@ type DeviceRequestAllocationResult struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,7,rep,name=bindingConditions"` // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,8,rep,name=bindingFailureConditions"` // ShareID uniquely identifies an individual allocation share of the device, @@ -1681,8 +1849,8 @@ type DeviceRequestAllocationResult struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid ShareID *types.UID `json:"shareID,omitempty" protobuf:"bytes,9,opt,name=shareID"` // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1706,7 +1874,7 @@ type DeviceAllocationConfiguration struct { // or from a claim. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Source AllocationConfigSource `json:"source" protobuf:"bytes,1,name=source"` // Requests lists the names of requests where the configuration applies. @@ -1718,17 +1886,17 @@ type DeviceAllocationConfiguration struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,2,opt,name=requests"` DeviceConfiguration `json:",inline" protobuf:"bytes,3,name=deviceConfiguration"` } // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type AllocationConfigSource string // Valid [DeviceAllocationConfiguration.Source] values. @@ -1760,15 +1928,12 @@ type ResourceClaimList struct { // device configuration and selectors. It can be referenced in // the device requests of a claim to apply these presets. // Cluster scoped. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type DeviceClass struct { metav1.TypeMeta `json:",inline"` // Standard object metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines what can be allocated and how to configure it. @@ -1789,8 +1954,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,1,opt,name=selectors"` // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -1801,8 +1966,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Config []DeviceClassConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` // SuitableNodes is tombstoned since Kubernetes 1.32 where @@ -1819,11 +1984,11 @@ type DeviceClassSpec struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:optional - // +k8s:format=k8s-extended-resource-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name ExtendedResourceName *string `json:"extendedResourceName,omitempty" protobuf:"bytes,4,opt,name=extendedResourceName"` } @@ -1851,9 +2016,6 @@ type DeviceClassList struct { // +k8s:prerelease-lifecycle-gen:introduced=1.34 // ResourceClaimTemplate is used to produce ResourceClaim objects. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type ResourceClaimTemplate struct { metav1.TypeMeta `json:",inline"` // Standard object metadata @@ -1949,8 +2111,8 @@ type AllocatedDeviceStatus struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid ShareID *string `json:"shareID,omitempty" protobuf:"bytes,7,opt,name=shareID"` // Conditions contains the latest observation of the device's state. @@ -1974,7 +2136,7 @@ type AllocatedDeviceStatus struct { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"` } @@ -1986,11 +2148,11 @@ type NetworkDeviceData struct { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"` // IPs lists the network addresses assigned to the device's network interface. @@ -2001,18 +2163,18 @@ type NetworkDeviceData struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=128 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"` } diff --git a/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go index 6ba5f598c6..51915d3e20 100644 --- a/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1/types_swagger_doc_generated.go @@ -46,7 +46,7 @@ var map_AllocationResult = map[string]string{ "": "AllocationResult contains attributes of an allocated resource.", "devices": "Devices is the result of allocating devices.", "nodeSelector": "NodeSelector defines where the allocated resources are available. If unset, they are available everywhere.", - "allocationTimestamp": "AllocationTimestamp stores the time when the resources were allocated. This field is not guaranteed to be set, in which case that time is unknown.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gate.", + "allocationTimestamp": "AllocationTimestamp stores the time when the resources were allocated. This field is not guaranteed to be set, in which case that time is unknown.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gate.", } func (AllocationResult) SwaggerDoc() map[string]string { @@ -55,7 +55,7 @@ func (AllocationResult) SwaggerDoc() map[string]string { var map_CELDeviceSelector = map[string]string{ "": "CELDeviceSelector contains a CEL expression for selecting a device.", - "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", + "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", } func (CELDeviceSelector) SwaggerDoc() map[string]string { @@ -113,19 +113,20 @@ func (CounterSet) SwaggerDoc() map[string]string { } var map_Device = map[string]string{ - "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", - "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", - "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", - "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", - "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", + "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", + "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", + "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "nodeAllocatableResourceMappings": "NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", } func (Device) SwaggerDoc() map[string]string { @@ -153,11 +154,15 @@ func (DeviceAllocationResult) SwaggerDoc() map[string]string { } var map_DeviceAttribute = map[string]string{ - "": "DeviceAttribute must have exactly one field set.", - "int": "IntValue is a number.", - "bool": "BoolValue is a true/false value.", - "string": "StringValue is a string. Must not be longer than 64 characters.", - "version": "VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.", + "": "DeviceAttribute must have exactly one field set.", + "int": "IntValue is a number.", + "bool": "BoolValue is a true/false value.", + "string": "StringValue is a string. Must not be longer than 64 characters.", + "version": "VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.", + "ints": "IntValues is a non-empty list of numbers.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", + "bools": "BoolValues is a non-empty list of true/false values.", + "strings": "StringValues is a non-empty list of strings. Each string must not be longer than 64 characters.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", + "versions": "VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. Each version string must not be longer than 64 characters.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", } func (DeviceAttribute) SwaggerDoc() map[string]string { @@ -195,7 +200,7 @@ func (DeviceClaimConfiguration) SwaggerDoc() map[string]string { } var map_DeviceClass = map[string]string{ - "": "DeviceClass is a vendor- or admin-provided resource that contains device configuration and selectors. It can be referenced in the device requests of a claim to apply these presets. Cluster scoped.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.", + "": "DeviceClass is a vendor- or admin-provided resource that contains device configuration and selectors. It can be referenced in the device requests of a claim to apply these presets. Cluster scoped.", "metadata": "Standard object metadata", "spec": "Spec defines what can be allocated and how to configure it.\n\nThis is mutable. Consumers have to be prepared for classes changing at any time, either because they get updated or replaced. Claim allocations are done once based on whatever was set in classes at the time of allocation.\n\nChanging the spec automatically increments the metadata.generation number.", } @@ -226,7 +231,7 @@ var map_DeviceClassSpec = map[string]string{ "": "DeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it.", "selectors": "Each selector must be satisfied by a device which is claimed via this class.", "config": "Config defines configuration parameters that apply to each device that is claimed via this class. Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver.\n\nThey are passed to the driver, but are not considered while allocating the claim.", - "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is an alpha field.", + "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is a beta field.", } func (DeviceClassSpec) SwaggerDoc() map[string]string { @@ -245,8 +250,8 @@ func (DeviceConfiguration) SwaggerDoc() map[string]string { var map_DeviceConstraint = map[string]string{ "": "DeviceConstraint must have exactly one field set besides Requests.", "requests": "Requests is a list of the one or more requests in this claim which must co-satisfy this constraint. If a request is fulfilled by multiple devices, then all of the devices must satisfy the constraint. If this is not specified, this constraint applies to all requests in this claim.\n\nReferences to subrequests must include the name of the main request and may include the subrequest using the format

[/]. If just the main request is given, the constraint applies to all subrequests.", - "matchAttribute": "MatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices.\n\nFor example, if you specified \"dra.example.com/numa\" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen.\n\nMust include the domain qualifier.", - "distinctAttribute": "DistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices.\n\nThis acts as the inverse of MatchAttribute.\n\nThis constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation.\n\nThis is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.", + "matchAttribute": "MatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices.\n\nFor example, if you specified \"dra.example.com/numa\" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen.\n\nWhen the DRAListTypeAttributes feature gate is enabled, comparison uses set semantics(i.e., element order and duplicates are ignored): list-valued attributes match when the intersection across all devices is non-empty. Scalar values are treated as single-element lists for backward compatibility.\n\nMust include the domain qualifier.", + "distinctAttribute": "DistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices.\n\nWhen the DRAListTypeAttributes feature gate is enabled, comparison uses set semantics (i.e., element order and duplicates are ignored): list-valued attributes must be pairwise disjoint across devices. Scalar values are treated as singleton sets for backward compatibility.\n\nThis acts as the inverse of MatchAttribute.\n\nThis constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation.\n\nThis is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.", } func (DeviceConstraint) SwaggerDoc() map[string]string { @@ -280,10 +285,10 @@ var map_DeviceRequestAllocationResult = map[string]string{ "driver": "Driver specifies the name of the DRA driver whose kubelet plugin should be invoked to process the allocation once the claim is needed on a node.\n\nMust be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver. It should use only lower case characters.", "pool": "This name together with the driver name and the device name field identify which device was allocated (`//`).\n\nMust not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.", "device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.", - "adminAccess": "AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", - "bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "adminAccess": "AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode.\n\nAdmin access is disabled if this field is unset or set to false, otherwise it is enabled.", + "tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", "shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.", "consumedCapacity": "ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. The consumed amount may differ from the requested amount: it is rounded up to the nearest valid value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount).\n\nThe total consumed capacity for each device must not exceed the DeviceCapacity's Value.\n\nThis field is populated only for devices that allow multiple allocations. All capacity entries are included, even if the consumed amount is zero.", } @@ -308,7 +313,7 @@ var map_DeviceSubRequest = map[string]string{ "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", } @@ -321,7 +326,7 @@ var map_DeviceTaint = map[string]string{ "key": "The taint key to be applied to a device. Must be a label name.", "value": "The taint value corresponding to the taint key. Must be a label value.", "effect": "The effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them.\n\nValid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here. More effects may get added in the future. Consumers must treat unknown effects like None.", - "timeAdded": "TimeAdded represents the time at which the taint was added. Added automatically during create or update if not set.", + "timeAdded": "TimeAdded represents the time at which the taint was added or (only in a DeviceTaintRule) the effect was modified. Added automatically during create or update if not set.\n\nIn addition, in a DeviceTaintRule a value provided during an update gets replaced with the current time if the provided value is the same as the old one and the new effect is different. Changing the key and/or value while keeping the effect unchanged is possible and does not update the time stamp because the eviction which uses it is either already started (NoExecute) or not started yet (NoEffect, NoSchedule).", } func (DeviceTaint) SwaggerDoc() map[string]string { @@ -347,8 +352,8 @@ var map_ExactDeviceRequest = map[string]string{ "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this request. All selectors must be satisfied for a device to be considered.", "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", + "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nAdmin access is disabled if this field is unset or set to false, otherwise it is enabled.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", } @@ -358,15 +363,25 @@ func (ExactDeviceRequest) SwaggerDoc() map[string]string { var map_NetworkDeviceData = map[string]string{ "": "NetworkDeviceData provides network-related details for the allocated device. This information may be filled by drivers or other components to configure or identify the device within a network context.", - "interfaceName": "InterfaceName specifies the name of the network interface associated with the allocated device. This might be the name of a physical or virtual network interface being configured in the pod.\n\nMust not be longer than 256 characters.", + "interfaceName": "InterfaceName specifies the name of the network interface associated with the allocated device. This might be the name of a physical or virtual network interface being configured in the pod.\n\nMust not be longer than 256 bytes.", "ips": "IPs lists the network addresses assigned to the device's network interface. This can include both IPv4 and IPv6 addresses. The IPs are in the CIDR notation, which includes both the address and the associated subnet mask. e.g.: \"192.0.2.5/24\" for IPv4 and \"2001:db8::5/64\" for IPv6.", - "hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 characters.", + "hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 bytes.", } func (NetworkDeviceData) SwaggerDoc() map[string]string { return map_NetworkDeviceData } +var map_NodeAllocatableResourceMapping = map[string]string{ + "": "NodeAllocatableResourceMapping defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource.", + "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. If `allocationMultiplier` is also set, it is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\", and `allocationMultiplier` should be omitted or set to \"1\".", + "allocationMultiplier": "AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.\n\t a. A DRA driver representing each CPU core as a device would have\n {ResourceName: \"cpu\", allocationMultiplier: \"2\"} in its\n `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,\n\t\t 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.\n b. A GPU device that needs additional node memory per GPU allocation would\n have {ResourceName: \"memory\", allocationMultiplier: \"2Gi\"}. Each allocated\n\t\t GPU device instance of this type will account for 2Gi of memory.\n\n2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.\n\t The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.\n For example, if a Device's capacity \"dra.example.com/cores\" is consumed,\n and each \"core\" provides 2 \"cpu\"s, the mapping would be:\n {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", allocationMultiplier: \"2\"}.\n If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", +} + +func (NodeAllocatableResourceMapping) SwaggerDoc() map[string]string { + return map_NodeAllocatableResourceMapping +} + var map_OpaqueDeviceConfiguration = map[string]string{ "": "OpaqueDeviceConfiguration contains configuration parameters for a driver in a format defined by the driver vendor.", "driver": "Driver is used to determine which kubelet plugin needs to be passed these configuration parameters.\n\nAn admission policy provided by the driver developer could use this to decide whether it needs to validate them.\n\nMust be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver. It should use only lower case characters.", @@ -378,7 +393,7 @@ func (OpaqueDeviceConfiguration) SwaggerDoc() map[string]string { } var map_ResourceClaim = map[string]string{ - "": "ResourceClaim describes a request for access to resources in the cluster, for use by workloads. For example, if a workload needs an accelerator device with specific properties, this is how that request is expressed. The status stanza tracks whether this claim has been satisfied and what specific resources have been allocated.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.", + "": "ResourceClaim describes a request for access to resources in the cluster, for use by workloads. For example, if a workload needs an accelerator device with specific properties, this is how that request is expressed. The status stanza tracks whether this claim has been satisfied and what specific resources have been allocated.", "metadata": "Standard object metadata", "spec": "Spec describes what is being requested and how to configure it. The spec is immutable.", "status": "Status describes whether the claim is ready to use and what has been allocated.", @@ -431,7 +446,7 @@ func (ResourceClaimStatus) SwaggerDoc() map[string]string { } var map_ResourceClaimTemplate = map[string]string{ - "": "ResourceClaimTemplate is used to produce ResourceClaim objects.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.", + "": "ResourceClaimTemplate is used to produce ResourceClaim objects.", "metadata": "Standard object metadata", "spec": "Describes the ResourceClaim that is to be generated.\n\nThis field is immutable. A ResourceClaim will get created by the control plane for a Pod when needed and then not get updated anymore.", } @@ -472,7 +487,7 @@ func (ResourcePool) SwaggerDoc() map[string]string { } var map_ResourceSlice = map[string]string{ - "": "ResourceSlice represents one or more resources in a pool of similar resources, managed by a common driver. A pool may span more than one ResourceSlice, and exactly how many ResourceSlices comprise a pool is determined by the driver.\n\nAt the moment, the only supported resources are devices with attributes and capacities. Each device in a given pool, regardless of how many ResourceSlices, must have a unique name. The ResourceSlice in which a device gets published may change over time. The unique identifier for a device is the tuple , , .\n\nWhenever a driver needs to update a pool, it increments the pool.Spec.Pool.Generation number and updates all ResourceSlices with that new number and new resource definitions. A consumer must only use ResourceSlices with the highest generation number and ignore all others.\n\nWhen allocating all resources in a pool matching certain criteria or when looking for the best solution among several different alternatives, a consumer should check the number of ResourceSlices in a pool (included in each ResourceSlice) to determine whether its view of a pool is complete and if not, should wait until the driver has completed updating the pool.\n\nFor resources that are not local to a node, the node name is not set. Instead, the driver may use a node selector to specify where the devices are available.\n\nThis is an alpha type and requires enabling the DynamicResourceAllocation feature gate.", + "": "ResourceSlice represents one or more resources in a pool of similar resources, managed by a common driver. A pool may span more than one ResourceSlice, and exactly how many ResourceSlices comprise a pool is determined by the driver.\n\nAt the moment, the only supported resources are devices with attributes and capacities. Each device in a given pool, regardless of how many ResourceSlices, must have a unique name. The ResourceSlice in which a device gets published may change over time. The unique identifier for a device is the tuple , , .\n\nWhenever a driver needs to update a pool, it increments the pool.Spec.Pool.Generation number and updates all ResourceSlices with that new number and new resource definitions. A consumer must only use ResourceSlices with the highest generation number and ignore all others.\n\nWhen allocating all resources in a pool matching certain criteria or when looking for the best solution among several different alternatives, a consumer should check the number of ResourceSlices in a pool (included in each ResourceSlice) to determine whether its view of a pool is complete and if not, should wait until the driver has completed updating the pool.\n\nFor resources that are not local to a node, the node name is not set. Instead, the driver may use a node selector to specify where the devices are available.", "metadata": "Standard object metadata", "spec": "Contains the information published by the driver.\n\nChanging the spec automatically increments the metadata.generation number.", } diff --git a/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go index 580ba64875..0c488a05ae 100644 --- a/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1/zz_generated.deepcopy.go @@ -302,6 +302,13 @@ func (in *Device) DeepCopyInto(out *Device) { *out = new(bool) **out = **in } + if in.NodeAllocatableResourceMappings != nil { + in, out := &in.NodeAllocatableResourceMappings, &out.NodeAllocatableResourceMappings + *out = make(map[corev1.ResourceName]NodeAllocatableResourceMapping, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } return } @@ -390,6 +397,26 @@ func (in *DeviceAttribute) DeepCopyInto(out *DeviceAttribute) { *out = new(string) **out = **in } + if in.IntValues != nil { + in, out := &in.IntValues, &out.IntValues + *out = make([]int64, len(*in)) + copy(*out, *in) + } + if in.BoolValues != nil { + in, out := &in.BoolValues, &out.BoolValues + *out = make([]bool, len(*in)) + copy(*out, *in) + } + if in.StringValues != nil { + in, out := &in.StringValues, &out.StringValues + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.VersionValues != nil { + in, out := &in.VersionValues, &out.VersionValues + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -907,6 +934,32 @@ func (in *NetworkDeviceData) DeepCopy() *NetworkDeviceData { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResourceMapping) DeepCopyInto(out *NodeAllocatableResourceMapping) { + *out = *in + if in.CapacityKey != nil { + in, out := &in.CapacityKey, &out.CapacityKey + *out = new(QualifiedName) + **out = **in + } + if in.AllocationMultiplier != nil { + in, out := &in.AllocationMultiplier, &out.AllocationMultiplier + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceMapping. +func (in *NodeAllocatableResourceMapping) DeepCopy() *NodeAllocatableResourceMapping { + if in == nil { + return nil + } + out := new(NodeAllocatableResourceMapping) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OpaqueDeviceConfiguration) DeepCopyInto(out *OpaqueDeviceConfiguration) { *out = *in diff --git a/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go index c0de4f9e9d..f163c61ed1 100644 --- a/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1/zz_generated.model_name.go @@ -171,6 +171,11 @@ func (in NetworkDeviceData) OpenAPIModelName() string { return "io.k8s.api.resource.v1.NetworkDeviceData" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableResourceMapping) OpenAPIModelName() string { + return "io.k8s.api.resource.v1.NodeAllocatableResourceMapping" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in OpaqueDeviceConfiguration) OpenAPIModelName() string { return "io.k8s.api.resource.v1.OpaqueDeviceConfiguration" diff --git a/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go b/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go index 66b9f8f620..fa1f5f4710 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1alpha3/generated.pb.go @@ -47,6 +47,16 @@ func (m *DeviceTaintRuleStatus) Reset() { *m = DeviceTaintRuleStatus{} } func (m *DeviceTaintSelector) Reset() { *m = DeviceTaintSelector{} } +func (m *PoolStatus) Reset() { *m = PoolStatus{} } + +func (m *ResourcePoolStatusRequest) Reset() { *m = ResourcePoolStatusRequest{} } + +func (m *ResourcePoolStatusRequestList) Reset() { *m = ResourcePoolStatusRequestList{} } + +func (m *ResourcePoolStatusRequestSpec) Reset() { *m = ResourcePoolStatusRequestSpec{} } + +func (m *ResourcePoolStatusRequestStatus) Reset() { *m = ResourcePoolStatusRequestStatus{} } + func (m *CELDeviceSelector) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -386,6 +396,279 @@ func (m *DeviceTaintSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PoolStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PoolStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PoolStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ValidationError != nil { + i -= len(*m.ValidationError) + copy(dAtA[i:], *m.ValidationError) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ValidationError))) + i-- + dAtA[i] = 0x52 + } + i = encodeVarintGenerated(dAtA, i, uint64(m.Generation)) + i-- + dAtA[i] = 0x48 + if m.ResourceSliceCount != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.ResourceSliceCount)) + i-- + dAtA[i] = 0x40 + } + if m.UnavailableDevices != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.UnavailableDevices)) + i-- + dAtA[i] = 0x38 + } + if m.AvailableDevices != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.AvailableDevices)) + i-- + dAtA[i] = 0x30 + } + if m.AllocatedDevices != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.AllocatedDevices)) + i-- + dAtA[i] = 0x28 + } + if m.TotalDevices != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.TotalDevices)) + i-- + dAtA[i] = 0x20 + } + if m.NodeName != nil { + i -= len(*m.NodeName) + copy(dAtA[i:], *m.NodeName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.NodeName))) + i-- + dAtA[i] = 0x1a + } + i -= len(m.PoolName) + copy(dAtA[i:], m.PoolName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PoolName))) + i-- + dAtA[i] = 0x12 + i -= len(m.Driver) + copy(dAtA[i:], m.Driver) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourcePoolStatusRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourcePoolStatusRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourcePoolStatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Status != nil { + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourcePoolStatusRequestList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourcePoolStatusRequestList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourcePoolStatusRequestList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourcePoolStatusRequestSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourcePoolStatusRequestSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourcePoolStatusRequestSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Limit != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Limit)) + i-- + dAtA[i] = 0x18 + } + if m.PoolName != nil { + i -= len(*m.PoolName) + copy(dAtA[i:], *m.PoolName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PoolName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Driver) + copy(dAtA[i:], m.Driver) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ResourcePoolStatusRequestStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourcePoolStatusRequestStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourcePoolStatusRequestStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolCount != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.PoolCount)) + i-- + dAtA[i] = 0x30 + } + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Pools) > 0 { + for iNdEx := len(m.Pools) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Pools[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + return len(dAtA) - i, nil +} + func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { offset -= sovGenerated(v) base := offset @@ -523,35 +806,148 @@ func (m *DeviceTaintSelector) Size() (n int) { return n } -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *CELDeviceSelector) String() string { - if this == nil { - return "nil" +func (m *PoolStatus) Size() (n int) { + if m == nil { + return 0 } - s := strings.Join([]string{`&CELDeviceSelector{`, - `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, - `}`, - }, "") - return s -} -func (this *DeviceSelector) String() string { - if this == nil { - return "nil" + var l int + _ = l + l = len(m.Driver) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.PoolName) + n += 1 + l + sovGenerated(uint64(l)) + if m.NodeName != nil { + l = len(*m.NodeName) + n += 1 + l + sovGenerated(uint64(l)) } - s := strings.Join([]string{`&DeviceSelector{`, - `CEL:` + strings.Replace(this.CEL.String(), "CELDeviceSelector", "CELDeviceSelector", 1) + `,`, - `}`, - }, "") - return s + if m.TotalDevices != nil { + n += 1 + sovGenerated(uint64(*m.TotalDevices)) + } + if m.AllocatedDevices != nil { + n += 1 + sovGenerated(uint64(*m.AllocatedDevices)) + } + if m.AvailableDevices != nil { + n += 1 + sovGenerated(uint64(*m.AvailableDevices)) + } + if m.UnavailableDevices != nil { + n += 1 + sovGenerated(uint64(*m.UnavailableDevices)) + } + if m.ResourceSliceCount != nil { + n += 1 + sovGenerated(uint64(*m.ResourceSliceCount)) + } + n += 1 + sovGenerated(uint64(m.Generation)) + if m.ValidationError != nil { + l = len(*m.ValidationError) + n += 1 + l + sovGenerated(uint64(l)) + } + return n } -func (this *DeviceTaintRule) String() string { - if this == nil { - return "nil" + +func (m *ResourcePoolStatusRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.Status != nil { + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *ResourcePoolStatusRequestList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *ResourcePoolStatusRequestSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Driver) + n += 1 + l + sovGenerated(uint64(l)) + if m.PoolName != nil { + l = len(*m.PoolName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Limit != nil { + n += 1 + sovGenerated(uint64(*m.Limit)) + } + return n +} + +func (m *ResourcePoolStatusRequestStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Pools) > 0 { + for _, e := range m.Pools { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.PoolCount != nil { + n += 1 + sovGenerated(uint64(*m.PoolCount)) + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *CELDeviceSelector) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&CELDeviceSelector{`, + `Expression:` + fmt.Sprintf("%v", this.Expression) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceSelector) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceSelector{`, + `CEL:` + strings.Replace(this.CEL.String(), "CELDeviceSelector", "CELDeviceSelector", 1) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRule) String() string { + if this == nil { + return "nil" } s := strings.Join([]string{`&DeviceTaintRule{`, `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, @@ -615,6 +1011,87 @@ func (this *DeviceTaintSelector) String() string { }, "") return s } +func (this *PoolStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PoolStatus{`, + `Driver:` + fmt.Sprintf("%v", this.Driver) + `,`, + `PoolName:` + fmt.Sprintf("%v", this.PoolName) + `,`, + `NodeName:` + valueToStringGenerated(this.NodeName) + `,`, + `TotalDevices:` + valueToStringGenerated(this.TotalDevices) + `,`, + `AllocatedDevices:` + valueToStringGenerated(this.AllocatedDevices) + `,`, + `AvailableDevices:` + valueToStringGenerated(this.AvailableDevices) + `,`, + `UnavailableDevices:` + valueToStringGenerated(this.UnavailableDevices) + `,`, + `ResourceSliceCount:` + valueToStringGenerated(this.ResourceSliceCount) + `,`, + `Generation:` + fmt.Sprintf("%v", this.Generation) + `,`, + `ValidationError:` + valueToStringGenerated(this.ValidationError) + `,`, + `}`, + }, "") + return s +} +func (this *ResourcePoolStatusRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourcePoolStatusRequest{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ResourcePoolStatusRequestSpec", "ResourcePoolStatusRequestSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(this.Status.String(), "ResourcePoolStatusRequestStatus", "ResourcePoolStatusRequestStatus", 1) + `,`, + `}`, + }, "") + return s +} +func (this *ResourcePoolStatusRequestList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]ResourcePoolStatusRequest{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "ResourcePoolStatusRequest", "ResourcePoolStatusRequest", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&ResourcePoolStatusRequestList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *ResourcePoolStatusRequestSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ResourcePoolStatusRequestSpec{`, + `Driver:` + fmt.Sprintf("%v", this.Driver) + `,`, + `PoolName:` + valueToStringGenerated(this.PoolName) + `,`, + `Limit:` + valueToStringGenerated(this.Limit) + `,`, + `}`, + }, "") + return s +} +func (this *ResourcePoolStatusRequestStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForPools := "[]PoolStatus{" + for _, f := range this.Pools { + repeatedStringForPools += strings.Replace(strings.Replace(f.String(), "PoolStatus", "PoolStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForPools += "}" + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&ResourcePoolStatusRequestStatus{`, + `Pools:` + repeatedStringForPools + `,`, + `Conditions:` + repeatedStringForConditions + `,`, + `PoolCount:` + valueToStringGenerated(this.PoolCount) + `,`, + `}`, + }, "") + return s +} func valueToStringGenerated(v interface{}) string { rv := reflect.ValueOf(v) if rv.IsNil() { @@ -824,7 +1301,924 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } - var stringLen uint64 + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TimeAdded == nil { + m.TimeAdded = &v1.Time{} + } + if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRule) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRuleList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRuleList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRuleList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, DeviceTaintRule{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRuleSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRuleSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRuleSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeviceSelector", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DeviceSelector == nil { + m.DeviceSelector = &DeviceTaintSelector{} + } + if err := m.DeviceSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Taint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Taint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRuleStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRuleStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRuleStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintSelector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Driver = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Pool = &s + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.Device = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PoolStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PoolStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PoolStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Driver = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.NodeName = &s + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDevices", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.TotalDevices = &v + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AllocatedDevices", wireType) + } + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -834,29 +2228,17 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + m.AllocatedDevices = &v + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AvailableDevices", wireType) } - var stringLen uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -866,29 +2248,37 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + m.AvailableDevices = &v + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field UnavailableDevices", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + m.UnavailableDevices = &v + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceSliceCount", wireType) } - var stringLen uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -898,29 +2288,36 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated + m.ResourceSliceCount = &v + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Generation", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + m.Generation = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Generation |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: + case 10: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidationError", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -930,27 +2327,24 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TimeAdded == nil { - m.TimeAdded = &v1.Time{} - } - if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := string(dAtA[iNdEx:postIndex]) + m.ValidationError = &s iNdEx = postIndex default: iNdEx = preIndex @@ -973,7 +2367,7 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceTaintRule) Unmarshal(dAtA []byte) error { +func (m *ResourcePoolStatusRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -996,10 +2390,10 @@ func (m *DeviceTaintRule) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceTaintRule: wiretype end group for non-group") + return fmt.Errorf("proto: ResourcePoolStatusRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceTaintRule: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResourcePoolStatusRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1097,6 +2491,9 @@ func (m *DeviceTaintRule) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Status == nil { + m.Status = &ResourcePoolStatusRequestStatus{} + } if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1122,7 +2519,7 @@ func (m *DeviceTaintRule) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceTaintRuleList) Unmarshal(dAtA []byte) error { +func (m *ResourcePoolStatusRequestList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1145,10 +2542,10 @@ func (m *DeviceTaintRuleList) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceTaintRuleList: wiretype end group for non-group") + return fmt.Errorf("proto: ResourcePoolStatusRequestList: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceTaintRuleList: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResourcePoolStatusRequestList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1213,7 +2610,7 @@ func (m *DeviceTaintRuleList) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, DeviceTaintRule{}) + m.Items = append(m.Items, ResourcePoolStatusRequest{}) if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1239,7 +2636,7 @@ func (m *DeviceTaintRuleList) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceTaintRuleSpec) Unmarshal(dAtA []byte) error { +func (m *ResourcePoolStatusRequestSpec) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1262,17 +2659,17 @@ func (m *DeviceTaintRuleSpec) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceTaintRuleSpec: wiretype end group for non-group") + return fmt.Errorf("proto: ResourcePoolStatusRequestSpec: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceTaintRuleSpec: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResourcePoolStatusRequestSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeviceSelector", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1282,33 +2679,29 @@ func (m *DeviceTaintRuleSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.DeviceSelector == nil { - m.DeviceSelector = &DeviceTaintSelector{} - } - if err := m.DeviceSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Driver = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Taint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PoolName", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1318,80 +2711,30 @@ func (m *DeviceTaintRuleSpec) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Taint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := string(dAtA[iNdEx:postIndex]) + m.PoolName = &s iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceTaintRuleStatus) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceTaintRuleStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceTaintRuleStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) } - var msglen int + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1401,26 +2744,12 @@ func (m *DeviceTaintRuleStatus) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Conditions = append(m.Conditions, v1.Condition{}) - if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex + m.Limit = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -1442,7 +2771,7 @@ func (m *DeviceTaintRuleStatus) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { +func (m *ResourcePoolStatusRequestStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1465,17 +2794,17 @@ func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceTaintSelector: wiretype end group for non-group") + return fmt.Errorf("proto: ResourcePoolStatusRequestStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceTaintSelector: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ResourcePoolStatusRequestStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pools", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1485,30 +2814,31 @@ func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.Driver = &s + m.Pools = append(m.Pools, PoolStatus{}) + if err := m.Pools[len(m.Pools)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1518,30 +2848,31 @@ func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - s := string(dAtA[iNdEx:postIndex]) - m.Pool = &s + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolCount", wireType) } - var stringLen uint64 + var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -1551,25 +2882,12 @@ func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + v |= int32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Device = &s - iNdEx = postIndex + m.PoolCount = &v default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/resource/v1alpha3/generated.proto b/vendor/k8s.io/api/resource/v1alpha3/generated.proto index 6414216db2..d6ee310806 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/generated.proto +++ b/vendor/k8s.io/api/resource/v1alpha3/generated.proto @@ -120,11 +120,21 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required + // +k8s:required optional string effect = 3; - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time timeAdded = 4; } @@ -140,6 +150,7 @@ message DeviceTaintRule { // Spec specifies the selector and one taint. // // Changing the spec automatically increments the metadata.generation number. + // +required optional DeviceTaintRuleSpec spec = 2; // Status provides information about what was requested in the spec. @@ -237,3 +248,210 @@ message DeviceTaintSelector { optional string device = 4; } +// PoolStatus contains status information for a single resource pool. +message PoolStatus { + // Driver is the DRA driver name for this pool. + // Must be a DNS subdomain (e.g., "gpu.example.com"). + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name-caseless + optional string driver = 1; + + // PoolName is the name of the pool. + // Must be a valid resource pool name (DNS subdomains separated by "/"). + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-pool-name + optional string poolName = 2; + + // Generation is the pool generation observed across all ResourceSlices + // in this pool. Only the latest generation is reported. During a generation + // rollout, if not all slices at the latest generation have been published, + // the pool is included with a validationError and device counts unset. + // + // +required + // +k8s:required + // +k8s:minimum=0 + optional int64 generation = 9; + + // ResourceSliceCount is the number of ResourceSlices that make up this pool. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=1 + optional int32 resourceSliceCount = 8; + + // TotalDevices is the total number of devices in the pool across all slices. + // A value of 0 means the pool has no devices. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + optional int32 totalDevices = 4; + + // AllocatedDevices is the number of devices currently allocated to claims. + // A value of 0 means no devices are allocated. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + optional int32 allocatedDevices = 5; + + // AvailableDevices is the number of devices available for allocation. + // This equals TotalDevices - AllocatedDevices - UnavailableDevices. + // A value of 0 means no devices are currently available. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + optional int32 availableDevices = 6; + + // UnavailableDevices is the number of devices that are not available + // due to taints or other conditions, but are not allocated. + // A value of 0 means all unallocated devices are available. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + optional int32 unavailableDevices = 7; + + // NodeName is the node this pool is associated with. + // When omitted, the pool is not associated with a specific node. + // Must be a valid DNS subdomain name (RFC1123). + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + optional string nodeName = 3; + + // ValidationError is set when the pool's data could not be fully + // validated (e.g., incomplete slice publication). When set, device + // count fields and ResourceSliceCount may be unset. + // + // +optional + // +k8s:optional + // +k8s:maxBytes=256 + optional string validationError = 10; +} + +// ResourcePoolStatusRequest triggers a one-time calculation of resource pool status +// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. +// Users should delete and recreate requests to get updated information. +message ResourcePoolStatusRequest { + // Standard object metadata + // +required + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Spec defines the filters for which pools to include in the status. + // The spec is immutable once created. + // + // +required + // +k8s:immutable + optional ResourcePoolStatusRequestSpec spec = 2; + + // Status is populated by the controller with the calculated pool status. + // When status is non-nil, the request is considered complete and the + // entire object becomes immutable. + // + // +optional + // +k8s:optional + optional ResourcePoolStatusRequestStatus status = 3; +} + +// ResourcePoolStatusRequestList is a collection of ResourcePoolStatusRequests. +message ResourcePoolStatusRequestList { + // Standard list metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of ResourcePoolStatusRequests. + repeated ResourcePoolStatusRequest items = 2; +} + +// ResourcePoolStatusRequestSpec defines the filters for the pool status request. +message ResourcePoolStatusRequestSpec { + // Driver specifies the DRA driver name to filter pools. + // Only pools from ResourceSlices with this driver will be included. + // Must be a DNS subdomain (e.g., "gpu.example.com"). + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name-caseless + optional string driver = 1; + + // PoolName optionally filters to a specific pool name. + // If not specified, all pools from the specified driver are included. + // When specified, must be a non-empty valid resource pool name + // (DNS subdomains separated by "/"). + // + // +optional + // +k8s:optional + // +k8s:format=k8s-resource-pool-name + optional string poolName = 2; + + // Limit optionally specifies the maximum number of pools to return in the status. + // If more pools match the filter criteria, the response will be truncated + // (i.e., len(status.pools) < status.poolCount). + // + // Default: 100 + // Minimum: 1 + // Maximum: 1000 + // + // +optional + // +k8s:optional + // +default=100 + // +k8s:minimum=1 + // +k8s:maximum=1000 + optional int32 limit = 3; +} + +// ResourcePoolStatusRequestStatus contains the calculated pool status information. +message ResourcePoolStatusRequestStatus { + // PoolCount is the total number of pools that matched the filter criteria, + // regardless of truncation. This helps users understand how many pools exist + // even when the response is truncated. A value of 0 means no pools matched + // the filter criteria. + // + // +required + // +k8s:required + // +k8s:minimum=0 + optional int32 poolCount = 6; + + // Pools contains the first `spec.limit` matching pools, sorted by driver + // then pool name. If `len(pools) < poolCount`, the list was truncated. + // When omitted, no pools matched the request filters. + // + // +optional + // +k8s:optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:maxItems=1000 + repeated PoolStatus pools = 2; + + // Conditions provide information about the state of the request. + // A condition with type=Complete or type=Failed will always be set + // when the status is populated. + // + // Known condition types: + // - "Complete": True when the request has been processed successfully + // - "Failed": True when the request could not be processed + // + // +optional + // +k8s:optional + // +listType=map + // +k8s:listType=map + // +listMapKey=type + // +k8s:listMapKey=type + // +patchStrategy=merge + // +patchMergeKey=type + // +k8s:maxItems=10 + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 3; +} + diff --git a/vendor/k8s.io/api/resource/v1alpha3/generated.protomessage.pb.go b/vendor/k8s.io/api/resource/v1alpha3/generated.protomessage.pb.go deleted file mode 100644 index aba6231f3d..0000000000 --- a/vendor/k8s.io/api/resource/v1alpha3/generated.protomessage.pb.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha3 - -func (*CELDeviceSelector) ProtoMessage() {} - -func (*DeviceSelector) ProtoMessage() {} - -func (*DeviceTaint) ProtoMessage() {} - -func (*DeviceTaintRule) ProtoMessage() {} - -func (*DeviceTaintRuleList) ProtoMessage() {} - -func (*DeviceTaintRuleSpec) ProtoMessage() {} - -func (*DeviceTaintRuleStatus) ProtoMessage() {} - -func (*DeviceTaintSelector) ProtoMessage() {} diff --git a/vendor/k8s.io/api/resource/v1alpha3/register.go b/vendor/k8s.io/api/resource/v1alpha3/register.go index dd79ec341e..ab20bd05fb 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/register.go +++ b/vendor/k8s.io/api/resource/v1alpha3/register.go @@ -46,6 +46,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &DeviceTaintRule{}, &DeviceTaintRuleList{}, + &ResourcePoolStatusRequest{}, + &ResourcePoolStatusRequestList{}, ) // Add the watch version that applies diff --git a/vendor/k8s.io/api/resource/v1alpha3/types.go b/vendor/k8s.io/api/resource/v1alpha3/types.go index ba02edabaa..1757c86150 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/types.go +++ b/vendor/k8s.io/api/resource/v1alpha3/types.go @@ -140,6 +140,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required + // +k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -155,9 +156,18 @@ type DeviceTaint struct { // which will enable adding new enums within a single release without // ratcheting. - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional TimeAdded *metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"` @@ -169,6 +179,7 @@ type DeviceTaint struct { } // +enum +// +k8s:enum type DeviceTaintEffect string const ( @@ -201,6 +212,7 @@ type DeviceTaintRule struct { // Spec specifies the selector and one taint. // // Changing the spec automatically increments the metadata.generation number. + // +required Spec DeviceTaintRuleSpec `json:"spec" protobuf:"bytes,2,name=spec"` // Status provides information about what was requested in the spec. @@ -332,3 +344,233 @@ type DeviceTaintRuleList struct { // Items is the list of DeviceTaintRules. Items []DeviceTaintRule `json:"items" protobuf:"bytes,2,rep,name=items"` } + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 +// +k8s:supportsSubresource="/status" + +// ResourcePoolStatusRequest triggers a one-time calculation of resource pool status +// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. +// Users should delete and recreate requests to get updated information. +type ResourcePoolStatusRequest struct { + metav1.TypeMeta `json:",inline"` + // Standard object metadata + // +required + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec defines the filters for which pools to include in the status. + // The spec is immutable once created. + // + // +required + // +k8s:immutable + Spec ResourcePoolStatusRequestSpec `json:"spec" protobuf:"bytes,2,name=spec"` + + // Status is populated by the controller with the calculated pool status. + // When status is non-nil, the request is considered complete and the + // entire object becomes immutable. + // + // +optional + // +k8s:optional + Status *ResourcePoolStatusRequestStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// ResourcePoolStatusRequestSpec defines the filters for the pool status request. +type ResourcePoolStatusRequestSpec struct { + // Driver specifies the DRA driver name to filter pools. + // Only pools from ResourceSlices with this driver will be included. + // Must be a DNS subdomain (e.g., "gpu.example.com"). + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name-caseless + Driver string `json:"driver" protobuf:"bytes,1,name=driver"` + + // PoolName optionally filters to a specific pool name. + // If not specified, all pools from the specified driver are included. + // When specified, must be a non-empty valid resource pool name + // (DNS subdomains separated by "/"). + // + // +optional + // +k8s:optional + // +k8s:format=k8s-resource-pool-name + PoolName *string `json:"poolName,omitempty" protobuf:"bytes,2,opt,name=poolName"` + + // Limit optionally specifies the maximum number of pools to return in the status. + // If more pools match the filter criteria, the response will be truncated + // (i.e., len(status.pools) < status.poolCount). + // + // Default: 100 + // Minimum: 1 + // Maximum: 1000 + // + // +optional + // +k8s:optional + // +default=100 + // +k8s:minimum=1 + // +k8s:maximum=1000 + Limit *int32 `json:"limit,omitempty" protobuf:"varint,3,opt,name=limit"` +} + +// ResourcePoolStatusRequestLimitDefault is the default value for spec.limit. +const ResourcePoolStatusRequestLimitDefault int32 = 100 + +// ResourcePoolStatusRequestLimitMax is the maximum allowed value for spec.limit. +const ResourcePoolStatusRequestLimitMax int32 = 1000 + +// ResourcePoolStatusRequestStatus contains the calculated pool status information. +type ResourcePoolStatusRequestStatus struct { + // PoolCount is the total number of pools that matched the filter criteria, + // regardless of truncation. This helps users understand how many pools exist + // even when the response is truncated. A value of 0 means no pools matched + // the filter criteria. + // + // +required + // +k8s:required + // +k8s:minimum=0 + PoolCount *int32 `json:"poolCount,omitempty" protobuf:"varint,6,opt,name=poolCount"` + + // Pools contains the first `spec.limit` matching pools, sorted by driver + // then pool name. If `len(pools) < poolCount`, the list was truncated. + // When omitted, no pools matched the request filters. + // + // +optional + // +k8s:optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:maxItems=1000 + Pools []PoolStatus `json:"pools,omitempty" protobuf:"bytes,2,rep,name=pools"` + + // Conditions provide information about the state of the request. + // A condition with type=Complete or type=Failed will always be set + // when the status is populated. + // + // Known condition types: + // - "Complete": True when the request has been processed successfully + // - "Failed": True when the request could not be processed + // + // +optional + // +k8s:optional + // +listType=map + // +k8s:listType=map + // +listMapKey=type + // +k8s:listMapKey=type + // +patchStrategy=merge + // +patchMergeKey=type + // +k8s:maxItems=10 + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,3,rep,name=conditions"` +} + +// PoolStatus contains status information for a single resource pool. +type PoolStatus struct { + // Driver is the DRA driver name for this pool. + // Must be a DNS subdomain (e.g., "gpu.example.com"). + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name-caseless + Driver string `json:"driver,omitempty" protobuf:"bytes,1,name=driver"` + + // PoolName is the name of the pool. + // Must be a valid resource pool name (DNS subdomains separated by "/"). + // + // +required + // +k8s:required + // +k8s:format=k8s-resource-pool-name + PoolName string `json:"poolName,omitempty" protobuf:"bytes,2,name=poolName"` + + // Generation is the pool generation observed across all ResourceSlices + // in this pool. Only the latest generation is reported. During a generation + // rollout, if not all slices at the latest generation have been published, + // the pool is included with a validationError and device counts unset. + // + // +required + // +k8s:required + // +k8s:minimum=0 + Generation int64 `json:"generation" protobuf:"varint,9,opt,name=generation"` + + // ResourceSliceCount is the number of ResourceSlices that make up this pool. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=1 + ResourceSliceCount *int32 `json:"resourceSliceCount,omitempty" protobuf:"varint,8,opt,name=resourceSliceCount"` + + // TotalDevices is the total number of devices in the pool across all slices. + // A value of 0 means the pool has no devices. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + TotalDevices *int32 `json:"totalDevices,omitempty" protobuf:"varint,4,opt,name=totalDevices"` + + // AllocatedDevices is the number of devices currently allocated to claims. + // A value of 0 means no devices are allocated. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + AllocatedDevices *int32 `json:"allocatedDevices,omitempty" protobuf:"varint,5,opt,name=allocatedDevices"` + + // AvailableDevices is the number of devices available for allocation. + // This equals TotalDevices - AllocatedDevices - UnavailableDevices. + // A value of 0 means no devices are currently available. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + AvailableDevices *int32 `json:"availableDevices,omitempty" protobuf:"varint,6,opt,name=availableDevices"` + + // UnavailableDevices is the number of devices that are not available + // due to taints or other conditions, but are not allocated. + // A value of 0 means all unallocated devices are available. + // May be unset when validationError is set. + // + // +optional + // +k8s:optional + // +k8s:minimum=0 + UnavailableDevices *int32 `json:"unavailableDevices,omitempty" protobuf:"varint,7,opt,name=unavailableDevices"` + + // NodeName is the node this pool is associated with. + // When omitted, the pool is not associated with a specific node. + // Must be a valid DNS subdomain name (RFC1123). + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,3,opt,name=nodeName"` + + // ValidationError is set when the pool's data could not be fully + // validated (e.g., incomplete slice publication). When set, device + // count fields and ResourceSliceCount may be unset. + // + // +optional + // +k8s:optional + // +k8s:maxBytes=256 + ValidationError *string `json:"validationError,omitempty" protobuf:"bytes,10,opt,name=validationError"` +} + +// ResourcePoolStatusRequestConditionComplete is the condition type for completed requests. +const ResourcePoolStatusRequestConditionComplete = "Complete" + +// ResourcePoolStatusRequestConditionFailed is the condition type for failed requests. +const ResourcePoolStatusRequestConditionFailed = "Failed" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 + +// ResourcePoolStatusRequestList is a collection of ResourcePoolStatusRequests. +type ResourcePoolStatusRequestList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of ResourcePoolStatusRequests. + Items []ResourcePoolStatusRequest `json:"items" protobuf:"bytes,2,rep,name=items"` +} diff --git a/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go index 30981bd7e6..49ff642fea 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1alpha3/types_swagger_doc_generated.go @@ -50,7 +50,7 @@ var map_DeviceTaint = map[string]string{ "key": "The taint key to be applied to a device. Must be a label name.", "value": "The taint value corresponding to the taint key. Must be a label value.", "effect": "The effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them.\n\nValid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here. More effects may get added in the future. Consumers must treat unknown effects like None.", - "timeAdded": "TimeAdded represents the time at which the taint was added. Added automatically during create or update if not set.", + "timeAdded": "TimeAdded represents the time at which the taint was added or (only in a DeviceTaintRule) the effect was modified. Added automatically during create or update if not set.\n\nIn addition, in a DeviceTaintRule a value provided during an update gets replaced with the current time if the provided value is the same as the old one and the new effect is different. Changing the key and/or value while keeping the effect unchanged is possible and does not update the time stamp because the eviction which uses it is either already started (NoExecute) or not started yet (NoEffect, NoSchedule).", } func (DeviceTaint) SwaggerDoc() map[string]string { @@ -108,4 +108,65 @@ func (DeviceTaintSelector) SwaggerDoc() map[string]string { return map_DeviceTaintSelector } +var map_PoolStatus = map[string]string{ + "": "PoolStatus contains status information for a single resource pool.", + "driver": "Driver is the DRA driver name for this pool. Must be a DNS subdomain (e.g., \"gpu.example.com\").", + "poolName": "PoolName is the name of the pool. Must be a valid resource pool name (DNS subdomains separated by \"/\").", + "generation": "Generation is the pool generation observed across all ResourceSlices in this pool. Only the latest generation is reported. During a generation rollout, if not all slices at the latest generation have been published, the pool is included with a validationError and device counts unset.", + "resourceSliceCount": "ResourceSliceCount is the number of ResourceSlices that make up this pool. May be unset when validationError is set.", + "totalDevices": "TotalDevices is the total number of devices in the pool across all slices. A value of 0 means the pool has no devices. May be unset when validationError is set.", + "allocatedDevices": "AllocatedDevices is the number of devices currently allocated to claims. A value of 0 means no devices are allocated. May be unset when validationError is set.", + "availableDevices": "AvailableDevices is the number of devices available for allocation. This equals TotalDevices - AllocatedDevices - UnavailableDevices. A value of 0 means no devices are currently available. May be unset when validationError is set.", + "unavailableDevices": "UnavailableDevices is the number of devices that are not available due to taints or other conditions, but are not allocated. A value of 0 means all unallocated devices are available. May be unset when validationError is set.", + "nodeName": "NodeName is the node this pool is associated with. When omitted, the pool is not associated with a specific node. Must be a valid DNS subdomain name (RFC1123).", + "validationError": "ValidationError is set when the pool's data could not be fully validated (e.g., incomplete slice publication). When set, device count fields and ResourceSliceCount may be unset.", +} + +func (PoolStatus) SwaggerDoc() map[string]string { + return map_PoolStatus +} + +var map_ResourcePoolStatusRequest = map[string]string{ + "": "ResourcePoolStatusRequest triggers a one-time calculation of resource pool status based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. Users should delete and recreate requests to get updated information.", + "metadata": "Standard object metadata", + "spec": "Spec defines the filters for which pools to include in the status. The spec is immutable once created.", + "status": "Status is populated by the controller with the calculated pool status. When status is non-nil, the request is considered complete and the entire object becomes immutable.", +} + +func (ResourcePoolStatusRequest) SwaggerDoc() map[string]string { + return map_ResourcePoolStatusRequest +} + +var map_ResourcePoolStatusRequestList = map[string]string{ + "": "ResourcePoolStatusRequestList is a collection of ResourcePoolStatusRequests.", + "metadata": "Standard list metadata", + "items": "Items is the list of ResourcePoolStatusRequests.", +} + +func (ResourcePoolStatusRequestList) SwaggerDoc() map[string]string { + return map_ResourcePoolStatusRequestList +} + +var map_ResourcePoolStatusRequestSpec = map[string]string{ + "": "ResourcePoolStatusRequestSpec defines the filters for the pool status request.", + "driver": "Driver specifies the DRA driver name to filter pools. Only pools from ResourceSlices with this driver will be included. Must be a DNS subdomain (e.g., \"gpu.example.com\").", + "poolName": "PoolName optionally filters to a specific pool name. If not specified, all pools from the specified driver are included. When specified, must be a non-empty valid resource pool name (DNS subdomains separated by \"/\").", + "limit": "Limit optionally specifies the maximum number of pools to return in the status. If more pools match the filter criteria, the response will be truncated (i.e., len(status.pools) < status.poolCount).\n\nDefault: 100 Minimum: 1 Maximum: 1000", +} + +func (ResourcePoolStatusRequestSpec) SwaggerDoc() map[string]string { + return map_ResourcePoolStatusRequestSpec +} + +var map_ResourcePoolStatusRequestStatus = map[string]string{ + "": "ResourcePoolStatusRequestStatus contains the calculated pool status information.", + "poolCount": "PoolCount is the total number of pools that matched the filter criteria, regardless of truncation. This helps users understand how many pools exist even when the response is truncated. A value of 0 means no pools matched the filter criteria.", + "pools": "Pools contains the first `spec.limit` matching pools, sorted by driver then pool name. If `len(pools) < poolCount`, the list was truncated. When omitted, no pools matched the request filters.", + "conditions": "Conditions provide information about the state of the request. A condition with type=Complete or type=Failed will always be set when the status is populated.\n\nKnown condition types: - \"Complete\": True when the request has been processed successfully - \"Failed\": True when the request could not be processed", +} + +func (ResourcePoolStatusRequestStatus) SwaggerDoc() map[string]string { + return map_ResourcePoolStatusRequestStatus +} + // AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go index 6813ab043c..32ec2ad8e2 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.deepcopy.go @@ -219,3 +219,180 @@ func (in *DeviceTaintSelector) DeepCopy() *DeviceTaintSelector { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PoolStatus) DeepCopyInto(out *PoolStatus) { + *out = *in + if in.ResourceSliceCount != nil { + in, out := &in.ResourceSliceCount, &out.ResourceSliceCount + *out = new(int32) + **out = **in + } + if in.TotalDevices != nil { + in, out := &in.TotalDevices, &out.TotalDevices + *out = new(int32) + **out = **in + } + if in.AllocatedDevices != nil { + in, out := &in.AllocatedDevices, &out.AllocatedDevices + *out = new(int32) + **out = **in + } + if in.AvailableDevices != nil { + in, out := &in.AvailableDevices, &out.AvailableDevices + *out = new(int32) + **out = **in + } + if in.UnavailableDevices != nil { + in, out := &in.UnavailableDevices, &out.UnavailableDevices + *out = new(int32) + **out = **in + } + if in.NodeName != nil { + in, out := &in.NodeName, &out.NodeName + *out = new(string) + **out = **in + } + if in.ValidationError != nil { + in, out := &in.ValidationError, &out.ValidationError + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PoolStatus. +func (in *PoolStatus) DeepCopy() *PoolStatus { + if in == nil { + return nil + } + out := new(PoolStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcePoolStatusRequest) DeepCopyInto(out *ResourcePoolStatusRequest) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(ResourcePoolStatusRequestStatus) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolStatusRequest. +func (in *ResourcePoolStatusRequest) DeepCopy() *ResourcePoolStatusRequest { + if in == nil { + return nil + } + out := new(ResourcePoolStatusRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourcePoolStatusRequest) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcePoolStatusRequestList) DeepCopyInto(out *ResourcePoolStatusRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ResourcePoolStatusRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolStatusRequestList. +func (in *ResourcePoolStatusRequestList) DeepCopy() *ResourcePoolStatusRequestList { + if in == nil { + return nil + } + out := new(ResourcePoolStatusRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ResourcePoolStatusRequestList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcePoolStatusRequestSpec) DeepCopyInto(out *ResourcePoolStatusRequestSpec) { + *out = *in + if in.PoolName != nil { + in, out := &in.PoolName, &out.PoolName + *out = new(string) + **out = **in + } + if in.Limit != nil { + in, out := &in.Limit, &out.Limit + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolStatusRequestSpec. +func (in *ResourcePoolStatusRequestSpec) DeepCopy() *ResourcePoolStatusRequestSpec { + if in == nil { + return nil + } + out := new(ResourcePoolStatusRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourcePoolStatusRequestStatus) DeepCopyInto(out *ResourcePoolStatusRequestStatus) { + *out = *in + if in.PoolCount != nil { + in, out := &in.PoolCount, &out.PoolCount + *out = new(int32) + **out = **in + } + if in.Pools != nil { + in, out := &in.Pools, &out.Pools + *out = make([]PoolStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePoolStatusRequestStatus. +func (in *ResourcePoolStatusRequestStatus) DeepCopy() *ResourcePoolStatusRequestStatus { + if in == nil { + return nil + } + out := new(ResourcePoolStatusRequestStatus) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go index 1c1672b4d6..3ef712c223 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.model_name.go @@ -60,3 +60,28 @@ func (in DeviceTaintRuleStatus) OpenAPIModelName() string { func (in DeviceTaintSelector) OpenAPIModelName() string { return "io.k8s.api.resource.v1alpha3.DeviceTaintSelector" } + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PoolStatus) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.PoolStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ResourcePoolStatusRequest) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ResourcePoolStatusRequestList) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ResourcePoolStatusRequestSpec) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ResourcePoolStatusRequestStatus) OpenAPIModelName() string { + return "io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestStatus" +} diff --git a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.prerelease-lifecycle.go index 08e8b6040f..5b74f40736 100644 --- a/vendor/k8s.io/api/resource/v1alpha3/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/resource/v1alpha3/zz_generated.prerelease-lifecycle.go @@ -56,3 +56,39 @@ func (in *DeviceTaintRuleList) APILifecycleDeprecated() (major, minor int) { func (in *DeviceTaintRuleList) APILifecycleRemoved() (major, minor int) { return 1, 39 } + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *ResourcePoolStatusRequest) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *ResourcePoolStatusRequest) APILifecycleDeprecated() (major, minor int) { + return 1, 39 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *ResourcePoolStatusRequest) APILifecycleRemoved() (major, minor int) { + return 1, 42 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *ResourcePoolStatusRequestList) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *ResourcePoolStatusRequestList) APILifecycleDeprecated() (major, minor int) { + return 1, 39 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *ResourcePoolStatusRequestList) APILifecycleRemoved() (major, minor int) { + return 1, 42 +} diff --git a/vendor/k8s.io/api/resource/v1beta1/generated.pb.go b/vendor/k8s.io/api/resource/v1beta1/generated.pb.go index 1ac7de8a8f..4170f77802 100644 --- a/vendor/k8s.io/api/resource/v1beta1/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1beta1/generated.pb.go @@ -25,6 +25,7 @@ import ( io "io" "sort" + k8s_io_api_core_v1 "k8s.io/api/core/v1" v11 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -97,6 +98,8 @@ func (m *DeviceToleration) Reset() { *m = DeviceToleration{} } func (m *NetworkDeviceData) Reset() { *m = NetworkDeviceData{} } +func (m *NodeAllocatableResourceMapping) Reset() { *m = NodeAllocatableResourceMapping{} } + func (m *OpaqueDeviceConfiguration) Reset() { *m = OpaqueDeviceConfiguration{} } func (m *ResourceClaim) Reset() { *m = ResourceClaim{} } @@ -283,6 +286,35 @@ func (m *BasicDevice) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NodeAllocatableResourceMappings) > 0 { + keysForNodeAllocatableResourceMappings := make([]string, 0, len(m.NodeAllocatableResourceMappings)) + for k := range m.NodeAllocatableResourceMappings { + keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + } + sort.Strings(keysForNodeAllocatableResourceMappings) + for iNdEx := len(keysForNodeAllocatableResourceMappings) - 1; iNdEx >= 0; iNdEx-- { + v := m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResourceMappings[iNdEx])] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(keysForNodeAllocatableResourceMappings[iNdEx]) + copy(dAtA[i:], keysForNodeAllocatableResourceMappings[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResourceMappings[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x62 + } + } if m.AllowMultipleAllocations != nil { i-- if *m.AllowMultipleAllocations { @@ -887,6 +919,43 @@ func (m *DeviceAttribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.VersionValues) > 0 { + for iNdEx := len(m.VersionValues) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.VersionValues[iNdEx]) + copy(dAtA[i:], m.VersionValues[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.VersionValues[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if len(m.StringValues) > 0 { + for iNdEx := len(m.StringValues) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StringValues[iNdEx]) + copy(dAtA[i:], m.StringValues[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.StringValues[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if len(m.BoolValues) > 0 { + for iNdEx := len(m.BoolValues) - 1; iNdEx >= 0; iNdEx-- { + i-- + if m.BoolValues[iNdEx] { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + } + if len(m.IntValues) > 0 { + for iNdEx := len(m.IntValues) - 1; iNdEx >= 0; iNdEx-- { + i = encodeVarintGenerated(dAtA, i, uint64(m.IntValues[iNdEx])) + i-- + dAtA[i] = 0x30 + } + } if m.VersionValue != nil { i -= len(*m.VersionValue) copy(dAtA[i:], *m.VersionValue) @@ -1872,6 +1941,48 @@ func (m *NetworkDeviceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NodeAllocatableResourceMapping) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.AllocationMultiplier != nil { + { + size, err := m.AllocationMultiplier.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.CapacityKey != nil { + i -= len(*m.CapacityKey) + copy(dAtA[i:], *m.CapacityKey) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.CapacityKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2635,6 +2746,15 @@ func (m *BasicDevice) Size() (n int) { if m.AllowMultipleAllocations != nil { n += 2 } + if len(m.NodeAllocatableResourceMappings) > 0 { + for k, v := range m.NodeAllocatableResourceMappings { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } return n } @@ -2817,6 +2937,26 @@ func (m *DeviceAttribute) Size() (n int) { l = len(*m.VersionValue) n += 1 + l + sovGenerated(uint64(l)) } + if len(m.IntValues) > 0 { + for _, e := range m.IntValues { + n += 1 + sovGenerated(uint64(e)) + } + } + if len(m.BoolValues) > 0 { + n += 2 * len(m.BoolValues) + } + if len(m.StringValues) > 0 { + for _, s := range m.StringValues { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.VersionValues) > 0 { + for _, s := range m.VersionValues { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3196,6 +3336,23 @@ func (m *NetworkDeviceData) Size() (n int) { return n } +func (m *NodeAllocatableResourceMapping) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CapacityKey != nil { + l = len(*m.CapacityKey) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.AllocationMultiplier != nil { + l = m.AllocationMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *OpaqueDeviceConfiguration) Size() (n int) { if m == nil { return 0 @@ -3488,6 +3645,16 @@ func (this *BasicDevice) String() string { mapStringForCapacity += fmt.Sprintf("%v: %v,", k, this.Capacity[QualifiedName(k)]) } mapStringForCapacity += "}" + keysForNodeAllocatableResourceMappings := make([]string, 0, len(this.NodeAllocatableResourceMappings)) + for k := range this.NodeAllocatableResourceMappings { + keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + } + sort.Strings(keysForNodeAllocatableResourceMappings) + mapStringForNodeAllocatableResourceMappings := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping{" + for _, k := range keysForNodeAllocatableResourceMappings { + mapStringForNodeAllocatableResourceMappings += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(k)]) + } + mapStringForNodeAllocatableResourceMappings += "}" s := strings.Join([]string{`&BasicDevice{`, `Attributes:` + mapStringForAttributes + `,`, `Capacity:` + mapStringForCapacity + `,`, @@ -3500,6 +3667,7 @@ func (this *BasicDevice) String() string { `BindingConditions:` + fmt.Sprintf("%v", this.BindingConditions) + `,`, `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `AllowMultipleAllocations:` + valueToStringGenerated(this.AllowMultipleAllocations) + `,`, + `NodeAllocatableResourceMappings:` + mapStringForNodeAllocatableResourceMappings + `,`, `}`, }, "") return s @@ -3647,6 +3815,10 @@ func (this *DeviceAttribute) String() string { `BoolValue:` + valueToStringGenerated(this.BoolValue) + `,`, `StringValue:` + valueToStringGenerated(this.StringValue) + `,`, `VersionValue:` + valueToStringGenerated(this.VersionValue) + `,`, + `IntValues:` + fmt.Sprintf("%v", this.IntValues) + `,`, + `BoolValues:` + fmt.Sprintf("%v", this.BoolValues) + `,`, + `StringValues:` + fmt.Sprintf("%v", this.StringValues) + `,`, + `VersionValues:` + fmt.Sprintf("%v", this.VersionValues) + `,`, `}`, }, "") return s @@ -3931,6 +4103,17 @@ func (this *NetworkDeviceData) String() string { }, "") return s } +func (this *NodeAllocatableResourceMapping) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableResourceMapping{`, + `CapacityKey:` + valueToStringGenerated(this.CapacityKey) + `,`, + `AllocationMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.AllocationMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} func (this *OpaqueDeviceConfiguration) String() string { if this == nil { return "nil" @@ -5118,6 +5301,135 @@ func (m *BasicDevice) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.AllowMultipleAllocations = &b + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResourceMappings", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NodeAllocatableResourceMappings == nil { + m.NodeAllocatableResourceMappings = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping) + } + var mapkey k8s_io_api_core_v1.ResourceName + mapvalue := &NodeAllocatableResourceMapping{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &NodeAllocatableResourceMapping{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -6527,6 +6839,216 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.VersionValue = &s iNdEx = postIndex + case 6: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IntValues = append(m.IntValues, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.IntValues) == 0 { + m.IntValues = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IntValues = append(m.IntValues, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field IntValues", wireType) + } + case 7: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.BoolValues) == 0 { + m.BoolValues = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValues", wireType) + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringValues", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StringValues = append(m.StringValues, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionValues", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VersionValues = append(m.VersionValues, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9510,6 +10032,125 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } return nil } +func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeAllocatableResourceMapping: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeAllocatableResourceMapping: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CapacityKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := QualifiedName(dAtA[iNdEx:postIndex]) + m.CapacityKey = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllocationMultiplier", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AllocationMultiplier == nil { + m.AllocationMultiplier = &resource.Quantity{} + } + if err := m.AllocationMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *OpaqueDeviceConfiguration) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/resource/v1beta1/generated.proto b/vendor/k8s.io/api/resource/v1beta1/generated.proto index fe2397a879..79a51ee2c8 100644 --- a/vendor/k8s.io/api/resource/v1beta1/generated.proto +++ b/vendor/k8s.io/api/resource/v1beta1/generated.proto @@ -65,8 +65,8 @@ message AllocatedDeviceStatus { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid optional string shareID = 7; // Conditions contains the latest observation of the device's state. @@ -90,7 +90,7 @@ message AllocatedDeviceStatus { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional NetworkDeviceData networkData = 6; } @@ -110,7 +110,7 @@ message AllocationResult { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. // // +optional @@ -126,6 +126,7 @@ message BasicDevice { // The maximum number of attributes and capacities combined is 32. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional map attributes = 1; // Capacity defines the set of capacities for this device. @@ -146,13 +147,13 @@ message BasicDevice { // device is 2. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=counterSet + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:maxItems=2 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 repeated DeviceCounterConsumption consumesCounters = 3; // NodeName identifies the node where the device is available. @@ -192,12 +193,13 @@ message BasicDevice { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceTaint taints = 7; // BindsToNode indicates if the usage of an allocation involving this device @@ -205,7 +207,7 @@ message BasicDevice { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional @@ -221,14 +223,14 @@ message BasicDevice { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingConditions = 9; // BindingFailureConditions defines the conditions for binding failure. @@ -239,14 +241,14 @@ message BasicDevice { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingFailureConditions = 10; // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -257,6 +259,21 @@ message BasicDevice { // +optional // +featureGate=DRAConsumableCapacity optional bool allowMultipleAllocations = 11; + + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + // +optional + // +featureGate=DRANodeAllocatableResources + map nodeAllocatableResourceMappings = 12; } // CELDeviceSelector contains a CEL expression for selecting a device. @@ -310,6 +327,14 @@ message CELDeviceSelector { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. @@ -448,8 +473,8 @@ message CounterSet { // It must be a DNS label. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name optional string name = 1; // Counters defines the set of counters for this CounterSet @@ -458,6 +483,8 @@ message CounterSet { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -474,6 +501,7 @@ message Device { // // +optional // +oneOf=deviceType + // +k8s:alpha(since: "1.36")=+k8s:optional optional BasicDevice basic = 2; } @@ -484,7 +512,7 @@ message DeviceAllocationConfiguration { // or from a claim. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string source = 1; // Requests lists the names of requests where the configuration applies. @@ -496,10 +524,10 @@ message DeviceAllocationConfiguration { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 2; optional DeviceConfiguration deviceConfiguration = 3; @@ -511,8 +539,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceRequestAllocationResult results = 1; // This field is a combination of all the claim and class configuration parameters. @@ -525,8 +553,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=64 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 repeated DeviceAllocationConfiguration config = 2; } @@ -535,31 +563,75 @@ message DeviceAttribute { // IntValue is a number. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional int64 int = 2; // BoolValue is a true/false value. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional bool bool = 3; // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional string string = 4; // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional string version = 5; + + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated int64 ints = 6; + + // BoolValues is a non-empty list of true/false values. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated bool bools = 7; + + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated string strings = 8; + + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated string versions = 9; } // DeviceCapacity describes a quantity associated with a device. @@ -595,11 +667,11 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceRequest requests = 1; // These constraints must be satisfied by the set of devices that get @@ -607,8 +679,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceConstraint constraints = 2; // This field holds configuration for multiple potential drivers which @@ -617,8 +689,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceClaimConfiguration config = 3; } @@ -633,10 +705,10 @@ message DeviceClaimConfiguration { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 1; optional DeviceConfiguration deviceConfiguration = 2; @@ -652,8 +724,8 @@ message DeviceClaimConfiguration { message DeviceClass { // Standard object metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines what can be allocated and how to configure it. @@ -689,8 +761,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 1; // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -701,8 +773,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceClassConfiguration config = 2; // ExtendedResourceName is the extended resource name for the devices of this class. @@ -714,11 +786,11 @@ message DeviceClassSpec { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:optional - // +k8s:format=k8s-extended-resource-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name optional string extendedResourceName = 4; } @@ -730,7 +802,7 @@ message DeviceConfiguration { // // +optional // +oneOf=ConfigurationType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional OpaqueDeviceConfiguration opaque = 1; } @@ -748,10 +820,10 @@ message DeviceConstraint { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 1; // MatchAttribute requires that all devices in question have this @@ -765,17 +837,27 @@ message DeviceConstraint { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as singleton sets for backward compatibility. + // // Must include the domain qualifier. // // +optional // +oneOf=ConstraintType - // +k8s:optional - // +k8s:format=k8s-resource-fully-qualified-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name optional string matchAttribute = 2; // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device @@ -797,8 +879,8 @@ message DeviceCounterConsumption { // counters defined will be consumed. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name optional string counterSet = 1; // Counters defines the counters that will be consumed by the device. @@ -806,6 +888,8 @@ message DeviceCounterConsumption { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -851,8 +935,8 @@ message DeviceRequest { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -878,7 +962,7 @@ message DeviceRequest { // requests with unknown modes. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -928,11 +1012,11 @@ message DeviceRequest { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 repeated DeviceSubRequest firstAvailable = 7; // If specified, the request's tolerations. @@ -953,12 +1037,13 @@ message DeviceRequest { // This field can only be set when deviceClassName is set and no subrequests // are specified in the firstAvailable list. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 8; // Capacity define resource requirements against each capacity. @@ -1000,8 +1085,9 @@ message DeviceRequestAllocationResult { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:format=k8s-long-name-caseless - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 optional string driver = 2; // This name together with the driver name and the device name field @@ -1011,8 +1097,8 @@ message DeviceRequestAllocationResult { // DNS sub-domains separated by slashes. // // +required - // +k8s:required - // +k8s:format=k8s-resource-pool-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name optional string pool = 3; // Device references one device instance via its name in the driver's @@ -1038,40 +1124,40 @@ message DeviceRequestAllocationResult { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:optional - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 repeated DeviceToleration tolerations = 6; // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingConditions = 7; // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingFailureConditions = 8; // ShareID uniquely identifies an individual allocation share of the device, @@ -1081,8 +1167,8 @@ message DeviceRequestAllocationResult { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid optional string shareID = 9; // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1140,8 +1226,8 @@ message DeviceSubRequest { // to reference. // // +required - // +k8s:required - // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name optional string deviceClassName = 2; // Selectors define criteria which must be satisfied by a specific @@ -1151,7 +1237,8 @@ message DeviceSubRequest { // // +optional // +listType=atomic - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -1173,6 +1260,7 @@ message DeviceSubRequest { // requests with unknown modes. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1197,12 +1285,13 @@ message DeviceSubRequest { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 7; // Capacity define resource requirements against each capacity. @@ -1249,12 +1338,21 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string effect = 3; - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time timeAdded = 4; } @@ -1267,8 +1365,8 @@ message DeviceToleration { // Must be a label name. // // +optional - // +k8s:optional - // +k8s:format=k8s-label-key + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key optional string key = 1; // Operator represents a key's relationship to the value. @@ -1278,6 +1376,7 @@ message DeviceToleration { // // +optional // +default="Equal" + // +k8s:alpha(since: "1.36")=+k8s:optional optional string operator = 2; // Value is the taint value the toleration matches to. @@ -1291,6 +1390,7 @@ message DeviceToleration { // When specified, allowed values are NoSchedule and NoExecute. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string effect = 4; // TolerationSeconds represents the period of time the toleration (which must be @@ -1312,11 +1412,11 @@ message NetworkDeviceData { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 optional string interfaceName = 1; // IPs lists the network addresses assigned to the device's network interface. @@ -1329,22 +1429,60 @@ message NetworkDeviceData { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 repeated string ips = 2; // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=128 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 optional string hardwareAddress = 3; } +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +message NodeAllocatableResourceMapping { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + // +optional + optional string capacityKey = 1; + + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity allocationMultiplier = 2; +} + // OpaqueDeviceConfiguration contains configuration parameters for a driver // in a format defined by the driver vendor. message OpaqueDeviceConfiguration { @@ -1358,8 +1496,9 @@ message OpaqueDeviceConfiguration { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:required - // +k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless optional string driver = 1; // Parameters can contain arbitrary data. It is the responsibility of @@ -1388,7 +1527,7 @@ message ResourceClaim { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:immutable optional ResourceClaimSpec spec = 2; // Status describes whether the claim is ready to use and what has been allocated. @@ -1443,8 +1582,8 @@ message ResourceClaimStatus { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:optional - // +k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify optional AllocationResult allocation = 1; // ReservedFor indicates which entities are currently allowed to use @@ -1472,10 +1611,10 @@ message ResourceClaimStatus { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=uid - // +k8s:maxItems=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid + // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 repeated ResourceClaimConsumerReference reservedFor = 2; // Devices contains the status of each device allocated for this @@ -1483,18 +1622,18 @@ message ResourceClaimStatus { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:listType=map - // +k8s:listMapKey=driver - // +k8s:listMapKey=device - // +k8s:listMapKey=pool - // +k8s:listMapKey=shareID + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID repeated AllocatedDeviceStatus devices = 4; } @@ -1608,6 +1747,7 @@ message ResourceSlice { // Contains the information published by the driver. // // Changing the spec automatically increments the metadata.generation number. + // +required optional ResourceSliceSpec spec = 2; } @@ -1682,7 +1822,7 @@ message ResourceSliceSpec { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +zeroOrOneOf=ResourceSliceType repeated Device devices = 6; @@ -1708,14 +1848,14 @@ message ResourceSliceSpec { // The maximum number of counter sets is 8. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 repeated CounterSet sharedCounters = 8; } diff --git a/vendor/k8s.io/api/resource/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/resource/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index e47160fb83..0000000000 --- a/vendor/k8s.io/api/resource/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*AllocatedDeviceStatus) ProtoMessage() {} - -func (*AllocationResult) ProtoMessage() {} - -func (*BasicDevice) ProtoMessage() {} - -func (*CELDeviceSelector) ProtoMessage() {} - -func (*CapacityRequestPolicy) ProtoMessage() {} - -func (*CapacityRequestPolicyRange) ProtoMessage() {} - -func (*CapacityRequirements) ProtoMessage() {} - -func (*Counter) ProtoMessage() {} - -func (*CounterSet) ProtoMessage() {} - -func (*Device) ProtoMessage() {} - -func (*DeviceAllocationConfiguration) ProtoMessage() {} - -func (*DeviceAllocationResult) ProtoMessage() {} - -func (*DeviceAttribute) ProtoMessage() {} - -func (*DeviceCapacity) ProtoMessage() {} - -func (*DeviceClaim) ProtoMessage() {} - -func (*DeviceClaimConfiguration) ProtoMessage() {} - -func (*DeviceClass) ProtoMessage() {} - -func (*DeviceClassConfiguration) ProtoMessage() {} - -func (*DeviceClassList) ProtoMessage() {} - -func (*DeviceClassSpec) ProtoMessage() {} - -func (*DeviceConfiguration) ProtoMessage() {} - -func (*DeviceConstraint) ProtoMessage() {} - -func (*DeviceCounterConsumption) ProtoMessage() {} - -func (*DeviceRequest) ProtoMessage() {} - -func (*DeviceRequestAllocationResult) ProtoMessage() {} - -func (*DeviceSelector) ProtoMessage() {} - -func (*DeviceSubRequest) ProtoMessage() {} - -func (*DeviceTaint) ProtoMessage() {} - -func (*DeviceToleration) ProtoMessage() {} - -func (*NetworkDeviceData) ProtoMessage() {} - -func (*OpaqueDeviceConfiguration) ProtoMessage() {} - -func (*ResourceClaim) ProtoMessage() {} - -func (*ResourceClaimConsumerReference) ProtoMessage() {} - -func (*ResourceClaimList) ProtoMessage() {} - -func (*ResourceClaimSpec) ProtoMessage() {} - -func (*ResourceClaimStatus) ProtoMessage() {} - -func (*ResourceClaimTemplate) ProtoMessage() {} - -func (*ResourceClaimTemplateList) ProtoMessage() {} - -func (*ResourceClaimTemplateSpec) ProtoMessage() {} - -func (*ResourcePool) ProtoMessage() {} - -func (*ResourceSlice) ProtoMessage() {} - -func (*ResourceSliceList) ProtoMessage() {} - -func (*ResourceSliceSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/resource/v1beta1/types.go b/vendor/k8s.io/api/resource/v1beta1/types.go index c55e2e92c9..0d35ac9895 100644 --- a/vendor/k8s.io/api/resource/v1beta1/types.go +++ b/vendor/k8s.io/api/resource/v1beta1/types.go @@ -35,6 +35,10 @@ const ( // special ResourceClaim. Its single valid value is "true". // This is used only inside the scheduler. ExtendedResourceClaimAnnotation = "resource.kubernetes.io/extended-resource-claim" + // PodResourceClaimAnnotation is the annotation set on template-generated + // ResourceClaims by the ResourceClaim controller. Its value is the + // pod.spec.resourceClaims[].name for which the claim was generated. + PodResourceClaimAnnotation = "resource.kubernetes.io/pod-claim-name" // Resource device class prefix is for generating implicit extended resource // name for a device class when its ExtendedResourceName field is not // specified. The generated name is this prefix + the device class name. @@ -82,6 +86,7 @@ type ResourceSlice struct { // Contains the information published by the driver. // // Changing the spec automatically increments the metadata.generation number. + // +required Spec ResourceSliceSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -155,7 +160,7 @@ type ResourceSliceSpec struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +zeroOrOneOf=ResourceSliceType Devices []Device `json:"devices,omitempty" protobuf:"bytes,6,name=devices"` @@ -181,14 +186,14 @@ type ResourceSliceSpec struct { // The maximum number of counter sets is 8. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 SharedCounters []CounterSet `json:"sharedCounters,omitempty" protobuf:"bytes,8,name=sharedCounters"` } @@ -205,8 +210,8 @@ type CounterSet struct { // It must be a DNS label. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name Name string `json:"name" protobuf:"bytes,1,name=name"` // Counters defines the set of counters for this CounterSet @@ -215,6 +220,8 @@ type CounterSet struct { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,name=counters"` } @@ -269,7 +276,14 @@ type ResourcePool struct { const ResourceSliceMaxSharedCapacity = 128 const ResourceSliceMaxDevices = 128 -const ResourceSliceMaxDevicesWithTaintsOrConsumesCounters = 64 + +// ResourceSliceMaxDevicesWithAdvancedFeatures defines the maximum number of devices in a ResourceSlice +// if any of those devices uses advanced features: +// - device taints (DRADeviceTaints feature gate) +// - consuming counters (DRAPartitionableDevices feature gate) +// - list attributes (DRAListTypeAttributes feature gate) +const ResourceSliceMaxDevicesWithAdvancedFeatures = 64 + const PoolNameMaxLength = validation.DNS1123SubdomainMaxLength // Same as for a single node name. const BindingConditionsMaxSize = 4 const BindingFailureConditionsMaxSize = 4 @@ -304,6 +318,7 @@ type Device struct { // // +optional // +oneOf=deviceType + // +k8s:alpha(since: "1.36")=+k8s:optional Basic *BasicDevice `json:"basic,omitempty" protobuf:"bytes,2,opt,name=basic"` } @@ -315,6 +330,7 @@ type BasicDevice struct { // The maximum number of attributes and capacities combined is 32. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Attributes map[QualifiedName]DeviceAttribute `json:"attributes,omitempty" protobuf:"bytes,1,rep,name=attributes"` // Capacity defines the set of capacities for this device. @@ -335,13 +351,13 @@ type BasicDevice struct { // device is 2. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=counterSet + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:maxItems=2 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 ConsumesCounters []DeviceCounterConsumption `json:"consumesCounters,omitempty" protobuf:"bytes,3,rep,name=consumesCounters"` // NodeName identifies the node where the device is available. @@ -381,12 +397,13 @@ type BasicDevice struct { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Taints []DeviceTaint `json:"taints,omitempty" protobuf:"bytes,7,rep,name=taints"` // BindsToNode indicates if the usage of an allocation involving this device @@ -394,7 +411,7 @@ type BasicDevice struct { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional @@ -410,14 +427,14 @@ type BasicDevice struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,9,rep,name=bindingConditions"` // BindingFailureConditions defines the conditions for binding failure. @@ -428,14 +445,14 @@ type BasicDevice struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,10,rep,name=bindingFailureConditions"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -446,6 +463,59 @@ type BasicDevice struct { // +optional // +featureGate=DRAConsumableCapacity AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty" protobuf:"bytes,11,opt,name=allowMultipleAllocations"` + + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + // +optional + // +featureGate=DRANodeAllocatableResources + NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,12,opt,name=nodeAllocatableResourceMappings"` +} + +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +type NodeAllocatableResourceMapping struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + // +optional + CapacityKey *QualifiedName `json:"capacityKey,omitempty" protobuf:"bytes,1,opt,name=capacityKey"` + + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty" protobuf:"bytes,2,opt,name=allocationMultiplier"` } // DeviceCounterConsumption defines a set of counters that @@ -455,8 +525,8 @@ type DeviceCounterConsumption struct { // counters defined will be consumed. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name CounterSet string `json:"counterSet" protobuf:"bytes,1,opt,name=counterSet"` // Counters defines the counters that will be consumed by the device. @@ -464,6 +534,8 @@ type DeviceCounterConsumption struct { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,opt,name=counters"` } @@ -576,6 +648,10 @@ type CapacityRequestPolicyRange struct { // Limit for the sum of the number of entries in both attributes and capacity. const ResourceSliceMaxAttributesAndCapacitiesPerDevice = 32 +// Limit per device for the total number of string, version, bool or int values +// in list and non-list attributes. +const ResourceSliceMaxAttributeValuesPerDevice = 48 + // QualifiedName is the name of a device attribute or capacity. // // Attributes and capacities are defined either by the owner of the specific @@ -615,31 +691,75 @@ type DeviceAttribute struct { // IntValue is a number. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember IntValue *int64 `json:"int,omitempty" protobuf:"varint,2,opt,name=int"` // BoolValue is a true/false value. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember BoolValue *bool `json:"bool,omitempty" protobuf:"varint,3,opt,name=bool"` // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember StringValue *string `json:"string,omitempty" protobuf:"bytes,4,opt,name=string"` // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember VersionValue *string `json:"version,omitempty" protobuf:"bytes,5,opt,name=version"` + + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + IntValues []int64 `json:"ints,omitempty" protobuf:"varint,6,opt,name=ints"` + + // BoolValues is a non-empty list of true/false values. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + BoolValues []bool `json:"bools,omitempty" protobuf:"varint,7,opt,name=bools"` + + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + StringValues []string `json:"strings,omitempty" protobuf:"bytes,8,opt,name=strings"` + + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + VersionValues []string `json:"versions,omitempty" protobuf:"bytes,9,opt,name=versions"` } // DeviceAttributeMaxValueLength is the maximum length of a string or version attribute value. @@ -674,7 +794,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -690,9 +810,18 @@ type DeviceTaint struct { // which will enable adding new enums within a single release without // ratcheting. - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional TimeAdded *metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"` @@ -704,7 +833,7 @@ type DeviceTaint struct { } // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceTaintEffect string const ( @@ -737,7 +866,7 @@ type ResourceSliceList struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.32 -// +k8s:supportsSubresource=/status +// +k8s:supportsSubresource="/status" // ResourceClaim describes a request for access to resources in the cluster, // for use by workloads. For example, if a workload needs an accelerator device @@ -755,7 +884,7 @@ type ResourceClaim struct { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:immutable Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` // Status describes whether the claim is ready to use and what has been allocated. @@ -783,11 +912,11 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []DeviceRequest `json:"requests" protobuf:"bytes,1,name=requests"` // These constraints must be satisfied by the set of devices that get @@ -795,8 +924,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Constraints []DeviceConstraint `json:"constraints,omitempty" protobuf:"bytes,2,opt,name=constraints"` // This field holds configuration for multiple potential drivers which @@ -805,8 +934,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Config []DeviceClaimConfiguration `json:"config,omitempty" protobuf:"bytes,3,opt,name=config"` // Potential future extension, ignored by older schedulers. This is @@ -873,8 +1002,8 @@ type DeviceRequest struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -900,7 +1029,7 @@ type DeviceRequest struct { // requests with unknown modes. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -950,11 +1079,11 @@ type DeviceRequest struct { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 FirstAvailable []DeviceSubRequest `json:"firstAvailable,omitempty" protobuf:"bytes,7,name=firstAvailable"` // If specified, the request's tolerations. @@ -975,12 +1104,13 @@ type DeviceRequest struct { // This field can only be set when deviceClassName is set and no subrequests // are specified in the firstAvailable list. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,8,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1033,8 +1163,8 @@ type DeviceSubRequest struct { // to reference. // // +required - // +k8s:required - // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name DeviceClassName string `json:"deviceClassName" protobuf:"bytes,2,name=deviceClassName"` // Selectors define criteria which must be satisfied by a specific @@ -1044,7 +1174,8 @@ type DeviceSubRequest struct { // // +optional // +listType=atomic - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1066,6 +1197,7 @@ type DeviceSubRequest struct { // requests with unknown modes. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1090,12 +1222,13 @@ type DeviceSubRequest struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,7,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1152,7 +1285,7 @@ const ( ) // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceAllocationMode string // Valid [DeviceRequest.CountMode] values. @@ -1221,6 +1354,14 @@ type CELDeviceSelector struct { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. @@ -1271,10 +1412,10 @@ type DeviceConstraint struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` // MatchAttribute requires that all devices in question have this @@ -1288,12 +1429,17 @@ type DeviceConstraint struct { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as singleton sets for backward compatibility. + // // Must include the domain qualifier. // // +optional // +oneOf=ConstraintType - // +k8s:optional - // +k8s:format=k8s-resource-fully-qualified-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name MatchAttribute *FullyQualifiedName `json:"matchAttribute,omitempty" protobuf:"bytes,2,opt,name=matchAttribute"` // Potential future extension, not part of the current design: @@ -1309,6 +1455,11 @@ type DeviceConstraint struct { // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device @@ -1334,10 +1485,10 @@ type DeviceClaimConfiguration struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` DeviceConfiguration `json:",inline" protobuf:"bytes,2,name=deviceConfiguration"` @@ -1351,7 +1502,7 @@ type DeviceConfiguration struct { // // +optional // +oneOf=ConfigurationType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional Opaque *OpaqueDeviceConfiguration `json:"opaque,omitempty" protobuf:"bytes,1,opt,name=opaque"` } @@ -1368,8 +1519,9 @@ type OpaqueDeviceConfiguration struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:required - // +k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless Driver string `json:"driver" protobuf:"bytes,1,name=driver"` // Parameters can contain arbitrary data. It is the responsibility of @@ -1395,8 +1547,8 @@ type DeviceToleration struct { // Must be a label name. // // +optional - // +k8s:optional - // +k8s:format=k8s-label-key + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` // Operator represents a key's relationship to the value. @@ -1406,6 +1558,7 @@ type DeviceToleration struct { // // +optional // +default="Equal" + // +k8s:alpha(since: "1.36")=+k8s:optional Operator DeviceTolerationOperator `json:"operator,omitempty" protobuf:"bytes,2,opt,name=operator,casttype=DeviceTolerationOperator"` // Value is the taint value the toleration matches to. @@ -1419,6 +1572,7 @@ type DeviceToleration struct { // When specified, allowed values are NoSchedule and NoExecute. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Effect DeviceTaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=DeviceTaintEffect"` // TolerationSeconds represents the period of time the toleration (which must be @@ -1435,7 +1589,7 @@ type DeviceToleration struct { // A toleration operator is the set of operators that can be used in a toleration. // // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceTolerationOperator string const ( @@ -1449,8 +1603,8 @@ type ResourceClaimStatus struct { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:optional - // +k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,1,opt,name=allocation"` // ReservedFor indicates which entities are currently allowed to use @@ -1478,10 +1632,10 @@ type ResourceClaimStatus struct { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=uid - // +k8s:maxItems=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid + // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 ReservedFor []ResourceClaimConsumerReference `json:"reservedFor,omitempty" protobuf:"bytes,2,opt,name=reservedFor" patchStrategy:"merge" patchMergeKey:"uid"` // DeallocationRequested is tombstoned since Kubernetes 1.32 where @@ -1494,18 +1648,18 @@ type ResourceClaimStatus struct { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:listType=map - // +k8s:listMapKey=driver - // +k8s:listMapKey=device - // +k8s:listMapKey=pool - // +k8s:listMapKey=shareID + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"` } @@ -1554,7 +1708,7 @@ type AllocationResult struct { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. // // +optional @@ -1568,8 +1722,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Results []DeviceRequestAllocationResult `json:"results,omitempty" protobuf:"bytes,1,opt,name=results"` // This field is a combination of all the claim and class configuration parameters. @@ -1582,8 +1736,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=64 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 Config []DeviceAllocationConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` } @@ -1612,8 +1766,9 @@ type DeviceRequestAllocationResult struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:format=k8s-long-name-caseless - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 Driver string `json:"driver" protobuf:"bytes,2,name=driver"` // This name together with the driver name and the device name field @@ -1623,8 +1778,8 @@ type DeviceRequestAllocationResult struct { // DNS sub-domains separated by slashes. // // +required - // +k8s:required - // +k8s:format=k8s-resource-pool-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name Pool string `json:"pool" protobuf:"bytes,3,name=pool"` // Device references one device instance via its name in the driver's @@ -1650,40 +1805,40 @@ type DeviceRequestAllocationResult struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints - // +k8s:optional - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,7,rep,name=bindingConditions"` // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,8,rep,name=bindingFailureConditions"` // ShareID uniquely identifies an individual allocation share of the device, @@ -1693,8 +1848,8 @@ type DeviceRequestAllocationResult struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid ShareID *types.UID `json:"shareID,omitempty" protobuf:"bytes,9,opt,name=shareID"` // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1718,7 +1873,7 @@ type DeviceAllocationConfiguration struct { // or from a claim. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Source AllocationConfigSource `json:"source" protobuf:"bytes,1,name=source"` // Requests lists the names of requests where the configuration applies. @@ -1730,17 +1885,17 @@ type DeviceAllocationConfiguration struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,2,opt,name=requests"` DeviceConfiguration `json:",inline" protobuf:"bytes,3,name=deviceConfiguration"` } // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type AllocationConfigSource string // Valid [DeviceAllocationConfiguration.Source] values. @@ -1779,8 +1934,8 @@ type DeviceClass struct { metav1.TypeMeta `json:",inline"` // Standard object metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines what can be allocated and how to configure it. @@ -1801,8 +1956,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,1,opt,name=selectors"` // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -1813,8 +1968,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Config []DeviceClassConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` // SuitableNodes is tombstoned since Kubernetes 1.32 where @@ -1831,11 +1986,11 @@ type DeviceClassSpec struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:optional - // +k8s:format=k8s-extended-resource-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name ExtendedResourceName *string `json:"extendedResourceName,omitempty" protobuf:"bytes,4,opt,name=extendedResourceName"` } @@ -1961,8 +2116,8 @@ type AllocatedDeviceStatus struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid ShareID *string `json:"shareID,omitempty" protobuf:"bytes,7,opt,name=shareID"` // Conditions contains the latest observation of the device's state. @@ -1986,7 +2141,7 @@ type AllocatedDeviceStatus struct { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"` } @@ -1998,11 +2153,11 @@ type NetworkDeviceData struct { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"` // IPs lists the network addresses assigned to the device's network interface. @@ -2015,18 +2170,18 @@ type NetworkDeviceData struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=128 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"` } diff --git a/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go index 070536e67f..4b147a3f3e 100644 --- a/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1beta1/types_swagger_doc_generated.go @@ -46,7 +46,7 @@ var map_AllocationResult = map[string]string{ "": "AllocationResult contains attributes of an allocated resource.", "devices": "Devices is the result of allocating devices.", "nodeSelector": "NodeSelector defines where the allocated resources are available. If unset, they are available everywhere.", - "allocationTimestamp": "AllocationTimestamp stores the time when the resources were allocated. This field is not guaranteed to be set, in which case that time is unknown.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gate.", + "allocationTimestamp": "AllocationTimestamp stores the time when the resources were allocated. This field is not guaranteed to be set, in which case that time is unknown.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gate.", } func (AllocationResult) SwaggerDoc() map[string]string { @@ -54,18 +54,19 @@ func (AllocationResult) SwaggerDoc() map[string]string { } var map_BasicDevice = map[string]string{ - "": "BasicDevice defines one device instance.", - "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", - "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", - "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is true, a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "": "BasicDevice defines one device instance.", + "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", + "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is true, a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "nodeAllocatableResourceMappings": "NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", } func (BasicDevice) SwaggerDoc() map[string]string { @@ -74,7 +75,7 @@ func (BasicDevice) SwaggerDoc() map[string]string { var map_CELDeviceSelector = map[string]string{ "": "CELDeviceSelector contains a CEL expression for selecting a device.", - "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", + "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", } func (CELDeviceSelector) SwaggerDoc() map[string]string { @@ -162,11 +163,15 @@ func (DeviceAllocationResult) SwaggerDoc() map[string]string { } var map_DeviceAttribute = map[string]string{ - "": "DeviceAttribute must have exactly one field set.", - "int": "IntValue is a number.", - "bool": "BoolValue is a true/false value.", - "string": "StringValue is a string. Must not be longer than 64 characters.", - "version": "VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.", + "": "DeviceAttribute must have exactly one field set.", + "int": "IntValue is a number.", + "bool": "BoolValue is a true/false value.", + "string": "StringValue is a string. Must not be longer than 64 characters.", + "version": "VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.", + "ints": "IntValues is a non-empty list of numbers.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", + "bools": "BoolValues is a non-empty list of true/false values.", + "strings": "StringValues is a non-empty list of strings. Each string must not be longer than 64 characters.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", + "versions": "VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. Each version string must not be longer than 64 characters.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", } func (DeviceAttribute) SwaggerDoc() map[string]string { @@ -235,7 +240,7 @@ var map_DeviceClassSpec = map[string]string{ "": "DeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it.", "selectors": "Each selector must be satisfied by a device which is claimed via this class.", "config": "Config defines configuration parameters that apply to each device that is claimed via this class. Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver.\n\nThey are passed to the driver, but are not considered while allocating the claim.", - "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is an alpha field.", + "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is a beta field.", } func (DeviceClassSpec) SwaggerDoc() map[string]string { @@ -254,8 +259,8 @@ func (DeviceConfiguration) SwaggerDoc() map[string]string { var map_DeviceConstraint = map[string]string{ "": "DeviceConstraint must have exactly one field set besides Requests.", "requests": "Requests is a list of the one or more requests in this claim which must co-satisfy this constraint. If a request is fulfilled by multiple devices, then all of the devices must satisfy the constraint. If this is not specified, this constraint applies to all requests in this claim.\n\nReferences to subrequests must include the name of the main request and may include the subrequest using the format
[/]. If just the main request is given, the constraint applies to all subrequests.", - "matchAttribute": "MatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices.\n\nFor example, if you specified \"dra.example.com/numa\" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen.\n\nMust include the domain qualifier.", - "distinctAttribute": "DistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices.\n\nThis acts as the inverse of MatchAttribute.\n\nThis constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation.\n\nThis is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.", + "matchAttribute": "MatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices.\n\nFor example, if you specified \"dra.example.com/numa\" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen.\n\nWhen the DRAListTypeAttributes feature gate is enabled, comparison uses set semantics(i.e., element order and duplicates are ignored): list-valued attributes match when the intersection across all devices is non-empty. Scalar values are treated as singleton sets for backward compatibility.\n\nMust include the domain qualifier.", + "distinctAttribute": "DistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices.\n\nWhen the DRAListTypeAttributes feature gate is enabled, comparison uses set semantics (i.e., element order and duplicates are ignored): list-valued attributes must be pairwise disjoint across devices. Scalar values are treated as singleton sets for backward compatibility.\n\nThis acts as the inverse of MatchAttribute.\n\nThis constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation.\n\nThis is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.", } func (DeviceConstraint) SwaggerDoc() map[string]string { @@ -281,7 +286,7 @@ var map_DeviceRequest = map[string]string{ "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.", "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", "firstAvailable": "FirstAvailable contains subrequests, of which exactly one will be satisfied by the scheduler to satisfy this request. It tries to satisfy them in the order in which they are listed here. So if there are two entries in the list, the scheduler will only check the second one if it determines that the first one cannot be used.\n\nThis field may only be set in the entries of DeviceClaim.Requests.\n\nDRA does not yet implement scoring, so the scheduler will select the first set of devices that satisfies all the requests in the claim. And if the requirements can be satisfied on more than one node, other scheduling features will determine which node is chosen. This means that the set of devices allocated to a claim might not be the optimal set available to the cluster. Scoring will be implemented later.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", } @@ -296,9 +301,9 @@ var map_DeviceRequestAllocationResult = map[string]string{ "pool": "This name together with the driver name and the device name field identify which device was allocated (`//`).\n\nMust not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.", "device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.", "adminAccess": "AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", - "bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", "shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.", "consumedCapacity": "ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. The consumed amount may differ from the requested amount: it is rounded up to the nearest valid value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount).\n\nThe total consumed capacity for each device must not exceed the DeviceCapacity's Value.\n\nThis field is populated only for devices that allow multiple allocations. All capacity entries are included, even if the consumed amount is zero.", } @@ -323,7 +328,7 @@ var map_DeviceSubRequest = map[string]string{ "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", } @@ -336,7 +341,7 @@ var map_DeviceTaint = map[string]string{ "key": "The taint key to be applied to a device. Must be a label name.", "value": "The taint value corresponding to the taint key. Must be a label value.", "effect": "The effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them.\n\nValid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here. More effects may get added in the future. Consumers must treat unknown effects like None.", - "timeAdded": "TimeAdded represents the time at which the taint was added. Added automatically during create or update if not set.", + "timeAdded": "TimeAdded represents the time at which the taint was added or (only in a DeviceTaintRule) the effect was modified. Added automatically during create or update if not set.\n\nIn addition, in a DeviceTaintRule a value provided during an update gets replaced with the current time if the provided value is the same as the old one and the new effect is different. Changing the key and/or value while keeping the effect unchanged is possible and does not update the time stamp because the eviction which uses it is either already started (NoExecute) or not started yet (NoEffect, NoSchedule).", } func (DeviceTaint) SwaggerDoc() map[string]string { @@ -358,15 +363,25 @@ func (DeviceToleration) SwaggerDoc() map[string]string { var map_NetworkDeviceData = map[string]string{ "": "NetworkDeviceData provides network-related details for the allocated device. This information may be filled by drivers or other components to configure or identify the device within a network context.", - "interfaceName": "InterfaceName specifies the name of the network interface associated with the allocated device. This might be the name of a physical or virtual network interface being configured in the pod.\n\nMust not be longer than 256 characters.", + "interfaceName": "InterfaceName specifies the name of the network interface associated with the allocated device. This might be the name of a physical or virtual network interface being configured in the pod.\n\nMust not be longer than 256 bytes.", "ips": "IPs lists the network addresses assigned to the device's network interface. This can include both IPv4 and IPv6 addresses. The IPs are in the CIDR notation, which includes both the address and the associated subnet mask. e.g.: \"192.0.2.5/24\" for IPv4 and \"2001:db8::5/64\" for IPv6.\n\nMust not contain more than 16 entries.", - "hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 characters.", + "hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 bytes.", } func (NetworkDeviceData) SwaggerDoc() map[string]string { return map_NetworkDeviceData } +var map_NodeAllocatableResourceMapping = map[string]string{ + "": "NodeAllocatableResourceMapping defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource.", + "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. If `allocationMultiplier` is also set, it is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\", and `allocationMultiplier` should be omitted or set to \"1\".", + "allocationMultiplier": "AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.\n\t a. A DRA driver representing each CPU core as a device would have\n {ResourceName: \"cpu\", allocationMultiplier: \"2\"} in its\n `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,\n\t\t 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.\n b. A GPU device that needs additional node memory per GPU allocation would\n have {ResourceName: \"memory\", allocationMultiplier: \"2Gi\"}. Each allocated\n\t\t GPU device instance of this type will account for 2Gi of memory.\n\n2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.\n\t The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.\n For example, if a Device's capacity \"dra.example.com/cores\" is consumed,\n and each \"core\" provides 2 \"cpu\"s, the mapping would be:\n {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", allocationMultiplier: \"2\"}.\n If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", +} + +func (NodeAllocatableResourceMapping) SwaggerDoc() map[string]string { + return map_NodeAllocatableResourceMapping +} + var map_OpaqueDeviceConfiguration = map[string]string{ "": "OpaqueDeviceConfiguration contains configuration parameters for a driver in a format defined by the driver vendor.", "driver": "Driver is used to determine which kubelet plugin needs to be passed these configuration parameters.\n\nAn admission policy provided by the driver developer could use this to decide whether it needs to validate them.\n\nMust be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver. It should use only lower case characters.", diff --git a/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go index 156fea79ba..78ec7b0d58 100644 --- a/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1beta1/zz_generated.deepcopy.go @@ -159,6 +159,13 @@ func (in *BasicDevice) DeepCopyInto(out *BasicDevice) { *out = new(bool) **out = **in } + if in.NodeAllocatableResourceMappings != nil { + in, out := &in.NodeAllocatableResourceMappings, &out.NodeAllocatableResourceMappings + *out = make(map[corev1.ResourceName]NodeAllocatableResourceMapping, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } return } @@ -411,6 +418,26 @@ func (in *DeviceAttribute) DeepCopyInto(out *DeviceAttribute) { *out = new(string) **out = **in } + if in.IntValues != nil { + in, out := &in.IntValues, &out.IntValues + *out = make([]int64, len(*in)) + copy(*out, *in) + } + if in.BoolValues != nil { + in, out := &in.BoolValues, &out.BoolValues + *out = make([]bool, len(*in)) + copy(*out, *in) + } + if in.StringValues != nil { + in, out := &in.StringValues, &out.StringValues + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.VersionValues != nil { + in, out := &in.VersionValues, &out.VersionValues + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -907,6 +934,32 @@ func (in *NetworkDeviceData) DeepCopy() *NetworkDeviceData { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResourceMapping) DeepCopyInto(out *NodeAllocatableResourceMapping) { + *out = *in + if in.CapacityKey != nil { + in, out := &in.CapacityKey, &out.CapacityKey + *out = new(QualifiedName) + **out = **in + } + if in.AllocationMultiplier != nil { + in, out := &in.AllocationMultiplier, &out.AllocationMultiplier + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceMapping. +func (in *NodeAllocatableResourceMapping) DeepCopy() *NodeAllocatableResourceMapping { + if in == nil { + return nil + } + out := new(NodeAllocatableResourceMapping) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OpaqueDeviceConfiguration) DeepCopyInto(out *OpaqueDeviceConfiguration) { *out = *in diff --git a/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go index 0d4983d34e..a2887e7534 100644 --- a/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1beta1/zz_generated.model_name.go @@ -171,6 +171,11 @@ func (in NetworkDeviceData) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta1.NetworkDeviceData" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableResourceMapping) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in OpaqueDeviceConfiguration) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta1.OpaqueDeviceConfiguration" diff --git a/vendor/k8s.io/api/resource/v1beta2/generated.pb.go b/vendor/k8s.io/api/resource/v1beta2/generated.pb.go index 5a36e6d2b5..6b59098807 100644 --- a/vendor/k8s.io/api/resource/v1beta2/generated.pb.go +++ b/vendor/k8s.io/api/resource/v1beta2/generated.pb.go @@ -25,6 +25,7 @@ import ( io "io" "sort" + k8s_io_api_core_v1 "k8s.io/api/core/v1" v11 "k8s.io/api/core/v1" resource "k8s.io/apimachinery/pkg/api/resource" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -91,12 +92,24 @@ func (m *DeviceSubRequest) Reset() { *m = DeviceSubRequest{} } func (m *DeviceTaint) Reset() { *m = DeviceTaint{} } +func (m *DeviceTaintRule) Reset() { *m = DeviceTaintRule{} } + +func (m *DeviceTaintRuleList) Reset() { *m = DeviceTaintRuleList{} } + +func (m *DeviceTaintRuleSpec) Reset() { *m = DeviceTaintRuleSpec{} } + +func (m *DeviceTaintRuleStatus) Reset() { *m = DeviceTaintRuleStatus{} } + +func (m *DeviceTaintSelector) Reset() { *m = DeviceTaintSelector{} } + func (m *DeviceToleration) Reset() { *m = DeviceToleration{} } func (m *ExactDeviceRequest) Reset() { *m = ExactDeviceRequest{} } func (m *NetworkDeviceData) Reset() { *m = NetworkDeviceData{} } +func (m *NodeAllocatableResourceMapping) Reset() { *m = NodeAllocatableResourceMapping{} } + func (m *OpaqueDeviceConfiguration) Reset() { *m = OpaqueDeviceConfiguration{} } func (m *ResourceClaim) Reset() { *m = ResourceClaim{} } @@ -573,6 +586,35 @@ func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.NodeAllocatableResourceMappings) > 0 { + keysForNodeAllocatableResourceMappings := make([]string, 0, len(m.NodeAllocatableResourceMappings)) + for k := range m.NodeAllocatableResourceMappings { + keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + } + sort.Strings(keysForNodeAllocatableResourceMappings) + for iNdEx := len(keysForNodeAllocatableResourceMappings) - 1; iNdEx >= 0; iNdEx-- { + v := m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(keysForNodeAllocatableResourceMappings[iNdEx])] + baseI := i + { + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(keysForNodeAllocatableResourceMappings[iNdEx]) + copy(dAtA[i:], keysForNodeAllocatableResourceMappings[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForNodeAllocatableResourceMappings[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x6a + } + } if m.AllowMultipleAllocations != nil { i-- if *m.AllowMultipleAllocations { @@ -852,6 +894,43 @@ func (m *DeviceAttribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.VersionValues) > 0 { + for iNdEx := len(m.VersionValues) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.VersionValues[iNdEx]) + copy(dAtA[i:], m.VersionValues[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.VersionValues[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if len(m.StringValues) > 0 { + for iNdEx := len(m.StringValues) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.StringValues[iNdEx]) + copy(dAtA[i:], m.StringValues[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.StringValues[iNdEx]))) + i-- + dAtA[i] = 0x42 + } + } + if len(m.BoolValues) > 0 { + for iNdEx := len(m.BoolValues) - 1; iNdEx >= 0; iNdEx-- { + i-- + if m.BoolValues[iNdEx] { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + } + if len(m.IntValues) > 0 { + for iNdEx := len(m.IntValues) - 1; iNdEx >= 0; iNdEx-- { + i = encodeVarintGenerated(dAtA, i, uint64(m.IntValues[iNdEx])) + i-- + dAtA[i] = 0x30 + } + } if m.VersionValue != nil { i -= len(*m.VersionValue) copy(dAtA[i:], *m.VersionValue) @@ -1696,6 +1775,232 @@ func (m *DeviceTaint) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DeviceTaintRule) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceTaintRule) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceTaintRule) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DeviceTaintRuleList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceTaintRuleList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceTaintRuleList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *DeviceTaintRuleSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceTaintRuleSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceTaintRuleSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Taint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.DeviceSelector != nil { + { + size, err := m.DeviceSelector.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DeviceTaintRuleStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceTaintRuleStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceTaintRuleStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *DeviceTaintSelector) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DeviceTaintSelector) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DeviceTaintSelector) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Device != nil { + i -= len(*m.Device) + copy(dAtA[i:], *m.Device) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Device))) + i-- + dAtA[i] = 0x22 + } + if m.Pool != nil { + i -= len(*m.Pool) + copy(dAtA[i:], *m.Pool) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Pool))) + i-- + dAtA[i] = 0x1a + } + if m.Driver != nil { + i -= len(*m.Driver) + copy(dAtA[i:], *m.Driver) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.Driver))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + func (m *DeviceToleration) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1872,7 +2177,7 @@ func (m *NetworkDeviceData) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { +func (m *NodeAllocatableResourceMapping) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1882,29 +2187,71 @@ func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *OpaqueDeviceConfiguration) MarshalTo(dAtA []byte) (int, error) { +func (m *NodeAllocatableResourceMapping) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *OpaqueDeviceConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *NodeAllocatableResourceMapping) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Parameters.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.AllocationMultiplier != nil { + { + size, err := m.AllocationMultiplier.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 - i -= len(m.Driver) - copy(dAtA[i:], m.Driver) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) + if m.CapacityKey != nil { + i -= len(*m.CapacityKey) + copy(dAtA[i:], *m.CapacityKey) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.CapacityKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *OpaqueDeviceConfiguration) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OpaqueDeviceConfiguration) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OpaqueDeviceConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Parameters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(m.Driver) + copy(dAtA[i:], m.Driver) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Driver))) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -2745,6 +3092,15 @@ func (m *Device) Size() (n int) { if m.AllowMultipleAllocations != nil { n += 2 } + if len(m.NodeAllocatableResourceMappings) > 0 { + for k, v := range m.NodeAllocatableResourceMappings { + _ = k + _ = v + l = v.Size() + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + l + sovGenerated(uint64(l)) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) + } + } return n } @@ -2808,6 +3164,26 @@ func (m *DeviceAttribute) Size() (n int) { l = len(*m.VersionValue) n += 1 + l + sovGenerated(uint64(l)) } + if len(m.IntValues) > 0 { + for _, e := range m.IntValues { + n += 1 + sovGenerated(uint64(e)) + } + } + if len(m.BoolValues) > 0 { + n += 2 * len(m.BoolValues) + } + if len(m.StringValues) > 0 { + for _, s := range m.StringValues { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.VersionValues) > 0 { + for _, s := range m.VersionValues { + l = len(s) + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -3128,6 +3504,89 @@ func (m *DeviceTaint) Size() (n int) { return n } +func (m *DeviceTaintRule) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *DeviceTaintRuleList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DeviceTaintRuleSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.DeviceSelector != nil { + l = m.DeviceSelector.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = m.Taint.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *DeviceTaintRuleStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *DeviceTaintSelector) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Driver != nil { + l = len(*m.Driver) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Pool != nil { + l = len(*m.Pool) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Device != nil { + l = len(*m.Device) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *DeviceToleration) Size() (n int) { if m == nil { return 0 @@ -3200,6 +3659,23 @@ func (m *NetworkDeviceData) Size() (n int) { return n } +func (m *NodeAllocatableResourceMapping) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CapacityKey != nil { + l = len(*m.CapacityKey) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.AllocationMultiplier != nil { + l = m.AllocationMultiplier.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *OpaqueDeviceConfiguration) Size() (n int) { if m == nil { return 0 @@ -3586,6 +4062,16 @@ func (this *Device) String() string { mapStringForCapacity += fmt.Sprintf("%v: %v,", k, this.Capacity[QualifiedName(k)]) } mapStringForCapacity += "}" + keysForNodeAllocatableResourceMappings := make([]string, 0, len(this.NodeAllocatableResourceMappings)) + for k := range this.NodeAllocatableResourceMappings { + keysForNodeAllocatableResourceMappings = append(keysForNodeAllocatableResourceMappings, string(k)) + } + sort.Strings(keysForNodeAllocatableResourceMappings) + mapStringForNodeAllocatableResourceMappings := "map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping{" + for _, k := range keysForNodeAllocatableResourceMappings { + mapStringForNodeAllocatableResourceMappings += fmt.Sprintf("%v: %v,", k, this.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(k)]) + } + mapStringForNodeAllocatableResourceMappings += "}" s := strings.Join([]string{`&Device{`, `Name:` + fmt.Sprintf("%v", this.Name) + `,`, `Attributes:` + mapStringForAttributes + `,`, @@ -3599,6 +4085,7 @@ func (this *Device) String() string { `BindingConditions:` + fmt.Sprintf("%v", this.BindingConditions) + `,`, `BindingFailureConditions:` + fmt.Sprintf("%v", this.BindingFailureConditions) + `,`, `AllowMultipleAllocations:` + valueToStringGenerated(this.AllowMultipleAllocations) + `,`, + `NodeAllocatableResourceMappings:` + mapStringForNodeAllocatableResourceMappings + `,`, `}`, }, "") return s @@ -3645,6 +4132,10 @@ func (this *DeviceAttribute) String() string { `BoolValue:` + valueToStringGenerated(this.BoolValue) + `,`, `StringValue:` + valueToStringGenerated(this.StringValue) + `,`, `VersionValue:` + valueToStringGenerated(this.VersionValue) + `,`, + `IntValues:` + fmt.Sprintf("%v", this.IntValues) + `,`, + `BoolValues:` + fmt.Sprintf("%v", this.BoolValues) + `,`, + `StringValues:` + fmt.Sprintf("%v", this.StringValues) + `,`, + `VersionValues:` + fmt.Sprintf("%v", this.VersionValues) + `,`, `}`, }, "") return s @@ -3887,6 +4378,72 @@ func (this *DeviceSubRequest) String() string { }, "") return s } +func (this *DeviceTaintRule) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceTaintRule{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "DeviceTaintRuleSpec", "DeviceTaintRuleSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "DeviceTaintRuleStatus", "DeviceTaintRuleStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRuleList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]DeviceTaintRule{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "DeviceTaintRule", "DeviceTaintRule", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&DeviceTaintRuleList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRuleSpec) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceTaintRuleSpec{`, + `DeviceSelector:` + strings.Replace(this.DeviceSelector.String(), "DeviceTaintSelector", "DeviceTaintSelector", 1) + `,`, + `Taint:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Taint), "DeviceTaint", "DeviceTaint", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintRuleStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + s := strings.Join([]string{`&DeviceTaintRuleStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `}`, + }, "") + return s +} +func (this *DeviceTaintSelector) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DeviceTaintSelector{`, + `Driver:` + valueToStringGenerated(this.Driver) + `,`, + `Pool:` + valueToStringGenerated(this.Pool) + `,`, + `Device:` + valueToStringGenerated(this.Device) + `,`, + `}`, + }, "") + return s +} func (this *DeviceToleration) String() string { if this == nil { return "nil" @@ -3939,6 +4496,17 @@ func (this *NetworkDeviceData) String() string { }, "") return s } +func (this *NodeAllocatableResourceMapping) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NodeAllocatableResourceMapping{`, + `CapacityKey:` + valueToStringGenerated(this.CapacityKey) + `,`, + `AllocationMultiplier:` + strings.Replace(fmt.Sprintf("%v", this.AllocationMultiplier), "Quantity", "resource.Quantity", 1) + `,`, + `}`, + }, "") + return s +} func (this *OpaqueDeviceConfiguration) String() string { if this == nil { return "nil" @@ -6027,61 +6595,11 @@ func (m *Device) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.AllowMultipleAllocations = &b - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceAllocationConfiguration: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceAllocationConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 13: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NodeAllocatableResourceMappings", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -6091,23 +6609,202 @@ func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Source = AllocationConfigSource(dAtA[iNdEx:postIndex]) + if m.NodeAllocatableResourceMappings == nil { + m.NodeAllocatableResourceMappings = make(map[k8s_io_api_core_v1.ResourceName]NodeAllocatableResourceMapping) + } + var mapkey k8s_io_api_core_v1.ResourceName + mapvalue := &NodeAllocatableResourceMapping{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = k8s_io_api_core_v1.ResourceName(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return ErrInvalidLengthGenerated + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return ErrInvalidLengthGenerated + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &NodeAllocatableResourceMapping{} + if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.NodeAllocatableResourceMappings[k8s_io_api_core_v1.ResourceName(mapkey)] = *mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceAllocationConfiguration) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceAllocationConfiguration: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceAllocationConfiguration: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = AllocationConfigSource(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -6449,76 +7146,286 @@ func (m *DeviceAttribute) Unmarshal(dAtA []byte) error { s := string(dAtA[iNdEx:postIndex]) m.VersionValue = &s iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeviceCapacity) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DeviceCapacity: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceCapacity: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break + case 6: + if wireType == 0 { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } } - } - if msglen < 0 { + m.IntValues = append(m.IntValues, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.IntValues) == 0 { + m.IntValues = make([]int64, 0, elementCount) + } + for iNdEx < postIndex { + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IntValues = append(m.IntValues, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field IntValues", wireType) + } + case 7: + if wireType == 0 { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + packedLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + elementCount = packedLen + if elementCount != 0 && len(m.BoolValues) == 0 { + m.BoolValues = make([]bool, 0, elementCount) + } + for iNdEx < postIndex { + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BoolValues = append(m.BoolValues, bool(v != 0)) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field BoolValues", wireType) + } + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field StringValues", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.StringValues = append(m.StringValues, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VersionValues", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VersionValues = append(m.VersionValues, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceCapacity) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceCapacity: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceCapacity: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen @@ -8619,33 +9526,601 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { if postIndex < 0 { return ErrInvalidLengthGenerated } - if postIndex > l { + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AllocationMode = DeviceAllocationMode(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tolerations = append(m.Tolerations, DeviceToleration{}) + if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Capacity == nil { + m.Capacity = &CapacityRequirements{} + } + if err := m.Capacity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TimeAdded == nil { + m.TimeAdded = &v1.Time{} + } + if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRule) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRuleList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRuleList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRuleList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, DeviceTaintRule{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintRuleSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.AllocationMode = DeviceAllocationMode(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) - } - m.Count = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Count |= int64(b&0x7F) << shift - if b < 0x80 { - break - } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - case 6: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintRuleSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintRuleSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tolerations", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DeviceSelector", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8672,14 +10147,16 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Tolerations = append(m.Tolerations, DeviceToleration{}) - if err := m.Tolerations[len(m.Tolerations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.DeviceSelector == nil { + m.DeviceSelector = &DeviceTaintSelector{} + } + if err := m.DeviceSelector.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 7: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Capacity", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Taint", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -8706,10 +10183,7 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Capacity == nil { - m.Capacity = &CapacityRequirements{} - } - if err := m.Capacity.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Taint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -8734,7 +10208,7 @@ func (m *DeviceSubRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeviceTaint) Unmarshal(dAtA []byte) error { +func (m *DeviceTaintRuleStatus) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -8757,17 +10231,17 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeviceTaint: wiretype end group for non-group") + return fmt.Errorf("proto: DeviceTaintRuleStatus: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeviceTaint: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeviceTaintRuleStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8777,27 +10251,79 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeviceTaintSelector) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeviceTaintSelector: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeviceTaintSelector: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Driver", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8825,11 +10351,12 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = string(dAtA[iNdEx:postIndex]) + s := string(dAtA[iNdEx:postIndex]) + m.Driver = &s iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Effect", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Pool", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -8857,13 +10384,14 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Effect = DeviceTaintEffect(dAtA[iNdEx:postIndex]) + s := string(dAtA[iNdEx:postIndex]) + m.Pool = &s iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeAdded", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Device", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -8873,27 +10401,24 @@ func (m *DeviceTaint) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TimeAdded == nil { - m.TimeAdded = &v1.Time{} - } - if err := m.TimeAdded.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + s := string(dAtA[iNdEx:postIndex]) + m.Device = &s iNdEx = postIndex default: iNdEx = preIndex @@ -9518,6 +11043,125 @@ func (m *NetworkDeviceData) Unmarshal(dAtA []byte) error { } return nil } +func (m *NodeAllocatableResourceMapping) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NodeAllocatableResourceMapping: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NodeAllocatableResourceMapping: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CapacityKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := QualifiedName(dAtA[iNdEx:postIndex]) + m.CapacityKey = &s + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllocationMultiplier", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AllocationMultiplier == nil { + m.AllocationMultiplier = &resource.Quantity{} + } + if err := m.AllocationMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *OpaqueDeviceConfiguration) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/api/resource/v1beta2/generated.proto b/vendor/k8s.io/api/resource/v1beta2/generated.proto index 76af5aa4e2..82bb033b3e 100644 --- a/vendor/k8s.io/api/resource/v1beta2/generated.proto +++ b/vendor/k8s.io/api/resource/v1beta2/generated.proto @@ -65,8 +65,8 @@ message AllocatedDeviceStatus { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid optional string shareID = 7; // Conditions contains the latest observation of the device's state. @@ -90,7 +90,7 @@ message AllocatedDeviceStatus { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional NetworkDeviceData networkData = 6; } @@ -110,7 +110,7 @@ message AllocationResult { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. // // +optional @@ -169,6 +169,14 @@ message CELDeviceSelector { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. @@ -307,8 +315,8 @@ message CounterSet { // It must be a DNS label. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name optional string name = 1; // Counters defines the set of counters for this CounterSet @@ -317,6 +325,8 @@ message CounterSet { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -335,6 +345,7 @@ message Device { // The maximum number of attributes and capacities combined is 32. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional map attributes = 2; // Capacity defines the set of capacities for this device. @@ -355,13 +366,13 @@ message Device { // device is 2. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=counterSet + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:maxItems=2 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 repeated DeviceCounterConsumption consumesCounters = 4; // NodeName identifies the node where the device is available. @@ -402,12 +413,13 @@ message Device { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceTaint taints = 8; // BindsToNode indicates if the usage of an allocation involving this device @@ -415,7 +427,7 @@ message Device { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional @@ -431,14 +443,14 @@ message Device { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingConditions = 10; // BindingFailureConditions defines the conditions for binding failure. @@ -449,14 +461,14 @@ message Device { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingFailureConditions = 11; // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -467,6 +479,21 @@ message Device { // +optional // +featureGate=DRAConsumableCapacity optional bool allowMultipleAllocations = 12; + + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + // +optional + // +featureGate=DRANodeAllocatableResources + map nodeAllocatableResourceMappings = 13; } // DeviceAllocationConfiguration gets embedded in an AllocationResult. @@ -476,7 +503,7 @@ message DeviceAllocationConfiguration { // or from a claim. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string source = 1; // Requests lists the names of requests where the configuration applies. @@ -488,10 +515,10 @@ message DeviceAllocationConfiguration { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 2; optional DeviceConfiguration deviceConfiguration = 3; @@ -503,8 +530,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceRequestAllocationResult results = 1; // This field is a combination of all the claim and class configuration parameters. @@ -517,8 +544,8 @@ message DeviceAllocationResult { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=64 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 repeated DeviceAllocationConfiguration config = 2; } @@ -527,31 +554,79 @@ message DeviceAttribute { // IntValue is a number. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional int64 int = 2; // BoolValue is a true/false value. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional bool bool = 3; // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional string string = 4; // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember optional string version = 5; + + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated int64 ints = 6; + + // BoolValues is a non-empty list of true/false values. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated bool bools = 7; + + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated string strings = 8; + + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + repeated string versions = 9; } // DeviceCapacity describes a quantity associated with a device. @@ -587,11 +662,11 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceRequest requests = 1; // These constraints must be satisfied by the set of devices that get @@ -599,8 +674,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceConstraint constraints = 2; // This field holds configuration for multiple potential drivers which @@ -609,8 +684,8 @@ message DeviceClaim { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceClaimConfiguration config = 3; } @@ -625,10 +700,10 @@ message DeviceClaimConfiguration { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 1; optional DeviceConfiguration deviceConfiguration = 2; @@ -644,8 +719,8 @@ message DeviceClaimConfiguration { message DeviceClass { // Standard object metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; // Spec defines what can be allocated and how to configure it. @@ -681,8 +756,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 1; // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -693,8 +768,8 @@ message DeviceClassSpec { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceClassConfiguration config = 2; // ExtendedResourceName is the extended resource name for the devices of this class. @@ -706,11 +781,11 @@ message DeviceClassSpec { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:optional - // +k8s:format=k8s-extended-resource-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name optional string extendedResourceName = 4; } @@ -722,7 +797,7 @@ message DeviceConfiguration { // // +optional // +oneOf=ConfigurationType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional OpaqueDeviceConfiguration opaque = 1; } @@ -740,10 +815,10 @@ message DeviceConstraint { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated string requests = 1; // MatchAttribute requires that all devices in question have this @@ -757,17 +832,27 @@ message DeviceConstraint { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as singleton sets for backward compatibility. + // // Must include the domain qualifier. // // +optional // +oneOf=ConstraintType - // +k8s:optional - // +k8s:format=k8s-resource-fully-qualified-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name optional string matchAttribute = 2; // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device @@ -789,8 +874,8 @@ message DeviceCounterConsumption { // counters defined will be consumed. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name optional string counterSet = 1; // Counters defines the counters that will be consumed by the device. @@ -798,6 +883,8 @@ message DeviceCounterConsumption { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name map counters = 2; } @@ -827,7 +914,7 @@ message DeviceRequest { // // +optional // +oneOf=deviceRequestType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional ExactDeviceRequest exactly = 2; // FirstAvailable contains subrequests, of which exactly one will be @@ -848,11 +935,11 @@ message DeviceRequest { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 repeated DeviceSubRequest firstAvailable = 3; } @@ -877,8 +964,9 @@ message DeviceRequestAllocationResult { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:format=k8s-long-name-caseless - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:alpha(since: "1.36")=+k8s:required optional string driver = 2; // This name together with the driver name and the device name field @@ -888,8 +976,8 @@ message DeviceRequestAllocationResult { // DNS sub-domains separated by slashes. // // +required - // +k8s:required - // +k8s:format=k8s-resource-pool-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name optional string pool = 3; // Device references one device instance via its name in the driver's @@ -915,38 +1003,39 @@ message DeviceRequestAllocationResult { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 6; // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingConditions = 7; // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 repeated string bindingFailureConditions = 8; // ShareID uniquely identifies an individual allocation share of the device, @@ -956,8 +1045,8 @@ message DeviceRequestAllocationResult { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid optional string shareID = 9; // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1014,8 +1103,8 @@ message DeviceSubRequest { // to reference. // // +required - // +k8s:required - // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name optional string deviceClassName = 2; // Selectors define criteria which must be satisfied by a specific @@ -1025,8 +1114,8 @@ message DeviceSubRequest { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 3; // AllocationMode and its related fields define how devices are allocated @@ -1048,6 +1137,7 @@ message DeviceSubRequest { // requests with unknown modes. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string allocationMode = 4; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1072,12 +1162,13 @@ message DeviceSubRequest { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1124,16 +1215,134 @@ message DeviceTaint { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required optional string effect = 3; - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time timeAdded = 4; } +// DeviceTaintRule adds one taint to all devices which match the selector. +// This has the same effect as if the taint was specified directly +// in the ResourceSlice by the DRA driver. +message DeviceTaintRule { + // Standard object metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Spec specifies the selector and one taint. + // + // Changing the spec automatically increments the metadata.generation number. + // +required + optional DeviceTaintRuleSpec spec = 2; + + // Status provides information about what was requested in the spec. + // + // +optional + optional DeviceTaintRuleStatus status = 3; +} + +// DeviceTaintRuleList is a collection of DeviceTaintRules. +message DeviceTaintRuleList { + // Standard list metadata + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of DeviceTaintRules. + repeated DeviceTaintRule items = 2; +} + +// DeviceTaintRuleSpec specifies the selector and one taint. +message DeviceTaintRuleSpec { + // DeviceSelector defines which device(s) the taint is applied to. + // All selector criteria must be satisfied for a device to + // match. The empty selector matches all devices. Without + // a selector, no devices are matches. + // + // +optional + optional DeviceTaintSelector deviceSelector = 1; + + // The taint that gets applied to matching devices. + // + // +required + optional DeviceTaint taint = 2; +} + +// DeviceTaintRuleStatus provides information about an on-going pod eviction. +message DeviceTaintRuleStatus { + // Conditions provide information about the state of the DeviceTaintRule + // and the cluster at some point in time, + // in a machine-readable and human-readable format. + // + // The following condition is currently defined as part of this API, more may + // get added: + // - Type: EvictionInProgress + // - Status: True if there are currently pods which need to be evicted, False otherwise + // (includes the effects which don't cause eviction). + // - Reason: not specified, may change + // - Message: includes information about number of pending pods and already evicted pods + // in a human-readable format, updated periodically, may change + // + // For `effect: None`, the condition above gets set once for each change to + // the spec, with the message containing information about what would happen + // if the effect was `NoExecute`. This feedback can be used to decide whether + // changing the effect to `NoExecute` will work as intended. It only gets + // set once to avoid having to constantly update the status. + // + // Must have 8 or fewer entries. + // + // +optional + // +listType=map + // +listMapKey=type + // +patchStrategy=merge + // +patchMergeKey=type + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; +} + +// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. +// The empty selector matches all devices. Without a selector, no devices +// are matched. +message DeviceTaintSelector { + // If driver is set, only devices from that driver are selected. + // This fields corresponds to slice.spec.driver. + // + // +optional + optional string driver = 2; + + // If pool is set, only devices in that pool are selected. + // + // Also setting the driver name may be useful to avoid + // ambiguity when different drivers use the same pool name, + // but this is not required because selecting pools from + // different drivers may also be useful, for example when + // drivers with node-local devices use the node name as + // their pool name. + // + // +optional + optional string pool = 3; + + // If device is set, only devices with that name are selected. + // This field corresponds to slice.spec.devices[].name. + // + // Setting also driver and pool may be required to avoid ambiguity, + // but is not required. + // + // +optional + optional string device = 4; +} + // The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches // the triple using the matching operator . message DeviceToleration { @@ -1142,8 +1351,8 @@ message DeviceToleration { // Must be a label name. // // +optional - // +k8s:optional - // +k8s:format=k8s-label-key + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key optional string key = 1; // Operator represents a key's relationship to the value. @@ -1153,6 +1362,7 @@ message DeviceToleration { // // +optional // +default="Equal" + // +k8s:alpha(since: "1.36")=+k8s:optional optional string operator = 2; // Value is the taint value the toleration matches to. @@ -1166,6 +1376,7 @@ message DeviceToleration { // When specified, allowed values are NoSchedule and NoExecute. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string effect = 4; // TolerationSeconds represents the period of time the toleration (which must be @@ -1203,8 +1414,8 @@ message ExactDeviceRequest { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 repeated DeviceSelector selectors = 2; // AllocationMode and its related fields define how devices are allocated @@ -1227,7 +1438,7 @@ message ExactDeviceRequest { // requests with unknown modes. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional optional string allocationMode = 3; // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1266,12 +1477,13 @@ message ExactDeviceRequest { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional repeated DeviceToleration tolerations = 6; // Capacity define resource requirements against each capacity. @@ -1300,11 +1512,11 @@ message NetworkDeviceData { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 optional string interfaceName = 1; // IPs lists the network addresses assigned to the device's network interface. @@ -1315,22 +1527,60 @@ message NetworkDeviceData { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 repeated string ips = 2; // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=128 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 optional string hardwareAddress = 3; } +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +message NodeAllocatableResourceMapping { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + // +optional + optional string capacityKey = 1; + + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + optional .k8s.io.apimachinery.pkg.api.resource.Quantity allocationMultiplier = 2; +} + // OpaqueDeviceConfiguration contains configuration parameters for a driver // in a format defined by the driver vendor. message OpaqueDeviceConfiguration { @@ -1344,8 +1594,9 @@ message OpaqueDeviceConfiguration { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:required - // +k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless optional string driver = 1; // Parameters can contain arbitrary data. It is the responsibility of @@ -1374,7 +1625,7 @@ message ResourceClaim { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:immutable optional ResourceClaimSpec spec = 2; // Status describes whether the claim is ready to use and what has been allocated. @@ -1429,8 +1680,8 @@ message ResourceClaimStatus { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:optional - // +k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify optional AllocationResult allocation = 1; // ReservedFor indicates which entities are currently allowed to use @@ -1458,10 +1709,10 @@ message ResourceClaimStatus { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=uid - // +k8s:maxItems=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid + // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 repeated ResourceClaimConsumerReference reservedFor = 2; // Devices contains the status of each device allocated for this @@ -1469,18 +1720,18 @@ message ResourceClaimStatus { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:listType=map - // +k8s:listMapKey=driver - // +k8s:listMapKey=device - // +k8s:listMapKey=pool - // +k8s:listMapKey=shareID + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID repeated AllocatedDeviceStatus devices = 4; } @@ -1594,6 +1845,7 @@ message ResourceSlice { // Contains the information published by the driver. // // Changing the spec automatically increments the metadata.generation number. + // +required optional ResourceSliceSpec spec = 2; } @@ -1668,7 +1920,7 @@ message ResourceSliceSpec { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +zeroOrOneOf=ResourceSliceType repeated Device devices = 6; @@ -1694,14 +1946,14 @@ message ResourceSliceSpec { // The maximum number of counter sets is 8. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 repeated CounterSet sharedCounters = 8; } diff --git a/vendor/k8s.io/api/resource/v1beta2/generated.protomessage.pb.go b/vendor/k8s.io/api/resource/v1beta2/generated.protomessage.pb.go deleted file mode 100644 index b6417d18c2..0000000000 --- a/vendor/k8s.io/api/resource/v1beta2/generated.protomessage.pb.go +++ /dev/null @@ -1,108 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta2 - -func (*AllocatedDeviceStatus) ProtoMessage() {} - -func (*AllocationResult) ProtoMessage() {} - -func (*CELDeviceSelector) ProtoMessage() {} - -func (*CapacityRequestPolicy) ProtoMessage() {} - -func (*CapacityRequestPolicyRange) ProtoMessage() {} - -func (*CapacityRequirements) ProtoMessage() {} - -func (*Counter) ProtoMessage() {} - -func (*CounterSet) ProtoMessage() {} - -func (*Device) ProtoMessage() {} - -func (*DeviceAllocationConfiguration) ProtoMessage() {} - -func (*DeviceAllocationResult) ProtoMessage() {} - -func (*DeviceAttribute) ProtoMessage() {} - -func (*DeviceCapacity) ProtoMessage() {} - -func (*DeviceClaim) ProtoMessage() {} - -func (*DeviceClaimConfiguration) ProtoMessage() {} - -func (*DeviceClass) ProtoMessage() {} - -func (*DeviceClassConfiguration) ProtoMessage() {} - -func (*DeviceClassList) ProtoMessage() {} - -func (*DeviceClassSpec) ProtoMessage() {} - -func (*DeviceConfiguration) ProtoMessage() {} - -func (*DeviceConstraint) ProtoMessage() {} - -func (*DeviceCounterConsumption) ProtoMessage() {} - -func (*DeviceRequest) ProtoMessage() {} - -func (*DeviceRequestAllocationResult) ProtoMessage() {} - -func (*DeviceSelector) ProtoMessage() {} - -func (*DeviceSubRequest) ProtoMessage() {} - -func (*DeviceTaint) ProtoMessage() {} - -func (*DeviceToleration) ProtoMessage() {} - -func (*ExactDeviceRequest) ProtoMessage() {} - -func (*NetworkDeviceData) ProtoMessage() {} - -func (*OpaqueDeviceConfiguration) ProtoMessage() {} - -func (*ResourceClaim) ProtoMessage() {} - -func (*ResourceClaimConsumerReference) ProtoMessage() {} - -func (*ResourceClaimList) ProtoMessage() {} - -func (*ResourceClaimSpec) ProtoMessage() {} - -func (*ResourceClaimStatus) ProtoMessage() {} - -func (*ResourceClaimTemplate) ProtoMessage() {} - -func (*ResourceClaimTemplateList) ProtoMessage() {} - -func (*ResourceClaimTemplateSpec) ProtoMessage() {} - -func (*ResourcePool) ProtoMessage() {} - -func (*ResourceSlice) ProtoMessage() {} - -func (*ResourceSliceList) ProtoMessage() {} - -func (*ResourceSliceSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/resource/v1beta2/register.go b/vendor/k8s.io/api/resource/v1beta2/register.go index 5e676a0549..d08534c9e0 100644 --- a/vendor/k8s.io/api/resource/v1beta2/register.go +++ b/vendor/k8s.io/api/resource/v1beta2/register.go @@ -46,6 +46,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &DeviceClass{}, &DeviceClassList{}, + &DeviceTaintRule{}, + &DeviceTaintRuleList{}, &ResourceClaim{}, &ResourceClaimList{}, &ResourceClaimTemplate{}, diff --git a/vendor/k8s.io/api/resource/v1beta2/types.go b/vendor/k8s.io/api/resource/v1beta2/types.go index 4953434884..47a46355f0 100644 --- a/vendor/k8s.io/api/resource/v1beta2/types.go +++ b/vendor/k8s.io/api/resource/v1beta2/types.go @@ -35,6 +35,10 @@ const ( // special ResourceClaim. Its single valid value is "true". // This is used only inside the scheduler. ExtendedResourceClaimAnnotation = "resource.kubernetes.io/extended-resource-claim" + // PodResourceClaimAnnotation is the annotation set on template-generated + // ResourceClaims by the ResourceClaim controller. Its value is the + // pod.spec.resourceClaims[].name for which the claim was generated. + PodResourceClaimAnnotation = "resource.kubernetes.io/pod-claim-name" // Resource device class prefix is for generating implicit extended resource // name for a device class when its ExtendedResourceName field is not // specified. The generated name is this prefix + the device class name. @@ -82,6 +86,7 @@ type ResourceSlice struct { // Contains the information published by the driver. // // Changing the spec automatically increments the metadata.generation number. + // +required Spec ResourceSliceSpec `json:"spec" protobuf:"bytes,2,name=spec"` } @@ -155,7 +160,7 @@ type ResourceSliceSpec struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +zeroOrOneOf=ResourceSliceType Devices []Device `json:"devices,omitempty" protobuf:"bytes,6,name=devices"` @@ -181,14 +186,14 @@ type ResourceSliceSpec struct { // The maximum number of counter sets is 8. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name // +featureGate=DRAPartitionableDevices // +zeroOrOneOf=ResourceSliceType - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 SharedCounters []CounterSet `json:"sharedCounters,omitempty" protobuf:"bytes,8,name=sharedCounters"` } @@ -205,8 +210,8 @@ type CounterSet struct { // It must be a DNS label. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name Name string `json:"name" protobuf:"bytes,1,name=name"` // Counters defines the set of counters for this CounterSet @@ -215,6 +220,8 @@ type CounterSet struct { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,name=counters"` } @@ -261,7 +268,14 @@ type ResourcePool struct { const ResourceSliceMaxSharedCapacity = 128 const ResourceSliceMaxDevices = 128 -const ResourceSliceMaxDevicesWithTaintsOrConsumesCounters = 64 + +// ResourceSliceMaxDevicesWithAdvancedFeatures defines the maximum number of devices in a ResourceSlice +// if any of those devices uses advanced features: +// - device taints (DRADeviceTaints feature gate) +// - consuming counters (DRAPartitionableDevices feature gate) +// - list attributes (DRAListTypeAttributes feature gate) +const ResourceSliceMaxDevicesWithAdvancedFeatures = 64 + const PoolNameMaxLength = validation.DNS1123SubdomainMaxLength // Same as for a single node name. const BindingConditionsMaxSize = 4 const BindingFailureConditionsMaxSize = 4 @@ -298,6 +312,7 @@ type Device struct { // The maximum number of attributes and capacities combined is 32. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Attributes map[QualifiedName]DeviceAttribute `json:"attributes,omitempty" protobuf:"bytes,2,rep,name=attributes"` // Capacity defines the set of capacities for this device. @@ -318,13 +333,13 @@ type Device struct { // device is 2. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=atomic // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=counterSet + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=counterSet // +featureGate=DRAPartitionableDevices - // +k8s:maxItems=2 + // +k8s:alpha(since: "1.36")=+k8s:maxItems=2 ConsumesCounters []DeviceCounterConsumption `json:"consumesCounters,omitempty" protobuf:"bytes,4,rep,name=consumesCounters"` // NodeName identifies the node where the device is available. @@ -365,12 +380,13 @@ type Device struct { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Taints []DeviceTaint `json:"taints,omitempty" protobuf:"bytes,8,rep,name=taints"` // BindsToNode indicates if the usage of an allocation involving this device @@ -378,7 +394,7 @@ type Device struct { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional @@ -394,14 +410,14 @@ type Device struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,10,rep,name=bindingConditions"` // BindingFailureConditions defines the conditions for binding failure. @@ -412,14 +428,14 @@ type Device struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,11,rep,name=bindingFailureConditions"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -430,6 +446,59 @@ type Device struct { // +optional // +featureGate=DRAConsumableCapacity AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty" protobuf:"bytes,12,opt,name=allowMultipleAllocations"` + + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + // +optional + // +featureGate=DRANodeAllocatableResources + NodeAllocatableResourceMappings map[v1.ResourceName]NodeAllocatableResourceMapping `json:"nodeAllocatableResourceMappings,omitempty" protobuf:"bytes,13,opt,name=nodeAllocatableResourceMappings"` +} + +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +type NodeAllocatableResourceMapping struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + // +optional + CapacityKey *QualifiedName `json:"capacityKey,omitempty" protobuf:"bytes,1,opt,name=capacityKey"` + + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + // +optional + AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty" protobuf:"bytes,2,opt,name=allocationMultiplier"` } // DeviceCounterConsumption defines a set of counters that @@ -439,8 +508,8 @@ type DeviceCounterConsumption struct { // counters defined will be consumed. // // +required - // +k8s:required - // +k8s:format=k8s-short-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-short-name CounterSet string `json:"counterSet" protobuf:"bytes,1,opt,name=counterSet"` // Counters defines the counters that will be consumed by the device. @@ -448,6 +517,8 @@ type DeviceCounterConsumption struct { // The maximum number of counters is 32. // // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:eachKey=+k8s:format=k8s-short-name Counters map[string]Counter `json:"counters,omitempty" protobuf:"bytes,2,opt,name=counters"` } @@ -568,6 +639,10 @@ type CapacityRequestPolicyRange struct { // Limit for the sum of the number of entries in both attributes and capacity. const ResourceSliceMaxAttributesAndCapacitiesPerDevice = 32 +// Limit per device for the total number of string, version, bool or int values +// in list and non-list attributes. +const ResourceSliceMaxAttributeValuesPerDevice = 48 + // QualifiedName is the name of a device attribute or capacity. // // Attributes and capacities are defined either by the owner of the specific @@ -607,31 +682,79 @@ type DeviceAttribute struct { // IntValue is a number. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember IntValue *int64 `json:"int,omitempty" protobuf:"varint,2,opt,name=int"` // BoolValue is a true/false value. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember BoolValue *bool `json:"bool,omitempty" protobuf:"varint,3,opt,name=bool"` // StringValue is a string. Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember StringValue *string `json:"string,omitempty" protobuf:"bytes,4,opt,name=string"` // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. // // +optional - // +k8s:optional - // +k8s:unionMember + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember VersionValue *string `json:"version,omitempty" protobuf:"bytes,5,opt,name=version"` + + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + IntValues []int64 `json:"ints,omitempty" protobuf:"varint,6,opt,name=ints"` + + // BoolValues is a non-empty list of true/false values. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + BoolValues []bool `json:"bools,omitempty" protobuf:"varint,7,opt,name=bools"` + + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + StringValues []string `json:"strings,omitempty" protobuf:"bytes,8,opt,name=strings"` + + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + // + // +optional + // +listType=atomic + // +k8s:listType=atomic + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:unionMember + // +featureGate=DRAListTypeAttributes + VersionValues []string `json:"versions,omitempty" protobuf:"bytes,9,opt,name=versions"` } // DeviceAttributeMaxValueLength is the maximum length of a string or version attribute value. @@ -666,7 +789,7 @@ type DeviceTaint struct { // Consumers must treat unknown effects like None. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"` // ^^^^ @@ -682,9 +805,18 @@ type DeviceTaint struct { // which will enable adding new enums within a single release without // ratcheting. - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). + // // +optional TimeAdded *metav1.Time `json:"timeAdded,omitempty" protobuf:"bytes,4,opt,name=timeAdded"` @@ -696,7 +828,7 @@ type DeviceTaint struct { } // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceTaintEffect string const ( @@ -712,6 +844,156 @@ const ( DeviceTaintEffectNoExecute DeviceTaintEffect = "NoExecute" ) +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 + +// DeviceTaintRule adds one taint to all devices which match the selector. +// This has the same effect as if the taint was specified directly +// in the ResourceSlice by the DRA driver. +type DeviceTaintRule struct { + metav1.TypeMeta `json:",inline"` + // Standard object metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec specifies the selector and one taint. + // + // Changing the spec automatically increments the metadata.generation number. + // +required + Spec DeviceTaintRuleSpec `json:"spec" protobuf:"bytes,2,name=spec"` + + // Status provides information about what was requested in the spec. + // + // +optional + Status DeviceTaintRuleStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// DeviceTaintRuleSpec specifies the selector and one taint. +type DeviceTaintRuleSpec struct { + // DeviceSelector defines which device(s) the taint is applied to. + // All selector criteria must be satisfied for a device to + // match. The empty selector matches all devices. Without + // a selector, no devices are matches. + // + // +optional + DeviceSelector *DeviceTaintSelector `json:"deviceSelector,omitempty" protobuf:"bytes,1,opt,name=deviceSelector"` + + // The taint that gets applied to matching devices. + // + // +required + Taint DeviceTaint `json:"taint,omitempty" protobuf:"bytes,2,rep,name=taint"` +} + +// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. +// The empty selector matches all devices. Without a selector, no devices +// are matched. +type DeviceTaintSelector struct { + // If DeviceClassName is set, the selectors defined there must be + // satisfied by a device to be selected. This field corresponds + // to class.metadata.name. + // + // +optional + // + // Tombstoned since 1.35 because it turned out that supporting this in all cases + // would depend on copying the device attributes into the ResourceClaim allocation + // result. Without that the eviction controller cannot evaluate these CEL expressions. + // + // DeviceClassName *string `json:"deviceClassName,omitempty" protobuf:"bytes,1,opt,name=deviceClassName"` + + // If driver is set, only devices from that driver are selected. + // This fields corresponds to slice.spec.driver. + // + // +optional + Driver *string `json:"driver,omitempty" protobuf:"bytes,2,opt,name=driver"` + + // If pool is set, only devices in that pool are selected. + // + // Also setting the driver name may be useful to avoid + // ambiguity when different drivers use the same pool name, + // but this is not required because selecting pools from + // different drivers may also be useful, for example when + // drivers with node-local devices use the node name as + // their pool name. + // + // +optional + Pool *string `json:"pool,omitempty" protobuf:"bytes,3,opt,name=pool"` + + // If device is set, only devices with that name are selected. + // This field corresponds to slice.spec.devices[].name. + // + // Setting also driver and pool may be required to avoid ambiguity, + // but is not required. + // + // +optional + Device *string `json:"device,omitempty" protobuf:"bytes,4,opt,name=device"` + + // Selectors contains the same selection criteria as a ResourceClaim. + // Currently, CEL expressions are supported. All of these selectors + // must be satisfied. + // + // +optional + // +listType=atomic + // + // Tombstoned since 1.35 because it turned out that supporting this in all cases + // would depend on copying the device attributes into the ResourceClaim allocation + // result. Without that the eviction controller cannot evaluate these CEL expressions. + // + // Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,5,rep,name=selectors"` +} + +// DeviceTaintRuleStatus provides information about an on-going pod eviction. +type DeviceTaintRuleStatus struct { + // Conditions provide information about the state of the DeviceTaintRule + // and the cluster at some point in time, + // in a machine-readable and human-readable format. + // + // The following condition is currently defined as part of this API, more may + // get added: + // - Type: EvictionInProgress + // - Status: True if there are currently pods which need to be evicted, False otherwise + // (includes the effects which don't cause eviction). + // - Reason: not specified, may change + // - Message: includes information about number of pending pods and already evicted pods + // in a human-readable format, updated periodically, may change + // + // For `effect: None`, the condition above gets set once for each change to + // the spec, with the message containing information about what would happen + // if the effect was `NoExecute`. This feedback can be used to decide whether + // changing the effect to `NoExecute` will work as intended. It only gets + // set once to avoid having to constantly update the status. + // + // Must have 8 or fewer entries. + // + // +optional + // +listType=map + // +listMapKey=type + // +patchStrategy=merge + // +patchMergeKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` +} + +// DeviceTaintRuleStatusMaxConditions is the maximum number of conditions in DeviceTaintRuleStatus. +const DeviceTaintRuleStatusMaxConditions = 8 + +// DeviceTaintConditionEvictionInProgress is the publicly documented condition type for the DeviceTaintRuleStatus. +const DeviceTaintConditionEvictionInProgress = "EvictionInProgress" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:prerelease-lifecycle-gen:introduced=1.36 + +// DeviceTaintRuleList is a collection of DeviceTaintRules. +type DeviceTaintRuleList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of DeviceTaintRules. + Items []DeviceTaintRule `json:"items" protobuf:"bytes,2,rep,name=items"` +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.33 @@ -729,7 +1011,7 @@ type ResourceSliceList struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.33 -// +k8s:supportsSubresource=/status +// +k8s:supportsSubresource="/status" // ResourceClaim describes a request for access to resources in the cluster, // for use by workloads. For example, if a workload needs an accelerator device @@ -747,7 +1029,7 @@ type ResourceClaim struct { // Spec describes what is being requested and how to configure it. // The spec is immutable. - // +k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:immutable Spec ResourceClaimSpec `json:"spec" protobuf:"bytes,2,name=spec"` // Status describes whether the claim is ready to use and what has been allocated. @@ -775,11 +1057,11 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []DeviceRequest `json:"requests" protobuf:"bytes,1,name=requests"` // These constraints must be satisfied by the set of devices that get @@ -787,8 +1069,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Constraints []DeviceConstraint `json:"constraints,omitempty" protobuf:"bytes,2,opt,name=constraints"` // This field holds configuration for multiple potential drivers which @@ -797,8 +1079,8 @@ type DeviceClaim struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Config []DeviceClaimConfiguration `json:"config,omitempty" protobuf:"bytes,3,opt,name=config"` // Potential future extension, ignored by older schedulers. This is @@ -849,7 +1131,7 @@ type DeviceRequest struct { // // +optional // +oneOf=deviceRequestType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional Exactly *ExactDeviceRequest `json:"exactly,omitempty" protobuf:"bytes,2,name=exactly"` // FirstAvailable contains subrequests, of which exactly one will be @@ -870,11 +1152,11 @@ type DeviceRequest struct { // +oneOf=deviceRequestType // +listType=atomic // +featureGate=DRAPrioritizedList - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=map - // +k8s:listMapKey=name - // +k8s:maxItems=8 + // +k8s:alpha(since: "1.36")=+k8s:unique=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=name + // +k8s:alpha(since: "1.36")=+k8s:maxItems=8 FirstAvailable []DeviceSubRequest `json:"firstAvailable,omitempty" protobuf:"bytes,3,name=firstAvailable"` } @@ -902,8 +1184,8 @@ type ExactDeviceRequest struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,2,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -926,7 +1208,7 @@ type ExactDeviceRequest struct { // requests with unknown modes. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,3,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -965,12 +1247,13 @@ type ExactDeviceRequest struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1022,8 +1305,8 @@ type DeviceSubRequest struct { // to reference. // // +required - // +k8s:required - // +k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name DeviceClassName string `json:"deviceClassName" protobuf:"bytes,2,name=deviceClassName"` // Selectors define criteria which must be satisfied by a specific @@ -1033,8 +1316,8 @@ type DeviceSubRequest struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,3,name=selectors"` // AllocationMode and its related fields define how devices are allocated @@ -1056,6 +1339,7 @@ type DeviceSubRequest struct { // requests with unknown modes. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional AllocationMode DeviceAllocationMode `json:"allocationMode,omitempty" protobuf:"bytes,4,opt,name=allocationMode"` // Count is used only when the count mode is "ExactCount". Must be greater than zero. @@ -1080,12 +1364,13 @@ type DeviceSubRequest struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // Capacity define resource requirements against each capacity. @@ -1142,7 +1427,7 @@ const ( ) // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceAllocationMode string // Valid [DeviceRequest.CountMode] values. @@ -1211,6 +1496,14 @@ type CELDeviceSelector struct { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. @@ -1261,10 +1554,10 @@ type DeviceConstraint struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` // MatchAttribute requires that all devices in question have this @@ -1278,12 +1571,17 @@ type DeviceConstraint struct { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as singleton sets for backward compatibility. + // // Must include the domain qualifier. // // +optional // +oneOf=ConstraintType - // +k8s:optional - // +k8s:format=k8s-resource-fully-qualified-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-fully-qualified-name MatchAttribute *FullyQualifiedName `json:"matchAttribute,omitempty" protobuf:"bytes,2,opt,name=matchAttribute"` // Potential future extension, not part of the current design: @@ -1299,6 +1597,11 @@ type DeviceConstraint struct { // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device @@ -1324,10 +1627,10 @@ type DeviceClaimConfiguration struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,1,opt,name=requests"` DeviceConfiguration `json:",inline" protobuf:"bytes,2,name=deviceConfiguration"` @@ -1341,7 +1644,7 @@ type DeviceConfiguration struct { // // +optional // +oneOf=ConfigurationType - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional Opaque *OpaqueDeviceConfiguration `json:"opaque,omitempty" protobuf:"bytes,1,opt,name=opaque"` } @@ -1358,8 +1661,9 @@ type OpaqueDeviceConfiguration struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:required - // +k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless Driver string `json:"driver" protobuf:"bytes,1,name=driver"` // Parameters can contain arbitrary data. It is the responsibility of @@ -1385,8 +1689,8 @@ type DeviceToleration struct { // Must be a label name. // // +optional - // +k8s:optional - // +k8s:format=k8s-label-key + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-label-key Key string `json:"key,omitempty" protobuf:"bytes,1,opt,name=key"` // Operator represents a key's relationship to the value. @@ -1396,6 +1700,7 @@ type DeviceToleration struct { // // +optional // +default="Equal" + // +k8s:alpha(since: "1.36")=+k8s:optional Operator DeviceTolerationOperator `json:"operator,omitempty" protobuf:"bytes,2,opt,name=operator,casttype=DeviceTolerationOperator"` // Value is the taint value the toleration matches to. @@ -1409,6 +1714,7 @@ type DeviceToleration struct { // When specified, allowed values are NoSchedule and NoExecute. // // +optional + // +k8s:alpha(since: "1.36")=+k8s:optional Effect DeviceTaintEffect `json:"effect,omitempty" protobuf:"bytes,4,opt,name=effect,casttype=DeviceTaintEffect"` // TolerationSeconds represents the period of time the toleration (which must be @@ -1425,7 +1731,7 @@ type DeviceToleration struct { // A toleration operator is the set of operators that can be used in a toleration. // // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type DeviceTolerationOperator string const ( @@ -1439,8 +1745,8 @@ type ResourceClaimStatus struct { // Allocation is set once the claim has been allocated successfully. // // +optional - // +k8s:optional - // +k8s:update=NoModify + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:update=NoModify Allocation *AllocationResult `json:"allocation,omitempty" protobuf:"bytes,1,opt,name=allocation"` // ReservedFor indicates which entities are currently allowed to use @@ -1468,10 +1774,10 @@ type ResourceClaimStatus struct { // +listMapKey=uid // +patchStrategy=merge // +patchMergeKey=uid - // +k8s:optional - // +k8s:listType=map - // +k8s:listMapKey=uid - // +k8s:maxItems=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=uid + // +k8s:alpha(since: "1.36")=+k8s:maxItems=256 ReservedFor []ResourceClaimConsumerReference `json:"reservedFor,omitempty" protobuf:"bytes,2,opt,name=reservedFor" patchStrategy:"merge" patchMergeKey:"uid"` // DeallocationRequested is tombstoned since Kubernetes 1.32 where @@ -1484,18 +1790,18 @@ type ResourceClaimStatus struct { // information. Entries are owned by their respective drivers. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +listType=map // +listMapKey=driver // +listMapKey=device // +listMapKey=pool // +listMapKey=shareID // +featureGate=DRAResourceClaimDeviceStatus - // +k8s:listType=map - // +k8s:listMapKey=driver - // +k8s:listMapKey=device - // +k8s:listMapKey=pool - // +k8s:listMapKey=shareID + // +k8s:alpha(since: "1.36")=+k8s:listType=map + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=driver + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=device + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=pool + // +k8s:alpha(since: "1.36")=+k8s:listMapKey=shareID Devices []AllocatedDeviceStatus `json:"devices,omitempty" protobuf:"bytes,4,opt,name=devices"` } @@ -1544,7 +1850,7 @@ type AllocationResult struct { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. // // +optional @@ -1558,8 +1864,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Results []DeviceRequestAllocationResult `json:"results,omitempty" protobuf:"bytes,1,opt,name=results"` // This field is a combination of all the claim and class configuration parameters. @@ -1572,8 +1878,8 @@ type DeviceAllocationResult struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=64 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=64 Config []DeviceAllocationConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` } @@ -1602,8 +1908,9 @@ type DeviceRequestAllocationResult struct { // vendor of the driver. It should use only lower case characters. // // +required - // +k8s:format=k8s-long-name-caseless - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-long-name-caseless + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 + // +k8s:alpha(since: "1.36")=+k8s:required Driver string `json:"driver" protobuf:"bytes,2,name=driver"` // This name together with the driver name and the device name field @@ -1613,8 +1920,8 @@ type DeviceRequestAllocationResult struct { // DNS sub-domains separated by slashes. // // +required - // +k8s:required - // +k8s:format=k8s-resource-pool-name + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-resource-pool-name Pool string `json:"pool" protobuf:"bytes,3,name=pool"` // Device references one device instance via its name in the driver's @@ -1640,38 +1947,39 @@ type DeviceRequestAllocationResult struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. // // +optional // +listType=atomic // +featureGate=DRADeviceTaints + // +k8s:alpha(since: "1.36")=+k8s:optional Tolerations []DeviceToleration `json:"tolerations,omitempty" protobuf:"bytes,6,opt,name=tolerations"` // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingConditions []string `json:"bindingConditions,omitempty" protobuf:"bytes,7,rep,name=bindingConditions"` // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. // // +optional // +listType=atomic // +featureGate=DRADeviceBindingConditions,DRAResourceClaimDeviceStatus - // +k8s:optional - // +k8s:maxItems=4 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=4 BindingFailureConditions []string `json:"bindingFailureConditions,omitempty" protobuf:"bytes,8,rep,name=bindingFailureConditions"` // ShareID uniquely identifies an individual allocation share of the device, @@ -1681,8 +1989,8 @@ type DeviceRequestAllocationResult struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid ShareID *types.UID `json:"shareID,omitempty" protobuf:"bytes,9,opt,name=shareID"` // ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. @@ -1706,7 +2014,7 @@ type DeviceAllocationConfiguration struct { // or from a claim. // // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required Source AllocationConfigSource `json:"source" protobuf:"bytes,1,name=source"` // Requests lists the names of requests where the configuration applies. @@ -1718,17 +2026,17 @@ type DeviceAllocationConfiguration struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Requests []string `json:"requests,omitempty" protobuf:"bytes,2,opt,name=requests"` DeviceConfiguration `json:",inline" protobuf:"bytes,3,name=deviceConfiguration"` } // +enum -// +k8s:enum +// +k8s:alpha(since: "1.36")=+k8s:enum type AllocationConfigSource string // Valid [DeviceAllocationConfiguration.Source] values. @@ -1767,8 +2075,8 @@ type DeviceClass struct { metav1.TypeMeta `json:",inline"` // Standard object metadata // +optional - // +k8s:subfield(name)=+k8s:optional - // +k8s:subfield(name)=+k8s:format=k8s-long-name + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:subfield(name)=+k8s:format=k8s-long-name metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` // Spec defines what can be allocated and how to configure it. @@ -1789,8 +2097,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,1,opt,name=selectors"` // Config defines configuration parameters that apply to each device that is claimed via this class. @@ -1801,8 +2109,8 @@ type DeviceClassSpec struct { // // +optional // +listType=atomic - // +k8s:optional - // +k8s:maxItems=32 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxItems=32 Config []DeviceClassConfiguration `json:"config,omitempty" protobuf:"bytes,2,opt,name=config"` // SuitableNodes is tombstoned since Kubernetes 1.32 where @@ -1819,11 +2127,11 @@ type DeviceClassSpec struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. // +optional // +featureGate=DRAExtendedResource - // +k8s:optional - // +k8s:format=k8s-extended-resource-name + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-extended-resource-name ExtendedResourceName *string `json:"extendedResourceName,omitempty" protobuf:"bytes,4,opt,name=extendedResourceName"` } @@ -1949,8 +2257,8 @@ type AllocatedDeviceStatus struct { // // +optional // +featureGate=DRAConsumableCapacity - // +k8s:optional - // +k8s:format=k8s-uuid + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:format=k8s-uuid ShareID *string `json:"shareID,omitempty" protobuf:"bytes,7,opt,name=shareID"` // Conditions contains the latest observation of the device's state. @@ -1974,7 +2282,7 @@ type AllocatedDeviceStatus struct { // NetworkData contains network-related information specific to the device. // // +optional - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional NetworkData *NetworkDeviceData `json:"networkData,omitempty" protobuf:"bytes,6,opt,name=networkData"` } @@ -1986,11 +2294,11 @@ type NetworkDeviceData struct { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=256 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=256 InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"` // IPs lists the network addresses assigned to the device's network interface. @@ -2001,18 +2309,18 @@ type NetworkDeviceData struct { // // +optional // +listType=atomic - // +k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:optional // +k8s:listType=atomic - // +k8s:unique=set - // +k8s:maxItems=16 + // +k8s:alpha(since: "1.36")=+k8s:unique=set + // +k8s:alpha(since: "1.36")=+k8s:maxItems=16 IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. // // +optional - // +k8s:optional - // +k8s:maxLength=128 + // +k8s:alpha(since: "1.36")=+k8s:optional + // +k8s:alpha(since: "1.36")=+k8s:maxBytes=128 HardwareAddress string `json:"hardwareAddress,omitempty" protobuf:"bytes,3,opt,name=hardwareAddress"` } diff --git a/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go b/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go index a086f9bf23..122170ec25 100644 --- a/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/resource/v1beta2/types_swagger_doc_generated.go @@ -46,7 +46,7 @@ var map_AllocationResult = map[string]string{ "": "AllocationResult contains attributes of an allocated resource.", "devices": "Devices is the result of allocating devices.", "nodeSelector": "NodeSelector defines where the allocated resources are available. If unset, they are available everywhere.", - "allocationTimestamp": "AllocationTimestamp stores the time when the resources were allocated. This field is not guaranteed to be set, in which case that time is unknown.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gate.", + "allocationTimestamp": "AllocationTimestamp stores the time when the resources were allocated. This field is not guaranteed to be set, in which case that time is unknown.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gate.", } func (AllocationResult) SwaggerDoc() map[string]string { @@ -55,7 +55,7 @@ func (AllocationResult) SwaggerDoc() map[string]string { var map_CELDeviceSelector = map[string]string{ "": "CELDeviceSelector contains a CEL expression for selecting a device.", - "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", + "expression": "Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort.\n\nThe expression's input is an object named \"device\", which carries the following properties:\n - driver (string): the name of the driver which defines this device.\n - attributes (map[string]object): the device's attributes, grouped by prefix\n (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all\n of the attributes which were prefixed by \"dra.example.com\".\n - capacity (map[string]object): the device's capacities, grouped by prefix.\n - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device\n (v1.34+ with the DRAConsumableCapacity feature enabled).\n\nExample: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields:\n\n device.driver\n device.attributes[\"dra.example.com\"].model\n device.attributes[\"ext.example.com\"].family\n device.capacity[\"dra.example.com\"].modules\n\nThe device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers.\n\nThe value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity.\n\nIf an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort.\n\nA robust expression should check for the existence of attributes before referencing them.\n\nFor ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example:\n\n cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool)\n\nWhen the DRAListTypeAttributes feature gate is enabled, the includes() helper is available and it can work for both scalar and list-type attributes. It was introduced to support smooth migration from scalar attributes to list-type attributes while keeping CEL expressions simple. For example:\n\n device.attributes[\"dra.example.com\"].models.includes(\"some-model\")\n\nThe length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps.", } func (CELDeviceSelector) SwaggerDoc() map[string]string { @@ -113,19 +113,20 @@ func (CounterSet) SwaggerDoc() map[string]string { } var map_Device = map[string]string{ - "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", - "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", - "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", - "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", - "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", - "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", - "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "": "Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.", + "name": "Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.", + "attributes": "Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "capacity": "Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set.\n\nThe maximum number of attributes and capacities combined is 32.", + "consumesCounters": "ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.\n\nThere can only be a single entry per counterSet.\n\nThe maximum number of device counter consumptions per device is 2.", + "nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.", + "taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "allowMultipleAllocations": "AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.\n\nIf AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.", + "nodeAllocatableResourceMappings": "NodeAllocatableResourceMappings defines the mapping of node resources that are managed by the DRA driver exposing this device. This includes resources currently reported in v1.Node `status.allocatable` that are not extended resources (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). Examples include \"cpu\", \"memory\", \"ephemeral-storage\", and hugepages. In addition to standard requests made through the Pod `spec`, these resources can also be requested through claims and allocated by the DRA driver. For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory dependencies of an accelerator device. The keys of this map are the node-allocatable resource names (e.g., \"cpu\", \"memory\"). Extended resource names are not permitted as keys.", } func (Device) SwaggerDoc() map[string]string { @@ -153,11 +154,15 @@ func (DeviceAllocationResult) SwaggerDoc() map[string]string { } var map_DeviceAttribute = map[string]string{ - "": "DeviceAttribute must have exactly one field set.", - "int": "IntValue is a number.", - "bool": "BoolValue is a true/false value.", - "string": "StringValue is a string. Must not be longer than 64 characters.", - "version": "VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.", + "": "DeviceAttribute must have exactly one field set.", + "int": "IntValue is a number.", + "bool": "BoolValue is a true/false value.", + "string": "StringValue is a string. Must not be longer than 64 characters.", + "version": "VersionValue is a semantic version according to semver.org spec 2.0.0. Must not be longer than 64 characters.", + "ints": "IntValues is a non-empty list of numbers.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", + "bools": "BoolValues is a non-empty list of true/false values.", + "strings": "StringValues is a non-empty list of strings. Each string must not be longer than 64 characters.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", + "versions": "VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. Each version string must not be longer than 64 characters.\n\nThis is an alpha field and requires enabling the DRAListTypeAttributes feature gate.", } func (DeviceAttribute) SwaggerDoc() map[string]string { @@ -226,7 +231,7 @@ var map_DeviceClassSpec = map[string]string{ "": "DeviceClassSpec is used in a [DeviceClass] to define what can be allocated and how to configure it.", "selectors": "Each selector must be satisfied by a device which is claimed via this class.", "config": "Config defines configuration parameters that apply to each device that is claimed via this class. Some classses may potentially be satisfied by multiple drivers, so each instance of a vendor configuration applies to exactly one driver.\n\nThey are passed to the driver, but are not considered while allocating the claim.", - "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is an alpha field.", + "extendedResourceName": "ExtendedResourceName is the extended resource name for the devices of this class. The devices of this class can be used to satisfy a pod's extended resource requests. It has the same format as the name of a pod's extended resource. It should be unique among all the device classes in a cluster. If two device classes have the same name, then the class created later is picked to satisfy a pod's extended resource requests. If two classes are created at the same time, then the name of the class lexicographically sorted first is picked.\n\nThis is a beta field.", } func (DeviceClassSpec) SwaggerDoc() map[string]string { @@ -245,8 +250,8 @@ func (DeviceConfiguration) SwaggerDoc() map[string]string { var map_DeviceConstraint = map[string]string{ "": "DeviceConstraint must have exactly one field set besides Requests.", "requests": "Requests is a list of the one or more requests in this claim which must co-satisfy this constraint. If a request is fulfilled by multiple devices, then all of the devices must satisfy the constraint. If this is not specified, this constraint applies to all requests in this claim.\n\nReferences to subrequests must include the name of the main request and may include the subrequest using the format
[/]. If just the main request is given, the constraint applies to all subrequests.", - "matchAttribute": "MatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices.\n\nFor example, if you specified \"dra.example.com/numa\" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen.\n\nMust include the domain qualifier.", - "distinctAttribute": "DistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices.\n\nThis acts as the inverse of MatchAttribute.\n\nThis constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation.\n\nThis is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.", + "matchAttribute": "MatchAttribute requires that all devices in question have this attribute and that its type and value are the same across those devices.\n\nFor example, if you specified \"dra.example.com/numa\" (a hypothetical example!), then only devices in the same NUMA node will be chosen. A device which does not have that attribute will not be chosen. All devices should use a value of the same type for this attribute because that is part of its specification, but if one device doesn't, then it also will not be chosen.\n\nWhen the DRAListTypeAttributes feature gate is enabled, comparison uses set semantics(i.e., element order and duplicates are ignored): list-valued attributes match when the intersection across all devices is non-empty. Scalar values are treated as singleton sets for backward compatibility.\n\nMust include the domain qualifier.", + "distinctAttribute": "DistinctAttribute requires that all devices in question have this attribute and that its type and value are unique across those devices.\n\nWhen the DRAListTypeAttributes feature gate is enabled, comparison uses set semantics (i.e., element order and duplicates are ignored): list-valued attributes must be pairwise disjoint across devices. Scalar values are treated as singleton sets for backward compatibility.\n\nThis acts as the inverse of MatchAttribute.\n\nThis constraint is used to avoid allocating multiple requests to the same device by ensuring attribute-level differentiation.\n\nThis is useful for scenarios where resource requests must be fulfilled by separate physical devices. For example, a container requests two network interfaces that must be allocated from two different physical NICs.", } func (DeviceConstraint) SwaggerDoc() map[string]string { @@ -281,9 +286,9 @@ var map_DeviceRequestAllocationResult = map[string]string{ "pool": "This name together with the driver name and the device name field identify which device was allocated (`//`).\n\nMust not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.", "device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.", "adminAccess": "AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", - "bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", - "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", + "bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", + "bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.", "shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.", "consumedCapacity": "ConsumedCapacity tracks the amount of capacity consumed per device as part of the claim request. The consumed amount may differ from the requested amount: it is rounded up to the nearest valid value based on the device’s requestPolicy if applicable (i.e., may not be less than the requested amount).\n\nThe total consumed capacity for each device must not exceed the DeviceCapacity's Value.\n\nThis field is populated only for devices that allow multiple allocations. All capacity entries are included, even if the consumed amount is zero.", } @@ -308,7 +313,7 @@ var map_DeviceSubRequest = map[string]string{ "selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.", "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", } @@ -321,13 +326,64 @@ var map_DeviceTaint = map[string]string{ "key": "The taint key to be applied to a device. Must be a label name.", "value": "The taint value corresponding to the taint key. Must be a label value.", "effect": "The effect of the taint on claims that do not tolerate the taint and through such claims on the pods using them.\n\nValid effects are None, NoSchedule and NoExecute. PreferNoSchedule as used for nodes is not valid here. More effects may get added in the future. Consumers must treat unknown effects like None.", - "timeAdded": "TimeAdded represents the time at which the taint was added. Added automatically during create or update if not set.", + "timeAdded": "TimeAdded represents the time at which the taint was added or (only in a DeviceTaintRule) the effect was modified. Added automatically during create or update if not set.\n\nIn addition, in a DeviceTaintRule a value provided during an update gets replaced with the current time if the provided value is the same as the old one and the new effect is different. Changing the key and/or value while keeping the effect unchanged is possible and does not update the time stamp because the eviction which uses it is either already started (NoExecute) or not started yet (NoEffect, NoSchedule).", } func (DeviceTaint) SwaggerDoc() map[string]string { return map_DeviceTaint } +var map_DeviceTaintRule = map[string]string{ + "": "DeviceTaintRule adds one taint to all devices which match the selector. This has the same effect as if the taint was specified directly in the ResourceSlice by the DRA driver.", + "metadata": "Standard object metadata", + "spec": "Spec specifies the selector and one taint.\n\nChanging the spec automatically increments the metadata.generation number.", + "status": "Status provides information about what was requested in the spec.", +} + +func (DeviceTaintRule) SwaggerDoc() map[string]string { + return map_DeviceTaintRule +} + +var map_DeviceTaintRuleList = map[string]string{ + "": "DeviceTaintRuleList is a collection of DeviceTaintRules.", + "metadata": "Standard list metadata", + "items": "Items is the list of DeviceTaintRules.", +} + +func (DeviceTaintRuleList) SwaggerDoc() map[string]string { + return map_DeviceTaintRuleList +} + +var map_DeviceTaintRuleSpec = map[string]string{ + "": "DeviceTaintRuleSpec specifies the selector and one taint.", + "deviceSelector": "DeviceSelector defines which device(s) the taint is applied to. All selector criteria must be satisfied for a device to match. The empty selector matches all devices. Without a selector, no devices are matches.", + "taint": "The taint that gets applied to matching devices.", +} + +func (DeviceTaintRuleSpec) SwaggerDoc() map[string]string { + return map_DeviceTaintRuleSpec +} + +var map_DeviceTaintRuleStatus = map[string]string{ + "": "DeviceTaintRuleStatus provides information about an on-going pod eviction.", + "conditions": "Conditions provide information about the state of the DeviceTaintRule and the cluster at some point in time, in a machine-readable and human-readable format.\n\nThe following condition is currently defined as part of this API, more may get added: - Type: EvictionInProgress - Status: True if there are currently pods which need to be evicted, False otherwise\n (includes the effects which don't cause eviction).\n- Reason: not specified, may change - Message: includes information about number of pending pods and already evicted pods\n in a human-readable format, updated periodically, may change\n\nFor `effect: None`, the condition above gets set once for each change to the spec, with the message containing information about what would happen if the effect was `NoExecute`. This feedback can be used to decide whether changing the effect to `NoExecute` will work as intended. It only gets set once to avoid having to constantly update the status.\n\nMust have 8 or fewer entries.", +} + +func (DeviceTaintRuleStatus) SwaggerDoc() map[string]string { + return map_DeviceTaintRuleStatus +} + +var map_DeviceTaintSelector = map[string]string{ + "": "DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The empty selector matches all devices. Without a selector, no devices are matched.", + "driver": "If driver is set, only devices from that driver are selected. This fields corresponds to slice.spec.driver.", + "pool": "If pool is set, only devices in that pool are selected.\n\nAlso setting the driver name may be useful to avoid ambiguity when different drivers use the same pool name, but this is not required because selecting pools from different drivers may also be useful, for example when drivers with node-local devices use the node name as their pool name.", + "device": "If device is set, only devices with that name are selected. This field corresponds to slice.spec.devices[].name.\n\nSetting also driver and pool may be required to avoid ambiguity, but is not required.", +} + +func (DeviceTaintSelector) SwaggerDoc() map[string]string { + return map_DeviceTaintSelector +} + var map_DeviceToleration = map[string]string{ "": "The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches the triple using the matching operator .", "key": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. Must be a label name.", @@ -348,7 +404,7 @@ var map_ExactDeviceRequest = map[string]string{ "allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.", "count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.", "adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.", - "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.", + "tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.", "capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.", } @@ -358,15 +414,25 @@ func (ExactDeviceRequest) SwaggerDoc() map[string]string { var map_NetworkDeviceData = map[string]string{ "": "NetworkDeviceData provides network-related details for the allocated device. This information may be filled by drivers or other components to configure or identify the device within a network context.", - "interfaceName": "InterfaceName specifies the name of the network interface associated with the allocated device. This might be the name of a physical or virtual network interface being configured in the pod.\n\nMust not be longer than 256 characters.", + "interfaceName": "InterfaceName specifies the name of the network interface associated with the allocated device. This might be the name of a physical or virtual network interface being configured in the pod.\n\nMust not be longer than 256 bytes.", "ips": "IPs lists the network addresses assigned to the device's network interface. This can include both IPv4 and IPv6 addresses. The IPs are in the CIDR notation, which includes both the address and the associated subnet mask. e.g.: \"192.0.2.5/24\" for IPv4 and \"2001:db8::5/64\" for IPv6.", - "hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 characters.", + "hardwareAddress": "HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.\n\nMust not be longer than 128 bytes.", } func (NetworkDeviceData) SwaggerDoc() map[string]string { return map_NetworkDeviceData } +var map_NodeAllocatableResourceMapping = map[string]string{ + "": "NodeAllocatableResourceMapping defines the translation between the DRA device/capacity units requested to the corresponding quantity of the node allocatable resource.", + "capacityKey": "CapacityKey references a capacity name defined as a key in the `spec.devices[*].capacity` map. When this field is set, the value associated with this key in the `status.allocation.devices.results[*].consumedCapacity` map (for a specific claim allocation) determines the base quantity for the node allocatable resource. If `allocationMultiplier` is also set, it is multiplied with the base quantity. For example, if `spec.devices[*].capacity` has an entry \"dra.example.com/memory\": \"128Gi\", and this field is set to \"dra.example.com/memory\", then for a claim allocation that consumes { \"dra.example.com/memory\": \"4Gi\" } the base quantity for the node allocatable resource mapping will be \"4Gi\", and `allocationMultiplier` should be omitted or set to \"1\".", + "allocationMultiplier": "AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim.\n\t a. A DRA driver representing each CPU core as a device would have\n {ResourceName: \"cpu\", allocationMultiplier: \"2\"} in its\n `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim,\n\t\t 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity.\n b. A GPU device that needs additional node memory per GPU allocation would\n have {ResourceName: \"memory\", allocationMultiplier: \"2Gi\"}. Each allocated\n\t\t GPU device instance of this type will account for 2Gi of memory.\n\n2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed.\n\t The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`.\n For example, if a Device's capacity \"dra.example.com/cores\" is consumed,\n and each \"core\" provides 2 \"cpu\"s, the mapping would be:\n {ResourceName: \"cpu\", capacityKey: \"dra.example.com/cores\", allocationMultiplier: \"2\"}.\n If a claim consumes 8 \"dra.example.com/cores\", the CPU footprint is 8 * 2 = 16.", +} + +func (NodeAllocatableResourceMapping) SwaggerDoc() map[string]string { + return map_NodeAllocatableResourceMapping +} + var map_OpaqueDeviceConfiguration = map[string]string{ "": "OpaqueDeviceConfiguration contains configuration parameters for a driver in a format defined by the driver vendor.", "driver": "Driver is used to determine which kubelet plugin needs to be passed these configuration parameters.\n\nAn admission policy provided by the driver developer could use this to decide whether it needs to validate them.\n\nMust be a DNS subdomain and should end with a DNS domain owned by the vendor of the driver. It should use only lower case characters.", diff --git a/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go b/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go index 3af5c43c78..820ad2af61 100644 --- a/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/resource/v1beta2/zz_generated.deepcopy.go @@ -302,6 +302,13 @@ func (in *Device) DeepCopyInto(out *Device) { *out = new(bool) **out = **in } + if in.NodeAllocatableResourceMappings != nil { + in, out := &in.NodeAllocatableResourceMappings, &out.NodeAllocatableResourceMappings + *out = make(map[corev1.ResourceName]NodeAllocatableResourceMapping, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } return } @@ -390,6 +397,26 @@ func (in *DeviceAttribute) DeepCopyInto(out *DeviceAttribute) { *out = new(string) **out = **in } + if in.IntValues != nil { + in, out := &in.IntValues, &out.IntValues + *out = make([]int64, len(*in)) + copy(*out, *in) + } + if in.BoolValues != nil { + in, out := &in.BoolValues, &out.BoolValues + *out = make([]bool, len(*in)) + copy(*out, *in) + } + if in.StringValues != nil { + in, out := &in.StringValues, &out.StringValues + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.VersionValues != nil { + in, out := &in.VersionValues, &out.VersionValues + *out = make([]string, len(*in)) + copy(*out, *in) + } return } @@ -825,6 +852,143 @@ func (in *DeviceTaint) DeepCopy() *DeviceTaint { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRule) DeepCopyInto(out *DeviceTaintRule) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRule. +func (in *DeviceTaintRule) DeepCopy() *DeviceTaintRule { + if in == nil { + return nil + } + out := new(DeviceTaintRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeviceTaintRule) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRuleList) DeepCopyInto(out *DeviceTaintRuleList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]DeviceTaintRule, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleList. +func (in *DeviceTaintRuleList) DeepCopy() *DeviceTaintRuleList { + if in == nil { + return nil + } + out := new(DeviceTaintRuleList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DeviceTaintRuleList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRuleSpec) DeepCopyInto(out *DeviceTaintRuleSpec) { + *out = *in + if in.DeviceSelector != nil { + in, out := &in.DeviceSelector, &out.DeviceSelector + *out = new(DeviceTaintSelector) + (*in).DeepCopyInto(*out) + } + in.Taint.DeepCopyInto(&out.Taint) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleSpec. +func (in *DeviceTaintRuleSpec) DeepCopy() *DeviceTaintRuleSpec { + if in == nil { + return nil + } + out := new(DeviceTaintRuleSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintRuleStatus) DeepCopyInto(out *DeviceTaintRuleStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleStatus. +func (in *DeviceTaintRuleStatus) DeepCopy() *DeviceTaintRuleStatus { + if in == nil { + return nil + } + out := new(DeviceTaintRuleStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeviceTaintSelector) DeepCopyInto(out *DeviceTaintSelector) { + *out = *in + if in.Driver != nil { + in, out := &in.Driver, &out.Driver + *out = new(string) + **out = **in + } + if in.Pool != nil { + in, out := &in.Pool, &out.Pool + *out = new(string) + **out = **in + } + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintSelector. +func (in *DeviceTaintSelector) DeepCopy() *DeviceTaintSelector { + if in == nil { + return nil + } + out := new(DeviceTaintSelector) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeviceToleration) DeepCopyInto(out *DeviceToleration) { *out = *in @@ -907,6 +1071,32 @@ func (in *NetworkDeviceData) DeepCopy() *NetworkDeviceData { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResourceMapping) DeepCopyInto(out *NodeAllocatableResourceMapping) { + *out = *in + if in.CapacityKey != nil { + in, out := &in.CapacityKey, &out.CapacityKey + *out = new(QualifiedName) + **out = **in + } + if in.AllocationMultiplier != nil { + in, out := &in.AllocationMultiplier, &out.AllocationMultiplier + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceMapping. +func (in *NodeAllocatableResourceMapping) DeepCopy() *NodeAllocatableResourceMapping { + if in == nil { + return nil + } + out := new(NodeAllocatableResourceMapping) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OpaqueDeviceConfiguration) DeepCopyInto(out *OpaqueDeviceConfiguration) { *out = *in diff --git a/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go b/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go index 0518ff73ce..ce388ffd2e 100644 --- a/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go +++ b/vendor/k8s.io/api/resource/v1beta2/zz_generated.model_name.go @@ -156,6 +156,31 @@ func (in DeviceTaint) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta2.DeviceTaint" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRule) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.DeviceTaintRule" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRuleList) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.DeviceTaintRuleList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRuleSpec) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintRuleStatus) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in DeviceTaintSelector) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.DeviceTaintSelector" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in DeviceToleration) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta2.DeviceToleration" @@ -171,6 +196,11 @@ func (in NetworkDeviceData) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta2.NetworkDeviceData" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in NodeAllocatableResourceMapping) OpenAPIModelName() string { + return "io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in OpaqueDeviceConfiguration) OpenAPIModelName() string { return "io.k8s.api.resource.v1beta2.OpaqueDeviceConfiguration" diff --git a/vendor/k8s.io/api/resource/v1beta2/zz_generated.prerelease-lifecycle.go b/vendor/k8s.io/api/resource/v1beta2/zz_generated.prerelease-lifecycle.go index 898b1aed35..c28687b870 100644 --- a/vendor/k8s.io/api/resource/v1beta2/zz_generated.prerelease-lifecycle.go +++ b/vendor/k8s.io/api/resource/v1beta2/zz_generated.prerelease-lifecycle.go @@ -57,6 +57,42 @@ func (in *DeviceClassList) APILifecycleRemoved() (major, minor int) { return 1, 39 } +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *DeviceTaintRule) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *DeviceTaintRule) APILifecycleDeprecated() (major, minor int) { + return 1, 39 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *DeviceTaintRule) APILifecycleRemoved() (major, minor int) { + return 1, 42 +} + +// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. +func (in *DeviceTaintRuleList) APILifecycleIntroduced() (major, minor int) { + return 1, 36 +} + +// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor. +func (in *DeviceTaintRuleList) APILifecycleDeprecated() (major, minor int) { + return 1, 39 +} + +// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison. +// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor. +func (in *DeviceTaintRuleList) APILifecycleRemoved() (major, minor int) { + return 1, 42 +} + // APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison. // It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go. func (in *ResourceClaim) APILifecycleIntroduced() (major, minor int) { diff --git a/vendor/k8s.io/api/scheduling/v1/generated.proto b/vendor/k8s.io/api/scheduling/v1/generated.proto index 374e68238b..6be7204de1 100644 --- a/vendor/k8s.io/api/scheduling/v1/generated.proto +++ b/vendor/k8s.io/api/scheduling/v1/generated.proto @@ -39,6 +39,7 @@ message PriorityClass { // value represents the integer value of this priority class. This is the actual priority that pods // receive when they have the name of this class in their pod spec. + // +optional optional int32 value = 2; // globalDefault specifies whether this PriorityClass should be considered as diff --git a/vendor/k8s.io/api/scheduling/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/scheduling/v1/generated.protomessage.pb.go deleted file mode 100644 index 261d4903e7..0000000000 --- a/vendor/k8s.io/api/scheduling/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*PriorityClass) ProtoMessage() {} - -func (*PriorityClassList) ProtoMessage() {} diff --git a/vendor/k8s.io/api/scheduling/v1/types.go b/vendor/k8s.io/api/scheduling/v1/types.go index 019dbcd00e..655b5eb159 100644 --- a/vendor/k8s.io/api/scheduling/v1/types.go +++ b/vendor/k8s.io/api/scheduling/v1/types.go @@ -37,6 +37,7 @@ type PriorityClass struct { // value represents the integer value of this priority class. This is the actual priority that pods // receive when they have the name of this class in their pod spec. + // +optional Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"` // globalDefault specifies whether this PriorityClass should be considered as diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go b/vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go deleted file mode 100644 index 64c39b4c35..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go +++ /dev/null @@ -1,2010 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: k8s.io/api/scheduling/v1alpha1/generated.proto - -package v1alpha1 - -import ( - fmt "fmt" - - io "io" - - k8s_io_api_core_v1 "k8s.io/api/core/v1" - - math_bits "math/bits" - reflect "reflect" - strings "strings" -) - -func (m *BasicSchedulingPolicy) Reset() { *m = BasicSchedulingPolicy{} } - -func (m *GangSchedulingPolicy) Reset() { *m = GangSchedulingPolicy{} } - -func (m *PodGroup) Reset() { *m = PodGroup{} } - -func (m *PodGroupPolicy) Reset() { *m = PodGroupPolicy{} } - -func (m *PriorityClass) Reset() { *m = PriorityClass{} } - -func (m *PriorityClassList) Reset() { *m = PriorityClassList{} } - -func (m *TypedLocalObjectReference) Reset() { *m = TypedLocalObjectReference{} } - -func (m *Workload) Reset() { *m = Workload{} } - -func (m *WorkloadList) Reset() { *m = WorkloadList{} } - -func (m *WorkloadSpec) Reset() { *m = WorkloadSpec{} } - -func (m *BasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *BasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *BasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *GangSchedulingPolicy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i = encodeVarintGenerated(dAtA, i, uint64(m.MinCount)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} - -func (m *PodGroup) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodGroup) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Policy.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PodGroupPolicy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PodGroupPolicy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PodGroupPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Gang != nil { - { - size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.Basic != nil { - { - size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} - -func (m *PriorityClass) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PriorityClass) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PriorityClass) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.PreemptionPolicy != nil { - i -= len(*m.PreemptionPolicy) - copy(dAtA[i:], *m.PreemptionPolicy) - i = encodeVarintGenerated(dAtA, i, uint64(len(*m.PreemptionPolicy))) - i-- - dAtA[i] = 0x2a - } - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x22 - i-- - if m.GlobalDefault { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - i = encodeVarintGenerated(dAtA, i, uint64(m.Value)) - i-- - dAtA[i] = 0x10 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *PriorityClassList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PriorityClassList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PriorityClassList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *TypedLocalObjectReference) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TypedLocalObjectReference) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TypedLocalObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0x1a - i -= len(m.Kind) - copy(dAtA[i:], m.Kind) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) - i-- - dAtA[i] = 0x12 - i -= len(m.APIGroup) - copy(dAtA[i:], m.APIGroup) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroup))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Workload) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Workload) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Workload) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - { - size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *WorkloadList) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WorkloadList) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WorkloadList) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *WorkloadSpec) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WorkloadSpec) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WorkloadSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.PodGroups) > 0 { - for iNdEx := len(m.PodGroups) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.PodGroups[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.ControllerRef != nil { - { - size, err := m.ControllerRef.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenerated(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { - offset -= sovGenerated(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *BasicSchedulingPolicy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *GangSchedulingPolicy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovGenerated(uint64(m.MinCount)) - return n -} - -func (m *PodGroup) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - l = m.Policy.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *PodGroupPolicy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Basic != nil { - l = m.Basic.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if m.Gang != nil { - l = m.Gang.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *PriorityClass) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - n += 1 + sovGenerated(uint64(m.Value)) - n += 2 - l = len(m.Description) - n += 1 + l + sovGenerated(uint64(l)) - if m.PreemptionPolicy != nil { - l = len(*m.PreemptionPolicy) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - -func (m *PriorityClassList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *TypedLocalObjectReference) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.APIGroup) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Kind) - n += 1 + l + sovGenerated(uint64(l)) - l = len(m.Name) - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *Workload) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ObjectMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - l = m.Spec.Size() - n += 1 + l + sovGenerated(uint64(l)) - return n -} - -func (m *WorkloadList) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ListMeta.Size() - n += 1 + l + sovGenerated(uint64(l)) - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func (m *WorkloadSpec) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ControllerRef != nil { - l = m.ControllerRef.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - if len(m.PodGroups) > 0 { - for _, e := range m.PodGroups { - l = e.Size() - n += 1 + l + sovGenerated(uint64(l)) - } - } - return n -} - -func sovGenerated(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenerated(x uint64) (n int) { - return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *BasicSchedulingPolicy) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BasicSchedulingPolicy{`, - `}`, - }, "") - return s -} -func (this *GangSchedulingPolicy) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GangSchedulingPolicy{`, - `MinCount:` + fmt.Sprintf("%v", this.MinCount) + `,`, - `}`, - }, "") - return s -} -func (this *PodGroup) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodGroup{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Policy:` + strings.Replace(strings.Replace(this.Policy.String(), "PodGroupPolicy", "PodGroupPolicy", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *PodGroupPolicy) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PodGroupPolicy{`, - `Basic:` + strings.Replace(this.Basic.String(), "BasicSchedulingPolicy", "BasicSchedulingPolicy", 1) + `,`, - `Gang:` + strings.Replace(this.Gang.String(), "GangSchedulingPolicy", "GangSchedulingPolicy", 1) + `,`, - `}`, - }, "") - return s -} -func (this *PriorityClass) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PriorityClass{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `GlobalDefault:` + fmt.Sprintf("%v", this.GlobalDefault) + `,`, - `Description:` + fmt.Sprintf("%v", this.Description) + `,`, - `PreemptionPolicy:` + valueToStringGenerated(this.PreemptionPolicy) + `,`, - `}`, - }, "") - return s -} -func (this *PriorityClassList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]PriorityClass{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PriorityClass", "PriorityClass", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&PriorityClassList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *TypedLocalObjectReference) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&TypedLocalObjectReference{`, - `APIGroup:` + fmt.Sprintf("%v", this.APIGroup) + `,`, - `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `}`, - }, "") - return s -} -func (this *Workload) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Workload{`, - `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, - `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "WorkloadSpec", "WorkloadSpec", 1), `&`, ``, 1) + `,`, - `}`, - }, "") - return s -} -func (this *WorkloadList) String() string { - if this == nil { - return "nil" - } - repeatedStringForItems := "[]Workload{" - for _, f := range this.Items { - repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Workload", "Workload", 1), `&`, ``, 1) + "," - } - repeatedStringForItems += "}" - s := strings.Join([]string{`&WorkloadList{`, - `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, - `Items:` + repeatedStringForItems + `,`, - `}`, - }, "") - return s -} -func (this *WorkloadSpec) String() string { - if this == nil { - return "nil" - } - repeatedStringForPodGroups := "[]PodGroup{" - for _, f := range this.PodGroups { - repeatedStringForPodGroups += strings.Replace(strings.Replace(f.String(), "PodGroup", "PodGroup", 1), `&`, ``, 1) + "," - } - repeatedStringForPodGroups += "}" - s := strings.Join([]string{`&WorkloadSpec{`, - `ControllerRef:` + strings.Replace(this.ControllerRef.String(), "TypedLocalObjectReference", "TypedLocalObjectReference", 1) + `,`, - `PodGroups:` + repeatedStringForPodGroups + `,`, - `}`, - }, "") - return s -} -func valueToStringGenerated(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *BasicSchedulingPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BasicSchedulingPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GangSchedulingPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GangSchedulingPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) - } - m.MinCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinCount |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodGroup) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodGroup: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroup: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Policy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Policy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PodGroupPolicy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PodGroupPolicy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PodGroupPolicy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Basic == nil { - m.Basic = &BasicSchedulingPolicy{} - } - if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Gang == nil { - m.Gang = &GangSchedulingPolicy{} - } - if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PriorityClass) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PriorityClass: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PriorityClass: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - m.Value = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Value |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field GlobalDefault", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.GlobalDefault = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PreemptionPolicy", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := k8s_io_api_core_v1.PreemptionPolicy(dAtA[iNdEx:postIndex]) - m.PreemptionPolicy = &s - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PriorityClassList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PriorityClassList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PriorityClassList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, PriorityClass{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TypedLocalObjectReference: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TypedLocalObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field APIGroup", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.APIGroup = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Kind = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Workload) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Workload: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Workload: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WorkloadList) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WorkloadList: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WorkloadList: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Items = append(m.Items, Workload{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WorkloadSpec: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WorkloadSpec: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ControllerRef", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ControllerRef == nil { - m.ControllerRef = &TypedLocalObjectReference{} - } - if err := m.ControllerRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PodGroups", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PodGroups = append(m.PodGroups, PodGroup{}) - if err := m.PodGroups[len(m.PodGroups)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenerated(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowGenerated - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthGenerated - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenerated - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenerated - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") -) diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/generated.proto b/vendor/k8s.io/api/scheduling/v1alpha1/generated.proto deleted file mode 100644 index 6014f60e20..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha1/generated.proto +++ /dev/null @@ -1,190 +0,0 @@ -/* -Copyright 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. -*/ - - -// This file was autogenerated by go-to-protobuf. Do not edit it manually! - -syntax = "proto2"; - -package k8s.io.api.scheduling.v1alpha1; - -import "k8s.io/api/core/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/generated.proto"; -import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; - -// Package-wide variables from generator "generated". -option go_package = "k8s.io/api/scheduling/v1alpha1"; - -// BasicSchedulingPolicy indicates that standard Kubernetes -// scheduling behavior should be used. -message BasicSchedulingPolicy { -} - -// GangSchedulingPolicy defines the parameters for gang scheduling. -message GangSchedulingPolicy { - // MinCount is the minimum number of pods that must be schedulable or scheduled - // at the same time for the scheduler to admit the entire group. - // It must be a positive integer. - // - // +required - optional int32 minCount = 1; -} - -// PodGroup represents a set of pods with a common scheduling policy. -message PodGroup { - // Name is a unique identifier for the PodGroup within the Workload. - // It must be a DNS label. This field is immutable. - // - // +required - optional string name = 1; - - // Policy defines the scheduling policy for this PodGroup. - // - // +required - optional PodGroupPolicy policy = 3; -} - -// PodGroupPolicy defines the scheduling configuration for a PodGroup. -message PodGroupPolicy { - // Basic specifies that the pods in this group should be scheduled using - // standard Kubernetes scheduling behavior. - // - // +optional - // +oneOf=PolicySelection - optional BasicSchedulingPolicy basic = 2; - - // Gang specifies that the pods in this group should be scheduled using - // all-or-nothing semantics. - // - // +optional - // +oneOf=PolicySelection - optional GangSchedulingPolicy gang = 3; -} - -// DEPRECATED - This group version of PriorityClass is deprecated by scheduling.k8s.io/v1/PriorityClass. -// PriorityClass defines mapping from a priority class name to the priority -// integer value. The value can be any valid integer. -message PriorityClass { - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // value represents the integer value of this priority class. This is the actual priority that pods - // receive when they have the name of this class in their pod spec. - optional int32 value = 2; - - // globalDefault specifies whether this PriorityClass should be considered as - // the default priority for pods that do not have any priority class. - // Only one PriorityClass can be marked as `globalDefault`. However, if more than - // one PriorityClasses exists with their `globalDefault` field set to true, - // the smallest value of such global default PriorityClasses will be used as the default priority. - // +optional - optional bool globalDefault = 3; - - // description is an arbitrary string that usually provides guidelines on - // when this priority class should be used. - // +optional - optional string description = 4; - - // preemptionPolicy is the Policy for preempting pods with lower priority. - // One of Never, PreemptLowerPriority. - // Defaults to PreemptLowerPriority if unset. - // +optional - optional string preemptionPolicy = 5; -} - -// PriorityClassList is a collection of priority classes. -message PriorityClassList { - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - // items is the list of PriorityClasses - repeated PriorityClass items = 2; -} - -// TypedLocalObjectReference allows to reference typed object inside the same namespace. -message TypedLocalObjectReference { - // APIGroup is the group for the resource being referenced. - // If APIGroup is empty, the specified Kind must be in the core API group. - // For any other third-party types, setting APIGroup is required. - // It must be a DNS subdomain. - // - // +optional - optional string apiGroup = 1; - - // Kind is the type of resource being referenced. - // It must be a path segment name. - // - // +required - optional string kind = 2; - - // Name is the name of resource being referenced. - // It must be a path segment name. - // - // +required - optional string name = 3; -} - -// Workload allows for expressing scheduling constraints that should be used -// when managing lifecycle of workloads from scheduling perspective, -// including scheduling, preemption, eviction and other phases. -message Workload { - // Standard object's metadata. - // Name must be a DNS subdomain. - // - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; - - // Spec defines the desired behavior of a Workload. - // - // +required - optional WorkloadSpec spec = 2; -} - -// WorkloadList contains a list of Workload resources. -message WorkloadList { - // Standard list metadata. - // - // +optional - optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; - - // Items is the list of Workloads. - repeated Workload items = 2; -} - -// WorkloadSpec defines the desired state of a Workload. -message WorkloadSpec { - // ControllerRef is an optional reference to the controlling object, such as a - // Deployment or Job. This field is intended for use by tools like CLIs - // to provide a link back to the original workload definition. - // When set, it cannot be changed. - // - // +optional - optional TypedLocalObjectReference controllerRef = 1; - - // PodGroups is the list of pod groups that make up the Workload. - // The maximum number of pod groups is 8. This field is immutable. - // - // +required - // +listType=map - // +listMapKey=name - repeated PodGroup podGroups = 2; -} - diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/scheduling/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index a92e57b1e7..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*BasicSchedulingPolicy) ProtoMessage() {} - -func (*GangSchedulingPolicy) ProtoMessage() {} - -func (*PodGroup) ProtoMessage() {} - -func (*PodGroupPolicy) ProtoMessage() {} - -func (*PriorityClass) ProtoMessage() {} - -func (*PriorityClassList) ProtoMessage() {} - -func (*TypedLocalObjectReference) ProtoMessage() {} - -func (*Workload) ProtoMessage() {} - -func (*WorkloadList) ProtoMessage() {} - -func (*WorkloadSpec) ProtoMessage() {} diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/types.go b/vendor/k8s.io/api/scheduling/v1alpha1/types.go deleted file mode 100644 index 480b53da01..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha1/types.go +++ /dev/null @@ -1,201 +0,0 @@ -/* -Copyright 2017 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. -*/ - -package v1alpha1 - -import ( - apiv1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// +genclient -// +genclient:nonNamespaced -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// DEPRECATED - This group version of PriorityClass is deprecated by scheduling.k8s.io/v1/PriorityClass. -// PriorityClass defines mapping from a priority class name to the priority -// integer value. The value can be any valid integer. -type PriorityClass struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // value represents the integer value of this priority class. This is the actual priority that pods - // receive when they have the name of this class in their pod spec. - Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"` - - // globalDefault specifies whether this PriorityClass should be considered as - // the default priority for pods that do not have any priority class. - // Only one PriorityClass can be marked as `globalDefault`. However, if more than - // one PriorityClasses exists with their `globalDefault` field set to true, - // the smallest value of such global default PriorityClasses will be used as the default priority. - // +optional - GlobalDefault bool `json:"globalDefault,omitempty" protobuf:"bytes,3,opt,name=globalDefault"` - - // description is an arbitrary string that usually provides guidelines on - // when this priority class should be used. - // +optional - Description string `json:"description,omitempty" protobuf:"bytes,4,opt,name=description"` - - // preemptionPolicy is the Policy for preempting pods with lower priority. - // One of Never, PreemptLowerPriority. - // Defaults to PreemptLowerPriority if unset. - // +optional - PreemptionPolicy *apiv1.PreemptionPolicy `json:"preemptionPolicy,omitempty" protobuf:"bytes,5,opt,name=preemptionPolicy"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// PriorityClassList is a collection of priority classes. -type PriorityClassList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // items is the list of PriorityClasses - Items []PriorityClass `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// +genclient -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// Workload allows for expressing scheduling constraints that should be used -// when managing lifecycle of workloads from scheduling perspective, -// including scheduling, preemption, eviction and other phases. -type Workload struct { - metav1.TypeMeta `json:",inline"` - // Standard object's metadata. - // Name must be a DNS subdomain. - // - // +optional - metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Spec defines the desired behavior of a Workload. - // - // +required - Spec WorkloadSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` -} - -// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// WorkloadList contains a list of Workload resources. -type WorkloadList struct { - metav1.TypeMeta `json:",inline"` - // Standard list metadata. - // - // +optional - metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` - - // Items is the list of Workloads. - Items []Workload `json:"items" protobuf:"bytes,2,rep,name=items"` -} - -// WorkloadMaxPodGroups is the maximum number of pod groups per Workload. -const WorkloadMaxPodGroups = 8 - -// WorkloadSpec defines the desired state of a Workload. -type WorkloadSpec struct { - // ControllerRef is an optional reference to the controlling object, such as a - // Deployment or Job. This field is intended for use by tools like CLIs - // to provide a link back to the original workload definition. - // When set, it cannot be changed. - // - // +optional - ControllerRef *TypedLocalObjectReference `json:"controllerRef,omitempty" protobuf:"bytes,1,opt,name=controllerRef"` - - // PodGroups is the list of pod groups that make up the Workload. - // The maximum number of pod groups is 8. This field is immutable. - // - // +required - // +listType=map - // +listMapKey=name - PodGroups []PodGroup `json:"podGroups" protobuf:"bytes,2,rep,name=podGroups"` -} - -// TypedLocalObjectReference allows to reference typed object inside the same namespace. -type TypedLocalObjectReference struct { - // APIGroup is the group for the resource being referenced. - // If APIGroup is empty, the specified Kind must be in the core API group. - // For any other third-party types, setting APIGroup is required. - // It must be a DNS subdomain. - // - // +optional - APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,1,opt,name=apiGroup"` - // Kind is the type of resource being referenced. - // It must be a path segment name. - // - // +required - Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` - // Name is the name of resource being referenced. - // It must be a path segment name. - // - // +required - Name string `json:"name" protobuf:"bytes,3,opt,name=name"` -} - -// PodGroup represents a set of pods with a common scheduling policy. -type PodGroup struct { - // Name is a unique identifier for the PodGroup within the Workload. - // It must be a DNS label. This field is immutable. - // - // +required - Name string `json:"name" protobuf:"bytes,1,opt,name=name"` - - // Policy defines the scheduling policy for this PodGroup. - // - // +required - Policy PodGroupPolicy `json:"policy" protobuf:"bytes,3,opt,name=policy"` -} - -// PodGroupPolicy defines the scheduling configuration for a PodGroup. -type PodGroupPolicy struct { - // Basic specifies that the pods in this group should be scheduled using - // standard Kubernetes scheduling behavior. - // - // +optional - // +oneOf=PolicySelection - Basic *BasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,2,opt,name=basic"` - - // Gang specifies that the pods in this group should be scheduled using - // all-or-nothing semantics. - // - // +optional - // +oneOf=PolicySelection - Gang *GangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,3,opt,name=gang"` -} - -// BasicSchedulingPolicy indicates that standard Kubernetes -// scheduling behavior should be used. -type BasicSchedulingPolicy struct { - // This is intentionally empty. Its presence indicates that the basic - // scheduling policy should be applied. In the future, new fields may appear, - // describing such constraints on a pod group level without "all or nothing" - // (gang) scheduling. -} - -// GangSchedulingPolicy defines the parameters for gang scheduling. -type GangSchedulingPolicy struct { - // MinCount is the minimum number of pods that must be schedulable or scheduled - // at the same time for the scheduler to admit the entire group. - // It must be a positive integer. - // - // +required - MinCount int32 `json:"minCount" protobuf:"varint,1,opt,name=minCount"` -} diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go b/vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go deleted file mode 100644 index a2915bff44..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright 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. -*/ - -package v1alpha1 - -// This file contains a collection of methods that can be used from go-restful to -// generate Swagger API documentation for its models. Please read this PR for more -// information on the implementation: https://github.com/emicklei/go-restful/pull/215 -// -// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if -// they are on one line! For multiple line or blocks that you want to ignore use ---. -// Any context after a --- is ignored. -// -// Those methods can be generated by using hack/update-codegen.sh - -// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. -var map_BasicSchedulingPolicy = map[string]string{ - "": "BasicSchedulingPolicy indicates that standard Kubernetes scheduling behavior should be used.", -} - -func (BasicSchedulingPolicy) SwaggerDoc() map[string]string { - return map_BasicSchedulingPolicy -} - -var map_GangSchedulingPolicy = map[string]string{ - "": "GangSchedulingPolicy defines the parameters for gang scheduling.", - "minCount": "MinCount is the minimum number of pods that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer.", -} - -func (GangSchedulingPolicy) SwaggerDoc() map[string]string { - return map_GangSchedulingPolicy -} - -var map_PodGroup = map[string]string{ - "": "PodGroup represents a set of pods with a common scheduling policy.", - "name": "Name is a unique identifier for the PodGroup within the Workload. It must be a DNS label. This field is immutable.", - "policy": "Policy defines the scheduling policy for this PodGroup.", -} - -func (PodGroup) SwaggerDoc() map[string]string { - return map_PodGroup -} - -var map_PodGroupPolicy = map[string]string{ - "": "PodGroupPolicy defines the scheduling configuration for a PodGroup.", - "basic": "Basic specifies that the pods in this group should be scheduled using standard Kubernetes scheduling behavior.", - "gang": "Gang specifies that the pods in this group should be scheduled using all-or-nothing semantics.", -} - -func (PodGroupPolicy) SwaggerDoc() map[string]string { - return map_PodGroupPolicy -} - -var map_PriorityClass = map[string]string{ - "": "DEPRECATED - This group version of PriorityClass is deprecated by scheduling.k8s.io/v1/PriorityClass. PriorityClass defines mapping from a priority class name to the priority integer value. The value can be any valid integer.", - "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "value": "value represents the integer value of this priority class. This is the actual priority that pods receive when they have the name of this class in their pod spec.", - "globalDefault": "globalDefault specifies whether this PriorityClass should be considered as the default priority for pods that do not have any priority class. Only one PriorityClass can be marked as `globalDefault`. However, if more than one PriorityClasses exists with their `globalDefault` field set to true, the smallest value of such global default PriorityClasses will be used as the default priority.", - "description": "description is an arbitrary string that usually provides guidelines on when this priority class should be used.", - "preemptionPolicy": "preemptionPolicy is the Policy for preempting pods with lower priority. One of Never, PreemptLowerPriority. Defaults to PreemptLowerPriority if unset.", -} - -func (PriorityClass) SwaggerDoc() map[string]string { - return map_PriorityClass -} - -var map_PriorityClassList = map[string]string{ - "": "PriorityClassList is a collection of priority classes.", - "metadata": "Standard list metadata More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", - "items": "items is the list of PriorityClasses", -} - -func (PriorityClassList) SwaggerDoc() map[string]string { - return map_PriorityClassList -} - -var map_TypedLocalObjectReference = map[string]string{ - "": "TypedLocalObjectReference allows to reference typed object inside the same namespace.", - "apiGroup": "APIGroup is the group for the resource being referenced. If APIGroup is empty, the specified Kind must be in the core API group. For any other third-party types, setting APIGroup is required. It must be a DNS subdomain.", - "kind": "Kind is the type of resource being referenced. It must be a path segment name.", - "name": "Name is the name of resource being referenced. It must be a path segment name.", -} - -func (TypedLocalObjectReference) SwaggerDoc() map[string]string { - return map_TypedLocalObjectReference -} - -var map_Workload = map[string]string{ - "": "Workload allows for expressing scheduling constraints that should be used when managing lifecycle of workloads from scheduling perspective, including scheduling, preemption, eviction and other phases.", - "metadata": "Standard object's metadata. Name must be a DNS subdomain.", - "spec": "Spec defines the desired behavior of a Workload.", -} - -func (Workload) SwaggerDoc() map[string]string { - return map_Workload -} - -var map_WorkloadList = map[string]string{ - "": "WorkloadList contains a list of Workload resources.", - "metadata": "Standard list metadata.", - "items": "Items is the list of Workloads.", -} - -func (WorkloadList) SwaggerDoc() map[string]string { - return map_WorkloadList -} - -var map_WorkloadSpec = map[string]string{ - "": "WorkloadSpec defines the desired state of a Workload.", - "controllerRef": "ControllerRef is an optional reference to the controlling object, such as a Deployment or Job. This field is intended for use by tools like CLIs to provide a link back to the original workload definition. When set, it cannot be changed.", - "podGroups": "PodGroups is the list of pod groups that make up the Workload. The maximum number of pod groups is 8. This field is immutable.", -} - -func (WorkloadSpec) SwaggerDoc() map[string]string { - return map_WorkloadSpec -} - -// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go b/vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go deleted file mode 100644 index ccaf45d72c..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go +++ /dev/null @@ -1,270 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by deepcopy-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - v1 "k8s.io/api/core/v1" - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *BasicSchedulingPolicy) DeepCopyInto(out *BasicSchedulingPolicy) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicSchedulingPolicy. -func (in *BasicSchedulingPolicy) DeepCopy() *BasicSchedulingPolicy { - if in == nil { - return nil - } - out := new(BasicSchedulingPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *GangSchedulingPolicy) DeepCopyInto(out *GangSchedulingPolicy) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GangSchedulingPolicy. -func (in *GangSchedulingPolicy) DeepCopy() *GangSchedulingPolicy { - if in == nil { - return nil - } - out := new(GangSchedulingPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroup) DeepCopyInto(out *PodGroup) { - *out = *in - in.Policy.DeepCopyInto(&out.Policy) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. -func (in *PodGroup) DeepCopy() *PodGroup { - if in == nil { - return nil - } - out := new(PodGroup) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PodGroupPolicy) DeepCopyInto(out *PodGroupPolicy) { - *out = *in - if in.Basic != nil { - in, out := &in.Basic, &out.Basic - *out = new(BasicSchedulingPolicy) - **out = **in - } - if in.Gang != nil { - in, out := &in.Gang, &out.Gang - *out = new(GangSchedulingPolicy) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupPolicy. -func (in *PodGroupPolicy) DeepCopy() *PodGroupPolicy { - if in == nil { - return nil - } - out := new(PodGroupPolicy) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PriorityClass) DeepCopyInto(out *PriorityClass) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - if in.PreemptionPolicy != nil { - in, out := &in.PreemptionPolicy, &out.PreemptionPolicy - *out = new(v1.PreemptionPolicy) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityClass. -func (in *PriorityClass) DeepCopy() *PriorityClass { - if in == nil { - return nil - } - out := new(PriorityClass) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PriorityClass) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *PriorityClassList) DeepCopyInto(out *PriorityClassList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]PriorityClass, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityClassList. -func (in *PriorityClassList) DeepCopy() *PriorityClassList { - if in == nil { - return nil - } - out := new(PriorityClassList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *PriorityClassList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *TypedLocalObjectReference) DeepCopyInto(out *TypedLocalObjectReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedLocalObjectReference. -func (in *TypedLocalObjectReference) DeepCopy() *TypedLocalObjectReference { - if in == nil { - return nil - } - out := new(TypedLocalObjectReference) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Workload) DeepCopyInto(out *Workload) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.Spec.DeepCopyInto(&out.Spec) - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workload. -func (in *Workload) DeepCopy() *Workload { - if in == nil { - return nil - } - out := new(Workload) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *Workload) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadList) DeepCopyInto(out *WorkloadList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]Workload, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadList. -func (in *WorkloadList) DeepCopy() *WorkloadList { - if in == nil { - return nil - } - out := new(WorkloadList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WorkloadList) DeepCopyObject() runtime.Object { - if c := in.DeepCopy(); c != nil { - return c - } - return nil -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) { - *out = *in - if in.ControllerRef != nil { - in, out := &in.ControllerRef, &out.ControllerRef - *out = new(TypedLocalObjectReference) - **out = **in - } - if in.PodGroups != nil { - in, out := &in.PodGroups, &out.PodGroups - *out = make([]PodGroup, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpec. -func (in *WorkloadSpec) DeepCopy() *WorkloadSpec { - if in == nil { - return nil - } - out := new(WorkloadSpec) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.model_name.go b/vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.model_name.go deleted file mode 100644 index 25844f419a..0000000000 --- a/vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.model_name.go +++ /dev/null @@ -1,72 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by openapi-gen. DO NOT EDIT. - -package v1alpha1 - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in BasicSchedulingPolicy) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.BasicSchedulingPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in GangSchedulingPolicy) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.GangSchedulingPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroup) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.PodGroup" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PodGroupPolicy) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.PodGroupPolicy" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PriorityClass) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.PriorityClass" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in PriorityClassList) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.PriorityClassList" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in TypedLocalObjectReference) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.TypedLocalObjectReference" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in Workload) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.Workload" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in WorkloadList) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.WorkloadList" -} - -// OpenAPIModelName returns the OpenAPI model name for this type. -func (in WorkloadSpec) OpenAPIModelName() string { - return "io.k8s.api.scheduling.v1alpha1.WorkloadSpec" -} diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/doc.go b/vendor/k8s.io/api/scheduling/v1alpha2/doc.go similarity index 84% rename from vendor/k8s.io/api/scheduling/v1alpha1/doc.go rename to vendor/k8s.io/api/scheduling/v1alpha2/doc.go index 2b6182e864..24ba23e72c 100644 --- a/vendor/k8s.io/api/scheduling/v1alpha1/doc.go +++ b/vendor/k8s.io/api/scheduling/v1alpha2/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors. +Copyright 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. @@ -17,8 +17,8 @@ limitations under the License. // +k8s:deepcopy-gen=package // +k8s:protobuf-gen=package // +k8s:openapi-gen=true -// +k8s:openapi-model-package=io.k8s.api.scheduling.v1alpha1 +// +k8s:openapi-model-package=io.k8s.api.scheduling.v1alpha2 // +groupName=scheduling.k8s.io -package v1alpha1 +package v1alpha2 diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/generated.pb.go b/vendor/k8s.io/api/scheduling/v1alpha2/generated.pb.go new file mode 100644 index 0000000000..12402df3d2 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha2/generated.pb.go @@ -0,0 +1,3828 @@ +/* +Copyright 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. +*/ + +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: k8s.io/api/scheduling/v1alpha2/generated.proto + +package v1alpha2 + +import ( + fmt "fmt" + + io "io" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +func (m *BasicSchedulingPolicy) Reset() { *m = BasicSchedulingPolicy{} } + +func (m *GangSchedulingPolicy) Reset() { *m = GangSchedulingPolicy{} } + +func (m *PodGroup) Reset() { *m = PodGroup{} } + +func (m *PodGroupList) Reset() { *m = PodGroupList{} } + +func (m *PodGroupResourceClaim) Reset() { *m = PodGroupResourceClaim{} } + +func (m *PodGroupResourceClaimStatus) Reset() { *m = PodGroupResourceClaimStatus{} } + +func (m *PodGroupSchedulingConstraints) Reset() { *m = PodGroupSchedulingConstraints{} } + +func (m *PodGroupSchedulingPolicy) Reset() { *m = PodGroupSchedulingPolicy{} } + +func (m *PodGroupSpec) Reset() { *m = PodGroupSpec{} } + +func (m *PodGroupStatus) Reset() { *m = PodGroupStatus{} } + +func (m *PodGroupTemplate) Reset() { *m = PodGroupTemplate{} } + +func (m *PodGroupTemplateReference) Reset() { *m = PodGroupTemplateReference{} } + +func (m *TopologyConstraint) Reset() { *m = TopologyConstraint{} } + +func (m *TypedLocalObjectReference) Reset() { *m = TypedLocalObjectReference{} } + +func (m *Workload) Reset() { *m = Workload{} } + +func (m *WorkloadList) Reset() { *m = WorkloadList{} } + +func (m *WorkloadPodGroupTemplateReference) Reset() { *m = WorkloadPodGroupTemplateReference{} } + +func (m *WorkloadSpec) Reset() { *m = WorkloadSpec{} } + +func (m *BasicSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BasicSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BasicSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *GangSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GangSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GangSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i = encodeVarintGenerated(dAtA, i, uint64(m.MinCount)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} + +func (m *PodGroup) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroup) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroup) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Status.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupResourceClaim) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupResourceClaim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupResourceClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResourceClaimTemplateName != nil { + i -= len(*m.ResourceClaimTemplateName) + copy(dAtA[i:], *m.ResourceClaimTemplateName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimTemplateName))) + i-- + dAtA[i] = 0x1a + } + if m.ResourceClaimName != nil { + i -= len(*m.ResourceClaimName) + copy(dAtA[i:], *m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupResourceClaimStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupResourceClaimStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupResourceClaimStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ResourceClaimName != nil { + i -= len(*m.ResourceClaimName) + copy(dAtA[i:], *m.ResourceClaimName) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.ResourceClaimName))) + i-- + dAtA[i] = 0x12 + } + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupSchedulingConstraints) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSchedulingConstraints) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSchedulingConstraints) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Topology) > 0 { + for iNdEx := len(m.Topology) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Topology[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PodGroupSchedulingPolicy) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSchedulingPolicy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSchedulingPolicy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Gang != nil { + { + size, err := m.Gang.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.Basic != nil { + { + size, err := m.Basic.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PodGroupSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x38 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x32 + if m.DisruptionMode != nil { + i -= len(*m.DisruptionMode) + copy(dAtA[i:], *m.DisruptionMode) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.DisruptionMode))) + i-- + dAtA[i] = 0x2a + } + if len(m.ResourceClaims) > 0 { + for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if m.PodGroupTemplateRef != nil { + { + size, err := m.PodGroupTemplateRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PodGroupStatus) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupStatus) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupStatus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ResourceClaimStatuses) > 0 { + for iNdEx := len(m.ResourceClaimStatuses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaimStatuses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Conditions) > 0 { + for iNdEx := len(m.Conditions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Conditions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *PodGroupTemplate) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupTemplate) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupTemplate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Priority != nil { + i = encodeVarintGenerated(dAtA, i, uint64(*m.Priority)) + i-- + dAtA[i] = 0x38 + } + i -= len(m.PriorityClassName) + copy(dAtA[i:], m.PriorityClassName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PriorityClassName))) + i-- + dAtA[i] = 0x32 + if m.DisruptionMode != nil { + i -= len(*m.DisruptionMode) + copy(dAtA[i:], *m.DisruptionMode) + i = encodeVarintGenerated(dAtA, i, uint64(len(*m.DisruptionMode))) + i-- + dAtA[i] = 0x2a + } + if len(m.ResourceClaims) > 0 { + for iNdEx := len(m.ResourceClaims) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourceClaims[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if m.SchedulingConstraints != nil { + { + size, err := m.SchedulingConstraints.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + { + size, err := m.SchedulingPolicy.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *PodGroupTemplateReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PodGroupTemplateReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PodGroupTemplateReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Workload != nil { + { + size, err := m.Workload.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TopologyConstraint) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TopologyConstraint) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TopologyConstraint) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *TypedLocalObjectReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TypedLocalObjectReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TypedLocalObjectReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x1a + i -= len(m.Kind) + copy(dAtA[i:], m.Kind) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Kind))) + i-- + dAtA[i] = 0x12 + i -= len(m.APIGroup) + copy(dAtA[i:], m.APIGroup) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.APIGroup))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Workload) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Workload) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Workload) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.ObjectMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadList) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for iNdEx := len(m.Items) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Items[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.ListMeta.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadPodGroupTemplateReference) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadPodGroupTemplateReference) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadPodGroupTemplateReference) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.PodGroupTemplateName) + copy(dAtA[i:], m.PodGroupTemplateName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.PodGroupTemplateName))) + i-- + dAtA[i] = 0x12 + i -= len(m.WorkloadName) + copy(dAtA[i:], m.WorkloadName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.WorkloadName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *WorkloadSpec) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WorkloadSpec) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WorkloadSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.PodGroupTemplates) > 0 { + for iNdEx := len(m.PodGroupTemplates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.PodGroupTemplates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.ControllerRef != nil { + { + size, err := m.ControllerRef.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGenerated(dAtA []byte, offset int, v uint64) int { + offset -= sovGenerated(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BasicSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GangSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovGenerated(uint64(m.MinCount)) + return n +} + +func (m *PodGroup) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Status.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *PodGroupList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupResourceClaim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.ResourceClaimName != nil { + l = len(*m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + } + if m.ResourceClaimTemplateName != nil { + l = len(*m.ResourceClaimTemplateName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupResourceClaimStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + if m.ResourceClaimName != nil { + l = len(*m.ResourceClaimName) + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupSchedulingConstraints) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Topology) > 0 { + for _, e := range m.Topology { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupSchedulingPolicy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Basic != nil { + l = m.Basic.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if m.Gang != nil { + l = m.Gang.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *PodGroupSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PodGroupTemplateRef != nil { + l = m.PodGroupTemplateRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceClaims) > 0 { + for _, e := range m.ResourceClaims { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.DisruptionMode != nil { + l = len(*m.DisruptionMode) + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + return n +} + +func (m *PodGroupStatus) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Conditions) > 0 { + for _, e := range m.Conditions { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if len(m.ResourceClaimStatuses) > 0 { + for _, e := range m.ResourceClaimStatuses { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *PodGroupTemplate) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + l = m.SchedulingPolicy.Size() + n += 1 + l + sovGenerated(uint64(l)) + if m.SchedulingConstraints != nil { + l = m.SchedulingConstraints.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.ResourceClaims) > 0 { + for _, e := range m.ResourceClaims { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + if m.DisruptionMode != nil { + l = len(*m.DisruptionMode) + n += 1 + l + sovGenerated(uint64(l)) + } + l = len(m.PriorityClassName) + n += 1 + l + sovGenerated(uint64(l)) + if m.Priority != nil { + n += 1 + sovGenerated(uint64(*m.Priority)) + } + return n +} + +func (m *PodGroupTemplateReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Workload != nil { + l = m.Workload.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (m *TopologyConstraint) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *TypedLocalObjectReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.APIGroup) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Kind) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Name) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *Workload) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ObjectMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + l = m.Spec.Size() + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *WorkloadList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ListMeta.Size() + n += 1 + l + sovGenerated(uint64(l)) + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func (m *WorkloadPodGroupTemplateReference) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.WorkloadName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.PodGroupTemplateName) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + +func (m *WorkloadSpec) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ControllerRef != nil { + l = m.ControllerRef.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + if len(m.PodGroupTemplates) > 0 { + for _, e := range m.PodGroupTemplates { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } + return n +} + +func sovGenerated(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenerated(x uint64) (n int) { + return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *BasicSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BasicSchedulingPolicy{`, + `}`, + }, "") + return s +} +func (this *GangSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&GangSchedulingPolicy{`, + `MinCount:` + fmt.Sprintf("%v", this.MinCount) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroup) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroup{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "PodGroupSpec", "PodGroupSpec", 1), `&`, ``, 1) + `,`, + `Status:` + strings.Replace(strings.Replace(this.Status.String(), "PodGroupStatus", "PodGroupStatus", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]PodGroup{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "PodGroup", "PodGroup", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&PodGroupList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupResourceClaim) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupResourceClaim{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + `ResourceClaimTemplateName:` + valueToStringGenerated(this.ResourceClaimTemplateName) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupResourceClaimStatus) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupResourceClaimStatus{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `ResourceClaimName:` + valueToStringGenerated(this.ResourceClaimName) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSchedulingConstraints) String() string { + if this == nil { + return "nil" + } + repeatedStringForTopology := "[]TopologyConstraint{" + for _, f := range this.Topology { + repeatedStringForTopology += strings.Replace(strings.Replace(f.String(), "TopologyConstraint", "TopologyConstraint", 1), `&`, ``, 1) + "," + } + repeatedStringForTopology += "}" + s := strings.Join([]string{`&PodGroupSchedulingConstraints{`, + `Topology:` + repeatedStringForTopology + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSchedulingPolicy) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupSchedulingPolicy{`, + `Basic:` + strings.Replace(this.Basic.String(), "BasicSchedulingPolicy", "BasicSchedulingPolicy", 1) + `,`, + `Gang:` + strings.Replace(this.Gang.String(), "GangSchedulingPolicy", "GangSchedulingPolicy", 1) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupSpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" + for _, f := range this.ResourceClaims { + repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaims += "}" + s := strings.Join([]string{`&PodGroupSpec{`, + `PodGroupTemplateRef:` + strings.Replace(this.PodGroupTemplateRef.String(), "PodGroupTemplateReference", "PodGroupTemplateReference", 1) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, + `ResourceClaims:` + repeatedStringForResourceClaims + `,`, + `DisruptionMode:` + valueToStringGenerated(this.DisruptionMode) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupStatus) String() string { + if this == nil { + return "nil" + } + repeatedStringForConditions := "[]Condition{" + for _, f := range this.Conditions { + repeatedStringForConditions += fmt.Sprintf("%v", f) + "," + } + repeatedStringForConditions += "}" + repeatedStringForResourceClaimStatuses := "[]PodGroupResourceClaimStatus{" + for _, f := range this.ResourceClaimStatuses { + repeatedStringForResourceClaimStatuses += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaimStatus", "PodGroupResourceClaimStatus", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaimStatuses += "}" + s := strings.Join([]string{`&PodGroupStatus{`, + `Conditions:` + repeatedStringForConditions + `,`, + `ResourceClaimStatuses:` + repeatedStringForResourceClaimStatuses + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupTemplate) String() string { + if this == nil { + return "nil" + } + repeatedStringForResourceClaims := "[]PodGroupResourceClaim{" + for _, f := range this.ResourceClaims { + repeatedStringForResourceClaims += strings.Replace(strings.Replace(f.String(), "PodGroupResourceClaim", "PodGroupResourceClaim", 1), `&`, ``, 1) + "," + } + repeatedStringForResourceClaims += "}" + s := strings.Join([]string{`&PodGroupTemplate{`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `SchedulingPolicy:` + strings.Replace(strings.Replace(this.SchedulingPolicy.String(), "PodGroupSchedulingPolicy", "PodGroupSchedulingPolicy", 1), `&`, ``, 1) + `,`, + `SchedulingConstraints:` + strings.Replace(this.SchedulingConstraints.String(), "PodGroupSchedulingConstraints", "PodGroupSchedulingConstraints", 1) + `,`, + `ResourceClaims:` + repeatedStringForResourceClaims + `,`, + `DisruptionMode:` + valueToStringGenerated(this.DisruptionMode) + `,`, + `PriorityClassName:` + fmt.Sprintf("%v", this.PriorityClassName) + `,`, + `Priority:` + valueToStringGenerated(this.Priority) + `,`, + `}`, + }, "") + return s +} +func (this *PodGroupTemplateReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PodGroupTemplateReference{`, + `Workload:` + strings.Replace(this.Workload.String(), "WorkloadPodGroupTemplateReference", "WorkloadPodGroupTemplateReference", 1) + `,`, + `}`, + }, "") + return s +} +func (this *TopologyConstraint) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TopologyConstraint{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `}`, + }, "") + return s +} +func (this *TypedLocalObjectReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TypedLocalObjectReference{`, + `APIGroup:` + fmt.Sprintf("%v", this.APIGroup) + `,`, + `Kind:` + fmt.Sprintf("%v", this.Kind) + `,`, + `Name:` + fmt.Sprintf("%v", this.Name) + `,`, + `}`, + }, "") + return s +} +func (this *Workload) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Workload{`, + `ObjectMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ObjectMeta), "ObjectMeta", "v1.ObjectMeta", 1), `&`, ``, 1) + `,`, + `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "WorkloadSpec", "WorkloadSpec", 1), `&`, ``, 1) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadList) String() string { + if this == nil { + return "nil" + } + repeatedStringForItems := "[]Workload{" + for _, f := range this.Items { + repeatedStringForItems += strings.Replace(strings.Replace(f.String(), "Workload", "Workload", 1), `&`, ``, 1) + "," + } + repeatedStringForItems += "}" + s := strings.Join([]string{`&WorkloadList{`, + `ListMeta:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.ListMeta), "ListMeta", "v1.ListMeta", 1), `&`, ``, 1) + `,`, + `Items:` + repeatedStringForItems + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadPodGroupTemplateReference) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&WorkloadPodGroupTemplateReference{`, + `WorkloadName:` + fmt.Sprintf("%v", this.WorkloadName) + `,`, + `PodGroupTemplateName:` + fmt.Sprintf("%v", this.PodGroupTemplateName) + `,`, + `}`, + }, "") + return s +} +func (this *WorkloadSpec) String() string { + if this == nil { + return "nil" + } + repeatedStringForPodGroupTemplates := "[]PodGroupTemplate{" + for _, f := range this.PodGroupTemplates { + repeatedStringForPodGroupTemplates += strings.Replace(strings.Replace(f.String(), "PodGroupTemplate", "PodGroupTemplate", 1), `&`, ``, 1) + "," + } + repeatedStringForPodGroupTemplates += "}" + s := strings.Join([]string{`&WorkloadSpec{`, + `ControllerRef:` + strings.Replace(this.ControllerRef.String(), "TypedLocalObjectReference", "TypedLocalObjectReference", 1) + `,`, + `PodGroupTemplates:` + repeatedStringForPodGroupTemplates + `,`, + `}`, + }, "") + return s +} +func valueToStringGenerated(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *BasicSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BasicSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BasicSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GangSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GangSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GangSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinCount", wireType) + } + m.MinCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinCount |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Status.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, PodGroup{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupResourceClaim) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupResourceClaim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupResourceClaim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimTemplateName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimTemplateName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupResourceClaimStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupResourceClaimStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupResourceClaimStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := string(dAtA[iNdEx:postIndex]) + m.ResourceClaimName = &s + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSchedulingConstraints) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSchedulingConstraints: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSchedulingConstraints: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Topology", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Topology = append(m.Topology, TopologyConstraint{}) + if err := m.Topology[len(m.Topology)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSchedulingPolicy) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSchedulingPolicy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSchedulingPolicy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Basic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Basic == nil { + m.Basic = &BasicSchedulingPolicy{} + } + if err := m.Basic.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gang", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Gang == nil { + m.Gang = &GangSchedulingPolicy{} + } + if err := m.Gang.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplateRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PodGroupTemplateRef == nil { + m.PodGroupTemplateRef = &PodGroupTemplateReference{} + } + if err := m.PodGroupTemplateRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &PodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) + if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := DisruptionMode(dAtA[iNdEx:postIndex]) + m.DisruptionMode = &s + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupStatus) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Conditions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Conditions = append(m.Conditions, v1.Condition{}) + if err := m.Conditions[len(m.Conditions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaimStatuses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaimStatuses = append(m.ResourceClaimStatuses, PodGroupResourceClaimStatus{}) + if err := m.ResourceClaimStatuses[len(m.ResourceClaimStatuses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupTemplate) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupTemplate: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupTemplate: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingPolicy", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.SchedulingPolicy.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SchedulingConstraints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SchedulingConstraints == nil { + m.SchedulingConstraints = &PodGroupSchedulingConstraints{} + } + if err := m.SchedulingConstraints.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourceClaims", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourceClaims = append(m.ResourceClaims, PodGroupResourceClaim{}) + if err := m.ResourceClaims[len(m.ResourceClaims)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DisruptionMode", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + s := DisruptionMode(dAtA[iNdEx:postIndex]) + m.DisruptionMode = &s + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PriorityClassName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PriorityClassName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Priority", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Priority = &v + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PodGroupTemplateReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PodGroupTemplateReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PodGroupTemplateReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Workload", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Workload == nil { + m.Workload = &WorkloadPodGroupTemplateReference{} + } + if err := m.Workload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TopologyConstraint) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TopologyConstraint: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TopologyConstraint: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TypedLocalObjectReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TypedLocalObjectReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TypedLocalObjectReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field APIGroup", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.APIGroup = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Kind", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Kind = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Workload) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Workload: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Workload: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ObjectMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ListMeta.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, Workload{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadPodGroupTemplateReference) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadPodGroupTemplateReference: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadPodGroupTemplateReference: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WorkloadName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WorkloadName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplateName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PodGroupTemplateName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WorkloadSpec) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WorkloadSpec: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WorkloadSpec: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ControllerRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ControllerRef == nil { + m.ControllerRef = &TypedLocalObjectReference{} + } + if err := m.ControllerRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PodGroupTemplates", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PodGroupTemplates = append(m.PodGroupTemplates, PodGroupTemplate{}) + if err := m.PodGroupTemplates[len(m.PodGroupTemplates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenerated(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenerated + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenerated + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenerated + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenerated + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenerated = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenerated = fmt.Errorf("proto: unexpected end of group") +) diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/generated.proto b/vendor/k8s.io/api/scheduling/v1alpha2/generated.proto new file mode 100644 index 0000000000..73b3308e38 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha2/generated.proto @@ -0,0 +1,550 @@ +/* +Copyright 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. +*/ + + +// This file was autogenerated by go-to-protobuf. Do not edit it manually! + +syntax = "proto2"; + +package k8s.io.api.scheduling.v1alpha2; + +import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/generated.proto"; +import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto"; + +// Package-wide variables from generator "generated". +option go_package = "k8s.io/api/scheduling/v1alpha2"; + +// BasicSchedulingPolicy indicates that standard Kubernetes +// scheduling behavior should be used. +message BasicSchedulingPolicy { +} + +// GangSchedulingPolicy defines the parameters for gang scheduling. +message GangSchedulingPolicy { + // MinCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + // + // +required + // +k8s:required + // +k8s:minimum=1 + optional int32 minCount = 1; +} + +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +message PodGroup { + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Spec defines the desired state of the PodGroup. + // + // +required + optional PodGroupSpec spec = 2; + + // Status represents the current observed state of the PodGroup. + // + // +optional + optional PodGroupStatus status = 3; +} + +// PodGroupList contains a list of PodGroup resources. +message PodGroupList { + // Standard list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of PodGroups. + repeated PodGroup items = 2; +} + +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +message PodGroupResourceClaim { + // Name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // ResourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimName = 2; + + // ResourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + optional string resourceClaimTemplateName = 3; +} + +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +message PodGroupResourceClaimStatus { + // Name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + // + // +required + optional string name = 1; + + // ResourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + optional string resourceClaimName = 2; +} + +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +message PodGroupSchedulingConstraints { + // Topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + repeated TopologyConstraint topology = 1; +} + +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. +// +union +message PodGroupSchedulingPolicy { + // Basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional BasicSchedulingPolicy basic = 1; + + // Gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional GangSchedulingPolicy gang = 2; +} + +// PodGroupSpec defines the desired state of a PodGroup. +message PodGroupSpec { + // PodGroupTemplateRef references an optional PodGroup template within other object + // (e.g. Workload) that was used to create the PodGroup. This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional PodGroupTemplateReference podGroupTemplateRef = 1; + + // SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // + // +required + // +k8s:immutable + optional PodGroupSchedulingPolicy schedulingPolicy = 2; + + // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable + optional PodGroupSchedulingConstraints schedulingConstraints = 3; + + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is an alpha-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + repeated PodGroupResourceClaim resourceClaims = 4; + + // DisruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Pod, PodGroup. Defaults to Pod if unset. + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable + // +default="Pod" + optional string disruptionMode = 5; + + // PriorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable + optional string priorityClassName = 6; + + // Priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 + optional int32 priority = 7; +} + +// PodGroupStatus represents information about the status of a pod group. +message PodGroupStatus { + // Conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupScheduled": Indicates whether the scheduling requirement has been satisfied. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1; + + // Status of resource claims. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + repeated PodGroupResourceClaimStatus resourceClaimStatuses = 2; +} + +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +message PodGroupTemplate { + // Name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string name = 1; + + // SchedulingPolicy defines the scheduling policy for this PodGroupTemplate. + // + // +required + optional PodGroupSchedulingPolicy schedulingPolicy = 2; + + // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + optional PodGroupSchedulingConstraints schedulingConstraints = 3; + + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is an alpha-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + repeated PodGroupResourceClaim resourceClaims = 4; + + // DisruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Pod, PodGroup. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + optional string disruptionMode = 5; + + // PriorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. If no priority class is specified, admission + // control can set this to the global default priority class if it exists. Otherwise, + // pod groups created from this template will have the priority set to zero. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name + optional string priorityClassName = 6; + + // Priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. When + // Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 + optional int32 priority = 7; +} + +// PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). +// Exactly one reference must be set. +// +union +message PodGroupTemplateReference { + // Workload references the PodGroupTemplate within the Workload object that was used to create + // the PodGroup. + // + // +optional + // +k8s:optional + // +k8s:unionMember + optional WorkloadPodGroupTemplateReference workload = 1; +} + +// TopologyConstraint defines a topology constraint for a PodGroup. +message TopologyConstraint { + // Key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + // + // +required + // +k8s:required + // +k8s:format=k8s-label-key + optional string key = 1; +} + +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +message TypedLocalObjectReference { + // APIGroup is the group for the resource being referenced. + // If APIGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting APIGroup is required. + // It must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + optional string apiGroup = 1; + + // Kind is the type of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + optional string kind = 2; + + // Name is the name of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + optional string name = 3; +} + +// Workload allows for expressing scheduling constraints that should be used +// when managing the lifecycle of workloads from the scheduling perspective, +// including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. +message Workload { + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1; + + // Spec defines the desired behavior of a Workload. + // + // +required + optional WorkloadSpec spec = 2; +} + +// WorkloadList contains a list of Workload resources. +message WorkloadList { + // Standard list metadata. + // + // +optional + optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1; + + // Items is the list of Workloads. + repeated Workload items = 2; +} + +// WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object. +message WorkloadPodGroupTemplateReference { + // WorkloadName defines the name of the Workload object. + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name + optional string workloadName = 1; + + // PodGroupTemplateName defines the PodGroupTemplate name within the Workload object. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + optional string podGroupTemplateName = 2; +} + +// WorkloadSpec defines the desired state of a Workload. +message WorkloadSpec { + // ControllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + optional TypedLocalObjectReference controllerRef = 1; + + // PodGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // + // +required + // +listType=map + // +listMapKey=name + // +k8s:required + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:immutable + repeated PodGroupTemplate podGroupTemplates = 2; +} + diff --git a/vendor/k8s.io/api/scheduling/v1alpha1/register.go b/vendor/k8s.io/api/scheduling/v1alpha2/register.go similarity index 90% rename from vendor/k8s.io/api/scheduling/v1alpha1/register.go rename to vendor/k8s.io/api/scheduling/v1alpha2/register.go index 25de55d308..fc03ae5ec9 100644 --- a/vendor/k8s.io/api/scheduling/v1alpha1/register.go +++ b/vendor/k8s.io/api/scheduling/v1alpha2/register.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors. +Copyright 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1alpha2 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -26,7 +26,7 @@ import ( const GroupName = "scheduling.k8s.io" // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha2"} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { @@ -43,11 +43,12 @@ var ( // Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { - scheme.AddKnownTypes(SchemeGroupVersion, - &PriorityClass{}, - &PriorityClassList{}, + scheme.AddKnownTypes( + SchemeGroupVersion, &Workload{}, &WorkloadList{}, + &PodGroup{}, + &PodGroupList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/types.go b/vendor/k8s.io/api/scheduling/v1alpha2/types.go new file mode 100644 index 0000000000..1f84f2c43d --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha2/types.go @@ -0,0 +1,601 @@ +/* +Copyright 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. +*/ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// Workload allows for expressing scheduling constraints that should be used +// when managing the lifecycle of workloads from the scheduling perspective, +// including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. +type Workload struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec defines the desired behavior of a Workload. + // + // +required + Spec WorkloadSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// WorkloadList contains a list of Workload resources. +type WorkloadList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of Workloads. + Items []Workload `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// WorkloadMaxPodGroupTemplates is the maximum number of pod group templates per Workload. +const WorkloadMaxPodGroupTemplates = 8 + +// WorkloadSpec defines the desired state of a Workload. +type WorkloadSpec struct { + // ControllerRef is an optional reference to the controlling object, such as a + // Deployment or Job. This field is intended for use by tools like CLIs + // to provide a link back to the original workload definition. + // This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + ControllerRef *TypedLocalObjectReference `json:"controllerRef,omitempty" protobuf:"bytes,1,opt,name=controllerRef"` + + // PodGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + // + // +required + // +listType=map + // +listMapKey=name + // +k8s:required + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=8 + // +k8s:immutable + PodGroupTemplates []PodGroupTemplate `json:"podGroupTemplates" protobuf:"bytes,2,rep,name=podGroupTemplates"` +} + +// TypedLocalObjectReference allows to reference typed object inside the same namespace. +type TypedLocalObjectReference struct { + // APIGroup is the group for the resource being referenced. + // If APIGroup is empty, the specified Kind must be in the core API group. + // For any other third-party types, setting APIGroup is required. + // It must be a DNS subdomain. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,1,opt,name=apiGroup"` + // Kind is the type of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"` + // Name is the name of resource being referenced. + // It must be a path segment name. + // + // +required + // +k8s:required + // +k8s:format=k8s-path-segment-name + Name string `json:"name" protobuf:"bytes,3,opt,name=name"` +} + +// MaxPodGroupResourceClaims is the maximum number of resource claims for a +// PodGroup or a Workload's PodGroupTemplate. +const MaxPodGroupResourceClaims = 4 + +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +type PodGroupTemplate struct { + // Name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // SchedulingPolicy defines the scheduling policy for this PodGroupTemplate. + // + // +required + SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` + + // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints" protobuf:"bytes,3,opt,name=schedulingConstraints"` + + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is an alpha-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,4,rep,name=resourceClaims"` + + // DisruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Pod, PodGroup. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,5,opt,name=disruptionMode,casttype=DisruptionMode"` + + // PriorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. If no priority class is specified, admission + // control can set this to the global default priority class if it exists. Otherwise, + // pod groups created from this template will have the priority set to zero. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,6,opt,name=priorityClassName"` + + // Priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. When + // Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 + Priority *int32 `json:"priority,omitempty" protobuf:"varint,7,opt,name=priority"` +} + +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. +// +union +type PodGroupSchedulingPolicy struct { + // Basic specifies that the pods in this group should be scheduled using + // standard Kubernetes scheduling behavior. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Basic *BasicSchedulingPolicy `json:"basic,omitempty" protobuf:"bytes,1,opt,name=basic"` + + // Gang specifies that the pods in this group should be scheduled using + // all-or-nothing semantics. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Gang *GangSchedulingPolicy `json:"gang,omitempty" protobuf:"bytes,2,opt,name=gang"` +} + +// BasicSchedulingPolicy indicates that standard Kubernetes +// scheduling behavior should be used. +type BasicSchedulingPolicy struct { + // This is intentionally empty. Its presence indicates that the basic + // scheduling policy should be applied. In the future, new fields may appear, + // describing such constraints on a pod group level without "all or nothing" + // (gang) scheduling. +} + +// GangSchedulingPolicy defines the parameters for gang scheduling. +type GangSchedulingPolicy struct { + // MinCount is the minimum number of pods that must be schedulable or scheduled + // at the same time for the scheduler to admit the entire group. + // It must be a positive integer. + // + // +required + // +k8s:required + // +k8s:minimum=1 + MinCount int32 `json:"minCount" protobuf:"varint,1,opt,name=minCount"` +} + +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +type PodGroupResourceClaim struct { + // Name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + Name string `json:"name" protobuf:"bytes,1,opt,name=name"` + + // ResourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` + + // ResourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + // + // +optional + // +k8s:optional + // +k8s:unionMember + // +k8s:format=k8s-long-name + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty" protobuf:"bytes,3,opt,name=resourceClaimTemplateName"` +} + +// DisruptionMode describes the mode in which a PodGroup can be disrupted (e.g. preempted). +// +enum +// +k8s:enum +type DisruptionMode string + +const ( + // DisruptionModePod means that individual pods can be disrupted or preempted independently. + // It doesn't depend on exact set of pods currently running in this PodGroup. + DisruptionModePod DisruptionMode = "Pod" + // DisruptionModePodGroup means that the whole PodGroup needs to be disrupted + // or preempted together. + DisruptionModePodGroup DisruptionMode = "PodGroup" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +k8s:supportsSubresource="/status" + +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +type PodGroup struct { + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Spec defines the desired state of the PodGroup. + // + // +required + Spec PodGroupSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` + + // Status represents the current observed state of the PodGroup. + // + // +optional + Status PodGroupStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PodGroupList contains a list of PodGroup resources. +type PodGroupList struct { + metav1.TypeMeta `json:",inline"` + // Standard list metadata. + // + // +optional + metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Items is the list of PodGroups. + Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"` +} + +// PodGroupSpec defines the desired state of a PodGroup. +type PodGroupSpec struct { + // PodGroupTemplateRef references an optional PodGroup template within other object + // (e.g. Workload) that was used to create the PodGroup. This field is immutable. + // + // +optional + // +k8s:optional + // +k8s:immutable + PodGroupTemplateRef *PodGroupTemplateReference `json:"podGroupTemplateRef" protobuf:"bytes,1,opt,name=podGroupTemplateRef"` + + // SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // + // +required + // +k8s:immutable + SchedulingPolicy PodGroupSchedulingPolicy `json:"schedulingPolicy" protobuf:"bytes,2,opt,name=schedulingPolicy"` + + // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + // + // +featureGate=TopologyAwareWorkloadScheduling + // +optional + // +k8s:ifDisabled(TopologyAwareWorkloadScheduling)=+k8s:forbidden + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:optional + // +k8s:ifEnabled(TopologyAwareWorkloadScheduling)=+k8s:immutable + SchedulingConstraints *PodGroupSchedulingConstraints `json:"schedulingConstraints,omitempty" protobuf:"bytes,3,opt,name=schedulingConstraints"` + + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is an alpha-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + // + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +k8s:immutable + // +featureGate=DRAWorkloadResourceClaims + ResourceClaims []PodGroupResourceClaim `json:"resourceClaims,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,4,rep,name=resourceClaims"` + + // DisruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Pod, PodGroup. Defaults to Pod if unset. + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable + // +default="Pod" + DisruptionMode *DisruptionMode `json:"disruptionMode,omitempty" protobuf:"bytes,5,opt,name=disruptionMode,casttype=DisruptionMode"` + + // PriorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:format=k8s-long-name + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable + PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,6,opt,name=priorityClassName"` + + // Priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + // + // +featureGate=WorkloadAwarePreemption + // +optional + // +k8s:ifDisabled("WorkloadAwarePreemption")=+k8s:forbidden + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:optional + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:immutable + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:maximum=1000000000 # HighestUserDefinablePriority + // +k8s:ifEnabled("WorkloadAwarePreemption")=+k8s:minimum=-2147483648 + Priority *int32 `json:"priority,omitempty" protobuf:"varint,7,opt,name=priority"` +} + +// PodGroupStatus represents information about the status of a pod group. +type PodGroupStatus struct { + // Conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupScheduled": Indicates whether the scheduling requirement has been satisfied. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + // + // +optional + // +patchMergeKey=type + // +patchStrategy=merge + // +listType=map + // +listMapKey=type + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + // Status of resource claims. + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + // +listType=map + // +listMapKey=name + // +k8s:optional + // +k8s:listType=map + // +k8s:listMapKey=name + // +k8s:maxItems=4 + // +featureGate=DRAWorkloadResourceClaims + ResourceClaimStatuses []PodGroupResourceClaimStatus `json:"resourceClaimStatuses,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name" protobuf:"bytes,2,rep,name=resourceClaimStatuses"` +} + +// Well-known condition types for PodGroups. +const ( + // PodGroupScheduled represents status of the scheduling process for this PodGroup. + PodGroupScheduled string = "PodGroupScheduled" + // DisruptionTarget indicates the PodGroup is about to be terminated due to disruption + // such as preemption. + DisruptionTarget string = "DisruptionTarget" +) + +// Well-known condition reasons for PodGroups. +const ( + // Unschedulable reason in the PodGroupScheduled condition indicates that the PodGroup cannot be scheduled + // due to resource constraints, affinity/anti-affinity rules, or insufficient capacity for the PodGroup. + PodGroupReasonUnschedulable string = "Unschedulable" + // SchedulerError reason in the PodGroupScheduled condition means that some internal error happens + // during scheduling, for example due to nodeAffinity parsing errors. + PodGroupReasonSchedulerError string = "SchedulerError" + // PreemptionByScheduler reason in the DisruptionTarget condition indicates the PodGroup was preempted + // to make room for higher-priority PodGroups or Pods. + PodGroupReasonPreemptionByScheduler string = "PreemptionByScheduler" +) + +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +type PodGroupResourceClaimStatus struct { + // Name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + // + // +required + Name string `json:"name" protobuf:"bytes,1,name=name"` + + // ResourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + // + // +optional + // +k8s:optional + // +k8s:format=k8s-long-name + ResourceClaimName *string `json:"resourceClaimName,omitempty" protobuf:"bytes,2,opt,name=resourceClaimName"` +} + +// PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). +// Exactly one reference must be set. +// +union +type PodGroupTemplateReference struct { + // Workload references the PodGroupTemplate within the Workload object that was used to create + // the PodGroup. + // + // +optional + // +k8s:optional + // +k8s:unionMember + Workload *WorkloadPodGroupTemplateReference `json:"workload" protobuf:"bytes,1,opt,name=workload"` +} + +// WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object. +type WorkloadPodGroupTemplateReference struct { + // WorkloadName defines the name of the Workload object. + // + // +required + // +k8s:required + // +k8s:format=k8s-long-name + WorkloadName string `json:"workloadName" protobuf:"bytes,1,opt,name=workloadName"` + + // PodGroupTemplateName defines the PodGroupTemplate name within the Workload object. + // + // +required + // +k8s:required + // +k8s:format=k8s-short-name + PodGroupTemplateName string `json:"podGroupTemplateName" protobuf:"bytes,2,opt,name=podGroupTemplateName"` +} + +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +type PodGroupSchedulingConstraints struct { + // Topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + // + // +optional + // +k8s:optional + // +k8s:maxItems=1 + // +listType=atomic + // +k8s:listType=atomic + Topology []TopologyConstraint `json:"topology,omitempty" protobuf:"bytes,1,rep,name=topology"` +} + +// TopologyConstraint defines a topology constraint for a PodGroup. +type TopologyConstraint struct { + // Key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + // + // +required + // +k8s:required + // +k8s:format=k8s-label-key + Key string `json:"key" protobuf:"bytes,1,opt,name=key"` +} diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/types_swagger_doc_generated.go b/vendor/k8s.io/api/scheduling/v1alpha2/types_swagger_doc_generated.go new file mode 100644 index 0000000000..2dc06b1c6f --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha2/types_swagger_doc_generated.go @@ -0,0 +1,217 @@ +/* +Copyright 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. +*/ + +package v1alpha2 + +// This file contains a collection of methods that can be used from go-restful to +// generate Swagger API documentation for its models. Please read this PR for more +// information on the implementation: https://github.com/emicklei/go-restful/pull/215 +// +// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if +// they are on one line! For multiple line or blocks that you want to ignore use ---. +// Any context after a --- is ignored. +// +// Those methods can be generated by using hack/update-codegen.sh + +// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT. +var map_BasicSchedulingPolicy = map[string]string{ + "": "BasicSchedulingPolicy indicates that standard Kubernetes scheduling behavior should be used.", +} + +func (BasicSchedulingPolicy) SwaggerDoc() map[string]string { + return map_BasicSchedulingPolicy +} + +var map_GangSchedulingPolicy = map[string]string{ + "": "GangSchedulingPolicy defines the parameters for gang scheduling.", + "minCount": "MinCount is the minimum number of pods that must be schedulable or scheduled at the same time for the scheduler to admit the entire group. It must be a positive integer.", +} + +func (GangSchedulingPolicy) SwaggerDoc() map[string]string { + return map_GangSchedulingPolicy +} + +var map_PodGroup = map[string]string{ + "": "PodGroup represents a runtime instance of pods grouped together. PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from Workload.podGroupTemplates. PodGroup API enablement is toggled by the GenericWorkload feature gate.", + "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "Spec defines the desired state of the PodGroup.", + "status": "Status represents the current observed state of the PodGroup.", +} + +func (PodGroup) SwaggerDoc() map[string]string { + return map_PodGroup +} + +var map_PodGroupList = map[string]string{ + "": "PodGroupList contains a list of PodGroup resources.", + "metadata": "Standard list metadata.", + "items": "Items is the list of PodGroups.", +} + +func (PodGroupList) SwaggerDoc() map[string]string { + return map_PodGroupList +} + +var map_PodGroupResourceClaim = map[string]string{ + "": "PodGroupResourceClaim references exactly one ResourceClaim, either directly or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim for the PodGroup.\n\nIt adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. Pods that need access to the ResourceClaim define a matching reference in its own Spec.ResourceClaims. The Pod's claim must match all fields of the PodGroup's claim exactly.", + "name": "Name uniquely identifies this resource claim inside the PodGroup. This must be a DNS_LABEL.", + "resourceClaimName": "ResourceClaimName is the name of a ResourceClaim object in the same namespace as this PodGroup. The ResourceClaim will be reserved for the PodGroup instead of its individual pods.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", + "resourceClaimTemplateName": "ResourceClaimTemplateName is the name of a ResourceClaimTemplate object in the same namespace as this PodGroup.\n\nThe template will be used to create a new ResourceClaim, which will be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim will also be deleted. The PodGroup name and resource name, along with a generated component, will be used to form a unique name for the ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses.\n\nThis field is immutable and no changes will be made to the corresponding ResourceClaim by the control plane after creating the ResourceClaim.\n\nExactly one of ResourceClaimName and ResourceClaimTemplateName must be set.", +} + +func (PodGroupResourceClaim) SwaggerDoc() map[string]string { + return map_PodGroupResourceClaim +} + +var map_PodGroupResourceClaimStatus = map[string]string{ + "": "PodGroupResourceClaimStatus is stored in the PodGroupStatus for each PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the generated name for the corresponding ResourceClaim.", + "name": "Name uniquely identifies this resource claim inside the PodGroup. This must match the name of an entry in podgroup.spec.resourceClaims, which implies that the string must be a DNS_LABEL.", + "resourceClaimName": "ResourceClaimName is the name of the ResourceClaim that was generated for the PodGroup in the namespace of the PodGroup. If this is unset, then generating a ResourceClaim was not necessary. The podgroup.spec.resourceClaims entry can be ignored in this case.", +} + +func (PodGroupResourceClaimStatus) SwaggerDoc() map[string]string { + return map_PodGroupResourceClaimStatus +} + +var map_PodGroupSchedulingConstraints = map[string]string{ + "": "PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup.", + "topology": "Topology defines the topology constraints for the pod group. Currently only a single topology constraint can be specified. This may change in the future.", +} + +func (PodGroupSchedulingConstraints) SwaggerDoc() map[string]string { + return map_PodGroupSchedulingConstraints +} + +var map_PodGroupSchedulingPolicy = map[string]string{ + "": "PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. Exactly one policy must be set.", + "basic": "Basic specifies that the pods in this group should be scheduled using standard Kubernetes scheduling behavior.", + "gang": "Gang specifies that the pods in this group should be scheduled using all-or-nothing semantics.", +} + +func (PodGroupSchedulingPolicy) SwaggerDoc() map[string]string { + return map_PodGroupSchedulingPolicy +} + +var map_PodGroupSpec = map[string]string{ + "": "PodGroupSpec defines the desired state of a PodGroup.", + "podGroupTemplateRef": "PodGroupTemplateRef references an optional PodGroup template within other object (e.g. Workload) that was used to create the PodGroup. This field is immutable.", + "schedulingPolicy": "SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate. This field is immutable.", + "schedulingConstraints": "SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. Controllers are expected to fill this field by copying it from a PodGroupTemplate. This field is immutable. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.", + "resourceClaims": "ResourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is an alpha-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", + "disruptionMode": "DisruptionMode defines the mode in which a given PodGroup can be disrupted. Controllers are expected to fill this field by copying it from a PodGroupTemplate. One of Pod, PodGroup. Defaults to Pod if unset. This field is immutable. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", + "priorityClassName": "PriorityClassName defines the priority that should be considered when scheduling this pod group. Controllers are expected to fill this field by copying it from a PodGroupTemplate. Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate (i.e. if no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, the pod group's priority will be zero). This field is immutable. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", + "priority": "Priority is the value of priority of this pod group. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is immutable. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", +} + +func (PodGroupSpec) SwaggerDoc() map[string]string { + return map_PodGroupSpec +} + +var map_PodGroupStatus = map[string]string{ + "": "PodGroupStatus represents information about the status of a pod group.", + "conditions": "Conditions represent the latest observations of the PodGroup's state.\n\nKnown condition types: - \"PodGroupScheduled\": Indicates whether the scheduling requirement has been satisfied. - \"DisruptionTarget\": Indicates whether the PodGroup is about to be terminated\n due to disruption such as preemption.\n\nKnown reasons for the PodGroupScheduled condition: - \"Unschedulable\": The PodGroup cannot be scheduled due to resource constraints,\n affinity/anti-affinity rules, or insufficient capacity for the gang.\n- \"SchedulerError\": The PodGroup cannot be scheduled due to some internal error\n that happened during scheduling, for example due to nodeAffinity parsing errors.\n\nKnown reasons for the DisruptionTarget condition: - \"PreemptionByScheduler\": The PodGroup was preempted by the scheduler to make room for\n higher-priority PodGroups or Pods.", + "resourceClaimStatuses": "Status of resource claims.", +} + +func (PodGroupStatus) SwaggerDoc() map[string]string { + return map_PodGroupStatus +} + +var map_PodGroupTemplate = map[string]string{ + "": "PodGroupTemplate represents a template for a set of pods with a scheduling policy.", + "name": "Name is a unique identifier for the PodGroupTemplate within the Workload. It must be a DNS label. This field is immutable.", + "schedulingPolicy": "SchedulingPolicy defines the scheduling policy for this PodGroupTemplate.", + "schedulingConstraints": "SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled.", + "resourceClaims": "ResourceClaims defines which ResourceClaims may be shared among Pods in the group. Pods consume the devices allocated to a PodGroup's claim by defining a claim in its own Spec.ResourceClaims that matches the PodGroup's claim exactly. The claim must have the same name and refer to the same ResourceClaim or ResourceClaimTemplate.\n\nThis is an alpha-level field and requires that the DRAWorkloadResourceClaims feature gate is enabled.\n\nThis field is immutable.", + "disruptionMode": "DisruptionMode defines the mode in which a given PodGroup can be disrupted. One of Pod, PodGroup. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", + "priorityClassName": "PriorityClassName indicates the priority that should be considered when scheduling a pod group created from this template. If no priority class is specified, admission control can set this to the global default priority class if it exists. Otherwise, pod groups created from this template will have the priority set to zero. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", + "priority": "Priority is the value of priority of pod groups created from this template. Various system components use this field to find the priority of the pod group. When Priority Admission Controller is enabled, it prevents users from setting this field. The admission controller populates this field from PriorityClassName. The higher the value, the higher the priority. This field is available only when the WorkloadAwarePreemption feature gate is enabled.", +} + +func (PodGroupTemplate) SwaggerDoc() map[string]string { + return map_PodGroupTemplate +} + +var map_PodGroupTemplateReference = map[string]string{ + "": "PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). Exactly one reference must be set.", + "workload": "Workload references the PodGroupTemplate within the Workload object that was used to create the PodGroup.", +} + +func (PodGroupTemplateReference) SwaggerDoc() map[string]string { + return map_PodGroupTemplateReference +} + +var map_TopologyConstraint = map[string]string{ + "": "TopologyConstraint defines a topology constraint for a PodGroup.", + "key": "Key specifies the key of the node label representing the topology domain. All pods within the PodGroup must be colocated within the same domain instance. Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. Examples: \"topology.kubernetes.io/rack\"", +} + +func (TopologyConstraint) SwaggerDoc() map[string]string { + return map_TopologyConstraint +} + +var map_TypedLocalObjectReference = map[string]string{ + "": "TypedLocalObjectReference allows to reference typed object inside the same namespace.", + "apiGroup": "APIGroup is the group for the resource being referenced. If APIGroup is empty, the specified Kind must be in the core API group. For any other third-party types, setting APIGroup is required. It must be a DNS subdomain.", + "kind": "Kind is the type of resource being referenced. It must be a path segment name.", + "name": "Name is the name of resource being referenced. It must be a path segment name.", +} + +func (TypedLocalObjectReference) SwaggerDoc() map[string]string { + return map_TypedLocalObjectReference +} + +var map_Workload = map[string]string{ + "": "Workload allows for expressing scheduling constraints that should be used when managing the lifecycle of workloads from the scheduling perspective, including scheduling, preemption, eviction and other phases. Workload API enablement is toggled by the GenericWorkload feature gate.", + "metadata": "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata", + "spec": "Spec defines the desired behavior of a Workload.", +} + +func (Workload) SwaggerDoc() map[string]string { + return map_Workload +} + +var map_WorkloadList = map[string]string{ + "": "WorkloadList contains a list of Workload resources.", + "metadata": "Standard list metadata.", + "items": "Items is the list of Workloads.", +} + +func (WorkloadList) SwaggerDoc() map[string]string { + return map_WorkloadList +} + +var map_WorkloadPodGroupTemplateReference = map[string]string{ + "": "WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object.", + "workloadName": "WorkloadName defines the name of the Workload object.", + "podGroupTemplateName": "PodGroupTemplateName defines the PodGroupTemplate name within the Workload object.", +} + +func (WorkloadPodGroupTemplateReference) SwaggerDoc() map[string]string { + return map_WorkloadPodGroupTemplateReference +} + +var map_WorkloadSpec = map[string]string{ + "": "WorkloadSpec defines the desired state of a Workload.", + "controllerRef": "ControllerRef is an optional reference to the controlling object, such as a Deployment or Job. This field is intended for use by tools like CLIs to provide a link back to the original workload definition. This field is immutable.", + "podGroupTemplates": "PodGroupTemplates is the list of templates that make up the Workload. The maximum number of templates is 8. This field is immutable.", +} + +func (WorkloadSpec) SwaggerDoc() map[string]string { + return map_WorkloadSpec +} + +// AUTO-GENERATED FUNCTIONS END HERE diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.deepcopy.go b/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 0000000000..901bb0a3ad --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,484 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BasicSchedulingPolicy) DeepCopyInto(out *BasicSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BasicSchedulingPolicy. +func (in *BasicSchedulingPolicy) DeepCopy() *BasicSchedulingPolicy { + if in == nil { + return nil + } + out := new(BasicSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *GangSchedulingPolicy) DeepCopyInto(out *GangSchedulingPolicy) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GangSchedulingPolicy. +func (in *GangSchedulingPolicy) DeepCopy() *GangSchedulingPolicy { + if in == nil { + return nil + } + out := new(GangSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroup) DeepCopyInto(out *PodGroup) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroup. +func (in *PodGroup) DeepCopy() *PodGroup { + if in == nil { + return nil + } + out := new(PodGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroup) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupList) DeepCopyInto(out *PodGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PodGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupList. +func (in *PodGroupList) DeepCopy() *PodGroupList { + if in == nil { + return nil + } + out := new(PodGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PodGroupList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupResourceClaim) DeepCopyInto(out *PodGroupResourceClaim) { + *out = *in + if in.ResourceClaimName != nil { + in, out := &in.ResourceClaimName, &out.ResourceClaimName + *out = new(string) + **out = **in + } + if in.ResourceClaimTemplateName != nil { + in, out := &in.ResourceClaimTemplateName, &out.ResourceClaimTemplateName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaim. +func (in *PodGroupResourceClaim) DeepCopy() *PodGroupResourceClaim { + if in == nil { + return nil + } + out := new(PodGroupResourceClaim) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupResourceClaimStatus) DeepCopyInto(out *PodGroupResourceClaimStatus) { + *out = *in + if in.ResourceClaimName != nil { + in, out := &in.ResourceClaimName, &out.ResourceClaimName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupResourceClaimStatus. +func (in *PodGroupResourceClaimStatus) DeepCopy() *PodGroupResourceClaimStatus { + if in == nil { + return nil + } + out := new(PodGroupResourceClaimStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSchedulingConstraints) DeepCopyInto(out *PodGroupSchedulingConstraints) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = make([]TopologyConstraint, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingConstraints. +func (in *PodGroupSchedulingConstraints) DeepCopy() *PodGroupSchedulingConstraints { + if in == nil { + return nil + } + out := new(PodGroupSchedulingConstraints) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSchedulingPolicy) DeepCopyInto(out *PodGroupSchedulingPolicy) { + *out = *in + if in.Basic != nil { + in, out := &in.Basic, &out.Basic + *out = new(BasicSchedulingPolicy) + **out = **in + } + if in.Gang != nil { + in, out := &in.Gang, &out.Gang + *out = new(GangSchedulingPolicy) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSchedulingPolicy. +func (in *PodGroupSchedulingPolicy) DeepCopy() *PodGroupSchedulingPolicy { + if in == nil { + return nil + } + out := new(PodGroupSchedulingPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupSpec) DeepCopyInto(out *PodGroupSpec) { + *out = *in + if in.PodGroupTemplateRef != nil { + in, out := &in.PodGroupTemplateRef, &out.PodGroupTemplateRef + *out = new(PodGroupTemplateReference) + (*in).DeepCopyInto(*out) + } + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(PodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.ResourceClaims != nil { + in, out := &in.ResourceClaims, &out.ResourceClaims + *out = make([]PodGroupResourceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(DisruptionMode) + **out = **in + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupSpec. +func (in *PodGroupSpec) DeepCopy() *PodGroupSpec { + if in == nil { + return nil + } + out := new(PodGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupStatus) DeepCopyInto(out *PodGroupStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ResourceClaimStatuses != nil { + in, out := &in.ResourceClaimStatuses, &out.ResourceClaimStatuses + *out = make([]PodGroupResourceClaimStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupStatus. +func (in *PodGroupStatus) DeepCopy() *PodGroupStatus { + if in == nil { + return nil + } + out := new(PodGroupStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupTemplate) DeepCopyInto(out *PodGroupTemplate) { + *out = *in + in.SchedulingPolicy.DeepCopyInto(&out.SchedulingPolicy) + if in.SchedulingConstraints != nil { + in, out := &in.SchedulingConstraints, &out.SchedulingConstraints + *out = new(PodGroupSchedulingConstraints) + (*in).DeepCopyInto(*out) + } + if in.ResourceClaims != nil { + in, out := &in.ResourceClaims, &out.ResourceClaims + *out = make([]PodGroupResourceClaim, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DisruptionMode != nil { + in, out := &in.DisruptionMode, &out.DisruptionMode + *out = new(DisruptionMode) + **out = **in + } + if in.Priority != nil { + in, out := &in.Priority, &out.Priority + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupTemplate. +func (in *PodGroupTemplate) DeepCopy() *PodGroupTemplate { + if in == nil { + return nil + } + out := new(PodGroupTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodGroupTemplateReference) DeepCopyInto(out *PodGroupTemplateReference) { + *out = *in + if in.Workload != nil { + in, out := &in.Workload, &out.Workload + *out = new(WorkloadPodGroupTemplateReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodGroupTemplateReference. +func (in *PodGroupTemplateReference) DeepCopy() *PodGroupTemplateReference { + if in == nil { + return nil + } + out := new(PodGroupTemplateReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TopologyConstraint) DeepCopyInto(out *TopologyConstraint) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologyConstraint. +func (in *TopologyConstraint) DeepCopy() *TopologyConstraint { + if in == nil { + return nil + } + out := new(TopologyConstraint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TypedLocalObjectReference) DeepCopyInto(out *TypedLocalObjectReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedLocalObjectReference. +func (in *TypedLocalObjectReference) DeepCopy() *TypedLocalObjectReference { + if in == nil { + return nil + } + out := new(TypedLocalObjectReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Workload) DeepCopyInto(out *Workload) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workload. +func (in *Workload) DeepCopy() *Workload { + if in == nil { + return nil + } + out := new(Workload) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Workload) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadList) DeepCopyInto(out *WorkloadList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Workload, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadList. +func (in *WorkloadList) DeepCopy() *WorkloadList { + if in == nil { + return nil + } + out := new(WorkloadList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WorkloadList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadPodGroupTemplateReference) DeepCopyInto(out *WorkloadPodGroupTemplateReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadPodGroupTemplateReference. +func (in *WorkloadPodGroupTemplateReference) DeepCopy() *WorkloadPodGroupTemplateReference { + if in == nil { + return nil + } + out := new(WorkloadPodGroupTemplateReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkloadSpec) DeepCopyInto(out *WorkloadSpec) { + *out = *in + if in.ControllerRef != nil { + in, out := &in.ControllerRef, &out.ControllerRef + *out = new(TypedLocalObjectReference) + **out = **in + } + if in.PodGroupTemplates != nil { + in, out := &in.PodGroupTemplates, &out.PodGroupTemplates + *out = make([]PodGroupTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadSpec. +func (in *WorkloadSpec) DeepCopy() *WorkloadSpec { + if in == nil { + return nil + } + out := new(WorkloadSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.model_name.go b/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.model_name.go new file mode 100644 index 0000000000..1b7effea96 --- /dev/null +++ b/vendor/k8s.io/api/scheduling/v1alpha2/zz_generated.model_name.go @@ -0,0 +1,112 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by openapi-gen. DO NOT EDIT. + +package v1alpha2 + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in BasicSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in GangSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroup) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroup" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupList) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupResourceClaim) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupResourceClaimStatus) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSchedulingConstraints) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSchedulingPolicy) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupSpec) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupSpec" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupStatus) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupStatus" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupTemplate) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupTemplate" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in PodGroupTemplateReference) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in TopologyConstraint) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.TopologyConstraint" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in TypedLocalObjectReference) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Workload) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.Workload" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadList) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.WorkloadList" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadPodGroupTemplateReference) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference" +} + +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in WorkloadSpec) OpenAPIModelName() string { + return "io.k8s.api.scheduling.v1alpha2.WorkloadSpec" +} diff --git a/vendor/k8s.io/api/scheduling/v1beta1/generated.proto b/vendor/k8s.io/api/scheduling/v1beta1/generated.proto index 7f77b01753..0e701be549 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/generated.proto +++ b/vendor/k8s.io/api/scheduling/v1beta1/generated.proto @@ -40,6 +40,7 @@ message PriorityClass { // value represents the integer value of this priority class. This is the actual priority that pods // receive when they have the name of this class in their pod spec. + // +optional optional int32 value = 2; // globalDefault specifies whether this PriorityClass should be considered as diff --git a/vendor/k8s.io/api/scheduling/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/scheduling/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 0c7339ae79..0000000000 --- a/vendor/k8s.io/api/scheduling/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*PriorityClass) ProtoMessage() {} - -func (*PriorityClassList) ProtoMessage() {} diff --git a/vendor/k8s.io/api/scheduling/v1beta1/types.go b/vendor/k8s.io/api/scheduling/v1beta1/types.go index 6f88592cf2..8a7a2058f0 100644 --- a/vendor/k8s.io/api/scheduling/v1beta1/types.go +++ b/vendor/k8s.io/api/scheduling/v1beta1/types.go @@ -41,6 +41,7 @@ type PriorityClass struct { // value represents the integer value of this priority class. This is the actual priority that pods // receive when they have the name of this class in their pod spec. + // +optional Value int32 `json:"value" protobuf:"bytes,2,opt,name=value"` // globalDefault specifies whether this PriorityClass should be considered as diff --git a/vendor/k8s.io/api/storage/v1/generated.pb.go b/vendor/k8s.io/api/storage/v1/generated.pb.go index 52003c3132..5fc7d55a5b 100644 --- a/vendor/k8s.io/api/storage/v1/generated.pb.go +++ b/vendor/k8s.io/api/storage/v1/generated.pb.go @@ -187,6 +187,16 @@ func (m *CSIDriverSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PreventPodSchedulingIfMissing != nil { + i-- + if *m.PreventPodSchedulingIfMissing { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } if m.ServiceAccountTokenInSecrets != nil { i-- if *m.ServiceAccountTokenInSecrets { @@ -1304,6 +1314,9 @@ func (m *CSIDriverSpec) Size() (n int) { if m.ServiceAccountTokenInSecrets != nil { n += 2 } + if m.PreventPodSchedulingIfMissing != nil { + n += 2 + } return n } @@ -1701,6 +1714,7 @@ func (this *CSIDriverSpec) String() string { `SELinuxMount:` + valueToStringGenerated(this.SELinuxMount) + `,`, `NodeAllocatableUpdatePeriodSeconds:` + valueToStringGenerated(this.NodeAllocatableUpdatePeriodSeconds) + `,`, `ServiceAccountTokenInSecrets:` + valueToStringGenerated(this.ServiceAccountTokenInSecrets) + `,`, + `PreventPodSchedulingIfMissing:` + valueToStringGenerated(this.PreventPodSchedulingIfMissing) + `,`, `}`, }, "") return s @@ -2498,6 +2512,27 @@ func (m *CSIDriverSpec) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.ServiceAccountTokenInSecrets = &b + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PreventPodSchedulingIfMissing", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.PreventPodSchedulingIfMissing = &b default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/storage/v1/generated.proto b/vendor/k8s.io/api/storage/v1/generated.proto index d77bea9cc0..d6bc969bb3 100644 --- a/vendor/k8s.io/api/storage/v1/generated.proto +++ b/vendor/k8s.io/api/storage/v1/generated.proto @@ -218,7 +218,7 @@ message CSIDriverSpec { // occur (neither periodic nor upon detecting capacity-related failures), and the // allocatable.count remains static. The minimum allowed value for this field is 10 seconds. // - // This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled. + // This feature requires the MutableCSINodeAllocatableCount feature gate to be enabled. // // This field is mutable. // @@ -249,6 +249,27 @@ message CSIDriverSpec { // +featureGate=CSIServiceAccountTokenSecrets // +optional optional bool serviceAccountTokenInSecrets = 10; + + // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // scheduling if the CSI driver on the node is missing. + // + // Enabling this option will prevent the scheduler (or any other + // component which embeds default scheduler such as cluster-autoscaler) from + // scheduling pods to nodes where CSI driver is not installed. + // + // For components(such as cluster-autoscaler) that embed the scheduler and run + // pod placement simulations using scheduler plugins, they MUST be aware of + // CSI driver registration information via CSINode object. They must create simulated + // CSINode objects in addition to Node objects during scheduling simulation, otherwise + // if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any + // newly created node may be rejected by the scheduler because of missing CSI driver + // information from the node. + // + // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // Default is "false". + // +featureGate=VolumeLimitScaling + // +optional + optional bool preventPodSchedulingIfMissing = 11; } // CSINode holds information about all CSI drivers installed on a node. @@ -434,17 +455,22 @@ message StorageClass { // provisioner indicates the type of the provisioner. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable optional string provisioner = 2; // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional map parameters = 3; // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional optional string reclaimPolicy = 4; // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -462,6 +488,8 @@ message StorageClass { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional optional string volumeBindingMode = 7; // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -509,6 +537,8 @@ message VolumeAttachment { // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +required optional VolumeAttachmentSpec spec = 2; // status represents status of the VolumeAttachment request. @@ -552,6 +582,10 @@ message VolumeAttachmentSource { message VolumeAttachmentSpec { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 optional string attacher = 1; // source represents the volume that should be attached. @@ -643,7 +677,7 @@ message VolumeError { // errorCode is a numeric gRPC code representing the error encountered during Attach or Detach operations. // - // This is an optional, beta field that requires the MutableCSINodeAllocatableCount feature gate being enabled to be set. + // This field requires the MutableCSINodeAllocatableCount feature gate being enabled to be set. // // +featureGate=MutableCSINodeAllocatableCount // +optional diff --git a/vendor/k8s.io/api/storage/v1/generated.protomessage.pb.go b/vendor/k8s.io/api/storage/v1/generated.protomessage.pb.go deleted file mode 100644 index 3702060422..0000000000 --- a/vendor/k8s.io/api/storage/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*CSIDriver) ProtoMessage() {} - -func (*CSIDriverList) ProtoMessage() {} - -func (*CSIDriverSpec) ProtoMessage() {} - -func (*CSINode) ProtoMessage() {} - -func (*CSINodeDriver) ProtoMessage() {} - -func (*CSINodeList) ProtoMessage() {} - -func (*CSINodeSpec) ProtoMessage() {} - -func (*CSIStorageCapacity) ProtoMessage() {} - -func (*CSIStorageCapacityList) ProtoMessage() {} - -func (*StorageClass) ProtoMessage() {} - -func (*StorageClassList) ProtoMessage() {} - -func (*TokenRequest) ProtoMessage() {} - -func (*VolumeAttachment) ProtoMessage() {} - -func (*VolumeAttachmentList) ProtoMessage() {} - -func (*VolumeAttachmentSource) ProtoMessage() {} - -func (*VolumeAttachmentSpec) ProtoMessage() {} - -func (*VolumeAttachmentStatus) ProtoMessage() {} - -func (*VolumeAttributesClass) ProtoMessage() {} - -func (*VolumeAttributesClassList) ProtoMessage() {} - -func (*VolumeError) ProtoMessage() {} - -func (*VolumeNodeResources) ProtoMessage() {} diff --git a/vendor/k8s.io/api/storage/v1/types.go b/vendor/k8s.io/api/storage/v1/types.go index b198cb7138..c65ebed4ec 100644 --- a/vendor/k8s.io/api/storage/v1/types.go +++ b/vendor/k8s.io/api/storage/v1/types.go @@ -42,17 +42,22 @@ type StorageClass struct { // provisioner indicates the type of the provisioner. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"` // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"` // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -70,6 +75,8 @@ type StorageClass struct { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"` // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -117,6 +124,7 @@ const ( // +genclient:nonNamespaced // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +k8s:prerelease-lifecycle-gen:introduced=1.13 +// +k8s:supportsSubresource="/status" // VolumeAttachment captures the intent to attach or detach the specified volume // to/from the specified node. @@ -132,6 +140,8 @@ type VolumeAttachment struct { // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +required Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // status represents status of the VolumeAttachment request. @@ -161,6 +171,10 @@ type VolumeAttachmentList struct { type VolumeAttachmentSpec struct { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"` // source represents the volume that should be attached. @@ -231,7 +245,7 @@ type VolumeError struct { // errorCode is a numeric gRPC code representing the error encountered during Attach or Detach operations. // - // This is an optional, beta field that requires the MutableCSINodeAllocatableCount feature gate being enabled to be set. + // This field requires the MutableCSINodeAllocatableCount feature gate being enabled to be set. // // +featureGate=MutableCSINodeAllocatableCount // +optional @@ -438,7 +452,7 @@ type CSIDriverSpec struct { // occur (neither periodic nor upon detecting capacity-related failures), and the // allocatable.count remains static. The minimum allowed value for this field is 10 seconds. // - // This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled. + // This feature requires the MutableCSINodeAllocatableCount feature gate to be enabled. // // This field is mutable. // @@ -469,6 +483,27 @@ type CSIDriverSpec struct { // +featureGate=CSIServiceAccountTokenSecrets // +optional ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty" protobuf:"varint,10,opt,name=serviceAccountTokenInSecrets"` + + // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // scheduling if the CSI driver on the node is missing. + // + // Enabling this option will prevent the scheduler (or any other + // component which embeds default scheduler such as cluster-autoscaler) from + // scheduling pods to nodes where CSI driver is not installed. + // + // For components(such as cluster-autoscaler) that embed the scheduler and run + // pod placement simulations using scheduler plugins, they MUST be aware of + // CSI driver registration information via CSINode object. They must create simulated + // CSINode objects in addition to Node objects during scheduling simulation, otherwise + // if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any + // newly created node may be rejected by the scheduler because of missing CSI driver + // information from the node. + // + // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // Default is "false". + // +featureGate=VolumeLimitScaling + // +optional + PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty" protobuf:"varint,11,opt,name=preventPodSchedulingIfMissing"` } // FSGroupPolicy specifies if a CSI Driver supports modifying diff --git a/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go b/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go index 7f06c2744f..47a7e92492 100644 --- a/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go @@ -57,8 +57,9 @@ var map_CSIDriverSpec = map[string]string{ "tokenRequests": "tokenRequests indicates the CSI driver needs pods' service account tokens it is mounting volume for to do necessary authentication. Kubelet will pass the tokens in VolumeContext in the CSI NodePublishVolume calls. The CSI driver should parse and validate the following VolumeContext: \"csi.storage.k8s.io/serviceAccount.tokens\": {\n \"\": {\n \"token\": ,\n \"expirationTimestamp\": ,\n },\n ...\n}\n\nNote: Audience in each TokenRequest should be different and at most one token is empty string. To receive a new token after expiry, RequiresRepublish can be used to trigger NodePublishVolume periodically.", "requiresRepublish": "requiresRepublish indicates the CSI driver wants `NodePublishVolume` being periodically called to reflect any possible change in the mounted volume. This field defaults to false.\n\nNote: After a successful initial NodePublishVolume call, subsequent calls to NodePublishVolume should only update the contents of the volume. New mount points will not be seen by a running container.", "seLinuxMount": "seLinuxMount specifies if the CSI driver supports \"-o context\" mount option.\n\nWhen \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context.\n\nWhen \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem.\n\nDefault is \"false\".", - "nodeAllocatableUpdatePeriodSeconds": "nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.\n\nThis is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled.\n\nThis field is mutable.", + "nodeAllocatableUpdatePeriodSeconds": "nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.\n\nThis feature requires the MutableCSINodeAllocatableCount feature gate to be enabled.\n\nThis field is mutable.", "serviceAccountTokenInSecrets": "serviceAccountTokenInSecrets is an opt-in for CSI drivers to indicate that service account tokens should be passed via the Secrets field in NodePublishVolumeRequest instead of the VolumeContext field. The CSI specification provides a dedicated Secrets field for sensitive information like tokens, which is the appropriate mechanism for handling credentials. This addresses security concerns where sensitive tokens were being logged as part of volume context.\n\nWhen \"true\", kubelet will pass the tokens only in the Secrets field with the key \"csi.storage.k8s.io/serviceAccount.tokens\". The CSI driver must be updated to read tokens from the Secrets field instead of VolumeContext.\n\nWhen \"false\" or not set, kubelet will pass the tokens in VolumeContext with the key \"csi.storage.k8s.io/serviceAccount.tokens\" (existing behavior). This maintains backward compatibility with existing CSI drivers.\n\nThis field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests.\n\nDefault behavior if unset is to pass tokens in the VolumeContext field.", + "preventPodSchedulingIfMissing": "PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".", } func (CSIDriverSpec) SwaggerDoc() map[string]string { @@ -243,7 +244,7 @@ var map_VolumeError = map[string]string{ "": "VolumeError captures an error encountered during a volume operation.", "time": "time represents the time the error was encountered.", "message": "message represents the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information.", - "errorCode": "errorCode is a numeric gRPC code representing the error encountered during Attach or Detach operations.\n\nThis is an optional, beta field that requires the MutableCSINodeAllocatableCount feature gate being enabled to be set.", + "errorCode": "errorCode is a numeric gRPC code representing the error encountered during Attach or Detach operations.\n\nThis field requires the MutableCSINodeAllocatableCount feature gate being enabled to be set.", } func (VolumeError) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go b/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go index b9e0a7d912..aa3ffd0686 100644 --- a/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go @@ -142,6 +142,11 @@ func (in *CSIDriverSpec) DeepCopyInto(out *CSIDriverSpec) { *out = new(bool) **out = **in } + if in.PreventPodSchedulingIfMissing != nil { + in, out := &in.PreventPodSchedulingIfMissing, &out.PreventPodSchedulingIfMissing + *out = new(bool) + **out = **in + } return } diff --git a/vendor/k8s.io/api/storage/v1alpha1/generated.proto b/vendor/k8s.io/api/storage/v1alpha1/generated.proto index c1abc3fb36..837d011640 100644 --- a/vendor/k8s.io/api/storage/v1alpha1/generated.proto +++ b/vendor/k8s.io/api/storage/v1alpha1/generated.proto @@ -134,6 +134,8 @@ message VolumeAttachment { // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +required optional VolumeAttachmentSpec spec = 2; // status represents status of the VolumeAttachment request. @@ -177,6 +179,10 @@ message VolumeAttachmentSource { message VolumeAttachmentSpec { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 optional string attacher = 1; // source represents the volume that should be attached. diff --git a/vendor/k8s.io/api/storage/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/api/storage/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index d58dcac3c2..0000000000 --- a/vendor/k8s.io/api/storage/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,42 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*CSIStorageCapacity) ProtoMessage() {} - -func (*CSIStorageCapacityList) ProtoMessage() {} - -func (*VolumeAttachment) ProtoMessage() {} - -func (*VolumeAttachmentList) ProtoMessage() {} - -func (*VolumeAttachmentSource) ProtoMessage() {} - -func (*VolumeAttachmentSpec) ProtoMessage() {} - -func (*VolumeAttachmentStatus) ProtoMessage() {} - -func (*VolumeAttributesClass) ProtoMessage() {} - -func (*VolumeAttributesClassList) ProtoMessage() {} - -func (*VolumeError) ProtoMessage() {} diff --git a/vendor/k8s.io/api/storage/v1alpha1/types.go b/vendor/k8s.io/api/storage/v1alpha1/types.go index 2785b01d4a..286ac42aaa 100644 --- a/vendor/k8s.io/api/storage/v1alpha1/types.go +++ b/vendor/k8s.io/api/storage/v1alpha1/types.go @@ -28,6 +28,7 @@ import ( // +k8s:prerelease-lifecycle-gen:introduced=1.9 // +k8s:prerelease-lifecycle-gen:deprecated=1.21 // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,VolumeAttachment +// +k8s:supportsSubresource="/status" // VolumeAttachment captures the intent to attach or detach the specified volume // to/from the specified node. @@ -43,6 +44,8 @@ type VolumeAttachment struct { // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +required Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // status represents status of the VolumeAttachment request. @@ -74,6 +77,10 @@ type VolumeAttachmentList struct { type VolumeAttachmentSpec struct { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"` // source represents the volume that should be attached. diff --git a/vendor/k8s.io/api/storage/v1beta1/generated.pb.go b/vendor/k8s.io/api/storage/v1beta1/generated.pb.go index ed03dd5059..7fd08783aa 100644 --- a/vendor/k8s.io/api/storage/v1beta1/generated.pb.go +++ b/vendor/k8s.io/api/storage/v1beta1/generated.pb.go @@ -187,6 +187,16 @@ func (m *CSIDriverSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.PreventPodSchedulingIfMissing != nil { + i-- + if *m.PreventPodSchedulingIfMissing { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } if m.ServiceAccountTokenInSecrets != nil { i-- if *m.ServiceAccountTokenInSecrets { @@ -1304,6 +1314,9 @@ func (m *CSIDriverSpec) Size() (n int) { if m.ServiceAccountTokenInSecrets != nil { n += 2 } + if m.PreventPodSchedulingIfMissing != nil { + n += 2 + } return n } @@ -1701,6 +1714,7 @@ func (this *CSIDriverSpec) String() string { `SELinuxMount:` + valueToStringGenerated(this.SELinuxMount) + `,`, `NodeAllocatableUpdatePeriodSeconds:` + valueToStringGenerated(this.NodeAllocatableUpdatePeriodSeconds) + `,`, `ServiceAccountTokenInSecrets:` + valueToStringGenerated(this.ServiceAccountTokenInSecrets) + `,`, + `PreventPodSchedulingIfMissing:` + valueToStringGenerated(this.PreventPodSchedulingIfMissing) + `,`, `}`, }, "") return s @@ -2498,6 +2512,27 @@ func (m *CSIDriverSpec) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.ServiceAccountTokenInSecrets = &b + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PreventPodSchedulingIfMissing", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.PreventPodSchedulingIfMissing = &b default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/vendor/k8s.io/api/storage/v1beta1/generated.proto b/vendor/k8s.io/api/storage/v1beta1/generated.proto index 33b904ee6d..3cae755fb4 100644 --- a/vendor/k8s.io/api/storage/v1beta1/generated.proto +++ b/vendor/k8s.io/api/storage/v1beta1/generated.proto @@ -251,6 +251,27 @@ message CSIDriverSpec { // +featureGate=CSIServiceAccountTokenSecrets // +optional optional bool serviceAccountTokenInSecrets = 10; + + // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // scheduling if the CSI driver on the node is missing. + // + // Enabling this option will prevent the scheduler (or any other + // component which embeds default scheduler such as cluster-autoscaler) from + // scheduling pods to nodes where CSI driver is not installed. + // + // For components(such as cluster-autoscaler) that embed the scheduler and run + // pod placement simulations using scheduler plugins, they MUST be aware of + // CSI driver registration information via CSINode object. They must create simulated + // CSINode objects in addition to Node objects during scheduling simulation, otherwise + // if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any + // newly created node may be rejected by the scheduler because of missing CSI driver + // information from the node. + // + // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // Default is "false". + // +featureGate=VolumeLimitScaling + // +optional + optional bool preventPodSchedulingIfMissing = 11; } // DEPRECATED - This group version of CSINode is deprecated by storage/v1/CSINode. @@ -436,17 +457,22 @@ message StorageClass { // provisioner indicates the type of the provisioner. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable optional string provisioner = 2; // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional map parameters = 3; // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional optional string reclaimPolicy = 4; // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -464,6 +490,8 @@ message StorageClass { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional optional string volumeBindingMode = 7; // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -511,6 +539,8 @@ message VolumeAttachment { // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +required optional VolumeAttachmentSpec spec = 2; // status represents status of the VolumeAttachment request. @@ -554,6 +584,10 @@ message VolumeAttachmentSource { message VolumeAttachmentSpec { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 optional string attacher = 1; // source represents the volume that should be attached. diff --git a/vendor/k8s.io/api/storage/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/storage/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index a288b7fb6a..0000000000 --- a/vendor/k8s.io/api/storage/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*CSIDriver) ProtoMessage() {} - -func (*CSIDriverList) ProtoMessage() {} - -func (*CSIDriverSpec) ProtoMessage() {} - -func (*CSINode) ProtoMessage() {} - -func (*CSINodeDriver) ProtoMessage() {} - -func (*CSINodeList) ProtoMessage() {} - -func (*CSINodeSpec) ProtoMessage() {} - -func (*CSIStorageCapacity) ProtoMessage() {} - -func (*CSIStorageCapacityList) ProtoMessage() {} - -func (*StorageClass) ProtoMessage() {} - -func (*StorageClassList) ProtoMessage() {} - -func (*TokenRequest) ProtoMessage() {} - -func (*VolumeAttachment) ProtoMessage() {} - -func (*VolumeAttachmentList) ProtoMessage() {} - -func (*VolumeAttachmentSource) ProtoMessage() {} - -func (*VolumeAttachmentSpec) ProtoMessage() {} - -func (*VolumeAttachmentStatus) ProtoMessage() {} - -func (*VolumeAttributesClass) ProtoMessage() {} - -func (*VolumeAttributesClassList) ProtoMessage() {} - -func (*VolumeError) ProtoMessage() {} - -func (*VolumeNodeResources) ProtoMessage() {} diff --git a/vendor/k8s.io/api/storage/v1beta1/types.go b/vendor/k8s.io/api/storage/v1beta1/types.go index b5dde72ad9..0c33e218e7 100644 --- a/vendor/k8s.io/api/storage/v1beta1/types.go +++ b/vendor/k8s.io/api/storage/v1beta1/types.go @@ -44,17 +44,22 @@ type StorageClass struct { // provisioner indicates the type of the provisioner. // +required - // +k8s:required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:immutable Provisioner string `json:"provisioner" protobuf:"bytes,2,opt,name=provisioner"` // parameters holds the parameters for the provisioner that should // create volumes of this storage class. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional Parameters map[string]string `json:"parameters,omitempty" protobuf:"bytes,3,rep,name=parameters"` // reclaimPolicy controls the reclaimPolicy for dynamically provisioned PersistentVolumes of this storage class. // Defaults to Delete. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional ReclaimPolicy *v1.PersistentVolumeReclaimPolicy `json:"reclaimPolicy,omitempty" protobuf:"bytes,4,opt,name=reclaimPolicy,casttype=k8s.io/api/core/v1.PersistentVolumeReclaimPolicy"` // mountOptions controls the mountOptions for dynamically provisioned PersistentVolumes of this storage class. @@ -72,6 +77,8 @@ type StorageClass struct { // provisioned and bound. When unset, VolumeBindingImmediate is used. // This field is only honored by servers that enable the VolumeScheduling feature. // +optional + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +k8s:alpha(since: "1.36")=+k8s:optional VolumeBindingMode *VolumeBindingMode `json:"volumeBindingMode,omitempty" protobuf:"bytes,7,opt,name=volumeBindingMode"` // allowedTopologies restrict the node topologies where volumes can be dynamically provisioned. @@ -122,6 +129,7 @@ const ( // +k8s:prerelease-lifecycle-gen:introduced=1.10 // +k8s:prerelease-lifecycle-gen:deprecated=1.19 // +k8s:prerelease-lifecycle-gen:replacement=storage.k8s.io,v1,VolumeAttachment +// +k8s:supportsSubresource="/status" // VolumeAttachment captures the intent to attach or detach the specified volume // to/from the specified node. @@ -137,6 +145,8 @@ type VolumeAttachment struct { // spec represents specification of the desired attach/detach volume behavior. // Populated by the Kubernetes system. + // +k8s:alpha(since: "1.36")=+k8s:immutable + // +required Spec VolumeAttachmentSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"` // status represents status of the VolumeAttachment request. @@ -168,6 +178,10 @@ type VolumeAttachmentList struct { type VolumeAttachmentSpec struct { // attacher indicates the name of the volume driver that MUST handle this // request. This is the name returned by GetPluginName(). + // +required + // +k8s:alpha(since: "1.36")=+k8s:required + // +k8s:alpha(since: "1.36")=+k8s:format="k8s-long-name-caseless" + // +k8s:alpha(since: "1.36")=+k8s:maxLength=63 Attacher string `json:"attacher" protobuf:"bytes,1,opt,name=attacher"` // source represents the volume that should be attached. @@ -482,6 +496,27 @@ type CSIDriverSpec struct { // +featureGate=CSIServiceAccountTokenSecrets // +optional ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty" protobuf:"varint,10,opt,name=serviceAccountTokenInSecrets"` + + // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // scheduling if the CSI driver on the node is missing. + // + // Enabling this option will prevent the scheduler (or any other + // component which embeds default scheduler such as cluster-autoscaler) from + // scheduling pods to nodes where CSI driver is not installed. + // + // For components(such as cluster-autoscaler) that embed the scheduler and run + // pod placement simulations using scheduler plugins, they MUST be aware of + // CSI driver registration information via CSINode object. They must create simulated + // CSINode objects in addition to Node objects during scheduling simulation, otherwise + // if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any + // newly created node may be rejected by the scheduler because of missing CSI driver + // information from the node. + // + // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // Default is "false". + // +featureGate=VolumeLimitScaling + // +optional + PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty" protobuf:"varint,11,opt,name=preventPodSchedulingIfMissing"` } // FSGroupPolicy specifies if a CSI Driver supports modifying diff --git a/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go b/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go index 78da9266e0..80b68839b4 100644 --- a/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go @@ -59,6 +59,7 @@ var map_CSIDriverSpec = map[string]string{ "seLinuxMount": "seLinuxMount specifies if the CSI driver supports \"-o context\" mount option.\n\nWhen \"true\", the CSI driver must ensure that all volumes provided by this CSI driver can be mounted separately with different `-o context` options. This is typical for storage backends that provide volumes as filesystems on block devices or as independent shared volumes. Kubernetes will call NodeStage / NodePublish with \"-o context=xyz\" mount option when mounting a ReadWriteOncePod volume used in Pod that has explicitly set SELinux context. In the future, it may be expanded to other volume AccessModes. In any case, Kubernetes will ensure that the volume is mounted only with a single SELinux context.\n\nWhen \"false\", Kubernetes won't pass any special SELinux mount options to the driver. This is typical for volumes that represent subdirectories of a bigger shared filesystem.\n\nDefault is \"false\".", "nodeAllocatableUpdatePeriodSeconds": "nodeAllocatableUpdatePeriodSeconds specifies the interval between periodic updates of the CSINode allocatable capacity for this driver. When set, both periodic updates and updates triggered by capacity-related failures are enabled. If not set, no updates occur (neither periodic nor upon detecting capacity-related failures), and the allocatable.count remains static. The minimum allowed value for this field is 10 seconds.\n\nThis is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled.\n\nThis field is mutable.", "serviceAccountTokenInSecrets": "serviceAccountTokenInSecrets is an opt-in for CSI drivers to indicate that service account tokens should be passed via the Secrets field in NodePublishVolumeRequest instead of the VolumeContext field. The CSI specification provides a dedicated Secrets field for sensitive information like tokens, which is the appropriate mechanism for handling credentials. This addresses security concerns where sensitive tokens were being logged as part of volume context.\n\nWhen \"true\", kubelet will pass the tokens only in the Secrets field with the key \"csi.storage.k8s.io/serviceAccount.tokens\". The CSI driver must be updated to read tokens from the Secrets field instead of VolumeContext.\n\nWhen \"false\" or not set, kubelet will pass the tokens in VolumeContext with the key \"csi.storage.k8s.io/serviceAccount.tokens\" (existing behavior). This maintains backward compatibility with existing CSI drivers.\n\nThis field can only be set when TokenRequests is configured. The API server will reject CSIDriver specs that set this field without TokenRequests.\n\nDefault behavior if unset is to pass tokens in the VolumeContext field.", + "preventPodSchedulingIfMissing": "PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod scheduling if the CSI driver on the node is missing.\n\nEnabling this option will prevent the scheduler (or any other component which embeds default scheduler such as cluster-autoscaler) from scheduling pods to nodes where CSI driver is not installed.\n\nFor components(such as cluster-autoscaler) that embed the scheduler and run pod placement simulations using scheduler plugins, they MUST be aware of CSI driver registration information via CSINode object. They must create simulated CSINode objects in addition to Node objects during scheduling simulation, otherwise if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any newly created node may be rejected by the scheduler because of missing CSI driver information from the node.\n\nThis is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. Default is \"false\".", } func (CSIDriverSpec) SwaggerDoc() map[string]string { diff --git a/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go index 94cc629da6..ca28e0340c 100644 --- a/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go @@ -142,6 +142,11 @@ func (in *CSIDriverSpec) DeepCopyInto(out *CSIDriverSpec) { *out = new(bool) **out = **in } + if in.PreventPodSchedulingIfMissing != nil { + in, out := &in.PreventPodSchedulingIfMissing, &out.PreventPodSchedulingIfMissing + *out = new(bool) + **out = **in + } return } diff --git a/vendor/k8s.io/api/storagemigration/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/api/storagemigration/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 39cafd8a9e..0000000000 --- a/vendor/k8s.io/api/storagemigration/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*StorageVersionMigration) ProtoMessage() {} - -func (*StorageVersionMigrationList) ProtoMessage() {} - -func (*StorageVersionMigrationSpec) ProtoMessage() {} - -func (*StorageVersionMigrationStatus) ProtoMessage() {} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/generated.protomessage.pb.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/generated.protomessage.pb.go deleted file mode 100644 index 7dc6ed2bc5..0000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*ConversionRequest) ProtoMessage() {} - -func (*ConversionResponse) ProtoMessage() {} - -func (*ConversionReview) ProtoMessage() {} - -func (*CustomResourceColumnDefinition) ProtoMessage() {} - -func (*CustomResourceConversion) ProtoMessage() {} - -func (*CustomResourceDefinition) ProtoMessage() {} - -func (*CustomResourceDefinitionCondition) ProtoMessage() {} - -func (*CustomResourceDefinitionList) ProtoMessage() {} - -func (*CustomResourceDefinitionNames) ProtoMessage() {} - -func (*CustomResourceDefinitionSpec) ProtoMessage() {} - -func (*CustomResourceDefinitionStatus) ProtoMessage() {} - -func (*CustomResourceDefinitionVersion) ProtoMessage() {} - -func (*CustomResourceSubresourceScale) ProtoMessage() {} - -func (*CustomResourceSubresourceStatus) ProtoMessage() {} - -func (*CustomResourceSubresources) ProtoMessage() {} - -func (*CustomResourceValidation) ProtoMessage() {} - -func (*ExternalDocumentation) ProtoMessage() {} - -func (*JSON) ProtoMessage() {} - -func (*JSONSchemaProps) ProtoMessage() {} - -func (*JSONSchemaPropsOrArray) ProtoMessage() {} - -func (*JSONSchemaPropsOrBool) ProtoMessage() {} - -func (*JSONSchemaPropsOrStringArray) ProtoMessage() {} - -func (*SelectableField) ProtoMessage() {} - -func (*ServiceReference) ProtoMessage() {} - -func (*ValidationRule) ProtoMessage() {} - -func (*WebhookClientConfig) ProtoMessage() {} - -func (*WebhookConversion) ProtoMessage() {} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go index 764726b6e9..b3a8ce7ef4 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1/types.go @@ -332,6 +332,9 @@ const ( // be true if .metadata.annotations["api-approved.kubernetes.io"] is set to a URL, otherwise it will be false. // See https://github.com/kubernetes/enhancements/pull/1111 for more details. KubernetesAPIApprovalPolicyConformant CustomResourceDefinitionConditionType = "KubernetesAPIApprovalPolicyConformant" + // StorageMigrating indicates that the underlying storage version of the CRD + // is undergoing migration. + StorageMigrating CustomResourceDefinitionConditionType = "StorageMigrating" ) // CustomResourceDefinitionCondition contains details for the current condition of this pod. diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 997d32f31e..0000000000 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,74 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*ConversionRequest) ProtoMessage() {} - -func (*ConversionResponse) ProtoMessage() {} - -func (*ConversionReview) ProtoMessage() {} - -func (*CustomResourceColumnDefinition) ProtoMessage() {} - -func (*CustomResourceConversion) ProtoMessage() {} - -func (*CustomResourceDefinition) ProtoMessage() {} - -func (*CustomResourceDefinitionCondition) ProtoMessage() {} - -func (*CustomResourceDefinitionList) ProtoMessage() {} - -func (*CustomResourceDefinitionNames) ProtoMessage() {} - -func (*CustomResourceDefinitionSpec) ProtoMessage() {} - -func (*CustomResourceDefinitionStatus) ProtoMessage() {} - -func (*CustomResourceDefinitionVersion) ProtoMessage() {} - -func (*CustomResourceSubresourceScale) ProtoMessage() {} - -func (*CustomResourceSubresourceStatus) ProtoMessage() {} - -func (*CustomResourceSubresources) ProtoMessage() {} - -func (*CustomResourceValidation) ProtoMessage() {} - -func (*ExternalDocumentation) ProtoMessage() {} - -func (*JSON) ProtoMessage() {} - -func (*JSONSchemaProps) ProtoMessage() {} - -func (*JSONSchemaPropsOrArray) ProtoMessage() {} - -func (*JSONSchemaPropsOrBool) ProtoMessage() {} - -func (*JSONSchemaPropsOrStringArray) ProtoMessage() {} - -func (*SelectableField) ProtoMessage() {} - -func (*ServiceReference) ProtoMessage() {} - -func (*ValidationRule) ProtoMessage() {} - -func (*WebhookClientConfig) ProtoMessage() {} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcecolumndefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcecolumndefinition.go new file mode 100644 index 0000000000..3c14acfc2e --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcecolumndefinition.go @@ -0,0 +1,98 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// CustomResourceColumnDefinitionApplyConfiguration represents a declarative configuration of the CustomResourceColumnDefinition type for use +// with apply. +// +// CustomResourceColumnDefinition specifies a column for server side printing. +type CustomResourceColumnDefinitionApplyConfiguration struct { + // name is a human readable name for the column. + Name *string `json:"name,omitempty"` + // type is an OpenAPI type definition for this column. + // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + Type *string `json:"type,omitempty"` + // format is an optional OpenAPI type definition for this column. The 'name' format is applied + // to the primary identifier column to assist in clients identifying column is the resource name. + // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + Format *string `json:"format,omitempty"` + // description is a human readable description of this column. + Description *string `json:"description,omitempty"` + // priority is an integer defining the relative importance of this column compared to others. Lower + // numbers are considered higher priority. Columns that may be omitted in limited space scenarios + // should be given a priority greater than 0. + Priority *int32 `json:"priority,omitempty"` + // jsonPath is a simple JSON path (i.e. with array notation) which is evaluated against + // each custom resource to produce the value for this column. + JSONPath *string `json:"jsonPath,omitempty"` +} + +// CustomResourceColumnDefinitionApplyConfiguration constructs a declarative configuration of the CustomResourceColumnDefinition type for use with +// apply. +func CustomResourceColumnDefinition() *CustomResourceColumnDefinitionApplyConfiguration { + return &CustomResourceColumnDefinitionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithName(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Name = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithType(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Type = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithFormat(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Format = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithDescription(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Description = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithPriority(value int32) *CustomResourceColumnDefinitionApplyConfiguration { + b.Priority = &value + return b +} + +// WithJSONPath sets the JSONPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JSONPath field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithJSONPath(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.JSONPath = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourceconversion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourceconversion.go new file mode 100644 index 0000000000..f2d1853366 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourceconversion.go @@ -0,0 +1,59 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// CustomResourceConversionApplyConfiguration represents a declarative configuration of the CustomResourceConversion type for use +// with apply. +// +// CustomResourceConversion describes how to convert different versions of a CR. +type CustomResourceConversionApplyConfiguration struct { + // strategy specifies how custom resources are converted between versions. Allowed values are: + // - `"None"`: The converter only change the apiVersion and would not touch any other field in the custom resource. + // - `"Webhook"`: API Server will call to an external webhook to do the conversion. Additional information + // is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhook to be set. + Strategy *apiextensionsv1.ConversionStrategyType `json:"strategy,omitempty"` + // webhook describes how to call the conversion webhook. Required when `strategy` is set to `"Webhook"`. + Webhook *WebhookConversionApplyConfiguration `json:"webhook,omitempty"` +} + +// CustomResourceConversionApplyConfiguration constructs a declarative configuration of the CustomResourceConversion type for use with +// apply. +func CustomResourceConversion() *CustomResourceConversionApplyConfiguration { + return &CustomResourceConversionApplyConfiguration{} +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *CustomResourceConversionApplyConfiguration) WithStrategy(value apiextensionsv1.ConversionStrategyType) *CustomResourceConversionApplyConfiguration { + b.Strategy = &value + return b +} + +// WithWebhook sets the Webhook field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Webhook field is set to the value of the last call. +func (b *CustomResourceConversionApplyConfiguration) WithWebhook(value *WebhookConversionApplyConfiguration) *CustomResourceConversionApplyConfiguration { + b.Webhook = value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go new file mode 100644 index 0000000000..4884c25237 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinition.go @@ -0,0 +1,249 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CustomResourceDefinitionApplyConfiguration represents a declarative configuration of the CustomResourceDefinition type for use +// with apply. +// +// CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format +// <.spec.name>.<.spec.group>. +type CustomResourceDefinitionApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:",inline"` + // Standard object's metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec describes how the user wants the resources to appear + Spec *CustomResourceDefinitionSpecApplyConfiguration `json:"spec,omitempty"` + // status indicates the actual state of the CustomResourceDefinition + Status *CustomResourceDefinitionStatusApplyConfiguration `json:"status,omitempty"` +} + +// CustomResourceDefinition constructs a declarative configuration of the CustomResourceDefinition type for use with +// apply. +func CustomResourceDefinition(name string) *CustomResourceDefinitionApplyConfiguration { + b := &CustomResourceDefinitionApplyConfiguration{} + b.WithName(name) + b.WithKind("CustomResourceDefinition") + b.WithAPIVersion("apiextensions.k8s.io/v1") + return b +} + +func (b CustomResourceDefinitionApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithKind(value string) *CustomResourceDefinitionApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithAPIVersion(value string) *CustomResourceDefinitionApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithName(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithGenerateName(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithNamespace(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithUID(value types.UID) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithResourceVersion(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithGeneration(value int64) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CustomResourceDefinitionApplyConfiguration) WithLabels(entries map[string]string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CustomResourceDefinitionApplyConfiguration) WithAnnotations(entries map[string]string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CustomResourceDefinitionApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CustomResourceDefinitionApplyConfiguration) WithFinalizers(values ...string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *CustomResourceDefinitionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithSpec(value *CustomResourceDefinitionSpecApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithStatus(value *CustomResourceDefinitionStatusApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitioncondition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitioncondition.go new file mode 100644 index 0000000000..54f7d2d7b7 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitioncondition.go @@ -0,0 +1,100 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CustomResourceDefinitionConditionApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionCondition type for use +// with apply. +// +// CustomResourceDefinitionCondition contains details for the current condition of this pod. +type CustomResourceDefinitionConditionApplyConfiguration struct { + // type is the type of the condition. Types include Established, NamesAccepted and Terminating. + Type *apiextensionsv1.CustomResourceDefinitionConditionType `json:"type,omitempty"` + // status is the status of the condition. + // Can be True, False, Unknown. + Status *apiextensionsv1.ConditionStatus `json:"status,omitempty"` + // lastTransitionTime last time the condition transitioned from one status to another. + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` + // reason is a unique, one-word, CamelCase reason for the condition's last transition. + Reason *string `json:"reason,omitempty"` + // message is a human-readable message indicating details about last transition. + Message *string `json:"message,omitempty"` + // observedGeneration represents the .metadata.generation that the condition was set based upon. + // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + // with respect to the current state of the instance. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` +} + +// CustomResourceDefinitionConditionApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionCondition type for use with +// apply. +func CustomResourceDefinitionCondition() *CustomResourceDefinitionConditionApplyConfiguration { + return &CustomResourceDefinitionConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithType(value apiextensionsv1.CustomResourceDefinitionConditionType) *CustomResourceDefinitionConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithStatus(value apiextensionsv1.ConditionStatus) *CustomResourceDefinitionConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *CustomResourceDefinitionConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithReason(value string) *CustomResourceDefinitionConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithMessage(value string) *CustomResourceDefinitionConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithObservedGeneration(value int64) *CustomResourceDefinitionConditionApplyConfiguration { + b.ObservedGeneration = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionnames.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionnames.go new file mode 100644 index 0000000000..d6558eec85 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionnames.go @@ -0,0 +1,104 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// CustomResourceDefinitionNamesApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionNames type for use +// with apply. +// +// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition +type CustomResourceDefinitionNamesApplyConfiguration struct { + // plural is the plural name of the resource to serve. + // The custom resources are served under `/apis///.../`. + // Must match the name of the CustomResourceDefinition (in the form `.`). + // Must be all lowercase. + Plural *string `json:"plural,omitempty"` + // singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`. + Singular *string `json:"singular,omitempty"` + // shortNames are short names for the resource, exposed in API discovery documents, + // and used by clients to support invocations like `kubectl get `. + // It must be all lowercase. + ShortNames []string `json:"shortNames,omitempty"` + // kind is the serialized kind of the resource. It is normally CamelCase and singular. + // Custom resource instances will use this value as the `kind` attribute in API calls. + Kind *string `json:"kind,omitempty"` + // listKind is the serialized kind of the list for this resource. Defaults to "`kind`List". + ListKind *string `json:"listKind,omitempty"` + // categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). + // This is published in API discovery documents, and used by clients to support invocations like + // `kubectl get all`. + Categories []string `json:"categories,omitempty"` +} + +// CustomResourceDefinitionNamesApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionNames type for use with +// apply. +func CustomResourceDefinitionNames() *CustomResourceDefinitionNamesApplyConfiguration { + return &CustomResourceDefinitionNamesApplyConfiguration{} +} + +// WithPlural sets the Plural field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Plural field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithPlural(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Plural = &value + return b +} + +// WithSingular sets the Singular field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Singular field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithSingular(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Singular = &value + return b +} + +// WithShortNames adds the given value to the ShortNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ShortNames field. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithShortNames(values ...string) *CustomResourceDefinitionNamesApplyConfiguration { + for i := range values { + b.ShortNames = append(b.ShortNames, values[i]) + } + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithKind(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Kind = &value + return b +} + +// WithListKind sets the ListKind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ListKind field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithListKind(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.ListKind = &value + return b +} + +// WithCategories adds the given value to the Categories field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Categories field. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithCategories(values ...string) *CustomResourceDefinitionNamesApplyConfiguration { + for i := range values { + b.Categories = append(b.Categories, values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionspec.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionspec.go new file mode 100644 index 0000000000..b33a824184 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionspec.go @@ -0,0 +1,115 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// CustomResourceDefinitionSpecApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionSpec type for use +// with apply. +// +// CustomResourceDefinitionSpec describes how a user wants their resource to appear +type CustomResourceDefinitionSpecApplyConfiguration struct { + // group is the API group of the defined custom resource. + // The custom resources are served under `/apis//...`. + // Must match the name of the CustomResourceDefinition (in the form `.`). + Group *string `json:"group,omitempty"` + // names specify the resource and kind names for the custom resource. + Names *CustomResourceDefinitionNamesApplyConfiguration `json:"names,omitempty"` + // scope indicates whether the defined custom resource is cluster- or namespace-scoped. + // Allowed values are `Cluster` and `Namespaced`. + Scope *apiextensionsv1.ResourceScope `json:"scope,omitempty"` + // versions is the list of all API versions of the defined custom resource. + // Version names are used to compute the order in which served versions are listed in API discovery. + // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered + // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), + // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first + // by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing + // major version, then minor version. An example sorted list of versions: + // v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. + Versions []CustomResourceDefinitionVersionApplyConfiguration `json:"versions,omitempty"` + // conversion defines conversion settings for the CRD. + Conversion *CustomResourceConversionApplyConfiguration `json:"conversion,omitempty"` + // preserveUnknownFields indicates that object fields which are not specified + // in the OpenAPI schema should be preserved when persisting to storage. + // apiVersion, kind, metadata and known fields inside metadata are always preserved. + // This field is deprecated in favor of setting `x-preserve-unknown-fields` to true in `spec.versions[*].schema.openAPIV3Schema`. + // See https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning for details. + PreserveUnknownFields *bool `json:"preserveUnknownFields,omitempty"` +} + +// CustomResourceDefinitionSpecApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionSpec type for use with +// apply. +func CustomResourceDefinitionSpec() *CustomResourceDefinitionSpecApplyConfiguration { + return &CustomResourceDefinitionSpecApplyConfiguration{} +} + +// WithGroup sets the Group field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Group field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithGroup(value string) *CustomResourceDefinitionSpecApplyConfiguration { + b.Group = &value + return b +} + +// WithNames sets the Names field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Names field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithNames(value *CustomResourceDefinitionNamesApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Names = value + return b +} + +// WithScope sets the Scope field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scope field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithScope(value apiextensionsv1.ResourceScope) *CustomResourceDefinitionSpecApplyConfiguration { + b.Scope = &value + return b +} + +// WithVersions adds the given value to the Versions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Versions field. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithVersions(values ...*CustomResourceDefinitionVersionApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVersions") + } + b.Versions = append(b.Versions, *values[i]) + } + return b +} + +// WithConversion sets the Conversion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conversion field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithConversion(value *CustomResourceConversionApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Conversion = value + return b +} + +// WithPreserveUnknownFields sets the PreserveUnknownFields field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreserveUnknownFields field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithPreserveUnknownFields(value bool) *CustomResourceDefinitionSpecApplyConfiguration { + b.PreserveUnknownFields = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionstatus.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionstatus.go new file mode 100644 index 0000000000..8a590de96b --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionstatus.go @@ -0,0 +1,85 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// CustomResourceDefinitionStatusApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionStatus type for use +// with apply. +// +// CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition +type CustomResourceDefinitionStatusApplyConfiguration struct { + // conditions indicate state for particular aspects of a CustomResourceDefinition + Conditions []CustomResourceDefinitionConditionApplyConfiguration `json:"conditions,omitempty"` + // acceptedNames are the names that are actually being used to serve discovery. + // They may be different than the names in spec. + AcceptedNames *CustomResourceDefinitionNamesApplyConfiguration `json:"acceptedNames,omitempty"` + // storedVersions lists all versions of CustomResources that were ever persisted. Tracking these + // versions allows a migration path for stored versions in etcd. The field is mutable + // so a migration controller can finish a migration to another version (ensuring + // no old objects are left in storage), and then remove the rest of the + // versions from this list. + // Versions may not be removed from `spec.versions` while they exist in this list. + StoredVersions []string `json:"storedVersions,omitempty"` + // The generation observed by the CRD controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` +} + +// CustomResourceDefinitionStatusApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionStatus type for use with +// apply. +func CustomResourceDefinitionStatus() *CustomResourceDefinitionStatusApplyConfiguration { + return &CustomResourceDefinitionStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithConditions(values ...*CustomResourceDefinitionConditionApplyConfiguration) *CustomResourceDefinitionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAcceptedNames sets the AcceptedNames field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AcceptedNames field is set to the value of the last call. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithAcceptedNames(value *CustomResourceDefinitionNamesApplyConfiguration) *CustomResourceDefinitionStatusApplyConfiguration { + b.AcceptedNames = value + return b +} + +// WithStoredVersions adds the given value to the StoredVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the StoredVersions field. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithStoredVersions(values ...string) *CustomResourceDefinitionStatusApplyConfiguration { + for i := range values { + b.StoredVersions = append(b.StoredVersions, values[i]) + } + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithObservedGeneration(value int64) *CustomResourceDefinitionStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionversion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionversion.go new file mode 100644 index 0000000000..0362753e81 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcedefinitionversion.go @@ -0,0 +1,143 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// CustomResourceDefinitionVersionApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionVersion type for use +// with apply. +// +// CustomResourceDefinitionVersion describes a version for CRD. +type CustomResourceDefinitionVersionApplyConfiguration struct { + // name is the version name, e.g. “v1”, “v2beta1”, etc. + // The custom resources are served under this version at `/apis///...` if `served` is true. + Name *string `json:"name,omitempty"` + // served is a flag enabling/disabling this version from being served via REST APIs + Served *bool `json:"served,omitempty"` + // storage indicates this version should be used when persisting custom resources to storage. + // There must be exactly one version with storage=true. + Storage *bool `json:"storage,omitempty"` + // deprecated indicates this version of the custom resource API is deprecated. + // When set to true, API requests to this version receive a warning header in the server response. + // Defaults to false. + Deprecated *bool `json:"deprecated,omitempty"` + // deprecationWarning overrides the default warning returned to API clients. + // May only be set when `deprecated` is true. + // The default warning indicates this version is deprecated and recommends use + // of the newest served version of equal or greater stability, if one exists. + DeprecationWarning *string `json:"deprecationWarning,omitempty"` + // schema describes the schema used for validation, pruning, and defaulting of this version of the custom resource. + Schema *CustomResourceValidationApplyConfiguration `json:"schema,omitempty"` + // subresources specify what subresources this version of the defined custom resource have. + Subresources *CustomResourceSubresourcesApplyConfiguration `json:"subresources,omitempty"` + // additionalPrinterColumns specifies additional columns returned in Table output. + // See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. + // If no columns are specified, a single column displaying the age of the custom resource is used. + AdditionalPrinterColumns []CustomResourceColumnDefinitionApplyConfiguration `json:"additionalPrinterColumns,omitempty"` + // selectableFields specifies paths to fields that may be used as field selectors. + // A maximum of 8 selectable fields are allowed. + // See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors + SelectableFields []SelectableFieldApplyConfiguration `json:"selectableFields,omitempty"` +} + +// CustomResourceDefinitionVersionApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionVersion type for use with +// apply. +func CustomResourceDefinitionVersion() *CustomResourceDefinitionVersionApplyConfiguration { + return &CustomResourceDefinitionVersionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithName(value string) *CustomResourceDefinitionVersionApplyConfiguration { + b.Name = &value + return b +} + +// WithServed sets the Served field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Served field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithServed(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Served = &value + return b +} + +// WithStorage sets the Storage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Storage field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithStorage(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Storage = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithDeprecated(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Deprecated = &value + return b +} + +// WithDeprecationWarning sets the DeprecationWarning field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecationWarning field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithDeprecationWarning(value string) *CustomResourceDefinitionVersionApplyConfiguration { + b.DeprecationWarning = &value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSchema(value *CustomResourceValidationApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + b.Schema = value + return b +} + +// WithSubresources sets the Subresources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subresources field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSubresources(value *CustomResourceSubresourcesApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + b.Subresources = value + return b +} + +// WithAdditionalPrinterColumns adds the given value to the AdditionalPrinterColumns field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AdditionalPrinterColumns field. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithAdditionalPrinterColumns(values ...*CustomResourceColumnDefinitionApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAdditionalPrinterColumns") + } + b.AdditionalPrinterColumns = append(b.AdditionalPrinterColumns, *values[i]) + } + return b +} + +// WithSelectableFields adds the given value to the SelectableFields field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SelectableFields field. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSelectableFields(values ...*SelectableFieldApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSelectableFields") + } + b.SelectableFields = append(b.SelectableFields, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresources.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresources.go new file mode 100644 index 0000000000..77307d9af0 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresources.go @@ -0,0 +1,59 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// CustomResourceSubresourcesApplyConfiguration represents a declarative configuration of the CustomResourceSubresources type for use +// with apply. +// +// CustomResourceSubresources defines the status and scale subresources for CustomResources. +type CustomResourceSubresourcesApplyConfiguration struct { + // status indicates the custom resource should serve a `/status` subresource. + // When enabled: + // 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. + // 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object. + Status *apiextensionsv1.CustomResourceSubresourceStatus `json:"status,omitempty"` + // scale indicates the custom resource should serve a `/scale` subresource that returns an `autoscaling/v1` Scale object. + Scale *CustomResourceSubresourceScaleApplyConfiguration `json:"scale,omitempty"` +} + +// CustomResourceSubresourcesApplyConfiguration constructs a declarative configuration of the CustomResourceSubresources type for use with +// apply. +func CustomResourceSubresources() *CustomResourceSubresourcesApplyConfiguration { + return &CustomResourceSubresourcesApplyConfiguration{} +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceSubresourcesApplyConfiguration) WithStatus(value apiextensionsv1.CustomResourceSubresourceStatus) *CustomResourceSubresourcesApplyConfiguration { + b.Status = &value + return b +} + +// WithScale sets the Scale field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scale field is set to the value of the last call. +func (b *CustomResourceSubresourcesApplyConfiguration) WithScale(value *CustomResourceSubresourceScaleApplyConfiguration) *CustomResourceSubresourcesApplyConfiguration { + b.Scale = value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresourcescale.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresourcescale.go new file mode 100644 index 0000000000..61743e236a --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcesubresourcescale.go @@ -0,0 +1,77 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// CustomResourceSubresourceScaleApplyConfiguration represents a declarative configuration of the CustomResourceSubresourceScale type for use +// with apply. +// +// CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources. +type CustomResourceSubresourceScaleApplyConfiguration struct { + // specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. + // Only JSON paths without the array notation are allowed. + // Must be a JSON Path under `.spec`. + // If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET. + SpecReplicasPath *string `json:"specReplicasPath,omitempty"` + // statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. + // Only JSON paths without the array notation are allowed. + // Must be a JSON Path under `.status`. + // If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource + // will default to 0. + StatusReplicasPath *string `json:"statusReplicasPath,omitempty"` + // labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. + // Only JSON paths without the array notation are allowed. + // Must be a JSON Path under `.status` or `.spec`. + // Must be set to work with HorizontalPodAutoscaler. + // The field pointed by this JSON path must be a string field (not a complex selector struct) + // which contains a serialized label selector in string form. + // More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource + // If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` + // subresource will default to the empty string. + LabelSelectorPath *string `json:"labelSelectorPath,omitempty"` +} + +// CustomResourceSubresourceScaleApplyConfiguration constructs a declarative configuration of the CustomResourceSubresourceScale type for use with +// apply. +func CustomResourceSubresourceScale() *CustomResourceSubresourceScaleApplyConfiguration { + return &CustomResourceSubresourceScaleApplyConfiguration{} +} + +// WithSpecReplicasPath sets the SpecReplicasPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SpecReplicasPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithSpecReplicasPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.SpecReplicasPath = &value + return b +} + +// WithStatusReplicasPath sets the StatusReplicasPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StatusReplicasPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithStatusReplicasPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.StatusReplicasPath = &value + return b +} + +// WithLabelSelectorPath sets the LabelSelectorPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LabelSelectorPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithLabelSelectorPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.LabelSelectorPath = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcevalidation.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcevalidation.go new file mode 100644 index 0000000000..459ea7e69d --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/customresourcevalidation.go @@ -0,0 +1,42 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// CustomResourceValidationApplyConfiguration represents a declarative configuration of the CustomResourceValidation type for use +// with apply. +// +// CustomResourceValidation is a list of validation methods for CustomResources. +type CustomResourceValidationApplyConfiguration struct { + // openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning. + OpenAPIV3Schema *JSONSchemaPropsApplyConfiguration `json:"openAPIV3Schema,omitempty"` +} + +// CustomResourceValidationApplyConfiguration constructs a declarative configuration of the CustomResourceValidation type for use with +// apply. +func CustomResourceValidation() *CustomResourceValidationApplyConfiguration { + return &CustomResourceValidationApplyConfiguration{} +} + +// WithOpenAPIV3Schema sets the OpenAPIV3Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OpenAPIV3Schema field is set to the value of the last call. +func (b *CustomResourceValidationApplyConfiguration) WithOpenAPIV3Schema(value *JSONSchemaPropsApplyConfiguration) *CustomResourceValidationApplyConfiguration { + b.OpenAPIV3Schema = value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/externaldocumentation.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/externaldocumentation.go new file mode 100644 index 0000000000..907f2ae7e3 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/externaldocumentation.go @@ -0,0 +1,50 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ExternalDocumentationApplyConfiguration represents a declarative configuration of the ExternalDocumentation type for use +// with apply. +// +// ExternalDocumentation allows referencing an external resource for extended documentation. +type ExternalDocumentationApplyConfiguration struct { + Description *string `json:"description,omitempty"` + URL *string `json:"url,omitempty"` +} + +// ExternalDocumentationApplyConfiguration constructs a declarative configuration of the ExternalDocumentation type for use with +// apply. +func ExternalDocumentation() *ExternalDocumentationApplyConfiguration { + return &ExternalDocumentationApplyConfiguration{} +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *ExternalDocumentationApplyConfiguration) WithDescription(value string) *ExternalDocumentationApplyConfiguration { + b.Description = &value + return b +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *ExternalDocumentationApplyConfiguration) WithURL(value string) *ExternalDocumentationApplyConfiguration { + b.URL = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/jsonschemaprops.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/jsonschemaprops.go new file mode 100644 index 0000000000..8441405281 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/jsonschemaprops.go @@ -0,0 +1,554 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// JSONSchemaPropsApplyConfiguration represents a declarative configuration of the JSONSchemaProps type for use +// with apply. +// +// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/). +type JSONSchemaPropsApplyConfiguration struct { + ID *string `json:"id,omitempty"` + Schema *apiextensionsv1.JSONSchemaURL `json:"$schema,omitempty"` + Ref *string `json:"$ref,omitempty"` + Description *string `json:"description,omitempty"` + Type *string `json:"type,omitempty"` + // format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated: + // + // - bsonobjectid: a bson object ID, i.e. a 24 characters hex string + // - uri: an URI as parsed by Golang net/url.ParseRequestURI + // - email: an email address as parsed by Golang net/mail.ParseAddress + // - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. + // - ipv4: an IPv4 IP as parsed by Golang net.ParseIP + // - ipv6: an IPv6 IP as parsed by Golang net.ParseIP + // - cidr: a CIDR as parsed by Golang net.ParseCIDR + // - mac: a MAC address as parsed by Golang net.ParseMAC + // - uuid: an UUID that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + // - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + // - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + // - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + // - isbn: an ISBN10 or ISBN13 number string like "0321751043" or "978-0321751041" + // - isbn10: an ISBN10 number string like "0321751043" + // - isbn13: an ISBN13 number string like "978-0321751041" + // - creditcard: a credit card number defined by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$ with any non digit characters mixed in + // - ssn: a U.S. social security number following the regex ^\\d{3}[- ]?\\d{2}[- ]?\\d{4}$ + // - hexcolor: an hexadecimal color code like "#FFFFFF: following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ + // - rgbcolor: an RGB color code like rgb like "rgb(255,255,2559" + // - byte: base64 encoded binary data + // - password: any kind of string + // - date: a date string like "2006-01-02" as defined by full-date in RFC3339 + // - duration: a duration string like "22 ns" as parsed by Golang time.ParseDuration or compatible with Scala duration format + // - datetime: a date time string like "2014-12-15T19:30:20.000Z" as defined by date-time in RFC3339. + Format *string `json:"format,omitempty"` + Title *string `json:"title,omitempty"` + // default is a default value for undefined object fields. + // Defaulting is a beta feature under the CustomResourceDefaulting feature gate. + // Defaulting requires spec.preserveUnknownFields to be false. + Default *apiextensionsv1.JSON `json:"default,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` + ExclusiveMaximum *bool `json:"exclusiveMaximum,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + ExclusiveMinimum *bool `json:"exclusiveMinimum,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Pattern *string `json:"pattern,omitempty"` + MaxItems *int64 `json:"maxItems,omitempty"` + MinItems *int64 `json:"minItems,omitempty"` + UniqueItems *bool `json:"uniqueItems,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty"` + Enum []apiextensionsv1.JSON `json:"enum,omitempty"` + MaxProperties *int64 `json:"maxProperties,omitempty"` + MinProperties *int64 `json:"minProperties,omitempty"` + Required []string `json:"required,omitempty"` + Items *apiextensionsv1.JSONSchemaPropsOrArray `json:"items,omitempty"` + AllOf []JSONSchemaPropsApplyConfiguration `json:"allOf,omitempty"` + OneOf []JSONSchemaPropsApplyConfiguration `json:"oneOf,omitempty"` + AnyOf []JSONSchemaPropsApplyConfiguration `json:"anyOf,omitempty"` + Not *JSONSchemaPropsApplyConfiguration `json:"not,omitempty"` + Properties map[string]JSONSchemaPropsApplyConfiguration `json:"properties,omitempty"` + AdditionalProperties *apiextensionsv1.JSONSchemaPropsOrBool `json:"additionalProperties,omitempty"` + PatternProperties map[string]JSONSchemaPropsApplyConfiguration `json:"patternProperties,omitempty"` + Dependencies *apiextensionsv1.JSONSchemaDependencies `json:"dependencies,omitempty"` + AdditionalItems *apiextensionsv1.JSONSchemaPropsOrBool `json:"additionalItems,omitempty"` + Definitions *apiextensionsv1.JSONSchemaDefinitions `json:"definitions,omitempty"` + ExternalDocs *ExternalDocumentationApplyConfiguration `json:"externalDocs,omitempty"` + Example *apiextensionsv1.JSON `json:"example,omitempty"` + Nullable *bool `json:"nullable,omitempty"` + // x-kubernetes-preserve-unknown-fields stops the API server + // decoding step from pruning fields which are not specified + // in the validation schema. This affects fields recursively, + // but switches back to normal pruning behaviour if nested + // properties or additionalProperties are specified in the schema. + // This can either be true or undefined. False is forbidden. + XPreserveUnknownFields *bool `json:"x-kubernetes-preserve-unknown-fields,omitempty"` + // x-kubernetes-embedded-resource defines that the value is an + // embedded Kubernetes runtime.Object, with TypeMeta and + // ObjectMeta. The type must be object. It is allowed to further + // restrict the embedded object. kind, apiVersion and metadata + // are validated automatically. x-kubernetes-preserve-unknown-fields + // is allowed to be true, but does not have to be if the object + // is fully specified (up to kind, apiVersion, metadata). + XEmbeddedResource *bool `json:"x-kubernetes-embedded-resource,omitempty"` + // x-kubernetes-int-or-string specifies that this value is + // either an integer or a string. If this is true, an empty + // type is allowed and type as child of anyOf is permitted + // if following one of the following patterns: + // + // 1) anyOf: + // - type: integer + // - type: string + // 2) allOf: + // - anyOf: + // - type: integer + // - type: string + // - ... zero or more + XIntOrString *bool `json:"x-kubernetes-int-or-string,omitempty"` + // x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used + // as the index of the map. + // + // This tag MUST only be used on lists that have the "x-kubernetes-list-type" + // extension set to "map". Also, the values specified for this attribute must + // be a scalar typed field of the child structure (no nesting is supported). + // + // The properties specified must either be required or have a default value, + // to ensure those properties are present for all list items. + XListMapKeys []string `json:"x-kubernetes-list-map-keys,omitempty"` + // x-kubernetes-list-type annotates an array to further describe its topology. + // This extension must only be used on lists and may have 3 possible values: + // + // 1) `atomic`: the list is treated as a single entity, like a scalar. + // Atomic lists will be entirely replaced when updated. This extension + // may be used on any type of list (struct, scalar, ...). + // 2) `set`: + // Sets are lists that must not have multiple items with the same value. Each + // value must be a scalar, an object with x-kubernetes-map-type `atomic` or an + // array with x-kubernetes-list-type `atomic`. + // 3) `map`: + // These lists are like maps in that their elements have a non-index key + // used to identify them. Order is preserved upon merge. The map tag + // must only be used on a list with elements of type object. + // Defaults to atomic for arrays. + XListType *string `json:"x-kubernetes-list-type,omitempty"` + // x-kubernetes-map-type annotates an object to further describe its topology. + // This extension must only be used when type is object and may have 2 possible values: + // + // 1) `granular`: + // These maps are actual maps (key-value pairs) and each fields are independent + // from each other (they can each be manipulated by separate actors). This is + // the default behaviour for all maps. + // 2) `atomic`: the list is treated as a single entity, like a scalar. + // Atomic maps will be entirely replaced when updated. + XMapType *string `json:"x-kubernetes-map-type,omitempty"` + // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. + XValidations *apiextensionsv1.ValidationRules `json:"x-kubernetes-validations,omitempty"` +} + +// JSONSchemaPropsApplyConfiguration constructs a declarative configuration of the JSONSchemaProps type for use with +// apply. +func JSONSchemaProps() *JSONSchemaPropsApplyConfiguration { + return &JSONSchemaPropsApplyConfiguration{} +} + +// WithID sets the ID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ID field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithID(value string) *JSONSchemaPropsApplyConfiguration { + b.ID = &value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithSchema(value apiextensionsv1.JSONSchemaURL) *JSONSchemaPropsApplyConfiguration { + b.Schema = &value + return b +} + +// WithRef sets the Ref field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ref field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithRef(value string) *JSONSchemaPropsApplyConfiguration { + b.Ref = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDescription(value string) *JSONSchemaPropsApplyConfiguration { + b.Description = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithType(value string) *JSONSchemaPropsApplyConfiguration { + b.Type = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithFormat(value string) *JSONSchemaPropsApplyConfiguration { + b.Format = &value + return b +} + +// WithTitle sets the Title field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Title field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithTitle(value string) *JSONSchemaPropsApplyConfiguration { + b.Title = &value + return b +} + +// WithDefault sets the Default field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Default field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDefault(value apiextensionsv1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Default = &value + return b +} + +// WithMaximum sets the Maximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Maximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaximum(value float64) *JSONSchemaPropsApplyConfiguration { + b.Maximum = &value + return b +} + +// WithExclusiveMaximum sets the ExclusiveMaximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMaximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMaximum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMaximum = &value + return b +} + +// WithMinimum sets the Minimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Minimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinimum(value float64) *JSONSchemaPropsApplyConfiguration { + b.Minimum = &value + return b +} + +// WithExclusiveMinimum sets the ExclusiveMinimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMinimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMinimum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMinimum = &value + return b +} + +// WithMaxLength sets the MaxLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxLength = &value + return b +} + +// WithMinLength sets the MinLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinLength = &value + return b +} + +// WithPattern sets the Pattern field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pattern field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithPattern(value string) *JSONSchemaPropsApplyConfiguration { + b.Pattern = &value + return b +} + +// WithMaxItems sets the MaxItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxItems = &value + return b +} + +// WithMinItems sets the MinItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinItems = &value + return b +} + +// WithUniqueItems sets the UniqueItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UniqueItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithUniqueItems(value bool) *JSONSchemaPropsApplyConfiguration { + b.UniqueItems = &value + return b +} + +// WithMultipleOf sets the MultipleOf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MultipleOf field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMultipleOf(value float64) *JSONSchemaPropsApplyConfiguration { + b.MultipleOf = &value + return b +} + +// WithEnum adds the given value to the Enum field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Enum field. +func (b *JSONSchemaPropsApplyConfiguration) WithEnum(values ...apiextensionsv1.JSON) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Enum = append(b.Enum, values[i]) + } + return b +} + +// WithMaxProperties sets the MaxProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxProperties = &value + return b +} + +// WithMinProperties sets the MinProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinProperties = &value + return b +} + +// WithRequired adds the given value to the Required field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Required field. +func (b *JSONSchemaPropsApplyConfiguration) WithRequired(values ...string) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Required = append(b.Required, values[i]) + } + return b +} + +// WithItems sets the Items field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Items field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithItems(value apiextensionsv1.JSONSchemaPropsOrArray) *JSONSchemaPropsApplyConfiguration { + b.Items = &value + return b +} + +// WithAllOf adds the given value to the AllOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AllOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAllOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAllOf") + } + b.AllOf = append(b.AllOf, *values[i]) + } + return b +} + +// WithOneOf adds the given value to the OneOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OneOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithOneOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOneOf") + } + b.OneOf = append(b.OneOf, *values[i]) + } + return b +} + +// WithAnyOf adds the given value to the AnyOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AnyOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAnyOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAnyOf") + } + b.AnyOf = append(b.AnyOf, *values[i]) + } + return b +} + +// WithNot sets the Not field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Not field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithNot(value *JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.Not = value + return b +} + +// WithProperties puts the entries into the Properties field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Properties field, +// overwriting an existing map entries in Properties field with the same key. +func (b *JSONSchemaPropsApplyConfiguration) WithProperties(entries map[string]JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + if b.Properties == nil && len(entries) > 0 { + b.Properties = make(map[string]JSONSchemaPropsApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.Properties[k] = v + } + return b +} + +// WithAdditionalProperties sets the AdditionalProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithAdditionalProperties(value apiextensionsv1.JSONSchemaPropsOrBool) *JSONSchemaPropsApplyConfiguration { + b.AdditionalProperties = &value + return b +} + +// WithPatternProperties puts the entries into the PatternProperties field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the PatternProperties field, +// overwriting an existing map entries in PatternProperties field with the same key. +func (b *JSONSchemaPropsApplyConfiguration) WithPatternProperties(entries map[string]JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + if b.PatternProperties == nil && len(entries) > 0 { + b.PatternProperties = make(map[string]JSONSchemaPropsApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.PatternProperties[k] = v + } + return b +} + +// WithDependencies sets the Dependencies field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Dependencies field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDependencies(value apiextensionsv1.JSONSchemaDependencies) *JSONSchemaPropsApplyConfiguration { + b.Dependencies = &value + return b +} + +// WithAdditionalItems sets the AdditionalItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithAdditionalItems(value apiextensionsv1.JSONSchemaPropsOrBool) *JSONSchemaPropsApplyConfiguration { + b.AdditionalItems = &value + return b +} + +// WithDefinitions sets the Definitions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Definitions field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDefinitions(value apiextensionsv1.JSONSchemaDefinitions) *JSONSchemaPropsApplyConfiguration { + b.Definitions = &value + return b +} + +// WithExternalDocs sets the ExternalDocs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalDocs field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExternalDocs(value *ExternalDocumentationApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.ExternalDocs = value + return b +} + +// WithExample sets the Example field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Example field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExample(value apiextensionsv1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Example = &value + return b +} + +// WithNullable sets the Nullable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Nullable field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithNullable(value bool) *JSONSchemaPropsApplyConfiguration { + b.Nullable = &value + return b +} + +// WithXPreserveUnknownFields sets the XPreserveUnknownFields field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XPreserveUnknownFields field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXPreserveUnknownFields(value bool) *JSONSchemaPropsApplyConfiguration { + b.XPreserveUnknownFields = &value + return b +} + +// WithXEmbeddedResource sets the XEmbeddedResource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XEmbeddedResource field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXEmbeddedResource(value bool) *JSONSchemaPropsApplyConfiguration { + b.XEmbeddedResource = &value + return b +} + +// WithXIntOrString sets the XIntOrString field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XIntOrString field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXIntOrString(value bool) *JSONSchemaPropsApplyConfiguration { + b.XIntOrString = &value + return b +} + +// WithXListMapKeys adds the given value to the XListMapKeys field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the XListMapKeys field. +func (b *JSONSchemaPropsApplyConfiguration) WithXListMapKeys(values ...string) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.XListMapKeys = append(b.XListMapKeys, values[i]) + } + return b +} + +// WithXListType sets the XListType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XListType field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXListType(value string) *JSONSchemaPropsApplyConfiguration { + b.XListType = &value + return b +} + +// WithXMapType sets the XMapType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XMapType field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXMapType(value string) *JSONSchemaPropsApplyConfiguration { + b.XMapType = &value + return b +} + +// WithXValidations sets the XValidations field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XValidations field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXValidations(value apiextensionsv1.ValidationRules) *JSONSchemaPropsApplyConfiguration { + b.XValidations = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/selectablefield.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/selectablefield.go new file mode 100644 index 0000000000..b1edc643fd --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/selectablefield.go @@ -0,0 +1,49 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// SelectableFieldApplyConfiguration represents a declarative configuration of the SelectableField type for use +// with apply. +// +// SelectableField specifies the JSON path of a field that may be used with field selectors. +type SelectableFieldApplyConfiguration struct { + // jsonPath is a simple JSON path which is evaluated against each custom resource to produce a + // field selector value. + // Only JSON paths without the array notation are allowed. + // Must point to a field of type string, boolean or integer. Types with enum values + // and strings with formats are allowed. + // If jsonPath refers to absent field in a resource, the jsonPath evaluates to an empty string. + // Must not point to metdata fields. + // Required. + JSONPath *string `json:"jsonPath,omitempty"` +} + +// SelectableFieldApplyConfiguration constructs a declarative configuration of the SelectableField type for use with +// apply. +func SelectableField() *SelectableFieldApplyConfiguration { + return &SelectableFieldApplyConfiguration{} +} + +// WithJSONPath sets the JSONPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JSONPath field is set to the value of the last call. +func (b *SelectableFieldApplyConfiguration) WithJSONPath(value string) *SelectableFieldApplyConfiguration { + b.JSONPath = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/servicereference.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/servicereference.go new file mode 100644 index 0000000000..215bc3a14e --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/servicereference.go @@ -0,0 +1,76 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ServiceReferenceApplyConfiguration represents a declarative configuration of the ServiceReference type for use +// with apply. +// +// ServiceReference holds a reference to Service.legacy.k8s.io +type ServiceReferenceApplyConfiguration struct { + // namespace is the namespace of the service. + // Required + Namespace *string `json:"namespace,omitempty"` + // name is the name of the service. + // Required + Name *string `json:"name,omitempty"` + // path is an optional URL path at which the webhook will be contacted. + Path *string `json:"path,omitempty"` + // port is an optional service port at which the webhook will be contacted. + // `port` should be a valid port number (1-65535, inclusive). + // Defaults to 443 for backward compatibility. + Port *int32 `json:"port,omitempty"` +} + +// ServiceReferenceApplyConfiguration constructs a declarative configuration of the ServiceReference type for use with +// apply. +func ServiceReference() *ServiceReferenceApplyConfiguration { + return &ServiceReferenceApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithNamespace(value string) *ServiceReferenceApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithName(value string) *ServiceReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPath(value string) *ServiceReferenceApplyConfiguration { + b.Path = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPort(value int32) *ServiceReferenceApplyConfiguration { + b.Port = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/validationrule.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/validationrule.go new file mode 100644 index 0000000000..4f2278bf22 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/validationrule.go @@ -0,0 +1,196 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" +) + +// ValidationRuleApplyConfiguration represents a declarative configuration of the ValidationRule type for use +// with apply. +// +// ValidationRule describes a validation rule written in the CEL expression language. +type ValidationRuleApplyConfiguration struct { + // Rule represents the expression which will be evaluated by CEL. + // ref: https://github.com/google/cel-spec + // The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. + // The `self` variable in the CEL expression is bound to the scoped value. + // Example: + // - Rule scoped to the root of a resource with a status subresource: {"rule": "self.status.actual <= self.spec.maxDesired"} + // + // If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable + // via `self.field` and field presence can be checked via `has(self.field)`. Null valued fields are treated as + // absent fields in CEL expressions. + // If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map + // are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map + // are accessible via CEL macros and functions such as `self.all(...)`. + // If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and + // functions. + // If the Rule is scoped to a scalar, `self` is bound to the scalar value. + // Examples: + // - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"} + // - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"} + // - Rule scoped to a string value: {"rule": "self.startsWith('kube')"} + // + // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the + // object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible. + // + // Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL + // expressions. This includes: + // - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. + // - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as: + // - A schema with no type and x-kubernetes-preserve-unknown-fields set to true + // - An array where the items schema is of an "unknown type" + // - An object where the additionalProperties schema is of an "unknown type" + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Accessible property names are escaped according to the following rules when accessed in the expression: + // - '__' escapes to '__underscores__' + // - '.' escapes to '__dot__' + // - '-' escapes to '__dash__' + // - '/' escapes to '__slash__' + // - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + // "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + // "import", "let", "loop", "package", "namespace", "return". + // Examples: + // - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"} + // - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"} + // - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"} + // + // Equality on arrays with x-kubernetes-list-type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. + // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + // - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + // non-intersecting elements in `Y` are appended, retaining their partial order. + // - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + // non-intersecting keys are appended, retaining their partial order. + // + // If `rule` makes use of the `oldSelf` variable it is implicitly a + // `transition rule`. + // + // By default, the `oldSelf` variable is the same type as `self`. + // When `optionalOldSelf` is true, the `oldSelf` variable is a CEL optional + // variable whose value() is the same type as `self`. + // See the documentation for the `optionalOldSelf` field for details. + // + // Transition rules by default are applied only on UPDATE requests and are + // skipped if an old value could not be found. You can opt a transition + // rule into unconditional evaluation by setting `optionalOldSelf` to true. + Rule *string `json:"rule,omitempty"` + // Message represents the message displayed when validation fails. The message is required if the Rule contains + // line breaks. The message must not contain line breaks. + // If unset, the message is "failed rule: {Rule}". + // e.g. "must be a URL with the host matching spec.host" + Message *string `json:"message,omitempty"` + // MessageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. + // Since messageExpression is used as a failure message, it must evaluate to a string. + // If both message and messageExpression are present on a rule, then messageExpression will be used if validation + // fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced + // as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string + // that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and + // the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. + // messageExpression has access to all the same variables as the rule; the only difference is the return type. + // Example: + // "x must be less than max ("+string(self.max)+")" + MessageExpression *string `json:"messageExpression,omitempty"` + // reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. + // The HTTP status code returned to the caller will match the reason of the reason of the first failed validation rule. + // The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate". + // If not set, default to use "FieldValueInvalid". + // All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid. + Reason *apiextensionsv1.FieldValueErrorReason `json:"reason,omitempty"` + // fieldPath represents the field path returned when the validation fails. + // It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field. + // e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo` + // If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList` + // It does not support list numeric index. + // It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](https://kubernetes.io/docs/reference/kubectl/jsonpath/) for more info. + // Numeric index of array is not supported. + // For field name which contains special characters, use `['specialName']` to refer the field name. + // e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']` + FieldPath *string `json:"fieldPath,omitempty"` + // optionalOldSelf is used to opt a transition rule into evaluation + // even when the object is first created, or if the old object is + // missing the value. + // + // When enabled `oldSelf` will be a CEL optional whose value will be + // `None` if there is no old value, or when the object is initially created. + // + // You may check for presence of oldSelf using `oldSelf.hasValue()` and + // unwrap it after checking using `oldSelf.value()`. Check the CEL + // documentation for Optional types for more information: + // https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes + // + // May not be set unless `oldSelf` is used in `rule`. + OptionalOldSelf *bool `json:"optionalOldSelf,omitempty"` +} + +// ValidationRuleApplyConfiguration constructs a declarative configuration of the ValidationRule type for use with +// apply. +func ValidationRule() *ValidationRuleApplyConfiguration { + return &ValidationRuleApplyConfiguration{} +} + +// WithRule sets the Rule field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rule field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithRule(value string) *ValidationRuleApplyConfiguration { + b.Rule = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessage(value string) *ValidationRuleApplyConfiguration { + b.Message = &value + return b +} + +// WithMessageExpression sets the MessageExpression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MessageExpression field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessageExpression(value string) *ValidationRuleApplyConfiguration { + b.MessageExpression = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithReason(value apiextensionsv1.FieldValueErrorReason) *ValidationRuleApplyConfiguration { + b.Reason = &value + return b +} + +// WithFieldPath sets the FieldPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldPath field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithFieldPath(value string) *ValidationRuleApplyConfiguration { + b.FieldPath = &value + return b +} + +// WithOptionalOldSelf sets the OptionalOldSelf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OptionalOldSelf field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithOptionalOldSelf(value bool) *ValidationRuleApplyConfiguration { + b.OptionalOldSelf = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookclientconfig.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookclientconfig.go new file mode 100644 index 0000000000..c984e1dc8e --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookclientconfig.go @@ -0,0 +1,92 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// WebhookClientConfigApplyConfiguration represents a declarative configuration of the WebhookClientConfig type for use +// with apply. +// +// WebhookClientConfig contains the information to make a TLS connection with the webhook. +type WebhookClientConfigApplyConfiguration struct { + // url gives the location of the webhook, in standard URL form + // (`scheme://host:port/path`). Exactly one of `url` or `service` + // must be specified. + // + // The `host` should not refer to a service running in the cluster; use + // the `service` field instead. The host might be resolved via external + // DNS in some apiservers (e.g., `kube-apiserver` cannot resolve + // in-cluster DNS as that would be a layering violation). `host` may + // also be an IP address. + // + // Please note that using `localhost` or `127.0.0.1` as a `host` is + // risky unless you take great care to run this webhook on all hosts + // which run an apiserver which might need to make calls to this + // webhook. Such installs are likely to be non-portable, i.e., not easy + // to turn up in a new cluster. + // + // The scheme must be "https"; the URL must begin with "https://". + // + // A path is optional, and if present may be any string permissible in + // a URL. You may use the path to pass an arbitrary string to the + // webhook, for example, a cluster identifier. + // + // Attempting to use a user or basic auth e.g. "user:password@" is not + // allowed. Fragments ("#...") and query parameters ("?...") are not + // allowed, either. + URL *string `json:"url,omitempty"` + // service is a reference to the service for this webhook. Either + // service or url must be specified. + // + // If the webhook is running within the cluster, then you should use `service`. + Service *ServiceReferenceApplyConfiguration `json:"service,omitempty"` + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // If unspecified, system trust roots on the apiserver are used. + CABundle []byte `json:"caBundle,omitempty"` +} + +// WebhookClientConfigApplyConfiguration constructs a declarative configuration of the WebhookClientConfig type for use with +// apply. +func WebhookClientConfig() *WebhookClientConfigApplyConfiguration { + return &WebhookClientConfigApplyConfiguration{} +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithURL(value string) *WebhookClientConfigApplyConfiguration { + b.URL = &value + return b +} + +// WithService sets the Service field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Service field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithService(value *ServiceReferenceApplyConfiguration) *WebhookClientConfigApplyConfiguration { + b.Service = value + return b +} + +// WithCABundle adds the given value to the CABundle field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CABundle field. +func (b *WebhookClientConfigApplyConfiguration) WithCABundle(values ...byte) *WebhookClientConfigApplyConfiguration { + for i := range values { + b.CABundle = append(b.CABundle, values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookconversion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookconversion.go new file mode 100644 index 0000000000..6daf74eac0 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1/webhookconversion.go @@ -0,0 +1,59 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// WebhookConversionApplyConfiguration represents a declarative configuration of the WebhookConversion type for use +// with apply. +// +// WebhookConversion describes how to call a conversion webhook +type WebhookConversionApplyConfiguration struct { + // clientConfig is the instructions for how to call the webhook if strategy is `Webhook`. + ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` + // conversionReviewVersions is an ordered list of preferred `ConversionReview` + // versions the Webhook expects. The API server will use the first version in + // the list which it supports. If none of the versions specified in this list + // are supported by API server, conversion will fail for the custom resource. + // If a persisted Webhook configuration specifies allowed versions and does not + // include any versions known to the API Server, calls to the webhook will fail. + ConversionReviewVersions []string `json:"conversionReviewVersions,omitempty"` +} + +// WebhookConversionApplyConfiguration constructs a declarative configuration of the WebhookConversion type for use with +// apply. +func WebhookConversion() *WebhookConversionApplyConfiguration { + return &WebhookConversionApplyConfiguration{} +} + +// WithClientConfig sets the ClientConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClientConfig field is set to the value of the last call. +func (b *WebhookConversionApplyConfiguration) WithClientConfig(value *WebhookClientConfigApplyConfiguration) *WebhookConversionApplyConfiguration { + b.ClientConfig = value + return b +} + +// WithConversionReviewVersions adds the given value to the ConversionReviewVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ConversionReviewVersions field. +func (b *WebhookConversionApplyConfiguration) WithConversionReviewVersions(values ...string) *WebhookConversionApplyConfiguration { + for i := range values { + b.ConversionReviewVersions = append(b.ConversionReviewVersions, values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcecolumndefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcecolumndefinition.go new file mode 100644 index 0000000000..ea6f783bab --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcecolumndefinition.go @@ -0,0 +1,98 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// CustomResourceColumnDefinitionApplyConfiguration represents a declarative configuration of the CustomResourceColumnDefinition type for use +// with apply. +// +// CustomResourceColumnDefinition specifies a column for server side printing. +type CustomResourceColumnDefinitionApplyConfiguration struct { + // name is a human readable name for the column. + Name *string `json:"name,omitempty"` + // type is an OpenAPI type definition for this column. + // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + Type *string `json:"type,omitempty"` + // format is an optional OpenAPI type definition for this column. The 'name' format is applied + // to the primary identifier column to assist in clients identifying column is the resource name. + // See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types for details. + Format *string `json:"format,omitempty"` + // description is a human readable description of this column. + Description *string `json:"description,omitempty"` + // priority is an integer defining the relative importance of this column compared to others. Lower + // numbers are considered higher priority. Columns that may be omitted in limited space scenarios + // should be given a priority greater than 0. + Priority *int32 `json:"priority,omitempty"` + // JSONPath is a simple JSON path (i.e. with array notation) which is evaluated against + // each custom resource to produce the value for this column. + JSONPath *string `json:"JSONPath,omitempty"` +} + +// CustomResourceColumnDefinitionApplyConfiguration constructs a declarative configuration of the CustomResourceColumnDefinition type for use with +// apply. +func CustomResourceColumnDefinition() *CustomResourceColumnDefinitionApplyConfiguration { + return &CustomResourceColumnDefinitionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithName(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Name = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithType(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Type = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithFormat(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Format = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithDescription(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.Description = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithPriority(value int32) *CustomResourceColumnDefinitionApplyConfiguration { + b.Priority = &value + return b +} + +// WithJSONPath sets the JSONPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JSONPath field is set to the value of the last call. +func (b *CustomResourceColumnDefinitionApplyConfiguration) WithJSONPath(value string) *CustomResourceColumnDefinitionApplyConfiguration { + b.JSONPath = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourceconversion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourceconversion.go new file mode 100644 index 0000000000..8cc99f2eb1 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourceconversion.go @@ -0,0 +1,78 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" +) + +// CustomResourceConversionApplyConfiguration represents a declarative configuration of the CustomResourceConversion type for use +// with apply. +// +// CustomResourceConversion describes how to convert different versions of a CR. +type CustomResourceConversionApplyConfiguration struct { + // strategy specifies how custom resources are converted between versions. Allowed values are: + // - `None`: The converter only change the apiVersion and would not touch any other field in the custom resource. + // - `Webhook`: API Server will call to an external webhook to do the conversion. Additional information + // is needed for this option. This requires spec.preserveUnknownFields to be false, and spec.conversion.webhookClientConfig to be set. + Strategy *apiextensionsv1beta1.ConversionStrategyType `json:"strategy,omitempty"` + // webhookClientConfig is the instructions for how to call the webhook if strategy is `Webhook`. + // Required when `strategy` is set to `Webhook`. + WebhookClientConfig *WebhookClientConfigApplyConfiguration `json:"webhookClientConfig,omitempty"` + // conversionReviewVersions is an ordered list of preferred `ConversionReview` + // versions the Webhook expects. The API server will use the first version in + // the list which it supports. If none of the versions specified in this list + // are supported by API server, conversion will fail for the custom resource. + // If a persisted Webhook configuration specifies allowed versions and does not + // include any versions known to the API Server, calls to the webhook will fail. + // Defaults to `["v1beta1"]`. + ConversionReviewVersions []string `json:"conversionReviewVersions,omitempty"` +} + +// CustomResourceConversionApplyConfiguration constructs a declarative configuration of the CustomResourceConversion type for use with +// apply. +func CustomResourceConversion() *CustomResourceConversionApplyConfiguration { + return &CustomResourceConversionApplyConfiguration{} +} + +// WithStrategy sets the Strategy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Strategy field is set to the value of the last call. +func (b *CustomResourceConversionApplyConfiguration) WithStrategy(value apiextensionsv1beta1.ConversionStrategyType) *CustomResourceConversionApplyConfiguration { + b.Strategy = &value + return b +} + +// WithWebhookClientConfig sets the WebhookClientConfig field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WebhookClientConfig field is set to the value of the last call. +func (b *CustomResourceConversionApplyConfiguration) WithWebhookClientConfig(value *WebhookClientConfigApplyConfiguration) *CustomResourceConversionApplyConfiguration { + b.WebhookClientConfig = value + return b +} + +// WithConversionReviewVersions adds the given value to the ConversionReviewVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ConversionReviewVersions field. +func (b *CustomResourceConversionApplyConfiguration) WithConversionReviewVersions(values ...string) *CustomResourceConversionApplyConfiguration { + for i := range values { + b.ConversionReviewVersions = append(b.ConversionReviewVersions, values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go new file mode 100644 index 0000000000..4838dafcb6 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinition.go @@ -0,0 +1,250 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// CustomResourceDefinitionApplyConfiguration represents a declarative configuration of the CustomResourceDefinition type for use +// with apply. +// +// CustomResourceDefinition represents a resource that should be exposed on the API server. Its name MUST be in the format +// <.spec.name>.<.spec.group>. +// Deprecated in v1.16, planned for removal in v1.22. Use apiextensions.k8s.io/v1 CustomResourceDefinition instead. +type CustomResourceDefinitionApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + // Standard object's metadata + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec describes how the user wants the resources to appear + Spec *CustomResourceDefinitionSpecApplyConfiguration `json:"spec,omitempty"` + // status indicates the actual state of the CustomResourceDefinition + Status *CustomResourceDefinitionStatusApplyConfiguration `json:"status,omitempty"` +} + +// CustomResourceDefinition constructs a declarative configuration of the CustomResourceDefinition type for use with +// apply. +func CustomResourceDefinition(name string) *CustomResourceDefinitionApplyConfiguration { + b := &CustomResourceDefinitionApplyConfiguration{} + b.WithName(name) + b.WithKind("CustomResourceDefinition") + b.WithAPIVersion("apiextensions.k8s.io/v1beta1") + return b +} + +func (b CustomResourceDefinitionApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithKind(value string) *CustomResourceDefinitionApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithAPIVersion(value string) *CustomResourceDefinitionApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithName(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithGenerateName(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithNamespace(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithUID(value types.UID) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithResourceVersion(value string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithGeneration(value int64) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithCreationTimestamp(value metav1.Time) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *CustomResourceDefinitionApplyConfiguration) WithLabels(entries map[string]string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *CustomResourceDefinitionApplyConfiguration) WithAnnotations(entries map[string]string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *CustomResourceDefinitionApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *CustomResourceDefinitionApplyConfiguration) WithFinalizers(values ...string) *CustomResourceDefinitionApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *CustomResourceDefinitionApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithSpec(value *CustomResourceDefinitionSpecApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceDefinitionApplyConfiguration) WithStatus(value *CustomResourceDefinitionStatusApplyConfiguration) *CustomResourceDefinitionApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *CustomResourceDefinitionApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitioncondition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitioncondition.go new file mode 100644 index 0000000000..ce0577234c --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitioncondition.go @@ -0,0 +1,100 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// CustomResourceDefinitionConditionApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionCondition type for use +// with apply. +// +// CustomResourceDefinitionCondition contains details for the current condition of this pod. +type CustomResourceDefinitionConditionApplyConfiguration struct { + // type is the type of the condition. Types include Established, NamesAccepted and Terminating. + Type *apiextensionsv1beta1.CustomResourceDefinitionConditionType `json:"type,omitempty"` + // status is the status of the condition. + // Can be True, False, Unknown. + Status *apiextensionsv1beta1.ConditionStatus `json:"status,omitempty"` + // lastTransitionTime last time the condition transitioned from one status to another. + LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` + // reason is a unique, one-word, CamelCase reason for the condition's last transition. + Reason *string `json:"reason,omitempty"` + // message is a human-readable message indicating details about last transition. + Message *string `json:"message,omitempty"` + // observedGeneration represents the .metadata.generation that the condition was set based upon. + // For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + // with respect to the current state of the instance. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` +} + +// CustomResourceDefinitionConditionApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionCondition type for use with +// apply. +func CustomResourceDefinitionCondition() *CustomResourceDefinitionConditionApplyConfiguration { + return &CustomResourceDefinitionConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithType(value apiextensionsv1beta1.CustomResourceDefinitionConditionType) *CustomResourceDefinitionConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithStatus(value apiextensionsv1beta1.ConditionStatus) *CustomResourceDefinitionConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithLastTransitionTime(value v1.Time) *CustomResourceDefinitionConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithReason(value string) *CustomResourceDefinitionConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithMessage(value string) *CustomResourceDefinitionConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *CustomResourceDefinitionConditionApplyConfiguration) WithObservedGeneration(value int64) *CustomResourceDefinitionConditionApplyConfiguration { + b.ObservedGeneration = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionnames.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionnames.go new file mode 100644 index 0000000000..4ad23b7b29 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionnames.go @@ -0,0 +1,104 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// CustomResourceDefinitionNamesApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionNames type for use +// with apply. +// +// CustomResourceDefinitionNames indicates the names to serve this CustomResourceDefinition +type CustomResourceDefinitionNamesApplyConfiguration struct { + // plural is the plural name of the resource to serve. + // The custom resources are served under `/apis///.../`. + // Must match the name of the CustomResourceDefinition (in the form `.`). + // Must be all lowercase. + Plural *string `json:"plural,omitempty"` + // singular is the singular name of the resource. It must be all lowercase. Defaults to lowercased `kind`. + Singular *string `json:"singular,omitempty"` + // shortNames are short names for the resource, exposed in API discovery documents, + // and used by clients to support invocations like `kubectl get `. + // It must be all lowercase. + ShortNames []string `json:"shortNames,omitempty"` + // kind is the serialized kind of the resource. It is normally CamelCase and singular. + // Custom resource instances will use this value as the `kind` attribute in API calls. + Kind *string `json:"kind,omitempty"` + // listKind is the serialized kind of the list for this resource. Defaults to "`kind`List". + ListKind *string `json:"listKind,omitempty"` + // categories is a list of grouped resources this custom resource belongs to (e.g. 'all'). + // This is published in API discovery documents, and used by clients to support invocations like + // `kubectl get all`. + Categories []string `json:"categories,omitempty"` +} + +// CustomResourceDefinitionNamesApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionNames type for use with +// apply. +func CustomResourceDefinitionNames() *CustomResourceDefinitionNamesApplyConfiguration { + return &CustomResourceDefinitionNamesApplyConfiguration{} +} + +// WithPlural sets the Plural field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Plural field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithPlural(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Plural = &value + return b +} + +// WithSingular sets the Singular field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Singular field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithSingular(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Singular = &value + return b +} + +// WithShortNames adds the given value to the ShortNames field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ShortNames field. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithShortNames(values ...string) *CustomResourceDefinitionNamesApplyConfiguration { + for i := range values { + b.ShortNames = append(b.ShortNames, values[i]) + } + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithKind(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.Kind = &value + return b +} + +// WithListKind sets the ListKind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ListKind field is set to the value of the last call. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithListKind(value string) *CustomResourceDefinitionNamesApplyConfiguration { + b.ListKind = &value + return b +} + +// WithCategories adds the given value to the Categories field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Categories field. +func (b *CustomResourceDefinitionNamesApplyConfiguration) WithCategories(values ...string) *CustomResourceDefinitionNamesApplyConfiguration { + for i := range values { + b.Categories = append(b.Categories, values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionspec.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionspec.go new file mode 100644 index 0000000000..12e24ba2fa --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionspec.go @@ -0,0 +1,193 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" +) + +// CustomResourceDefinitionSpecApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionSpec type for use +// with apply. +// +// CustomResourceDefinitionSpec describes how a user wants their resource to appear +type CustomResourceDefinitionSpecApplyConfiguration struct { + // group is the API group of the defined custom resource. + // The custom resources are served under `/apis//...`. + // Must match the name of the CustomResourceDefinition (in the form `.`). + Group *string `json:"group,omitempty"` + // version is the API version of the defined custom resource. + // The custom resources are served under `/apis///...`. + // Must match the name of the first item in the `versions` list if `version` and `versions` are both specified. + // Optional if `versions` is specified. + // Deprecated: use `versions` instead. + Version *string `json:"version,omitempty"` + // names specify the resource and kind names for the custom resource. + Names *CustomResourceDefinitionNamesApplyConfiguration `json:"names,omitempty"` + // scope indicates whether the defined custom resource is cluster- or namespace-scoped. + // Allowed values are `Cluster` and `Namespaced`. Default is `Namespaced`. + Scope *apiextensionsv1beta1.ResourceScope `json:"scope,omitempty"` + // validation describes the schema used for validation and pruning of the custom resource. + // If present, this validation schema is used to validate all versions. + // Top-level and per-version schemas are mutually exclusive. + Validation *CustomResourceValidationApplyConfiguration `json:"validation,omitempty"` + // subresources specify what subresources the defined custom resource has. + // If present, this field configures subresources for all versions. + // Top-level and per-version subresources are mutually exclusive. + Subresources *CustomResourceSubresourcesApplyConfiguration `json:"subresources,omitempty"` + // versions is the list of all API versions of the defined custom resource. + // Optional if `version` is specified. + // The name of the first item in the `versions` list must match the `version` field if `version` and `versions` are both specified. + // Version names are used to compute the order in which served versions are listed in API discovery. + // If the version string is "kube-like", it will sort above non "kube-like" version strings, which are ordered + // lexicographically. "Kube-like" versions start with a "v", then are followed by a number (the major version), + // then optionally the string "alpha" or "beta" and another number (the minor version). These are sorted first + // by GA > beta > alpha (where GA is a version with no suffix such as beta or alpha), and then by comparing + // major version, then minor version. An example sorted list of versions: + // v10, v2, v1, v11beta2, v10beta3, v3beta1, v12alpha1, v11alpha2, foo1, foo10. + Versions []CustomResourceDefinitionVersionApplyConfiguration `json:"versions,omitempty"` + // additionalPrinterColumns specifies additional columns returned in Table output. + // See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. + // If present, this field configures columns for all versions. + // Top-level and per-version columns are mutually exclusive. + // If no top-level or per-version columns are specified, a single column displaying the age of the custom resource is used. + AdditionalPrinterColumns []CustomResourceColumnDefinitionApplyConfiguration `json:"additionalPrinterColumns,omitempty"` + // selectableFields specifies paths to fields that may be used as field selectors. + // See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors + SelectableFields []SelectableFieldApplyConfiguration `json:"selectableFields,omitempty"` + // conversion defines conversion settings for the CRD. + Conversion *CustomResourceConversionApplyConfiguration `json:"conversion,omitempty"` + // preserveUnknownFields indicates that object fields which are not specified + // in the OpenAPI schema should be preserved when persisting to storage. + // apiVersion, kind, metadata and known fields inside metadata are always preserved. + // If false, schemas must be defined for all versions. + // Defaults to true in v1beta for backwards compatibility. + // Deprecated: will be required to be false in v1. Preservation of unknown fields can be specified + // in the validation schema using the `x-kubernetes-preserve-unknown-fields: true` extension. + // See https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#field-pruning for details. + PreserveUnknownFields *bool `json:"preserveUnknownFields,omitempty"` +} + +// CustomResourceDefinitionSpecApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionSpec type for use with +// apply. +func CustomResourceDefinitionSpec() *CustomResourceDefinitionSpecApplyConfiguration { + return &CustomResourceDefinitionSpecApplyConfiguration{} +} + +// WithGroup sets the Group field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Group field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithGroup(value string) *CustomResourceDefinitionSpecApplyConfiguration { + b.Group = &value + return b +} + +// WithVersion sets the Version field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Version field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithVersion(value string) *CustomResourceDefinitionSpecApplyConfiguration { + b.Version = &value + return b +} + +// WithNames sets the Names field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Names field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithNames(value *CustomResourceDefinitionNamesApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Names = value + return b +} + +// WithScope sets the Scope field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scope field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithScope(value apiextensionsv1beta1.ResourceScope) *CustomResourceDefinitionSpecApplyConfiguration { + b.Scope = &value + return b +} + +// WithValidation sets the Validation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Validation field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithValidation(value *CustomResourceValidationApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Validation = value + return b +} + +// WithSubresources sets the Subresources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subresources field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithSubresources(value *CustomResourceSubresourcesApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Subresources = value + return b +} + +// WithVersions adds the given value to the Versions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Versions field. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithVersions(values ...*CustomResourceDefinitionVersionApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVersions") + } + b.Versions = append(b.Versions, *values[i]) + } + return b +} + +// WithAdditionalPrinterColumns adds the given value to the AdditionalPrinterColumns field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AdditionalPrinterColumns field. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithAdditionalPrinterColumns(values ...*CustomResourceColumnDefinitionApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAdditionalPrinterColumns") + } + b.AdditionalPrinterColumns = append(b.AdditionalPrinterColumns, *values[i]) + } + return b +} + +// WithSelectableFields adds the given value to the SelectableFields field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SelectableFields field. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithSelectableFields(values ...*SelectableFieldApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSelectableFields") + } + b.SelectableFields = append(b.SelectableFields, *values[i]) + } + return b +} + +// WithConversion sets the Conversion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conversion field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithConversion(value *CustomResourceConversionApplyConfiguration) *CustomResourceDefinitionSpecApplyConfiguration { + b.Conversion = value + return b +} + +// WithPreserveUnknownFields sets the PreserveUnknownFields field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreserveUnknownFields field is set to the value of the last call. +func (b *CustomResourceDefinitionSpecApplyConfiguration) WithPreserveUnknownFields(value bool) *CustomResourceDefinitionSpecApplyConfiguration { + b.PreserveUnknownFields = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionstatus.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionstatus.go new file mode 100644 index 0000000000..e0107b3a78 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionstatus.go @@ -0,0 +1,85 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// CustomResourceDefinitionStatusApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionStatus type for use +// with apply. +// +// CustomResourceDefinitionStatus indicates the state of the CustomResourceDefinition +type CustomResourceDefinitionStatusApplyConfiguration struct { + // conditions indicate state for particular aspects of a CustomResourceDefinition + Conditions []CustomResourceDefinitionConditionApplyConfiguration `json:"conditions,omitempty"` + // acceptedNames are the names that are actually being used to serve discovery. + // They may be different than the names in spec. + AcceptedNames *CustomResourceDefinitionNamesApplyConfiguration `json:"acceptedNames,omitempty"` + // storedVersions lists all versions of CustomResources that were ever persisted. Tracking these + // versions allows a migration path for stored versions in etcd. The field is mutable + // so a migration controller can finish a migration to another version (ensuring + // no old objects are left in storage), and then remove the rest of the + // versions from this list. + // Versions may not be removed from `spec.versions` while they exist in this list. + StoredVersions []string `json:"storedVersions,omitempty"` + // The generation observed by the CRD controller. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` +} + +// CustomResourceDefinitionStatusApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionStatus type for use with +// apply. +func CustomResourceDefinitionStatus() *CustomResourceDefinitionStatusApplyConfiguration { + return &CustomResourceDefinitionStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithConditions(values ...*CustomResourceDefinitionConditionApplyConfiguration) *CustomResourceDefinitionStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAcceptedNames sets the AcceptedNames field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AcceptedNames field is set to the value of the last call. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithAcceptedNames(value *CustomResourceDefinitionNamesApplyConfiguration) *CustomResourceDefinitionStatusApplyConfiguration { + b.AcceptedNames = value + return b +} + +// WithStoredVersions adds the given value to the StoredVersions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the StoredVersions field. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithStoredVersions(values ...string) *CustomResourceDefinitionStatusApplyConfiguration { + for i := range values { + b.StoredVersions = append(b.StoredVersions, values[i]) + } + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *CustomResourceDefinitionStatusApplyConfiguration) WithObservedGeneration(value int64) *CustomResourceDefinitionStatusApplyConfiguration { + b.ObservedGeneration = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionversion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionversion.go new file mode 100644 index 0000000000..f26bfd4a66 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcedefinitionversion.go @@ -0,0 +1,148 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// CustomResourceDefinitionVersionApplyConfiguration represents a declarative configuration of the CustomResourceDefinitionVersion type for use +// with apply. +// +// CustomResourceDefinitionVersion describes a version for CRD. +type CustomResourceDefinitionVersionApplyConfiguration struct { + // name is the version name, e.g. “v1”, “v2beta1”, etc. + // The custom resources are served under this version at `/apis///...` if `served` is true. + Name *string `json:"name,omitempty"` + // served is a flag enabling/disabling this version from being served via REST APIs + Served *bool `json:"served,omitempty"` + // storage indicates this version should be used when persisting custom resources to storage. + // There must be exactly one version with storage=true. + Storage *bool `json:"storage,omitempty"` + // deprecated indicates this version of the custom resource API is deprecated. + // When set to true, API requests to this version receive a warning header in the server response. + // Defaults to false. + Deprecated *bool `json:"deprecated,omitempty"` + // deprecationWarning overrides the default warning returned to API clients. + // May only be set when `deprecated` is true. + // The default warning indicates this version is deprecated and recommends use + // of the newest served version of equal or greater stability, if one exists. + DeprecationWarning *string `json:"deprecationWarning,omitempty"` + // schema describes the schema used for validation and pruning of this version of the custom resource. + // Top-level and per-version schemas are mutually exclusive. + // Per-version schemas must not all be set to identical values (top-level validation schema should be used instead). + Schema *CustomResourceValidationApplyConfiguration `json:"schema,omitempty"` + // subresources specify what subresources this version of the defined custom resource have. + // Top-level and per-version subresources are mutually exclusive. + // Per-version subresources must not all be set to identical values (top-level subresources should be used instead). + Subresources *CustomResourceSubresourcesApplyConfiguration `json:"subresources,omitempty"` + // additionalPrinterColumns specifies additional columns returned in Table output. + // See https://kubernetes.io/docs/reference/using-api/api-concepts/#receiving-resources-as-tables for details. + // Top-level and per-version columns are mutually exclusive. + // Per-version columns must not all be set to identical values (top-level columns should be used instead). + // If no top-level or per-version columns are specified, a single column displaying the age of the custom resource is used. + AdditionalPrinterColumns []CustomResourceColumnDefinitionApplyConfiguration `json:"additionalPrinterColumns,omitempty"` + // selectableFields specifies paths to fields that may be used as field selectors. + // See https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors + SelectableFields []SelectableFieldApplyConfiguration `json:"selectableFields,omitempty"` +} + +// CustomResourceDefinitionVersionApplyConfiguration constructs a declarative configuration of the CustomResourceDefinitionVersion type for use with +// apply. +func CustomResourceDefinitionVersion() *CustomResourceDefinitionVersionApplyConfiguration { + return &CustomResourceDefinitionVersionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithName(value string) *CustomResourceDefinitionVersionApplyConfiguration { + b.Name = &value + return b +} + +// WithServed sets the Served field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Served field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithServed(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Served = &value + return b +} + +// WithStorage sets the Storage field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Storage field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithStorage(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Storage = &value + return b +} + +// WithDeprecated sets the Deprecated field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Deprecated field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithDeprecated(value bool) *CustomResourceDefinitionVersionApplyConfiguration { + b.Deprecated = &value + return b +} + +// WithDeprecationWarning sets the DeprecationWarning field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeprecationWarning field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithDeprecationWarning(value string) *CustomResourceDefinitionVersionApplyConfiguration { + b.DeprecationWarning = &value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSchema(value *CustomResourceValidationApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + b.Schema = value + return b +} + +// WithSubresources sets the Subresources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subresources field is set to the value of the last call. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSubresources(value *CustomResourceSubresourcesApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + b.Subresources = value + return b +} + +// WithAdditionalPrinterColumns adds the given value to the AdditionalPrinterColumns field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AdditionalPrinterColumns field. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithAdditionalPrinterColumns(values ...*CustomResourceColumnDefinitionApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAdditionalPrinterColumns") + } + b.AdditionalPrinterColumns = append(b.AdditionalPrinterColumns, *values[i]) + } + return b +} + +// WithSelectableFields adds the given value to the SelectableFields field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SelectableFields field. +func (b *CustomResourceDefinitionVersionApplyConfiguration) WithSelectableFields(values ...*SelectableFieldApplyConfiguration) *CustomResourceDefinitionVersionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithSelectableFields") + } + b.SelectableFields = append(b.SelectableFields, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresources.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresources.go new file mode 100644 index 0000000000..6b92eb1fcd --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresources.go @@ -0,0 +1,59 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" +) + +// CustomResourceSubresourcesApplyConfiguration represents a declarative configuration of the CustomResourceSubresources type for use +// with apply. +// +// CustomResourceSubresources defines the status and scale subresources for CustomResources. +type CustomResourceSubresourcesApplyConfiguration struct { + // status indicates the custom resource should serve a `/status` subresource. + // When enabled: + // 1. requests to the custom resource primary endpoint ignore changes to the `status` stanza of the object. + // 2. requests to the custom resource `/status` subresource ignore changes to anything other than the `status` stanza of the object. + Status *apiextensionsv1beta1.CustomResourceSubresourceStatus `json:"status,omitempty"` + // scale indicates the custom resource should serve a `/scale` subresource that returns an `autoscaling/v1` Scale object. + Scale *CustomResourceSubresourceScaleApplyConfiguration `json:"scale,omitempty"` +} + +// CustomResourceSubresourcesApplyConfiguration constructs a declarative configuration of the CustomResourceSubresources type for use with +// apply. +func CustomResourceSubresources() *CustomResourceSubresourcesApplyConfiguration { + return &CustomResourceSubresourcesApplyConfiguration{} +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *CustomResourceSubresourcesApplyConfiguration) WithStatus(value apiextensionsv1beta1.CustomResourceSubresourceStatus) *CustomResourceSubresourcesApplyConfiguration { + b.Status = &value + return b +} + +// WithScale sets the Scale field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Scale field is set to the value of the last call. +func (b *CustomResourceSubresourcesApplyConfiguration) WithScale(value *CustomResourceSubresourceScaleApplyConfiguration) *CustomResourceSubresourcesApplyConfiguration { + b.Scale = value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresourcescale.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresourcescale.go new file mode 100644 index 0000000000..4141699c4d --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcesubresourcescale.go @@ -0,0 +1,77 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// CustomResourceSubresourceScaleApplyConfiguration represents a declarative configuration of the CustomResourceSubresourceScale type for use +// with apply. +// +// CustomResourceSubresourceScale defines how to serve the scale subresource for CustomResources. +type CustomResourceSubresourceScaleApplyConfiguration struct { + // specReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `spec.replicas`. + // Only JSON paths without the array notation are allowed. + // Must be a JSON Path under `.spec`. + // If there is no value under the given path in the custom resource, the `/scale` subresource will return an error on GET. + SpecReplicasPath *string `json:"specReplicasPath,omitempty"` + // statusReplicasPath defines the JSON path inside of a custom resource that corresponds to Scale `status.replicas`. + // Only JSON paths without the array notation are allowed. + // Must be a JSON Path under `.status`. + // If there is no value under the given path in the custom resource, the `status.replicas` value in the `/scale` subresource + // will default to 0. + StatusReplicasPath *string `json:"statusReplicasPath,omitempty"` + // labelSelectorPath defines the JSON path inside of a custom resource that corresponds to Scale `status.selector`. + // Only JSON paths without the array notation are allowed. + // Must be a JSON Path under `.status` or `.spec`. + // Must be set to work with HorizontalPodAutoscaler. + // The field pointed by this JSON path must be a string field (not a complex selector struct) + // which contains a serialized label selector in string form. + // More info: https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions#scale-subresource + // If there is no value under the given path in the custom resource, the `status.selector` value in the `/scale` + // subresource will default to the empty string. + LabelSelectorPath *string `json:"labelSelectorPath,omitempty"` +} + +// CustomResourceSubresourceScaleApplyConfiguration constructs a declarative configuration of the CustomResourceSubresourceScale type for use with +// apply. +func CustomResourceSubresourceScale() *CustomResourceSubresourceScaleApplyConfiguration { + return &CustomResourceSubresourceScaleApplyConfiguration{} +} + +// WithSpecReplicasPath sets the SpecReplicasPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SpecReplicasPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithSpecReplicasPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.SpecReplicasPath = &value + return b +} + +// WithStatusReplicasPath sets the StatusReplicasPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the StatusReplicasPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithStatusReplicasPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.StatusReplicasPath = &value + return b +} + +// WithLabelSelectorPath sets the LabelSelectorPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LabelSelectorPath field is set to the value of the last call. +func (b *CustomResourceSubresourceScaleApplyConfiguration) WithLabelSelectorPath(value string) *CustomResourceSubresourceScaleApplyConfiguration { + b.LabelSelectorPath = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcevalidation.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcevalidation.go new file mode 100644 index 0000000000..64007c709a --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/customresourcevalidation.go @@ -0,0 +1,42 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// CustomResourceValidationApplyConfiguration represents a declarative configuration of the CustomResourceValidation type for use +// with apply. +// +// CustomResourceValidation is a list of validation methods for CustomResources. +type CustomResourceValidationApplyConfiguration struct { + // openAPIV3Schema is the OpenAPI v3 schema to use for validation and pruning. + OpenAPIV3Schema *JSONSchemaPropsApplyConfiguration `json:"openAPIV3Schema,omitempty"` +} + +// CustomResourceValidationApplyConfiguration constructs a declarative configuration of the CustomResourceValidation type for use with +// apply. +func CustomResourceValidation() *CustomResourceValidationApplyConfiguration { + return &CustomResourceValidationApplyConfiguration{} +} + +// WithOpenAPIV3Schema sets the OpenAPIV3Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OpenAPIV3Schema field is set to the value of the last call. +func (b *CustomResourceValidationApplyConfiguration) WithOpenAPIV3Schema(value *JSONSchemaPropsApplyConfiguration) *CustomResourceValidationApplyConfiguration { + b.OpenAPIV3Schema = value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/externaldocumentation.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/externaldocumentation.go new file mode 100644 index 0000000000..42f7ace15f --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/externaldocumentation.go @@ -0,0 +1,50 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// ExternalDocumentationApplyConfiguration represents a declarative configuration of the ExternalDocumentation type for use +// with apply. +// +// ExternalDocumentation allows referencing an external resource for extended documentation. +type ExternalDocumentationApplyConfiguration struct { + Description *string `json:"description,omitempty"` + URL *string `json:"url,omitempty"` +} + +// ExternalDocumentationApplyConfiguration constructs a declarative configuration of the ExternalDocumentation type for use with +// apply. +func ExternalDocumentation() *ExternalDocumentationApplyConfiguration { + return &ExternalDocumentationApplyConfiguration{} +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *ExternalDocumentationApplyConfiguration) WithDescription(value string) *ExternalDocumentationApplyConfiguration { + b.Description = &value + return b +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *ExternalDocumentationApplyConfiguration) WithURL(value string) *ExternalDocumentationApplyConfiguration { + b.URL = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/jsonschemaprops.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/jsonschemaprops.go new file mode 100644 index 0000000000..4997d47e60 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/jsonschemaprops.go @@ -0,0 +1,554 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" +) + +// JSONSchemaPropsApplyConfiguration represents a declarative configuration of the JSONSchemaProps type for use +// with apply. +// +// JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/). +type JSONSchemaPropsApplyConfiguration struct { + ID *string `json:"id,omitempty"` + Schema *apiextensionsv1beta1.JSONSchemaURL `json:"$schema,omitempty"` + Ref *string `json:"$ref,omitempty"` + Description *string `json:"description,omitempty"` + Type *string `json:"type,omitempty"` + // format is an OpenAPI v3 format string. Unknown formats are ignored. The following formats are validated: + // + // - bsonobjectid: a bson object ID, i.e. a 24 characters hex string + // - uri: an URI as parsed by Golang net/url.ParseRequestURI + // - email: an email address as parsed by Golang net/mail.ParseAddress + // - hostname: a valid representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. + // - ipv4: an IPv4 IP as parsed by Golang net.ParseIP + // - ipv6: an IPv6 IP as parsed by Golang net.ParseIP + // - cidr: a CIDR as parsed by Golang net.ParseCIDR + // - mac: a MAC address as parsed by Golang net.ParseMAC + // - uuid: an UUID that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + // - uuid3: an UUID3 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?3[0-9a-f]{3}-?[0-9a-f]{4}-?[0-9a-f]{12}$ + // - uuid4: an UUID4 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + // - uuid5: an UUID5 that allows uppercase defined by the regex (?i)^[0-9a-f]{8}-?[0-9a-f]{4}-?5[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$ + // - isbn: an ISBN10 or ISBN13 number string like "0321751043" or "978-0321751041" + // - isbn10: an ISBN10 number string like "0321751043" + // - isbn13: an ISBN13 number string like "978-0321751041" + // - creditcard: a credit card number defined by the regex ^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$ with any non digit characters mixed in + // - ssn: a U.S. social security number following the regex ^\\d{3}[- ]?\\d{2}[- ]?\\d{4}$ + // - hexcolor: an hexadecimal color code like "#FFFFFF: following the regex ^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$ + // - rgbcolor: an RGB color code like rgb like "rgb(255,255,2559" + // - byte: base64 encoded binary data + // - password: any kind of string + // - date: a date string like "2006-01-02" as defined by full-date in RFC3339 + // - duration: a duration string like "22 ns" as parsed by Golang time.ParseDuration or compatible with Scala duration format + // - datetime: a date time string like "2014-12-15T19:30:20.000Z" as defined by date-time in RFC3339. + Format *string `json:"format,omitempty"` + Title *string `json:"title,omitempty"` + // default is a default value for undefined object fields. + // Defaulting is a beta feature under the CustomResourceDefaulting feature gate. + // CustomResourceDefinitions with defaults must be created using the v1 (or newer) CustomResourceDefinition API. + Default *apiextensionsv1beta1.JSON `json:"default,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` + ExclusiveMaximum *bool `json:"exclusiveMaximum,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + ExclusiveMinimum *bool `json:"exclusiveMinimum,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Pattern *string `json:"pattern,omitempty"` + MaxItems *int64 `json:"maxItems,omitempty"` + MinItems *int64 `json:"minItems,omitempty"` + UniqueItems *bool `json:"uniqueItems,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty"` + Enum []apiextensionsv1beta1.JSON `json:"enum,omitempty"` + MaxProperties *int64 `json:"maxProperties,omitempty"` + MinProperties *int64 `json:"minProperties,omitempty"` + Required []string `json:"required,omitempty"` + Items *apiextensionsv1beta1.JSONSchemaPropsOrArray `json:"items,omitempty"` + AllOf []JSONSchemaPropsApplyConfiguration `json:"allOf,omitempty"` + OneOf []JSONSchemaPropsApplyConfiguration `json:"oneOf,omitempty"` + AnyOf []JSONSchemaPropsApplyConfiguration `json:"anyOf,omitempty"` + Not *JSONSchemaPropsApplyConfiguration `json:"not,omitempty"` + Properties map[string]JSONSchemaPropsApplyConfiguration `json:"properties,omitempty"` + AdditionalProperties *apiextensionsv1beta1.JSONSchemaPropsOrBool `json:"additionalProperties,omitempty"` + PatternProperties map[string]JSONSchemaPropsApplyConfiguration `json:"patternProperties,omitempty"` + Dependencies *apiextensionsv1beta1.JSONSchemaDependencies `json:"dependencies,omitempty"` + AdditionalItems *apiextensionsv1beta1.JSONSchemaPropsOrBool `json:"additionalItems,omitempty"` + Definitions *apiextensionsv1beta1.JSONSchemaDefinitions `json:"definitions,omitempty"` + ExternalDocs *ExternalDocumentationApplyConfiguration `json:"externalDocs,omitempty"` + Example *apiextensionsv1beta1.JSON `json:"example,omitempty"` + Nullable *bool `json:"nullable,omitempty"` + // x-kubernetes-preserve-unknown-fields stops the API server + // decoding step from pruning fields which are not specified + // in the validation schema. This affects fields recursively, + // but switches back to normal pruning behaviour if nested + // properties or additionalProperties are specified in the schema. + // This can either be true or undefined. False is forbidden. + XPreserveUnknownFields *bool `json:"x-kubernetes-preserve-unknown-fields,omitempty"` + // x-kubernetes-embedded-resource defines that the value is an + // embedded Kubernetes runtime.Object, with TypeMeta and + // ObjectMeta. The type must be object. It is allowed to further + // restrict the embedded object. kind, apiVersion and metadata + // are validated automatically. x-kubernetes-preserve-unknown-fields + // is allowed to be true, but does not have to be if the object + // is fully specified (up to kind, apiVersion, metadata). + XEmbeddedResource *bool `json:"x-kubernetes-embedded-resource,omitempty"` + // x-kubernetes-int-or-string specifies that this value is + // either an integer or a string. If this is true, an empty + // type is allowed and type as child of anyOf is permitted + // if following one of the following patterns: + // + // 1) anyOf: + // - type: integer + // - type: string + // 2) allOf: + // - anyOf: + // - type: integer + // - type: string + // - ... zero or more + XIntOrString *bool `json:"x-kubernetes-int-or-string,omitempty"` + // x-kubernetes-list-map-keys annotates an array with the x-kubernetes-list-type `map` by specifying the keys used + // as the index of the map. + // + // This tag MUST only be used on lists that have the "x-kubernetes-list-type" + // extension set to "map". Also, the values specified for this attribute must + // be a scalar typed field of the child structure (no nesting is supported). + // + // The properties specified must either be required or have a default value, + // to ensure those properties are present for all list items. + XListMapKeys []string `json:"x-kubernetes-list-map-keys,omitempty"` + // x-kubernetes-list-type annotates an array to further describe its topology. + // This extension must only be used on lists and may have 3 possible values: + // + // 1) `atomic`: the list is treated as a single entity, like a scalar. + // Atomic lists will be entirely replaced when updated. This extension + // may be used on any type of list (struct, scalar, ...). + // 2) `set`: + // Sets are lists that must not have multiple items with the same value. Each + // value must be a scalar, an object with x-kubernetes-map-type `atomic` or an + // array with x-kubernetes-list-type `atomic`. + // 3) `map`: + // These lists are like maps in that their elements have a non-index key + // used to identify them. Order is preserved upon merge. The map tag + // must only be used on a list with elements of type object. + // Defaults to atomic for arrays. + XListType *string `json:"x-kubernetes-list-type,omitempty"` + // x-kubernetes-map-type annotates an object to further describe its topology. + // This extension must only be used when type is object and may have 2 possible values: + // + // 1) `granular`: + // These maps are actual maps (key-value pairs) and each fields are independent + // from each other (they can each be manipulated by separate actors). This is + // the default behaviour for all maps. + // 2) `atomic`: the list is treated as a single entity, like a scalar. + // Atomic maps will be entirely replaced when updated. + XMapType *string `json:"x-kubernetes-map-type,omitempty"` + // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. + XValidations *apiextensionsv1beta1.ValidationRules `json:"x-kubernetes-validations,omitempty"` +} + +// JSONSchemaPropsApplyConfiguration constructs a declarative configuration of the JSONSchemaProps type for use with +// apply. +func JSONSchemaProps() *JSONSchemaPropsApplyConfiguration { + return &JSONSchemaPropsApplyConfiguration{} +} + +// WithID sets the ID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ID field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithID(value string) *JSONSchemaPropsApplyConfiguration { + b.ID = &value + return b +} + +// WithSchema sets the Schema field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Schema field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithSchema(value apiextensionsv1beta1.JSONSchemaURL) *JSONSchemaPropsApplyConfiguration { + b.Schema = &value + return b +} + +// WithRef sets the Ref field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ref field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithRef(value string) *JSONSchemaPropsApplyConfiguration { + b.Ref = &value + return b +} + +// WithDescription sets the Description field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Description field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDescription(value string) *JSONSchemaPropsApplyConfiguration { + b.Description = &value + return b +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithType(value string) *JSONSchemaPropsApplyConfiguration { + b.Type = &value + return b +} + +// WithFormat sets the Format field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Format field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithFormat(value string) *JSONSchemaPropsApplyConfiguration { + b.Format = &value + return b +} + +// WithTitle sets the Title field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Title field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithTitle(value string) *JSONSchemaPropsApplyConfiguration { + b.Title = &value + return b +} + +// WithDefault sets the Default field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Default field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDefault(value apiextensionsv1beta1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Default = &value + return b +} + +// WithMaximum sets the Maximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Maximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaximum(value float64) *JSONSchemaPropsApplyConfiguration { + b.Maximum = &value + return b +} + +// WithExclusiveMaximum sets the ExclusiveMaximum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMaximum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMaximum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMaximum = &value + return b +} + +// WithMinimum sets the Minimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Minimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinimum(value float64) *JSONSchemaPropsApplyConfiguration { + b.Minimum = &value + return b +} + +// WithExclusiveMinimum sets the ExclusiveMinimum field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExclusiveMinimum field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExclusiveMinimum(value bool) *JSONSchemaPropsApplyConfiguration { + b.ExclusiveMinimum = &value + return b +} + +// WithMaxLength sets the MaxLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxLength = &value + return b +} + +// WithMinLength sets the MinLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinLength field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinLength(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinLength = &value + return b +} + +// WithPattern sets the Pattern field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pattern field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithPattern(value string) *JSONSchemaPropsApplyConfiguration { + b.Pattern = &value + return b +} + +// WithMaxItems sets the MaxItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxItems = &value + return b +} + +// WithMinItems sets the MinItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinItems(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinItems = &value + return b +} + +// WithUniqueItems sets the UniqueItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UniqueItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithUniqueItems(value bool) *JSONSchemaPropsApplyConfiguration { + b.UniqueItems = &value + return b +} + +// WithMultipleOf sets the MultipleOf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MultipleOf field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMultipleOf(value float64) *JSONSchemaPropsApplyConfiguration { + b.MultipleOf = &value + return b +} + +// WithEnum adds the given value to the Enum field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Enum field. +func (b *JSONSchemaPropsApplyConfiguration) WithEnum(values ...apiextensionsv1beta1.JSON) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Enum = append(b.Enum, values[i]) + } + return b +} + +// WithMaxProperties sets the MaxProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MaxProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMaxProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MaxProperties = &value + return b +} + +// WithMinProperties sets the MinProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MinProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithMinProperties(value int64) *JSONSchemaPropsApplyConfiguration { + b.MinProperties = &value + return b +} + +// WithRequired adds the given value to the Required field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Required field. +func (b *JSONSchemaPropsApplyConfiguration) WithRequired(values ...string) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.Required = append(b.Required, values[i]) + } + return b +} + +// WithItems sets the Items field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Items field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithItems(value apiextensionsv1beta1.JSONSchemaPropsOrArray) *JSONSchemaPropsApplyConfiguration { + b.Items = &value + return b +} + +// WithAllOf adds the given value to the AllOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AllOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAllOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAllOf") + } + b.AllOf = append(b.AllOf, *values[i]) + } + return b +} + +// WithOneOf adds the given value to the OneOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OneOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithOneOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOneOf") + } + b.OneOf = append(b.OneOf, *values[i]) + } + return b +} + +// WithAnyOf adds the given value to the AnyOf field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AnyOf field. +func (b *JSONSchemaPropsApplyConfiguration) WithAnyOf(values ...*JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAnyOf") + } + b.AnyOf = append(b.AnyOf, *values[i]) + } + return b +} + +// WithNot sets the Not field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Not field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithNot(value *JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.Not = value + return b +} + +// WithProperties puts the entries into the Properties field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Properties field, +// overwriting an existing map entries in Properties field with the same key. +func (b *JSONSchemaPropsApplyConfiguration) WithProperties(entries map[string]JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + if b.Properties == nil && len(entries) > 0 { + b.Properties = make(map[string]JSONSchemaPropsApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.Properties[k] = v + } + return b +} + +// WithAdditionalProperties sets the AdditionalProperties field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalProperties field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithAdditionalProperties(value apiextensionsv1beta1.JSONSchemaPropsOrBool) *JSONSchemaPropsApplyConfiguration { + b.AdditionalProperties = &value + return b +} + +// WithPatternProperties puts the entries into the PatternProperties field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the PatternProperties field, +// overwriting an existing map entries in PatternProperties field with the same key. +func (b *JSONSchemaPropsApplyConfiguration) WithPatternProperties(entries map[string]JSONSchemaPropsApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + if b.PatternProperties == nil && len(entries) > 0 { + b.PatternProperties = make(map[string]JSONSchemaPropsApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.PatternProperties[k] = v + } + return b +} + +// WithDependencies sets the Dependencies field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Dependencies field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDependencies(value apiextensionsv1beta1.JSONSchemaDependencies) *JSONSchemaPropsApplyConfiguration { + b.Dependencies = &value + return b +} + +// WithAdditionalItems sets the AdditionalItems field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AdditionalItems field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithAdditionalItems(value apiextensionsv1beta1.JSONSchemaPropsOrBool) *JSONSchemaPropsApplyConfiguration { + b.AdditionalItems = &value + return b +} + +// WithDefinitions sets the Definitions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Definitions field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithDefinitions(value apiextensionsv1beta1.JSONSchemaDefinitions) *JSONSchemaPropsApplyConfiguration { + b.Definitions = &value + return b +} + +// WithExternalDocs sets the ExternalDocs field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExternalDocs field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExternalDocs(value *ExternalDocumentationApplyConfiguration) *JSONSchemaPropsApplyConfiguration { + b.ExternalDocs = value + return b +} + +// WithExample sets the Example field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Example field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithExample(value apiextensionsv1beta1.JSON) *JSONSchemaPropsApplyConfiguration { + b.Example = &value + return b +} + +// WithNullable sets the Nullable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Nullable field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithNullable(value bool) *JSONSchemaPropsApplyConfiguration { + b.Nullable = &value + return b +} + +// WithXPreserveUnknownFields sets the XPreserveUnknownFields field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XPreserveUnknownFields field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXPreserveUnknownFields(value bool) *JSONSchemaPropsApplyConfiguration { + b.XPreserveUnknownFields = &value + return b +} + +// WithXEmbeddedResource sets the XEmbeddedResource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XEmbeddedResource field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXEmbeddedResource(value bool) *JSONSchemaPropsApplyConfiguration { + b.XEmbeddedResource = &value + return b +} + +// WithXIntOrString sets the XIntOrString field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XIntOrString field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXIntOrString(value bool) *JSONSchemaPropsApplyConfiguration { + b.XIntOrString = &value + return b +} + +// WithXListMapKeys adds the given value to the XListMapKeys field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the XListMapKeys field. +func (b *JSONSchemaPropsApplyConfiguration) WithXListMapKeys(values ...string) *JSONSchemaPropsApplyConfiguration { + for i := range values { + b.XListMapKeys = append(b.XListMapKeys, values[i]) + } + return b +} + +// WithXListType sets the XListType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XListType field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXListType(value string) *JSONSchemaPropsApplyConfiguration { + b.XListType = &value + return b +} + +// WithXMapType sets the XMapType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XMapType field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXMapType(value string) *JSONSchemaPropsApplyConfiguration { + b.XMapType = &value + return b +} + +// WithXValidations sets the XValidations field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the XValidations field is set to the value of the last call. +func (b *JSONSchemaPropsApplyConfiguration) WithXValidations(value apiextensionsv1beta1.ValidationRules) *JSONSchemaPropsApplyConfiguration { + b.XValidations = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/selectablefield.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/selectablefield.go new file mode 100644 index 0000000000..a216cd886d --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/selectablefield.go @@ -0,0 +1,49 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// SelectableFieldApplyConfiguration represents a declarative configuration of the SelectableField type for use +// with apply. +// +// SelectableField specifies the JSON path of a field that may be used with field selectors. +type SelectableFieldApplyConfiguration struct { + // jsonPath is a simple JSON path which is evaluated against each custom resource to produce a + // field selector value. + // Only JSON paths without the array notation are allowed. + // Must point to a field of type string, boolean or integer. Types with enum values + // and strings with formats are allowed. + // If jsonPath refers to absent field in a resource, the jsonPath evaluates to an empty string. + // Must not point to metdata fields. + // Required. + JSONPath *string `json:"jsonPath,omitempty"` +} + +// SelectableFieldApplyConfiguration constructs a declarative configuration of the SelectableField type for use with +// apply. +func SelectableField() *SelectableFieldApplyConfiguration { + return &SelectableFieldApplyConfiguration{} +} + +// WithJSONPath sets the JSONPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JSONPath field is set to the value of the last call. +func (b *SelectableFieldApplyConfiguration) WithJSONPath(value string) *SelectableFieldApplyConfiguration { + b.JSONPath = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/servicereference.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/servicereference.go new file mode 100644 index 0000000000..2d2ef35f69 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/servicereference.go @@ -0,0 +1,76 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// ServiceReferenceApplyConfiguration represents a declarative configuration of the ServiceReference type for use +// with apply. +// +// ServiceReference holds a reference to Service.legacy.k8s.io +type ServiceReferenceApplyConfiguration struct { + // namespace is the namespace of the service. + // Required + Namespace *string `json:"namespace,omitempty"` + // name is the name of the service. + // Required + Name *string `json:"name,omitempty"` + // path is an optional URL path at which the webhook will be contacted. + Path *string `json:"path,omitempty"` + // port is an optional service port at which the webhook will be contacted. + // `port` should be a valid port number (1-65535, inclusive). + // Defaults to 443 for backward compatibility. + Port *int32 `json:"port,omitempty"` +} + +// ServiceReferenceApplyConfiguration constructs a declarative configuration of the ServiceReference type for use with +// apply. +func ServiceReference() *ServiceReferenceApplyConfiguration { + return &ServiceReferenceApplyConfiguration{} +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithNamespace(value string) *ServiceReferenceApplyConfiguration { + b.Namespace = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithName(value string) *ServiceReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithPath sets the Path field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Path field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPath(value string) *ServiceReferenceApplyConfiguration { + b.Path = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *ServiceReferenceApplyConfiguration) WithPort(value int32) *ServiceReferenceApplyConfiguration { + b.Port = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/validationrule.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/validationrule.go new file mode 100644 index 0000000000..4e1c108fa0 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/validationrule.go @@ -0,0 +1,196 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" +) + +// ValidationRuleApplyConfiguration represents a declarative configuration of the ValidationRule type for use +// with apply. +// +// ValidationRule describes a validation rule written in the CEL expression language. +type ValidationRuleApplyConfiguration struct { + // Rule represents the expression which will be evaluated by CEL. + // ref: https://github.com/google/cel-spec + // The Rule is scoped to the location of the x-kubernetes-validations extension in the schema. + // The `self` variable in the CEL expression is bound to the scoped value. + // Example: + // - Rule scoped to the root of a resource with a status subresource: {"rule": "self.status.actual <= self.spec.maxDesired"} + // + // If the Rule is scoped to an object with properties, the accessible properties of the object are field selectable + // via `self.field` and field presence can be checked via `has(self.field)`. Null valued fields are treated as + // absent fields in CEL expressions. + // If the Rule is scoped to an object with additionalProperties (i.e. a map) the value of the map + // are accessible via `self[mapKey]`, map containment can be checked via `mapKey in self` and all entries of the map + // are accessible via CEL macros and functions such as `self.all(...)`. + // If the Rule is scoped to an array, the elements of the array are accessible via `self[i]` and also by macros and + // functions. + // If the Rule is scoped to a scalar, `self` is bound to the scalar value. + // Examples: + // - Rule scoped to a map of objects: {"rule": "self.components['Widget'].priority < 10"} + // - Rule scoped to a list of integers: {"rule": "self.values.all(value, value >= 0 && value < 100)"} + // - Rule scoped to a string value: {"rule": "self.startsWith('kube')"} + // + // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the + // object and from any x-kubernetes-embedded-resource annotated objects. No other metadata properties are accessible. + // + // Unknown data preserved in custom resources via x-kubernetes-preserve-unknown-fields is not accessible in CEL + // expressions. This includes: + // - Unknown field values that are preserved by object schemas with x-kubernetes-preserve-unknown-fields. + // - Object properties where the property schema is of an "unknown type". An "unknown type" is recursively defined as: + // - A schema with no type and x-kubernetes-preserve-unknown-fields set to true + // - An array where the items schema is of an "unknown type" + // - An object where the additionalProperties schema is of an "unknown type" + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Accessible property names are escaped according to the following rules when accessed in the expression: + // - '__' escapes to '__underscores__' + // - '.' escapes to '__dot__' + // - '-' escapes to '__dash__' + // - '/' escapes to '__slash__' + // - Property names that exactly match a CEL RESERVED keyword escape to '__{keyword}__'. The keywords are: + // "true", "false", "null", "in", "as", "break", "const", "continue", "else", "for", "function", "if", + // "import", "let", "loop", "package", "namespace", "return". + // Examples: + // - Rule accessing a property named "namespace": {"rule": "self.__namespace__ > 0"} + // - Rule accessing a property named "x-prop": {"rule": "self.x__dash__prop > 0"} + // - Rule accessing a property named "redact__d": {"rule": "self.redact__underscores__d > 0"} + // + // Equality on arrays with x-kubernetes-list-type of 'set' or 'map' ignores element order, i.e. [1, 2] == [2, 1]. + // Concatenation on arrays with x-kubernetes-list-type use the semantics of the list type: + // - 'set': `X + Y` performs a union where the array positions of all elements in `X` are preserved and + // non-intersecting elements in `Y` are appended, retaining their partial order. + // - 'map': `X + Y` performs a merge where the array positions of all keys in `X` are preserved but the values + // are overwritten by values in `Y` when the key sets of `X` and `Y` intersect. Elements in `Y` with + // non-intersecting keys are appended, retaining their partial order. + // + // If `rule` makes use of the `oldSelf` variable it is implicitly a + // `transition rule`. + // + // By default, the `oldSelf` variable is the same type as `self`. + // When `optionalOldSelf` is true, the `oldSelf` variable is a CEL optional + // variable whose value() is the same type as `self`. + // See the documentation for the `optionalOldSelf` field for details. + // + // Transition rules by default are applied only on UPDATE requests and are + // skipped if an old value could not be found. You can opt a transition + // rule into unconditional evaluation by setting `optionalOldSelf` to true. + Rule *string `json:"rule,omitempty"` + // Message represents the message displayed when validation fails. The message is required if the Rule contains + // line breaks. The message must not contain line breaks. + // If unset, the message is "failed rule: {Rule}". + // e.g. "must be a URL with the host matching spec.host" + Message *string `json:"message,omitempty"` + // MessageExpression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. + // Since messageExpression is used as a failure message, it must evaluate to a string. + // If both message and messageExpression are present on a rule, then messageExpression will be used if validation + // fails. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced + // as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string + // that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and + // the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. + // messageExpression has access to all the same variables as the rule; the only difference is the return type. + // Example: + // "x must be less than max ("+string(self.max)+")" + MessageExpression *string `json:"messageExpression,omitempty"` + // reason provides a machine-readable validation failure reason that is returned to the caller when a request fails this validation rule. + // The HTTP status code returned to the caller will match the reason of the reason of the first failed validation rule. + // The currently supported reasons are: "FieldValueInvalid", "FieldValueForbidden", "FieldValueRequired", "FieldValueDuplicate". + // If not set, default to use "FieldValueInvalid". + // All future added reasons must be accepted by clients when reading this value and unknown reasons should be treated as FieldValueInvalid. + Reason *apiextensionsv1beta1.FieldValueErrorReason `json:"reason,omitempty"` + // fieldPath represents the field path returned when the validation fails. + // It must be a relative JSON path (i.e. with array notation) scoped to the location of this x-kubernetes-validations extension in the schema and refer to an existing field. + // e.g. when validation checks if a specific attribute `foo` under a map `testMap`, the fieldPath could be set to `.testMap.foo` + // If the validation checks two lists must have unique attributes, the fieldPath could be set to either of the list: e.g. `.testList` + // It does not support list numeric index. + // It supports child operation to refer to an existing field currently. Refer to [JSONPath support in Kubernetes](https://kubernetes.io/docs/reference/kubectl/jsonpath/) for more info. + // Numeric index of array is not supported. + // For field name which contains special characters, use `['specialName']` to refer the field name. + // e.g. for attribute `foo.34$` appears in a list `testList`, the fieldPath could be set to `.testList['foo.34$']` + FieldPath *string `json:"fieldPath,omitempty"` + // optionalOldSelf is used to opt a transition rule into evaluation + // even when the object is first created, or if the old object is + // missing the value. + // + // When enabled `oldSelf` will be a CEL optional whose value will be + // `None` if there is no old value, or when the object is initially created. + // + // You may check for presence of oldSelf using `oldSelf.hasValue()` and + // unwrap it after checking using `oldSelf.value()`. Check the CEL + // documentation for Optional types for more information: + // https://pkg.go.dev/github.com/google/cel-go/cel#OptionalTypes + // + // May not be set unless `oldSelf` is used in `rule`. + OptionalOldSelf *bool `json:"optionalOldSelf,omitempty"` +} + +// ValidationRuleApplyConfiguration constructs a declarative configuration of the ValidationRule type for use with +// apply. +func ValidationRule() *ValidationRuleApplyConfiguration { + return &ValidationRuleApplyConfiguration{} +} + +// WithRule sets the Rule field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rule field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithRule(value string) *ValidationRuleApplyConfiguration { + b.Rule = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessage(value string) *ValidationRuleApplyConfiguration { + b.Message = &value + return b +} + +// WithMessageExpression sets the MessageExpression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MessageExpression field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithMessageExpression(value string) *ValidationRuleApplyConfiguration { + b.MessageExpression = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithReason(value apiextensionsv1beta1.FieldValueErrorReason) *ValidationRuleApplyConfiguration { + b.Reason = &value + return b +} + +// WithFieldPath sets the FieldPath field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldPath field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithFieldPath(value string) *ValidationRuleApplyConfiguration { + b.FieldPath = &value + return b +} + +// WithOptionalOldSelf sets the OptionalOldSelf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OptionalOldSelf field is set to the value of the last call. +func (b *ValidationRuleApplyConfiguration) WithOptionalOldSelf(value bool) *ValidationRuleApplyConfiguration { + b.OptionalOldSelf = &value + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/webhookclientconfig.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/webhookclientconfig.go new file mode 100644 index 0000000000..67b7fcb09d --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1/webhookclientconfig.go @@ -0,0 +1,92 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +// WebhookClientConfigApplyConfiguration represents a declarative configuration of the WebhookClientConfig type for use +// with apply. +// +// WebhookClientConfig contains the information to make a TLS connection with the webhook. +type WebhookClientConfigApplyConfiguration struct { + // url gives the location of the webhook, in standard URL form + // (`scheme://host:port/path`). Exactly one of `url` or `service` + // must be specified. + // + // The `host` should not refer to a service running in the cluster; use + // the `service` field instead. The host might be resolved via external + // DNS in some apiservers (e.g., `kube-apiserver` cannot resolve + // in-cluster DNS as that would be a layering violation). `host` may + // also be an IP address. + // + // Please note that using `localhost` or `127.0.0.1` as a `host` is + // risky unless you take great care to run this webhook on all hosts + // which run an apiserver which might need to make calls to this + // webhook. Such installs are likely to be non-portable, i.e., not easy + // to turn up in a new cluster. + // + // The scheme must be "https"; the URL must begin with "https://". + // + // A path is optional, and if present may be any string permissible in + // a URL. You may use the path to pass an arbitrary string to the + // webhook, for example, a cluster identifier. + // + // Attempting to use a user or basic auth e.g. "user:password@" is not + // allowed. Fragments ("#...") and query parameters ("?...") are not + // allowed, either. + URL *string `json:"url,omitempty"` + // service is a reference to the service for this webhook. Either + // service or url must be specified. + // + // If the webhook is running within the cluster, then you should use `service`. + Service *ServiceReferenceApplyConfiguration `json:"service,omitempty"` + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // If unspecified, system trust roots on the apiserver are used. + CABundle []byte `json:"caBundle,omitempty"` +} + +// WebhookClientConfigApplyConfiguration constructs a declarative configuration of the WebhookClientConfig type for use with +// apply. +func WebhookClientConfig() *WebhookClientConfigApplyConfiguration { + return &WebhookClientConfigApplyConfiguration{} +} + +// WithURL sets the URL field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the URL field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithURL(value string) *WebhookClientConfigApplyConfiguration { + b.URL = &value + return b +} + +// WithService sets the Service field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Service field is set to the value of the last call. +func (b *WebhookClientConfigApplyConfiguration) WithService(value *ServiceReferenceApplyConfiguration) *WebhookClientConfigApplyConfiguration { + b.Service = value + return b +} + +// WithCABundle adds the given value to the CABundle field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the CABundle field. +func (b *WebhookClientConfigApplyConfiguration) WithCABundle(values ...byte) *WebhookClientConfigApplyConfiguration { + for i := range values { + b.CABundle = append(b.CABundle, values[i]) + } + return b +} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go new file mode 100644 index 0000000000..93dd79d63f --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/clientset.go @@ -0,0 +1,133 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package clientset + +import ( + fmt "fmt" + http "net/http" + + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1" + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1" + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ApiextensionsV1() apiextensionsv1.ApiextensionsV1Interface + ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1beta1Interface +} + +// Clientset contains the clients for groups. +type Clientset struct { + *discovery.DiscoveryClient + apiextensionsV1 *apiextensionsv1.ApiextensionsV1Client + apiextensionsV1beta1 *apiextensionsv1beta1.ApiextensionsV1beta1Client +} + +// ApiextensionsV1 retrieves the ApiextensionsV1Client +func (c *Clientset) ApiextensionsV1() apiextensionsv1.ApiextensionsV1Interface { + return c.apiextensionsV1 +} + +// ApiextensionsV1beta1 retrieves the ApiextensionsV1beta1Client +func (c *Clientset) ApiextensionsV1beta1() apiextensionsv1beta1.ApiextensionsV1beta1Interface { + return c.apiextensionsV1beta1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfig will generate a rate-limiter in configShallowCopy. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + + if configShallowCopy.UserAgent == "" { + configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent() + } + + // share the transport between all clients + httpClient, err := rest.HTTPClientFor(&configShallowCopy) + if err != nil { + return nil, err + } + + return NewForConfigAndClient(&configShallowCopy, httpClient) +} + +// NewForConfigAndClient creates a new Clientset for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +// If config's RateLimiter is not set and QPS and Burst are acceptable, +// NewForConfigAndClient will generate a rate-limiter in configShallowCopy. +func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + if configShallowCopy.Burst <= 0 { + return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0") + } + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + + var cs Clientset + var err error + cs.apiextensionsV1, err = apiextensionsv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.apiextensionsV1beta1, err = apiextensionsv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + cs, err := NewForConfig(c) + if err != nil { + panic(err) + } + return cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.apiextensionsV1 = apiextensionsv1.New(c) + cs.apiextensionsV1beta1 = apiextensionsv1beta1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/doc.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme/doc.go similarity index 86% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/doc.go rename to vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme/doc.go index 16f4439906..7dc3756168 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/doc.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme/doc.go @@ -16,5 +16,5 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -// Package fake has the automatically generated clients. -package fake +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme/register.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme/register.go new file mode 100644 index 0000000000..b5c4fdc789 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme/register.go @@ -0,0 +1,58 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + apiextensionsv1.AddToScheme, + apiextensionsv1beta1.AddToScheme, +} + +// AddToScheme adds all types of this clientset into the given scheme. This allows composition +// of clientsets, like in: +// +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/autoscaling_client.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/apiextensions_client.go similarity index 59% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/autoscaling_client.go rename to vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/apiextensions_client.go index 25e38f371d..866f11fb97 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/autoscaling_client.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/apiextensions_client.go @@ -16,34 +16,34 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2beta1 +package v1 import ( http "net/http" - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - scheme "k8s.io/client-go/kubernetes/scheme" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + scheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" rest "k8s.io/client-go/rest" ) -type AutoscalingV2beta1Interface interface { +type ApiextensionsV1Interface interface { RESTClient() rest.Interface - HorizontalPodAutoscalersGetter + CustomResourceDefinitionsGetter } -// AutoscalingV2beta1Client is used to interact with features provided by the autoscaling group. -type AutoscalingV2beta1Client struct { +// ApiextensionsV1Client is used to interact with features provided by the apiextensions.k8s.io group. +type ApiextensionsV1Client struct { restClient rest.Interface } -func (c *AutoscalingV2beta1Client) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface { - return newHorizontalPodAutoscalers(c, namespace) +func (c *ApiextensionsV1Client) CustomResourceDefinitions() CustomResourceDefinitionInterface { + return newCustomResourceDefinitions(c) } -// NewForConfig creates a new AutoscalingV2beta1Client for the given config. +// NewForConfig creates a new ApiextensionsV1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*AutoscalingV2beta1Client, error) { +func NewForConfig(c *rest.Config) (*ApiextensionsV1Client, error) { config := *c setConfigDefaults(&config) httpClient, err := rest.HTTPClientFor(&config) @@ -53,21 +53,21 @@ func NewForConfig(c *rest.Config) (*AutoscalingV2beta1Client, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new AutoscalingV2beta1Client for the given config and http client. +// NewForConfigAndClient creates a new ApiextensionsV1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AutoscalingV2beta1Client, error) { +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ApiextensionsV1Client, error) { config := *c setConfigDefaults(&config) client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } - return &AutoscalingV2beta1Client{client}, nil + return &ApiextensionsV1Client{client}, nil } -// NewForConfigOrDie creates a new AutoscalingV2beta1Client for the given config and +// NewForConfigOrDie creates a new ApiextensionsV1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *AutoscalingV2beta1Client { +func NewForConfigOrDie(c *rest.Config) *ApiextensionsV1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -75,13 +75,13 @@ func NewForConfigOrDie(c *rest.Config) *AutoscalingV2beta1Client { return client } -// New creates a new AutoscalingV2beta1Client for the given RESTClient. -func New(c rest.Interface) *AutoscalingV2beta1Client { - return &AutoscalingV2beta1Client{c} +// New creates a new ApiextensionsV1Client for the given RESTClient. +func New(c rest.Interface) *ApiextensionsV1Client { + return &ApiextensionsV1Client{c} } func setConfigDefaults(config *rest.Config) { - gv := autoscalingv2beta1.SchemeGroupVersion + gv := apiextensionsv1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() @@ -93,7 +93,7 @@ func setConfigDefaults(config *rest.Config) { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *AutoscalingV2beta1Client) RESTClient() rest.Interface { +func (c *ApiextensionsV1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/customresourcedefinition.go new file mode 100644 index 0000000000..1197071d02 --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/customresourcedefinition.go @@ -0,0 +1,77 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + applyconfigurationapiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1" + scheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// CustomResourceDefinitionsGetter has a method to return a CustomResourceDefinitionInterface. +// A group's client should implement this interface. +type CustomResourceDefinitionsGetter interface { + CustomResourceDefinitions() CustomResourceDefinitionInterface +} + +// CustomResourceDefinitionInterface has methods to work with CustomResourceDefinition resources. +type CustomResourceDefinitionInterface interface { + Create(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinition, opts metav1.CreateOptions) (*apiextensionsv1.CustomResourceDefinition, error) + Update(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinition, opts metav1.UpdateOptions) (*apiextensionsv1.CustomResourceDefinition, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, customResourceDefinition *apiextensionsv1.CustomResourceDefinition, opts metav1.UpdateOptions) (*apiextensionsv1.CustomResourceDefinition, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*apiextensionsv1.CustomResourceDefinition, error) + List(ctx context.Context, opts metav1.ListOptions) (*apiextensionsv1.CustomResourceDefinitionList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *apiextensionsv1.CustomResourceDefinition, err error) + Apply(ctx context.Context, customResourceDefinition *applyconfigurationapiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1.CustomResourceDefinition, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, customResourceDefinition *applyconfigurationapiextensionsv1.CustomResourceDefinitionApplyConfiguration, opts metav1.ApplyOptions) (result *apiextensionsv1.CustomResourceDefinition, err error) + CustomResourceDefinitionExpansion +} + +// customResourceDefinitions implements CustomResourceDefinitionInterface +type customResourceDefinitions struct { + *gentype.ClientWithListAndApply[*apiextensionsv1.CustomResourceDefinition, *apiextensionsv1.CustomResourceDefinitionList, *applyconfigurationapiextensionsv1.CustomResourceDefinitionApplyConfiguration] +} + +// newCustomResourceDefinitions returns a CustomResourceDefinitions +func newCustomResourceDefinitions(c *ApiextensionsV1Client) *customResourceDefinitions { + return &customResourceDefinitions{ + gentype.NewClientWithListAndApply[*apiextensionsv1.CustomResourceDefinition, *apiextensionsv1.CustomResourceDefinitionList, *applyconfigurationapiextensionsv1.CustomResourceDefinitionApplyConfiguration]( + "customresourcedefinitions", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *apiextensionsv1.CustomResourceDefinition { return &apiextensionsv1.CustomResourceDefinition{} }, + func() *apiextensionsv1.CustomResourceDefinitionList { + return &apiextensionsv1.CustomResourceDefinitionList{} + }, + gentype.PrefersProtobuf[*apiextensionsv1.CustomResourceDefinition](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/doc.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/doc.go similarity index 97% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/doc.go rename to vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/doc.go index c600965946..3af5d054f1 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/doc.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v2beta2 +package v1 diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/generated_expansion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/generated_expansion.go similarity index 90% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/generated_expansion.go rename to vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/generated_expansion.go index 6f1704f1ee..e594636af9 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/generated_expansion.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2beta1 +package v1 -type HorizontalPodAutoscalerExpansion interface{} +type CustomResourceDefinitionExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/autoscaling_client.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/apiextensions_client.go similarity index 57% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/autoscaling_client.go rename to vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/apiextensions_client.go index 21626e5ce7..6687e77457 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/autoscaling_client.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/apiextensions_client.go @@ -16,34 +16,34 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2beta2 +package v1beta1 import ( http "net/http" - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" - scheme "k8s.io/client-go/kubernetes/scheme" + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + scheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" rest "k8s.io/client-go/rest" ) -type AutoscalingV2beta2Interface interface { +type ApiextensionsV1beta1Interface interface { RESTClient() rest.Interface - HorizontalPodAutoscalersGetter + CustomResourceDefinitionsGetter } -// AutoscalingV2beta2Client is used to interact with features provided by the autoscaling group. -type AutoscalingV2beta2Client struct { +// ApiextensionsV1beta1Client is used to interact with features provided by the apiextensions.k8s.io group. +type ApiextensionsV1beta1Client struct { restClient rest.Interface } -func (c *AutoscalingV2beta2Client) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface { - return newHorizontalPodAutoscalers(c, namespace) +func (c *ApiextensionsV1beta1Client) CustomResourceDefinitions() CustomResourceDefinitionInterface { + return newCustomResourceDefinitions(c) } -// NewForConfig creates a new AutoscalingV2beta2Client for the given config. +// NewForConfig creates a new ApiextensionsV1beta1Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*AutoscalingV2beta2Client, error) { +func NewForConfig(c *rest.Config) (*ApiextensionsV1beta1Client, error) { config := *c setConfigDefaults(&config) httpClient, err := rest.HTTPClientFor(&config) @@ -53,21 +53,21 @@ func NewForConfig(c *rest.Config) (*AutoscalingV2beta2Client, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new AutoscalingV2beta2Client for the given config and http client. +// NewForConfigAndClient creates a new ApiextensionsV1beta1Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AutoscalingV2beta2Client, error) { +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*ApiextensionsV1beta1Client, error) { config := *c setConfigDefaults(&config) client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } - return &AutoscalingV2beta2Client{client}, nil + return &ApiextensionsV1beta1Client{client}, nil } -// NewForConfigOrDie creates a new AutoscalingV2beta2Client for the given config and +// NewForConfigOrDie creates a new ApiextensionsV1beta1Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *AutoscalingV2beta2Client { +func NewForConfigOrDie(c *rest.Config) *ApiextensionsV1beta1Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -75,13 +75,13 @@ func NewForConfigOrDie(c *rest.Config) *AutoscalingV2beta2Client { return client } -// New creates a new AutoscalingV2beta2Client for the given RESTClient. -func New(c rest.Interface) *AutoscalingV2beta2Client { - return &AutoscalingV2beta2Client{c} +// New creates a new ApiextensionsV1beta1Client for the given RESTClient. +func New(c rest.Interface) *ApiextensionsV1beta1Client { + return &ApiextensionsV1beta1Client{c} } func setConfigDefaults(config *rest.Config) { - gv := autoscalingv2beta2.SchemeGroupVersion + gv := apiextensionsv1beta1.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() @@ -93,7 +93,7 @@ func setConfigDefaults(config *rest.Config) { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *AutoscalingV2beta2Client) RESTClient() rest.Interface { +func (c *ApiextensionsV1beta1Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/customresourcedefinition.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/customresourcedefinition.go new file mode 100644 index 0000000000..e7ea4e971f --- /dev/null +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/customresourcedefinition.go @@ -0,0 +1,79 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta1 + +import ( + context "context" + + apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" + applyconfigurationapiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1" + scheme "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// CustomResourceDefinitionsGetter has a method to return a CustomResourceDefinitionInterface. +// A group's client should implement this interface. +type CustomResourceDefinitionsGetter interface { + CustomResourceDefinitions() CustomResourceDefinitionInterface +} + +// CustomResourceDefinitionInterface has methods to work with CustomResourceDefinition resources. +type CustomResourceDefinitionInterface interface { + Create(ctx context.Context, customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinition, opts v1.CreateOptions) (*apiextensionsv1beta1.CustomResourceDefinition, error) + Update(ctx context.Context, customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinition, opts v1.UpdateOptions) (*apiextensionsv1beta1.CustomResourceDefinition, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, customResourceDefinition *apiextensionsv1beta1.CustomResourceDefinition, opts v1.UpdateOptions) (*apiextensionsv1beta1.CustomResourceDefinition, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*apiextensionsv1beta1.CustomResourceDefinition, error) + List(ctx context.Context, opts v1.ListOptions) (*apiextensionsv1beta1.CustomResourceDefinitionList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *apiextensionsv1beta1.CustomResourceDefinition, err error) + Apply(ctx context.Context, customResourceDefinition *applyconfigurationapiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration, opts v1.ApplyOptions) (result *apiextensionsv1beta1.CustomResourceDefinition, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, customResourceDefinition *applyconfigurationapiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration, opts v1.ApplyOptions) (result *apiextensionsv1beta1.CustomResourceDefinition, err error) + CustomResourceDefinitionExpansion +} + +// customResourceDefinitions implements CustomResourceDefinitionInterface +type customResourceDefinitions struct { + *gentype.ClientWithListAndApply[*apiextensionsv1beta1.CustomResourceDefinition, *apiextensionsv1beta1.CustomResourceDefinitionList, *applyconfigurationapiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration] +} + +// newCustomResourceDefinitions returns a CustomResourceDefinitions +func newCustomResourceDefinitions(c *ApiextensionsV1beta1Client) *customResourceDefinitions { + return &customResourceDefinitions{ + gentype.NewClientWithListAndApply[*apiextensionsv1beta1.CustomResourceDefinition, *apiextensionsv1beta1.CustomResourceDefinitionList, *applyconfigurationapiextensionsv1beta1.CustomResourceDefinitionApplyConfiguration]( + "customresourcedefinitions", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *apiextensionsv1beta1.CustomResourceDefinition { + return &apiextensionsv1beta1.CustomResourceDefinition{} + }, + func() *apiextensionsv1beta1.CustomResourceDefinitionList { + return &apiextensionsv1beta1.CustomResourceDefinitionList{} + }, + gentype.PrefersProtobuf[*apiextensionsv1beta1.CustomResourceDefinition](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/doc.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/doc.go similarity index 97% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/doc.go rename to vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/doc.go index 06fd344c01..771101956f 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/doc.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v2beta1 +package v1beta1 diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/generated_expansion.go b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/generated_expansion.go similarity index 90% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/generated_expansion.go rename to vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/generated_expansion.go index 822e062872..2a989d4bea 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/generated_expansion.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1/generated_expansion.go @@ -16,6 +16,6 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v2beta2 +package v1beta1 -type HorizontalPodAutoscalerExpansion interface{} +type CustomResourceDefinitionExpansion interface{} diff --git a/vendor/k8s.io/apiextensions-apiserver/pkg/features/kube_features.go b/vendor/k8s.io/apiextensions-apiserver/pkg/features/kube_features.go index e59d6213f6..13ede31c1b 100644 --- a/vendor/k8s.io/apiextensions-apiserver/pkg/features/kube_features.go +++ b/vendor/k8s.io/apiextensions-apiserver/pkg/features/kube_features.go @@ -65,6 +65,7 @@ func init() { var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate.VersionedSpecs{ CRDObservedGenerationTracking: { {Version: version.MustParse("1.35"), PreRelease: featuregate.Beta, Default: false}, + {Version: version.MustParse("1.36"), PreRelease: featuregate.Beta, Default: true}, }, CRDValidationRatcheting: { {Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Alpha}, diff --git a/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go b/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go index f02fa8e434..cd78c38416 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go +++ b/vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go @@ -40,6 +40,9 @@ var Semantic = conversion.EqualitiesOrDie( func(a, b metav1.Time) bool { return a.UTC() == b.UTC() }, + func(a, b metav1.FieldsV1) bool { + return a.Equal(b) + }, func(a, b labels.Selector) bool { return a.String() == b.String() }, diff --git a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.protomessage.pb.go b/vendor/k8s.io/apimachinery/pkg/api/resource/generated.protomessage.pb.go deleted file mode 100644 index 712e155c3e..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/api/resource/generated.protomessage.pb.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package resource - -func (*Quantity) ProtoMessage() {} - -func (*QuantityValue) ProtoMessage() {} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/content/errors.go b/vendor/k8s.io/apimachinery/pkg/api/validate/content/errors.go index a4a1b5574c..13eeced1a0 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/content/errors.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/content/errors.go @@ -29,6 +29,12 @@ func MinError[T constraints.Integer](min T) string { return fmt.Sprintf("must be greater than or equal to %d", min) } +// MaxError returns a string explanation of a "must be less than or equal" +// validation failure. +func MaxError[T constraints.Integer](max T) string { + return fmt.Sprintf("must be less than or equal to %d", max) +} + // MaxLenError returns a string explanation of a "string too long" validation // failure. func MaxLenError(length int) string { diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/content/path.go b/vendor/k8s.io/apimachinery/pkg/api/validate/content/path.go new file mode 100644 index 0000000000..c41b1d4731 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/content/path.go @@ -0,0 +1,63 @@ +/* +Copyright 2015 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. +*/ + +package content + +import ( + "fmt" + "strings" +) + +// Strings that cannot be used as names specified as path segments (like the +// REST API or etcd store). +var pathSegmentNameMayNotBe = []string{".", ".."} + +// Substrings that cannot be used in names specified as path segments (like the +// REST API or etcd store). +var pathSegmentNameMayNotContain = []string{"/", "%"} + +// IsPathSegmentName validates the name can be safely encoded as a path +// segment. +// +// Note that, for historical reason, this function does not check for +// empty strings or impose a limit on the length of the name. +func IsPathSegmentName(name string) []string { + for _, illegalName := range pathSegmentNameMayNotBe { + if name == illegalName { + return []string{fmt.Sprintf(`may not be '%s'`, illegalName)} + } + } + + return IsPathSegmentPrefix(name) +} + +// IsPathSegmentPrefix validates the name can be used as a prefix for a +// name which will be encoded as a path segment It does not check for exact +// matches with disallowed names, since an arbitrary suffix might make the name +// valid. +// +// Note that, for historical reason, this function does not check for +// empty strings or impose a limit on the length of the name. +func IsPathSegmentPrefix(name string) []string { + var errors []string + for _, illegalContent := range pathSegmentNameMayNotContain { + if strings.Contains(name, illegalContent) { + errors = append(errors, fmt.Sprintf(`may not contain '%s'`, illegalContent)) + } + } + + return errors +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go b/vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go new file mode 100644 index 0000000000..787ae6b0b7 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/discriminator.go @@ -0,0 +1,71 @@ +/* +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. +*/ + +package validate + +import ( + "context" + + "k8s.io/apimachinery/pkg/api/operation" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +// DiscriminatedRule defines a validation to apply for a specific discriminator value. +type DiscriminatedRule[Tfield any, Tdisc comparable] struct { + Value Tdisc + Validation ValidateFunc[Tfield] +} + +// Discriminated validates a member field based on a discriminator value. +// It iterates through the rules and applies the first one that matches the discriminator. +// If no rule matches, it applies the defaultValidation if provided. +// +// It performs ratcheting: if the operation is an Update, and neither the discriminator +// nor the value (checked via equiv) have changed, validation is skipped. +func Discriminated[Tfield any, Tdisc comparable, Tstruct any](ctx context.Context, op operation.Operation, structPath *field.Path, + obj, oldObj *Tstruct, fieldName string, getMemberValue func(*Tstruct) Tfield, getDiscriminator func(*Tstruct) Tdisc, + equiv MatchFunc[Tfield], defaultValidation ValidateFunc[Tfield], rules []DiscriminatedRule[Tfield, Tdisc], +) field.ErrorList { + value := getMemberValue(obj) + discriminator := getDiscriminator(obj) + var oldValue Tfield + var oldDiscriminator Tdisc + + if oldObj != nil { + oldValue = getMemberValue(oldObj) + oldDiscriminator = getDiscriminator(oldObj) + } + + if op.Type == operation.Update && oldObj != nil && discriminator == oldDiscriminator && equiv(value, oldValue) { + return nil + } + + fldPath := structPath.Child(fieldName) + for _, rule := range rules { + if rule.Value == discriminator { + if rule.Validation == nil { + return nil + } + return rule.Validation(ctx, op, fldPath, value, oldValue) + } + } + + if defaultValidation != nil { + return defaultValidation(ctx, op, fldPath, value, oldValue) + } + + return nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go b/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go index b6db5e08cb..dcc7f518d8 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/limits.go @@ -18,6 +18,8 @@ package validate import ( "context" + "math" + "unicode/utf8" "k8s.io/apimachinery/pkg/api/operation" "k8s.io/apimachinery/pkg/api/validate/constraints" @@ -31,9 +33,40 @@ func MaxLength[T ~string](_ context.Context, _ operation.Operation, fldPath *fie if value == nil { return nil } + + // if the length of the value in bytes is less + // than the maximum size then we can confidently + // say that this value is within the bounds + // enforced by the maximum value regardless + // of the actual makeup of characters in the value + byteLength := len(*value) + if byteLength <= max { + return nil + } + + // because runes are up to 4 byte characters, if we assume all characters + // in the input are runes, the minimum number of characters that + // are specified is len(value)/4. If the minimum multi-byte + // character count is greater than our enforced maximum, we + // can confidently say that the value is invalid without having + // to actually perform the more expensive rune counting step + minimum := int(math.Ceil(float64(byteLength) / 4.0)) + if minimum > max || utf8.RuneCountInString(string(*value)) > max { + return field.ErrorList{field.TooLongCharacters(fldPath, *value, max).WithOrigin("maxLength")} + } + return nil +} + +// MaxBytes verifies that the specified value is not longer than max bytes. +func MaxBytes[T ~string](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *T, max int) field.ErrorList { + if value == nil { + return nil + } + if len(*value) > max { - return field.ErrorList{field.TooLong(fldPath, *value, max).WithOrigin("maxLength")} + return field.ErrorList{field.TooLong(fldPath, *value, max).WithOrigin("maxBytes")} } + return nil } @@ -45,6 +78,14 @@ func MaxItems[T any](_ context.Context, _ operation.Operation, fldPath *field.Pa return nil } +// MinItems verifies that the specified slice is not shorter than min items. +func MinItems[T any](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ []T, min int) field.ErrorList { + if len(value) < min { + return field.ErrorList{field.TooFew(fldPath, len(value), min).WithOrigin("minItems")} + } + return nil +} + // Minimum verifies that the specified value is greater than or equal to min. func Minimum[T constraints.Integer](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *T, min T) field.ErrorList { if value == nil { @@ -55,3 +96,45 @@ func Minimum[T constraints.Integer](_ context.Context, _ operation.Operation, fl } return nil } + +// Maximum verifies that the specified value is less than or equal to max. +func Maximum[T constraints.Integer](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *T, max T) field.ErrorList { + if value == nil { + return nil + } + if *value > max { + return field.ErrorList{field.Invalid(fldPath, *value, content.MaxError(max)).WithOrigin("maximum")} + } + return nil +} + +// MinLength verifies that the specified value is at least min characters, if non-nil. +func MinLength[T ~string](_ context.Context, _ operation.Operation, fldPath *field.Path, value, _ *T, min int) field.ErrorList { + if value == nil { + return nil + } + + byteLength := len(*value) + + // because runes are up to 4 byte characters, if we assume all characters + // in the input are 4 byte runes, the minimum number of characters that + // are specified is len(value)/4. If the minimum multi-byte + // character count is greater than or equal to our enforced minimum, we + // can confidently say that the value is valid without having + // to actually perform the more expensive rune counting step + if int(math.Ceil(float64(byteLength)/4.0)) >= min { + return nil + } + + // if the length of the value in bytes is less + // than the minimum size then we can confidently + // say that this value is not within the bounds + // enforced by the maximum value regardless + // of the actual makeup of characters in the value. + // Otherwise, perform a rune count to determine if the + // number of characters is less than the minimum. + if byteLength < min || utf8.RuneCountInString(string(*value)) < min { + return field.ErrorList{field.TooShort(fldPath, *value, min).WithOrigin("minLength")} + } + return nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go b/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go index 9a21473055..190fa8dbe9 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/strfmt.go @@ -133,6 +133,23 @@ func LabelValue[T ~string](_ context.Context, op operation.Operation, fldPath *f return allErrs } +// PathSegmentName verifies that the specified value is a valid path segment name. +// A path segment name can be safely encoded as a path segment in URLs and file paths. +// - must not be exactly "." or ".." +// - must not contain "/" (forward slash) +// - must not contain "%" (percent sign) +// - can contain any other characters including mixed case, numbers, dots, hyphens, underscores, and non-ASCII characters +func PathSegmentName[T ~string](_ context.Context, op operation.Operation, fldPath *field.Path, value, _ *T) field.ErrorList { + if value == nil { + return nil + } + var allErrs field.ErrorList + for _, msg := range content.IsPathSegmentName((string)(*value)) { + allErrs = append(allErrs, field.Invalid(fldPath, *value, msg).WithOrigin("format=k8s-path-segment-name")) + } + return allErrs +} + // UUID verifies that the specified value is a valid UUID (RFC 4122). // - must be 36 characters long // - must be in the normalized form `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` diff --git a/vendor/k8s.io/apimachinery/pkg/api/validate/union.go b/vendor/k8s.io/apimachinery/pkg/api/validate/union.go index 03f45f8661..753a4a9ee1 100644 --- a/vendor/k8s.io/apimachinery/pkg/api/validate/union.go +++ b/vendor/k8s.io/apimachinery/pkg/api/validate/union.go @@ -19,6 +19,7 @@ package validate import ( "context" "fmt" + "reflect" "strings" "k8s.io/apimachinery/pkg/api/operation" @@ -60,6 +61,10 @@ type UnionValidationOptions struct { // )...) // return errs // } +// +// Note that T is "any", rather than "comparable", because union-members can be +// slices, meaning T might be a struct with a slice, meaning it is not +// comparable. func Union[T any](_ context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj T, union *UnionMembership, isSetFns ...ExtractorFn[T, bool]) field.ErrorList { options := UnionValidationOptions{ ErrorForEmpty: func(fldPath *field.Path, allFields []string) *field.Error { @@ -72,7 +77,7 @@ func Union[T any](_ context.Context, op operation.Operation, fldPath *field.Path }, } - return unionValidate(op, fldPath, obj, oldObj, union, options, isSetFns...) + return unionValidate(op, fldPath, obj, oldObj, union, options, isSetFns...).WithOrigin("union") } // DiscriminatedUnion verifies specified union member matches the discriminator. @@ -98,6 +103,10 @@ func Union[T any](_ context.Context, op operation.Operation, fldPath *field.Path // // It is not an error for the discriminatorValue to be unknown. That must be // validated on its own. +// +// Note that T is "any", rather than "comparable", because union-members can be +// slices, meaning T might be a struct with a slice, meaning it is not +// comparable. func DiscriminatedUnion[T any, D ~string](_ context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj T, union *UnionMembership, discriminatorExtractor ExtractorFn[T, D], isSetFns ...ExtractorFn[T, bool]) (errs field.ErrorList) { if len(union.members) != len(isSetFns) { return field.ErrorList{ @@ -106,6 +115,7 @@ func DiscriminatedUnion[T any, D ~string](_ context.Context, op operation.Operat len(isSetFns), len(union.members))), } } + hasOldValue := !reflect.ValueOf(oldObj).IsZero() // because T is any, rather than comparable var changed bool discriminatorValue := discriminatorExtractor(obj) if op.Type == operation.Update { @@ -131,10 +141,10 @@ func DiscriminatedUnion[T any, D ~string](_ context.Context, op operation.Operat } // If the union discriminator and membership is unchanged, we don't need to // re-validate. - if op.Type == operation.Update && !changed { + if op.Type == operation.Update && hasOldValue && !changed { return nil } - return errs + return errs.WithOrigin("union") } // UnionMember represents a member of a union. @@ -195,6 +205,7 @@ func unionValidate[T any](op operation.Operation, fldPath *field.Path, } } + hasOldValue := !reflect.ValueOf(oldObj).IsZero() // because T is any, rather than comparable var specifiedFields []string var changed bool for i, fieldIsSet := range isSetFns { @@ -209,7 +220,7 @@ func unionValidate[T any](op operation.Operation, fldPath *field.Path, } // If the union membership is unchanged, we don't need to re-validate. - if op.Type == operation.Update && !changed { + if op.Type == operation.Update && hasOldValue && !changed { return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/api/validation/path/name.go b/vendor/k8s.io/apimachinery/pkg/api/validation/path/name.go deleted file mode 100644 index ffb9f56d80..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/api/validation/path/name.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 2015 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. -*/ - -package path - -import ( - "fmt" - "strings" -) - -// NameMayNotBe specifies strings that cannot be used as names specified as path segments (like the REST API or etcd store) -var NameMayNotBe = []string{".", ".."} - -// NameMayNotContain specifies substrings that cannot be used in names specified as path segments (like the REST API or etcd store) -var NameMayNotContain = []string{"/", "%"} - -// IsValidPathSegmentName validates the name can be safely encoded as a path segment -func IsValidPathSegmentName(name string) []string { - for _, illegalName := range NameMayNotBe { - if name == illegalName { - return []string{fmt.Sprintf(`may not be '%s'`, illegalName)} - } - } - - var errors []string - for _, illegalContent := range NameMayNotContain { - if strings.Contains(name, illegalContent) { - errors = append(errors, fmt.Sprintf(`may not contain '%s'`, illegalContent)) - } - } - - return errors -} - -// IsValidPathSegmentPrefix validates the name can be used as a prefix for a name which will be encoded as a path segment -// It does not check for exact matches with disallowed names, since an arbitrary suffix might make the name valid -func IsValidPathSegmentPrefix(name string) []string { - var errors []string - for _, illegalContent := range NameMayNotContain { - if strings.Contains(name, illegalContent) { - errors = append(errors, fmt.Sprintf(`may not contain '%s'`, illegalContent)) - } - } - - return errors -} - -// ValidatePathSegmentName validates the name can be safely encoded as a path segment -func ValidatePathSegmentName(name string, prefix bool) []string { - if prefix { - return IsValidPathSegmentPrefix(name) - } - - return IsValidPathSegmentName(name) -} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.defaults.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/conversion.go similarity index 53% rename from vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.defaults.go rename to vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/conversion.go index 5070cb91b9..f431157ec4 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.defaults.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/conversion.go @@ -1,6 +1,3 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - /* Copyright The Kubernetes Authors. @@ -17,17 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by defaulter-gen. DO NOT EDIT. - -package v1alpha1 +package internalversion import ( - runtime "k8s.io/apimachinery/pkg/runtime" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/conversion" ) -// RegisterDefaults adds defaulters functions to the given scheme. -// Public to allow building arbitrary schemes. -// All generated defaulters are covering - they call all nested defaulters. -func RegisterDefaults(scheme *runtime.Scheme) error { - return nil +func Convert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOptions, out *ListOptions, s conversion.Scope) error { + return autoConvert_v1_ListOptions_To_internalversion_ListOptions(in, out, s) +} + +func Convert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions, out *v1.ListOptions, s conversion.Scope) error { + return autoConvert_internalversion_ListOptions_To_v1_ListOptions(in, out, s) } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go index 8c60e7d2a8..a34a11c3e3 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go @@ -89,6 +89,11 @@ type ListOptions struct { // Defaults to true if `resourceVersion=""` or `resourceVersion="0"` (for backward // compatibility reasons) and to false otherwise. SendInitialEvents *bool + + // ShardSelector is the raw shard selector string from the request. + // Parsing is deferred to the apiserver storage layer where the CEL + // parser dependency is available. + ShardSelector string } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go index a6552c276e..f321ad2345 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go @@ -46,12 +46,12 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*ListOptions)(nil), (*v1.ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + if err := s.AddConversionFunc((*ListOptions)(nil), (*v1.ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_internalversion_ListOptions_To_v1_ListOptions(a.(*ListOptions), b.(*v1.ListOptions), scope) }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1.ListOptions)(nil), (*ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { + if err := s.AddConversionFunc((*v1.ListOptions)(nil), (*ListOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_ListOptions_To_internalversion_ListOptions(a.(*v1.ListOptions), b.(*ListOptions), scope) }); err != nil { return err @@ -116,14 +116,10 @@ func autoConvert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions, out.Limit = in.Limit out.Continue = in.Continue out.SendInitialEvents = (*bool)(unsafe.Pointer(in.SendInitialEvents)) + out.ShardSelector = in.ShardSelector return nil } -// Convert_internalversion_ListOptions_To_v1_ListOptions is an autogenerated conversion function. -func Convert_internalversion_ListOptions_To_v1_ListOptions(in *ListOptions, out *v1.ListOptions, s conversion.Scope) error { - return autoConvert_internalversion_ListOptions_To_v1_ListOptions(in, out, s) -} - func autoConvert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOptions, out *ListOptions, s conversion.Scope) error { if err := v1.Convert_string_To_labels_Selector(&in.LabelSelector, &out.LabelSelector, s); err != nil { return err @@ -139,10 +135,6 @@ func autoConvert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOption out.Limit = in.Limit out.Continue = in.Continue out.SendInitialEvents = (*bool)(unsafe.Pointer(in.SendInitialEvents)) + out.ShardSelector = in.ShardSelector return nil } - -// Convert_v1_ListOptions_To_internalversion_ListOptions is an autogenerated conversion function. -func Convert_v1_ListOptions_To_internalversion_ListOptions(in *v1.ListOptions, out *ListOptions, s conversion.Scope) error { - return autoConvert_v1_ListOptions_To_internalversion_ListOptions(in, out, s) -} diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1.go new file mode 100644 index 0000000000..81aca59fac --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1.go @@ -0,0 +1,170 @@ +/* +Copyright 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. +*/ + +package v1 + +import ( + "fmt" + "io" +) + +func (FieldsV1) SwaggerDoc() map[string]string { + return map[string]string{ + "": "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff", + } +} + +type FieldsV1Reader interface { + io.Reader + io.ReaderAt + // Size returns the original byte length of the underlying data. Size is the number of bytes available for reading via ReadAt. + Size() int64 +} + +func (f *FieldsV1) DeepCopy() *FieldsV1 { + if f == nil { + return nil + } + out := new(FieldsV1) + f.DeepCopyInto(out) + return out +} + +func (f *FieldsV1) Marshal() (dAtA []byte, err error) { + size := f.Size() + dAtA = make([]byte, size) + n, err := f.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (f *FieldsV1) MarshalTo(dAtA []byte) (int, error) { + size := f.Size() + return f.MarshalToSizedBuffer(dAtA[:size]) +} + +func (f *FieldsV1) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + rawBytes := f.GetRawBytes() + if len(rawBytes) > 0 { + i -= len(rawBytes) + copy(dAtA[i:], rawBytes) + i = encodeVarintGenerated(dAtA, i, uint64(len(rawBytes))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (f *FieldsV1) Size() (n int) { + if f == nil { + return 0 + } + var l int + _ = l + if l := int(f.GetRawReader().Size()); l > 0 { + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + +func (f *FieldsV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FieldsV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FieldsV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + + f.SetRawBytes(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_byte.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_byte.go new file mode 100644 index 0000000000..66f28e1d9f --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_byte.go @@ -0,0 +1,105 @@ +//go:build !fieldsv1string + +/* +Copyright 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. +*/ + +package v1 + +import ( + "bytes" +) + +// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format. +// +// Each key is either a '.' representing the field itself, and will always map to an empty set, +// or a string representing a sub-field or item. The string will follow one of these four formats: +// 'f:', where is the name of a field in a struct, or key in a map +// 'v:', where is the exact json formatted value of a list item +// 'i:', where is position of a item in a list +// 'k:', where is a map of a list item's key fields to their unique values +// If a key maps to an empty Fields value, the field that key represents is part of the set. +// +// The exact format is defined in sigs.k8s.io/structured-merge-diff +// +k8s:deepcopy-gen=false +// +protobuf.options.marshal=false +// +protobuf.options.(gogoproto.goproto_stringer)=false +type FieldsV1 struct { + // Raw is the underlying serialization of this object. + // + // Deprecated: Direct access to this field is deprecated. Use GetRawBytes, GetRawString, SetRawBytes, SetRawString, GetRawReader, NewFieldsV1 instead. + Raw []byte `json:"-" protobuf:"bytes,1,opt,name=Raw"` +} + +func (f FieldsV1) String() string { + return string(f.Raw) +} + +func (f FieldsV1) Equal(f2 FieldsV1) bool { + return bytes.Equal(f.Raw, f2.Raw) +} + +func (f *FieldsV1) GetRawReader() FieldsV1Reader { + if f == nil || len(f.Raw) == 0 { + return bytes.NewReader(nil) + } + return bytes.NewReader(f.Raw) +} + +// GetRawBytes returns the raw bytes. +// These may or may not be a copy of the underlying bytes. +// If mutating the underlying bytes is desired, the returned bytes may be mutated and then passed to SetRawBytes(). +// If mutating the underlying bytes is not desired, make a copy of the returned bytes. +func (f *FieldsV1) GetRawBytes() []byte { + if f == nil { + return nil + } + return f.Raw +} + +// GetRawString returns the raw data as a string. +func (f *FieldsV1) GetRawString() string { + if f == nil { + return "" + } + return string(f.Raw) +} + +// SetRawBytes sets the raw bytes. It does not retain the passed-in byte slice. +func (f *FieldsV1) SetRawBytes(b []byte) { + if f != nil { + f.Raw = bytes.Clone(b) + } +} + +// SetRawString sets the raw data from a string. +func (f *FieldsV1) SetRawString(s string) { + if f != nil { + f.Raw = []byte(s) + } +} + +func NewFieldsV1(raw string) *FieldsV1 { + return &FieldsV1{Raw: []byte(raw)} +} + +func (f *FieldsV1) DeepCopyInto(out *FieldsV1) { + *out = *f + if f.Raw != nil { + in, out := &f.Raw, &out.Raw + *out = make([]byte, len(*in)) + copy(*out, *in) + } +} diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_string.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_string.go new file mode 100644 index 0000000000..679452ae17 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/fieldsv1_string.go @@ -0,0 +1,113 @@ +//go:build fieldsv1string + +/* +Copyright 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. +*/ + +package v1 + +import ( + "strings" + "unique" +) + +// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format. +// +// Each key is either a '.' representing the field itself, and will always map to an empty set, +// or a string representing a sub-field or item. The string will follow one of these four formats: +// 'f:', where is the name of a field in a struct, or key in a map +// 'v:', where is the exact json formatted value of a list item +// 'i:', where is position of a item in a list +// 'k:', where is a map of a list item's key fields to their unique values +// If a key maps to an empty Fields value, the field that key represents is part of the set. +// +// The exact format is defined in sigs.k8s.io/structured-merge-diff +// +k8s:deepcopy-gen=false +// +protobuf.options.marshal=false +// +protobuf.options.(gogoproto.goproto_stringer)=false +type FieldsV1 struct { + // The zero value of a unique.Handle[string] has an uninitialized underlying pointer. + // Calling .Value() on it panics. We must explicitly check for this uninitialized + // state (f.handle == unique.Handle[string]{}) across accessors to safely support + // uninitialized metav1.FieldsV1{} objects. + // See ongoing golang discussion related to this here: https://github.com/golang/go/issues/73344 + handle unique.Handle[string] +} + +func (f FieldsV1) String() string { + if f.handle == (unique.Handle[string]{}) { + return "" + } + return f.handle.Value() +} + +func (f FieldsV1) Equal(f2 FieldsV1) bool { + if f.handle == f2.handle { + return true + } + // An uninitialized FieldsV1 compared to an explicitly empty + // FieldsV1 (unique.Make("") will fail the handle check above. + // Evaluate string contents directly as well to maintain parity with legacy + // bytes.Equal(nil, []byte{}) == true behavior. + return f.GetRawString() == f2.GetRawString() +} + +func (f *FieldsV1) GetRawReader() FieldsV1Reader { + if f == nil || f.handle == (unique.Handle[string]{}) { + return strings.NewReader("") + } + return strings.NewReader(f.handle.Value()) +} + +// GetRawBytes returns the raw bytes. +// These may or may not be a copy of the underlying bytes. +// If mutating the underlying bytes is desired, the returned bytes may be mutated and then passed to SetRawBytes(). +// If mutating the underlying bytes is not desired, make a copy of the returned bytes. +func (f *FieldsV1) GetRawBytes() []byte { + if f == nil || f.handle == (unique.Handle[string]{}) { + return nil + } + return []byte(f.handle.Value()) +} + +// GetRawString returns the raw data as a string. +func (f *FieldsV1) GetRawString() string { + if f == nil || f.handle == (unique.Handle[string]{}) { + return "" + } + return f.handle.Value() +} + +// SetRawBytes sets the raw bytes. It does not retain the passed-in byte slice. +func (f *FieldsV1) SetRawBytes(b []byte) { + if f != nil { + f.handle = unique.Make(string(b)) + } +} + +// SetRawString sets the raw data from a string. +func (f *FieldsV1) SetRawString(s string) { + if f != nil { + f.handle = unique.Make(s) + } +} + +func NewFieldsV1(raw string) *FieldsV1 { + return &FieldsV1{handle: unique.Make(raw)} +} + +func (f *FieldsV1) DeepCopyInto(out *FieldsV1) { + *out = *f +} diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go index f6b1a6a4e0..293b0223a7 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go @@ -105,6 +105,8 @@ func (m *RootPaths) Reset() { *m = RootPaths{} } func (m *ServerAddressByClientCIDR) Reset() { *m = ServerAddressByClientCIDR{} } +func (m *ShardInfo) Reset() { *m = ShardInfo{} } + func (m *Status) Reset() { *m = Status{} } func (m *StatusCause) Reset() { *m = StatusCause{} } @@ -694,36 +696,6 @@ func (m *FieldSelectorRequirement) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *FieldsV1) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *FieldsV1) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *FieldsV1) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Raw != nil { - i -= len(m.Raw) - copy(dAtA[i:], m.Raw) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.Raw))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *GetOptions) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1130,6 +1102,18 @@ func (m *ListMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.ShardInfo != nil { + { + size, err := m.ShardInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } if m.RemainingItemCount != nil { i = encodeVarintGenerated(dAtA, i, uint64(*m.RemainingItemCount)) i-- @@ -1173,6 +1157,11 @@ func (m *ListOptions) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + i -= len(m.ShardSelector) + copy(dAtA[i:], m.ShardSelector) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.ShardSelector))) + i-- + dAtA[i] = 0x7a if m.SendInitialEvents != nil { i-- if *m.SendInitialEvents { @@ -1797,6 +1786,34 @@ func (m *ServerAddressByClientCIDR) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *ShardInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ShardInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ShardInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Selector) + copy(dAtA[i:], m.Selector) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Selector))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *Status) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2405,19 +2422,6 @@ func (m *FieldSelectorRequirement) Size() (n int) { return n } -func (m *FieldsV1) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Raw != nil { - l = len(m.Raw) - n += 1 + l + sovGenerated(uint64(l)) - } - return n -} - func (m *GetOptions) Size() (n int) { if m == nil { return 0 @@ -2585,6 +2589,10 @@ func (m *ListMeta) Size() (n int) { if m.RemainingItemCount != nil { n += 1 + sovGenerated(uint64(*m.RemainingItemCount)) } + if m.ShardInfo != nil { + l = m.ShardInfo.Size() + n += 1 + l + sovGenerated(uint64(l)) + } return n } @@ -2613,6 +2621,8 @@ func (m *ListOptions) Size() (n int) { if m.SendInitialEvents != nil { n += 2 } + l = len(m.ShardSelector) + n += 1 + l + sovGenerated(uint64(l)) return n } @@ -2835,6 +2845,17 @@ func (m *ServerAddressByClientCIDR) Size() (n int) { return n } +func (m *ShardInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Selector) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *Status) Size() (n int) { if m == nil { return 0 @@ -3217,6 +3238,7 @@ func (this *ListMeta) String() string { `ResourceVersion:` + fmt.Sprintf("%v", this.ResourceVersion) + `,`, `Continue:` + fmt.Sprintf("%v", this.Continue) + `,`, `RemainingItemCount:` + valueToStringGenerated(this.RemainingItemCount) + `,`, + `ShardInfo:` + strings.Replace(this.ShardInfo.String(), "ShardInfo", "ShardInfo", 1) + `,`, `}`, }, "") return s @@ -3236,6 +3258,7 @@ func (this *ListOptions) String() string { `AllowWatchBookmarks:` + fmt.Sprintf("%v", this.AllowWatchBookmarks) + `,`, `ResourceVersionMatch:` + fmt.Sprintf("%v", this.ResourceVersionMatch) + `,`, `SendInitialEvents:` + valueToStringGenerated(this.SendInitialEvents) + `,`, + `ShardSelector:` + fmt.Sprintf("%v", this.ShardSelector) + `,`, `}`, }, "") return s @@ -3405,6 +3428,16 @@ func (this *ServerAddressByClientCIDR) String() string { }, "") return s } +func (this *ShardInfo) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ShardInfo{`, + `Selector:` + fmt.Sprintf("%v", this.Selector) + `,`, + `}`, + }, "") + return s +} func (this *Status) String() string { if this == nil { return "nil" @@ -5314,90 +5347,6 @@ func (m *FieldSelectorRequirement) Unmarshal(dAtA []byte) error { } return nil } -func (m *FieldsV1) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FieldsV1: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FieldsV1: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenerated - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthGenerated - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthGenerated - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Raw = append(m.Raw[:0], dAtA[iNdEx:postIndex]...) - if m.Raw == nil { - m.Raw = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenerated(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenerated - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *GetOptions) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -6847,6 +6796,42 @@ func (m *ListMeta) Unmarshal(dAtA []byte) error { } } m.RemainingItemCount = &v + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShardInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ShardInfo == nil { + m.ShardInfo = &ShardInfo{} + } + if err := m.ShardInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -7157,6 +7142,38 @@ func (m *ListOptions) Unmarshal(dAtA []byte) error { } b := bool(v != 0) m.SendInitialEvents = &b + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ShardSelector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ShardSelector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) @@ -9113,6 +9130,88 @@ func (m *ServerAddressByClientCIDR) Unmarshal(dAtA []byte) error { } return nil } +func (m *ShardInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ShardInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ShardInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Selector = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *Status) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto index fb21b72368..d03a733141 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto @@ -369,9 +369,13 @@ message FieldSelectorRequirement { // If a key maps to an empty Fields value, the field that key represents is part of the set. // // The exact format is defined in sigs.k8s.io/structured-merge-diff +// +k8s:deepcopy-gen=false +// +protobuf.options.marshal=false // +protobuf.options.(gogoproto.goproto_stringer)=false message FieldsV1 { // Raw is the underlying serialization of this object. + // + // Deprecated: Direct access to this field is deprecated. Use GetRawBytes, GetRawString, SetRawBytes, SetRawString, GetRawReader, NewFieldsV1 instead. optional bytes Raw = 1; } @@ -533,6 +537,17 @@ message ListMeta { // should not rely on the remainingItemCount to be set or to be exact. // +optional optional int64 remainingItemCount = 4; + + // shardInfo is set when the list is a filtered subset of the full collection, + // as selected by a shard selector on the request. It echoes back the selector + // so clients can verify which shard they received and merge sharded responses. + // Clients should not cache sharded list responses as a full representation + // of the collection. + // + // This is an alpha field and requires enabling the ShardedListAndWatch feature gate. + // +featureGate=ShardedListAndWatch + // +optional + optional ShardInfo shardInfo = 5; } // ListOptions is the query options to a standard REST list call. @@ -643,6 +658,38 @@ message ListOptions { // compatibility reasons) and to false otherwise. // +optional optional bool sendInitialEvents = 11; + + // shardSelector restricts the list of returned objects using a CEL-based + // shard selector expression. The format uses the shardRange() function + // combined with || (logical OR) to specify one or more hash ranges: + // + // shardRange(object.metadata.uid, '0x0', '0x8000000000000000') + // shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000') + // + // Field paths use CEL-style object-rooted syntax (e.g. "object.metadata.uid"), + // NOT the fieldSelector format ("metadata.uid"). Currently supported paths: + // - object.metadata.uid + // - object.metadata.namespace + // + // hexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, + // defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a + // hash space. The full range is [0x0, 0x10000000000000000), where the exclusive + // upper bound equals 2^64. + // + // Examples: + // 2-shard split: + // shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000') + // shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000') + // 4-shard split: + // shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000') + // shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000') + // shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000') + // shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000') + // + // This is an alpha field and requires enabling the ShardedListAndWatch feature gate. + // +featureGate=ShardedListAndWatch + // +optional + optional string shardSelector = 15; } // ManagedFieldsEntry is a workflow-id, a FieldSet and the group version of the resource @@ -1009,6 +1056,15 @@ message ServerAddressByClientCIDR { optional string serverAddress = 2; } +// ShardInfo describes the shard selector that was applied to produce a list response. +// Its presence on a list response indicates the list is a filtered subset. +message ShardInfo { + // selector is the shard selector string from the request, echoed back so clients + // can verify which shard they received and merge responses from multiple shards. + // +required + optional string selector = 1; +} + // Status is a return value for calls that don't return other objects. message Status { // Standard list metadata. diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.protomessage.pb.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.protomessage.pb.go deleted file mode 100644 index 459ae1ad87..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*APIGroup) ProtoMessage() {} - -func (*APIGroupList) ProtoMessage() {} - -func (*APIResource) ProtoMessage() {} - -func (*APIResourceList) ProtoMessage() {} - -func (*APIVersions) ProtoMessage() {} - -func (*ApplyOptions) ProtoMessage() {} - -func (*Condition) ProtoMessage() {} - -func (*CreateOptions) ProtoMessage() {} - -func (*DeleteOptions) ProtoMessage() {} - -func (*Duration) ProtoMessage() {} - -func (*FieldSelectorRequirement) ProtoMessage() {} - -func (*FieldsV1) ProtoMessage() {} - -func (*GetOptions) ProtoMessage() {} - -func (*GroupKind) ProtoMessage() {} - -func (*GroupResource) ProtoMessage() {} - -func (*GroupVersion) ProtoMessage() {} - -func (*GroupVersionForDiscovery) ProtoMessage() {} - -func (*GroupVersionKind) ProtoMessage() {} - -func (*GroupVersionResource) ProtoMessage() {} - -func (*LabelSelector) ProtoMessage() {} - -func (*LabelSelectorRequirement) ProtoMessage() {} - -func (*List) ProtoMessage() {} - -func (*ListMeta) ProtoMessage() {} - -func (*ListOptions) ProtoMessage() {} - -func (*ManagedFieldsEntry) ProtoMessage() {} - -func (*MicroTime) ProtoMessage() {} - -func (*ObjectMeta) ProtoMessage() {} - -func (*OwnerReference) ProtoMessage() {} - -func (*PartialObjectMetadata) ProtoMessage() {} - -func (*PartialObjectMetadataList) ProtoMessage() {} - -func (*Patch) ProtoMessage() {} - -func (*PatchOptions) ProtoMessage() {} - -func (*Preconditions) ProtoMessage() {} - -func (*RootPaths) ProtoMessage() {} - -func (*ServerAddressByClientCIDR) ProtoMessage() {} - -func (*Status) ProtoMessage() {} - -func (*StatusCause) ProtoMessage() {} - -func (*StatusDetails) ProtoMessage() {} - -func (*TableOptions) ProtoMessage() {} - -func (*Time) ProtoMessage() {} - -func (*Timestamp) ProtoMessage() {} - -func (*TypeMeta) ProtoMessage() {} - -func (*UpdateOptions) ProtoMessage() {} - -func (*Verbs) ProtoMessage() {} - -func (*WatchEvent) ProtoMessage() {} diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go index c748071ed7..45ed1e9891 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go @@ -279,17 +279,18 @@ func ResetObjectMetaForStatus(meta, existingMeta Object) { // MarshalJSON may get called on pointers or values, so implement MarshalJSON on value. // http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go func (f FieldsV1) MarshalJSON() ([]byte, error) { - if f.Raw == nil { + raw := f.GetRawBytes() + if len(raw) == 0 { return []byte("null"), nil } if f.getContentType() == fieldsV1InvalidOrValidCBORObject { var u map[string]interface{} - if err := cbor.Unmarshal(f.Raw, &u); err != nil { + if err := cbor.Unmarshal(raw, &u); err != nil { return nil, fmt.Errorf("metav1.FieldsV1 cbor invalid: %w", err) } return utiljson.Marshal(u) } - return f.Raw, nil + return raw, nil } // UnmarshalJSON implements json.Unmarshaler @@ -298,7 +299,7 @@ func (f *FieldsV1) UnmarshalJSON(b []byte) error { return errors.New("metav1.FieldsV1: UnmarshalJSON on nil pointer") } if !bytes.Equal(b, []byte("null")) { - f.Raw = append(f.Raw[0:0], b...) + f.SetRawBytes(b) } return nil } @@ -307,17 +308,18 @@ var _ json.Marshaler = FieldsV1{} var _ json.Unmarshaler = &FieldsV1{} func (f FieldsV1) MarshalCBOR() ([]byte, error) { - if f.Raw == nil { + raw := f.GetRawBytes() + if len(raw) == 0 { return cbor.Marshal(nil) } if f.getContentType() == fieldsV1InvalidOrValidJSONObject { var u map[string]interface{} - if err := utiljson.Unmarshal(f.Raw, &u); err != nil { + if err := utiljson.Unmarshal(raw, &u); err != nil { return nil, fmt.Errorf("metav1.FieldsV1 json invalid: %w", err) } return cbor.Marshal(u) } - return f.Raw, nil + return raw, nil } var cborNull = []byte{0xf6} @@ -327,7 +329,7 @@ func (f *FieldsV1) UnmarshalCBOR(b []byte) error { return errors.New("metav1.FieldsV1: UnmarshalCBOR on nil pointer") } if !bytes.Equal(b, cborNull) { - f.Raw = append(f.Raw[0:0], b...) + f.SetRawBytes(b) } return nil } @@ -362,8 +364,13 @@ const ( // or, if a tag-enclosed map, an initial byte with major type "tag" (0xf6, 0xa0...0xbf, or // 0xc6...0xdb). The two sets of valid initial bytes don't intersect. func (f FieldsV1) getContentType() int { - if len(f.Raw) > 0 { - p := f.Raw[0] + reader := f.GetRawReader() + if reader.Size() > 0 { + var buf [1]byte + if _, err := reader.Read(buf[:]); err != nil { + return fieldsV1InvalidOrEmpty + } + p := buf[0] switch p { case 'n', '{', '\t', '\r', '\n', ' ': return fieldsV1InvalidOrValidJSONObject diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go index 92d3ed5e01..6ae1b095fc 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go @@ -94,6 +94,13 @@ type ListInterface interface { SetRemainingItemCount(c *int64) } +// ShardedListInterface can be implemented by list types to indicate that they +// represent a sharded subset of the full collection rather than the complete list. +type ShardedListInterface interface { + GetShardInfo() *ShardInfo + SetShardInfo(*ShardInfo) +} + // Type exposes the type and APIVersion of versioned or internal API objects. // TODO: move this, and TypeMeta and ListMeta, to a different package type Type interface { @@ -113,6 +120,8 @@ func (meta *ListMeta) GetContinue() string { return meta.Continue func (meta *ListMeta) SetContinue(c string) { meta.Continue = c } func (meta *ListMeta) GetRemainingItemCount() *int64 { return meta.RemainingItemCount } func (meta *ListMeta) SetRemainingItemCount(c *int64) { meta.RemainingItemCount = c } +func (meta *ListMeta) GetShardInfo() *ShardInfo { return meta.ShardInfo } +func (meta *ListMeta) SetShardInfo(s *ShardInfo) { meta.ShardInfo = s } func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_fuzz.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_fuzz.go index a5f437b4b3..338ea9be72 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_fuzz.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_fuzz.go @@ -1,5 +1,4 @@ //go:build !notest -// +build !notest /* Copyright 2020 The Kubernetes Authors. diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_fuzz.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_fuzz.go index 48fb978450..14ec5f0586 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_fuzz.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_fuzz.go @@ -1,5 +1,4 @@ //go:build !notest -// +build !notest /* Copyright 2020 The Kubernetes Authors. diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go index 9970e877d0..c8b87f20c8 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go @@ -92,6 +92,26 @@ type ListMeta struct { // should not rely on the remainingItemCount to be set or to be exact. // +optional RemainingItemCount *int64 `json:"remainingItemCount,omitempty" protobuf:"bytes,4,opt,name=remainingItemCount"` + + // shardInfo is set when the list is a filtered subset of the full collection, + // as selected by a shard selector on the request. It echoes back the selector + // so clients can verify which shard they received and merge sharded responses. + // Clients should not cache sharded list responses as a full representation + // of the collection. + // + // This is an alpha field and requires enabling the ShardedListAndWatch feature gate. + // +featureGate=ShardedListAndWatch + // +optional + ShardInfo *ShardInfo `json:"shardInfo,omitempty" protobuf:"bytes,5,opt,name=shardInfo"` +} + +// ShardInfo describes the shard selector that was applied to produce a list response. +// Its presence on a list response indicates the list is a filtered subset. +type ShardInfo struct { + // selector is the shard selector string from the request, echoed back so clients + // can verify which shard they received and merge responses from multiple shards. + // +required + Selector string `json:"selector" protobuf:"bytes,1,opt,name=selector"` } // Field path constants that are specific to the internal API @@ -430,6 +450,38 @@ type ListOptions struct { // compatibility reasons) and to false otherwise. // +optional SendInitialEvents *bool `json:"sendInitialEvents,omitempty" protobuf:"varint,11,opt,name=sendInitialEvents"` + + // shardSelector restricts the list of returned objects using a CEL-based + // shard selector expression. The format uses the shardRange() function + // combined with || (logical OR) to specify one or more hash ranges: + // + // shardRange(object.metadata.uid, '0x0', '0x8000000000000000') + // shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000') + // + // Field paths use CEL-style object-rooted syntax (e.g. "object.metadata.uid"), + // NOT the fieldSelector format ("metadata.uid"). Currently supported paths: + // - object.metadata.uid + // - object.metadata.namespace + // + // hexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, + // defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a + // hash space. The full range is [0x0, 0x10000000000000000), where the exclusive + // upper bound equals 2^64. + // + // Examples: + // 2-shard split: + // shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000') + // shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000') + // 4-shard split: + // shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000') + // shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000') + // shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000') + // shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000') + // + // This is an alpha field and requires enabling the ShardedListAndWatch feature gate. + // +featureGate=ShardedListAndWatch + // +optional + ShardSelector string `json:"shardSelector,omitempty" protobuf:"bytes,15,opt,name=shardSelector"` } const ( @@ -1384,27 +1436,6 @@ const ( ManagedFieldsOperationUpdate ManagedFieldsOperationType = "Update" ) -// FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format. -// -// Each key is either a '.' representing the field itself, and will always map to an empty set, -// or a string representing a sub-field or item. The string will follow one of these four formats: -// 'f:', where is the name of a field in a struct, or key in a map -// 'v:', where is the exact json formatted value of a list item -// 'i:', where is position of a item in a list -// 'k:', where is a map of a list item's key fields to their unique values -// If a key maps to an empty Fields value, the field that key represents is part of the set. -// -// The exact format is defined in sigs.k8s.io/structured-merge-diff -// +protobuf.options.(gogoproto.goproto_stringer)=false -type FieldsV1 struct { - // Raw is the underlying serialization of this object. - Raw []byte `json:"-" protobuf:"bytes,1,opt,name=Raw"` -} - -func (f FieldsV1) String() string { - return string(f.Raw) -} - // TODO: Table does not generate to protobuf because of the interface{} - fix protobuf // generation to support a meta type that can accept any valid JSON. This can be introduced // in a v1 because clients a) receive an error if they try to access proto today, and b) diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go index 405496d3df..c45c00f1aa 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go @@ -147,14 +147,6 @@ func (FieldSelectorRequirement) SwaggerDoc() map[string]string { return map_FieldSelectorRequirement } -var map_FieldsV1 = map[string]string{ - "": "FieldsV1 stores a set of fields in a data structure like a Trie, in JSON format.\n\nEach key is either a '.' representing the field itself, and will always map to an empty set, or a string representing a sub-field or item. The string will follow one of these four formats: 'f:', where is the name of a field in a struct, or key in a map 'v:', where is the exact json formatted value of a list item 'i:', where is position of a item in a list 'k:', where is a map of a list item's key fields to their unique values If a key maps to an empty Fields value, the field that key represents is part of the set.\n\nThe exact format is defined in sigs.k8s.io/structured-merge-diff", -} - -func (FieldsV1) SwaggerDoc() map[string]string { - return map_FieldsV1 -} - var map_GetOptions = map[string]string{ "": "GetOptions is the standard query options to the standard REST get call.", "resourceVersion": "resourceVersion sets a constraint on what resource versions a request may be served from. See https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.\n\nDefaults to unset", @@ -211,6 +203,7 @@ var map_ListMeta = map[string]string{ "resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency", "continue": "continue may be set if the user set a limit on the number of items returned, and indicates that the server has more data available. The value is opaque and may be used to issue another request to the endpoint that served this list to retrieve the next set of available objects. Continuing a consistent list may not be possible if the server configuration has changed or more than a few minutes have passed. The resourceVersion field returned when using this continue value will be identical to the value in the first response, unless you have received this token from an error message.", "remainingItemCount": "remainingItemCount is the number of subsequent items in the list which are not included in this list response. If the list request contained label or field selectors, then the number of remaining items is unknown and the field will be left unset and omitted during serialization. If the list is complete (either because it is not chunking or because this is the last chunk), then there are no more remaining items and this field will be left unset and omitted during serialization. Servers older than v1.15 do not set this field. The intended use of the remainingItemCount is *estimating* the size of a collection. Clients should not rely on the remainingItemCount to be set or to be exact.", + "shardInfo": "shardInfo is set when the list is a filtered subset of the full collection, as selected by a shard selector on the request. It echoes back the selector so clients can verify which shard they received and merge sharded responses. Clients should not cache sharded list responses as a full representation of the collection.\n\nThis is an alpha field and requires enabling the ShardedListAndWatch feature gate.", } func (ListMeta) SwaggerDoc() map[string]string { @@ -229,6 +222,7 @@ var map_ListOptions = map[string]string{ "limit": "limit is a maximum number of responses to return for a list call. If more items exist, the server will set the `continue` field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.\n\nThe server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.", "continue": "The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \"next key\".\n\nThis field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.", "sendInitialEvents": "`sendInitialEvents=true` may be set together with `watch=true`. In that case, the watch stream will begin with synthetic events to produce the current state of objects in the collection. Once all such events have been sent, a synthetic \"Bookmark\" event will be sent. The bookmark will report the ResourceVersion (RV) corresponding to the set of objects, and be marked with `\"k8s.io/initial-events-end\": \"true\"` annotation. Afterwards, the watch stream will proceed as usual, sending watch events corresponding to changes (subsequent to the RV) to objects watched.\n\nWhen `sendInitialEvents` option is set, we require `resourceVersionMatch` option to also be set. The semantic of the watch request is as following: - `resourceVersionMatch` = NotOlderThan\n is interpreted as \"data at least as new as the provided `resourceVersion`\"\n and the bookmark event is send when the state is synced\n to a `resourceVersion` at least as fresh as the one provided by the ListOptions.\n If `resourceVersion` is unset, this is interpreted as \"consistent read\" and the\n bookmark event is send when the state is synced at least to the moment\n when request started being processed.\n- `resourceVersionMatch` set to any other value or unset\n Invalid error is returned.\n\nDefaults to true if `resourceVersion=\"\"` or `resourceVersion=\"0\"` (for backward compatibility reasons) and to false otherwise.", + "shardSelector": "shardSelector restricts the list of returned objects using a CEL-based shard selector expression. The format uses the shardRange() function combined with || (logical OR) to specify one or more hash ranges:\n\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000')\n shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n\nField paths use CEL-style object-rooted syntax (e.g. \"object.metadata.uid\"), NOT the fieldSelector format (\"metadata.uid\"). Currently supported paths:\n - object.metadata.uid\n - object.metadata.namespace\n\nhexStart and hexEnd are single-quoted CEL string literals with a '0x' prefix, defining the inclusive lower and exclusive upper bounds over the 64-bit FNV-1a hash space. The full range is [0x0, 0x10000000000000000), where the exclusive upper bound equals 2^64.\n\nExamples:\n 2-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x8000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x8000000000000000', '0x10000000000000000')\n 4-shard split:\n shard 0: shardRange(object.metadata.uid, '0x0000000000000000', '0x4000000000000000')\n shard 1: shardRange(object.metadata.uid, '0x4000000000000000', '0x8000000000000000')\n shard 2: shardRange(object.metadata.uid, '0x8000000000000000', '0xc000000000000000')\n shard 3: shardRange(object.metadata.uid, '0xc000000000000000', '0x10000000000000000')\n\nThis is an alpha field and requires enabling the ShardedListAndWatch feature gate.", } func (ListOptions) SwaggerDoc() map[string]string { @@ -355,6 +349,15 @@ func (ServerAddressByClientCIDR) SwaggerDoc() map[string]string { return map_ServerAddressByClientCIDR } +var map_ShardInfo = map[string]string{ + "": "ShardInfo describes the shard selector that was applied to produce a list response. Its presence on a list response indicates the list is a filtered subset.", + "selector": "selector is the shard selector string from the request, echoed back so clients can verify which shard they received and merge responses from multiple shards.", +} + +func (ShardInfo) SwaggerDoc() map[string]string { + return map_ShardInfo +} + var map_Status = map[string]string{ "": "Status is a return value for calls that don't return other objects.", "metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go index 82e2722404..735cbcb08f 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go @@ -440,6 +440,13 @@ func autoConvert_url_Values_To_v1_ListOptions(in *url.Values, out *ListOptions, } else { out.SendInitialEvents = nil } + if values, ok := map[string][]string(*in)["shardSelector"]; ok && len(values) > 0 { + if err := runtime.Convert_Slice_string_To_string(&values, &out.ShardSelector, s); err != nil { + return err + } + } else { + out.ShardSelector = "" + } return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go index 6b0d0dfee9..eb7eb80d9b 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go @@ -353,27 +353,6 @@ func (in *FieldSelectorRequirement) DeepCopy() *FieldSelectorRequirement { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *FieldsV1) DeepCopyInto(out *FieldsV1) { - *out = *in - if in.Raw != nil { - in, out := &in.Raw, &out.Raw - *out = make([]byte, len(*in)) - copy(*out, *in) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FieldsV1. -func (in *FieldsV1) DeepCopy() *FieldsV1 { - if in == nil { - return nil - } - out := new(FieldsV1) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GetOptions) DeepCopyInto(out *GetOptions) { *out = *in @@ -606,6 +585,11 @@ func (in *ListMeta) DeepCopyInto(out *ListMeta) { *out = new(int64) **out = **in } + if in.ShardInfo != nil { + in, out := &in.ShardInfo, &out.ShardInfo + *out = new(ShardInfo) + **out = **in + } return } @@ -663,8 +647,7 @@ func (in *ManagedFieldsEntry) DeepCopyInto(out *ManagedFieldsEntry) { } if in.FieldsV1 != nil { in, out := &in.FieldsV1, &out.FieldsV1 - *out = new(FieldsV1) - (*in).DeepCopyInto(*out) + *out = (*in).DeepCopy() } return } @@ -947,6 +930,22 @@ func (in *ServerAddressByClientCIDR) DeepCopy() *ServerAddressByClientCIDR { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ShardInfo) DeepCopyInto(out *ShardInfo) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShardInfo. +func (in *ShardInfo) DeepCopy() *ShardInfo { + if in == nil { + return nil + } + out := new(ShardInfo) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Status) DeepCopyInto(out *Status) { *out = *in diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.model_name.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.model_name.go index fd6e876ece..3df687707c 100644 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.model_name.go +++ b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.model_name.go @@ -201,6 +201,11 @@ func (in ServerAddressByClientCIDR) OpenAPIModelName() string { return "io.k8s.apimachinery.pkg.apis.meta.v1.ServerAddressByClientCIDR" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ShardInfo) OpenAPIModelName() string { + return "io.k8s.apimachinery.pkg.apis.meta.v1.ShardInfo" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in Status) OpenAPIModelName() string { return "io.k8s.apimachinery.pkg.apis.meta.v1.Status" diff --git a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index a782b1d8f0..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*PartialObjectMetadataList) ProtoMessage() {} diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/generated.protomessage.pb.go b/vendor/k8s.io/apimachinery/pkg/runtime/generated.protomessage.pb.go deleted file mode 100644 index 1716853ff1..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/runtime/generated.protomessage.pb.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package runtime - -func (*RawExtension) ProtoMessage() {} - -func (*TypeMeta) ProtoMessage() {} - -func (*Unknown) ProtoMessage() {} diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.protomessage.pb.go b/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.protomessage.pb.go deleted file mode 100644 index 047437377f..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.protomessage.pb.go +++ /dev/null @@ -1,22 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package schema diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go index 0210132ffa..4a7055c10f 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/internal/modes/decode.go @@ -58,12 +58,18 @@ var decode cbor.DecMode = func() cbor.DecMode { // with or without tagging. If a tag number is present, it must be valid. TimeTag: cbor.DecTagOptional, - // Observed depth up to 16 in fuzzed batch/v1 CronJobList. JSON implementation limit - // is 10000. - MaxNestedLevels: 64, - - MaxArrayElements: 1024, - MaxMapPairs: 1024, + // MaxNestedLevels is set to the same value used in the JSON implementation. + MaxNestedLevels: 10000, + + // MaxArrayElements is set to the maximum allowed by the cbor library. We rely on + // the library initial wellformedness scan and on the api max request limit to + // prevent preallocating very large slices during decoding. + MaxArrayElements: 2147483647, + + // MaxMapPairs specifies the maximum number of key-value pairs allowed in a map. + // We selected this value as it is large enough so that in practice the API server + // decoder will always hit the request body limit before the limit here is reached. + MaxMapPairs: 2097152, // Indefinite-length sequences aren't produced by this serializer, but other // implementations can. diff --git a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/raw.go b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/raw.go index 09d1340f93..6d4f283cae 100644 --- a/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/raw.go +++ b/vendor/k8s.io/apimachinery/pkg/runtime/serializer/cbor/raw.go @@ -50,7 +50,7 @@ var rawTypeTranscodeFuncs = map[reflect.Type]func(reflect.Value) error{ return nil } fields := rv.Addr().Interface().(*metav1.FieldsV1) - if fields.Raw == nil { + if fields.GetRawReader().Size() == 0 { // When Raw is nil it encodes to null. Don't change nil Raw values during // transcoding, they would have unmarshalled from JSON as nil too. return nil @@ -59,7 +59,7 @@ var rawTypeTranscodeFuncs = map[reflect.Type]func(reflect.Value) error{ if err != nil { return fmt.Errorf("failed to transcode FieldsV1 to JSON: %w", err) } - fields.Raw = j + fields.SetRawBytes(j) return nil }, } diff --git a/vendor/k8s.io/apimachinery/pkg/sharding/accessor.go b/vendor/k8s.io/apimachinery/pkg/sharding/accessor.go new file mode 100644 index 0000000000..fab98ffca4 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/sharding/accessor.go @@ -0,0 +1,50 @@ +/* +Copyright 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. +*/ + +package sharding + +import ( + "fmt" + + "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/runtime" +) + +// ResolveFieldValue extracts a metadata field value from a runtime.Object +// based on the given field path. +// +// Field paths use CEL-style object-rooted syntax ("object.metadata."), +// which differs from the fieldSelector format ("metadata."). The +// "object." prefix anchors the path to the resource being filtered. +// +// Supported field paths: +// - "object.metadata.uid" +// - "object.metadata.namespace" +func ResolveFieldValue(obj runtime.Object, fieldPath string) (string, error) { + accessor, err := meta.Accessor(obj) + if err != nil { + return "", fmt.Errorf("failed to access object metadata: %w", err) + } + + switch fieldPath { + case "object.metadata.uid": + return string(accessor.GetUID()), nil + case "object.metadata.namespace": + return accessor.GetNamespace(), nil + default: + return "", fmt.Errorf("unsupported field path: %q", fieldPath) + } +} diff --git a/vendor/k8s.io/api/coordination/v1/generated.protomessage.pb.go b/vendor/k8s.io/apimachinery/pkg/sharding/hash.go similarity index 66% rename from vendor/k8s.io/api/coordination/v1/generated.protomessage.pb.go rename to vendor/k8s.io/apimachinery/pkg/sharding/hash.go index f9210fce6a..ae4dcfe2f6 100644 --- a/vendor/k8s.io/api/coordination/v1/generated.protomessage.pb.go +++ b/vendor/k8s.io/apimachinery/pkg/sharding/hash.go @@ -1,6 +1,3 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - /* Copyright The Kubernetes Authors. @@ -17,12 +14,17 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*Lease) ProtoMessage() {} +package sharding -func (*LeaseList) ProtoMessage() {} +import ( + "fmt" + "hash/fnv" +) -func (*LeaseSpec) ProtoMessage() {} +// HashField computes a hash of value and returns it +// as a 16-character lowercase hex string (no "0x" prefix). +func HashField(value string) string { + h := fnv.New64a() + h.Write([]byte(value)) + return fmt.Sprintf("%016x", h.Sum64()) +} diff --git a/vendor/k8s.io/apimachinery/pkg/sharding/selector.go b/vendor/k8s.io/apimachinery/pkg/sharding/selector.go new file mode 100644 index 0000000000..841388a0d7 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/sharding/selector.go @@ -0,0 +1,137 @@ +/* +Copyright 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. +*/ + +package sharding + +import ( + "fmt" + "strings" + + "k8s.io/apimachinery/pkg/runtime" +) + +// Selector represents a shard selector that can match objects based on +// hash ranges of their metadata fields. It follows the labels.Selector +// pattern from the Kubernetes API. +type Selector interface { + // Matches returns true if the given object matches the shard selector. + Matches(obj runtime.Object) (bool, error) + + // Empty returns true if the selector matches everything (no filtering). + Empty() bool + + // String returns the wire-format string representation that can be + // round-tripped through Parse. + String() string + + // Requirements returns the list of shard range requirements. + Requirements() []ShardRangeRequirement + + // DeepCopySelector returns a deep copy of the selector. + DeepCopySelector() Selector +} + +// Everything returns a selector that matches all objects. +func Everything() Selector { + return &everythingSelector{} +} + +type everythingSelector struct{} + +func (s *everythingSelector) Matches(_ runtime.Object) (bool, error) { return true, nil } +func (s *everythingSelector) Empty() bool { return true } +func (s *everythingSelector) String() string { return "" } +func (s *everythingSelector) Requirements() []ShardRangeRequirement { return nil } +func (s *everythingSelector) DeepCopySelector() Selector { return &everythingSelector{} } + +// shardSelector implements Selector with one or more shard range requirements. +type shardSelector struct { + requirements []ShardRangeRequirement +} + +func (s *shardSelector) Matches(obj runtime.Object) (bool, error) { + if len(s.requirements) == 0 { + return true, nil + } + // All requirements must share the same key so we resolve the field value + // and compute the hash once. The parser enforces this, but we verify here + // to guard against selectors constructed through other means. + key := s.requirements[0].Key + for _, req := range s.requirements[1:] { + if req.Key != key { + return false, fmt.Errorf("inconsistent shard keys: %q vs %q", key, req.Key) + } + } + + value, err := ResolveFieldValue(obj, key) + if err != nil { + return false, err + } + hash := "0x" + HashField(value) + + for _, req := range s.requirements { + if !HexLess(hash, req.Start) && HexLess(hash, req.End) { + return true, nil + } + } + return false, nil +} + +// HexLess compares two 0x-prefixed lowercase hex strings numerically. +// Both values must be normalized to 16 hex digits (e.g. "0x0000000000000000"), +// except for the special upper bound "0x10000000000000000" (2^64) which has 17. +func HexLess(a, b string) bool { + if len(a) != len(b) { + return len(a) < len(b) + } + return a < b +} + +func (s *shardSelector) Empty() bool { + return len(s.requirements) == 0 +} + +func (s *shardSelector) String() string { + parts := make([]string, 0, len(s.requirements)) + for _, req := range s.requirements { + parts = append(parts, fmt.Sprintf("shardRange(%s, '%s', '%s')", req.Key, req.Start, req.End)) + } + return strings.Join(parts, " || ") +} + +func (s *shardSelector) Requirements() []ShardRangeRequirement { + result := make([]ShardRangeRequirement, len(s.requirements)) + copy(result, s.requirements) + return result +} + +func (s *shardSelector) DeepCopySelector() Selector { + reqs := make([]ShardRangeRequirement, len(s.requirements)) + copy(reqs, s.requirements) + return &shardSelector{requirements: reqs} +} + +// NewSelector creates a Selector from the given requirements. +// All requirements must use the same Key; this is validated at match time. +// If no requirements are provided, returns Everything(). +func NewSelector(reqs ...ShardRangeRequirement) Selector { + if len(reqs) == 0 { + return Everything() + } + return &shardSelector{ + requirements: reqs, + } +} diff --git a/vendor/k8s.io/apimachinery/pkg/sharding/types.go b/vendor/k8s.io/apimachinery/pkg/sharding/types.go new file mode 100644 index 0000000000..4684fc497f --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/sharding/types.go @@ -0,0 +1,32 @@ +/* +Copyright 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. +*/ + +package sharding + +// ShardRangeRequirement represents a single shard range requirement. +// It specifies a field path to hash and a hex range [Start, End) for filtering. +// The hash space is FNV-1a 64-bit: [0x0000000000000000, 0x10000000000000000). +// Both Start and End must be specified (no empty/unbounded values). +type ShardRangeRequirement struct { + // Key is the field path, e.g. "object.metadata.uid" + Key string + // Start is the inclusive lower bound as a 0x-prefixed lowercase hex string. + // Minimum value is "0x0000000000000000". + Start string + // End is the exclusive upper bound as a 0x-prefixed lowercase hex string. + // Maximum value is "0x10000000000000000" (2^64). + End string +} diff --git a/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go b/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go index aed04524b6..7bfa6088bc 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go +++ b/vendor/k8s.io/apimachinery/pkg/util/diff/diff.go @@ -1,6 +1,3 @@ -//go:build !usegocmp -// +build !usegocmp - /* Copyright 2025 The Kubernetes Authors. @@ -25,7 +22,7 @@ import ( "github.com/pmezard/go-difflib/difflib" - "k8s.io/apimachinery/pkg/util/dump" + "k8s.io/utils/dump" ) // Diff returns a string representation of the difference between two objects. diff --git a/vendor/k8s.io/apimachinery/pkg/util/diff/legacy_diff.go b/vendor/k8s.io/apimachinery/pkg/util/diff/legacy_diff.go index 4d32d36adb..9f0dc2f6ad 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/diff/legacy_diff.go +++ b/vendor/k8s.io/apimachinery/pkg/util/diff/legacy_diff.go @@ -22,7 +22,7 @@ import ( "strings" "text/tabwriter" - "k8s.io/apimachinery/pkg/util/dump" + "k8s.io/utils/dump" ) // ObjectGoPrintSideBySide prints a and b as textual dumps side by side, diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/doc.go b/vendor/k8s.io/apimachinery/pkg/util/httpstream/doc.go index 1da83f14b1..5fdc7955fa 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/doc.go +++ b/vendor/k8s.io/apimachinery/pkg/util/httpstream/doc.go @@ -14,6 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package httpstream adds multiplexed streaming support to HTTP requests and -// responses via connection upgrades. +// Package httpstream contains compatibility wrappers for streaming transport APIs. +// +// Deprecated: use k8s.io/streaming/pkg/httpstream directly. package httpstream diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/doc.go b/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/doc.go new file mode 100644 index 0000000000..d03acb0eed --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2015 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. +*/ + +// Package spdy contains compatibility wrappers for the SPDY transport stack. +// +// Deprecated: use k8s.io/streaming/pkg/httpstream/spdy directly. +package spdy diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/spdy.go b/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/spdy.go new file mode 100644 index 0000000000..37dfe81894 --- /dev/null +++ b/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/spdy.go @@ -0,0 +1,236 @@ +/* +Copyright 2015 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. +*/ + +package spdy + +import ( + "crypto/tls" + "net" + "net/http" + "net/url" + "time" + + apihttpstream "k8s.io/apimachinery/pkg/util/httpstream" + streamhttp "k8s.io/streaming/pkg/httpstream" + streamspdy "k8s.io/streaming/pkg/httpstream/spdy" +) + +const HeaderSpdy31 = streamspdy.HeaderSpdy31 + +// SpdyRoundTripper is a compatibility wrapper around the streaming module's +// SPDY round tripper. +type SpdyRoundTripper struct { + delegate *streamspdy.SpdyRoundTripper +} + +func NewRoundTripper(tlsConfig *tls.Config) (*SpdyRoundTripper, error) { + delegate, err := streamspdy.NewRoundTripper(tlsConfig) + if err != nil { + return nil, err + } + return &SpdyRoundTripper{delegate: delegate}, nil +} + +func NewRoundTripperWithProxy(tlsConfig *tls.Config, proxier func(*http.Request) (*url.URL, error)) (*SpdyRoundTripper, error) { + delegate, err := streamspdy.NewRoundTripperWithProxy(tlsConfig, proxier) + if err != nil { + return nil, err + } + return &SpdyRoundTripper{delegate: delegate}, nil +} + +// RoundTripperConfig is a set of options for an SpdyRoundTripper. +type RoundTripperConfig struct { + // TLS configuration used by the round tripper if UpgradeTransport not present. + TLS *tls.Config + // Proxier is a proxy function invoked on each request. Optional. + Proxier func(*http.Request) (*url.URL, error) + // PingPeriod is a period for sending SPDY Pings on the connection. + // Optional. + PingPeriod time.Duration + // UpgradeTransport is a subtitute transport used for dialing. If set, + // this field will be used instead of "TLS" and "Proxier" for connection creation. + // Optional. + UpgradeTransport http.RoundTripper +} + +func NewRoundTripperWithConfig(cfg RoundTripperConfig) (*SpdyRoundTripper, error) { + delegate, err := streamspdy.NewRoundTripperWithConfig(streamspdy.RoundTripperConfig{ + TLS: cfg.TLS, + Proxier: cfg.Proxier, + PingPeriod: cfg.PingPeriod, + UpgradeTransport: cfg.UpgradeTransport, + }) + if err != nil { + return nil, err + } + return &SpdyRoundTripper{delegate: delegate}, nil +} + +// TLSClientConfig implements pkg/util/net.TLSClientConfigHolder for proper TLS checking during +// proxying with a spdy roundtripper. +func (s *SpdyRoundTripper) TLSClientConfig() *tls.Config { + return s.delegate.TLSClientConfig() +} + +// Dial opens a network connection for an upgrade request. +func (s *SpdyRoundTripper) Dial(req *http.Request) (net.Conn, error) { + return s.delegate.Dial(req) +} + +// RoundTrip executes a request and upgrades the connection. +func (s *SpdyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + return s.delegate.RoundTrip(req) +} + +// NewConnection validates a server upgrade response and prepares the transport. +func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (apihttpstream.Connection, error) { + conn, err := s.delegate.NewConnection(resp) + if err != nil { + return nil, err + } + return wrapConnection(conn), nil +} + +type responseUpgraderAdapter struct { + delegate streamhttp.ResponseUpgrader +} + +func (r *responseUpgraderAdapter) UpgradeResponse(w http.ResponseWriter, req *http.Request, newStreamHandler apihttpstream.NewStreamHandler) apihttpstream.Connection { + conn := r.delegate.UpgradeResponse(w, req, wrapNewStreamHandler(newStreamHandler)) + return wrapConnection(conn) +} + +func NewResponseUpgrader() apihttpstream.ResponseUpgrader { + return &responseUpgraderAdapter{delegate: streamspdy.NewResponseUpgrader()} +} + +func NewResponseUpgraderWithPings(pingPeriod time.Duration) apihttpstream.ResponseUpgrader { + return &responseUpgraderAdapter{delegate: streamspdy.NewResponseUpgraderWithPings(pingPeriod)} +} + +func NewClientConnection(conn net.Conn) (apihttpstream.Connection, error) { + c, err := streamspdy.NewClientConnection(conn) + if err != nil { + return nil, err + } + return wrapConnection(c), nil +} + +func NewClientConnectionWithPings(conn net.Conn, pingPeriod time.Duration) (apihttpstream.Connection, error) { + c, err := streamspdy.NewClientConnectionWithPings(conn, pingPeriod) + if err != nil { + return nil, err + } + return wrapConnection(c), nil +} + +func NewServerConnection(conn net.Conn, newStreamHandler apihttpstream.NewStreamHandler) (apihttpstream.Connection, error) { + c, err := streamspdy.NewServerConnection(conn, wrapNewStreamHandler(newStreamHandler)) + if err != nil { + return nil, err + } + return wrapConnection(c), nil +} + +func NewServerConnectionWithPings(conn net.Conn, newStreamHandler apihttpstream.NewStreamHandler, pingPeriod time.Duration) (apihttpstream.Connection, error) { + c, err := streamspdy.NewServerConnectionWithPings(conn, wrapNewStreamHandler(newStreamHandler), pingPeriod) + if err != nil { + return nil, err + } + return wrapConnection(c), nil +} + +type streamAdapter struct { + delegate streamhttp.Stream +} + +func (s *streamAdapter) Read(p []byte) (int, error) { + return s.delegate.Read(p) +} + +func (s *streamAdapter) Write(p []byte) (int, error) { + return s.delegate.Write(p) +} + +func (s *streamAdapter) Close() error { + return s.delegate.Close() +} + +func (s *streamAdapter) Reset() error { + return s.delegate.Reset() +} + +func (s *streamAdapter) Headers() http.Header { + return s.delegate.Headers() +} + +func (s *streamAdapter) Identifier() uint32 { + return s.delegate.Identifier() +} + +type connectionAdapter struct { + delegate streamhttp.Connection +} + +func (c *connectionAdapter) CreateStream(headers http.Header) (apihttpstream.Stream, error) { + stream, err := c.delegate.CreateStream(headers) + if err != nil { + return nil, err + } + return &streamAdapter{delegate: stream}, nil +} + +func (c *connectionAdapter) Close() error { + return c.delegate.Close() +} + +func (c *connectionAdapter) CloseChan() <-chan bool { + return c.delegate.CloseChan() +} + +func (c *connectionAdapter) SetIdleTimeout(timeout time.Duration) { + c.delegate.SetIdleTimeout(timeout) +} + +func (c *connectionAdapter) RemoveStreams(streams ...apihttpstream.Stream) { + streamingStreams := make([]streamhttp.Stream, 0, len(streams)) + for _, stream := range streams { + if stream == nil { + continue + } + if s, ok := stream.(streamhttp.Stream); ok { + streamingStreams = append(streamingStreams, s) + } + } + c.delegate.RemoveStreams(streamingStreams...) +} + +func wrapConnection(conn streamhttp.Connection) apihttpstream.Connection { + if conn == nil { + return nil + } + return &connectionAdapter{delegate: conn} +} + +func wrapNewStreamHandler(newStreamHandler apihttpstream.NewStreamHandler) streamhttp.NewStreamHandler { + if newStreamHandler == nil { + return nil + } + return func(stream streamhttp.Stream, replySent <-chan struct{}) error { + return newStreamHandler(&streamAdapter{delegate: stream}, replySent) + } +} diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.protomessage.pb.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.protomessage.pb.go deleted file mode 100644 index 2853a01830..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/util/intstr/generated.protomessage.pb.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package intstr - -func (*IntOrString) ProtoMessage() {} diff --git a/vendor/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go b/vendor/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go index 2d6f6a0ccc..494325c1f3 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go +++ b/vendor/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go @@ -1,5 +1,4 @@ //go:build !notest -// +build !notest /* Copyright 2020 The Kubernetes Authors. diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go index aef858b26d..ff7dda1a50 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go +++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go @@ -17,7 +17,6 @@ limitations under the License. package managedfields import ( - "bytes" "fmt" "sigs.k8s.io/structured-merge-diff/v6/fieldpath" @@ -65,7 +64,7 @@ func ExtractInto(object runtime.Object, objectType typed.ParseableType, fieldMan return nil } fieldset := &fieldpath.Set{} - err = fieldset.FromJSON(bytes.NewReader(fieldsEntry.FieldsV1.Raw)) + err = fieldset.FromJSON(fieldsEntry.FieldsV1.GetRawReader()) if err != nil { return fmt.Errorf("error marshalling FieldsV1 to JSON: %w", err) } diff --git a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go index 5c47b9c546..549412b41d 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go +++ b/vendor/k8s.io/apimachinery/pkg/util/managedfields/internal/fields.go @@ -17,8 +17,6 @@ limitations under the License. package internal import ( - "bytes" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/structured-merge-diff/v6/fieldpath" @@ -36,12 +34,13 @@ var EmptyFields = func() metav1.FieldsV1 { // FieldsToSet creates a set paths from an input trie of fields func FieldsToSet(f metav1.FieldsV1) (s fieldpath.Set, err error) { - err = s.FromJSON(bytes.NewReader(f.Raw)) + err = s.FromJSON(f.GetRawReader()) return s, err } // SetToFields creates a trie of fields from an input set of paths func SetToFields(s fieldpath.Set) (f metav1.FieldsV1, err error) { - f.Raw, err = s.ToJSON() + raw, err := s.ToJSON() + f.SetRawBytes(raw) return f, err } diff --git a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go index 25626cf3af..46e3bb75dd 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go +++ b/vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go @@ -20,7 +20,7 @@ import ( "fmt" "reflect" - "k8s.io/apimachinery/pkg/util/dump" + "k8s.io/utils/dump" "sigs.k8s.io/yaml" ) diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/http.go b/vendor/k8s.io/apimachinery/pkg/util/net/http.go index 8cc1810af1..8912804c50 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/net/http.go +++ b/vendor/k8s.io/apimachinery/pkg/util/net/http.go @@ -132,9 +132,11 @@ func SetTransportDefaults(t *http.Transport) *http.Transport { t = SetOldTransportDefaults(t) // Allow clients to disable http2 if needed. if s := os.Getenv("DISABLE_HTTP2"); len(s) > 0 { + //nolint:logcheck // Should be rare, not worth converting. klog.Info("HTTP2 has been explicitly disabled") } else if allowsHTTP2(t) { if err := configureHTTP2Transport(t); err != nil { + //nolint:logcheck // Should be rare, not worth converting. klog.Warningf("Transport failed http2 configuration: %v", err) } } @@ -148,6 +150,7 @@ func readIdleTimeoutSeconds() int { if s := os.Getenv("HTTP2_READ_IDLE_TIMEOUT_SECONDS"); len(s) > 0 { i, err := strconv.Atoi(s) if err != nil { + //nolint:logcheck // Should be rare, not worth converting. klog.Warningf("Illegal HTTP2_READ_IDLE_TIMEOUT_SECONDS(%q): %v."+ " Default value %d is used", s, err, ret) return ret @@ -162,6 +165,7 @@ func pingTimeoutSeconds() int { if s := os.Getenv("HTTP2_PING_TIMEOUT_SECONDS"); len(s) > 0 { i, err := strconv.Atoi(s) if err != nil { + //nolint:logcheck // Should be rare, not worth converting. klog.Warningf("Illegal HTTP2_PING_TIMEOUT_SECONDS(%q): %v."+ " Default value %d is used", s, err, ret) return ret @@ -256,6 +260,7 @@ func CloseIdleConnectionsFor(transport http.RoundTripper) { case RoundTripperWrapper: CloseIdleConnectionsFor(transport.WrappedRoundTripper()) default: + //nolint:logcheck // Should be rare, not worth converting. klog.Warningf("unknown transport type: %T", transport) } } diff --git a/vendor/k8s.io/apimachinery/pkg/util/net/interface.go b/vendor/k8s.io/apimachinery/pkg/util/net/interface.go index 01d028e727..3ccf227af0 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/net/interface.go +++ b/vendor/k8s.io/apimachinery/pkg/util/net/interface.go @@ -201,12 +201,12 @@ func parseIP(str string, family AddressFamily) (net.IP, error) { return net.IP(bytes), nil } -func isInterfaceUp(intf *net.Interface) bool { +func isInterfaceUp(logger klog.Logger, intf *net.Interface) bool { if intf == nil { return false } if intf.Flags&net.FlagUp != 0 { - klog.V(4).Infof("Interface %v is up", intf.Name) + logger.V(4).Info("Interface is up", "interface", intf.Name) return true } return false @@ -218,23 +218,23 @@ func isLoopbackOrPointToPoint(intf *net.Interface) bool { // getMatchingGlobalIP returns the first valid global unicast address of the given // 'family' from the list of 'addrs'. -func getMatchingGlobalIP(addrs []net.Addr, family AddressFamily) (net.IP, error) { +func getMatchingGlobalIP(logger klog.Logger, addrs []net.Addr, family AddressFamily) (net.IP, error) { if len(addrs) > 0 { for i := range addrs { - klog.V(4).Infof("Checking addr %s.", addrs[i].String()) + logger.V(4).Info("Checking for matching global IP", "address", addrs[i]) ip, _, err := netutils.ParseCIDRSloppy(addrs[i].String()) if err != nil { return nil, err } if memberOf(ip, family) { if ip.IsGlobalUnicast() { - klog.V(4).Infof("IP found %v", ip) + logger.V(4).Info("IP found", "IP", ip) return ip, nil } else { - klog.V(4).Infof("Non-global unicast address found %v", ip) + logger.V(4).Info("Non-global unicast address found", "IP", ip) } } else { - klog.V(4).Infof("%v is not an IPv%d address", ip, int(family)) + logger.V(4).Info("IP address has wrong version", "IP", ip, "IPVersion", int(family)) } } @@ -244,23 +244,23 @@ func getMatchingGlobalIP(addrs []net.Addr, family AddressFamily) (net.IP, error) // getIPFromInterface gets the IPs on an interface and returns a global unicast address, if any. The // interface must be up, the IP must in the family requested, and the IP must be a global unicast address. -func getIPFromInterface(intfName string, forFamily AddressFamily, nw networkInterfacer) (net.IP, error) { +func getIPFromInterface(logger klog.Logger, intfName string, forFamily AddressFamily, nw networkInterfacer) (net.IP, error) { intf, err := nw.InterfaceByName(intfName) if err != nil { return nil, err } - if isInterfaceUp(intf) { + if isInterfaceUp(logger, intf) { addrs, err := nw.Addrs(intf) if err != nil { return nil, err } - klog.V(4).Infof("Interface %q has %d addresses :%v.", intfName, len(addrs), addrs) - matchingIP, err := getMatchingGlobalIP(addrs, forFamily) + logger.V(4).Info("Found addresses for interface", "interface", intfName, "numAddresses", len(addrs), "addresses", addrs) + matchingIP, err := getMatchingGlobalIP(logger, addrs, forFamily) if err != nil { return nil, err } if matchingIP != nil { - klog.V(4).Infof("Found valid IPv%d address %v for interface %q.", int(forFamily), matchingIP, intfName) + logger.V(4).Info("Found valid address", "IPVersion", int(forFamily), "IP", matchingIP, "interface", intfName) return matchingIP, nil } } @@ -269,13 +269,13 @@ func getIPFromInterface(intfName string, forFamily AddressFamily, nw networkInte // getIPFromLoopbackInterface gets the IPs on a loopback interface and returns a global unicast address, if any. // The loopback interface must be up, the IP must in the family requested, and the IP must be a global unicast address. -func getIPFromLoopbackInterface(forFamily AddressFamily, nw networkInterfacer) (net.IP, error) { +func getIPFromLoopbackInterface(logger klog.Logger, forFamily AddressFamily, nw networkInterfacer) (net.IP, error) { intfs, err := nw.Interfaces() if err != nil { return nil, err } for _, intf := range intfs { - if !isInterfaceUp(&intf) { + if !isInterfaceUp(logger, &intf) { continue } if intf.Flags&(net.FlagLoopback) != 0 { @@ -283,13 +283,13 @@ func getIPFromLoopbackInterface(forFamily AddressFamily, nw networkInterfacer) ( if err != nil { return nil, err } - klog.V(4).Infof("Interface %q has %d addresses :%v.", intf.Name, len(addrs), addrs) - matchingIP, err := getMatchingGlobalIP(addrs, forFamily) + logger.V(4).Info("Found addresses for interface", "interface", intf.Name, "numAddresses", len(addrs), "addresses", addrs) + matchingIP, err := getMatchingGlobalIP(logger, addrs, forFamily) if err != nil { return nil, err } if matchingIP != nil { - klog.V(4).Infof("Found valid IPv%d address %v for interface %q.", int(forFamily), matchingIP, intf.Name) + logger.V(4).Info("Found valid address", "IPVersion", int(forFamily), "IP", matchingIP, "interface", intf.Name) return matchingIP, nil } } @@ -309,7 +309,7 @@ func memberOf(ip net.IP, family AddressFamily) bool { // chooseIPFromHostInterfaces looks at all system interfaces, trying to find one that is up that // has a global unicast address (non-loopback, non-link local, non-point2point), and returns the IP. // addressFamilies determines whether it prefers IPv4 or IPv6 -func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFamilyPreference) (net.IP, error) { +func chooseIPFromHostInterfaces(logger klog.Logger, nw networkInterfacer, addressFamilies AddressFamilyPreference) (net.IP, error) { intfs, err := nw.Interfaces() if err != nil { return nil, err @@ -318,14 +318,14 @@ func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFam return nil, fmt.Errorf("no interfaces found on host.") } for _, family := range addressFamilies { - klog.V(4).Infof("Looking for system interface with a global IPv%d address", uint(family)) + logger.V(4).Info("Looking for system interface with a global address", "IPVersion", uint(family)) for _, intf := range intfs { - if !isInterfaceUp(&intf) { - klog.V(4).Infof("Skipping: down interface %q", intf.Name) + if !isInterfaceUp(logger, &intf) { + logger.V(4).Info("Skipping: interface is down", "interface", intf.Name) continue } if isLoopbackOrPointToPoint(&intf) { - klog.V(4).Infof("Skipping: LB or P2P interface %q", intf.Name) + logger.V(4).Info("Skipping: is LB or P2P", "interface", intf.Name) continue } addrs, err := nw.Addrs(&intf) @@ -333,7 +333,7 @@ func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFam return nil, err } if len(addrs) == 0 { - klog.V(4).Infof("Skipping: no addresses on interface %q", intf.Name) + logger.V(4).Info("Skipping: no addresses", "interface", intf.Name) continue } for _, addr := range addrs { @@ -342,15 +342,15 @@ func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFam return nil, fmt.Errorf("unable to parse CIDR for interface %q: %s", intf.Name, err) } if !memberOf(ip, family) { - klog.V(4).Infof("Skipping: no address family match for %q on interface %q.", ip, intf.Name) + logger.V(4).Info("Skipping: no address family match", "IP", ip, "interface", intf.Name) continue } // TODO: Decide if should open up to allow IPv6 LLAs in future. if !ip.IsGlobalUnicast() { - klog.V(4).Infof("Skipping: non-global address %q on interface %q.", ip, intf.Name) + logger.V(4).Info("Skipping: non-global address", "IP", ip, "interface", intf.Name) continue } - klog.V(4).Infof("Found global unicast address %q on interface %q.", ip, intf.Name) + logger.V(4).Info("Found global unicast address", "IP", ip, "interface", intf.Name) return ip, nil } } @@ -363,20 +363,31 @@ func chooseIPFromHostInterfaces(nw networkInterfacer, addressFamilies AddressFam // interfaces. Otherwise, it will use IPv4 and IPv6 route information to return the // IP of the interface with a gateway on it (with priority given to IPv4). For a node // with no internet connection, it returns error. +// +//logcheck:context // [ChooseHostInterfaceWithLogger] should be used instead of ChooseHostInterface in code which supports contextual logging. func ChooseHostInterface() (net.IP, error) { - return chooseHostInterface(preferIPv4) + return ChooseHostInterfaceWithLogger(klog.Background()) } -func chooseHostInterface(addressFamilies AddressFamilyPreference) (net.IP, error) { +// ChooseHostInterfaceWithLogger is a method used fetch an IP for a daemon. +// If there is no routing info file, it will choose a global IP from the system +// interfaces. Otherwise, it will use IPv4 and IPv6 route information to return the +// IP of the interface with a gateway on it (with priority given to IPv4). For a node +// with no internet connection, it returns error. +func ChooseHostInterfaceWithLogger(logger klog.Logger) (net.IP, error) { + return chooseHostInterface(logger, preferIPv4) +} + +func chooseHostInterface(logger klog.Logger, addressFamilies AddressFamilyPreference) (net.IP, error) { var nw networkInterfacer = networkInterface{} if _, err := os.Stat(ipv4RouteFile); os.IsNotExist(err) { - return chooseIPFromHostInterfaces(nw, addressFamilies) + return chooseIPFromHostInterfaces(logger, nw, addressFamilies) } routes, err := getAllDefaultRoutes() if err != nil { return nil, err } - return chooseHostInterfaceFromRoute(routes, nw, addressFamilies) + return chooseHostInterfaceFromRoute(logger, routes, nw, addressFamilies) } // networkInterfacer defines an interface for several net library functions. Production @@ -427,36 +438,36 @@ func getAllDefaultRoutes() ([]Route, error) { // global IP address from the interface for the route. If there are routes but no global // address is obtained from the interfaces, it checks if the loopback interface has a global address. // addressFamilies determines whether it prefers IPv4 or IPv6 -func chooseHostInterfaceFromRoute(routes []Route, nw networkInterfacer, addressFamilies AddressFamilyPreference) (net.IP, error) { +func chooseHostInterfaceFromRoute(logger klog.Logger, routes []Route, nw networkInterfacer, addressFamilies AddressFamilyPreference) (net.IP, error) { for _, family := range addressFamilies { - klog.V(4).Infof("Looking for default routes with IPv%d addresses", uint(family)) + logger.V(4).Info("Looking for default routes with IP addresses", "IPVersion", uint(family)) for _, route := range routes { if route.Family != family { continue } - klog.V(4).Infof("Default route transits interface %q", route.Interface) - finalIP, err := getIPFromInterface(route.Interface, family, nw) + logger.V(4).Info("Default route transits interface", "interface", route.Interface) + finalIP, err := getIPFromInterface(logger, route.Interface, family, nw) if err != nil { return nil, err } if finalIP != nil { - klog.V(4).Infof("Found active IP %v ", finalIP) + logger.V(4).Info("Found active IP", "IP", finalIP) return finalIP, nil } // In case of network setups where default routes are present, but network // interfaces use only link-local addresses (e.g. as described in RFC5549). // the global IP is assigned to the loopback interface, and we should use it - loopbackIP, err := getIPFromLoopbackInterface(family, nw) + loopbackIP, err := getIPFromLoopbackInterface(logger, family, nw) if err != nil { return nil, err } if loopbackIP != nil { - klog.V(4).Infof("Found active IP %v on Loopback interface", loopbackIP) + logger.V(4).Info("Found active IP on Loopback interface", "IP", loopbackIP) return loopbackIP, nil } } } - klog.V(4).Infof("No active IP found by looking at default routes") + logger.V(4).Info("No active IP found by looking at default routes") return nil, fmt.Errorf("unable to select an IP from default routes.") } @@ -465,14 +476,25 @@ func chooseHostInterfaceFromRoute(routes []Route, nw networkInterfacer, addressF // If bindAddress is unspecified or loopback, it returns the default IP of the same // address family as bindAddress. // Otherwise, it just returns bindAddress. +// +//logcheck:context // [ResolveBindAddressWithLogger] should be used instead of ResolveBindAddress in code which supports contextual logging. func ResolveBindAddress(bindAddress net.IP) (net.IP, error) { + return ResolveBindAddressWithLogger(klog.Background(), bindAddress) +} + +// ResolveBindAddressWithLogger returns the IP address of a daemon, based on the given bindAddress: +// If bindAddress is unset, it returns the host's default IP, as with ChooseHostInterface(). +// If bindAddress is unspecified or loopback, it returns the default IP of the same +// address family as bindAddress. +// Otherwise, it just returns bindAddress. +func ResolveBindAddressWithLogger(logger klog.Logger, bindAddress net.IP) (net.IP, error) { addressFamilies := preferIPv4 if bindAddress != nil && memberOf(bindAddress, familyIPv6) { addressFamilies = preferIPv6 } if bindAddress == nil || bindAddress.IsUnspecified() || bindAddress.IsLoopback() { - hostIP, err := chooseHostInterface(addressFamilies) + hostIP, err := chooseHostInterface(logger, addressFamilies) if err != nil { return nil, err } @@ -485,10 +507,20 @@ func ResolveBindAddress(bindAddress net.IP) (net.IP, error) { // This is required in case of network setups where default routes are present, but network // interfaces use only link-local addresses (e.g. as described in RFC5549). // e.g when using BGP to announce a host IP over link-local ip addresses and this ip address is attached to the lo interface. +// +//logcheck:context // [ChooseBindAddressForInterfaceWithLogger] should be used instead of ChooseBindAddressForInterface in code which supports contextual logging. func ChooseBindAddressForInterface(intfName string) (net.IP, error) { + return ChooseBindAddressForInterfaceWithLogger(klog.Background(), intfName) +} + +// ChooseBindAddressForInterfaceWithLogger choose a global IP for a specific interface, with priority given to IPv4. +// This is required in case of network setups where default routes are present, but network +// interfaces use only link-local addresses (e.g. as described in RFC5549). +// e.g when using BGP to announce a host IP over link-local ip addresses and this ip address is attached to the lo interface. +func ChooseBindAddressForInterfaceWithLogger(logger klog.Logger, intfName string) (net.IP, error) { var nw networkInterfacer = networkInterface{} for _, family := range preferIPv4 { - ip, err := getIPFromInterface(intfName, family, nw) + ip, err := getIPFromInterface(logger, intfName, family, nw) if err != nil { return nil, err } diff --git a/vendor/k8s.io/apimachinery/pkg/util/proxy/dial.go b/vendor/k8s.io/apimachinery/pkg/util/proxy/dial.go deleted file mode 100644 index e5196d1ee8..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/util/proxy/dial.go +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2015 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. -*/ - -package proxy - -import ( - "context" - "crypto/tls" - "fmt" - "net" - "net/http" - "net/url" - - utilnet "k8s.io/apimachinery/pkg/util/net" - "k8s.io/apimachinery/third_party/forked/golang/netutil" - "k8s.io/klog/v2" -) - -// DialURL will dial the specified URL using the underlying dialer held by the passed -// RoundTripper. The primary use of this method is to support proxying upgradable connections. -// For this reason this method will prefer to negotiate http/1.1 if the URL scheme is https. -// If you wish to ensure ALPN negotiates http2 then set NextProto=[]string{"http2"} in the -// TLSConfig of the http.Transport -func DialURL(ctx context.Context, url *url.URL, transport http.RoundTripper) (net.Conn, error) { - dialAddr := netutil.CanonicalAddr(url) - - dialer, err := utilnet.DialerFor(transport) - if err != nil { - klog.V(5).Infof("Unable to unwrap transport %T to get dialer: %v", transport, err) - } - - switch url.Scheme { - case "http": - if dialer != nil { - return dialer(ctx, "tcp", dialAddr) - } - var d net.Dialer - return d.DialContext(ctx, "tcp", dialAddr) - case "https": - // Get the tls config from the transport if we recognize it - tlsConfig, err := utilnet.TLSClientConfig(transport) - if err != nil { - klog.V(5).Infof("Unable to unwrap transport %T to get at TLS config: %v", transport, err) - } - - if dialer != nil { - // We have a dialer; use it to open the connection, then - // create a tls client using the connection. - netConn, err := dialer(ctx, "tcp", dialAddr) - if err != nil { - return nil, err - } - if tlsConfig == nil { - // tls.Client requires non-nil config - klog.Warning("using custom dialer with no TLSClientConfig. Defaulting to InsecureSkipVerify") - // tls.Handshake() requires ServerName or InsecureSkipVerify - tlsConfig = &tls.Config{ - InsecureSkipVerify: true, - } - } else if len(tlsConfig.ServerName) == 0 && !tlsConfig.InsecureSkipVerify { - // tls.HandshakeContext() requires ServerName or InsecureSkipVerify - // infer the ServerName from the hostname we're connecting to. - inferredHost := dialAddr - if host, _, err := net.SplitHostPort(dialAddr); err == nil { - inferredHost = host - } - // Make a copy to avoid polluting the provided config - tlsConfigCopy := tlsConfig.Clone() - tlsConfigCopy.ServerName = inferredHost - tlsConfig = tlsConfigCopy - } - - // Since this method is primarily used within a "Connection: Upgrade" call we assume the caller is - // going to write HTTP/1.1 request to the wire. http2 should not be allowed in the TLSConfig.NextProtos, - // so we explicitly set that here. We only do this check if the TLSConfig support http/1.1. - if supportsHTTP11(tlsConfig.NextProtos) { - tlsConfig = tlsConfig.Clone() - tlsConfig.NextProtos = []string{"http/1.1"} - } - - tlsConn := tls.Client(netConn, tlsConfig) - if err := tlsConn.HandshakeContext(ctx); err != nil { - netConn.Close() - return nil, err - } - return tlsConn, nil - } else { - // Dial. - tlsDialer := tls.Dialer{ - Config: tlsConfig, - } - return tlsDialer.DialContext(ctx, "tcp", dialAddr) - } - default: - return nil, fmt.Errorf("unknown scheme: %s", url.Scheme) - } -} - -func supportsHTTP11(nextProtos []string) bool { - if len(nextProtos) == 0 { - return true - } - for _, proto := range nextProtos { - if proto == "http/1.1" { - return true - } - } - return false -} diff --git a/vendor/k8s.io/apimachinery/pkg/util/proxy/transport.go b/vendor/k8s.io/apimachinery/pkg/util/proxy/transport.go deleted file mode 100644 index 5a2dd6e14c..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/util/proxy/transport.go +++ /dev/null @@ -1,272 +0,0 @@ -/* -Copyright 2014 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. -*/ - -package proxy - -import ( - "bytes" - "compress/flate" - "compress/gzip" - "fmt" - "io" - "net/http" - "net/url" - "path" - "strings" - - "golang.org/x/net/html" - "golang.org/x/net/html/atom" - "k8s.io/klog/v2" - - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/util/net" - "k8s.io/apimachinery/pkg/util/sets" -) - -// atomsToAttrs states which attributes of which tags require URL substitution. -// Sources: http://www.w3.org/TR/REC-html40/index/attributes.html -// -// http://www.w3.org/html/wg/drafts/html/master/index.html#attributes-1 -var atomsToAttrs = map[atom.Atom]sets.String{ - atom.A: sets.NewString("href"), - atom.Applet: sets.NewString("codebase"), - atom.Area: sets.NewString("href"), - atom.Audio: sets.NewString("src"), - atom.Base: sets.NewString("href"), - atom.Blockquote: sets.NewString("cite"), - atom.Body: sets.NewString("background"), - atom.Button: sets.NewString("formaction"), - atom.Command: sets.NewString("icon"), - atom.Del: sets.NewString("cite"), - atom.Embed: sets.NewString("src"), - atom.Form: sets.NewString("action"), - atom.Frame: sets.NewString("longdesc", "src"), - atom.Head: sets.NewString("profile"), - atom.Html: sets.NewString("manifest"), - atom.Iframe: sets.NewString("longdesc", "src"), - atom.Img: sets.NewString("longdesc", "src", "usemap"), - atom.Input: sets.NewString("src", "usemap", "formaction"), - atom.Ins: sets.NewString("cite"), - atom.Link: sets.NewString("href"), - atom.Object: sets.NewString("classid", "codebase", "data", "usemap"), - atom.Q: sets.NewString("cite"), - atom.Script: sets.NewString("src"), - atom.Source: sets.NewString("src"), - atom.Video: sets.NewString("poster", "src"), - - // TODO: css URLs hidden in style elements. -} - -// Transport is a transport for text/html content that replaces URLs in html -// content with the prefix of the proxy server -type Transport struct { - Scheme string - Host string - PathPrepend string - - http.RoundTripper -} - -// RoundTrip implements the http.RoundTripper interface -func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) { - // Add reverse proxy headers. - forwardedURI := path.Join(t.PathPrepend, req.URL.EscapedPath()) - if strings.HasSuffix(req.URL.Path, "/") { - forwardedURI = forwardedURI + "/" - } - req.Header.Set("X-Forwarded-Uri", forwardedURI) - if len(t.Host) > 0 { - req.Header.Set("X-Forwarded-Host", t.Host) - } - if len(t.Scheme) > 0 { - req.Header.Set("X-Forwarded-Proto", t.Scheme) - } - - rt := t.RoundTripper - if rt == nil { - rt = http.DefaultTransport - } - resp, err := rt.RoundTrip(req) - - if err != nil { - return nil, errors.NewServiceUnavailable(fmt.Sprintf("error trying to reach service: %v", err)) - } - - if redirect := resp.Header.Get("Location"); redirect != "" { - targetURL, err := url.Parse(redirect) - if err != nil { - return nil, errors.NewInternalError(fmt.Errorf("error trying to parse Location header: %v", err)) - } - resp.Header.Set("Location", t.rewriteURL(targetURL, req.URL, req.Host)) - return resp, nil - } - - cType := resp.Header.Get("Content-Type") - cType = strings.TrimSpace(strings.SplitN(cType, ";", 2)[0]) - if cType != "text/html" { - // Do nothing, simply pass through - return resp, nil - } - - return t.rewriteResponse(req, resp) -} - -var _ = net.RoundTripperWrapper(&Transport{}) - -func (rt *Transport) WrappedRoundTripper() http.RoundTripper { - return rt.RoundTripper -} - -// rewriteURL rewrites a single URL to go through the proxy, if the URL refers -// to the same host as sourceURL, which is the page on which the target URL -// occurred, or if the URL matches the sourceRequestHost. -func (t *Transport) rewriteURL(url *url.URL, sourceURL *url.URL, sourceRequestHost string) string { - // Example: - // When API server processes a proxy request to a service (e.g. /api/v1/namespace/foo/service/bar/proxy/), - // the sourceURL.Host (i.e. req.URL.Host) is the endpoint IP address of the service. The - // sourceRequestHost (i.e. req.Host) is the Host header that specifies the host on which the - // URL is sought, which can be different from sourceURL.Host. For example, if user sends the - // request through "kubectl proxy" locally (i.e. localhost:8001/api/v1/namespace/foo/service/bar/proxy/), - // sourceRequestHost is "localhost:8001". - // - // If the service's response URL contains non-empty host, and url.Host is equal to either sourceURL.Host - // or sourceRequestHost, we should not consider the returned URL to be a completely different host. - // It's the API server's responsibility to rewrite a same-host-and-absolute-path URL and append the - // necessary URL prefix (i.e. /api/v1/namespace/foo/service/bar/proxy/). - isDifferentHost := url.Host != "" && url.Host != sourceURL.Host && url.Host != sourceRequestHost - isRelative := !strings.HasPrefix(url.Path, "/") - if isDifferentHost || isRelative { - return url.String() - } - - // Do not rewrite scheme and host if the Transport has empty scheme and host - // when targetURL already contains the sourceRequestHost - if !(url.Host == sourceRequestHost && t.Scheme == "" && t.Host == "") { - url.Scheme = t.Scheme - url.Host = t.Host - } - - origPath := url.Path - // Do not rewrite URL if the sourceURL already contains the necessary prefix. - if strings.HasPrefix(url.Path, t.PathPrepend) { - return url.String() - } - url.Path = path.Join(t.PathPrepend, url.Path) - if strings.HasSuffix(origPath, "/") { - // Add back the trailing slash, which was stripped by path.Join(). - url.Path += "/" - } - - return url.String() -} - -// rewriteHTML scans the HTML for tags with url-valued attributes, and updates -// those values with the urlRewriter function. The updated HTML is output to the -// writer. -func rewriteHTML(reader io.Reader, writer io.Writer, urlRewriter func(*url.URL) string) error { - // Note: This assumes the content is UTF-8. - tokenizer := html.NewTokenizer(reader) - - var err error - for err == nil { - tokenType := tokenizer.Next() - switch tokenType { - case html.ErrorToken: - err = tokenizer.Err() - case html.StartTagToken, html.SelfClosingTagToken: - token := tokenizer.Token() - if urlAttrs, ok := atomsToAttrs[token.DataAtom]; ok { - for i, attr := range token.Attr { - if urlAttrs.Has(attr.Key) { - url, err := url.Parse(attr.Val) - if err != nil { - // Do not rewrite the URL if it isn't valid. It is intended not - // to error here to prevent the inability to understand the - // content of the body to cause a fatal error. - continue - } - token.Attr[i].Val = urlRewriter(url) - } - } - } - _, err = writer.Write([]byte(token.String())) - default: - _, err = writer.Write(tokenizer.Raw()) - } - } - if err != io.EOF { - return err - } - return nil -} - -// rewriteResponse modifies an HTML response by updating absolute links referring -// to the original host to instead refer to the proxy transport. -func (t *Transport) rewriteResponse(req *http.Request, resp *http.Response) (*http.Response, error) { - origBody := resp.Body - defer origBody.Close() - - newContent := &bytes.Buffer{} - var reader io.Reader = origBody - var writer io.Writer = newContent - encoding := resp.Header.Get("Content-Encoding") - switch encoding { - case "gzip": - var err error - reader, err = gzip.NewReader(reader) - if err != nil { - return nil, fmt.Errorf("errorf making gzip reader: %v", err) - } - gzw := gzip.NewWriter(writer) - defer gzw.Close() - writer = gzw - case "deflate": - var err error - reader = flate.NewReader(reader) - flw, err := flate.NewWriter(writer, flate.BestCompression) - if err != nil { - return nil, fmt.Errorf("errorf making flate writer: %v", err) - } - defer func() { - flw.Close() - flw.Flush() - }() - writer = flw - case "": - // This is fine - default: - // Some encoding we don't understand-- don't try to parse this - klog.Errorf("Proxy encountered encoding %v for text/html; can't understand this so not fixing links.", encoding) - return resp, nil - } - - urlRewriter := func(targetUrl *url.URL) string { - return t.rewriteURL(targetUrl, req.URL, req.Host) - } - err := rewriteHTML(reader, writer, urlRewriter) - if err != nil { - klog.Errorf("Failed to rewrite URLs: %v", err) - return resp, err - } - - resp.Body = io.NopCloser(newContent) - // Update header node with new content-length - // TODO: Remove any hash/signature headers here? - resp.Header.Del("Content-Length") - resp.ContentLength = int64(newContent.Len()) - - return resp, err -} diff --git a/vendor/k8s.io/apimachinery/pkg/util/proxy/upgradeaware.go b/vendor/k8s.io/apimachinery/pkg/util/proxy/upgradeaware.go deleted file mode 100644 index 8c30a366de..0000000000 --- a/vendor/k8s.io/apimachinery/pkg/util/proxy/upgradeaware.go +++ /dev/null @@ -1,558 +0,0 @@ -/* -Copyright 2017 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. -*/ - -package proxy - -import ( - "bufio" - "bytes" - "fmt" - "io" - "log" - "net" - "net/http" - "net/http/httputil" - "net/url" - "os" - "strings" - "time" - - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/util/httpstream" - utilnet "k8s.io/apimachinery/pkg/util/net" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - - "github.com/mxk/go-flowrate/flowrate" - - "k8s.io/klog/v2" -) - -// UpgradeRequestRoundTripper provides an additional method to decorate a request -// with any authentication or other protocol level information prior to performing -// an upgrade on the server. Any response will be handled by the intercepting -// proxy. -type UpgradeRequestRoundTripper interface { - http.RoundTripper - // WrapRequest takes a valid HTTP request and returns a suitably altered version - // of request with any HTTP level values required to complete the request half of - // an upgrade on the server. It does not get a chance to see the response and - // should bypass any request side logic that expects to see the response. - WrapRequest(*http.Request) (*http.Request, error) -} - -// UpgradeAwareHandler is a handler for proxy requests that may require an upgrade -type UpgradeAwareHandler struct { - // UpgradeRequired will reject non-upgrade connections if true. - UpgradeRequired bool - // Location is the location of the upstream proxy. It is used as the location to Dial on the upstream server - // for upgrade requests unless UseRequestLocationOnUpgrade is true. - Location *url.URL - // AppendLocationPath determines if the original path of the Location should be appended to the upstream proxy request path - AppendLocationPath bool - // Transport provides an optional round tripper to use to proxy. If nil, the default proxy transport is used - Transport http.RoundTripper - // UpgradeTransport, if specified, will be used as the backend transport when upgrade requests are provided. - // This allows clients to disable HTTP/2. - UpgradeTransport UpgradeRequestRoundTripper - // WrapTransport indicates whether the provided Transport should be wrapped with default proxy transport behavior (URL rewriting, X-Forwarded-* header setting) - WrapTransport bool - // UseRequestLocation will use the incoming request URL when talking to the backend server. - UseRequestLocation bool - // UseLocationHost overrides the HTTP host header in requests to the backend server to use the Host from Location. - // This will override the req.Host field of a request, while UseRequestLocation will override the req.URL field - // of a request. The req.URL.Host specifies the server to connect to, while the req.Host field - // specifies the Host header value to send in the HTTP request. If this is false, the incoming req.Host header will - // just be forwarded to the backend server. - UseLocationHost bool - // FlushInterval controls how often the standard HTTP proxy will flush content from the upstream. - FlushInterval time.Duration - // MaxBytesPerSec controls the maximum rate for an upstream connection. No rate is imposed if the value is zero. - MaxBytesPerSec int64 - // Responder is passed errors that occur while setting up proxying. - Responder ErrorResponder - // Reject to forward redirect response - RejectForwardingRedirects bool -} - -const defaultFlushInterval = 200 * time.Millisecond - -// ErrorResponder abstracts error reporting to the proxy handler to remove the need to hardcode a particular -// error format. -type ErrorResponder interface { - Error(w http.ResponseWriter, req *http.Request, err error) -} - -// SimpleErrorResponder is the legacy implementation of ErrorResponder for callers that only -// service a single request/response per proxy. -type SimpleErrorResponder interface { - Error(err error) -} - -func NewErrorResponder(r SimpleErrorResponder) ErrorResponder { - return simpleResponder{r} -} - -type simpleResponder struct { - responder SimpleErrorResponder -} - -func (r simpleResponder) Error(w http.ResponseWriter, req *http.Request, err error) { - r.responder.Error(err) -} - -// upgradeRequestRoundTripper implements proxy.UpgradeRequestRoundTripper. -type upgradeRequestRoundTripper struct { - http.RoundTripper - upgrader http.RoundTripper -} - -var ( - _ UpgradeRequestRoundTripper = &upgradeRequestRoundTripper{} - _ utilnet.RoundTripperWrapper = &upgradeRequestRoundTripper{} -) - -// WrappedRoundTripper returns the round tripper that a caller would use. -func (rt *upgradeRequestRoundTripper) WrappedRoundTripper() http.RoundTripper { - return rt.RoundTripper -} - -// WriteToRequest calls the nested upgrader and then copies the returned request -// fields onto the passed request. -func (rt *upgradeRequestRoundTripper) WrapRequest(req *http.Request) (*http.Request, error) { - resp, err := rt.upgrader.RoundTrip(req) - if err != nil { - return nil, err - } - return resp.Request, nil -} - -// onewayRoundTripper captures the provided request - which is assumed to have -// been modified by other round trippers - and then returns a fake response. -type onewayRoundTripper struct{} - -// RoundTrip returns a simple 200 OK response that captures the provided request. -func (onewayRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - return &http.Response{ - Status: "200 OK", - StatusCode: http.StatusOK, - Body: io.NopCloser(&bytes.Buffer{}), - Request: req, - }, nil -} - -// MirrorRequest is a round tripper that can be called to get back the calling request as -// the core round tripper in a chain. -var MirrorRequest http.RoundTripper = onewayRoundTripper{} - -// NewUpgradeRequestRoundTripper takes two round trippers - one for the underlying TCP connection, and -// one that is able to write headers to an HTTP request. The request rt is used to set the request headers -// and that is written to the underlying connection rt. -func NewUpgradeRequestRoundTripper(connection, request http.RoundTripper) UpgradeRequestRoundTripper { - return &upgradeRequestRoundTripper{ - RoundTripper: connection, - upgrader: request, - } -} - -// normalizeLocation returns the result of parsing the full URL, with scheme set to http if missing -func normalizeLocation(location *url.URL) *url.URL { - normalized, _ := url.Parse(location.String()) - if len(normalized.Scheme) == 0 { - normalized.Scheme = "http" - } - return normalized -} - -// NewUpgradeAwareHandler creates a new proxy handler with a default flush interval. Responder is required for returning -// errors to the caller. -func NewUpgradeAwareHandler(location *url.URL, transport http.RoundTripper, wrapTransport, upgradeRequired bool, responder ErrorResponder) *UpgradeAwareHandler { - return &UpgradeAwareHandler{ - Location: normalizeLocation(location), - Transport: transport, - WrapTransport: wrapTransport, - UpgradeRequired: upgradeRequired, - FlushInterval: defaultFlushInterval, - Responder: responder, - } -} - -func proxyRedirectsforRootPath(path string, w http.ResponseWriter, req *http.Request) bool { - redirect := false - method := req.Method - - // From pkg/genericapiserver/endpoints/handlers/proxy.go#ServeHTTP: - // Redirect requests with an empty path to a location that ends with a '/' - // This is essentially a hack for https://issue.k8s.io/4958. - // Note: Keep this code after tryUpgrade to not break that flow. - if len(path) == 0 && (method == http.MethodGet || method == http.MethodHead) { - var queryPart string - if len(req.URL.RawQuery) > 0 { - queryPart = "?" + req.URL.RawQuery - } - w.Header().Set("Location", req.URL.Path+"/"+queryPart) - w.WriteHeader(http.StatusMovedPermanently) - redirect = true - } - return redirect -} - -// ServeHTTP handles the proxy request -func (h *UpgradeAwareHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { - if h.tryUpgrade(w, req) { - return - } - if h.UpgradeRequired { - h.Responder.Error(w, req, errors.NewBadRequest("Upgrade request required")) - return - } - - loc := *h.Location - loc.RawQuery = req.URL.RawQuery - - // If original request URL ended in '/', append a '/' at the end of the - // of the proxy URL - if !strings.HasSuffix(loc.Path, "/") && strings.HasSuffix(req.URL.Path, "/") { - loc.Path += "/" - } - - proxyRedirect := proxyRedirectsforRootPath(loc.Path, w, req) - if proxyRedirect { - return - } - - if h.Transport == nil || h.WrapTransport { - h.Transport = h.defaultProxyTransport(req.URL, h.Transport) - } - - // WithContext creates a shallow clone of the request with the same context. - newReq := req.WithContext(req.Context()) - newReq.Header = utilnet.CloneHeader(req.Header) - if !h.UseRequestLocation { - newReq.URL = &loc - } - if h.UseLocationHost { - // exchanging req.Host with the backend location is necessary for backends that act on the HTTP host header (e.g. API gateways), - // because req.Host has preference over req.URL.Host in filling this header field - newReq.Host = h.Location.Host - } - - // create the target location to use for the reverse proxy - reverseProxyLocation := &url.URL{Scheme: h.Location.Scheme, Host: h.Location.Host} - if h.AppendLocationPath { - reverseProxyLocation.Path = h.Location.Path - } - - proxy := httputil.NewSingleHostReverseProxy(reverseProxyLocation) - proxy.Transport = h.Transport - proxy.FlushInterval = h.FlushInterval - proxy.ErrorLog = log.New(noSuppressPanicError{}, "", log.LstdFlags) - if h.RejectForwardingRedirects { - oldModifyResponse := proxy.ModifyResponse - proxy.ModifyResponse = func(response *http.Response) error { - code := response.StatusCode - if code >= 300 && code <= 399 && len(response.Header.Get("Location")) > 0 { - // close the original response - response.Body.Close() - msg := "the backend attempted to redirect this request, which is not permitted" - // replace the response - *response = http.Response{ - StatusCode: http.StatusBadGateway, - Status: fmt.Sprintf("%d %s", response.StatusCode, http.StatusText(response.StatusCode)), - Body: io.NopCloser(strings.NewReader(msg)), - ContentLength: int64(len(msg)), - } - } else { - if oldModifyResponse != nil { - if err := oldModifyResponse(response); err != nil { - return err - } - } - } - return nil - } - } - if h.Responder != nil { - // if an optional error interceptor/responder was provided wire it - // the custom responder might be used for providing a unified error reporting - // or supporting retry mechanisms by not sending non-fatal errors to the clients - proxy.ErrorHandler = h.Responder.Error - } - proxy.ServeHTTP(w, newReq) -} - -type noSuppressPanicError struct{} - -func (noSuppressPanicError) Write(p []byte) (n int, err error) { - // skip "suppressing panic for copyResponse error in test; copy error" error message - // that ends up in CI tests on each kube-apiserver termination as noise and - // everybody thinks this is fatal. - if strings.Contains(string(p), "suppressing panic") { - return len(p), nil - } - return os.Stderr.Write(p) -} - -// tryUpgrade returns true if the request was handled. -func (h *UpgradeAwareHandler) tryUpgrade(w http.ResponseWriter, req *http.Request) bool { - if !httpstream.IsUpgradeRequest(req) { - klog.V(6).Infof("Request was not an upgrade") - return false - } - - var ( - backendConn net.Conn - rawResponse []byte - err error - ) - - location := *h.Location - if h.UseRequestLocation { - location = *req.URL - location.Scheme = h.Location.Scheme - location.Host = h.Location.Host - if h.AppendLocationPath { - location.Path = singleJoiningSlash(h.Location.Path, location.Path) - } - } - - clone := utilnet.CloneRequest(req) - // Only append X-Forwarded-For in the upgrade path, since httputil.NewSingleHostReverseProxy - // handles this in the non-upgrade path. - utilnet.AppendForwardedForHeader(clone) - klog.V(6).Infof("Connecting to backend proxy (direct dial) %s\n Headers: %v", &location, clone.Header) - if h.UseLocationHost { - clone.Host = h.Location.Host - } - clone.URL = &location - klog.V(6).Infof("UpgradeAwareProxy: dialing for SPDY upgrade with headers: %v", clone.Header) - backendConn, err = h.DialForUpgrade(clone) - if err != nil { - klog.V(6).Infof("Proxy connection error: %v", err) - h.Responder.Error(w, req, err) - return true - } - defer backendConn.Close() - - // determine the http response code from the backend by reading from rawResponse+backendConn - backendHTTPResponse, headerBytes, err := getResponse(io.MultiReader(bytes.NewReader(rawResponse), backendConn)) - if err != nil { - klog.V(6).Infof("Proxy connection error: %v", err) - h.Responder.Error(w, req, err) - return true - } - if len(headerBytes) > len(rawResponse) { - // we read beyond the bytes stored in rawResponse, update rawResponse to the full set of bytes read from the backend - rawResponse = headerBytes - } - - // If the backend did not upgrade the request, return an error to the client. If the response was - // an error, the error is forwarded directly after the connection is hijacked. Otherwise, just - // return a generic error here. - if backendHTTPResponse.StatusCode != http.StatusSwitchingProtocols && backendHTTPResponse.StatusCode < 400 { - err := fmt.Errorf("invalid upgrade response: status code %d", backendHTTPResponse.StatusCode) - klog.Errorf("Proxy upgrade error: %v", err) - h.Responder.Error(w, req, err) - return true - } - - // Once the connection is hijacked, the ErrorResponder will no longer work, so - // hijacking should be the last step in the upgrade. - requestHijacker, ok := w.(http.Hijacker) - if !ok { - klog.Errorf("Unable to hijack response writer: %T", w) - h.Responder.Error(w, req, fmt.Errorf("request connection cannot be hijacked: %T", w)) - return true - } - requestHijackedConn, _, err := requestHijacker.Hijack() - if err != nil { - klog.Errorf("Unable to hijack response: %v", err) - h.Responder.Error(w, req, fmt.Errorf("error hijacking connection: %v", err)) - return true - } - defer requestHijackedConn.Close() - - if backendHTTPResponse.StatusCode != http.StatusSwitchingProtocols { - // If the backend did not upgrade the request, echo the response from the backend to the client and return, closing the connection. - klog.V(6).Infof("Proxy upgrade error, status code %d", backendHTTPResponse.StatusCode) - // set read/write deadlines - deadline := time.Now().Add(10 * time.Second) - backendConn.SetReadDeadline(deadline) - requestHijackedConn.SetWriteDeadline(deadline) - // write the response to the client - err := backendHTTPResponse.Write(requestHijackedConn) - if err != nil && !strings.Contains(err.Error(), "use of closed network connection") { - klog.Errorf("Error proxying data from backend to client: %v", err) - } - // Indicate we handled the request - return true - } - - // Forward raw response bytes back to client. - if len(rawResponse) > 0 { - klog.V(6).Infof("Writing %d bytes to hijacked connection", len(rawResponse)) - if _, err = requestHijackedConn.Write(rawResponse); err != nil { - utilruntime.HandleError(fmt.Errorf("Error proxying response from backend to client: %v", err)) - } - } - - // Proxy the connection. This is bidirectional, so we need a goroutine - // to copy in each direction. Once one side of the connection exits, we - // exit the function which performs cleanup and in the process closes - // the other half of the connection in the defer. - writerComplete := make(chan struct{}) - readerComplete := make(chan struct{}) - - go func() { - var writer io.WriteCloser - if h.MaxBytesPerSec > 0 { - writer = flowrate.NewWriter(backendConn, h.MaxBytesPerSec) - } else { - writer = backendConn - } - _, err := io.Copy(writer, requestHijackedConn) - if err != nil && !strings.Contains(err.Error(), "use of closed network connection") { - klog.Errorf("Error proxying data from client to backend: %v", err) - } - close(writerComplete) - }() - - go func() { - var reader io.ReadCloser - if h.MaxBytesPerSec > 0 { - reader = flowrate.NewReader(backendConn, h.MaxBytesPerSec) - } else { - reader = backendConn - } - _, err := io.Copy(requestHijackedConn, reader) - if err != nil && !strings.Contains(err.Error(), "use of closed network connection") { - klog.Errorf("Error proxying data from backend to client: %v", err) - } - close(readerComplete) - }() - - // Wait for one half the connection to exit. Once it does the defer will - // clean up the other half of the connection. - select { - case <-writerComplete: - case <-readerComplete: - } - klog.V(6).Infof("Disconnecting from backend proxy %s\n Headers: %v", &location, clone.Header) - - return true -} - -// FIXME: Taken from net/http/httputil/reverseproxy.go as singleJoiningSlash is not exported to be re-used. -// See-also: https://github.com/golang/go/issues/44290 -func singleJoiningSlash(a, b string) string { - aslash := strings.HasSuffix(a, "/") - bslash := strings.HasPrefix(b, "/") - switch { - case aslash && bslash: - return a + b[1:] - case !aslash && !bslash: - return a + "/" + b - } - return a + b -} - -func (h *UpgradeAwareHandler) DialForUpgrade(req *http.Request) (net.Conn, error) { - if h.UpgradeTransport == nil { - return dial(req, h.Transport) - } - updatedReq, err := h.UpgradeTransport.WrapRequest(req) - if err != nil { - return nil, err - } - return dial(updatedReq, h.UpgradeTransport) -} - -// getResponseCode reads a http response from the given reader, returns the response, -// the bytes read from the reader, and any error encountered -func getResponse(r io.Reader) (*http.Response, []byte, error) { - rawResponse := bytes.NewBuffer(make([]byte, 0, 256)) - // Save the bytes read while reading the response headers into the rawResponse buffer - resp, err := http.ReadResponse(bufio.NewReader(io.TeeReader(r, rawResponse)), nil) - if err != nil { - return nil, nil, err - } - // return the http response and the raw bytes consumed from the reader in the process - return resp, rawResponse.Bytes(), nil -} - -// dial dials the backend at req.URL and writes req to it. -func dial(req *http.Request, transport http.RoundTripper) (net.Conn, error) { - conn, err := DialURL(req.Context(), req.URL, transport) - if err != nil { - return nil, fmt.Errorf("error dialing backend: %v", err) - } - - if err = req.Write(conn); err != nil { - conn.Close() - return nil, fmt.Errorf("error sending request: %v", err) - } - - return conn, err -} - -func (h *UpgradeAwareHandler) defaultProxyTransport(url *url.URL, internalTransport http.RoundTripper) http.RoundTripper { - scheme := url.Scheme - host := url.Host - suffix := h.Location.Path - if strings.HasSuffix(url.Path, "/") && !strings.HasSuffix(suffix, "/") { - suffix += "/" - } - pathPrepend := strings.TrimSuffix(url.Path, suffix) - rewritingTransport := &Transport{ - Scheme: scheme, - Host: host, - PathPrepend: pathPrepend, - RoundTripper: internalTransport, - } - return &corsRemovingTransport{ - RoundTripper: rewritingTransport, - } -} - -// corsRemovingTransport is a wrapper for an internal transport. It removes CORS headers -// from the internal response. -// Implements pkg/util/net.RoundTripperWrapper -type corsRemovingTransport struct { - http.RoundTripper -} - -var _ = utilnet.RoundTripperWrapper(&corsRemovingTransport{}) - -func (rt *corsRemovingTransport) RoundTrip(req *http.Request) (*http.Response, error) { - resp, err := rt.RoundTripper.RoundTrip(req) - if err != nil { - return nil, err - } - removeCORSHeaders(resp) - return resp, nil -} - -func (rt *corsRemovingTransport) WrappedRoundTripper() http.RoundTripper { - return rt.RoundTripper -} - -// removeCORSHeaders strip CORS headers sent from the backend -// This should be called on all responses before returning -func removeCORSHeaders(resp *http.Response) { - resp.Header.Del("Access-Control-Allow-Credentials") - resp.Header.Del("Access-Control-Allow-Headers") - resp.Header.Del("Access-Control-Allow-Methods") - resp.Header.Del("Access-Control-Allow-Origin") -} diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go index cc09bdbc43..38c1f7b03c 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go +++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go @@ -17,14 +17,17 @@ limitations under the License. package runtime import ( + "bytes" "context" "fmt" "net/http" "runtime" + "strings" "sync" "time" "k8s.io/klog/v2" + "k8s.io/klog/v2/textlogger" ) var ( @@ -55,7 +58,6 @@ func HandleCrash(additionalHandlers ...func(interface{})) { if r := recover(); r != nil { additionalHandlersWithContext := make([]func(context.Context, interface{}), len(additionalHandlers)) for i, handler := range additionalHandlers { - handler := handler // capture loop variable additionalHandlersWithContext[i] = func(_ context.Context, r interface{}) { handler(r) } @@ -155,8 +157,37 @@ var ErrorHandlers = []ErrorHandler{ backoffError(1 * time.Millisecond), } +// ErrorHandler is called indirectly through [HandleError], [HandleErrorWithContext] or [HandleErrorWithLogger]. +// It is passed the same parameters that a structured logging backend needs to log a problem. +// It follows the semantic described for [HandleErrorWithContext] and [logr.Logger.Error]: +// - err is optional and may be nil +// - msg is string that describes the problem +// - keysAndValues contains additional information that varies between different occurrences of the problem +// +// [ErrorToString] can be used to convert these parameters into a single string, using the klog text output. type ErrorHandler func(ctx context.Context, err error, msg string, keysAndValues ...interface{}) +// ErrorToString takes the parameters passed to [ErrorHandler] and +// formats them as a string using the klog text output. +// +// If any of the values is a multi-line string, then the resulting +// string also uses line breaks and indention for the sake of readability. +// Does not include a trailing newline. +// +// Use errors.New if an error instead of a string is needed. +func ErrorToString(err error, msg string, keysAndValues ...interface{}) string { + var buffer bytes.Buffer + config := textlogger.NewConfig( + textlogger.Output(&buffer), + textlogger.WithHeader(false), + ) + logger := textlogger.NewLogger(config) + logger.Error(err, msg, keysAndValues...) + result := buffer.String() + result = strings.TrimSpace(result) + return result +} + // HandlerError is a method to invoke when a non-user facing piece of code cannot // return an error and needs to indicate it has been ignored. Invoking this method // is preferable to logging the error - the default behavior is to log but the diff --git a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go index 6825a808e6..71f6b5e875 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go +++ b/vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go @@ -1827,9 +1827,7 @@ func (ss SortableSliceOfMaps) Less(i, j int) bool { } func (ss SortableSliceOfMaps) Swap(i, j int) { - tmp := ss.s[i] - ss.s[i] = ss.s[j] - ss.s[j] = tmp + ss.s[i], ss.s[j] = ss.s[j], ss.s[i] } func deduplicateAndSortScalars(s []interface{}) []interface{} { @@ -1875,9 +1873,7 @@ func (ss SortableSliceOfScalars) Less(i, j int) bool { } func (ss SortableSliceOfScalars) Swap(i, j int) { - tmp := ss.s[i] - ss.s[i] = ss.s[j] - ss.s[j] = tmp + ss.s[i], ss.s[j] = ss.s[j], ss.s[i] } // Returns the type of the elements of N slice(s). If the type is different, diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go index f0264e50c7..1eeb71ff53 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/error_matcher.go @@ -40,10 +40,12 @@ type ErrorMatcher struct { matchField bool // TODO(thockin): consider whether value could be assumed - if the // "want" error has a nil value, don't match on value. - matchValue bool - matchOrigin bool - matchDetail func(want, got string) bool - requireOriginWhenInvalid bool + matchValue bool + matchOrigin bool + matchDetail func(want, got string) bool + requireOriginWhenInvalid bool + matchValidationStabilityLevel bool + matchSource bool // normalizationRules holds the pre-compiled regex patterns for path normalization. normalizationRules []NormalizationRule } @@ -86,6 +88,14 @@ func (m ErrorMatcher) Matches(want, got *Error) bool { if m.matchDetail != nil && !m.matchDetail(want.Detail, got.Detail) { return false } + if m.matchValidationStabilityLevel && want.ValidationStabilityLevel != got.ValidationStabilityLevel { + return false + } + + if m.matchSource && want.FromImperative != got.FromImperative { + return false + } + return true } @@ -148,6 +158,14 @@ func (m ErrorMatcher) Render(e *Error) string { comma() buf.WriteString(fmt.Sprintf("Detail=%q", e.Detail)) } + if m.matchValidationStabilityLevel { + comma() + buf.WriteString(fmt.Sprintf("ValidationStabilityLevel=%s", e.ValidationStabilityLevel)) + } + if m.matchSource { + comma() + buf.WriteString(fmt.Sprintf("FromImperative=%t", e.FromImperative)) + } return "{" + buf.String() + "}" } @@ -224,6 +242,20 @@ func (m ErrorMatcher) RequireOriginWhenInvalid() ErrorMatcher { return m } +// BySource returns a derived ErrorMatcher which also matches by the error origination +// value of field errors. +func (m ErrorMatcher) BySource() ErrorMatcher { + m.matchSource = true + return m +} + +// ByValidationStabilityLevel returns a derived ErrorMatcher which also matches by the validation stability level +// value of field errors. +func (m ErrorMatcher) ByValidationStabilityLevel() ErrorMatcher { + m.matchValidationStabilityLevel = true + return m +} + // ByDetailExact returns a derived ErrorMatcher which also matches errors by // the exact detail string. func (m ErrorMatcher) ByDetailExact() ErrorMatcher { diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go index 950d838682..9357fb306c 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/field/errors.go @@ -42,7 +42,7 @@ type Error struct { // The value should be either: // - A simple camelCase identifier (e.g., "maximum", "maxItems") // - A structured format using "format=" for validation errors related to specific formats - // (e.g., "format=dns-label", "format=qualified-name") + // (e.g. "format=k8s-short-name") // // If the Origin corresponds to an existing declarative validation tag or JSON Schema keyword, // use that same name for consistency. @@ -55,10 +55,46 @@ type Error struct { // validation. This field is to identify errors from imperative validation // that should also be caught by declarative validation. CoveredByDeclarative bool + + // FromImperative denotes these errors are originating from the hand written validations. + FromImperative bool + + // ValidationStabilityLevel denotes the validation stability level of the declarative validation from this error is returned. This should be used in the declarative validations only. + ValidationStabilityLevel ValidationStabilityLevel +} + +// ValidationStabilityLevel denotes the stability level of a validation. +type ValidationStabilityLevel int + +const ( + stabilityLevelUnknown ValidationStabilityLevel = iota + stabilityLevelAlpha + stabilityLevelBeta +) + +func (v ValidationStabilityLevel) String() string { + switch v { + case stabilityLevelAlpha: + return "alpha" + case stabilityLevelBeta: + return "beta" + default: + return "unknown" + } } var _ error = &Error{} +// IsAlpha returns true if the error is an alpha validation error. +func (e *Error) IsAlpha() bool { + return e.ValidationStabilityLevel == stabilityLevelAlpha +} + +// IsBeta returns true if the error is a beta validation error. +func (e *Error) IsBeta() bool { + return e.ValidationStabilityLevel == stabilityLevelBeta +} + // Error implements the error interface. func (e *Error) Error() string { return fmt.Sprintf("%s: %s", e.Field, e.ErrorBody()) @@ -73,10 +109,10 @@ var omitValue = OmitValueType{} func (e *Error) ErrorBody() string { var s string switch e.Type { - case ErrorTypeRequired, ErrorTypeForbidden, ErrorTypeTooLong, ErrorTypeInternal: + case ErrorTypeRequired, ErrorTypeForbidden, ErrorTypeTooLong, ErrorTypeTooShort, ErrorTypeInternal: s = e.Type.String() case ErrorTypeInvalid, ErrorTypeTypeInvalid, ErrorTypeNotSupported, - ErrorTypeNotFound, ErrorTypeDuplicate, ErrorTypeTooMany: + ErrorTypeNotFound, ErrorTypeDuplicate, ErrorTypeTooMany, ErrorTypeTooFew: if e.BadValue == omitValue { s = e.Type.String() break @@ -113,6 +149,7 @@ func (e *Error) ErrorBody() string { if len(e.Detail) != 0 { s += fmt.Sprintf(": %s", e.Detail) } + return s } @@ -164,11 +201,18 @@ const ( // report that a given list has too many items. This is similar to FieldValueTooLong, // but the error indicates quantity instead of length. ErrorTypeTooMany ErrorType = "FieldValueTooMany" + // ErrorTypeTooFew is used to report "too few". This is used to + // report that a given list has too few items. This is similar to FieldValueTooLong, + // but the error indicates quantity instead of length. + ErrorTypeTooFew ErrorType = "FieldValueTooFew" // ErrorTypeInternal is used to report other errors that are not related // to user input. See InternalError(). ErrorTypeInternal ErrorType = "InternalError" // ErrorTypeTypeInvalid is for the value did not match the schema type for that field ErrorTypeTypeInvalid ErrorType = "FieldValueTypeInvalid" + // ErrorTypeTooShort is used to report that the given value is too short. + // This is similar to ErrorTypeInvalid. See TooShort(). + ErrorTypeTooShort ErrorType = "FieldValueTooShort" ) // String converts a ErrorType into its corresponding canonical error message. @@ -190,10 +234,14 @@ func (t ErrorType) String() string { return "Too long" case ErrorTypeTooMany: return "Too many" + case ErrorTypeTooFew: + return "Too few" case ErrorTypeInternal: return "Internal error" case ErrorTypeTypeInvalid: return "Invalid value" + case ErrorTypeTooShort: + return "Too short" default: return fmt.Sprintf("", string(t)) } @@ -201,32 +249,56 @@ func (t ErrorType) String() string { // TypeInvalid returns a *Error indicating "type is invalid" func TypeInvalid(field *Path, value interface{}, detail string) *Error { - return &Error{ErrorTypeTypeInvalid, field.String(), value, detail, "", false} + return &Error{ + Type: ErrorTypeTypeInvalid, + Field: field.String(), + BadValue: value, + Detail: detail, + } } // NotFound returns a *Error indicating "value not found". This is // used to report failure to find a requested value (e.g. looking up an ID). func NotFound(field *Path, value interface{}) *Error { - return &Error{ErrorTypeNotFound, field.String(), value, "", "", false} + return &Error{ + Type: ErrorTypeNotFound, + Field: field.String(), + BadValue: value, + } } // Required returns a *Error indicating "value required". This is used // to report required values that are not provided (e.g. empty strings, null // values, or empty arrays). func Required(field *Path, detail string) *Error { - return &Error{ErrorTypeRequired, field.String(), "", detail, "", false} + return &Error{ + Type: ErrorTypeRequired, + Field: field.String(), + Detail: detail, + BadValue: "", + } } // Duplicate returns a *Error indicating "duplicate value". This is // used to report collisions of values that must be unique (e.g. names or IDs). func Duplicate(field *Path, value interface{}) *Error { - return &Error{ErrorTypeDuplicate, field.String(), value, "", "", false} + return &Error{ + Type: ErrorTypeDuplicate, + Field: field.String(), + BadValue: value, + } } // Invalid returns a *Error indicating "invalid value". This is used // to report malformed values (e.g. failed regex match, too long, out of bounds). func Invalid(field *Path, value interface{}, detail string) *Error { - return &Error{ErrorTypeInvalid, field.String(), value, detail, "", false} + return &Error{ + Type: ErrorTypeInvalid, + Field: field.String(), + BadValue: value, + Detail: detail, + } + } // NotSupported returns a *Error indicating "unsupported value". @@ -241,7 +313,12 @@ func NotSupported[T ~string](field *Path, value interface{}, validValues []T) *E } detail = "supported values: " + strings.Join(quotedValues, ", ") } - return &Error{ErrorTypeNotSupported, field.String(), value, detail, "", false} + return &Error{ + Type: ErrorTypeNotSupported, + Field: field.String(), + BadValue: value, + Detail: detail, + } } // Forbidden returns a *Error indicating "forbidden". This is used to @@ -249,7 +326,12 @@ func NotSupported[T ~string](field *Path, value interface{}, validValues []T) *E // some conditions, but which are not permitted by current conditions (e.g. // security policy). func Forbidden(field *Path, detail string) *Error { - return &Error{ErrorTypeForbidden, field.String(), "", detail, "", false} + return &Error{ + Type: ErrorTypeForbidden, + Field: field.String(), + Detail: detail, + BadValue: "", + } } // TooLong returns a *Error indicating "too long". This is used to report that @@ -267,7 +349,35 @@ func TooLong(field *Path, _ interface{}, maxLength int) *Error { } else { msg = "value is too long" } - return &Error{ErrorTypeTooLong, field.String(), "", msg, "", false} + return &Error{ + Type: ErrorTypeTooLong, + Field: field.String(), + BadValue: "", + Detail: msg, + } +} + +// TooLongCharacters returns a *Error indicating "too long". This is used to report that +// the given value is too long in characters (including multi-byte characters). +// This is similar to Invalid, but the returned error will not include the too-long value. +// If maxLength is negative, it will be included in the message. The value argument is not used. +func TooLongCharacters[T ~string](field *Path, _ T, maxLength int) *Error { + var msg string + if maxLength >= 0 { + bs := "characters" + if maxLength == 1 { + bs = "character" + } + msg = fmt.Sprintf("may not be more than %d %s", maxLength, bs) + } else { + msg = "value is too long" + } + return &Error{ + Type: ErrorTypeTooLong, + Field: field.String(), + BadValue: "", + Detail: msg, + } } // TooLongMaxLength returns a *Error indicating "too long". @@ -299,14 +409,46 @@ func TooMany(field *Path, actualQuantity, maxQuantity int) *Error { actual = omitValue } - return &Error{ErrorTypeTooMany, field.String(), actual, msg, "", false} + return &Error{ + Type: ErrorTypeTooMany, + Field: field.String(), + BadValue: actual, + Detail: msg, + } } // InternalError returns a *Error indicating "internal error". This is used // to signal that an error was found that was not directly related to user // input. The err argument must be non-nil. func InternalError(field *Path, err error) *Error { - return &Error{ErrorTypeInternal, field.String(), nil, err.Error(), "", false} + return &Error{ + Type: ErrorTypeInternal, + Field: field.String(), + BadValue: err, + Detail: err.Error(), + } +} + +// TooShort returns a *Error indicating "too short". This is used to report that +// the given value is too short in characters. This is similar to Invalid. +// If minLength is non-negative, it will be included in the message. +func TooShort[T ~string](field *Path, value T, minLength int) *Error { + var msg string + if minLength >= 0 { + bs := "characters" + if minLength == 1 { + bs = "character" + } + msg = fmt.Sprintf("must be at least %d %s", minLength, bs) + } else { + msg = "value is too short" + } + return &Error{ + Type: ErrorTypeTooShort, + Field: field.String(), + BadValue: value, + Detail: msg, + } } // ErrorList holds a set of Errors. It is plausible that we might one day have @@ -397,6 +539,46 @@ func (list ErrorList) ExtractCoveredByDeclarative() ErrorList { return newList } +// MarkAlpha marks the error as an alpha validation error. +func (e *Error) MarkAlpha() *Error { + e.ValidationStabilityLevel = stabilityLevelAlpha + return e +} + +// MarkAlpha marks the errors as alpha validation errors. +func (list ErrorList) MarkAlpha() ErrorList { + for _, err := range list { + err.ValidationStabilityLevel = stabilityLevelAlpha + } + return list +} + +// MarkBeta marks the error as a beta validation error. +func (e *Error) MarkBeta() *Error { + e.ValidationStabilityLevel = stabilityLevelBeta + return e +} + +// MarkBeta marks the errors as beta validation errors. +func (list ErrorList) MarkBeta() ErrorList { + for _, err := range list { + err.ValidationStabilityLevel = stabilityLevelBeta + } + return list +} + +func (e *Error) MarkFromImperative() *Error { + e.FromImperative = true + return e +} + +func (list ErrorList) MarkFromImperative() ErrorList { + for _, err := range list { + err.FromImperative = true + } + return list +} + // RemoveCoveredByDeclarative returns a new ErrorList containing only the errors that should not be covered by declarative validation. func (list ErrorList) RemoveCoveredByDeclarative() ErrorList { newList := ErrorList{} @@ -407,3 +589,27 @@ func (list ErrorList) RemoveCoveredByDeclarative() ErrorList { } return newList } + +// TooFew returns a *Error indicating "too few". This is used to +// report that a given list has too few items. This is similar to TooLong, +// but the returned error indicates quantity instead of length. +func TooFew(field *Path, actualQuantity, minQuantity int) *Error { + var msg string + + if minQuantity >= 0 { + is := "items" + if minQuantity == 1 { + is = "item" + } + msg = fmt.Sprintf("must have at least %d %s", minQuantity, is) + } else { + msg = "has too few items" + } + + return &Error{ + Type: ErrorTypeTooFew, + Field: field.String(), + BadValue: actualQuantity, + Detail: msg, + } +} diff --git a/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go b/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go index 6e947c74c9..869fb0aad0 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go +++ b/vendor/k8s.io/apimachinery/pkg/util/validation/ip.go @@ -115,7 +115,7 @@ func GetWarningsForIP(fldPath *field.Path, value string) []string { // ParseAddr() doesn't) or IPv4-mapped IPv6 (.Is4In6()). Either way, // re-stringifying the net.IP value will give the preferred form. return []string{ - fmt.Sprintf("%s: non-standard IP address %q will be considered invalid in a future Kubernetes release: use %q", fldPath, value, ip.String()), + fmt.Sprintf("%s: non-standard IP address %q is invalid: use %q", fldPath, value, ip.String()), } } @@ -233,7 +233,7 @@ func GetWarningsForCIDR(fldPath *field.Path, value string) []string { // ParsePrefix() doesn't) or IPv4-mapped IPv6 (.Is4In6()). Either way, // re-stringifying the net.IPNet value will give the preferred form. warnings = append(warnings, - fmt.Sprintf("%s: non-standard CIDR value %q will be considered invalid in a future Kubernetes release: use %q", fldPath, value, ipnet.String()), + fmt.Sprintf("%s: non-standard CIDR value %q is invalid: use %q", fldPath, value, ipnet.String()), ) } diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/netutil/addr.go b/vendor/k8s.io/apimachinery/third_party/forked/golang/netutil/addr.go deleted file mode 100644 index bd26f427e3..0000000000 --- a/vendor/k8s.io/apimachinery/third_party/forked/golang/netutil/addr.go +++ /dev/null @@ -1,28 +0,0 @@ -package netutil - -import ( - "net/url" - "strings" -) - -// FROM: http://golang.org/src/net/http/client.go -// Given a string of the form "host", "host:port", or "[ipv6::address]:port", -// return true if the string includes a port. -func hasPort(s string) bool { return strings.LastIndex(s, ":") > strings.LastIndex(s, "]") } - -// FROM: http://golang.org/src/net/http/transport.go -var portMap = map[string]string{ - "http": "80", - "https": "443", - "socks5": "1080", -} - -// FROM: http://golang.org/src/net/http/transport.go -// canonicalAddr returns url.Host but always with a ":port" suffix -func CanonicalAddr(url *url.URL) string { - addr := url.Host - if !hasPort(addr) { - return addr + ":" + portMap[url.Scheme] - } - return addr -} diff --git a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go b/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go index 511e625b63..bb0fa55f21 100644 --- a/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go +++ b/vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go @@ -178,7 +178,7 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool, } // Two lists that are both empty and both non nil are equal - if v1.Len() == 0 || v2.Len() == 0 { + if v1.Len() == 0 && v2.Len() == 0 { return true } } @@ -229,7 +229,7 @@ func (e Equalities) deepValueEqual(v1, v2 reflect.Value, visited map[visit]bool, } // Two maps that are both empty and both non nil are equal - if v1.Len() == 0 || v2.Len() == 0 { + if v1.Len() == 0 && v2.Len() == 0 { return true } } diff --git a/vendor/k8s.io/apiserver/pkg/admission/config.go b/vendor/k8s.io/apiserver/pkg/admission/config.go index 4bb5f27bfb..1e64af4474 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/config.go +++ b/vendor/k8s.io/apiserver/pkg/admission/config.go @@ -108,7 +108,7 @@ func ReadAdmissionConfiguration(pluginNames []string, configFilePath string, con // in order to preserve backwards compatibility, we set plugins that // previously read input from a non-versioned file configuration to the // current input file. - legacyPluginsWithUnversionedConfig := sets.NewString("ImagePolicyWebhook", "PodNodeSelector") + legacyPluginsWithUnversionedConfig := sets.New[string]("ImagePolicyWebhook", "PodNodeSelector") externalConfig := &apiserverv1.AdmissionConfiguration{} for _, pluginName := range pluginNames { if legacyPluginsWithUnversionedConfig.Has(pluginName) { diff --git a/vendor/k8s.io/apiserver/pkg/admission/handler.go b/vendor/k8s.io/apiserver/pkg/admission/handler.go index d2a9e7d4cf..e498b78f6b 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/handler.go +++ b/vendor/k8s.io/apiserver/pkg/admission/handler.go @@ -34,7 +34,7 @@ type ReadyFunc func() bool // Handler is a base for admission control handlers that // support a predefined set of operations type Handler struct { - operations sets.String + operations sets.Set[string] readyFunc ReadyFunc } @@ -46,7 +46,7 @@ func (h *Handler) Handles(operation Operation) bool { // NewHandler creates a new base handler that handles the passed // in operations func NewHandler(ops ...Operation) *Handler { - operations := sets.NewString() + operations := sets.New[string]() for _, op := range ops { operations.Insert(string(op)) } diff --git a/vendor/k8s.io/apiserver/pkg/admission/initializer/apiserver_id.go b/vendor/k8s.io/apiserver/pkg/admission/initializer/apiserver_id.go new file mode 100644 index 0000000000..b708d03ad8 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/initializer/apiserver_id.go @@ -0,0 +1,43 @@ +/* +Copyright 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. +*/ + +package initializer + +import "k8s.io/apiserver/pkg/admission" + +// apiServerIDInitializer injects the API server identity into admission plugins +// that implement WantsAPIServerID. This is used for metrics labeling in HA setups +// where multiple API servers may be running with different manifest configurations. +type apiServerIDInitializer struct { + apiServerID string +} + +var _ admission.PluginInitializer = &apiServerIDInitializer{} + +// NewAPIServerIDInitializer returns a PluginInitializer that injects the given +// API server ID into admission plugins that implement WantsAPIServerID. +// This initializer must be placed before the generic initializer in the chain +// so that the API server ID is available when SetExternalKubeInformerFactory is called. +func NewAPIServerIDInitializer(apiServerID string) admission.PluginInitializer { + return &apiServerIDInitializer{apiServerID: apiServerID} +} + +// Initialize checks whether the plugin implements WantsAPIServerID and injects the ID. +func (i *apiServerIDInitializer) Initialize(plugin admission.Interface) { + if wants, ok := plugin.(WantsAPIServerID); ok { + wants.SetAPIServerID(i.apiServerID) + } +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go b/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go index a66d62dff0..cd3da1a619 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go +++ b/vendor/k8s.io/apiserver/pkg/admission/initializer/interfaces.go @@ -17,6 +17,7 @@ limitations under the License. package initializer import ( + admissionregistrationv1api "k8s.io/api/admissionregistration/v1" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apiserver/pkg/admission" @@ -104,3 +105,41 @@ type WantsExcludedAdmissionResources interface { SetExcludedAdmissionResources(excludedAdmissionResources []schema.GroupResource) admission.InitializationValidator } + +// WantsAPIServerID defines a function which sets the API server ID for admission plugins +// that need it (e.g., for metrics labeling in HA setups). +type WantsAPIServerID interface { + SetAPIServerID(apiServerID string) + admission.InitializationValidator +} + +// ValidatingWebhookManifestLoadFunc loads ValidatingWebhookConfiguration manifests from a directory. +type ValidatingWebhookManifestLoadFunc func(dir string) ([]*admissionregistrationv1api.ValidatingWebhookConfiguration, string, error) + +// MutatingWebhookManifestLoadFunc loads MutatingWebhookConfiguration manifests from a directory. +type MutatingWebhookManifestLoadFunc func(dir string) ([]*admissionregistrationv1api.MutatingWebhookConfiguration, string, error) + +// ValidatingPolicyManifestLoadFunc loads ValidatingAdmissionPolicy manifests from a directory. +type ValidatingPolicyManifestLoadFunc func(dir string) ([]*admissionregistrationv1api.ValidatingAdmissionPolicy, []*admissionregistrationv1api.ValidatingAdmissionPolicyBinding, string, error) + +// MutatingPolicyManifestLoadFunc loads MutatingAdmissionPolicy manifests from a directory. +type MutatingPolicyManifestLoadFunc func(dir string) ([]*admissionregistrationv1api.MutatingAdmissionPolicy, []*admissionregistrationv1api.MutatingAdmissionPolicyBinding, string, error) + +// ManifestLoaders provides functions to load admission configurations from static manifest files +// with scheme-based defaulting and validation. +type ManifestLoaders struct { + // LoadValidatingWebhookManifests loads ValidatingWebhookConfiguration manifests. + LoadValidatingWebhookManifests ValidatingWebhookManifestLoadFunc + // LoadMutatingWebhookManifests loads MutatingWebhookConfiguration manifests. + LoadMutatingWebhookManifests MutatingWebhookManifestLoadFunc + // LoadValidatingPolicyManifests loads ValidatingAdmissionPolicy manifests. + LoadValidatingPolicyManifests ValidatingPolicyManifestLoadFunc + // LoadMutatingPolicyManifests loads MutatingAdmissionPolicy manifests. + LoadMutatingPolicyManifests MutatingPolicyManifestLoadFunc +} + +// WantsManifestLoaders is implemented by admission plugins that load configurations +// from static manifest files and need scheme-based defaulting and validation. +type WantsManifestLoaders interface { + SetManifestLoaders(loaders *ManifestLoaders) +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/composition.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/composition.go index bf8715a144..d7456d090b 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/composition.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/cel/composition.go @@ -34,7 +34,7 @@ import ( "k8s.io/apiserver/pkg/cel/lazy" ) -const VariablesTypeName = "kubernetes.variables" +const variablesTypeName = "kubernetes.variables" // CompositedCompiler compiles expressions with variable composition. type CompositedCompiler struct { @@ -42,7 +42,7 @@ type CompositedCompiler struct { ConditionCompiler MutatingCompiler - CompositionEnv *CompositionEnv + state *compositionState } // CompositedConditionEvaluator provides evaluation of a condition expression with variable composition. @@ -50,7 +50,7 @@ type CompositedCompiler struct { type CompositedConditionEvaluator struct { ConditionEvaluator - compositionEnv *CompositionEnv + state *compositionState } // CompositedEvaluator provides evaluation of a single expression with variable composition. @@ -58,32 +58,78 @@ type CompositedConditionEvaluator struct { type CompositedEvaluator struct { MutatingEvaluator - compositionEnv *CompositionEnv + state *compositionState } func NewCompositedCompiler(envSet *environment.EnvSet) (*CompositedCompiler, error) { - compositionContext, err := NewCompositionEnv(VariablesTypeName, envSet) + newMapType := apiservercel.NewObjectType(variablesTypeName, map[string]*apiservercel.DeclField{}) + + newEnvSet, err := envSet.Extend(environment.VersionedOptions{ + IntroducedVersion: version.MajorMinor(1, 0), + EnvOptions: []cel.EnvOption{ + cel.Variable("variables", newMapType.CelType()), + }, + DeclTypes: []*apiservercel.DeclType{ + newMapType, + }, + }) if err != nil { return nil, err } - return NewCompositedCompilerFromTemplate(compositionContext), nil -} -func NewCompositedCompilerFromTemplate(context *CompositionEnv) *CompositedCompiler { - context = &CompositionEnv{ - MapType: context.MapType, - EnvSet: context.EnvSet, - CompiledVariables: map[string]CompilationResult{}, + state := &compositionState{ + mapType: newMapType, + EnvSet: newEnvSet, + compiledVariables: map[string]CompilationResult{}, } - compiler := NewCompiler(context.EnvSet) + + compiler := NewCompiler(state.EnvSet) conditionCompiler := &conditionCompiler{compiler} mutation := &mutatingCompiler{compiler} return &CompositedCompiler{ Compiler: compiler, ConditionCompiler: conditionCompiler, MutatingCompiler: mutation, - CompositionEnv: context, + state: state, + }, nil +} + +// NewCompositedCompilerForTypeChecking creates a CompositedCompiler for type checking. +// It initializes the composition state but leaves the Compilers nil, as they are expected +// to be replaced by the caller (who is doing type checking). +func NewCompositedCompilerForTypeChecking(envSet *environment.EnvSet) (*CompositedCompiler, error) { + newMapType := apiservercel.NewObjectType(variablesTypeName, map[string]*apiservercel.DeclField{}) + + newEnvSet, err := envSet.Extend(environment.VersionedOptions{ + IntroducedVersion: version.MajorMinor(1, 0), + EnvOptions: []cel.EnvOption{ + cel.Variable("variables", newMapType.CelType()), + }, + DeclTypes: []*apiservercel.DeclType{ + newMapType, + }, + }) + if err != nil { + return nil, err } + + state := &compositionState{ + mapType: newMapType, + EnvSet: newEnvSet, + compiledVariables: map[string]CompilationResult{}, + } + return &CompositedCompiler{ + state: state, + }, nil +} + +// Env returns the CEL environment for the given mode. +func (c *CompositedCompiler) Env(mode environment.Type) (*cel.Env, error) { + return c.state.Env(mode) +} + +func (c *CompositedCompiler) CreateContext(parent context.Context) CompositionContext { + return c.state.CreateContext(parent) } func (c *CompositedCompiler) CompileAndStoreVariables(variables []NamedExpressionAccessor, options OptionalVariableDeclarations, mode environment.Type) { @@ -94,8 +140,8 @@ func (c *CompositedCompiler) CompileAndStoreVariables(variables []NamedExpressio func (c *CompositedCompiler) CompileAndStoreVariable(variable NamedExpressionAccessor, options OptionalVariableDeclarations, mode environment.Type) CompilationResult { result := c.Compiler.CompileCELExpression(variable, options, mode) - c.CompositionEnv.AddField(variable.GetName(), result.OutputType) - c.CompositionEnv.CompiledVariables[variable.GetName()] = result + c.state.AddField(variable.GetName(), result.OutputType) + c.state.compiledVariables[variable.GetName()] = result return result } @@ -103,7 +149,7 @@ func (c *CompositedCompiler) CompileCondition(expressions []ExpressionAccessor, condition := c.ConditionCompiler.CompileCondition(expressions, optionalDecls, envType) return &CompositedConditionEvaluator{ ConditionEvaluator: condition, - compositionEnv: c.CompositionEnv, + state: c.state, } } @@ -112,47 +158,25 @@ func (c *CompositedCompiler) CompileMutatingEvaluator(expression ExpressionAcces mutation := c.MutatingCompiler.CompileMutatingEvaluator(expression, optionalDecls, envType) return &CompositedEvaluator{ MutatingEvaluator: mutation, - compositionEnv: c.CompositionEnv, + state: c.state, } } -type CompositionEnv struct { +type compositionState struct { *environment.EnvSet - MapType *apiservercel.DeclType - CompiledVariables map[string]CompilationResult -} - -func (c *CompositionEnv) AddField(name string, celType *cel.Type) { - c.MapType.Fields[name] = apiservercel.NewDeclField(name, convertCelTypeToDeclType(celType), true, nil, nil) + mapType *apiservercel.DeclType + compiledVariables map[string]CompilationResult } -func NewCompositionEnv(typeName string, baseEnvSet *environment.EnvSet) (*CompositionEnv, error) { - declType := apiservercel.NewObjectType(typeName, map[string]*apiservercel.DeclField{}) - envSet, err := baseEnvSet.Extend(environment.VersionedOptions{ - // set to 1.0 because composition is one of the fundamental components - IntroducedVersion: version.MajorMinor(1, 0), - EnvOptions: []cel.EnvOption{ - cel.Variable("variables", declType.CelType()), - }, - DeclTypes: []*apiservercel.DeclType{ - declType, - }, - }) - if err != nil { - return nil, err - } - return &CompositionEnv{ - MapType: declType, - EnvSet: envSet, - CompiledVariables: map[string]CompilationResult{}, - }, nil +func (c *compositionState) AddField(name string, celType *cel.Type) { + c.mapType.Fields[name] = apiservercel.NewDeclField(name, convertCelTypeToDeclType(celType), true, nil, nil) } -func (c *CompositionEnv) CreateContext(parent context.Context) CompositionContext { +func (c *compositionState) CreateContext(parent context.Context) CompositionContext { return &compositionContext{ - Context: parent, - compositionEnv: c, + Context: parent, + state: c, } } @@ -165,13 +189,13 @@ type CompositionContext interface { type compositionContext struct { context.Context - compositionEnv *CompositionEnv + state *compositionState accumulatedCost int64 } func (c *compositionContext) Variables(activation any) ref.Val { - lazyMap := lazy.NewMapValue(c.compositionEnv.MapType) - for name, result := range c.compositionEnv.CompiledVariables { + lazyMap := lazy.NewMapValue(c.state.mapType) + for name, result := range c.state.compiledVariables { accessor := &variableAccessor{ name: name, result: result, @@ -184,7 +208,7 @@ func (c *compositionContext) Variables(activation any) ref.Val { } func (f *CompositedConditionEvaluator) ForInput(ctx context.Context, versionedAttr *admission.VersionedAttributes, request *v1.AdmissionRequest, optionalVars OptionalVariableBindings, namespace *corev1.Namespace, runtimeCELCostBudget int64) ([]EvaluationResult, int64, error) { - ctx = f.compositionEnv.CreateContext(ctx) + ctx = f.state.CreateContext(ctx) return f.ConditionEvaluator.ForInput(ctx, versionedAttr, request, optionalVars, namespace, runtimeCELCostBudget) } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/loader.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/loader.go new file mode 100644 index 0000000000..bb160fc10b --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/loader.go @@ -0,0 +1,120 @@ +/* +Copyright 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. +*/ + +// Package manifest provides shared utilities for loading admission configurations +// from static manifest files. +package manifest + +import ( + "bufio" + "bytes" + "crypto/sha256" + "errors" + "fmt" + "io" + "os" + "path/filepath" + "strings" + + utilyaml "k8s.io/apimachinery/pkg/util/yaml" +) + +// splitYAMLDocuments splits a multi-document YAML byte slice into individual documents. +// Empty documents are skipped. +func splitYAMLDocuments(data []byte) ([][]byte, error) { + reader := utilyaml.NewYAMLReader(bufio.NewReader(bytes.NewReader(data))) + var docs [][]byte + for { + doc, err := reader.Read() + if err != nil { + if errors.Is(err, io.EOF) { + break + } + return nil, err + } + doc = bytes.TrimSpace(doc) + if len(doc) == 0 { + continue + } + docs = append(docs, doc) + } + return docs, nil +} + +// FileDoc holds a decoded YAML document and the file it came from. +type FileDoc struct { + FilePath string + Doc []byte +} + +// LoadFiles reads all YAML/JSON files from dir, splits multi-document YAML, +// and returns individual documents with their source file paths plus a +// sha256-prefixed hash of the file contents for change detection. +// Files are processed in alphabetical order for deterministic behavior. +func LoadFiles(dir string) ([]FileDoc, string, error) { + if len(dir) == 0 { + return nil, "", fmt.Errorf("manifest directory path is empty") + } + + // os.ReadDir returns entries sorted by filename. + entries, err := os.ReadDir(dir) + if err != nil { + return nil, "", fmt.Errorf("failed to read manifest directory %q: %w", dir, err) + } + + var fileDocs []FileDoc + h := sha256.New() + hasData := false + + for _, entry := range entries { + if entry.IsDir() { + continue + } + name := entry.Name() + ext := strings.ToLower(filepath.Ext(name)) + if ext != ".yaml" && ext != ".yml" && ext != ".json" { + continue + } + + filePath := filepath.Join(dir, name) + data, err := os.ReadFile(filePath) + if err != nil { + return nil, "", fmt.Errorf("failed to read file %q: %w", filePath, err) + } + if len(data) == 0 { + continue + } + + h.Write(data) + h.Write([]byte{0}) + hasData = true + + docs, err := splitYAMLDocuments(data) + if err != nil { + return nil, "", fmt.Errorf("failed to split YAML documents in file %q: %w", filePath, err) + } + for _, doc := range docs { + fileDocs = append(fileDocs, FileDoc{FilePath: filePath, Doc: doc}) + } + } + + var hash string + if hasData { + hash = fmt.Sprintf("sha256:%x", h.Sum(nil)) + } + + return fileDocs, hash, nil +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/metrics/metrics.go new file mode 100644 index 0000000000..efdf2fe21e --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/metrics/metrics.go @@ -0,0 +1,161 @@ +/* +Copyright 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. +*/ + +// Package metrics provides metrics for manifest-based admission configuration. +package metrics + +import ( + "crypto/sha256" + "fmt" + "sync" + + "k8s.io/apiserver/pkg/util/configmetrics" + "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" +) + +const ( + namespace = "apiserver" + subsystem = "manifest_admission_config_controller" +) + +var ( + admissionManifestAutomaticReloadsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "automatic_reloads_total", + Help: "Total number of automatic reloads of admission manifest configuration split by status, plugin, and apiserver identity.", + StabilityLevel: metrics.ALPHA, + }, + []string{"status", "plugin", "apiserver_id_hash"}, + ) + + admissionManifestAutomaticReloadLastTimestampSeconds = metrics.NewGaugeVec( + &metrics.GaugeOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "automatic_reload_last_timestamp_seconds", + Help: "Timestamp of the last automatic reload of admission manifest configuration split by status, plugin, and apiserver identity.", + StabilityLevel: metrics.ALPHA, + }, + []string{"status", "plugin", "apiserver_id_hash"}, + ) + + admissionManifestLastConfigInfo = metrics.NewDesc( + metrics.BuildFQName(namespace, subsystem, "last_config_info"), + "Information about the last applied admission manifest configuration with hash as label, split by plugin and apiserver identity.", + []string{"plugin", "apiserver_id_hash", "hash"}, + nil, + metrics.ALPHA, + "", + ) +) + +// ManifestType represents the admission plugin name for which manifests are being tracked. +type ManifestType string + +const ( + // ValidatingWebhookManifestType represents validating webhook configurations. + ValidatingWebhookManifestType ManifestType = "ValidatingAdmissionWebhook" + // MutatingWebhookManifestType represents mutating webhook configurations. + MutatingWebhookManifestType ManifestType = "MutatingAdmissionWebhook" + // VAPManifestType represents validating admission policy configurations. + VAPManifestType ManifestType = "ValidatingAdmissionPolicy" + // MAPManifestType represents mutating admission policy configurations. + MAPManifestType ManifestType = "MutatingAdmissionPolicy" +) + +var registerMetrics sync.Once + +// configHashProviders stores providers per plugin for config info metrics. +// Each plugin has its own provider that stores [apiserver_id_hash, config_hash]. +var configHashProviders = map[ManifestType]*configmetrics.AtomicHashProvider{ + ValidatingWebhookManifestType: configmetrics.NewAtomicHashProvider(), + MutatingWebhookManifestType: configmetrics.NewAtomicHashProvider(), + VAPManifestType: configmetrics.NewAtomicHashProvider(), + MAPManifestType: configmetrics.NewAtomicHashProvider(), +} + +// multiTypeConfigInfoCollector emits config info metrics for multiple manifest types. +type multiTypeConfigInfoCollector struct { + metrics.BaseStableCollector + desc *metrics.Desc +} + +var _ metrics.StableCollector = &multiTypeConfigInfoCollector{} + +func (c *multiTypeConfigInfoCollector) DescribeWithStability(ch chan<- *metrics.Desc) { + ch <- c.desc +} + +func (c *multiTypeConfigInfoCollector) CollectWithStability(ch chan<- metrics.Metric) { + // Emit a metric for each plugin that has data + for manifestType, provider := range configHashProviders { + hashes := provider.GetCurrentHashes() + if len(hashes) >= 2 && len(hashes[0]) > 0 { + // hashes contains [apiserver_id_hash, config_hash] + // Prepend the plugin to match label order: ["plugin", "apiserver_id_hash", "hash"] + labelValues := append([]string{string(manifestType)}, hashes...) + ch <- metrics.NewLazyConstMetric(c.desc, metrics.GaugeValue, 1, labelValues...) + } + } +} + +func RegisterMetrics() { + registerMetrics.Do(func() { + legacyregistry.MustRegister(admissionManifestAutomaticReloadsTotal) + legacyregistry.MustRegister(admissionManifestAutomaticReloadLastTimestampSeconds) + // Use a custom collector that emits metrics for all manifest types + legacyregistry.CustomMustRegister(&multiTypeConfigInfoCollector{desc: admissionManifestLastConfigInfo}) + }) +} + +func ResetMetricsForTest() { + admissionManifestAutomaticReloadsTotal.Reset() + admissionManifestAutomaticReloadLastTimestampSeconds.Reset() +} + +// RecordAutomaticReloadFailure records a failed reload attempt for the given manifest type. +func RecordAutomaticReloadFailure(manifestType ManifestType, apiServerID string) { + apiServerIDHash := getHash(apiServerID) + admissionManifestAutomaticReloadsTotal.WithLabelValues("failure", string(manifestType), apiServerIDHash).Inc() + admissionManifestAutomaticReloadLastTimestampSeconds.WithLabelValues("failure", string(manifestType), apiServerIDHash).SetToCurrentTime() +} + +// RecordAutomaticReloadSuccess records a successful reload for the given manifest type. +func RecordAutomaticReloadSuccess(manifestType ManifestType, apiServerID, configHash string) { + apiServerIDHash := getHash(apiServerID) + admissionManifestAutomaticReloadsTotal.WithLabelValues("success", string(manifestType), apiServerIDHash).Inc() + admissionManifestAutomaticReloadLastTimestampSeconds.WithLabelValues("success", string(manifestType), apiServerIDHash).SetToCurrentTime() + + RecordLastConfigInfo(manifestType, apiServerID, configHash) +} + +// RecordLastConfigInfo records the hash of the last successfully loaded configuration. +func RecordLastConfigInfo(manifestType ManifestType, apiServerID, configHash string) { + if provider, ok := configHashProviders[manifestType]; ok { + // Store [apiserver_id_hash, config_hash] - the multiTypeConfigInfoCollector prepends the type + provider.SetHashes(getHash(apiServerID), configHash) + } +} + +func getHash(data string) string { + if len(data) == 0 { + return "" + } + return fmt.Sprintf("sha256:%x", sha256.Sum256([]byte(data))) +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/validation.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/validation.go new file mode 100644 index 0000000000..9effc544f1 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/manifest/validation.go @@ -0,0 +1,74 @@ +/* +Copyright 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. +*/ + +// Package manifest provides shared utilities for loading admission configurations +// from static manifest files. +package manifest + +import ( + "fmt" + "os" + "path" + "strings" + + "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" +) + +// StaticConfigSuffix is the reserved suffix for manifest-based admission configurations. +// Resources with names ending in this suffix can only be created via static manifest +// files loaded at API server startup, not through the REST API. +// NOTE: This constant is duplicated in pkg/apis/admissionregistration/validation/static_suffix.go +// because that package cannot import from staging. Keep both in sync. +const StaticConfigSuffix = ".static.k8s.io" + +// ValidateStaticManifestsDir validates the staticManifestsDir config field. +// It checks the feature gate is enabled, the path is absolute, exists, and is a directory. +func ValidateStaticManifestsDir(staticManifestsDir string) error { + if len(staticManifestsDir) > 0 { + if !utilfeature.DefaultFeatureGate.Enabled(features.ManifestBasedAdmissionControlConfig) { + return field.Forbidden(field.NewPath("staticManifestsDir"), "staticManifestsDir requires the ManifestBasedAdmissionControlConfig feature gate to be enabled") + } + if !path.IsAbs(staticManifestsDir) { + return field.Invalid(field.NewPath("staticManifestsDir"), staticManifestsDir, "must be an absolute file path") + } + info, err := os.Stat(staticManifestsDir) + if err != nil { + return field.Invalid(field.NewPath("staticManifestsDir"), staticManifestsDir, fmt.Sprintf("unable to read: %v", err)) + } + if !info.IsDir() { + return field.Invalid(field.NewPath("staticManifestsDir"), staticManifestsDir, "must be a directory") + } + } + return nil +} + +// ValidateManifestName checks that the object name is non-empty, has the required +// .static.k8s.io suffix, and is unique within the manifest set. +func ValidateManifestName(name, filePath string, seenNames map[string]string) error { + if len(name) == 0 { + return fmt.Errorf("resource in file %q must have a name", filePath) + } + if !strings.HasSuffix(name, StaticConfigSuffix) { + return fmt.Errorf("%q in file %q must have a name ending with %q", name, filePath, StaticConfigSuffix) + } + if prevFile, ok := seenNames[name]; ok { + return fmt.Errorf("duplicate name %q found in file %q (previously seen in %q)", name, filePath, prevFile) + } + seenNames[name] = filePath + return nil +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go index 936a95e45c..12654e2718 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle/admission.go @@ -54,7 +54,7 @@ const ( // Register registers a plugin func Register(plugins *admission.Plugins) { plugins.Register(PluginName, func(config io.Reader) (admission.Interface, error) { - return NewLifecycle(sets.NewString(metav1.NamespaceDefault, metav1.NamespaceSystem, metav1.NamespacePublic)) + return NewLifecycle(sets.New[string](metav1.NamespaceDefault, metav1.NamespaceSystem, metav1.NamespacePublic)) }) } @@ -63,7 +63,7 @@ func Register(plugins *admission.Plugins) { type Lifecycle struct { *admission.Handler client kubernetes.Interface - immortalNamespaces sets.String + immortalNamespaces sets.Set[string] namespaceLister corelisters.NamespaceLister // forceLiveLookupCache holds a list of entries for namespaces that we have a strong reason to believe are stale in our local cache. // if a namespace is in this cache, then we will ignore our local state and always fetch latest from api server. @@ -186,11 +186,11 @@ func (l *Lifecycle) Admit(ctx context.Context, a admission.Attributes, o admissi } // NewLifecycle creates a new namespace Lifecycle admission control handler -func NewLifecycle(immortalNamespaces sets.String) (*Lifecycle, error) { +func NewLifecycle(immortalNamespaces sets.Set[string]) (*Lifecycle, error) { return newLifecycleWithClock(immortalNamespaces, clock.RealClock{}) } -func newLifecycleWithClock(immortalNamespaces sets.String, clock utilcache.Clock) (*Lifecycle, error) { +func newLifecycleWithClock(immortalNamespaces sets.Set[string], clock utilcache.Clock) (*Lifecycle, error) { forceLiveLookupCache := utilcache.NewLRUExpireCacheWithClock(100, clock) return &Lifecycle{ Handler: admission.NewHandler(admission.Create, admission.Update, admission.Delete), diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/doc.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/doc.go new file mode 100644 index 0000000000..03728eda4e --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 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. +*/ + +// +k8s:deepcopy-gen=package + +// Package policyconfig defines the configuration for the validating and mutating admission policy plugins. +package policyconfig // import "k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig" diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/register.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/register.go similarity index 69% rename from vendor/k8s.io/api/autoscaling/v2beta2/register.go rename to vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/register.go index eb1265c168..11976152cd 100644 --- a/vendor/k8s.io/api/autoscaling/v2beta2/register.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/register.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The Kubernetes Authors. +Copyright 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. @@ -14,37 +14,38 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2beta2 +package policyconfig import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" ) +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + // GroupName is the group name use in this package -const GroupName = "autoscaling" +const GroupName = "apiserver.config.k8s.io" // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2beta2"} +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} + +// Kind takes an unqualified kind and returns a Group qualified GroupKind +func Kind(kind string) schema.GroupKind { + return SchemeGroupVersion.WithKind(kind).GroupKind() +} // Resource takes an unqualified resource and returns a Group qualified GroupResource func Resource(resource string) schema.GroupResource { return SchemeGroupVersion.WithResource(resource).GroupResource() } -var ( - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - localSchemeBuilder = &SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme -) - -// Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &HorizontalPodAutoscaler{}, - &HorizontalPodAutoscalerList{}, + &ValidatingAdmissionPolicyConfiguration{}, + &MutatingAdmissionPolicyConfiguration{}, ) - metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/types.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/types.go new file mode 100644 index 0000000000..9af5101222 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/types.go @@ -0,0 +1,63 @@ +/* +Copyright 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. +*/ + +package policyconfig + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ValidatingAdmissionPolicyConfiguration provides configuration for the validating admission policy controller. +type ValidatingAdmissionPolicyConfiguration struct { + metav1.TypeMeta + + // StaticManifestsDir is the path to a directory containing static + // ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding + // resources to be loaded at startup. Files with extensions .yaml, + // .yml, and .json are read. Only admissionregistration.k8s.io/v1 + // resources are supported. + // Using this field requires the ManifestBasedAdmissionControlConfig + // feature gate to be enabled. + // +optional + StaticManifestsDir string +} + +// GetStaticManifestsDir returns the static manifests directory path. +func (c *ValidatingAdmissionPolicyConfiguration) GetStaticManifestsDir() string { + return c.StaticManifestsDir +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MutatingAdmissionPolicyConfiguration provides configuration for the mutating admission policy controller. +type MutatingAdmissionPolicyConfiguration struct { + metav1.TypeMeta + + // StaticManifestsDir is the path to a directory containing static + // MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding + // resources to be loaded at startup. Files with extensions .yaml, + // .yml, and .json are read. Only admissionregistration.k8s.io/v1 + // resources are supported. + // Using this field requires the ManifestBasedAdmissionControlConfig + // feature gate to be enabled. + // +optional + StaticManifestsDir string +} + +// GetStaticManifestsDir returns the static manifests directory path. +func (c *MutatingAdmissionPolicyConfiguration) GetStaticManifestsDir() string { + return c.StaticManifestsDir +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/doc.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/doc.go new file mode 100644 index 0000000000..52837293d5 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 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. +*/ + +// +k8s:deepcopy-gen=package +// +k8s:conversion-gen=k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig + +// Package v1 is the v1 version of the API. +package v1 // import "k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1" diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/register.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/register.go similarity index 91% rename from vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/register.go rename to vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/register.go index 56489f7804..f9b3d1176b 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/register.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/register.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors. +Copyright 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. @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1 import ( "k8s.io/apimachinery/pkg/runtime" @@ -25,7 +25,7 @@ import ( const GroupName = "apiserver.config.k8s.io" // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} var ( // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. @@ -44,7 +44,8 @@ func init() { func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &WebhookAdmission{}, + &ValidatingAdmissionPolicyConfiguration{}, + &MutatingAdmissionPolicyConfiguration{}, ) return nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go new file mode 100644 index 0000000000..967b6ca3f9 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/types.go @@ -0,0 +1,53 @@ +/* +Copyright 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. +*/ + +package v1 + +import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// ValidatingAdmissionPolicyConfiguration provides configuration for the validating admission policy controller. +type ValidatingAdmissionPolicyConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // StaticManifestsDir is the path to a directory containing static + // ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding + // resources to be loaded at startup. Files with extensions .yaml, + // .yml, and .json are read. Only admissionregistration.k8s.io/v1 + // resources are supported. + // Using this field requires the ManifestBasedAdmissionControlConfig + // feature gate to be enabled. + // +optional + StaticManifestsDir string `json:"staticManifestsDir,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MutatingAdmissionPolicyConfiguration provides configuration for the mutating admission policy controller. +type MutatingAdmissionPolicyConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // StaticManifestsDir is the path to a directory containing static + // MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding + // resources to be loaded at startup. Files with extensions .yaml, + // .yml, and .json are read. Only admissionregistration.k8s.io/v1 + // resources are supported. + // Using this field requires the ManifestBasedAdmissionControlConfig + // feature gate to be enabled. + // +optional + StaticManifestsDir string `json:"staticManifestsDir,omitempty"` +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.conversion.go new file mode 100644 index 0000000000..e65c4e52f1 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.conversion.go @@ -0,0 +1,98 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by conversion-gen. DO NOT EDIT. + +package v1 + +import ( + conversion "k8s.io/apimachinery/pkg/conversion" + runtime "k8s.io/apimachinery/pkg/runtime" + policyconfig "k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig" +) + +func init() { + localSchemeBuilder.Register(RegisterConversions) +} + +// RegisterConversions adds conversion functions to the given scheme. +// Public to allow building arbitrary schemes. +func RegisterConversions(s *runtime.Scheme) error { + if err := s.AddGeneratedConversionFunc((*MutatingAdmissionPolicyConfiguration)(nil), (*policyconfig.MutatingAdmissionPolicyConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_MutatingAdmissionPolicyConfiguration_To_policyconfig_MutatingAdmissionPolicyConfiguration(a.(*MutatingAdmissionPolicyConfiguration), b.(*policyconfig.MutatingAdmissionPolicyConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*policyconfig.MutatingAdmissionPolicyConfiguration)(nil), (*MutatingAdmissionPolicyConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_policyconfig_MutatingAdmissionPolicyConfiguration_To_v1_MutatingAdmissionPolicyConfiguration(a.(*policyconfig.MutatingAdmissionPolicyConfiguration), b.(*MutatingAdmissionPolicyConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*ValidatingAdmissionPolicyConfiguration)(nil), (*policyconfig.ValidatingAdmissionPolicyConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ValidatingAdmissionPolicyConfiguration_To_policyconfig_ValidatingAdmissionPolicyConfiguration(a.(*ValidatingAdmissionPolicyConfiguration), b.(*policyconfig.ValidatingAdmissionPolicyConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*policyconfig.ValidatingAdmissionPolicyConfiguration)(nil), (*ValidatingAdmissionPolicyConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_policyconfig_ValidatingAdmissionPolicyConfiguration_To_v1_ValidatingAdmissionPolicyConfiguration(a.(*policyconfig.ValidatingAdmissionPolicyConfiguration), b.(*ValidatingAdmissionPolicyConfiguration), scope) + }); err != nil { + return err + } + return nil +} + +func autoConvert_v1_MutatingAdmissionPolicyConfiguration_To_policyconfig_MutatingAdmissionPolicyConfiguration(in *MutatingAdmissionPolicyConfiguration, out *policyconfig.MutatingAdmissionPolicyConfiguration, s conversion.Scope) error { + out.StaticManifestsDir = in.StaticManifestsDir + return nil +} + +// Convert_v1_MutatingAdmissionPolicyConfiguration_To_policyconfig_MutatingAdmissionPolicyConfiguration is an autogenerated conversion function. +func Convert_v1_MutatingAdmissionPolicyConfiguration_To_policyconfig_MutatingAdmissionPolicyConfiguration(in *MutatingAdmissionPolicyConfiguration, out *policyconfig.MutatingAdmissionPolicyConfiguration, s conversion.Scope) error { + return autoConvert_v1_MutatingAdmissionPolicyConfiguration_To_policyconfig_MutatingAdmissionPolicyConfiguration(in, out, s) +} + +func autoConvert_policyconfig_MutatingAdmissionPolicyConfiguration_To_v1_MutatingAdmissionPolicyConfiguration(in *policyconfig.MutatingAdmissionPolicyConfiguration, out *MutatingAdmissionPolicyConfiguration, s conversion.Scope) error { + out.StaticManifestsDir = in.StaticManifestsDir + return nil +} + +// Convert_policyconfig_MutatingAdmissionPolicyConfiguration_To_v1_MutatingAdmissionPolicyConfiguration is an autogenerated conversion function. +func Convert_policyconfig_MutatingAdmissionPolicyConfiguration_To_v1_MutatingAdmissionPolicyConfiguration(in *policyconfig.MutatingAdmissionPolicyConfiguration, out *MutatingAdmissionPolicyConfiguration, s conversion.Scope) error { + return autoConvert_policyconfig_MutatingAdmissionPolicyConfiguration_To_v1_MutatingAdmissionPolicyConfiguration(in, out, s) +} + +func autoConvert_v1_ValidatingAdmissionPolicyConfiguration_To_policyconfig_ValidatingAdmissionPolicyConfiguration(in *ValidatingAdmissionPolicyConfiguration, out *policyconfig.ValidatingAdmissionPolicyConfiguration, s conversion.Scope) error { + out.StaticManifestsDir = in.StaticManifestsDir + return nil +} + +// Convert_v1_ValidatingAdmissionPolicyConfiguration_To_policyconfig_ValidatingAdmissionPolicyConfiguration is an autogenerated conversion function. +func Convert_v1_ValidatingAdmissionPolicyConfiguration_To_policyconfig_ValidatingAdmissionPolicyConfiguration(in *ValidatingAdmissionPolicyConfiguration, out *policyconfig.ValidatingAdmissionPolicyConfiguration, s conversion.Scope) error { + return autoConvert_v1_ValidatingAdmissionPolicyConfiguration_To_policyconfig_ValidatingAdmissionPolicyConfiguration(in, out, s) +} + +func autoConvert_policyconfig_ValidatingAdmissionPolicyConfiguration_To_v1_ValidatingAdmissionPolicyConfiguration(in *policyconfig.ValidatingAdmissionPolicyConfiguration, out *ValidatingAdmissionPolicyConfiguration, s conversion.Scope) error { + out.StaticManifestsDir = in.StaticManifestsDir + return nil +} + +// Convert_policyconfig_ValidatingAdmissionPolicyConfiguration_To_v1_ValidatingAdmissionPolicyConfiguration is an autogenerated conversion function. +func Convert_policyconfig_ValidatingAdmissionPolicyConfiguration_To_v1_ValidatingAdmissionPolicyConfiguration(in *policyconfig.ValidatingAdmissionPolicyConfiguration, out *ValidatingAdmissionPolicyConfiguration, s conversion.Scope) error { + return autoConvert_policyconfig_ValidatingAdmissionPolicyConfiguration_To_v1_ValidatingAdmissionPolicyConfiguration(in, out, s) +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.deepcopy.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..f4382cd852 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1/zz_generated.deepcopy.go @@ -0,0 +1,76 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicyConfiguration) DeepCopyInto(out *MutatingAdmissionPolicyConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicyConfiguration. +func (in *MutatingAdmissionPolicyConfiguration) DeepCopy() *MutatingAdmissionPolicyConfiguration { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicyConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MutatingAdmissionPolicyConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ValidatingAdmissionPolicyConfiguration) DeepCopyInto(out *ValidatingAdmissionPolicyConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidatingAdmissionPolicyConfiguration. +func (in *ValidatingAdmissionPolicyConfiguration) DeepCopy() *ValidatingAdmissionPolicyConfiguration { + if in == nil { + return nil + } + out := new(ValidatingAdmissionPolicyConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ValidatingAdmissionPolicyConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/zz_generated.deepcopy.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/zz_generated.deepcopy.go new file mode 100644 index 0000000000..cfc56a61ae --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/zz_generated.deepcopy.go @@ -0,0 +1,76 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package policyconfig + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MutatingAdmissionPolicyConfiguration) DeepCopyInto(out *MutatingAdmissionPolicyConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutatingAdmissionPolicyConfiguration. +func (in *MutatingAdmissionPolicyConfiguration) DeepCopy() *MutatingAdmissionPolicyConfiguration { + if in == nil { + return nil + } + out := new(MutatingAdmissionPolicyConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MutatingAdmissionPolicyConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ValidatingAdmissionPolicyConfiguration) DeepCopyInto(out *ValidatingAdmissionPolicyConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ValidatingAdmissionPolicyConfiguration. +func (in *ValidatingAdmissionPolicyConfiguration) DeepCopy() *ValidatingAdmissionPolicyConfiguration { + if in == nil { + return nil + } + out := new(ValidatingAdmissionPolicyConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ValidatingAdmissionPolicyConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/config.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/config.go new file mode 100644 index 0000000000..125b9d8b0b --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/config/config.go @@ -0,0 +1,97 @@ +/* +Copyright 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. +*/ + +package config + +import ( + "fmt" + "io" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/apiserver/pkg/admission/plugin/manifest" + "k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig" + v1 "k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1" +) + +var ( + scheme = runtime.NewScheme() + codecs = serializer.NewCodecFactory(scheme, serializer.EnableStrict) +) + +func init() { + utilruntime.Must(policyconfig.AddToScheme(scheme)) + utilruntime.Must(v1.AddToScheme(scheme)) +} + +// PolicyConfig holds the configuration loaded from the config file. +type PolicyConfig struct { + // StaticManifestsDir is the path to the directory containing static policy manifests. + StaticManifestsDir string +} + +// staticManifestsDirAccessor is implemented by config types that have a StaticManifestsDir field. +type staticManifestsDirAccessor interface { + runtime.Object + GetStaticManifestsDir() string +} + +// LoadValidatingConfig extracts the validating admission policy configuration from configFile. +func LoadValidatingConfig(configFile io.Reader) (PolicyConfig, error) { + return loadConfig(configFile, func(obj runtime.Object) bool { + _, ok := obj.(*policyconfig.ValidatingAdmissionPolicyConfiguration) + return ok + }) +} + +// LoadMutatingConfig extracts the mutating admission policy configuration from configFile. +func LoadMutatingConfig(configFile io.Reader) (PolicyConfig, error) { + return loadConfig(configFile, func(obj runtime.Object) bool { + _, ok := obj.(*policyconfig.MutatingAdmissionPolicyConfiguration) + return ok + }) +} + +func loadConfig(configFile io.Reader, isExpectedType func(runtime.Object) bool) (PolicyConfig, error) { + var cfg PolicyConfig + if configFile == nil { + return cfg, nil + } + + data, err := io.ReadAll(configFile) + if err != nil { + return cfg, err + } + decoder := codecs.UniversalDecoder() + decodedObj, err := runtime.Decode(decoder, data) + if err != nil { + return cfg, err + } + if !isExpectedType(decodedObj) { + return cfg, fmt.Errorf("unexpected type: %T", decodedObj) + } + config, ok := decodedObj.(staticManifestsDirAccessor) + if !ok { + return cfg, fmt.Errorf("type %T does not implement staticManifestsDirAccessor", decodedObj) + } + + if err := manifest.ValidateStaticManifestsDir(config.GetStaticManifestsDir()); err != nil { + return cfg, err + } + cfg.StaticManifestsDir = config.GetStaticManifestsDir() + return cfg, nil +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/composite_policy_source.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/composite_policy_source.go new file mode 100644 index 0000000000..f991674e53 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/composite_policy_source.go @@ -0,0 +1,119 @@ +/* +Copyright 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. +*/ + +package generic + +import ( + "context" + "sync" +) + +// HookSource provides hooks and sync status. This is the minimal interface +// needed for static sources that don't have their own Run lifecycle. +type HookSource[H Hook] interface { + Hooks() []H + HasSynced() bool +} + +// compositePolicySource combines multiple policy sources into a single source. +// Static (manifest-based) policies are returned before API-based policies. +type compositePolicySource[H Hook] struct { + staticSource HookSource[H] + apiSource Source[H] + + mu sync.RWMutex + lastStatic []H + lastAPI []H + lastCombined []H +} + +var _ Source[Hook] = &compositePolicySource[Hook]{} + +// NewCompositePolicySource creates a policy source that combines static and API-based sources. +// Static policies are evaluated first, followed by API-based policies. +// If staticSource is nil, only apiSource policies are returned. +func NewCompositePolicySource[H Hook](staticSource HookSource[H], apiSource Source[H]) Source[H] { + if staticSource == nil { + return apiSource + } + return &compositePolicySource[H]{ + staticSource: staticSource, + apiSource: apiSource, + } +} + +// Hooks returns all policy hooks from both sources. +// Static policies come first, followed by API-based policies. +// The combined slice is cached and reused when the underlying slices haven't changed. +func (c *compositePolicySource[H]) Hooks() []H { + var staticHooks, apiHooks []H + + // Static policies first (platform policies take precedence) + if c.staticSource != nil { + staticHooks = c.staticSource.Hooks() + } + + // Then API-based policies + if c.apiSource != nil { + apiHooks = c.apiSource.Hooks() + } + + c.mu.RLock() + if slicesAreEqual(staticHooks, c.lastStatic) && slicesAreEqual(apiHooks, c.lastAPI) { + combined := c.lastCombined + c.mu.RUnlock() + return combined + } + c.mu.RUnlock() + + c.mu.Lock() + defer c.mu.Unlock() + // Re-check under write lock. + if slicesAreEqual(staticHooks, c.lastStatic) && slicesAreEqual(apiHooks, c.lastAPI) { + return c.lastCombined + } + + combined := make([]H, 0, len(staticHooks)+len(apiHooks)) + combined = append(combined, staticHooks...) + combined = append(combined, apiHooks...) + + c.lastStatic = staticHooks + c.lastAPI = apiHooks + c.lastCombined = combined + return combined +} + +// slicesAreEqual reports whether two slices share the same backing array and length. +func slicesAreEqual[T any](a, b []T) bool { + return len(a) == len(b) && (len(a) == 0 || &a[0] == &b[0]) +} + +// Run starts the API-based source. The static source is started separately +// by the plugin via its own goroutine (file watcher), so this method only +// needs to handle the API source lifecycle. +func (c *compositePolicySource[H]) Run(ctx context.Context) error { + if c.apiSource != nil { + return c.apiSource.Run(ctx) + } + return nil +} + +// HasSynced returns true only when both sources have synced. +func (c *compositePolicySource[H]) HasSynced() bool { + staticSynced := c.staticSource == nil || c.staticSource.HasSynced() + apiSynced := c.apiSource == nil || c.apiSource.HasSynced() + return staticSynced && apiSynced +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go index 03aebdd58a..20771583ce 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/plugin.go @@ -30,6 +30,8 @@ import ( "k8s.io/apiserver/pkg/admission/initializer" "k8s.io/apiserver/pkg/admission/plugin/policy/matching" "k8s.io/apiserver/pkg/authorization/authorizer" + "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/dynamic" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" @@ -37,9 +39,22 @@ import ( // H is the Hook type generated by the source and consumed by the dispatcher. // !TODO: Just pass in a Plugin[H] with accessors to all this information -type sourceFactory[H any] func(informers.SharedInformerFactory, kubernetes.Interface, dynamic.Interface, meta.RESTMapper) Source[H] +type apiSourceFactory[H any] func(informers.SharedInformerFactory, kubernetes.Interface, dynamic.Interface, meta.RESTMapper) Source[H] type dispatcherFactory[H any] func(authorizer.Authorizer, *matching.Matcher, kubernetes.Interface) Dispatcher[H] +// ReloadableSource extends HookSource with a method to run a reload loop +// that watches for configuration changes and blocks until the context is canceled. +type ReloadableSource[H any] interface { + HookSource[H] + // RunReloadLoop watches for configuration changes and reloads when detected. + // It blocks until ctx is canceled. + RunReloadLoop(ctx context.Context) +} + +// StaticSourceFactory creates a static policy source from a manifest directory. +// The returned Source should have LoadInitial() already called. +type StaticSourceFactory[H any] func(manifestsDir string) (ReloadableSource[H], error) + // admissionResources is the list of resources related to CEL-based admission // features. var admissionResources = []schema.GroupResource{ @@ -54,17 +69,37 @@ var admissionResources = []schema.GroupResource{ type Plugin[H any] struct { *admission.Handler - sourceFactory sourceFactory[H] - dispatcherFactory dispatcherFactory[H] + apiSourceFactory apiSourceFactory[H] + dispatcherFactory dispatcherFactory[H] + staticSourceFactory StaticSourceFactory[H] source Source[H] dispatcher Dispatcher[H] matcher *matching.Matcher - informerFactory informers.SharedInformerFactory - client kubernetes.Interface - restMapper meta.RESTMapper - dynamicClient dynamic.Interface + // staticSource holds a reference to only the static (manifest-based) policy source. + // This is used in Dispatch to run static hooks for admission config resources + // (e.g., VAP/MAP/VAPB/MAPB), allowing static policies to protect those resources + // without the circular dependency concern that applies to API-based policies. + staticSource HookSource[H] + + // staticManifestsDir is the path to a directory containing static policy manifests. + // When set and the feature gate is enabled, policies are also loaded from this directory. + staticManifestsDir string + + // apiServerID is the identity of this API server instance, used for metrics labeling. + apiServerID string + + informerFactory informers.SharedInformerFactory + client kubernetes.Interface + restMapper meta.RESTMapper + dynamicClient dynamic.Interface + // admissionConfigResources are admission configuration resources (VAP/MAP/VAPB/MAPB). + // API-based policies skip these to prevent circular dependencies, but static policies + // are safe to evaluate on them. + admissionConfigResources sets.Set[schema.GroupResource] + // excludedResources are non-persisted resources (auth/authz reviews) that must be + // excluded from ALL policy evaluation, including static policies. excludedResources sets.Set[schema.GroupResource] stopCh <-chan struct{} authorizer authorizer.Authorizer @@ -77,6 +112,7 @@ var ( _ initializer.WantsRESTMapper = &Plugin[any]{} _ initializer.WantsDynamicClient = &Plugin[any]{} _ initializer.WantsDrainedNotification = &Plugin[any]{} + _ initializer.WantsAPIServerID = &Plugin[any]{} _ initializer.WantsAuthorizer = &Plugin[any]{} _ initializer.WantsExcludedAdmissionResources = &Plugin[any]{} _ admission.InitializationValidator = &Plugin[any]{} @@ -84,16 +120,18 @@ var ( func NewPlugin[H any]( handler *admission.Handler, - sourceFactory sourceFactory[H], + apiSourceFactory apiSourceFactory[H], dispatcherFactory dispatcherFactory[H], ) *Plugin[H] { return &Plugin[H]{ Handler: handler, - sourceFactory: sourceFactory, + apiSourceFactory: apiSourceFactory, dispatcherFactory: dispatcherFactory, - // always exclude admission/mutating policies and bindings - excludedResources: sets.New(admissionResources...), + // admission config resources are skipped by API-based policies (circular dep) + // but evaluated by static policies + admissionConfigResources: sets.New(admissionResources...), + excludedResources: sets.New[schema.GroupResource](), } } @@ -133,6 +171,34 @@ func (c *Plugin[H]) SetExcludedAdmissionResources(excludedResources []schema.Gro c.excludedResources.Insert(excludedResources...) } +// SetStaticManifestsDir sets the directory containing static policy manifests. +func (c *Plugin[H]) SetStaticManifestsDir(dir string) { + c.staticManifestsDir = dir +} + +// GetStaticManifestsDir returns the directory containing static policy manifests. +func (c *Plugin[H]) GetStaticManifestsDir() string { + return c.staticManifestsDir +} + +// SetStaticSourceFactory sets the factory for creating static policy sources. +// This should be called before ValidateInitialization. +func (c *Plugin[H]) SetStaticSourceFactory(factory StaticSourceFactory[H]) { + c.staticSourceFactory = factory +} + +// SetAPIServerID implements the WantsAPIServerID interface. +// The API server ID is used for metrics labeling and must be set before +// ValidateInitialization is called. +func (c *Plugin[H]) SetAPIServerID(id string) { + c.apiServerID = id +} + +// GetAPIServerID returns the stored API server ID. +func (c *Plugin[H]) GetAPIServerID() string { + return c.apiServerID +} + // ValidateInitialization - once clientset and informer factory are provided, creates and starts the admission controller func (c *Plugin[H]) ValidateInitialization() error { // By default enabled is set to false. It is up to types which embed this @@ -162,38 +228,74 @@ func (c *Plugin[H]) ValidateInitialization() error { return errors.New("missing authorizer") } - // Use default matcher + // Guard: if static manifests dir is set but feature gate is off, return an error + if len(c.staticManifestsDir) > 0 && !utilfeature.DefaultFeatureGate.Enabled(features.ManifestBasedAdmissionControlConfig) { + return fmt.Errorf("static policy manifests dir %q configured but %s feature gate is not enabled", c.staticManifestsDir, features.ManifestBasedAdmissionControlConfig) + } + namespaceInformer := c.informerFactory.Core().V1().Namespaces() - c.matcher = matching.NewMatcher(namespaceInformer.Lister(), c.client) + // Construct matcher once, avoiding overwriting if already set. + if c.matcher == nil { + c.matcher = matching.NewMatcher(namespaceInformer.Lister(), c.client) + } if err := c.matcher.ValidateInitialization(); err != nil { return err } - c.source = c.sourceFactory(c.informerFactory, c.client, c.dynamicClient, c.restMapper) - c.dispatcher = c.dispatcherFactory(c.authorizer, c.matcher, c.client) - + // Create a shared context tied to server shutdown for all background goroutines. pluginContext, pluginContextCancel := context.WithCancel(context.Background()) go func() { defer pluginContextCancel() <-c.stopCh }() - go func() { - err := c.source.Run(pluginContext) - if err != nil && !errors.Is(err, context.Canceled) { - utilruntime.HandleError(fmt.Errorf("policy source context unexpectedly closed: %w", err)) + // Construct source once, avoiding overwriting if already set. + if c.source == nil { + apiSource := c.apiSourceFactory(c.informerFactory, c.client, c.dynamicClient, c.restMapper) + + if len(c.staticManifestsDir) > 0 { + if c.staticSourceFactory == nil { + return fmt.Errorf("static policy manifests configured in %q but no static source factory is set", c.staticManifestsDir) + } + staticSource, err := c.staticSourceFactory(c.staticManifestsDir) + if err != nil { + return fmt.Errorf("failed to load static policy manifests from %q: %w", c.staticManifestsDir, err) + } + // Use composite source that combines static + API sources + c.source = NewCompositePolicySource(staticSource, apiSource) + // Keep a reference to the static source so Dispatch can run static hooks + // for resources that are normally excluded from policy evaluation. + c.staticSource = staticSource + // Start the file watcher in a background goroutine + go staticSource.RunReloadLoop(pluginContext) + } else { + // Use only API-based source + c.source = apiSource } - }() - err := c.dispatcher.Start(pluginContext) - if err != nil && !errors.Is(err, context.Canceled) { - utilruntime.HandleError(fmt.Errorf("policy dispatcher context unexpectedly closed: %w", err)) + go func() { + err := c.source.Run(pluginContext) + if err != nil && !errors.Is(err, context.Canceled) { + utilruntime.HandleError(fmt.Errorf("policy source context unexpectedly closed: %w", err)) + } + }() + + c.SetReadyFunc(func() bool { + return namespaceInformer.Informer().HasSynced() && c.source.HasSynced() + }) + } + + // Construct dispatcher once, avoiding overwriting if already set. + if c.dispatcher == nil { + c.dispatcher = c.dispatcherFactory(c.authorizer, c.matcher, c.client) + + err := c.dispatcher.Start(pluginContext) + if err != nil && !errors.Is(err, context.Canceled) { + utilruntime.HandleError(fmt.Errorf("policy dispatcher context unexpectedly closed: %w", err)) + } } - c.SetReadyFunc(func() bool { - return namespaceInformer.Informer().HasSynced() && c.source.HasSynced() - }) return nil } @@ -204,18 +306,42 @@ func (c *Plugin[H]) Dispatch( ) (err error) { if !c.enabled { return nil - } else if c.shouldIgnoreResource(a) { + } + + gr := a.GetResource().GroupResource() + + if c.isExcludedFromAllHooks(gr) { + // Non-persisted resources (auth/authz reviews) are excluded from all policy + // evaluation to avoid breaking the cluster. + return nil + } else if c.isExcludedFromAPIHooks(gr) { + // Admission config resources (VAP/MAP/VAPB/MAPB) are excluded from API-based + // policies to prevent circular dependencies. However, static (manifest-based) + // policies are safe to evaluate since they don't have self-referential concerns. + if c.staticSource != nil { + if !c.staticSource.HasSynced() { + return admission.NewForbidden(a, fmt.Errorf("not yet ready to handle request")) + } + return c.dispatcher.Dispatch(ctx, a, o, c.staticSource.Hooks()) + } return nil - } else if !c.WaitForReady() { + } + + if !c.WaitForReady() { return admission.NewForbidden(a, fmt.Errorf("not yet ready to handle request")) } return c.dispatcher.Dispatch(ctx, a, o, c.source.Hooks()) } -func (c *Plugin[H]) shouldIgnoreResource(attr admission.Attributes) bool { - gvr := attr.GetResource() - // exclusion decision ignores the version. - gr := gvr.GroupResource() +// isExcludedFromAllHooks returns true for non-persisted resources (auth/authz reviews) +// that must not be intercepted by any policy hook. +func (c *Plugin[H]) isExcludedFromAllHooks(gr schema.GroupResource) bool { return c.excludedResources.Has(gr) } + +// isExcludedFromAPIHooks returns true for admission config resources (VAP/MAP/VAPB/MAPB) +// that are excluded from API-based hooks but may be evaluated by static hooks. +func (c *Plugin[H]) isExcludedFromAPIHooks(gr schema.GroupResource) bool { + return c.admissionConfigResources.Has(gr) +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go index b98c10e705..5a98902864 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/generic/policy_test_context.go @@ -164,7 +164,7 @@ func NewPolicyTestContext[P, B runtime.Object, E Evaluator]( return policiesAndBindingsTracker.List(fakePolicyGVR, fakePolicyGVK, "") }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - return policiesAndBindingsTracker.Watch(fakePolicyGVR, "") + return policiesAndBindingsTracker.Watch(fakePolicyGVR, "", options) }, }, policiesAndBindingsTracker), Pexample, @@ -177,7 +177,7 @@ func NewPolicyTestContext[P, B runtime.Object, E Evaluator]( return policiesAndBindingsTracker.List(fakeBindingGVR, fakeBindingGVK, "") }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { - return policiesAndBindingsTracker.Watch(fakeBindingGVR, "") + return policiesAndBindingsTracker.Watch(fakeBindingGVR, "", options) }, }, policiesAndBindingsTracker), Bexample, diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/internal/generic/controller.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/internal/generic/controller.go index a94004c272..65ffee4e2f 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/internal/generic/controller.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/internal/generic/controller.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" "sync" - "sync/atomic" "time" kerrors "k8s.io/apimachinery/pkg/api/errors" @@ -48,10 +47,7 @@ type controller[T runtime.Object] struct { options ControllerOptions - // must hold a func() bool or nil - notificationsDelivered atomic.Value - - hasProcessed synctrack.AsyncTracker[string] + hasProcessed *synctrack.AsyncTracker[string] } type ControllerOptions struct { @@ -77,17 +73,11 @@ func NewController[T runtime.Object]( } c := &controller[T]{ - options: options, - informer: informer, - reconciler: reconciler, - queue: nil, - } - c.hasProcessed.UpstreamHasSynced = func() bool { - f := c.notificationsDelivered.Load() - if f == nil { - return false - } - return f.(func() bool)() + options: options, + informer: informer, + reconciler: reconciler, + queue: nil, + hasProcessed: synctrack.NewAsyncTracker[string](options.Name), } return c } @@ -159,12 +149,9 @@ func (c *controller[T]) Run(ctx context.Context) error { return err } - c.notificationsDelivered.Store(registration.HasSynced) - // Make sure event handler is removed from informer in case return early from // an error defer func() { - c.notificationsDelivered.Store(func() bool { return false }) // Remove event handler and Handle Error here. Error should only be raised // for improper usage of event handler API. if err := c.informer.RemoveEventHandler(registration); err != nil { @@ -174,7 +161,12 @@ func (c *controller[T]) Run(ctx context.Context) error { // Wait for initial cache list to complete before beginning to reconcile // objects. - if !cache.WaitForNamedCacheSyncWithContext(ctx, c.informer.HasSynced) { + if !cache.WaitFor(ctx, "caches", c.informer.HasSyncedChecker(), registration.HasSyncedChecker()) { + // TODO: should cache.WaitFor return an error? + // ctx.Err() or context.Cause(ctx)? + // Either of them would make dead code like the "if err == nil" + // below more obvious. + // ctx cancelled during cache sync. return early err := ctx.Err() if err == nil { @@ -184,6 +176,10 @@ func (c *controller[T]) Run(ctx context.Context) error { return err } + // c.informer *and* our handler have synced, which implies that our AddFunc(= enqueue) + // and thus c.hasProcessed.Start have been called for the initial list => upstream is done. + c.hasProcessed.UpstreamHasSynced() + waitGroup := sync.WaitGroup{} for i := uint(0); i < c.options.Workers; i++ { diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/manifest/source/source.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/manifest/source/source.go new file mode 100644 index 0000000000..0e37d78645 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/manifest/source/source.go @@ -0,0 +1,192 @@ +/* +Copyright 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. +*/ + +// Package source provides a Source implementation that loads policy configurations from manifest files. +package source + +import ( + "context" + "fmt" + "sync/atomic" + "time" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/admission/plugin/manifest/metrics" + "k8s.io/apiserver/pkg/admission/plugin/policy/generic" + "k8s.io/apiserver/pkg/util/filesystem" + "k8s.io/klog/v2" +) + +// defaultReloadInterval is the default interval at which the manifest directory is checked for changes. +var defaultReloadInterval = 1 * time.Minute + +// SetReloadIntervalForTests sets the reload interval for testing and returns a function to restore the original value. +func SetReloadIntervalForTests(interval time.Duration) func() { + original := defaultReloadInterval + defaultReloadInterval = interval + return func() { + defaultReloadInterval = original + } +} + +// PolicyLoadFunc loads policy and binding manifests from a directory. +type PolicyLoadFunc[P, B runtime.Object] func(dir string) ([]P, []B, string, error) + +// PolicyCompiler compiles a policy into an Evaluator. +type PolicyCompiler[P runtime.Object, E generic.Evaluator] func(P) (E, error) + +// BindingPolicyName extracts the policy name referenced by a binding. +type BindingPolicyName[B runtime.Object] func(B) string + +// StaticPolicySource provides policy configurations loaded from manifest files. +type StaticPolicySource[P, B runtime.Object, E generic.Evaluator] struct { + manifestsDir string + apiServerID string + reloadInterval time.Duration + compiler PolicyCompiler[P, E] + loadFunc PolicyLoadFunc[P, B] + getBindingPolicyName BindingPolicyName[B] + manifestType metrics.ManifestType + + current atomic.Pointer[[]generic.PolicyHook[P, B, E]] + lastReadHash atomic.Pointer[string] // hash of last file content read (for short-circuiting) + hasSynced atomic.Bool +} + +// NewStaticPolicySource creates a new static policy source that loads configurations from the specified directory. +func NewStaticPolicySource[P, B runtime.Object, E generic.Evaluator]( + manifestsDir, apiServerID string, + compiler PolicyCompiler[P, E], + loadFunc PolicyLoadFunc[P, B], + getBindingPolicyName BindingPolicyName[B], + manifestType metrics.ManifestType, +) *StaticPolicySource[P, B, E] { + metrics.RegisterMetrics() + return &StaticPolicySource[P, B, E]{ + manifestsDir: manifestsDir, + apiServerID: apiServerID, + reloadInterval: defaultReloadInterval, + compiler: compiler, + loadFunc: loadFunc, + getBindingPolicyName: getBindingPolicyName, + manifestType: manifestType, + } +} + +// LoadInitial performs the initial load of manifests. +// This should be called during API server startup and will fail if the manifests cannot be loaded. +func (s *StaticPolicySource[P, B, E]) LoadInitial() error { + policies, bindings, hash, err := s.loadFunc(s.manifestsDir) + if err != nil { + return err + } + + hooks, err := s.compile(policies, bindings) + if err != nil { + return err + } + s.current.Store(&hooks) + s.lastReadHash.Store(&hash) + s.hasSynced.Store(true) + + klog.InfoS("Loaded manifest-based admission policy configurations", "plugin", string(s.manifestType), "count", len(hooks)) + metrics.RecordAutomaticReloadSuccess(s.manifestType, s.apiServerID, hash) + return nil +} + +// RunReloadLoop watches for configuration changes and reloads when detected. +// It blocks until ctx is canceled. +func (s *StaticPolicySource[P, B, E]) RunReloadLoop(ctx context.Context) { + filesystem.WatchUntil( + ctx, + s.reloadInterval, + s.manifestsDir, + func() { + s.checkAndReload() + }, + func(err error) { + klog.ErrorS(err, "watching manifest directory", "plugin", string(s.manifestType), "dir", s.manifestsDir) + }, + ) +} + +func (s *StaticPolicySource[P, B, E]) compile(policies []P, bindings []B) ([]generic.PolicyHook[P, B, E], error) { + bindingsByPolicy := make(map[string][]B) + for _, binding := range bindings { + policyName := s.getBindingPolicyName(binding) + bindingsByPolicy[policyName] = append(bindingsByPolicy[policyName], binding) + } + + var hooks []generic.PolicyHook[P, B, E] + for _, policy := range policies { + nameGetter, ok := any(policy).(interface{ GetName() string }) + if !ok { + return nil, fmt.Errorf("policy type %T does not implement GetName()", policy) + } + evaluator, err := s.compiler(policy) + if err != nil { + return nil, fmt.Errorf("failed to compile policy %q: %w", nameGetter.GetName(), err) + } + hook := generic.PolicyHook[P, B, E]{ + Policy: policy, + Bindings: bindingsByPolicy[nameGetter.GetName()], + Evaluator: evaluator, + } + hooks = append(hooks, hook) + } + + return hooks, nil +} + +func (s *StaticPolicySource[P, B, E]) checkAndReload() { + policies, bindings, hash, err := s.loadFunc(s.manifestsDir) + if err != nil { + klog.ErrorS(err, "reloading manifest config", "plugin", string(s.manifestType), "dir", s.manifestsDir) + metrics.RecordAutomaticReloadFailure(s.manifestType, s.apiServerID) + return + } + + // Short-circuit if file content hasn't changed since last read. + if last := s.lastReadHash.Load(); last != nil && hash == *last { + return + } + s.lastReadHash.Store(&hash) + + hooks, err := s.compile(policies, bindings) + if err != nil { + klog.ErrorS(err, "compiling manifest config", "plugin", string(s.manifestType), "dir", s.manifestsDir) + metrics.RecordAutomaticReloadFailure(s.manifestType, s.apiServerID) + return + } + s.current.Store(&hooks) + + klog.InfoS("reloaded manifest config", "plugin", string(s.manifestType), "dir", s.manifestsDir) + metrics.RecordAutomaticReloadSuccess(s.manifestType, s.apiServerID, hash) +} + +// HasSynced returns true if the initial load has completed. +func (s *StaticPolicySource[P, B, E]) HasSynced() bool { + return s.hasSynced.Load() +} + +// Hooks returns the list of policy hooks. +func (s *StaticPolicySource[P, B, E]) Hooks() []generic.PolicyHook[P, B, E] { + current := s.current.Load() + if current == nil { + return nil + } + return *current +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/accessor.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/accessor.go index ff342623a9..b20103c574 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/accessor.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/accessor.go @@ -18,7 +18,6 @@ package mutating import ( v1 "k8s.io/api/admissionregistration/v1" - "k8s.io/api/admissionregistration/v1beta1" "k8s.io/apimachinery/pkg/types" "k8s.io/apiserver/pkg/admission/plugin/policy/generic" ) @@ -59,19 +58,11 @@ func (v *mutatingAdmissionPolicyAccessor) GetParamKind() *v1.ParamKind { } func (v *mutatingAdmissionPolicyAccessor) GetMatchConstraints() *v1.MatchResources { - return convertV1alpha1ResourceRulesToV1(v.Spec.MatchConstraints) + return v.Spec.MatchConstraints } func (v *mutatingAdmissionPolicyAccessor) GetFailurePolicy() *v1.FailurePolicyType { - return toV1FailurePolicy(v.Spec.FailurePolicy) -} - -func toV1FailurePolicy(failurePolicy *v1beta1.FailurePolicyType) *v1.FailurePolicyType { - if failurePolicy == nil { - return nil - } - fp := v1.FailurePolicyType(*failurePolicy) - return &fp + return v.Spec.FailurePolicy } type mutatingAdmissionPolicyBindingAccessor struct { @@ -94,7 +85,7 @@ func (v *mutatingAdmissionPolicyBindingAccessor) GetPolicyName() types.Namespace } func (v *mutatingAdmissionPolicyBindingAccessor) GetMatchResources() *v1.MatchResources { - return convertV1alpha1ResourceRulesToV1(v.Spec.MatchResources) + return v.Spec.MatchResources } func (v *mutatingAdmissionPolicyBindingAccessor) GetParamRef() *v1.ParamRef { @@ -115,30 +106,3 @@ func (v *mutatingAdmissionPolicyBindingAccessor) GetParamRef() *v1.ParamRef { ParameterNotFoundAction: nfa, } } - -func convertV1alpha1ResourceRulesToV1(mc *v1beta1.MatchResources) *v1.MatchResources { - if mc == nil { - return nil - } - - var res v1.MatchResources - res.NamespaceSelector = mc.NamespaceSelector - res.ObjectSelector = mc.ObjectSelector - for _, ex := range mc.ExcludeResourceRules { - res.ExcludeResourceRules = append(res.ExcludeResourceRules, v1.NamedRuleWithOperations{ - ResourceNames: ex.ResourceNames, - RuleWithOperations: ex.RuleWithOperations, - }) - } - for _, ex := range mc.ResourceRules { - res.ResourceRules = append(res.ResourceRules, v1.NamedRuleWithOperations{ - ResourceNames: ex.ResourceNames, - RuleWithOperations: ex.RuleWithOperations, - }) - } - if mc.MatchPolicy != nil { - mp := v1.MatchPolicyType(*mc.MatchPolicy) - res.MatchPolicy = &mp - } - return &res -} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/compilation.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/compilation.go index 121c3b4004..a0772aab44 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/compilation.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/compilation.go @@ -19,9 +19,10 @@ package mutating import ( "fmt" - "k8s.io/api/admissionregistration/v1beta1" + "k8s.io/api/admissionregistration/v1" plugincel "k8s.io/apiserver/pkg/admission/plugin/cel" "k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch" + "k8s.io/apiserver/pkg/admission/plugin/policy/validating" "k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions" apiservercel "k8s.io/apiserver/pkg/cel" "k8s.io/apiserver/pkg/cel/environment" @@ -32,7 +33,7 @@ import ( // // Each individual mutation is compiled into MutationEvaluationFunc and // returned is a PolicyEvaluator in the same order as the mutations appeared in the policy. -func compilePolicy(policy *Policy) PolicyEvaluator { +func compilePolicy(policy *v1.MutatingAdmissionPolicy) PolicyEvaluator { opts := plugincel.OptionalVariableDeclarations{HasParams: policy.Spec.ParamKind != nil, HasAuthorizer: true} compiler, err := plugincel.NewCompositedCompiler(environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion())) if err != nil { @@ -43,7 +44,7 @@ func compilePolicy(policy *Policy) PolicyEvaluator { } // Compile and store variables - compiler.CompileAndStoreVariables(convertv1alpha1Variables(policy.Spec.Variables), opts, environment.StoredExpressions) + compiler.CompileAndStoreVariables(convertV1Variables(policy.Spec.Variables), opts, environment.StoredExpressions) // Compile matchers var matcher matchconditions.Matcher = nil @@ -53,7 +54,7 @@ func compilePolicy(policy *Policy) PolicyEvaluator { for i := range matchConditions { matchExpressionAccessors[i] = (*matchconditions.MatchCondition)(&matchConditions[i]) } - matcher = matchconditions.NewMatcher(compiler.CompileCondition(matchExpressionAccessors, opts, environment.StoredExpressions), toV1FailurePolicy(policy.Spec.FailurePolicy), "policy", "validate", policy.Name) + matcher = matchconditions.NewMatcher(compiler.CompileCondition(matchExpressionAccessors, opts, environment.StoredExpressions), policy.Spec.FailurePolicy, "policy", "validate", policy.Name) } // Compiler patchers @@ -62,13 +63,13 @@ func compilePolicy(policy *Policy) PolicyEvaluator { patchOptions.HasPatchTypes = true for _, m := range policy.Spec.Mutations { switch m.PatchType { - case v1beta1.PatchTypeJSONPatch: + case v1.PatchTypeJSONPatch: if m.JSONPatch != nil { accessor := &patch.JSONPatchCondition{Expression: m.JSONPatch.Expression} compileResult := compiler.CompileMutatingEvaluator(accessor, patchOptions, environment.StoredExpressions) patchers = append(patchers, patch.NewJSONPatcher(compileResult)) } - case v1beta1.PatchTypeApplyConfiguration: + case v1.PatchTypeApplyConfiguration: if m.ApplyConfiguration != nil { accessor := &patch.ApplyConfigurationCondition{Expression: m.ApplyConfiguration.Expression} compileResult := compiler.CompileMutatingEvaluator(accessor, patchOptions, environment.StoredExpressions) @@ -77,5 +78,19 @@ func compilePolicy(policy *Policy) PolicyEvaluator { } } - return PolicyEvaluator{Matcher: matcher, Mutators: patchers, CompositionEnv: compiler.CompositionEnv} + return PolicyEvaluator{Matcher: matcher, Mutators: patchers, CompositedCompiler: compiler} +} + +func convertV1Variables(variables []v1.Variable) []plugincel.NamedExpressionAccessor { + if variables == nil { + return nil + } + res := make([]plugincel.NamedExpressionAccessor, len(variables)) + for i, v := range variables { + res[i] = &validating.Variable{ + Name: v.Name, + Expression: v.Expression, + } + } + return res } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go index 53dbd6486f..e5b10c7f6d 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/dispatcher.go @@ -22,7 +22,7 @@ import ( "fmt" "time" - "k8s.io/api/admissionregistration/v1beta1" + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" v1 "k8s.io/api/core/v1" apiequality "k8s.io/apimachinery/pkg/api/equality" k8serrors "k8s.io/apimachinery/pkg/api/errors" @@ -137,8 +137,8 @@ func (d *dispatcher) dispatchInvocations( // Should loop through invocations, handling possible error and invoking // evaluator to apply patch, also should handle re-invocations for _, invocation := range invocations { - if invocation.Evaluator.CompositionEnv != nil { - ctx = invocation.Evaluator.CompositionEnv.CreateContext(ctx) + if invocation.Evaluator.CompositedCompiler != nil { + ctx = invocation.Evaluator.CompositedCompiler.CreateContext(ctx) } if len(invocation.Evaluator.Mutators) != len(invocation.Policy.Spec.Mutations) { // This would be a bug. The compiler should always return exactly as @@ -210,7 +210,7 @@ func (d *dispatcher) dispatchInvocations( policyReinvokeCtx.RequireReinvokingPreviouslyInvokedPlugins() reinvokeCtx.SetShouldReinvoke() } - if invocation.Policy.Spec.ReinvocationPolicy == v1beta1.IfNeededReinvocationPolicy { + if invocation.Policy.Spec.ReinvocationPolicy == admissionregistrationv1.IfNeededReinvocationPolicy { policyReinvokeCtx.AddReinvocablePolicyToPreviouslyInvoked(invocationKey) } } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go index 20e4d2d0c4..01dd230dea 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/mutating/plugin.go @@ -18,18 +18,23 @@ package mutating import ( "context" - celgo "github.com/google/cel-go/cel" "io" - "k8s.io/api/admissionregistration/v1beta1" + celgo "github.com/google/cel-go/cel" + + v1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/managedfields" "k8s.io/apiserver/pkg/admission" + "k8s.io/apiserver/pkg/admission/initializer" "k8s.io/apiserver/pkg/admission/plugin/cel" + "k8s.io/apiserver/pkg/admission/plugin/manifest/metrics" + "k8s.io/apiserver/pkg/admission/plugin/policy/config" "k8s.io/apiserver/pkg/admission/plugin/policy/generic" + "k8s.io/apiserver/pkg/admission/plugin/policy/manifest/source" "k8s.io/apiserver/pkg/admission/plugin/policy/matching" "k8s.io/apiserver/pkg/admission/plugin/policy/mutating/patch" "k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions" @@ -49,13 +54,13 @@ const ( // Register registers a plugin func Register(plugins *admission.Plugins) { plugins.Register(PluginName, func(configFile io.Reader) (admission.Interface, error) { - return NewPlugin(configFile), nil + return NewPlugin(configFile) }) } -type Policy = v1beta1.MutatingAdmissionPolicy -type PolicyBinding = v1beta1.MutatingAdmissionPolicyBinding -type PolicyMutation = v1beta1.Mutation +type Policy = v1.MutatingAdmissionPolicy +type PolicyBinding = v1.MutatingAdmissionPolicyBinding + type PolicyHook = generic.PolicyHook[*Policy, *PolicyBinding, PolicyEvaluator] type Mutator struct { @@ -73,10 +78,10 @@ type MutationEvaluationFunc func( ) (runtime.Object, error) type PolicyEvaluator struct { - Matcher matchconditions.Matcher - Mutators []patch.Patcher - CompositionEnv *cel.CompositionEnv - Error error + Matcher matchconditions.Matcher + Mutators []patch.Patcher + CompositedCompiler *cel.CompositedCompiler + Error error } // Plugin is an implementation of admission.Interface. @@ -86,9 +91,43 @@ type Plugin struct { var _ admission.Interface = &Plugin{} var _ admission.MutationInterface = &Plugin{} +var _ initializer.WantsManifestLoaders = &Plugin{} + +// SetManifestLoaders provides the manifest load functions for scheme-based defaulting and validation. +func (a *Plugin) SetManifestLoaders(loaders *initializer.ManifestLoaders) { + if loaders == nil || loaders.LoadMutatingPolicyManifests == nil { + return + } + loadFunc := loaders.LoadMutatingPolicyManifests + a.SetStaticSourceFactory(func(manifestsDir string) (generic.ReloadableSource[PolicyHook], error) { + staticSource := source.NewStaticPolicySource(manifestsDir, a.GetAPIServerID(), + func(p *v1.MutatingAdmissionPolicy) (PolicyEvaluator, error) { + e := compilePolicy(p) + if e.Error != nil { + return PolicyEvaluator{}, e.Error + } + return e, nil + }, + func(dir string) ([]*v1.MutatingAdmissionPolicy, []*v1.MutatingAdmissionPolicyBinding, string, error) { + return loadFunc(dir) + }, + func(b *v1.MutatingAdmissionPolicyBinding) string { return b.Spec.PolicyName }, + metrics.MAPManifestType, + ) + if err := staticSource.LoadInitial(); err != nil { + return nil, err + } + return staticSource, nil + }) +} // NewPlugin returns a generic admission webhook plugin. -func NewPlugin(_ io.Reader) *Plugin { +func NewPlugin(configFile io.Reader) (*Plugin, error) { + cfg, err := config.LoadMutatingConfig(configFile) + if err != nil { + return nil, err + } + // There is no request body to mutate for DELETE, so this plugin never handles that operation. handler := admission.NewHandler(admission.Create, admission.Update, admission.Connect) res := &Plugin{} @@ -96,8 +135,8 @@ func NewPlugin(_ io.Reader) *Plugin { handler, func(f informers.SharedInformerFactory, client kubernetes.Interface, dynamicClient dynamic.Interface, restMapper meta.RESTMapper) generic.Source[PolicyHook] { return generic.NewPolicySource( - f.Admissionregistration().V1beta1().MutatingAdmissionPolicies().Informer(), - f.Admissionregistration().V1beta1().MutatingAdmissionPolicyBindings().Informer(), + f.Admissionregistration().V1().MutatingAdmissionPolicies().Informer(), + f.Admissionregistration().V1().MutatingAdmissionPolicyBindings().Informer(), NewMutatingAdmissionPolicyAccessor, NewMutatingAdmissionPolicyBindingAccessor, compilePolicy, @@ -112,7 +151,8 @@ func NewPlugin(_ io.Reader) *Plugin { return NewDispatcher(a, m, patch.NewTypeConverterManager(nil, client.Discovery().OpenAPIV3())) }, ) - return res + res.SetStaticManifestsDir(cfg.StaticManifestsDir) + return res, nil } // Admit makes an admission decision based on the request attributes. @@ -141,11 +181,3 @@ func (v *Variable) ReturnTypes() []*celgo.Type { func (v *Variable) GetName() string { return v.Name } - -func convertv1alpha1Variables(variables []v1beta1.Variable) []cel.NamedExpressionAccessor { - namedExpressions := make([]cel.NamedExpressionAccessor, len(variables)) - for i, variable := range variables { - namedExpressions[i] = &Variable{Name: variable.Name, Expression: variable.Expression} - } - return namedExpressions -} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go index 97eeb95504..fd8015e7ce 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/interface.go @@ -92,4 +92,6 @@ type Validator interface { // Validate is used to take cel evaluations and convert into decisions // runtimeCELCostBudget was added for testing purpose only. Callers should always use const RuntimeCELCostBudget from k8s.io/apiserver/pkg/apis/cel/config.go as input. Validate(ctx context.Context, matchedResource schema.GroupVersionResource, versionedAttr *admission.VersionedAttributes, versionedParams runtime.Object, namespace *corev1.Namespace, runtimeCELCostBudget int64, authz authorizer.Authorizer) ValidateResult + // CompileError returns any error from CEL compilation, or nil if compilation succeeded. + CompileError() error } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go index bdca01e691..348ecde2d0 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/plugin.go @@ -26,7 +26,10 @@ import ( "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission/initializer" "k8s.io/apiserver/pkg/admission/plugin/cel" + "k8s.io/apiserver/pkg/admission/plugin/manifest/metrics" + "k8s.io/apiserver/pkg/admission/plugin/policy/config" "k8s.io/apiserver/pkg/admission/plugin/policy/generic" + "k8s.io/apiserver/pkg/admission/plugin/policy/manifest/source" "k8s.io/apiserver/pkg/admission/plugin/policy/matching" "k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions" "k8s.io/apiserver/pkg/authorization/authorizer" @@ -43,16 +46,12 @@ const ( var ( lazyCompositionEnvTemplateWithStrictCostInit sync.Once - lazyCompositionEnvTemplateWithStrictCost *cel.CompositionEnv + lazyCompositionEnvTemplateWithStrictCost *environment.EnvSet ) -func getCompositionEnvTemplateWithStrictCost() *cel.CompositionEnv { +func getCompositionEnvTemplateWithStrictCost() *environment.EnvSet { lazyCompositionEnvTemplateWithStrictCostInit.Do(func() { - env, err := cel.NewCompositionEnv(cel.VariablesTypeName, environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion())) - if err != nil { - panic(err) - } - lazyCompositionEnvTemplateWithStrictCost = env + lazyCompositionEnvTemplateWithStrictCost = environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion()) }) return lazyCompositionEnvTemplateWithStrictCost } @@ -60,7 +59,7 @@ func getCompositionEnvTemplateWithStrictCost() *cel.CompositionEnv { // Register registers a plugin func Register(plugins *admission.Plugins) { plugins.Register(PluginName, func(configFile io.Reader) (admission.Interface, error) { - return NewPlugin(configFile), nil + return NewPlugin(configFile) }) } @@ -77,8 +76,42 @@ type Plugin struct { var _ admission.Interface = &Plugin{} var _ admission.ValidationInterface = &Plugin{} var _ initializer.WantsExcludedAdmissionResources = &Plugin{} +var _ initializer.WantsManifestLoaders = &Plugin{} + +// SetManifestLoaders provides the manifest load functions for scheme-based defaulting and validation. +func (a *Plugin) SetManifestLoaders(loaders *initializer.ManifestLoaders) { + if loaders == nil || loaders.LoadValidatingPolicyManifests == nil { + return + } + loadFunc := loaders.LoadValidatingPolicyManifests + a.SetStaticSourceFactory(func(manifestsDir string) (generic.ReloadableSource[PolicyHook], error) { + staticSource := source.NewStaticPolicySource(manifestsDir, a.GetAPIServerID(), + func(p *v1.ValidatingAdmissionPolicy) (Validator, error) { + v := compilePolicy(p) + if err := v.CompileError(); err != nil { + return nil, err + } + return v, nil + }, + func(dir string) ([]*v1.ValidatingAdmissionPolicy, []*v1.ValidatingAdmissionPolicyBinding, string, error) { + return loadFunc(dir) + }, + func(b *v1.ValidatingAdmissionPolicyBinding) string { return b.Spec.PolicyName }, + metrics.VAPManifestType, + ) + if err := staticSource.LoadInitial(); err != nil { + return nil, err + } + return staticSource, nil + }) +} + +func NewPlugin(configFile io.Reader) (*Plugin, error) { + cfg, err := config.LoadValidatingConfig(configFile) + if err != nil { + return nil, err + } -func NewPlugin(_ io.Reader) *Plugin { handler := admission.NewHandler(admission.Connect, admission.Create, admission.Delete, admission.Update) p := &Plugin{ @@ -102,7 +135,8 @@ func NewPlugin(_ io.Reader) *Plugin { ), } p.SetEnabled(true) - return p + p.SetStaticManifestsDir(cfg.StaticManifestsDir) + return p, nil } // Validate makes an admission decision based on the request attributes. @@ -120,9 +154,11 @@ func compilePolicy(policy *Policy) Validator { failurePolicy := policy.Spec.FailurePolicy var matcher matchconditions.Matcher = nil matchConditions := policy.Spec.MatchConditions - var compositionEnvTemplate *cel.CompositionEnv - compositionEnvTemplate = getCompositionEnvTemplateWithStrictCost() - filterCompiler := cel.NewCompositedCompilerFromTemplate(compositionEnvTemplate) + compositionEnvTemplate := getCompositionEnvTemplateWithStrictCost() + filterCompiler, err := cel.NewCompositedCompiler(compositionEnvTemplate) + if err != nil { + return NewValidator(nil, nil, nil, nil, failurePolicy, err) + } filterCompiler.CompileAndStoreVariables(convertv1beta1Variables(policy.Spec.Variables), optionalVars, environment.StoredExpressions) if len(matchConditions) > 0 { @@ -138,6 +174,7 @@ func compilePolicy(policy *Policy) Validator { filterCompiler.CompileCondition(convertv1AuditAnnotations(policy.Spec.AuditAnnotations), optionalVars, environment.StoredExpressions), filterCompiler.CompileCondition(convertv1MessageExpressions(policy.Spec.Validations), expressionOptionalVars, environment.StoredExpressions), failurePolicy, + nil, ) return res diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/typechecking.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/typechecking.go index 6a284e6de9..c8b258f163 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/typechecking.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/typechecking.go @@ -177,20 +177,17 @@ func (c *TypeChecker) CreateContext(policy *v1.ValidatingAdmissionPolicy) *TypeC func (c *TypeChecker) compiler(ctx *TypeCheckingContext, typeOverwrite typeOverwrite) (*plugincel.CompositedCompiler, error) { envSet, err := buildEnvSet( - /* hasParams */ ctx.paramDeclType != nil, + /* hasParams */ !ctx.paramGVK.Empty(), /* hasAuthorizer */ true, typeOverwrite) if err != nil { return nil, err } - env, err := plugincel.NewCompositionEnv(plugincel.VariablesTypeName, envSet) + compiler, err := plugincel.NewCompositedCompilerForTypeChecking(envSet) if err != nil { return nil, err } - compiler := &plugincel.CompositedCompiler{ - Compiler: &typeCheckingCompiler{typeOverwrite: typeOverwrite, compositionEnv: env}, - CompositionEnv: env, - } + compiler.Compiler = &typeCheckingCompiler{typeOverwrite: typeOverwrite, compiler: compiler} return compiler, nil } @@ -208,7 +205,7 @@ func (c *TypeChecker) CheckExpression(ctx *TypeCheckingContext, expression strin continue } options := plugincel.OptionalVariableDeclarations{ - HasParams: ctx.paramDeclType != nil, + HasParams: !ctx.paramGVK.Empty(), HasAuthorizer: true, } compiler.CompileAndStoreVariables(convertv1beta1Variables(ctx.variables), options, environment.StoredExpressions) @@ -247,7 +244,11 @@ func (c *TypeChecker) declType(gvk schema.GroupVersionKind) (*apiservercel.DeclT if err != nil { return nil, err } - return common.SchemaDeclType(&openapi.Schema{Schema: s}, true).MaybeAssignTypeName(generateUniqueTypeName(gvk.Kind)), nil + declType := common.SchemaDeclType(&openapi.Schema{Schema: s}, true) + if declType == nil { + return nil, nil + } + return declType.MaybeAssignTypeName(generateUniqueTypeName(gvk.Kind)), nil } func (c *TypeChecker) paramsGVK(policy *v1.ValidatingAdmissionPolicy) schema.GroupVersionKind { @@ -407,12 +408,16 @@ func buildEnvSet(hasParams bool, hasAuthorizer bool, types typeOverwrite) (*envi varOpts = append(varOpts, createVariableOpts(requestType, plugincel.RequestVarName)...) // object and oldObject, same type, type(s) resolved from constraints - declTypes = append(declTypes, types.object) + if types.object != nil { + declTypes = append(declTypes, types.object) + } varOpts = append(varOpts, createVariableOpts(types.object, plugincel.ObjectVarName, plugincel.OldObjectVarName)...) // params, defined by ParamKind - if hasParams && types.params != nil { - declTypes = append(declTypes, types.params) + if hasParams { + if types.params != nil { + declTypes = append(declTypes, types.params) + } varOpts = append(varOpts, createVariableOpts(types.params, plugincel.ParamsVarName)...) } @@ -449,8 +454,8 @@ func createVariableOpts(declType *apiservercel.DeclType, variables ...string) [] } type typeCheckingCompiler struct { - compositionEnv *plugincel.CompositionEnv - typeOverwrite typeOverwrite + compiler *plugincel.CompositedCompiler + typeOverwrite typeOverwrite } // CompileCELExpression compiles the given expression. @@ -469,7 +474,7 @@ func (c *typeCheckingCompiler) CompileCELExpression(expressionAccessor plugincel ExpressionAccessor: expressionAccessor, } } - env, err := c.compositionEnv.Env(mode) + env, err := c.compiler.Env(mode) if err != nil { return resultError(fmt.Sprintf("fail to build env: %v", err), apiservercel.ErrorTypeInternal) } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go index 4057e515ee..2144795fd8 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/policy/validating/validator.go @@ -45,15 +45,19 @@ type validator struct { auditAnnotationFilter cel.ConditionEvaluator messageFilter cel.ConditionEvaluator failPolicy *v1.FailurePolicyType + // compileError holds any compilation error from the CEL expressions. + // If non-nil, the validator will return an error result based on the failPolicy. + compileError error } -func NewValidator(validationFilter cel.ConditionEvaluator, celMatcher matchconditions.Matcher, auditAnnotationFilter, messageFilter cel.ConditionEvaluator, failPolicy *v1.FailurePolicyType) Validator { +func NewValidator(validationFilter cel.ConditionEvaluator, celMatcher matchconditions.Matcher, auditAnnotationFilter, messageFilter cel.ConditionEvaluator, failPolicy *v1.FailurePolicyType, err error) Validator { return &validator{ celMatcher: celMatcher, validationFilter: validationFilter, auditAnnotationFilter: auditAnnotationFilter, messageFilter: messageFilter, failPolicy: failPolicy, + compileError: err, } } @@ -71,6 +75,10 @@ func auditAnnotationEvaluationForError(f v1.FailurePolicyType) PolicyAuditAnnota return AuditAnnotationActionError } +func (v *validator) CompileError() error { + return v.compileError +} + // Validate takes a list of Evaluation and a failure policy and converts them into actionable PolicyDecisions // runtimeCELCostBudget was added for testing purpose only. Callers should always use const RuntimeCELCostBudget from k8s.io/apiserver/pkg/apis/cel/config.go as input. @@ -81,6 +89,17 @@ func (v *validator) Validate(ctx context.Context, matchedResource schema.GroupVe } else { f = *v.failPolicy } + if v.compileError != nil { + return ValidateResult{ + Decisions: []PolicyDecision{ + { + Action: policyDecisionActionForError(f), + Evaluation: EvalError, + Message: v.compileError.Error(), + }, + }, + } + } if v.celMatcher != nil { matchResults := v.celMatcher.Match(ctx, versionedAttr, versionedParams, authz) if matchResults.Error != nil { diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/types.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/types.go index 71ce47b1f4..f6ba94e7cd 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/types.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/types.go @@ -26,4 +26,14 @@ type WebhookAdmission struct { // KubeConfigFile is the path to the kubeconfig file. KubeConfigFile string + + // StaticManifestsDir is the path to a directory containing static webhook + // configurations to be loaded at startup. Files with extensions .yaml, + // .yml, and .json are read. Only admissionregistration.k8s.io/v1 + // ValidatingWebhookConfiguration and MutatingWebhookConfiguration + // resources are supported. + // Using this field requires the ManifestBasedAdmissionControlConfig + // feature gate to be enabled. + // +optional + StaticManifestsDir string } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go index 632427d7df..be09205348 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/types.go @@ -26,4 +26,14 @@ type WebhookAdmission struct { // KubeConfigFile is the path to the kubeconfig file. KubeConfigFile string `json:"kubeConfigFile"` + + // StaticManifestsDir is the path to a directory containing static webhook + // configurations to be loaded at startup. Files with extensions .yaml, + // .yml, and .json are read. Only admissionregistration.k8s.io/v1 + // ValidatingWebhookConfiguration and MutatingWebhookConfiguration + // resources are supported. + // Using this field requires the ManifestBasedAdmissionControlConfig + // feature gate to be enabled. + // +optional + StaticManifestsDir string `json:"staticManifestsDir,omitempty"` } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/zz_generated.conversion.go index 4cf69291b3..90235e1e9d 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1/zz_generated.conversion.go @@ -49,6 +49,7 @@ func RegisterConversions(s *runtime.Scheme) error { func autoConvert_v1_WebhookAdmission_To_webhookadmission_WebhookAdmission(in *WebhookAdmission, out *webhookadmission.WebhookAdmission, s conversion.Scope) error { out.KubeConfigFile = in.KubeConfigFile + out.StaticManifestsDir = in.StaticManifestsDir return nil } @@ -59,6 +60,7 @@ func Convert_v1_WebhookAdmission_To_webhookadmission_WebhookAdmission(in *Webhoo func autoConvert_webhookadmission_WebhookAdmission_To_v1_WebhookAdmission(in *webhookadmission.WebhookAdmission, out *WebhookAdmission, s conversion.Scope) error { out.KubeConfigFile = in.KubeConfigFile + out.StaticManifestsDir = in.StaticManifestsDir return nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/doc.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/doc.go deleted file mode 100644 index 703f467f9f..0000000000 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/doc.go +++ /dev/null @@ -1,23 +0,0 @@ -/* -Copyright 2017 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. -*/ - -// +k8s:deepcopy-gen=package -// +k8s:conversion-gen=k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission -// +k8s:defaulter-gen=TypeMeta -// +groupName=apiserver.config.k8s.io - -// Package v1alpha1 is the v1alpha1 version of the API. -package v1alpha1 diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.conversion.go deleted file mode 100644 index 66aaecbd86..0000000000 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.conversion.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build !ignore_autogenerated -// +build !ignore_autogenerated - -/* -Copyright 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. -*/ - -// Code generated by conversion-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - conversion "k8s.io/apimachinery/pkg/conversion" - runtime "k8s.io/apimachinery/pkg/runtime" - webhookadmission "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission" -) - -func init() { - localSchemeBuilder.Register(RegisterConversions) -} - -// RegisterConversions adds conversion functions to the given scheme. -// Public to allow building arbitrary schemes. -func RegisterConversions(s *runtime.Scheme) error { - if err := s.AddGeneratedConversionFunc((*WebhookAdmission)(nil), (*webhookadmission.WebhookAdmission)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_WebhookAdmission_To_webhookadmission_WebhookAdmission(a.(*WebhookAdmission), b.(*webhookadmission.WebhookAdmission), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*webhookadmission.WebhookAdmission)(nil), (*WebhookAdmission)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_webhookadmission_WebhookAdmission_To_v1alpha1_WebhookAdmission(a.(*webhookadmission.WebhookAdmission), b.(*WebhookAdmission), scope) - }); err != nil { - return err - } - return nil -} - -func autoConvert_v1alpha1_WebhookAdmission_To_webhookadmission_WebhookAdmission(in *WebhookAdmission, out *webhookadmission.WebhookAdmission, s conversion.Scope) error { - out.KubeConfigFile = in.KubeConfigFile - return nil -} - -// Convert_v1alpha1_WebhookAdmission_To_webhookadmission_WebhookAdmission is an autogenerated conversion function. -func Convert_v1alpha1_WebhookAdmission_To_webhookadmission_WebhookAdmission(in *WebhookAdmission, out *webhookadmission.WebhookAdmission, s conversion.Scope) error { - return autoConvert_v1alpha1_WebhookAdmission_To_webhookadmission_WebhookAdmission(in, out, s) -} - -func autoConvert_webhookadmission_WebhookAdmission_To_v1alpha1_WebhookAdmission(in *webhookadmission.WebhookAdmission, out *WebhookAdmission, s conversion.Scope) error { - out.KubeConfigFile = in.KubeConfigFile - return nil -} - -// Convert_webhookadmission_WebhookAdmission_To_v1alpha1_WebhookAdmission is an autogenerated conversion function. -func Convert_webhookadmission_WebhookAdmission_To_v1alpha1_WebhookAdmission(in *webhookadmission.WebhookAdmission, out *WebhookAdmission, s conversion.Scope) error { - return autoConvert_webhookadmission_WebhookAdmission_To_v1alpha1_WebhookAdmission(in, out, s) -} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/kubeconfig.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/kubeconfig.go index 7b845f1d19..1b751effa0 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/kubeconfig.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/kubeconfig.go @@ -25,46 +25,49 @@ import ( "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/validation/field" + "k8s.io/apiserver/pkg/admission/plugin/manifest" "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission" - "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1" - "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1" + v1 "k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1" ) var ( scheme = runtime.NewScheme() - codecs = serializer.NewCodecFactory(scheme) + codecs = serializer.NewCodecFactory(scheme, serializer.EnableStrict) ) func init() { utilruntime.Must(webhookadmission.AddToScheme(scheme)) utilruntime.Must(v1.AddToScheme(scheme)) - utilruntime.Must(v1alpha1.AddToScheme(scheme)) } -// LoadConfig extract the KubeConfigFile from configFile -func LoadConfig(configFile io.Reader) (string, error) { - var kubeconfigFile string - if configFile != nil { - // we have a config so parse it. - data, err := io.ReadAll(configFile) - if err != nil { - return "", err - } - decoder := codecs.UniversalDecoder() - decodedObj, err := runtime.Decode(decoder, data) - if err != nil { - return "", err - } - config, ok := decodedObj.(*webhookadmission.WebhookAdmission) - if !ok { - return "", fmt.Errorf("unexpected type: %T", decodedObj) - } +// LoadConfig extracts the webhook admission configuration from configFile. +func LoadConfig(configFile io.Reader) (*webhookadmission.WebhookAdmission, error) { + if configFile == nil { + return &webhookadmission.WebhookAdmission{}, nil + } + // we have a config so parse it. + data, err := io.ReadAll(configFile) + if err != nil { + return nil, err + } + decoder := codecs.UniversalDecoder() + decodedObj, err := runtime.Decode(decoder, data) + if err != nil { + return nil, err + } + config, ok := decodedObj.(*webhookadmission.WebhookAdmission) + if !ok { + return nil, fmt.Errorf("unexpected type: %T", decodedObj) + } - if !path.IsAbs(config.KubeConfigFile) { - return "", field.Invalid(field.NewPath("kubeConfigFile"), config.KubeConfigFile, "must be an absolute file path") - } + // KubeConfigFile may be empty when only staticManifestsDir is configured. + if len(config.KubeConfigFile) > 0 && !path.IsAbs(config.KubeConfigFile) { + return nil, field.Invalid(field.NewPath("kubeConfigFile"), config.KubeConfigFile, "must be an absolute file path") + } - kubeconfigFile = config.KubeConfigFile + if err := manifest.ValidateStaticManifestsDir(config.StaticManifestsDir); err != nil { + return nil, err } - return kubeconfigFile, nil + + return config, nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/composite_webhook_source.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/composite_webhook_source.go new file mode 100644 index 0000000000..3b38c9fade --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/composite_webhook_source.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +package generic + +import ( + "sync" + + "k8s.io/apiserver/pkg/admission/plugin/webhook" +) + +// compositeWebhookSource combines multiple webhook sources into a single source. +// Static (manifest-based) webhooks are returned before API-based webhooks. +type compositeWebhookSource struct { + staticSource Source + apiSource Source + + mu sync.RWMutex + lastStaticSlice []webhook.WebhookAccessor + lastAPISlice []webhook.WebhookAccessor + lastCombined []webhook.WebhookAccessor +} + +var _ Source = &compositeWebhookSource{} + +// NewCompositeWebhookSource creates a webhook source that combines static and API-based sources. +// Static webhooks are evaluated first, followed by API-based webhooks. +// If staticSource is nil, only apiSource webhooks are returned. +func NewCompositeWebhookSource(staticSource, apiSource Source) Source { + if staticSource == nil { + return apiSource + } + return &compositeWebhookSource{ + staticSource: staticSource, + apiSource: apiSource, + } +} + +// Webhooks returns all webhook accessors from both sources. +// Static webhooks come first, followed by API-based webhooks. +// The combined slice is cached and reused when the underlying slices haven't changed. +func (c *compositeWebhookSource) Webhooks() []webhook.WebhookAccessor { + var staticSlice, apiSlice []webhook.WebhookAccessor + if c.staticSource != nil { + staticSlice = c.staticSource.Webhooks() + } + if c.apiSource != nil { + apiSlice = c.apiSource.Webhooks() + } + + c.mu.RLock() + if slicesAreEqual(c.lastStaticSlice, staticSlice) && slicesAreEqual(c.lastAPISlice, apiSlice) { + combined := c.lastCombined + c.mu.RUnlock() + return combined + } + c.mu.RUnlock() + + c.mu.Lock() + defer c.mu.Unlock() + // Re-check under write lock. + if slicesAreEqual(c.lastStaticSlice, staticSlice) && slicesAreEqual(c.lastAPISlice, apiSlice) { + return c.lastCombined + } + + combined := make([]webhook.WebhookAccessor, 0, len(staticSlice)+len(apiSlice)) + combined = append(combined, staticSlice...) + combined = append(combined, apiSlice...) + + c.lastStaticSlice = staticSlice + c.lastAPISlice = apiSlice + c.lastCombined = combined + return combined +} + +// slicesAreEqual reports whether two slices share the same backing array and length. +func slicesAreEqual[T any](a, b []T) bool { + return len(a) == len(b) && (len(a) == 0 || &a[0] == &b[0]) +} + +// HasSynced returns true only when both sources have synced. +func (c *compositeWebhookSource) HasSynced() bool { + staticSynced := c.staticSource == nil || c.staticSource.HasSynced() + apiSynced := c.apiSource == nil || c.apiSource.HasSynced() + return staticSynced && apiSynced +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go index bf646d0080..cef27b2330 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/generic/webhook.go @@ -22,6 +22,7 @@ import ( "io" "k8s.io/apiserver/pkg/cel/environment" + utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/klog/v2" admissionv1 "k8s.io/api/admission/v1" @@ -39,8 +40,10 @@ import ( "k8s.io/apiserver/pkg/admission/plugin/webhook/predicates/object" "k8s.io/apiserver/pkg/admission/plugin/webhook/predicates/rules" "k8s.io/apiserver/pkg/authorization/authorizer" + "k8s.io/apiserver/pkg/features" webhookutil "k8s.io/apiserver/pkg/util/webhook" "k8s.io/client-go/informers" + coreinformers "k8s.io/client-go/informers/core/v1" clientset "k8s.io/client-go/kubernetes" ) @@ -48,28 +51,63 @@ import ( type Webhook struct { *admission.Handler - sourceFactory sourceFactory + // Factories for creating webhook sources. + apiSourceFactory sourceFactory + staticSourceFactory StaticSourceFactory - hookSource Source - clientManager *webhookutil.ClientManager - namespaceMatcher *namespace.Matcher - objectMatcher *object.Matcher - dispatcher Dispatcher - filterCompiler cel.ConditionCompiler - authorizer authorizer.Authorizer + // Configuration provided via admission config file and initializers. + staticManifestsDir string // path to static webhook manifest directory (optional) + apiServerID string // identity of this API server instance, used for metrics + + // hookSource is the webhook source used at admission time. When staticManifestsDir + // is configured, this is a composite source combining staticSource (loaded from disk) + // with apiSource (from the API). Otherwise, it points directly to apiSource. + hookSource Source + // apiSource provides webhook configurations from the Kubernetes API (informer-based). + apiSource Source + // staticSource holds a reference to only the static (manifest-based) webhook source. + // This can be used to route requests for excluded resources to static hooks only. + staticSource ReloadableSource + + // Admission-time dependencies. + namespaceInformer coreinformers.NamespaceInformer + clientManager *webhookutil.ClientManager + namespaceMatcher *namespace.Matcher + objectMatcher *object.Matcher + dispatcher Dispatcher + filterCompiler cel.ConditionCompiler + authorizer authorizer.Authorizer + + // Lifecycle. + stopCh <-chan struct{} } var ( _ genericadmissioninit.WantsExternalKubeClientSet = &Webhook{} + _ genericadmissioninit.WantsDrainedNotification = &Webhook{} + _ genericadmissioninit.WantsAPIServerID = &Webhook{} _ admission.Interface = &Webhook{} ) type sourceFactory func(f informers.SharedInformerFactory) Source type dispatcherFactory func(cm *webhookutil.ClientManager) Dispatcher +// ReloadableSource extends Source with a method to run a reload loop +// that watches for configuration changes and blocks until the context is canceled. +type ReloadableSource interface { + Source + // RunReloadLoop watches for configuration changes and reloads when detected. + // It blocks until ctx is canceled. + RunReloadLoop(ctx context.Context) +} + +// StaticSourceFactory creates a static webhook source from a manifest directory. +// The returned Source should have LoadInitial() already called. +type StaticSourceFactory func(manifestsDir string) (ReloadableSource, error) + // NewWebhook creates a new generic admission webhook. func NewWebhook(handler *admission.Handler, configFile io.Reader, sourceFactory sourceFactory, dispatcherFactory dispatcherFactory) (*Webhook, error) { - kubeconfigFile, err := config.LoadConfig(configFile) + cfg, err := config.LoadConfig(configFile) if err != nil { return nil, err } @@ -85,7 +123,7 @@ func NewWebhook(handler *admission.Handler, configFile io.Reader, sourceFactory if err != nil { return nil, err } - authInfoResolver, err := webhookutil.NewDefaultAuthenticationInfoResolver(kubeconfigFile) + authInfoResolver, err := webhookutil.NewDefaultAuthenticationInfoResolver(cfg.KubeConfigFile) if err != nil { return nil, err } @@ -94,13 +132,14 @@ func NewWebhook(handler *admission.Handler, configFile io.Reader, sourceFactory cm.SetServiceResolver(webhookutil.NewDefaultServiceResolver()) return &Webhook{ - Handler: handler, - sourceFactory: sourceFactory, - clientManager: &cm, - namespaceMatcher: &namespace.Matcher{}, - objectMatcher: &object.Matcher{}, - dispatcher: dispatcherFactory(&cm), - filterCompiler: cel.NewConditionCompiler(environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion())), + Handler: handler, + apiSourceFactory: sourceFactory, + staticManifestsDir: cfg.StaticManifestsDir, + clientManager: &cm, + namespaceMatcher: &namespace.Matcher{}, + objectMatcher: &object.Matcher{}, + dispatcher: dispatcherFactory(&cm), + filterCompiler: cel.NewConditionCompiler(environment.MustBaseEnvSet(environment.DefaultCompatibilityVersion())), }, nil } @@ -117,6 +156,29 @@ func (a *Webhook) SetServiceResolver(sr webhookutil.ServiceResolver) { a.clientManager.SetServiceResolver(sr) } +// SetStaticSourceFactory sets the factory for creating static webhook sources. +// This should be called before SetExternalKubeInformerFactory. +func (a *Webhook) SetStaticSourceFactory(factory StaticSourceFactory) { + a.staticSourceFactory = factory +} + +// SetAPIServerID implements the WantsAPIServerID interface. +// The API server ID is used for metrics labeling and must be set before +// SetExternalKubeInformerFactory is called. +func (a *Webhook) SetAPIServerID(id string) { + a.apiServerID = id +} + +// GetAPIServerID returns the stored API server ID. +func (a *Webhook) GetAPIServerID() string { + return a.apiServerID +} + +// SetDrainedNotification implements the WantsDrainedNotification interface. +func (a *Webhook) SetDrainedNotification(stopCh <-chan struct{}) { + a.stopCh = stopCh +} + // SetExternalKubeClientSet implements the WantsExternalKubeInformerFactory interface. // It sets external ClientSet for admission plugins that need it func (a *Webhook) SetExternalKubeClientSet(client clientset.Interface) { @@ -127,10 +189,10 @@ func (a *Webhook) SetExternalKubeClientSet(client clientset.Interface) { func (a *Webhook) SetExternalKubeInformerFactory(f informers.SharedInformerFactory) { namespaceInformer := f.Core().V1().Namespaces() a.namespaceMatcher.NamespaceLister = namespaceInformer.Lister() - a.hookSource = a.sourceFactory(f) - a.SetReadyFunc(func() bool { - return namespaceInformer.Informer().HasSynced() && a.hookSource.HasSynced() - }) + a.namespaceInformer = namespaceInformer + + // Create the API-based source (stored for later use in ValidateInitialization) + a.apiSource = a.apiSourceFactory(f) } func (a *Webhook) SetAuthorizer(authorizer authorizer.Authorizer) { @@ -138,8 +200,10 @@ func (a *Webhook) SetAuthorizer(authorizer authorizer.Authorizer) { } // ValidateInitialization implements the InitializationValidator interface. +// Static source creation happens here (after all initializers have run) because +// SetManifestLoaders may be called after SetExternalKubeInformerFactory. func (a *Webhook) ValidateInitialization() error { - if a.hookSource == nil { + if a.apiSource == nil { return fmt.Errorf("kubernetes client is not properly setup") } if err := a.namespaceMatcher.Validate(); err != nil { @@ -148,6 +212,46 @@ func (a *Webhook) ValidateInitialization() error { if err := a.clientManager.Validate(); err != nil { return fmt.Errorf("clientManager is not properly setup: %v", err) } + + // Guard: if static manifests dir is set but feature gate is off, return an error + if len(a.staticManifestsDir) > 0 && !utilfeature.DefaultFeatureGate.Enabled(features.ManifestBasedAdmissionControlConfig) { + return fmt.Errorf("static webhook manifests dir %q configured but %s feature gate is not enabled", a.staticManifestsDir, features.ManifestBasedAdmissionControlConfig) + } + + // Construct hookSource. The static source path (which starts goroutines) + // is guarded to avoid duplicate construction. The API-only path is a cheap + // pointer assignment that must reflect the latest apiSource. + if len(a.staticManifestsDir) > 0 { + if a.hookSource == nil { + if a.staticSourceFactory == nil { + return fmt.Errorf("static webhook manifests configured in %q but no static source factory is set", a.staticManifestsDir) + } + if a.stopCh == nil { + return fmt.Errorf("stopCh not set: WantsDrainedNotification must be called before ValidateInitialization") + } + staticSource, err := a.staticSourceFactory(a.staticManifestsDir) + if err != nil { + return fmt.Errorf("failed to load static webhook manifests from %q: %w", a.staticManifestsDir, err) + } + a.staticSource = staticSource + // Start the file watcher in a background goroutine, tied to server shutdown + staticCtx, staticCancel := context.WithCancel(context.Background()) + go func() { + defer staticCancel() + <-a.stopCh + }() + go staticSource.RunReloadLoop(staticCtx) + // Use composite source that combines static + API sources + a.hookSource = NewCompositeWebhookSource(staticSource, a.apiSource) + } + } else { + a.hookSource = a.apiSource + } + + a.SetReadyFunc(func() bool { + return a.namespaceInformer.Informer().HasSynced() && a.hookSource.HasSynced() + }) + return nil } @@ -252,6 +356,16 @@ func (a *attrWithResourceOverride) GetResource() schema.GroupVersionResource { r // Dispatch is called by the downstream Validate or Admit methods. func (a *Webhook) Dispatch(ctx context.Context, attr admission.Attributes, o admission.ObjectInterfaces) error { if rules.IsExemptAdmissionConfigurationResource(attr) { + // Admission config resources are excluded from API-based webhooks to + // prevent circular dependencies. However, static (manifest-based) webhooks + // are safe to evaluate since they don't have self-referential concerns. + if a.staticSource != nil { + if !a.staticSource.HasSynced() { + return admission.NewForbidden(attr, fmt.Errorf("not yet ready to handle request")) + } + hooks := a.staticSource.Webhooks() + return a.dispatcher.Dispatch(ctx, attr, o, hooks) + } return nil } if !a.WaitForReady() { diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/loader/loader.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/loader/loader.go new file mode 100644 index 0000000000..258e5b47d7 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/loader/loader.go @@ -0,0 +1,220 @@ +/* +Copyright 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. +*/ + +// Package loader provides generic functionality to load webhook configurations +// from manifest files. It handles file reading, YAML/JSON decoding, and generic +// manifest validation. Type-specific defaulting and validation (e.g., scheme-based +// defaulting via internal types) are injected by callers through the AcceptObjectFunc +// callback. +package loader + +import ( + "fmt" + "sort" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/admission/plugin/manifest" + "k8s.io/apiserver/pkg/admission/plugin/webhook" +) + +// AcceptObjectFunc extracts typed items from a decoded runtime.Object, applying +// defaulting and validation. Returns the extracted items, or an error if the +// object type is not recognized or processing fails. +type AcceptObjectFunc[T metav1.Object] func(obj runtime.Object) ([]T, error) + +// LoadManifests loads webhook configurations from manifest files in dir using +// the provided decoder and acceptObject callback. It handles file I/O, YAML +// splitting, decoding, v1.List unwrapping, manifest name validation, webhook +// client config validation, and deterministic sorting by name. +func LoadManifests[T metav1.Object]( + dir string, + decoder runtime.Decoder, + acceptObject AcceptObjectFunc[T], +) ([]T, string, error) { + fileDocs, hash, err := manifest.LoadFiles(dir) + if err != nil { + return nil, "", err + } + + configs := make([]T, 0) + seenNames := map[string]string{} + + for _, fd := range fileDocs { + obj, _, err := decoder.Decode(fd.Doc, nil, nil) + if err != nil { + return nil, "", fmt.Errorf("error loading %s: %w", fd.FilePath, err) + } + + items, err := acceptFileObject(obj, fd.FilePath, seenNames, decoder, acceptObject) + if err != nil { + return nil, "", fmt.Errorf("error loading %s: %w", fd.FilePath, err) + } + configs = append(configs, items...) + } + + sort.Slice(configs, func(i, j int) bool { + return configs[i].GetName() < configs[j].GetName() + }) + + return configs, hash, nil +} + +// acceptFileObject handles type dispatch for a decoded object, including +// generic v1.List unwrapping, manifest name validation, item validation, +// and the default unsupported-type error. +func acceptFileObject[T metav1.Object]( + obj runtime.Object, + filePath string, + seenNames map[string]string, + decoder runtime.Decoder, + acceptObject AcceptObjectFunc[T], +) ([]T, error) { + // Handle generic v1.List by recursing into each item + if list, ok := obj.(*metav1.List); ok { + var allItems []T + for _, rawItem := range list.Items { + itemObj, _, err := decoder.Decode(rawItem.Raw, nil, nil) + if err != nil { + return nil, fmt.Errorf("failed to decode list item: %w", err) + } + items, err := acceptFileObject(itemObj, filePath, seenNames, decoder, acceptObject) + if err != nil { + return nil, err + } + allItems = append(allItems, items...) + } + return allItems, nil + } + + items, err := acceptObject(obj) + if err != nil { + return nil, err + } + for _, item := range items { + if err := validateAcceptedItem(item, filePath, seenNames); err != nil { + return nil, err + } + } + return items, nil +} + +// validateAcceptedItem runs manifest name validation and webhook client config validation. +func validateAcceptedItem[T metav1.Object](item T, filePath string, seenNames map[string]string) error { + name := item.GetName() + if err := manifest.ValidateManifestName(name, filePath, seenNames); err != nil { + return err + } + // Validate webhook client configs for webhook configuration types. + obj, ok := any(item).(runtime.Object) + if !ok { + return fmt.Errorf("type %T does not implement runtime.Object", item) + } + return validateWebhookClientConfigs(obj, name, filePath) +} + +// validateWebhookClientConfigs validates that all webhooks in a configuration +// use URL-based client config (service references are not supported for manifests). +func validateWebhookClientConfigs(obj runtime.Object, configName, filePath string) error { + switch c := obj.(type) { + case *admissionregistrationv1.ValidatingWebhookConfiguration: + for _, wh := range c.Webhooks { + if err := ValidateWebhookClientConfig(wh.Name, configName, filePath, wh.ClientConfig); err != nil { + return err + } + } + case *admissionregistrationv1.MutatingWebhookConfiguration: + for _, wh := range c.Webhooks { + if err := ValidateWebhookClientConfig(wh.Name, configName, filePath, wh.ClientConfig); err != nil { + return err + } + } + default: + return fmt.Errorf("unsupported webhook configuration type %T in file %q", obj, filePath) + } + return nil +} + +// ValidateWebhookClientConfig checks that a webhook uses URL-based client config +// (service references are not supported for static manifests). +func ValidateWebhookClientConfig(webhookName, configName, filePath string, cc admissionregistrationv1.WebhookClientConfig) error { + if cc.Service != nil { + return fmt.Errorf("webhook %q in %q (file %q): clientConfig.service is not supported for static manifests; use clientConfig.url instead", webhookName, configName, filePath) + } + if cc.URL == nil || len(*cc.URL) == 0 { + return fmt.Errorf("webhook %q in %q (file %q): clientConfig.url is required for static manifests", webhookName, configName, filePath) + } + return nil +} + +// ValidatingLoadResult holds the validating webhook configurations loaded from manifest files. +type ValidatingLoadResult struct { + // Configurations is the list of loaded validating webhook configurations. + Configurations []*admissionregistrationv1.ValidatingWebhookConfiguration + // Hash is the sha256 hash of all loaded files, used for change detection. + Hash string +} + +// MutatingLoadResult holds the mutating webhook configurations loaded from manifest files. +type MutatingLoadResult struct { + // Configurations is the list of loaded mutating webhook configurations. + Configurations []*admissionregistrationv1.MutatingWebhookConfiguration + // Hash is the sha256 hash of all loaded files, used for change detection. + Hash string +} + +// BuildValidatingAccessors builds webhook accessors from validating webhook configurations. +func BuildValidatingAccessors(configs []*admissionregistrationv1.ValidatingWebhookConfiguration) []webhook.WebhookAccessor { + var accessors []webhook.WebhookAccessor + for _, config := range configs { + names := map[string]int{} + for i := range config.Webhooks { + w := &config.Webhooks[i] + n := w.Name + uid := fmt.Sprintf("manifest/%s/%s/%d", config.Name, n, names[n]) + names[n]++ + accessors = append(accessors, webhook.NewValidatingWebhookAccessor(uid, config.Name, w)) + } + } + return accessors +} + +// BuildMutatingAccessors builds webhook accessors from mutating webhook configurations. +func BuildMutatingAccessors(configs []*admissionregistrationv1.MutatingWebhookConfiguration) []webhook.WebhookAccessor { + var accessors []webhook.WebhookAccessor + for _, config := range configs { + names := map[string]int{} + for i := range config.Webhooks { + w := &config.Webhooks[i] + n := w.Name + uid := fmt.Sprintf("manifest/%s/%s/%d", config.Name, n, names[n]) + names[n]++ + accessors = append(accessors, webhook.NewMutatingWebhookAccessor(uid, config.Name, w)) + } + } + return accessors +} + +// GetWebhookAccessors returns webhook accessors for all validating webhooks. +func (r *ValidatingLoadResult) GetWebhookAccessors() []webhook.WebhookAccessor { + return BuildValidatingAccessors(r.Configurations) +} + +// GetWebhookAccessors returns webhook accessors for all mutating webhooks. +func (r *MutatingLoadResult) GetWebhookAccessors() []webhook.WebhookAccessor { + return BuildMutatingAccessors(r.Configurations) +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source/source.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source/source.go new file mode 100644 index 0000000000..7ebd2bd5c8 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source/source.go @@ -0,0 +1,218 @@ +/* +Copyright 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. +*/ + +// Package source provides a Source implementation that loads webhook configurations from manifest files. +package source + +import ( + "context" + "errors" + "fmt" + "sync/atomic" + "time" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apiserver/pkg/admission/plugin/manifest/metrics" + "k8s.io/apiserver/pkg/admission/plugin/webhook" + stagingloader "k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/loader" + "k8s.io/apiserver/pkg/util/filesystem" + "k8s.io/klog/v2" +) + +// defaultReloadInterval is the default interval at which the manifest directory is checked for changes. +var defaultReloadInterval = 1 * time.Minute + +// SetReloadIntervalForTests sets the reload interval for testing and returns a function to restore the original value. +func SetReloadIntervalForTests(interval time.Duration) func() { + original := defaultReloadInterval + defaultReloadInterval = interval + return func() { + defaultReloadInterval = original + } +} + +// ValidatingWebhookLoadFunc loads validating webhook configurations from a directory. +// Returns the configurations, a hash string for change detection, and any error. +type ValidatingWebhookLoadFunc func(dir string) ([]*admissionregistrationv1.ValidatingWebhookConfiguration, string, error) + +// MutatingWebhookLoadFunc loads mutating webhook configurations from a directory. +// Returns the configurations, a hash string for change detection, and any error. +type MutatingWebhookLoadFunc func(dir string) ([]*admissionregistrationv1.MutatingWebhookConfiguration, string, error) + +// accessorBuilder builds webhook accessors from configurations. +type accessorBuilder[T runtime.Object] func(configs []T) []webhook.WebhookAccessor + +// webhookData holds the currently loaded webhook configurations and pre-built accessors. +type webhookData[T runtime.Object] struct { + configurations []T + accessors []webhook.WebhookAccessor +} + +// staticWebhookSource provides webhook configurations loaded from manifest files. +type staticWebhookSource[T runtime.Object] struct { + manifestsDir string + apiServerID string + reloadInterval time.Duration + webhookType metrics.ManifestType + loadFunc func(dir string) ([]T, string, error) + buildAccessors accessorBuilder[T] + + current atomic.Pointer[webhookData[T]] + lastReadHash atomic.Pointer[string] // hash of last file content read (for short-circuiting) + hasSynced atomic.Bool +} + +// ValidatingSource provides validating webhook configurations loaded from manifest files. +type ValidatingSource struct { + *staticWebhookSource[*admissionregistrationv1.ValidatingWebhookConfiguration] +} + +// MutatingSource provides mutating webhook configurations loaded from manifest files. +type MutatingSource struct { + *staticWebhookSource[*admissionregistrationv1.MutatingWebhookConfiguration] +} + +// NewValidatingSource creates a new validating webhook source that loads configurations from the specified directory. +func NewValidatingSource(manifestsDir, apiServerID string, loadFunc ValidatingWebhookLoadFunc) *ValidatingSource { + metrics.RegisterMetrics() + return &ValidatingSource{ + staticWebhookSource: &staticWebhookSource[*admissionregistrationv1.ValidatingWebhookConfiguration]{ + manifestsDir: manifestsDir, + apiServerID: apiServerID, + reloadInterval: defaultReloadInterval, + webhookType: metrics.ValidatingWebhookManifestType, + loadFunc: loadFunc, + buildAccessors: stagingloader.BuildValidatingAccessors, + }, + } +} + +// NewMutatingSource creates a new mutating webhook source that loads configurations from the specified directory. +func NewMutatingSource(manifestsDir, apiServerID string, loadFunc MutatingWebhookLoadFunc) *MutatingSource { + metrics.RegisterMetrics() + return &MutatingSource{ + staticWebhookSource: &staticWebhookSource[*admissionregistrationv1.MutatingWebhookConfiguration]{ + manifestsDir: manifestsDir, + apiServerID: apiServerID, + reloadInterval: defaultReloadInterval, + webhookType: metrics.MutatingWebhookManifestType, + loadFunc: loadFunc, + buildAccessors: stagingloader.BuildMutatingAccessors, + }, + } +} + +// LoadInitial performs the initial load of webhook manifests. +func (s *staticWebhookSource[T]) LoadInitial() error { + configs, hash, err := s.loadFunc(s.manifestsDir) + if err != nil { + return err + } + + accessors := s.buildAccessors(configs) + + // Validate accessors eagerly to catch selector parse errors at startup. + if err := validateAccessors(accessors); err != nil { + return err + } + + s.current.Store(&webhookData[T]{configurations: configs, accessors: accessors}) + s.lastReadHash.Store(&hash) + s.hasSynced.Store(true) + + klog.InfoS("Loaded manifest-based webhook configurations", "plugin", string(s.webhookType), + "configurations", len(configs)) + metrics.RecordAutomaticReloadSuccess(s.webhookType, s.apiServerID, hash) + return nil +} + +// RunReloadLoop watches for configuration changes and reloads when detected. +// It blocks until ctx is canceled. +func (s *staticWebhookSource[T]) RunReloadLoop(ctx context.Context) { + filesystem.WatchUntil( + ctx, + s.reloadInterval, + s.manifestsDir, + func() { + s.checkAndReload() + }, + func(err error) { + klog.ErrorS(err, "watching manifest directory", "plugin", string(s.webhookType), "dir", s.manifestsDir) + }, + ) +} + +func (s *staticWebhookSource[T]) checkAndReload() { + configs, hash, err := s.loadFunc(s.manifestsDir) + if err != nil { + klog.ErrorS(err, "reloading admission manifest config", "plugin", string(s.webhookType), "dir", s.manifestsDir) + metrics.RecordAutomaticReloadFailure(s.webhookType, s.apiServerID) + return + } + + // Short-circuit if file content hasn't changed since last read. + if last := s.lastReadHash.Load(); last != nil && hash == *last { + return + } + s.lastReadHash.Store(&hash) + + // Build and validate accessors (configs may be empty if files deleted) + accessors := s.buildAccessors(configs) + if err := validateAccessors(accessors); err != nil { + klog.ErrorS(err, "manifest webhook accessor validation failed after reload", "plugin", string(s.webhookType), "dir", s.manifestsDir) + metrics.RecordAutomaticReloadFailure(s.webhookType, s.apiServerID) + return + } + + s.current.Store(&webhookData[T]{configurations: configs, accessors: accessors}) + klog.InfoS("reloaded admission manifest config", "plugin", string(s.webhookType), "dir", s.manifestsDir) + metrics.RecordAutomaticReloadSuccess(s.webhookType, s.apiServerID, hash) +} + +// HasSynced returns true if the initial load has completed. +func (s *staticWebhookSource[T]) HasSynced() bool { + return s.hasSynced.Load() +} + +// Webhooks returns the list of webhook accessors. +func (s *staticWebhookSource[T]) Webhooks() []webhook.WebhookAccessor { + current := s.current.Load() + if current == nil { + return nil + } + return current.accessors +} + +// validateAccessors exercises lazy getters on each accessor to surface latent +// errors (e.g. invalid label selectors) early. +// Note: We intentionally skip GetRESTClient validation here because it requires +// a ClientManager. API validation (applied during defaulting) already ensures +// CA bundles parse and URLs are present and valid, and the manifest loader +// rejects service references, which covers the inputs needed to construct a +// REST client at admission time. +func validateAccessors(accessors []webhook.WebhookAccessor) error { + var errs []error + for _, a := range accessors { + if _, err := a.GetParsedNamespaceSelector(); err != nil { + errs = append(errs, fmt.Errorf("webhook %q: invalid namespaceSelector: %w", a.GetName(), err)) + } + if _, err := a.GetParsedObjectSelector(); err != nil { + errs = append(errs, fmt.Errorf("webhook %q: invalid objectSelector: %w", a.GetName(), err)) + } + } + return errors.Join(errs...) +} diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/plugin.go index fb07a61c1b..4ffd4c97d6 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/plugin.go @@ -22,7 +22,9 @@ import ( "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission/configuration" + "k8s.io/apiserver/pkg/admission/initializer" "k8s.io/apiserver/pkg/admission/plugin/webhook/generic" + "k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source" ) const ( @@ -48,6 +50,22 @@ type Plugin struct { } var _ admission.MutationInterface = &Plugin{} +var _ initializer.WantsManifestLoaders = &Plugin{} + +// SetManifestLoaders provides the manifest load functions for scheme-based defaulting and validation. +func (a *Plugin) SetManifestLoaders(loaders *initializer.ManifestLoaders) { + if loaders == nil || loaders.LoadMutatingWebhookManifests == nil { + return + } + loadFunc := loaders.LoadMutatingWebhookManifests + a.Webhook.SetStaticSourceFactory(func(manifestsDir string) (generic.ReloadableSource, error) { + src := source.NewMutatingSource(manifestsDir, a.Webhook.GetAPIServerID(), source.MutatingWebhookLoadFunc(loadFunc)) + if err := src.LoadInitial(); err != nil { + return nil, err + } + return src, nil + }) +} // NewMutatingWebhook returns a generic admission webhook plugin. func NewMutatingWebhook(configFile io.Reader) (*Plugin, error) { @@ -58,7 +76,6 @@ func NewMutatingWebhook(configFile io.Reader) (*Plugin, error) { if err != nil { return nil, err } - return p, nil } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/reinvocationcontext.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/reinvocationcontext.go index de0af221e1..d7237d0518 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/reinvocationcontext.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/mutating/reinvocationcontext.go @@ -27,9 +27,9 @@ type webhookReinvokeContext struct { lastWebhookOutput runtime.Object // previouslyInvokedReinvocableWebhooks holds the set of webhooks that have been invoked and // should be reinvoked if a later mutation occurs - previouslyInvokedReinvocableWebhooks sets.String + previouslyInvokedReinvocableWebhooks sets.Set[string] // reinvokeWebhooks holds the set of webhooks that should be reinvoked - reinvokeWebhooks sets.String + reinvokeWebhooks sets.Set[string] } func (rc *webhookReinvokeContext) ShouldReinvokeWebhook(webhook string) bool { @@ -50,7 +50,7 @@ func (rc *webhookReinvokeContext) SetLastWebhookInvocationOutput(object runtime. func (rc *webhookReinvokeContext) AddReinvocableWebhookToPreviouslyInvoked(webhook string) { if rc.previouslyInvokedReinvocableWebhooks == nil { - rc.previouslyInvokedReinvocableWebhooks = sets.NewString() + rc.previouslyInvokedReinvocableWebhooks = sets.New[string]() } rc.previouslyInvokedReinvocableWebhooks.Insert(webhook) } @@ -58,11 +58,11 @@ func (rc *webhookReinvokeContext) AddReinvocableWebhookToPreviouslyInvoked(webho func (rc *webhookReinvokeContext) RequireReinvokingPreviouslyInvokedPlugins() { if len(rc.previouslyInvokedReinvocableWebhooks) > 0 { if rc.reinvokeWebhooks == nil { - rc.reinvokeWebhooks = sets.NewString() + rc.reinvokeWebhooks = sets.New[string]() } for s := range rc.previouslyInvokedReinvocableWebhooks { rc.reinvokeWebhooks.Insert(s) } - rc.previouslyInvokedReinvocableWebhooks = sets.NewString() + rc.previouslyInvokedReinvocableWebhooks = sets.New[string]() } } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/plugin.go b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/plugin.go index 6972877b18..da20960210 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/plugin.go +++ b/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/validating/plugin.go @@ -22,7 +22,9 @@ import ( "k8s.io/apiserver/pkg/admission" "k8s.io/apiserver/pkg/admission/configuration" + "k8s.io/apiserver/pkg/admission/initializer" "k8s.io/apiserver/pkg/admission/plugin/webhook/generic" + "k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source" ) const ( @@ -48,6 +50,22 @@ type Plugin struct { } var _ admission.ValidationInterface = &Plugin{} +var _ initializer.WantsManifestLoaders = &Plugin{} + +// SetManifestLoaders provides the manifest load functions for scheme-based defaulting and validation. +func (a *Plugin) SetManifestLoaders(loaders *initializer.ManifestLoaders) { + if loaders == nil || loaders.LoadValidatingWebhookManifests == nil { + return + } + loadFunc := loaders.LoadValidatingWebhookManifests + a.Webhook.SetStaticSourceFactory(func(manifestsDir string) (generic.ReloadableSource, error) { + src := source.NewValidatingSource(manifestsDir, a.Webhook.GetAPIServerID(), source.ValidatingWebhookLoadFunc(loadFunc)) + if err := src.LoadInitial(); err != nil { + return nil, err + } + return src, nil + }) +} // NewValidatingAdmissionWebhook returns a generic admission webhook plugin. func NewValidatingAdmissionWebhook(configFile io.Reader) (*Plugin, error) { diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/types.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/types.go index 596b1f140a..0c5e6b5485 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/types.go @@ -146,6 +146,10 @@ type TLSConfig struct { // Must be configured if TCPTransport.URL is prefixed with https:// // +optional ClientCert string + + // tlsServerName is used to check server certificate. If tlsServerName is empty, the hostname used to contact the server is used. + // +optional + TLSServerName string } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go index 6e0f86da86..1e20c697b5 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/types.go @@ -147,6 +147,10 @@ type TLSConfig struct { // Must be configured if TCPTransport.URL is prefixed with https:// // +optional ClientCert string `json:"clientCert,omitempty"` + + // tlsServerName is used to check server certificate. If tlsServerName is empty, the hostname used to contact the server is used. + // +optional + TLSServerName string `json:"tlsServerName,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go index 9d7a8ce627..4ea0297895 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1alpha1/zz_generated.conversion.go @@ -817,6 +817,7 @@ func autoConvert_v1alpha1_TLSConfig_To_apiserver_TLSConfig(in *TLSConfig, out *a out.CABundle = in.CABundle out.ClientKey = in.ClientKey out.ClientCert = in.ClientCert + out.TLSServerName = in.TLSServerName return nil } @@ -829,6 +830,7 @@ func autoConvert_apiserver_TLSConfig_To_v1alpha1_TLSConfig(in *apiserver.TLSConf out.CABundle = in.CABundle out.ClientKey = in.ClientKey out.ClientCert = in.ClientCert + out.TLSServerName = in.TLSServerName return nil } diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go index 16260efb66..44bfbbd3c1 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/types.go @@ -118,6 +118,10 @@ type TLSConfig struct { // Must be configured if TCPTransport.URL is prefixed with https:// // +optional ClientCert string `json:"clientCert,omitempty"` + + // tlsServerName is used to check server certificate. If tlsServerName is empty, the hostname used to contact the server is used. + // +optional + TLSServerName string `json:"tlsServerName,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go index 4f25bd60c2..04323e2082 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/v1beta1/zz_generated.conversion.go @@ -753,6 +753,7 @@ func autoConvert_v1beta1_TLSConfig_To_apiserver_TLSConfig(in *TLSConfig, out *ap out.CABundle = in.CABundle out.ClientKey = in.ClientKey out.ClientCert = in.ClientCert + out.TLSServerName = in.TLSServerName return nil } @@ -765,6 +766,7 @@ func autoConvert_apiserver_TLSConfig_To_v1beta1_TLSConfig(in *apiserver.TLSConfi out.CABundle = in.CABundle out.ClientKey = in.ClientKey out.ClientCert = in.ClientCert + out.TLSServerName = in.TLSServerName return nil } diff --git a/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go b/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go index be85d4f3d7..a5eeaef60f 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go +++ b/vendor/k8s.io/apiserver/pkg/apis/apiserver/validation/validation.go @@ -763,7 +763,7 @@ func ValidateWebhookConfiguration(compiler authorizationcel.Compiler, fldPath *f allErrs = append(allErrs, field.NotSupported(fldPath.Child("connectionInfo", "type"), c.ConnectionInfo, []string{api.AuthorizationWebhookConnectionInfoTypeInCluster, api.AuthorizationWebhookConnectionInfoTypeKubeConfigFile})) } - _, errs := compileMatchConditions(compiler, c.MatchConditions, fldPath, utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthorizationConfiguration)) + _, errs := compileMatchConditions(compiler, c.MatchConditions, fldPath) allErrs = append(allErrs, errs...) return allErrs @@ -772,15 +772,11 @@ func ValidateWebhookConfiguration(compiler authorizationcel.Compiler, fldPath *f // ValidateAndCompileMatchConditions validates a given webhook's matchConditions. // This is exported for use in authz package. func ValidateAndCompileMatchConditions(compiler authorizationcel.Compiler, matchConditions []api.WebhookMatchCondition) (*authorizationcel.CELMatcher, field.ErrorList) { - return compileMatchConditions(compiler, matchConditions, nil, utilfeature.DefaultFeatureGate.Enabled(features.StructuredAuthorizationConfiguration)) + return compileMatchConditions(compiler, matchConditions, nil) } -func compileMatchConditions(compiler authorizationcel.Compiler, matchConditions []api.WebhookMatchCondition, fldPath *field.Path, structuredAuthzFeatureEnabled bool) (*authorizationcel.CELMatcher, field.ErrorList) { +func compileMatchConditions(compiler authorizationcel.Compiler, matchConditions []api.WebhookMatchCondition, fldPath *field.Path) (*authorizationcel.CELMatcher, field.ErrorList) { var allErrs field.ErrorList - // should fail when match conditions are used without feature enabled - if len(matchConditions) > 0 && !structuredAuthzFeatureEnabled { - allErrs = append(allErrs, field.Invalid(fldPath.Child("matchConditions"), "", "not supported when StructuredAuthorizationConfiguration feature gate is disabled")) - } if len(matchConditions) > 64 { allErrs = append(allErrs, field.TooMany(fldPath.Child("matchConditions"), len(matchConditions), 64)) return nil, allErrs diff --git a/vendor/k8s.io/apiserver/pkg/apis/audit/types.go b/vendor/k8s.io/apiserver/pkg/apis/audit/types.go index dfc9c4fd23..6218ae315c 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/audit/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/audit/types.go @@ -275,6 +275,7 @@ type PolicyRule struct { type GroupResources struct { // Group is the name of the API group that contains the resources. // The empty string represents the core API group. + // `*` matches all groups // +optional Group string // Resources is a list of resources this rule applies to. diff --git a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.proto b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.proto index 632db99862..db0afa5e42 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.proto +++ b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.proto @@ -135,6 +135,7 @@ message EventList { message GroupResources { // Group is the name of the API group that contains the resources. // The empty string represents the core API group. + // `*` matches all groups // +optional optional string group = 1; diff --git a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.protomessage.pb.go b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.protomessage.pb.go deleted file mode 100644 index 93920227e1..0000000000 --- a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/generated.protomessage.pb.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1 - -func (*AuthenticationMetadata) ProtoMessage() {} - -func (*Event) ProtoMessage() {} - -func (*EventList) ProtoMessage() {} - -func (*GroupResources) ProtoMessage() {} - -func (*ObjectReference) ProtoMessage() {} - -func (*Policy) ProtoMessage() {} - -func (*PolicyList) ProtoMessage() {} - -func (*PolicyRule) ProtoMessage() {} diff --git a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go index 28d3f2ace3..8c6dc676af 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go +++ b/vendor/k8s.io/apiserver/pkg/apis/audit/v1/types.go @@ -278,6 +278,7 @@ type PolicyRule struct { type GroupResources struct { // Group is the name of the API group that contains the resources. // The empty string represents the core API group. + // `*` matches all groups // +optional Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"` // Resources is a list of resources this rule applies to. diff --git a/vendor/k8s.io/apiserver/pkg/apis/audit/validation/validation.go b/vendor/k8s.io/apiserver/pkg/apis/audit/validation/validation.go index 0611c1ae5f..3b0d077fd4 100644 --- a/vendor/k8s.io/apiserver/pkg/apis/audit/validation/validation.go +++ b/vendor/k8s.io/apiserver/pkg/apis/audit/validation/validation.go @@ -98,7 +98,7 @@ func validateResources(groupResources []audit.GroupResources, fldPath *field.Pat var allErrs field.ErrorList for _, groupResource := range groupResources { // The empty string represents the core API group. - if len(groupResource.Group) != 0 { + if len(groupResource.Group) != 0 && groupResource.Group != "*" { // Group names must be lower case and be valid DNS subdomains. // reference: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md // an error is returned for group name like rbac.authorization.k8s.io/v1beta1 diff --git a/vendor/k8s.io/apiserver/pkg/audit/policy/checker.go b/vendor/k8s.io/apiserver/pkg/audit/policy/checker.go index cd6ec92bc8..9c21e2348a 100644 --- a/vendor/k8s.io/apiserver/pkg/audit/policy/checker.go +++ b/vendor/k8s.io/apiserver/pkg/audit/policy/checker.go @@ -191,7 +191,7 @@ func ruleMatchesResource(r *audit.PolicyRule, attrs authorizer.Attributes) bool name := attrs.GetName() for _, gr := range r.Resources { - if gr.Group == apiGroup { + if gr.Group == apiGroup || gr.Group == "*" { if len(gr.Resources) == 0 { return true } diff --git a/vendor/k8s.io/apiserver/pkg/audit/union.go b/vendor/k8s.io/apiserver/pkg/audit/union.go index 0766a9207b..39dd74f740 100644 --- a/vendor/k8s.io/apiserver/pkg/audit/union.go +++ b/vendor/k8s.io/apiserver/pkg/audit/union.go @@ -48,7 +48,6 @@ func (u union) ProcessEvents(events ...*auditinternal.Event) bool { func (u union) Run(stopCh <-chan struct{}) error { var funcs []func() error for _, backend := range u.backends { - backend := backend funcs = append(funcs, func() error { return backend.Run(stopCh) }) diff --git a/vendor/k8s.io/apiserver/pkg/authentication/request/headerrequest/requestheader_controller.go b/vendor/k8s.io/apiserver/pkg/authentication/request/headerrequest/requestheader_controller.go index a9e76fe011..e5419d0cec 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/request/headerrequest/requestheader_controller.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/request/headerrequest/requestheader_controller.go @@ -174,7 +174,7 @@ func (c *RequestHeaderAuthRequestController) AllowedClientNames() []string { // Run starts RequestHeaderAuthRequestController controller and blocks until stopCh is closed. func (c *RequestHeaderAuthRequestController) Run(ctx context.Context, workers int) { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) defer c.queue.ShutDown() klog.Infof("Starting %s", c.name) diff --git a/vendor/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go b/vendor/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go index ee8c89f5ce..a3a7833156 100644 --- a/vendor/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go +++ b/vendor/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go @@ -24,8 +24,8 @@ import ( "strings" "unicode/utf8" - "k8s.io/apimachinery/pkg/util/httpstream/wsstream" "k8s.io/apiserver/pkg/authentication/authenticator" + "k8s.io/streaming/pkg/httpstream/wsstream" ) const bearerProtocolPrefix = "base64url.bearer.authorization.k8s.io." diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/cidr.go b/vendor/k8s.io/apiserver/pkg/cel/library/cidr.go index a638fd4ac1..befc05d706 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/cidr.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/cidr.go @@ -82,24 +82,24 @@ import ( // // Examples: // -// cidr('192.168.0.0/24').containsIP(ip('192.168.0.1')) // returns true -// cidr('192.168.0.0/24').containsIP(ip('192.168.1.1')) // returns false -// cidr('192.168.0.0/24').containsIP('192.168.0.1') // returns true -// cidr('192.168.0.0/24').containsIP('192.168.1.1') // returns false -// cidr('192.168.0.0/16').containsCIDR(cidr('192.168.10.0/24')) // returns true -// cidr('192.168.1.0/24').containsCIDR(cidr('192.168.2.0/24')) // returns false -// cidr('192.168.0.0/16').containsCIDR('192.168.10.0/24') // returns true -// cidr('192.168.1.0/24').containsCIDR('192.168.2.0/24') // returns false -// cidr('192.168.0.1/24').ip() // returns ipAddr('192.168.0.1') -// cidr('192.168.0.1/24').ip().family() // returns '4' -// cidr('::1/128').ip() // returns ipAddr('::1') -// cidr('::1/128').ip().family() // returns '6' -// cidr('192.168.0.0/24').masked() // returns cidr('192.168.0.0/24') -// cidr('192.168.0.1/24').masked() // returns cidr('192.168.0.0/24') -// cidr('192.168.0.0/24') == cidr('192.168.0.0/24').masked() // returns true, CIDR was already in canonical format -// cidr('192.168.0.1/24') == cidr('192.168.0.1/24').masked() // returns false, CIDR was not in canonical format -// cidr('192.168.0.0/16').prefixLength() // returns 16 -// cidr('::1/128').prefixLength() // returns 128 +// cidr('192.168.0.0/24').containsIP(ip('192.168.0.1')) // returns true +// cidr('192.168.0.0/24').containsIP(ip('192.168.1.1')) // returns false +// cidr('192.168.0.0/24').containsIP('192.168.0.1') // returns true +// cidr('192.168.0.0/24').containsIP('192.168.1.1') // returns false +// cidr('192.168.0.0/16').containsCIDR(cidr('192.168.10.0/24')) // returns true +// cidr('192.168.1.0/24').containsCIDR(cidr('192.168.2.0/24')) // returns false +// cidr('192.168.0.0/16').containsCIDR('192.168.10.0/24') // returns true +// cidr('192.168.1.0/24').containsCIDR('192.168.2.0/24') // returns false +// cidr('192.168.0.1/24').ip() // returns ipAddr('192.168.0.1') +// cidr('192.168.0.1/24').ip().family() // returns '4' +// cidr('::1/128').ip() // returns ipAddr('::1') +// cidr('::1/128').ip().family() // returns '6' +// cidr('192.168.0.0/24').masked() // returns cidr('192.168.0.0/24') +// cidr('192.168.0.1/24').masked() // returns cidr('192.168.0.0/24') +// cidr('192.168.0.0/24') == cidr('192.168.0.0/24').masked() // returns true, CIDR was already in canonical format +// cidr('192.168.0.1/24') == cidr('192.168.0.1/24').masked() // returns false, CIDR was not in canonical format +// cidr('192.168.0.0/16').prefixLength() // returns 16 +// cidr('::1/128').prefixLength() // returns 128 func CIDR() cel.EnvOption { return cel.Lib(cidrsLib) } diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/format.go b/vendor/k8s.io/apiserver/pkg/cel/library/format.go index 2adc35c905..e8b2d07b55 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/format.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/format.go @@ -41,53 +41,53 @@ var ( // Format provides a CEL library exposing common named Kubernetes string // validations. Can be used in CRD ValidationRules messageExpression. // -// Example: +// Example: // -// rule: format.dns1123label.validate(object.metadata.name).hasValue() -// messageExpression: format.dns1123label.validate(object.metadata.name).value().join("\n") +// rule: format.dns1123label.validate(object.metadata.name).hasValue() +// messageExpression: format.dns1123label.validate(object.metadata.name).value().join("\n") // // format.named(name: string) -> ?Format // -// Returns the Format with the given name, if it exists. Otherwise, optional.none -// Allowed names are: -// - `dns1123Label` -// - `dns1123Subdomain` -// - `dns1035Label` -// - `qualifiedName` -// - `dns1123LabelPrefix` -// - `dns1123SubdomainPrefix` -// - `dns1035LabelPrefix` -// - `labelValue` -// - `uri` -// - `uuid` -// - `byte` -// - `date` -// - `datetime` +// Returns the Format with the given name, if it exists. Otherwise, optional.none +// Allowed names are: +// - `dns1123Label` +// - `dns1123Subdomain` +// - `dns1035Label` +// - `qualifiedName` +// - `dns1123LabelPrefix` +// - `dns1123SubdomainPrefix` +// - `dns1035LabelPrefix` +// - `labelValue` +// - `uri` +// - `uuid` +// - `byte` +// - `date` +// - `datetime` // // format.() -> Format // -// Convenience functions for all the named formats are also available +// Convenience functions for all the named formats are also available. // -// Examples: -// format.dns1123Label().validate("my-label-name") -// format.dns1123Subdomain().validate("apiextensions.k8s.io") -// format.dns1035Label().validate("my-label-name") -// format.qualifiedName().validate("apiextensions.k8s.io/v1beta1") -// format.dns1123LabelPrefix().validate("my-label-prefix-") -// format.dns1123SubdomainPrefix().validate("mysubdomain.prefix.-") -// format.dns1035LabelPrefix().validate("my-label-prefix-") -// format.uri().validate("http://example.com") -// Uses same pattern as isURL, but returns an error -// format.uuid().validate("123e4567-e89b-12d3-a456-426614174000") -// format.byte().validate("aGVsbG8=") -// format.date().validate("2021-01-01") -// format.datetime().validate("2021-01-01T00:00:00Z") +// Examples: +// +// format.dns1123Label().validate("my-label-name") +// format.dns1123Subdomain().validate("apiextensions.k8s.io") +// format.dns1035Label().validate("my-label-name") +// format.qualifiedName().validate("apiextensions.k8s.io/v1beta1") +// format.dns1123LabelPrefix().validate("my-label-prefix-") +// format.dns1123SubdomainPrefix().validate("mysubdomain.prefix.-") +// format.dns1035LabelPrefix().validate("my-label-prefix-") +// format.uri().validate("http://example.com") +// Uses same pattern as isURL, but returns an error +// format.uuid().validate("123e4567-e89b-12d3-a456-426614174000") +// format.byte().validate("aGVsbG8=") +// format.date().validate("2021-01-01") +// format.datetime().validate("2021-01-01T00:00:00Z") // - // .validate(str: string) -> ?list // -// Validates the given string against the given format. Returns optional.none -// if the string is valid, otherwise a list of validation error strings. +// Validates the given string against the given format. Returns optional.none +// if the string is valid, otherwise a list of validation error strings. func Format() cel.EnvOption { return cel.Lib(formatLib) } diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/ip.go b/vendor/k8s.io/apiserver/pkg/cel/library/ip.go index 5a089ae1cd..fa5e9f001d 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/ip.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/ip.go @@ -99,30 +99,30 @@ import ( // // Examples: // -// ip('127.0.0.1').family() // returns '4” -// ip('::1').family() // returns '6' -// ip('127.0.0.1').family() == 4 // returns true -// ip('::1').family() == 6 // returns true -// ip('0.0.0.0').isUnspecified() // returns true -// ip('127.0.0.1').isUnspecified() // returns false -// ip('::').isUnspecified() // returns true -// ip('::1').isUnspecified() // returns false -// ip('127.0.0.1').isLoopback() // returns true -// ip('192.168.0.1').isLoopback() // returns false -// ip('::1').isLoopback() // returns true -// ip('2001:db8::abcd').isLoopback() // returns false -// ip('224.0.0.1').isLinkLocalMulticast() // returns true -// ip('224.0.1.1').isLinkLocalMulticast() // returns false -// ip('ff02::1').isLinkLocalMulticast() // returns true -// ip('fd00::1').isLinkLocalMulticast() // returns false -// ip('169.254.169.254').isLinkLocalUnicast() // returns true -// ip('192.168.0.1').isLinkLocalUnicast() // returns false -// ip('fe80::1').isLinkLocalUnicast() // returns true -// ip('fd80::1').isLinkLocalUnicast() // returns false -// ip('192.168.0.1').isGlobalUnicast() // returns true -// ip('255.255.255.255').isGlobalUnicast() // returns false -// ip('2001:db8::abcd').isGlobalUnicast() // returns true -// ip('ff00::1').isGlobalUnicast() // returns false +// ip('127.0.0.1').family() // returns '4” +// ip('::1').family() // returns '6' +// ip('127.0.0.1').family() == 4 // returns true +// ip('::1').family() == 6 // returns true +// ip('0.0.0.0').isUnspecified() // returns true +// ip('127.0.0.1').isUnspecified() // returns false +// ip('::').isUnspecified() // returns true +// ip('::1').isUnspecified() // returns false +// ip('127.0.0.1').isLoopback() // returns true +// ip('192.168.0.1').isLoopback() // returns false +// ip('::1').isLoopback() // returns true +// ip('2001:db8::abcd').isLoopback() // returns false +// ip('224.0.0.1').isLinkLocalMulticast() // returns true +// ip('224.0.1.1').isLinkLocalMulticast() // returns false +// ip('ff02::1').isLinkLocalMulticast() // returns true +// ip('fd00::1').isLinkLocalMulticast() // returns false +// ip('169.254.169.254').isLinkLocalUnicast() // returns true +// ip('192.168.0.1').isLinkLocalUnicast() // returns false +// ip('fe80::1').isLinkLocalUnicast() // returns true +// ip('fd80::1').isLinkLocalUnicast() // returns false +// ip('192.168.0.1').isGlobalUnicast() // returns true +// ip('255.255.255.255').isGlobalUnicast() // returns false +// ip('2001:db8::abcd').isGlobalUnicast() // returns true +// ip('ff00::1').isGlobalUnicast() // returns false func IP() cel.EnvOption { return cel.Lib(ipLib) } diff --git a/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go b/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go index f9036a47c7..f3fd8b1c50 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go +++ b/vendor/k8s.io/apiserver/pkg/cel/library/quantity.go @@ -82,12 +82,12 @@ import ( // // Examples: // -// quantity("50000000G").isInteger() // returns true -// quantity("50k").isInteger() // returns true -// quantity("9999999999999999999999999999999999999G").asInteger() // error: cannot convert value to integer -// quantity("9999999999999999999999999999999999999G").isInteger() // returns false -// quantity("50k").asInteger() == 50000 // returns true -// quantity("50k").sub(20000).asApproximateFloat() == 30000 // returns true +// quantity("50000000G").isInteger() // returns true +// quantity("50k").isInteger() // returns true +// quantity("9999999999999999999999999999999999999G").asInteger() // error: cannot convert value to integer +// quantity("9999999999999999999999999999999999999G").isInteger() // returns false +// quantity("50k").asInteger() == 50000 // returns true +// quantity("50k").sub(20000).asApproximateFloat() == 30000 // returns true // // Arithmetic // @@ -105,11 +105,11 @@ import ( // // Examples: // -// quantity("50k").add("20k") == quantity("70k") // returns true -// quantity("50k").add(20) == quantity("50020") // returns true -// quantity("50k").sub("20k") == quantity("30k") // returns true -// quantity("50k").sub(20000) == quantity("30k") // returns true -// quantity("50k").add(20).sub(quantity("100k")).sub(-50000) == quantity("20") // returns true +// quantity("50k").add("20k") == quantity("70k") // returns true +// quantity("50k").add(20) == quantity("50020") // returns true +// quantity("50k").sub("20k") == quantity("30k") // returns true +// quantity("50k").sub(20000) == quantity("30k") // returns true +// quantity("50k").add(20).sub(quantity("100k")).sub(-50000) == quantity("20") // returns true // // Comparisons // @@ -125,13 +125,13 @@ import ( // // Examples: // -// quantity("200M").compareTo(quantity("0.2G")) // returns 0 -// quantity("50M").compareTo(quantity("50Mi")) // returns -1 -// quantity("50Mi").compareTo(quantity("50M")) // returns 1 -// quantity("150Mi").isGreaterThan(quantity("100Mi")) // returns true -// quantity("50Mi").isGreaterThan(quantity("100Mi")) // returns false -// quantity("50M").isLessThan(quantity("100M")) // returns true -// quantity("100M").isLessThan(quantity("50M")) // returns false +// quantity("200M").compareTo(quantity("0.2G")) // returns 0 +// quantity("50M").compareTo(quantity("50Mi")) // returns -1 +// quantity("50Mi").compareTo(quantity("50M")) // returns 1 +// quantity("150Mi").isGreaterThan(quantity("100Mi")) // returns true +// quantity("50Mi").isGreaterThan(quantity("100Mi")) // returns false +// quantity("50M").isLessThan(quantity("100M")) // returns true +// quantity("100M").isLessThan(quantity("50M")) // returns false func Quantity() cel.EnvOption { return cel.Lib(quantityLib) } diff --git a/vendor/k8s.io/apiserver/pkg/cel/openapi/adaptor.go b/vendor/k8s.io/apiserver/pkg/cel/openapi/adaptor.go index f95ec2a372..a5bfac2620 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/openapi/adaptor.go +++ b/vendor/k8s.io/apiserver/pkg/cel/openapi/adaptor.go @@ -156,7 +156,6 @@ func (s *Schema) Nullable() bool { func (s *Schema) AllOf() []common.Schema { var res []common.Schema for _, nestedSchema := range s.Schema.AllOf { - nestedSchema := nestedSchema res = append(res, &Schema{&nestedSchema}) } return res @@ -165,7 +164,6 @@ func (s *Schema) AllOf() []common.Schema { func (s *Schema) AnyOf() []common.Schema { var res []common.Schema for _, nestedSchema := range s.Schema.AnyOf { - nestedSchema := nestedSchema res = append(res, &Schema{&nestedSchema}) } return res @@ -174,7 +172,6 @@ func (s *Schema) AnyOf() []common.Schema { func (s *Schema) OneOf() []common.Schema { var res []common.Schema for _, nestedSchema := range s.Schema.OneOf { - nestedSchema := nestedSchema res = append(res, &Schema{&nestedSchema}) } return res diff --git a/vendor/k8s.io/apiserver/pkg/cel/openapi/resolver/refs.go b/vendor/k8s.io/apiserver/pkg/cel/openapi/resolver/refs.go index 56e2a4bbd3..808d643415 100644 --- a/vendor/k8s.io/apiserver/pkg/cel/openapi/resolver/refs.go +++ b/vendor/k8s.io/apiserver/pkg/cel/openapi/resolver/refs.go @@ -86,7 +86,9 @@ func populateRefs(schemaOf func(ref string) (*spec.Schema, bool), visited sets.S } if populated != result.AdditionalProperties.Schema { changed = true - result.AdditionalProperties.Schema = populated + newProps := *result.AdditionalProperties + newProps.Schema = populated + result.AdditionalProperties = &newProps } } // schema is a list, populate its items @@ -97,7 +99,9 @@ func populateRefs(schemaOf func(ref string) (*spec.Schema, bool), visited sets.S } if populated != result.Items.Schema { changed = true - result.Items.Schema = populated + newItems := *result.Items + newItems.Schema = populated + result.Items = &newItems } } if changed { diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go index 5e325ba447..1b8e8c72e0 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/discovery/aggregated/handler.go @@ -559,9 +559,13 @@ func writeDiscoveryResponse( return } var targetGV schema.GroupVersion - if mediaType.Convert == nil || - (mediaType.Convert.GroupVersion() != apidiscoveryv2.SchemeGroupVersion && - mediaType.Convert.GroupVersion() != apidiscoveryv2beta1.SchemeGroupVersion) { + if mediaType.Convert == nil { + utilruntime.HandleError(fmt.Errorf("expected aggregated discovery group version, got unknown group and version")) + w.WriteHeader(http.StatusInternalServerError) + return + } + if mediaType.Convert.GroupVersion() != apidiscoveryv2.SchemeGroupVersion && + mediaType.Convert.GroupVersion() != apidiscoveryv2beta1.SchemeGroupVersion { utilruntime.HandleError(fmt.Errorf("expected aggregated discovery group version, got group: %s, version %s", mediaType.Convert.Group, mediaType.Convert.Version)) w.WriteHeader(http.StatusInternalServerError) return diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/audit.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/audit.go index d25bf35ae3..83537bd215 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/audit.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/audit.go @@ -149,7 +149,6 @@ func evaluatePolicyAndCreateAuditEvent(req *http.Request, policy audit.PolicyRul // writeLatencyToAnnotation writes the latency incurred in different // layers of the apiserver to the annotations of the audit object. -// it should be invoked after ev.StageTimestamp has been set appropriately. func writeLatencyToAnnotation(ctx context.Context) { ac := audit.AuditContextFrom(ctx) // we will track latency in annotation only when the total latency @@ -157,7 +156,7 @@ func writeLatencyToAnnotation(ctx context.Context) { // traces in rest/handlers for create, delete, update, // get, list, and deletecollection. const threshold = 500 * time.Millisecond - latency := ac.GetEventStageTimestamp().Sub(ac.GetEventRequestReceivedTimestamp().Time) + latency := time.Since(ac.GetEventRequestReceivedTimestamp().Time) if latency <= threshold { return } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/cache.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/cache.go index cf73107896..c0ef42c583 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/cache.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/cache.go @@ -18,11 +18,12 @@ package impersonation import ( "crypto/sha256" + "encoding/binary" + "encoding/hex" "fmt" "hash/fnv" "time" - - "golang.org/x/crypto/cryptobyte" + "unsafe" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" @@ -60,21 +61,19 @@ func modeIndexCacheKey(attributes authorizer.Attributes) string { key := attributes.GetUser().GetName() // hash the name so our cache size is predicable regardless of the size of usernames // collisions do not matter for this logic as it simply changes the ordering of the modes used - hash := fnvSum128a([]byte(key)) - return fmt.Sprintf("%x", hash) -} - -func fnvSum128a(data []byte) []byte { h := fnv.New128a() - h.Write(data) + h.Write([]byte(key)) var sum [16]byte - return h.Sum(sum[:0]) + h.Sum(sum[:0]) + buf := make([]byte, 32) // 16 bytes of hash -> 32 hex chars + hex.Encode(buf, sum[:]) + return toString(buf) // only safe because buf is heap allocated via make } func newModeIndexCache() *modeIndexCache { return &modeIndexCache{ - // each entry is roughly ~24 bytes (16 bytes for the hashed key, 8 bytes for value) - // thus at even 10k entries, we should use less than 1 MB memory + // each entry is roughly ~100 bytes (hashed string key + int value + LRU list/map overhead) + // thus at even 10k entries, we should use about 1 MB memory // this hardcoded size allows us to remember many users without leaking memory cache: lru.New(10_000), } @@ -246,7 +245,7 @@ func buildKey(wantedUser *user.DefaultInfo, attributes authorizer.Attributes) (s } }) - return b.build() + return b.build(), nil } func addUser(b *cacheKeyBuilder, u user.Info) { @@ -265,20 +264,21 @@ func addUser(b *cacheKeyBuilder, u user.Info) { }) } -// cacheKeyBuilder adds syntactic sugar on top of cryptobyte.Builder to make it easier to use for complex inputs. +// cacheKeyBuilder builds a binary key from structured inputs using uint32 length-prefixed encoding, then hashes +// it with SHA-256. All methods operate on a single shared buffer to avoid closure and child-builder allocations. type cacheKeyBuilder struct { namespace string // in the programming sense, not the Kubernetes concept - builder *cryptobyte.Builder + builder []byte } func newCacheKeyBuilder(namespace string) *cacheKeyBuilder { // start with a reasonable size to avoid too many allocations - return &cacheKeyBuilder{namespace: namespace, builder: cryptobyte.NewBuilder(make([]byte, 0, 384))} + return &cacheKeyBuilder{namespace: namespace, builder: make([]byte, 0, 384)} } func (c *cacheKeyBuilder) addString(value string) *cacheKeyBuilder { c.addLengthPrefixed(func(c *cacheKeyBuilder) { - c.builder.AddBytes([]byte(value)) + c.builder = append(c.builder, value...) }) return c } @@ -297,24 +297,36 @@ func (c *cacheKeyBuilder) addBool(value bool) *cacheKeyBuilder { if value { b = 1 } - c.builder.AddUint8(b) + c.builder = append(c.builder, b) return c } type builderContinuation func(child *cacheKeyBuilder) func (c *cacheKeyBuilder) addLengthPrefixed(f builderContinuation) { - c.builder.AddUint32LengthPrefixed(func(b *cryptobyte.Builder) { - c := &cacheKeyBuilder{namespace: c.namespace, builder: b} - f(c) - }) + offset := len(c.builder) + c.builder = append(c.builder, 0, 0, 0, 0) // placeholder for uint32 length + f(c) + binary.BigEndian.PutUint32(c.builder[offset:], uint32(len(c.builder)-offset-4)) } -func (c *cacheKeyBuilder) build() (string, error) { - key, err := c.builder.Bytes() - if err != nil { - return "", err +func (c *cacheKeyBuilder) build() string { + hashed := sha256.Sum256(c.builder) // reduce the size of the cache key to keep the overall cache size small + // sha256 = 32 bytes -> 64 hex chars + "/" + namespace + buf := make([]byte, 0, 64+1+len(c.namespace)) + buf = hex.AppendEncode(buf, hashed[:]) + buf = append(buf, '/') + buf = append(buf, c.namespace...) + return toString(buf) // only safe because buf is heap allocated via make +} + +// toString performs unholy acts to avoid allocations +func toString(b []byte) string { + // unsafe.SliceData relies on cap whereas we want to rely on len + if len(b) == 0 { + return "" } - hash := sha256.Sum256(key) // reduce the size of the cache key to keep the overall cache size small - return fmt.Sprintf("%x/%s", hash[:], c.namespace), nil + // Copied from go 1.20.1 strings.Builder.String + // https://github.com/golang/go/blob/202a1a57064127c3f19d96df57b9f9586145e21c/src/strings/builder.go#L48 + return unsafe.String(unsafe.SliceData(b), len(b)) } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go index 861e6d6990..e2a6e953d5 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/constrained_impersonation.go @@ -22,6 +22,7 @@ import ( "fmt" "net/http" "strings" + "time" authenticationv1 "k8s.io/api/authentication/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -30,6 +31,7 @@ import ( "k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authorization/authorizer" "k8s.io/apiserver/pkg/endpoints/filters" + "k8s.io/apiserver/pkg/endpoints/filters/impersonation/metrics" "k8s.io/apiserver/pkg/endpoints/handlers/responsewriters" "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/server/httplog" @@ -42,10 +44,25 @@ import ( // expression of impersonation access. For example, a service account may be authorized to impersonate the // node that it is associated with but only when listing pods. See the linked KEP for further details. func WithConstrainedImpersonation(handler http.Handler, a authorizer.Authorizer, s runtime.NegotiatedSerializer) http.Handler { + metrics.RegisterMetrics() + + ma := &metricsAuthorizer{ + delegate: a, + recordAuthorizationCall: metrics.RecordImpersonationAuthorizationCall, + } + + recordAttempt := func(ctx context.Context, mode, decision string, duration time.Duration) { + metrics.RecordImpersonationAttempt(mode, decision, duration) + request.TrackImpersonationLatency(ctx, duration) + } + return &constrainedImpersonationHandler{ handler: handler, - tracker: newImpersonationModesTracker(a), + tracker: newImpersonationModesTracker(ma), s: s, + + recordAttempt: recordAttempt, + metricsAuthorizer: ma, } } @@ -53,6 +70,10 @@ type constrainedImpersonationHandler struct { handler http.Handler tracker *impersonationModesTracker s runtime.NegotiatedSerializer + + // to allow unit tests to override metrics recording + recordAttempt func(ctx context.Context, mode, decision string, duration time.Duration) + metricsAuthorizer *metricsAuthorizer } func (c *constrainedImpersonationHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { @@ -78,12 +99,16 @@ func (c *constrainedImpersonationHandler) ServeHTTP(w http.ResponseWriter, req * return } + start := time.Now() impersonatedUser, err := c.tracker.getImpersonatedUser(ctx, wantedUser, attributes) + duration := time.Since(start) if err != nil { + c.recordAttempt(ctx, "", "denied", duration) klog.V(4).InfoS("Forbidden", "URI", req.RequestURI, "err", err) responsewriters.RespondWithError(w, req, err, c.s) return } + c.recordAttempt(ctx, modeFromConstraint(impersonatedUser.constraint), "allowed", duration) req = req.WithContext(request.WithUser(ctx, impersonatedUser.user)) httplog.LogOf(req, w).Addf("%v is impersonating %v", userString(requestor), userString(impersonatedUser.user)) @@ -249,3 +274,49 @@ func (t *impersonationModesTracker) getImpersonatedUser(ctx context.Context, wan // this should not happen, but make sure we fail closed when no impersonation mode succeeded return nil, errors.New("all impersonation modes failed") } + +type metricsAuthorizer struct { + delegate authorizer.Authorizer + recordAuthorizationCall func(mode, decision string, duration time.Duration) +} + +func (m *metricsAuthorizer) Authorize(ctx context.Context, attributes authorizer.Attributes) (authorizer.Decision, string, error) { + start := time.Now() + decision, reason, err := m.delegate.Authorize(ctx, attributes) + duration := time.Since(start) + + m.recordAuthorizationCall(modeFromVerb(attributes.GetVerb()), decisionToLabel(decision), duration) + + return decision, reason, err +} + +func modeFromConstraint(constraint string) string { + if len(constraint) == 0 { + return "legacy" + } + return modeFromVerb(constraint) +} + +func modeFromVerb(verb string) string { + switch { + case verb == "impersonate": + return "legacy" + case verb == "impersonate:associated-node" || strings.HasPrefix(verb, "impersonate-on:associated-node:"): + return "associated-node" + case verb == "impersonate:arbitrary-node" || strings.HasPrefix(verb, "impersonate-on:arbitrary-node:"): + return "arbitrary-node" + case verb == "impersonate:serviceaccount" || strings.HasPrefix(verb, "impersonate-on:serviceaccount:"): + return "serviceaccount" + case verb == "impersonate:user-info" || strings.HasPrefix(verb, "impersonate-on:user-info:"): + return "user-info" + default: + return "unknown" + } +} + +func decisionToLabel(decision authorizer.Decision) string { + if decision == authorizer.DecisionAllow { + return "allowed" + } + return "denied" +} diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/metrics/metrics.go new file mode 100644 index 0000000000..ac47de82a0 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/endpoints/filters/impersonation/metrics/metrics.go @@ -0,0 +1,99 @@ +/* +Copyright 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. +*/ + +package metrics + +import ( + "sync" + "time" + + "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" +) + +const ( + namespace = "apiserver" + subsystem = "impersonation" +) + +var ( + impersonationAttemptsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "attempts_total", + Help: "Total number of impersonation attempts split by mode and decision.", + StabilityLevel: metrics.ALPHA, + }, + []string{"mode", "decision"}, + ) + + impersonationAttemptsDurationSeconds = metrics.NewHistogramVec( + &metrics.HistogramOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "attempts_duration_seconds", + Help: "Latency of impersonation attempts in seconds split by mode and decision.", + StabilityLevel: metrics.ALPHA, + Buckets: metrics.ExponentialBuckets(0.001, 2, 15), + }, + []string{"mode", "decision"}, + ) + + impersonationAuthorizationAttemptsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "authorization_attempts_total", + Help: "Total number of authorization checks made by the impersonation handler split by mode and decision.", + StabilityLevel: metrics.ALPHA, + }, + []string{"mode", "decision"}, + ) + + impersonationAuthorizationAttemptsDurationSeconds = metrics.NewHistogramVec( + &metrics.HistogramOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "authorization_attempts_duration_seconds", + Help: "Latency of authorization checks made by the impersonation handler in seconds split by mode and decision.", + StabilityLevel: metrics.ALPHA, + Buckets: metrics.ExponentialBuckets(0.001, 2, 15), + }, + []string{"mode", "decision"}, + ) +) + +var registerMetrics sync.Once + +func RegisterMetrics() { + registerMetrics.Do(func() { + legacyregistry.MustRegister(impersonationAttemptsTotal) + legacyregistry.MustRegister(impersonationAttemptsDurationSeconds) + legacyregistry.MustRegister(impersonationAuthorizationAttemptsTotal) + legacyregistry.MustRegister(impersonationAuthorizationAttemptsDurationSeconds) + }) +} + +func RecordImpersonationAttempt(mode, decision string, duration time.Duration) { + impersonationAttemptsTotal.WithLabelValues(mode, decision).Inc() + impersonationAttemptsDurationSeconds.WithLabelValues(mode, decision).Observe(duration.Seconds()) +} + +func RecordImpersonationAuthorizationCall(mode, decision string, duration time.Duration) { + impersonationAuthorizationAttemptsTotal.WithLabelValues(mode, decision).Inc() + impersonationAuthorizationAttemptsDurationSeconds.WithLabelValues(mode, decision).Observe(duration.Seconds()) +} diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go index 2efd08d25a..3d0800747a 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/delete.go @@ -415,7 +415,7 @@ func authorizeUnsafeDelete(ctx context.Context, attr admission.Attributes, authz decision, reason, err := authz.Authorize(ctx, record) if err != nil { err = fmt.Errorf("error while checking permission for %q, %w", record.Verb, err) - klog.FromContext(ctx).V(1).Error(err, "failed to authorize") + klog.FromContext(ctx).V(1).Info("failed to authorize", "err", err) return admission.NewForbidden(attr, err) } if decision == authorizer.DecisionAllow { diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go index eb52baf194..134e163eeb 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/get.go @@ -25,10 +25,7 @@ import ( "strings" "time" - "go.opentelemetry.io/otel/attribute" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/api/meta" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" metainternalversionscheme "k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme" metainternalversionvalidation "k8s.io/apimachinery/pkg/apis/meta/internalversion/validation" @@ -36,6 +33,7 @@ import ( "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/audit" "k8s.io/apiserver/pkg/endpoints/handlers/negotiation" "k8s.io/apiserver/pkg/endpoints/metrics" "k8s.io/apiserver/pkg/endpoints/request" @@ -170,142 +168,163 @@ func getRequestOptions(req *http.Request, scope *RequestScope, into runtime.Obje func ListResource(r rest.Lister, rw rest.Watcher, scope *RequestScope, forceWatch bool, minRequestTimeout time.Duration) http.HandlerFunc { return func(w http.ResponseWriter, req *http.Request) { ctx := req.Context() - // For performance tracking purposes. - ctx, span := tracing.Start(ctx, "List", traceFields(req)...) - req = req.WithContext(ctx) - namespace, err := scope.Namer.Namespace(req) if err != nil { scope.err(err, w, req) return } - - // Watches for single objects are routed to this function. - // Treat a name parameter the same as a field selector entry. - hasName := true - _, name, err := scope.Namer.Name(req) - if err != nil { - hasName = false - } ctx = request.WithNamespace(ctx, namespace) - opts := metainternalversion.ListOptions{} - if err := metainternalversionscheme.ParameterCodec.DecodeParameters(req.URL.Query(), scope.MetaGroupVersion, &opts); err != nil { - err = errors.NewBadRequest(err.Error()) + outputMediaType, _, err := negotiation.NegotiateOutputMediaType(req, scope.Serializer, scope) + if err != nil { scope.err(err, w, req) return } - - metainternalversion.SetListOptionsDefaults(&opts, utilfeature.DefaultFeatureGate.Enabled(features.WatchList)) - if errs := metainternalversionvalidation.ValidateListOptions(&opts, utilfeature.DefaultFeatureGate.Enabled(features.WatchList)); len(errs) > 0 { - err := errors.NewInvalid(schema.GroupKind{Group: metav1.GroupName, Kind: "ListOptions"}, "", errs) + opts, err := listOpts(req, scope) + if err != nil { scope.err(err, w, req) return } - outputMediaType, _, err := negotiation.NegotiateOutputMediaType(req, scope.Serializer, scope) + switch { + case opts.Watch || forceWatch: + err = handleWatch(ctx, rw, scope, req, w, opts, outputMediaType, minRequestTimeout) + default: + err = handleList(ctx, r, scope, req, w, opts, outputMediaType) + } if err != nil { scope.err(err, w, req) return } + } +} - // transform fields - // TODO: DecodeParametersInto should do this. - if opts.FieldSelector != nil { - fn := func(label, value string) (newLabel, newValue string, err error) { - return scope.Convertor.ConvertFieldLabel(scope.Kind, label, value) - } - if opts.FieldSelector, err = opts.FieldSelector.Transform(fn); err != nil { - // TODO: allow bad request to set field causes based on query parameters - err = errors.NewBadRequest(err.Error()) - scope.err(err, w, req) - return - } +func listOpts(req *http.Request, scope *RequestScope) (metainternalversion.ListOptions, error) { + // Watches for single objects are routed to this function. + // Treat a name parameter the same as a field selector entry. + hasName := true + _, name, err := scope.Namer.Name(req) + if err != nil { + hasName = false + } + + opts := metainternalversion.ListOptions{} + if err := metainternalversionscheme.ParameterCodec.DecodeParameters(req.URL.Query(), scope.MetaGroupVersion, &opts); err != nil { + return opts, errors.NewBadRequest(err.Error()) + } + + metainternalversion.SetListOptionsDefaults(&opts, utilfeature.DefaultFeatureGate.Enabled(features.WatchList)) + if errs := metainternalversionvalidation.ValidateListOptions(&opts, utilfeature.DefaultFeatureGate.Enabled(features.WatchList)); len(errs) > 0 { + err := errors.NewInvalid(schema.GroupKind{Group: metav1.GroupName, Kind: "ListOptions"}, "", errs) + return opts, err + } + + // transform fields + // TODO: DecodeParametersInto should do this. + if opts.FieldSelector != nil { + fn := func(label, value string) (newLabel, newValue string, err error) { + return scope.Convertor.ConvertFieldLabel(scope.Kind, label, value) } + if opts.FieldSelector, err = opts.FieldSelector.Transform(fn); err != nil { + // TODO: allow bad request to set field causes based on query parameters + return opts, errors.NewBadRequest(err.Error()) + } + } - if hasName { - // metadata.name is the canonical internal name. - // SelectionPredicate will notice that this is a request for - // a single object and optimize the storage query accordingly. - nameSelector := fields.OneTermEqualSelector("metadata.name", name) - - // Note that fieldSelector setting explicitly the "metadata.name" - // will result in reaching this branch (as the value of that field - // is propagated to requestInfo as the name parameter. - // That said, the allowed field selectors in this branch are: - // nil, fields.Everything and field selector matching metadata.name - // for our name. - if opts.FieldSelector != nil && !opts.FieldSelector.Empty() { - selectedName, ok := opts.FieldSelector.RequiresExactMatch("metadata.name") - if !ok || name != selectedName { - scope.err(errors.NewBadRequest("fieldSelector metadata.name doesn't match requested name"), w, req) - return - } - } else { - opts.FieldSelector = nameSelector + if hasName { + // metadata.name is the canonical internal name. + // SelectionPredicate will notice that this is a request for + // a single object and optimize the storage query accordingly. + nameSelector := fields.OneTermEqualSelector("metadata.name", name) + + // Note that fieldSelector setting explicitly the "metadata.name" + // will result in reaching this branch (as the value of that field + // is propagated to requestInfo as the name parameter. + // That said, the allowed field selectors in this branch are: + // nil, fields.Everything and field selector matching metadata.name + // for our name. + if opts.FieldSelector != nil && !opts.FieldSelector.Empty() { + selectedName, ok := opts.FieldSelector.RequiresExactMatch("metadata.name") + if !ok || name != selectedName { + return opts, errors.NewBadRequest("fieldSelector metadata.name doesn't match requested name") } + } else { + opts.FieldSelector = nameSelector } + } + return opts, nil +} - if opts.Watch || forceWatch { - if rw == nil { - scope.err(errors.NewMethodNotSupported(scope.Resource.GroupResource(), "watch"), w, req) - return - } - // TODO: Currently we explicitly ignore ?timeout= and use only ?timeoutSeconds=. - timeout := time.Duration(0) - if opts.TimeoutSeconds != nil { - timeout = time.Duration(*opts.TimeoutSeconds) * time.Second - } - if timeout == 0 && minRequestTimeout > 0 { - timeout = time.Duration(float64(minRequestTimeout) * (rand.Float64() + 1.0)) - } +func handleWatch(ctx context.Context, rw rest.Watcher, scope *RequestScope, req *http.Request, w http.ResponseWriter, opts metainternalversion.ListOptions, outputMediaType negotiation.MediaTypeOptions, minRequestTimeout time.Duration) error { + var span *tracing.Span + var onWatchListComplete WatchListCompleteHook + if isListWatchRequest(opts) { + ctx, span = tracing.Start(ctx, "WatchList", traceFields(req)...) + onWatchListComplete = func() { span.End(500 * time.Millisecond) } + req = req.WithContext(ctx) + } - klog.V(3).InfoS("Starting watch", "path", req.URL.Path, "resourceVersion", opts.ResourceVersion, "labels", opts.LabelSelector, "fields", opts.FieldSelector, "timeout", timeout) - ctx, cancel := context.WithTimeout(ctx, timeout) - defer func() { cancel() }() - watcher, err := rw.Watch(ctx, &opts) - if err != nil { - scope.err(err, w, req) - return - } - handler, err := serveWatchHandler(watcher, scope, outputMediaType, req, w, timeout, metrics.CleanListScope(ctx, &opts)) - if err != nil { - scope.err(err, w, req) - return - } - // Invalidate cancel() to defer until serve() is complete. - deferredCancel := cancel - cancel = func() {} - - serve := func() { - defer deferredCancel() - requestInfo, _ := request.RequestInfoFrom(ctx) - metrics.RecordLongRunning(req, requestInfo, metrics.APIServerComponent, func() { - defer watcher.Stop() - handler.ServeHTTP(w, req) - }) - } + if rw == nil { + return errors.NewMethodNotSupported(scope.Resource.GroupResource(), "watch") + } + // TODO: Currently we explicitly ignore ?timeout= and use only ?timeoutSeconds=. + timeout := time.Duration(0) + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + if timeout == 0 && minRequestTimeout > 0 { + timeout = time.Duration(float64(minRequestTimeout) * (rand.Float64() + 1.0)) + } - // Run watch serving in a separate goroutine to allow freeing current stack memory - t := routine.TaskFrom(req.Context()) - if t != nil { - t.Func = serve - } else { - serve() - } - return - } + klog.V(3).InfoS("Starting watch", "path", req.URL.Path, "resourceVersion", opts.ResourceVersion, "labels", opts.LabelSelector, "fields", opts.FieldSelector, "sendInitialEvents", opts.SendInitialEvents, "timeout", timeout, "audit-ID", audit.GetAuditIDTruncated(ctx)) + ctx, cancel := context.WithTimeout(ctx, timeout) + defer func() { cancel() }() + watcher, err := rw.Watch(ctx, &opts) + if err != nil { + return err + } + handler, err := serveWatchHandler(watcher, scope, outputMediaType, req, w, timeout, metrics.CleanListScope(ctx, &opts), onWatchListComplete) + if err != nil { + return err + } + // Invalidate cancel() to defer until serve() is complete. + deferredCancel := cancel + cancel = func() {} - // Log only long List requests (ignore Watch). - defer span.End(500 * time.Millisecond) - span.AddEvent("About to List from storage") - result, err := r.List(ctx, &opts) - if err != nil { - scope.err(err, w, req) - return - } - span.AddEvent("Listing from storage done") - defer span.AddEvent("Writing http response done", attribute.Int("count", meta.LenList(result))) - transformResponseObject(ctx, scope, req, w, http.StatusOK, outputMediaType, result) + serve := func() { + defer deferredCancel() + requestInfo, _ := request.RequestInfoFrom(ctx) + metrics.RecordLongRunning(req, requestInfo, metrics.APIServerComponent, func() { + defer watcher.Stop() + handler.ServeHTTP(w, req) + }) } + + // Run watch serving in a separate goroutine to allow freeing current stack memory + t := routine.TaskFrom(req.Context()) + if t != nil { + t.Func = serve + } else { + serve() + } + return nil +} + +func handleList(ctx context.Context, r rest.Lister, scope *RequestScope, req *http.Request, w http.ResponseWriter, opts metainternalversion.ListOptions, outputMediaType negotiation.MediaTypeOptions) error { + // For performance tracking purposes. + ctx, span := tracing.Start(ctx, "List", traceFields(req)...) + defer span.End(500 * time.Millisecond) + req = req.WithContext(ctx) + + result, err := r.List(ctx, &opts) + if err != nil { + return err + } + transformResponseObject(ctx, scope, req, w, http.StatusOK, outputMediaType, result) + return nil +} + +// isListWatchRequest is mirrored in staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go +func isListWatchRequest(opts metainternalversion.ListOptions) bool { + return opts.SendInitialEvents != nil && *opts.SendInitialEvents && opts.AllowWatchBookmarks } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/metrics/OWNERS b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/metrics/OWNERS index 433e84aa3e..04bd3fa653 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/metrics/OWNERS +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/metrics/OWNERS @@ -1,4 +1,5 @@ # See the OWNERS docs at https://go.k8s.io/owners -approvers: +approvers: [] +emeritus_approvers: - logicalhan diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go index 55f8b657a3..cb782f76a3 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go @@ -34,7 +34,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/httpstream/wsstream" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apiserver/pkg/audit" "k8s.io/apiserver/pkg/endpoints/handlers/negotiation" @@ -44,6 +43,7 @@ import ( utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/apiserver/pkg/util/flushwriter" "k8s.io/component-base/tracing" + "k8s.io/streaming/pkg/httpstream/wsstream" ) // StreamObject performs input stream negotiation from a ResourceStreamer and writes that to the response. diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go index 822e562889..9121ec3fad 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/handlers/watch.go @@ -24,21 +24,26 @@ import ( "sync/atomic" "time" + "go.opentelemetry.io/otel/attribute" "golang.org/x/net/websocket" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/util/httpstream/wsstream" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/audit" "k8s.io/apiserver/pkg/endpoints/handlers/negotiation" "k8s.io/apiserver/pkg/endpoints/metrics" apirequest "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/features" + "k8s.io/apiserver/pkg/server/httplog" "k8s.io/apiserver/pkg/storage" utilfeature "k8s.io/apiserver/pkg/util/feature" compbasemetrics "k8s.io/component-base/metrics" + "k8s.io/component-base/tracing" + "k8s.io/klog/v2" + "k8s.io/streaming/pkg/httpstream/wsstream" ) // timeoutFactory abstracts watch timeout logic for testing @@ -64,7 +69,7 @@ func (w *realTimeoutFactory) TimeoutCh() (<-chan time.Time, func() bool) { // serveWatchHandler returns a handle to serve a watch response. // TODO: the functionality in this method and in WatchServer.Serve is not cleanly decoupled. -func serveWatchHandler(watcher watch.Interface, scope *RequestScope, mediaTypeOptions negotiation.MediaTypeOptions, req *http.Request, w http.ResponseWriter, timeout time.Duration, metricsScope string) (http.Handler, error) { +func serveWatchHandler(watcher watch.Interface, scope *RequestScope, mediaTypeOptions negotiation.MediaTypeOptions, req *http.Request, w http.ResponseWriter, timeout time.Duration, metricsScope string, completeHook WatchListCompleteHook) (http.Handler, error) { options, err := optionsForTransform(mediaTypeOptions, req) if err != nil { return nil, err @@ -171,7 +176,8 @@ func serveWatchHandler(watcher watch.Interface, scope *RequestScope, mediaTypeOp TimeoutFactory: &realTimeoutFactory{timeout}, ServerShuttingDownCh: serverShuttingDownCh, - metricsScope: metricsScope, + metricsScope: metricsScope, + watchListCompleteHook: completeHook, } if wsstream.IsWebSocketRequest(req) { @@ -201,9 +207,12 @@ type WatchServer struct { TimeoutFactory TimeoutFactory ServerShuttingDownCh <-chan struct{} - metricsScope string + metricsScope string + watchListCompleteHook WatchListCompleteHook } +type WatchListCompleteHook func() + // watchEventMetricsRecorder allows the caller to count bytes written and report the size of the event. // It is thread-safe, as long as underlying io.Writer is thread-safe. // Once all Write calls for a given watch event have finished, RecordEvent must be called. @@ -230,6 +239,15 @@ func (c *watchEventMetricsRecorder) RecordEvent() { // HandleHTTP serves a series of encoded events via HTTP with Transfer-Encoding: chunked. // or over a websocket connection. func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { + ctx := req.Context() + ctx, span := tracing.Start(ctx, "WatchServer.HandleHTTP", + attribute.String("audit-id", audit.GetAuditIDTruncated(ctx)), + attribute.String("method", req.Method), + attribute.String("url", req.URL.Path), + attribute.String("protocol", req.Proto), + attribute.String("mediaType", s.MediaType), + attribute.String("encoder", string(s.Encoder.Identifier()))) + req = req.WithContext(ctx) defer func() { if s.MemoryAllocator != nil { runtime.AllocatorPool.Put(s.MemoryAllocator) @@ -239,7 +257,7 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { flusher, ok := w.(http.Flusher) if !ok { err := fmt.Errorf("unable to start watch - can't get http.Flusher: %#v", w) - utilruntime.HandleError(err) + utilruntime.HandleErrorWithContext(req.Context(), err, "Unable to start watch") s.Scope.err(errors.NewInternalError(err), w, req) return } @@ -248,7 +266,7 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { if framer == nil { // programmer error err := fmt.Errorf("no stream framing support is available for media type %q", s.MediaType) - utilruntime.HandleError(err) + utilruntime.HandleErrorWithContext(req.Context(), err, "No stream framing support available") s.Scope.err(errors.NewBadRequest(err.Error()), w, req) return } @@ -275,6 +293,7 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { ch := s.Watching.ResultChan() done := req.Context().Done() + span.AddEvent("About to start writing response") for { select { case <-s.ServerShuttingDownCh: @@ -295,10 +314,10 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { // End of results. return } - isWatchListLatencyRecordingRequired := shouldRecordWatchListLatency(event) + isWatchListLatencyRecordingRequired := shouldRecordWatchListLatency(req.Context(), event) if err := watchEncoder.Encode(event); err != nil { - utilruntime.HandleError(err) + utilruntime.HandleErrorWithContext(req.Context(), err, "Failed to encode watch event") // client disconnect. return } @@ -308,7 +327,20 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { flusher.Flush() } if isWatchListLatencyRecordingRequired { - metrics.RecordWatchListLatency(req.Context(), s.Scope.Resource, s.metricsScope) + // Record completion of initial listing phase for WatchList + receivedTimestamp, ok := apirequest.ReceivedTimestampFrom(req.Context()) + if !ok { + utilruntime.HandleErrorWithContext(req.Context(), nil, "Unable to measure watchlist latency, no received timestamp found in the context", "gvr", s.Scope.Resource) + } else { + initLatency := time.Since(receivedTimestamp) + metrics.RecordWatchListLatency(req.Context(), s.Scope.Resource, s.metricsScope, initLatency) + auditID := audit.GetAuditIDTruncated(req.Context()) + klog.V(3).InfoS("WatchList initial events sent", "path", req.URL.Path, "auditID", auditID, "initLatency", initLatency) + httplog.AddKeyValue(req.Context(), "watchlist_init_latency", initLatency) + span.AddEvent("Writing initial events done") + span.End(5 * time.Second) + s.watchListCompleteHook() + } } } } @@ -316,6 +348,9 @@ func (s *WatchServer) HandleHTTP(w http.ResponseWriter, req *http.Request) { // HandleWS serves a series of encoded events over a websocket connection. func (s *WatchServer) HandleWS(ws *websocket.Conn) { + ctx := ws.Request().Context() + logger := klog.FromContext(ctx) + defer func() { if s.MemoryAllocator != nil { runtime.AllocatorPool.Put(s.MemoryAllocator) @@ -329,10 +364,10 @@ func (s *WatchServer) HandleWS(ws *websocket.Conn) { defer cleanup() go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithLogger(logger) // This blocks until the connection is closed. // Client should not send anything. - wsstream.IgnoreReceives(ws, 0) + wsstream.IgnoreReceivesWithLogger(logger, ws, 0) // Once the client closes, we should also close close(done) }() @@ -340,7 +375,7 @@ func (s *WatchServer) HandleWS(ws *websocket.Conn) { framer := newWebsocketFramer(ws, s.UseTextFraming) gvr := s.Scope.Resource - watchEncoder := newWatchEncoder(context.TODO(), gvr, s.EmbeddedEncoder, s.Encoder, framer) + watchEncoder := newWatchEncoder(ctx, gvr, s.EmbeddedEncoder, s.Encoder, framer) ch := s.Watching.ResultChan() for { @@ -356,7 +391,7 @@ func (s *WatchServer) HandleWS(ws *websocket.Conn) { } if err := watchEncoder.Encode(event); err != nil { - utilruntime.HandleError(err) + utilruntime.HandleErrorWithLogger(logger, err, "Failed to encode watch event") // client disconnect. return } @@ -393,7 +428,7 @@ func (w *websocketFramer) Write(p []byte) (int, error) { var _ io.Writer = &websocketFramer{} -func shouldRecordWatchListLatency(event watch.Event) bool { +func shouldRecordWatchListLatency(ctx context.Context, event watch.Event) bool { if event.Type != watch.Bookmark || !utilfeature.DefaultFeatureGate.Enabled(features.WatchList) { return false } @@ -403,7 +438,7 @@ func shouldRecordWatchListLatency(event watch.Event) bool { // for more please read https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/3157-watch-list hasAnnotation, err := storage.HasInitialEventsEndBookmarkAnnotation(event.Object) if err != nil { - utilruntime.HandleError(fmt.Errorf("unable to determine if the obj has the required annotation for measuring watchlist latency, obj %T: %v", event.Object, err)) + utilruntime.HandleErrorWithContext(ctx, err, "Unable to determine if the object has the required annotation for measuring watchlist latency", "object", fmt.Sprintf("%T", event.Object)) return false } return hasAnnotation diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/metrics/OWNERS b/vendor/k8s.io/apiserver/pkg/endpoints/metrics/OWNERS index 43fbd53336..50b8726a7d 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/metrics/OWNERS +++ b/vendor/k8s.io/apiserver/pkg/endpoints/metrics/OWNERS @@ -2,5 +2,6 @@ reviewers: - wojtek-t -approvers: +approvers: [] +emeritus_approvers: - logicalhan diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go index c76457175a..a4da6ebe2f 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/metrics/metrics.go @@ -18,7 +18,6 @@ package metrics import ( "context" - "fmt" "net/http" "net/url" "strconv" @@ -32,7 +31,6 @@ import ( "k8s.io/apimachinery/pkg/apis/meta/v1/validation" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/types" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" utilsets "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/audit" "k8s.io/apiserver/pkg/authentication/user" @@ -291,7 +289,7 @@ var ( Name: "watch_list_duration_seconds", Help: "Response latency distribution in seconds for watch list requests broken by group, version, resource and scope.", Buckets: []float64{0.05, 0.1, 0.2, 0.4, 0.6, 0.8, 1.0, 2, 4, 6, 8, 10, 15, 20, 30, 45, 60}, - StabilityLevel: compbasemetrics.ALPHA, + StabilityLevel: compbasemetrics.BETA, }, []string{"group", "version", "resource", "scope"}, ) @@ -574,15 +572,8 @@ func RecordLongRunning(req *http.Request, requestInfo *request.RequestInfo, comp } // RecordWatchListLatency simply records response latency for watch list requests. -func RecordWatchListLatency(ctx context.Context, gvr schema.GroupVersionResource, metricsScope string) { - requestReceivedTimestamp, ok := request.ReceivedTimestampFrom(ctx) - if !ok { - utilruntime.HandleError(fmt.Errorf("unable to measure watchlist latency because no received ts found in the ctx, gvr: %s", gvr)) - return - } - elapsedSeconds := time.Since(requestReceivedTimestamp).Seconds() - - watchListLatencies.WithContext(ctx).WithLabelValues(gvr.Group, gvr.Version, gvr.Resource, metricsScope).Observe(elapsedSeconds) +func RecordWatchListLatency(ctx context.Context, gvr schema.GroupVersionResource, metricsScope string, elapsed time.Duration) { + watchListLatencies.WithContext(ctx).WithLabelValues(gvr.Group, gvr.Version, gvr.Resource, metricsScope).Observe(elapsed.Seconds()) } // MonitorRequest handles standard transformations for client and the reported verb and then invokes Monitor to record diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go b/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go index d6bf062a19..1cf14d892f 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go @@ -22,7 +22,7 @@ import ( "net/http" "strings" - "k8s.io/apimachinery/pkg/api/validation/path" + "k8s.io/apimachinery/pkg/api/validate/content" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" metainternalversionscheme "k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -246,7 +246,7 @@ func (r *RequestInfoFactory) NewRequestInfo(req *http.Request) (*RequestInfo, er if opts.FieldSelector != nil { if name, ok := opts.FieldSelector.RequiresExactMatch("metadata.name"); ok { - if len(path.IsValidPathSegmentName(name)) == 0 { + if len(content.IsPathSegmentName(name)) == 0 { requestInfo.Name = name } } diff --git a/vendor/k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go b/vendor/k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go index bda43b617b..df0ff77d89 100644 --- a/vendor/k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go +++ b/vendor/k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go @@ -165,6 +165,10 @@ type LatencyTrackers struct { // When called multiple times, the latency incurred inside to // decode func each time will be summed up. DecodeTracker DurationTracker + + // ImpersonationTracker tracks the latency incurred in resolving impersonation. + // This includes mode selection, authorization checks, and cache lookups. + ImpersonationTracker DurationTracker } type latencyTrackersKeyType int @@ -193,6 +197,7 @@ func WithLatencyTrackersAndCustomClock(parent context.Context, c clock.Clock) co SerializationTracker: newSumLatencyTracker(c), ResponseWriteTracker: newSumLatencyTracker(c), DecodeTracker: newSumLatencyTracker(c), + ImpersonationTracker: newSumLatencyTracker(c), }) } @@ -286,6 +291,14 @@ func TrackDecodeLatency(ctx context.Context, d time.Duration) { } } +// TrackImpersonationLatency is used to track latency incurred +// in resolving impersonation for the request. +func TrackImpersonationLatency(ctx context.Context, d time.Duration) { + if tracker, ok := LatencyTrackersFrom(ctx); ok { + tracker.ImpersonationTracker.TrackDuration(d) + } +} + // AuditAnnotationsFromLatencyTrackers will inspect each latency tracker // associated with the request context and return a set of audit // annotations that can be added to the API audit entry. @@ -301,6 +314,7 @@ func AuditAnnotationsFromLatencyTrackers(ctx context.Context) map[string]string apfQueueWaitLatencyKey = "apiserver.latency.k8s.io/apf-queue-wait" authenticationLatencyKey = "apiserver.latency.k8s.io/authentication" authorizationLatencyKey = "apiserver.latency.k8s.io/authorization" + impersonationLatencyKey = "apiserver.latency.k8s.io/impersonation" ) tracker, ok := LatencyTrackersFrom(ctx) @@ -339,5 +353,8 @@ func AuditAnnotationsFromLatencyTrackers(ctx context.Context) map[string]string if latency := tracker.AuthorizationTracker.GetLatency(); latency != 0 { annotations[authorizationLatencyKey] = latency.String() } + if latency := tracker.ImpersonationTracker.GetLatency(); latency != 0 { + annotations[impersonationLatencyKey] = latency.String() + } return annotations } diff --git a/vendor/k8s.io/apiserver/pkg/features/kube_features.go b/vendor/k8s.io/apiserver/pkg/features/kube_features.go index 3c9a799a58..dbe776e8af 100644 --- a/vendor/k8s.io/apiserver/pkg/features/kube_features.go +++ b/vendor/k8s.io/apiserver/pkg/features/kube_features.go @@ -128,13 +128,32 @@ const ( // Enables running declarative validation of APIs, where declared. When enabled, APIs with // declarative validation rules will validate objects using the generated // declarative validation code and compare the results to the regular imperative validation. - // See DeclarativeValidationTakeover for more. + // See DeclarativeValidationBeta for more. DeclarativeValidation featuregate.Feature = "DeclarativeValidation" + // owner: @jpbetz @aaron-prindle @yongruilin + // kep: http://kep.k8s.io/5073 + // beta: v1.36 + // + // This feature gate acts as the Global Safety Switch for Beta-stage validation rules (+k8s:beta). + // It allows cluster admins to disable enforcement for validations in the Beta stage if + // regressions are found, forcing them back to Shadow mode. + // In Shadow mode, declarative validation is executed and mismatches against handwritten + // validation are logged as metrics, but failures do not reject requests. + // Handwritten validation remains authoritative and enforced. + // Enforcement logic for resources using WithDeclarativeEnforcement(): + // - Standard tags (no prefix): Always Enforced (Bypasses this gate). + // - Beta tags (+k8s:beta): Enforced when this gate is enabled (default), otherwise Shadowed. + // - Alpha tags (+k8s:alpha): Always Shadowed. + // This gate has no effect if the master DeclarativeValidation feature gate is disabled. + DeclarativeValidationBeta featuregate.Feature = "DeclarativeValidationBeta" + // owner: @jpbetz @aaron-prindle @yongruilin // kep: http://kep.k8s.io/5073 // beta: v1.33 // + // Deprecated: in favor of DeclarativeValidationBeta. + // // When enabled, declarative validation errors are returned directly to the caller, // replacing hand-written validation errors for rules that have declarative implementations. // When disabled, hand-written validation errors are always returned, effectively putting @@ -162,6 +181,15 @@ const ( // Enables generating snapshots of watch cache store and using them to serve LIST requests. ListFromCacheSnapshot featuregate.Feature = "ListFromCacheSnapshot" + // owner: @aramase @BenTheElder + // kep: https://kep.k8s.io/5793 + // + // Enables manifest-based admission control configuration for webhooks and policies. + // When enabled, admission webhooks and policies can be loaded from + // manifest files on disk at API server startup, providing bootstrap-time enforcement + // and protection against API-based modification. + ManifestBasedAdmissionControlConfig featuregate.Feature = "ManifestBasedAdmissionControlConfig" + // owner: @alexzielenski, @cici37, @jiahuif, @jpbetz // kep: https://kep.k8s.io/3962 // @@ -199,6 +227,14 @@ const ( // This prevents watch cache from being starved by other watches. SeparateCacheWatchRPC featuregate.Feature = "SeparateCacheWatchRPC" + // owner: @jefftree + // kep: https://kep.k8s.io/5866 + // + // Enables the shard selector parameter on List/Watch requests, + // allowing clients to receive a filtered subset of objects based + // on hash ranges of metadata fields (e.g. UID). + ShardedListAndWatch featuregate.Feature = "ShardedListAndWatch" + // owner: @serathius // // Enables APF to use size of objects for estimating request cost. @@ -241,12 +277,6 @@ const ( // Enables JWKs metrics for Structured Authentication Configuration StructuredAuthenticationConfigurationJWKSMetrics featuregate.Feature = "StructuredAuthenticationConfigurationJWKSMetrics" - // owner: @palnabarun - // kep: https://kep.k8s.io/3221 - // - // Enables Structured Authorization Configuration - StructuredAuthorizationConfiguration featuregate.Feature = "StructuredAuthorizationConfiguration" - // owner: @aramase // // Enables validation of service account UID in TokenRequest API. @@ -284,11 +314,6 @@ const ( // Enables post-start-hook for storage readiness WatchCacheInitializationPostStartHook featuregate.Feature = "WatchCacheInitializationPostStartHook" - // owner: @serathius - // Enables watches without resourceVersion to be served from storage. - // Used to prevent https://github.com/kubernetes/kubernetes/issues/123072 until etcd fixes the issue. - WatchFromStorageWithoutResourceVersion featuregate.Feature = "WatchFromStorageWithoutResourceVersion" - // owner: @p0lyn0mial // // Allow the API server to stream individual items instead of chunking @@ -374,6 +399,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate ConstrainedImpersonation: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, CoordinatedLeaderElection: { @@ -383,10 +409,16 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate DeclarativeValidation: { {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA and LockToDefault in 1.36, remove in 1.39 + }, + + DeclarativeValidationBeta: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, DeclarativeValidationTakeover: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Deprecated}, }, DetectCacheInconsistency: { @@ -404,9 +436,14 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, + ManifestBasedAdmissionControlConfig: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + MutatingAdmissionPolicy: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA}, }, OpenAPIEnums: { @@ -433,6 +470,11 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate SeparateCacheWatchRPC: { {Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated}, + {Version: version.MustParse("1.36"), Default: false, LockToDefault: true, PreRelease: featuregate.Deprecated}, + }, + + ShardedListAndWatch: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, }, SizeBasedListCostEstimate: { @@ -472,12 +514,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, }, - StructuredAuthorizationConfiguration: { - {Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, - }, - TokenRequestServiceAccountUIDValidation: { {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, @@ -489,15 +525,12 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate UnknownVersionInteroperabilityProxy: { {Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, WatchCacheInitializationPostStartHook: { {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, - }, - - WatchFromStorageWithoutResourceVersion: { - {Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated, LockToDefault: true}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, WatchList: { diff --git a/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go b/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go index b664719209..6fa01fc613 100644 --- a/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go +++ b/vendor/k8s.io/apiserver/pkg/quota/v1/resources.go @@ -17,7 +17,7 @@ limitations under the License. package v1 import ( - "sort" + "slices" "strings" corev1 "k8s.io/api/core/v1" @@ -198,7 +198,7 @@ func Intersection(a []corev1.ResourceName, b []corev1.ResourceName) []corev1.Res } result = append(result, item) } - sort.Slice(result, func(i, j int) bool { return result[i] < result[j] }) + slices.Sort(result) return result } @@ -211,7 +211,7 @@ func Difference(a []corev1.ResourceName, b []corev1.ResourceName) []corev1.Resou } result = append(result, item) } - sort.Slice(result, func(i, j int) bool { return result[i] < result[j] }) + slices.Sort(result) return result } diff --git a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go index 722a312270..4fef3be397 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go +++ b/vendor/k8s.io/apiserver/pkg/registry/generic/registry/store.go @@ -27,8 +27,8 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/api/validate/content" "k8s.io/apimachinery/pkg/api/validation" - "k8s.io/apimachinery/pkg/api/validation/path" metainternalversion "k8s.io/apimachinery/pkg/apis/meta/internalversion" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" @@ -45,6 +45,7 @@ import ( "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/registry/generic" "k8s.io/apiserver/pkg/registry/rest" + "k8s.io/apiserver/pkg/sharding" "k8s.io/apiserver/pkg/storage" storeerr "k8s.io/apiserver/pkg/storage/errors" "k8s.io/apiserver/pkg/storage/etcd3/metrics" @@ -286,7 +287,7 @@ func NamespaceKeyFunc(ctx context.Context, prefix string, name string) (string, if len(name) == 0 { return "", apierrors.NewBadRequest("Name parameter required.") } - if msgs := path.IsValidPathSegmentName(name); len(msgs) != 0 { + if msgs := content.IsPathSegmentName(name); len(msgs) != 0 { return "", apierrors.NewBadRequest(fmt.Sprintf("Name parameter invalid: %q: %s", name, strings.Join(msgs, ";"))) } key = key + "/" + name @@ -299,7 +300,7 @@ func NoNamespaceKeyFunc(ctx context.Context, prefix string, name string) (string if len(name) == 0 { return "", apierrors.NewBadRequest("Name parameter required.") } - if msgs := path.IsValidPathSegmentName(name); len(msgs) != 0 { + if msgs := content.IsPathSegmentName(name); len(msgs) != 0 { return "", apierrors.NewBadRequest(fmt.Sprintf("Name parameter invalid: %q: %s", name, strings.Join(msgs, ";"))) } key := prefix + "/" + name @@ -393,6 +394,13 @@ func (e *Store) ListPredicate(ctx context.Context, p storage.SelectionPredicate, } p.Limit = options.Limit p.Continue = options.Continue + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) && options.ShardSelector != "" { + sel, err := sharding.Parse(options.ShardSelector) + if err != nil { + return nil, fmt.Errorf("invalid shard selector: %w", err) + } + p.ShardSelector = sel + } list := e.NewListFunc() qualifiedResource := e.qualifiedResourceFromContext(ctx) storageOpts := storage.ListOptions{ @@ -1263,7 +1271,7 @@ func (e *Store) DeleteCollection(ctx context.Context, deleteValidation rest.Vali for i := 0; i < workersNumber; i++ { go func() { // panics don't cross goroutine boundaries - defer utilruntime.HandleCrash(func(panicReason interface{}) { + defer utilruntime.HandleCrashWithContext(ctx, func(_ context.Context, panicReason interface{}) { errs <- fmt.Errorf("DeleteCollection goroutine panicked: %v", panicReason) }) defer wg.Done() @@ -1288,7 +1296,7 @@ func (e *Store) DeleteCollection(ctx context.Context, deleteValidation rest.Vali } // In case of all workers exit, notify distributor. go func() { - defer utilruntime.HandleCrash(func(panicReason interface{}) { + defer utilruntime.HandleCrashWithContext(ctx, func(_ context.Context, panicReason interface{}) { errs <- fmt.Errorf("DeleteCollection workers closer panicked: %v", panicReason) }) wg.Wait() @@ -1429,13 +1437,25 @@ func (e *Store) Watch(ctx context.Context, options *metainternalversion.ListOpti if options != nil { resourceVersion = options.ResourceVersion predicate.AllowWatchBookmarks = options.AllowWatchBookmarks + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) && options.ShardSelector != "" { + sel, err := sharding.Parse(options.ShardSelector) + if err != nil { + return nil, fmt.Errorf("invalid shard selector: %w", err) + } + predicate.ShardSelector = sel + } } return e.WatchPredicate(ctx, predicate, resourceVersion, options.SendInitialEvents) } // WatchPredicate starts a watch for the items that matches. func (e *Store) WatchPredicate(ctx context.Context, p storage.SelectionPredicate, resourceVersion string, sendInitialEvents *bool) (watch.Interface, error) { - storageOpts := storage.ListOptions{ResourceVersion: resourceVersion, Predicate: p, Recursive: true, SendInitialEvents: sendInitialEvents} + storageOpts := storage.ListOptions{ + ResourceVersion: resourceVersion, + Predicate: p, + Recursive: true, + SendInitialEvents: sendInitialEvents, + } // if we're not already namespace-scoped, see if the field selector narrows the scope of the watch if requestNamespace, _ := genericapirequest.NamespaceFrom(ctx); len(requestNamespace) == 0 { diff --git a/vendor/k8s.io/apiserver/pkg/registry/rest/create.go b/vendor/k8s.io/apiserver/pkg/registry/rest/create.go index b3e57d0a45..87b2c9d81b 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/rest/create.go +++ b/vendor/k8s.io/apiserver/pkg/registry/rest/create.go @@ -22,8 +22,8 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" + "k8s.io/apimachinery/pkg/api/validate/content" genericvalidation "k8s.io/apimachinery/pkg/api/validation" - "k8s.io/apimachinery/pkg/api/validation/path" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" @@ -89,6 +89,13 @@ type RESTCreateStrategy interface { Canonicalize(obj runtime.Object) } +func validatePathSegment(name string, prefix bool) []string { + if prefix { + return content.IsPathSegmentPrefix(name) + } + return content.IsPathSegmentName(name) +} + // BeforeCreate ensures that common operations for all resources are performed on creation. It only returns // errors that can be converted to api.Status. It invokes PrepareForCreate, then Validate. // It returns nil if the object should be created. @@ -126,7 +133,7 @@ func BeforeCreate(strategy RESTCreateStrategy, ctx context.Context, obj runtime. // Custom validation (including name validation) passed // Now run common validation on object meta // Do this *after* custom validation so that specific error messages are shown whenever possible - if errs := genericvalidation.ValidateObjectMetaAccessor(objectMeta, strategy.NamespaceScoped(), path.ValidatePathSegmentName, field.NewPath("metadata")); len(errs) > 0 { + if errs := genericvalidation.ValidateObjectMetaAccessor(objectMeta, strategy.NamespaceScoped(), validatePathSegment, field.NewPath("metadata")); len(errs) > 0 { return errors.NewInvalid(kind.GroupKind(), objectMeta.GetName(), errs) } diff --git a/vendor/k8s.io/apiserver/pkg/registry/rest/update.go b/vendor/k8s.io/apiserver/pkg/registry/rest/update.go index 00f42cfe7c..32de351aa7 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/rest/update.go +++ b/vendor/k8s.io/apiserver/pkg/registry/rest/update.go @@ -23,7 +23,6 @@ import ( "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" genericvalidation "k8s.io/apimachinery/pkg/api/validation" - "k8s.io/apimachinery/pkg/api/validation/path" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/validation/field" @@ -94,7 +93,7 @@ func validateCommonFields(obj, old runtime.Object, strategy RESTUpdateStrategy) if err != nil { return nil, fmt.Errorf("failed to get old object metadata: %v", err) } - allErrs = append(allErrs, genericvalidation.ValidateObjectMetaAccessor(objectMeta, strategy.NamespaceScoped(), path.ValidatePathSegmentName, field.NewPath("metadata"))...) + allErrs = append(allErrs, genericvalidation.ValidateObjectMetaAccessor(objectMeta, strategy.NamespaceScoped(), validatePathSegment, field.NewPath("metadata"))...) allErrs = append(allErrs, genericvalidation.ValidateObjectMetaAccessorUpdate(objectMeta, oldObjectMeta, field.NewPath("metadata"))...) return allErrs, nil diff --git a/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go b/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go index 65ffdd4f16..f0e355e54f 100644 --- a/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go +++ b/vendor/k8s.io/apiserver/pkg/registry/rest/validate.go @@ -76,13 +76,37 @@ func WithNormalizationRules(rules []field.NormalizationRule) ValidationConfig { } } +// WithDeclarativeEnforcement marks the validation configuration to indicate that it includes +// declarative validations that should follow the fine-grained Validation Lifecycle. +// When set, declarative validation is always executed regardless of feature gates. +// Authority is determined by individual tag prefixes (+k8s:alpha, +k8s:beta) and the +// DeclarativeValidationBeta safety switch. +func WithDeclarativeEnforcement() ValidationConfig { + return func(config *validationConfigOption) { + config.declarativeEnforcement = true + } +} + +type allDeclarativeEnforcedKeyType struct{} + +var allDeclarativeEnforcedKey = allDeclarativeEnforcedKeyType{} + +// WithAllDeclarativeEnforcedForTest returns a copy of parent context with allDeclarativeEnforcedKey set to true. +// This is used for testing to expose all declarative validation errors and filter all handwritten validation errors +// that are covered by declarative validation, regardless of the feature gate or maturity level. +// +// NOTE: This function is intended for testing purposes only and should not be used in production code. +func WithAllDeclarativeEnforcedForTest(ctx context.Context) context.Context { + return context.WithValue(ctx, allDeclarativeEnforcedKey, true) +} + type validationConfigOption struct { - opType operation.Type - options []string - takeover bool - subresourceGVKMapper GroupVersionKindProvider - validationIdentifier string - normalizationRules []field.NormalizationRule + opType operation.Type + options []string + subresourceGVKMapper GroupVersionKindProvider + validationIdentifier string + normalizationRules []field.NormalizationRule + declarativeEnforcement bool } // validateDeclaratively validates obj and oldObj against declarative @@ -155,9 +179,9 @@ func parseSubresourcePath(subresourcePath string) ([]string, error) { // compareDeclarativeErrorsAndEmitMismatches checks for mismatches between imperative and declarative validation // and logs + emits metrics when inconsistencies are found -func compareDeclarativeErrorsAndEmitMismatches(ctx context.Context, imperativeErrs, declarativeErrs field.ErrorList, takeover bool, validationIdentifier string, normalizationRules []field.NormalizationRule) { +func compareDeclarativeErrorsAndEmitMismatches(ctx context.Context, imperativeErrs, declarativeErrs field.ErrorList, enforced bool, validationIdentifier string, normalizationRules []field.NormalizationRule) { logger := klog.FromContext(ctx) - mismatchDetails := gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs, takeover, normalizationRules) + mismatchDetails := gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs, enforced, normalizationRules) for _, detail := range mismatchDetails { // Log information about the mismatch using contextual logger logger.Error(nil, detail) @@ -169,29 +193,34 @@ func compareDeclarativeErrorsAndEmitMismatches(ctx context.Context, imperativeEr // gatherDeclarativeValidationMismatches compares imperative and declarative validation errors // and returns detailed information about any mismatches found. Errors are compared via type, field, and origin -func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field.ErrorList, takeover bool, normalizationRules []field.NormalizationRule) []string { +func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field.ErrorList, enforced bool, normalizationRules []field.NormalizationRule) []string { var mismatchDetails []string // short circuit here to minimize allocs for usual case of 0 validation errors if len(imperativeErrs) == 0 && len(declarativeErrs) == 0 { return mismatchDetails } - // recommendation based on takeover status - recommendation := "This difference should not affect system operation since hand written validation is authoritative." - if takeover { - recommendation = "Consider disabling the DeclarativeValidationTakeover feature gate to keep data persisted in etcd consistent with prior versions of Kubernetes." + // default recommendation based on enforcement status + const ( + authoritativeMsg = "This difference should not affect system operation since hand written validation is authoritative." + disableBetaMsg = "Consider disabling the DeclarativeValidationBeta feature gate to keep data persisted in etcd consistent with prior versions of Kubernetes." + ) + + defaultRecommendation := authoritativeMsg + if enforced { + defaultRecommendation = disableBetaMsg } + fuzzyMatcher := field.ErrorMatcher{}.ByType().ByOrigin().RequireOriginWhenInvalid().ByFieldNormalized(normalizationRules) - exactMatcher := field.ErrorMatcher{}.Exactly() - // Dedupe imperative errors of exact error matches as they are - // not intended and come from (buggy) duplicate validation calls + // Dedupe imperative errors using the fuzzy matcher (type, field, and origin) as they are + // not intended and come from (buggy) duplicate validation calls. // This is necessary as without deduping we could get unmatched - // imperative errors for cases that are correct (matching) + // imperative errors for cases that are correct (matching). dedupedImperativeErrs := field.ErrorList{} for _, err := range imperativeErrs { found := false for _, existingErr := range dedupedImperativeErrs { - if exactMatcher.Matches(existingErr, err) { + if fuzzyMatcher.Matches(existingErr, err) { found = true break } @@ -233,12 +262,18 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field } if matchCount == 0 { + rec := defaultRecommendation + // If the imperative error is explicitly Alpha, it is never enforced, so HV is authoritative. + if iErr.IsAlpha() { + rec = authoritativeMsg + } + mismatchDetails = append(mismatchDetails, fmt.Sprintf( "Unexpected difference between hand written validation and declarative validation error results, unmatched error(s) found %s. "+ "This indicates an issue with declarative validation. %s", fuzzyMatcher.Render(iErr), - recommendation, + rec, ), ) } @@ -248,12 +283,18 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field // Any remaining unmatched declarative errors are considered "extra" for _, dErr := range remaining { + rec := defaultRecommendation + // If the declarative error is Alpha, it is never enforced (shadowed), so HV is authoritative. + if dErr.IsAlpha() { + rec = authoritativeMsg + } + mismatchDetails = append(mismatchDetails, fmt.Sprintf( "Unexpected difference between hand written validation and declarative validation error results, extra error(s) found %s. "+ "This indicates an issue with declarative validation. %s", fuzzyMatcher.Render(dErr), - recommendation, + rec, ), ) } @@ -262,8 +303,8 @@ func gatherDeclarativeValidationMismatches(imperativeErrs, declarativeErrs field } // createDeclarativeValidationPanicHandler returns a function with panic recovery logic -// that will increment the panic metric and either log or append errors based on the takeover parameter. -func createDeclarativeValidationPanicHandler(ctx context.Context, errs *field.ErrorList, takeover bool, validationIdentifier string) func() { +// that will increment the panic metric and either log or append errors based on the shouldFail parameter. +func createDeclarativeValidationPanicHandler(ctx context.Context, errs *field.ErrorList, shouldFail bool, validationIdentifier string) func() { logger := klog.FromContext(ctx) return func() { if r := recover(); r != nil { @@ -271,11 +312,11 @@ func createDeclarativeValidationPanicHandler(ctx context.Context, errs *field.Er validationmetrics.Metrics.IncDeclarativeValidationPanicMetric(validationIdentifier) const errorFmt = "panic during declarative validation: %v" - if takeover { - // If takeover is enabled, output as a validation error as authoritative validator panicked and validation should error + if shouldFail { + // If shouldFail is enabled, output as a validation error as authoritative validator panicked and validation should error *errs = append(*errs, field.InternalError(nil, fmt.Errorf(errorFmt, r))) } else { - // if takeover not enabled, log the panic as an error message + // if shouldFail not enabled, log the panic as an error message logger.Error(nil, fmt.Sprintf(errorFmt, r)) } } @@ -285,15 +326,15 @@ func createDeclarativeValidationPanicHandler(ctx context.Context, errs *field.Er // panicSafeValidateFunc wraps an validation function with panic recovery logic. // The returned function will execute the wrapped function and handle any panics by // incrementing the panic metric, and logging an error message -// if takeover=false, and adding a validation error if takeover=true. +// if shouldFail=false, and adding a validation error if shouldFail=true. func panicSafeValidateFunc( - validateUpdateFunc func(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) field.ErrorList, - takeover bool, validationIdentifier string, + validateFunc func(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) field.ErrorList, + shouldFail bool, validationIdentifier string, ) func(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) field.ErrorList { return func(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, o *validationConfigOption) (errs field.ErrorList) { - defer createDeclarativeValidationPanicHandler(ctx, &errs, takeover, validationIdentifier)() + defer createDeclarativeValidationPanicHandler(ctx, &errs, shouldFail, validationIdentifier)() - return validateUpdateFunc(ctx, scheme, obj, oldObj, o) + return validateFunc(ctx, scheme, obj, oldObj, o) } } @@ -334,16 +375,25 @@ func metricIdentifier(ctx context.Context, scheme *runtime.Scheme, obj runtime.O return identifier, errs } -// ValidateDeclarativelyWithMigrationChecks is a helper function that encapsulates the logic for running declarative validation. -// It checks if the DeclarativeValidation feature gate is enabled, generates a validation identifier, -// runs declarative validation, compares the results with imperative validation, and merges the errors if takeover is enabled. +// ValidateDeclarativelyWithMigrationChecks executes declarative validation and implements the Validation Lifecycle strategy. +// It manages the transition from handwritten (HV) to declarative (DV) validation by controlling enforcement: +// - Standard: Enforced if declarativeEnforcement is set. HV counterparts are expected to be deleted from source. +// - Beta: Enforced if declarativeEnforcement is set AND DeclarativeValidationBeta feature gate is enabled. +// When enforced, corresponding HV errors are filtered out. Otherwise, DV is shadowed. +// - Alpha: Always shadowed; HV remains authoritative. +// +// Mismatches between HV and DV are logged if the DeclarativeValidation gate is enabled. +// Mismatch checking is limited to Alpha and Beta stages when explicit enforcement is active. +// +// For testing purposes, WithAllDeclarativeEnforcedForTest can be used to enforce all declarative validations +// regardless of feature gates and filter all covered handwritten validations. func ValidateDeclarativelyWithMigrationChecks(ctx context.Context, scheme *runtime.Scheme, obj, oldObj runtime.Object, errs field.ErrorList, opType operation.Type, configOpts ...ValidationConfig) field.ErrorList { - if !utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidation) { - return errs - } - - takeover := utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationTakeover) - + declarativeValidationEnabled := utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidation) + betaEnabled := utilfeature.DefaultFeatureGate.Enabled(features.DeclarativeValidationBeta) + // allDeclarativeEnforced indicates that we should check all declarative errors for testing purposes. + allDeclarativeEnforced := ctx.Value(allDeclarativeEnforcedKey) == true + // These errors must be errors returned by the handwritten validation. + errs = errs.MarkFromImperative() validationIdentifier, err := metricIdentifier(ctx, scheme, obj, opType) if err != nil { // Log the error, but continue with the best-effort identifier. @@ -353,24 +403,92 @@ func ValidateDeclarativelyWithMigrationChecks(ctx context.Context, scheme *runti // Directly create the config and call the core validation logic. cfg := &validationConfigOption{ opType: opType, - takeover: takeover, validationIdentifier: validationIdentifier, } for _, opt := range configOpts { opt(cfg) } + // Short-circuit if neither DeclarativeValidation is enabled nor the object is explicitly configured for declarative enforcement. + if !declarativeValidationEnabled && !cfg.declarativeEnforcement && !allDeclarativeEnforced { + return errs + } + // Call the panic-safe wrapper with the real validation function. - declarativeErrs := panicSafeValidateFunc(validateDeclaratively, cfg.takeover, cfg.validationIdentifier)(ctx, scheme, obj, oldObj, cfg) + // We should fail if validation is enforced. + declarativeErrs := panicSafeValidateFunc(validateDeclaratively, cfg.declarativeEnforcement, cfg.validationIdentifier)(ctx, scheme, obj, oldObj, cfg) + + if declarativeValidationEnabled { + // Log mismatches. + // When explicit strategy is used (declarativeEnforcement), Standard errors are authoritative + // and may not have handwritten counterparts (e.g., in new APIs). + // We only mismatch check Alpha and Beta errors in this mode. + mismatchCandidateErrs := declarativeErrs + if cfg.declarativeEnforcement { + mismatchCandidateErrs = nil + for _, err := range declarativeErrs { + if err.IsAlpha() || err.IsBeta() { + mismatchCandidateErrs = append(mismatchCandidateErrs, err) + } + } + } - compareDeclarativeErrorsAndEmitMismatches(ctx, errs, declarativeErrs, takeover, validationIdentifier, cfg.normalizationRules) - if takeover { - errs = append(errs.RemoveCoveredByDeclarative(), declarativeErrs...) + // We pass betaEnabled (and enforcement) as the takeover flag to avoid changing logic elsewhere for now. + compareDeclarativeErrorsAndEmitMismatches(ctx, errs, mismatchCandidateErrs, cfg.declarativeEnforcement && betaEnabled, validationIdentifier, cfg.normalizationRules) + } + + if !cfg.declarativeEnforcement && !allDeclarativeEnforced { + // If enforcement is not enabled, we shadow declarative errors with hand-written ones, so we return early here. + return errs + } + + // Filter HV errors + errs = filterHandwrittenErrors(errs, allDeclarativeEnforced, betaEnabled) + + // Append Enforced DV errors + for _, dvErr := range declarativeErrs { + if allDeclarativeEnforced { + errs = append(errs, dvErr) + continue + } + switch { + case dvErr.Type == field.ErrorTypeInternal: + errs = append(errs, dvErr) + case dvErr.IsBeta(): + if betaEnabled { + errs = append(errs, dvErr) + } + case !dvErr.IsAlpha(): + errs = append(errs, dvErr) // Standard + } } return errs } +func filterHandwrittenErrors(errs field.ErrorList, allDeclarativeEnforced, betaEnabled bool) field.ErrorList { + // We remove HV errors that are covered by declarative validation AND are enforced. + return errs.Filter(func(e error) bool { + var fe *field.Error + if !errors.As(e, &fe) || !fe.CoveredByDeclarative { + return false + } + + if allDeclarativeEnforced { + return true + } + + // Explicit Strategy + if fe.IsBeta() { + // Beta validations are enforced only if the Beta feature gate is enabled. + return betaEnabled + } + // For Standard validations, we keep the handwritten error for now to avoid losing coverage + // before it is deleted from source. Alpha validations are always shadowed (kept). + return false + }) +} + // RecordDuplicateValidationErrors increments a metric and log the error when duplicate validation errors are found. func RecordDuplicateValidationErrors(ctx context.Context, qualifiedKind schema.GroupKind, errs field.ErrorList) { logger := klog.FromContext(ctx) diff --git a/vendor/k8s.io/apiserver/pkg/server/config.go b/vendor/k8s.io/apiserver/pkg/server/config.go index d10415b945..f197b55cd1 100644 --- a/vendor/k8s.io/apiserver/pkg/server/config.go +++ b/vendor/k8s.io/apiserver/pkg/server/config.go @@ -19,6 +19,7 @@ package server import ( "context" "crypto/sha256" + "crypto/tls" "encoding/base32" "fmt" "net" @@ -365,6 +366,13 @@ type SecureServingInfo struct { // Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). CipherSuites []uint16 + // CurvePreferences optionally specifies the set of allowed key exchange mechanisms for the server. + // The order of the list is ignored, and key exchange mechanisms + // are chosen by Go from this list using an internal preference order. + // If empty, the default Go curves will be used. + // Values are from the Go crypto/tls CurveID constants (https://golang.org/pkg/crypto/tls/#CurveID). + CurvePreferences []tls.CurveID + // HTTP2MaxStreamsPerConnection is the limit that the api server imposes on each client. // A value of zero means to use the default provided by golang's HTTP/2 support. HTTP2MaxStreamsPerConnection int @@ -573,6 +581,18 @@ func (c *Config) AddHealthChecks(healthChecks ...healthz.HealthChecker) { c.ReadyzChecks = append(c.ReadyzChecks, healthChecks...) } +// AddHealthzChecks adds the provided health checks to our config to be exposed by the +// healthz endpoint of our configured apiserver. +func (c *Config) AddHealthzChecks(healthChecks ...healthz.HealthChecker) { + c.HealthzChecks = append(c.HealthzChecks, healthChecks...) +} + +// AddLivezChecks adds the provided health checks to our config to be exposed by the +// livez endpoint of our configured apiserver. +func (c *Config) AddLivezChecks(healthChecks ...healthz.HealthChecker) { + c.LivezChecks = append(c.LivezChecks, healthChecks...) +} + // AddReadyzChecks adds a health check to our config to be exposed by the readyz endpoint // of our configured apiserver. func (c *Config) AddReadyzChecks(healthChecks ...healthz.HealthChecker) { @@ -818,6 +838,7 @@ func (c completedConfig) New(name string, delegationTarget DelegationTarget) (*G UnprotectedDebugSocket: debugSocket, listedPathProvider: apiServerHandler, + Flagz: c.Flagz, minRequestTimeout: time.Duration(c.MinRequestTimeout) * time.Second, ShutdownTimeout: c.RequestTimeout, diff --git a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/configmap_cafile_content.go b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/configmap_cafile_content.go index dbe9e375f2..5af3dbe866 100644 --- a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/configmap_cafile_content.go +++ b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/configmap_cafile_content.go @@ -199,7 +199,7 @@ func (c *ConfigMapCAController) RunOnce(ctx context.Context) error { // Run starts the kube-apiserver and blocks until stopCh is closed. func (c *ConfigMapCAController) Run(ctx context.Context, workers int) { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) defer c.queue.ShutDown() klog.InfoS("Starting controller", "name", c.name) diff --git a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go index 0fcf82bd0d..2f21951349 100644 --- a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go +++ b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_cafile_content.go @@ -155,7 +155,7 @@ func (c *DynamicFileCAContent) RunOnce(ctx context.Context) error { // Run starts the controller and blocks until stopCh is closed. func (c *DynamicFileCAContent) Run(ctx context.Context, workers int) { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) defer c.queue.ShutDown() klog.InfoS("Starting controller", "name", c.name) diff --git a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go index e0dd0474b1..268fe70b0d 100644 --- a/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go +++ b/vendor/k8s.io/apiserver/pkg/server/dynamiccertificates/dynamic_serving_content.go @@ -129,7 +129,7 @@ func (c *DynamicCertKeyPairContent) RunOnce(ctx context.Context) error { // Run starts the controller and blocks until context is killed. func (c *DynamicCertKeyPairContent) Run(ctx context.Context, workers int) { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) defer c.queue.ShutDown() klog.InfoS("Starting controller", "name", c.name) diff --git a/vendor/k8s.io/apiserver/pkg/server/egressselector/egress_selector.go b/vendor/k8s.io/apiserver/pkg/server/egressselector/egress_selector.go index 27408fe158..b898ff3270 100644 --- a/vendor/k8s.io/apiserver/pkg/server/egressselector/egress_selector.go +++ b/vendor/k8s.io/apiserver/pkg/server/egressselector/egress_selector.go @@ -300,6 +300,7 @@ func getTLSConfig(t *apiserver.TLSConfig) (*tls.Config, error) { return &tls.Config{ Certificates: []tls.Certificate{clientCerts}, RootCAs: certPool, + ServerName: t.TLSServerName, }, nil } diff --git a/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/doc.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/doc.go index ab7a48c210..42d5fcef53 100644 --- a/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/doc.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1alpha1/doc.go @@ -18,5 +18,5 @@ limitations under the License. // +k8s:openapi-gen=true // +k8s:openapi-model-package=io.k8s.apiserver.pkg.server.flagz.api.v1alpha1 -// Package v1alpha1 contains API Schema definitions for the zpages v1alpha1 API group +// Package v1alpha1 contains API Schema definitions for the flagz v1alpha1 API group package v1alpha1 diff --git a/vendor/k8s.io/api/autoscaling/v2beta2/doc.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/doc.go similarity index 73% rename from vendor/k8s.io/api/autoscaling/v2beta2/doc.go rename to vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/doc.go index 5ea9edb68a..bc8cffc0a0 100644 --- a/vendor/k8s.io/api/autoscaling/v2beta2/doc.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2018 The Kubernetes Authors. +Copyright 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. @@ -15,9 +15,8 @@ limitations under the License. */ // +k8s:deepcopy-gen=package -// +k8s:protobuf-gen=package // +k8s:openapi-gen=true -// +k8s:prerelease-lifecycle-gen=true -// +k8s:openapi-model-package=io.k8s.api.autoscaling.v2beta2 +// +k8s:openapi-model-package=io.k8s.apiserver.pkg.server.flagz.api.v1beta1 -package v2beta2 +// Package v1beta1 contains API Schema definitions for the flagz v1beta1 API group +package v1beta1 diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/register.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/register.go similarity index 53% rename from vendor/k8s.io/api/autoscaling/v2beta1/register.go rename to vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/register.go index 12d697f013..f66acc7dd6 100644 --- a/vendor/k8s.io/api/autoscaling/v2beta1/register.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/register.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors. +Copyright 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. @@ -14,38 +14,33 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v2beta1 +package v1beta1 import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" ) -// GroupName is the group name use in this package -const GroupName = "autoscaling" +const ( + GroupName = "config.k8s.io" + Version = "v1beta1" +) // SchemeGroupVersion is group version used to register these objects -var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v2beta1"} - -// Resource takes an unqualified resource and returns a Group qualified GroupResource -func Resource(resource string) schema.GroupResource { - return SchemeGroupVersion.WithResource(resource).GroupResource() -} +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} var ( - // TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api. - // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. - SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) - localSchemeBuilder = &SchemeBuilder - AddToScheme = localSchemeBuilder.AddToScheme + // SchemeBuilder initializes a scheme builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a global function that adds this group's types to a scheme + AddToScheme = SchemeBuilder.AddToScheme ) -// Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &HorizontalPodAutoscaler{}, - &HorizontalPodAutoscalerList{}, + &Flagz{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/types.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/types.go similarity index 52% rename from vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/types.go rename to vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/types.go index a49a6a813e..403436fdcf 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/types.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/types.go @@ -1,5 +1,5 @@ /* -Copyright 2017 The Kubernetes Authors. +Copyright 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. @@ -14,16 +14,24 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1alpha1 +package v1beta1 -import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object - -// WebhookAdmission provides configuration for the webhook admission controller. -type WebhookAdmission struct { +// Flagz is the structured response for the /flagz endpoint. +type Flagz struct { + // TypeMeta is the type metadata for the object. metav1.TypeMeta `json:",inline"` - - // KubeConfigFile is the path to the kubeconfig file. - KubeConfigFile string `json:"kubeConfigFile"` + // Standard object's metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + + // Flags contains the command-line flags and their values. + // The keys are the flag names and the values are the flag values, + // possibly with confidential values redacted. + // +optional + Flags map[string]string `json:"flags,omitempty"` } diff --git a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.deepcopy.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/zz_generated.deepcopy.go similarity index 75% rename from vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.deepcopy.go rename to vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/zz_generated.deepcopy.go index f997f4abaf..1d5e52605c 100644 --- a/vendor/k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/zz_generated.deepcopy.go @@ -19,31 +19,39 @@ limitations under the License. // Code generated by deepcopy-gen. DO NOT EDIT. -package v1alpha1 +package v1beta1 import ( runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WebhookAdmission) DeepCopyInto(out *WebhookAdmission) { +func (in *Flagz) DeepCopyInto(out *Flagz) { *out = *in out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + if in.Flags != nil { + in, out := &in.Flags, &out.Flags + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WebhookAdmission. -func (in *WebhookAdmission) DeepCopy() *WebhookAdmission { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Flagz. +func (in *Flagz) DeepCopy() *Flagz { if in == nil { return nil } - out := new(WebhookAdmission) + out := new(Flagz) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *WebhookAdmission) DeepCopyObject() runtime.Object { +func (in *Flagz) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } diff --git a/vendor/k8s.io/api/events/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/zz_generated.model_name.go similarity index 67% rename from vendor/k8s.io/api/events/v1beta1/generated.protomessage.pb.go rename to vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/zz_generated.model_name.go index a70924a20d..d475a0aa64 100644 --- a/vendor/k8s.io/api/events/v1beta1/generated.protomessage.pb.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/api/v1beta1/zz_generated.model_name.go @@ -1,5 +1,5 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release +//go:build !ignore_autogenerated +// +build !ignore_autogenerated /* Copyright The Kubernetes Authors. @@ -17,12 +17,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by go-to-protobuf. DO NOT EDIT. +// Code generated by openapi-gen. DO NOT EDIT. package v1beta1 -func (*Event) ProtoMessage() {} - -func (*EventList) ProtoMessage() {} - -func (*EventSeries) ProtoMessage() {} +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Flagz) OpenAPIModelName() string { + return "io.k8s.apiserver.pkg.server.flagz.api.v1beta1.Flagz" +} diff --git a/vendor/k8s.io/apiserver/pkg/server/flagz/flagz.go b/vendor/k8s.io/apiserver/pkg/server/flagz/flagz.go index de5dfe79fe..cb6df7b5d6 100644 --- a/vendor/k8s.io/apiserver/pkg/server/flagz/flagz.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/flagz.go @@ -20,25 +20,44 @@ import ( "fmt" "net/http" "strings" + "time" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apimachinery/pkg/runtime/serializer/cbor" utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apiserver/pkg/endpoints/handlers/negotiation" "k8s.io/apiserver/pkg/endpoints/handlers/responsewriters" - v1alpha1 "k8s.io/apiserver/pkg/server/flagz/api/v1alpha1" + "k8s.io/apiserver/pkg/endpoints/metrics" + "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/endpoints/responsewriter" + "k8s.io/apiserver/pkg/features" + "k8s.io/apiserver/pkg/server/flagz/api/v1alpha1" + "k8s.io/apiserver/pkg/server/flagz/api/v1beta1" "k8s.io/apiserver/pkg/server/flagz/negotiate" + utilfeature "k8s.io/apiserver/pkg/util/feature" ) -const ( - DefaultFlagzPath = "/flagz" - Kind = "Flagz" - GroupName = "config.k8s.io" - Version = "v1alpha1" +var ( + v1alpha1FlagzKind = v1alpha1.SchemeGroupVersion.WithKind("Flagz") + v1beta1FlagzKind = v1beta1.SchemeGroupVersion.WithKind("Flagz") + recognizedStructuredKinds = map[schema.GroupVersionKind]bool{ + v1alpha1FlagzKind: true, + v1beta1FlagzKind: true, + } ) +const DefaultFlagzPath = "/flagz" + +// flagzCodecFactory wraps a CodecFactory to filter out unsupported media types (like protobuf) +// from the supported media types list, so error messages only show actually supported types. +type flagzCodecFactory struct { + serializer.CodecFactory + supportedMediaTypes []runtime.SerializerInfo +} + type mux interface { Handle(path string, handler http.Handler) } @@ -47,7 +66,7 @@ type mux interface { func Install(m mux, componentName string, flagReader Reader, opts ...Option) { reg := ®istry{ reader: flagReader, - deprecatedVersionsMap: map[string]bool{}, + deprecatedVersionsMap: map[string]bool{"v1alpha1": true}, } for _, opt := range opts { opt(reg) @@ -55,10 +74,23 @@ func Install(m mux, componentName string, flagReader Reader, opts ...Option) { scheme := runtime.NewScheme() utilruntime.Must(v1alpha1.AddToScheme(scheme)) - codecFactory := serializer.NewCodecFactory( - scheme, + utilruntime.Must(v1beta1.AddToScheme(scheme)) + filteredCodecFactory, err := newFlagzCodecFactory(scheme, componentName, reg.reader) + if err != nil { + utilruntime.HandleError(err) + } + restrictions := negotiate.FlagzEndpointRestrictions{ + RecognizedStructuredKinds: recognizedStructuredKinds, + } + m.Handle(DefaultFlagzPath, handleFlagz(componentName, reg, filteredCodecFactory, restrictions)) +} + +// newFlagzCodecFactory creates a codec factory with the standard serializers for flagz, +// filtering out unsupported media types (e.g., protobuf). +func newFlagzCodecFactory(scheme *runtime.Scheme, componentName string, flagReader Reader) (*flagzCodecFactory, error) { + codecFactoryOpts := []serializer.CodecFactoryOptionsMutator{ serializer.WithSerializer(func(_ runtime.ObjectCreater, _ runtime.ObjectTyper) runtime.SerializerInfo { - textSerializer := flagzTextSerializer{componentName, reg.reader} + textSerializer := flagzTextSerializer{componentName, flagReader} return runtime.SerializerInfo{ MediaType: "text/plain", MediaTypeType: "text", @@ -68,16 +100,75 @@ func Install(m mux, componentName string, flagReader Reader, opts ...Option) { PrettySerializer: textSerializer, } }), - ) - m.Handle(DefaultFlagzPath, handleFlagz(componentName, reg, codecFactory, negotiate.FlagzEndpointRestrictions{})) + } + // TODO: remove this explicit check when https://github.com/kubernetes/enhancements/pull/5740 is implemented. + if utilfeature.DefaultFeatureGate.Enabled(features.CBORServingAndStorage) { + codecFactoryOpts = append(codecFactoryOpts, serializer.WithSerializer(cbor.NewSerializerInfo)) + } + + codecFactory := serializer.NewCodecFactory(scheme, codecFactoryOpts...) + allTypes := codecFactory.SupportedMediaTypes() + filtered := make([]runtime.SerializerInfo, 0, len(allTypes)) + + var unknownTypes []string + for _, info := range allTypes { + switch info.MediaType { + // Supported media types + case "text/plain", runtime.ContentTypeJSON, runtime.ContentTypeYAML, runtime.ContentTypeCBOR: + filtered = append(filtered, info) + // Unsupported media types + case runtime.ContentTypeProtobuf: + continue + default: + unknownTypes = append(unknownTypes, info.MediaType) + } + } + + var err error + if len(unknownTypes) > 0 { + err = fmt.Errorf("flagz: unknown media type(s) %v, excluding from supported types", unknownTypes) + } + + return &flagzCodecFactory{ + CodecFactory: codecFactory, + supportedMediaTypes: filtered, + }, err +} + +func (f *flagzCodecFactory) SupportedMediaTypes() []runtime.SerializerInfo { + return f.supportedMediaTypes } func handleFlagz(componentName string, reg *registry, serializer runtime.NegotiatedSerializer, restrictions negotiate.FlagzEndpointRestrictions) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - obj := flagz(componentName, reg.reader) + requestReceivedTimestamp, ok := request.ReceivedTimestampFrom(r.Context()) + if !ok { + requestReceivedTimestamp = time.Now() + } + delegate := &metrics.ResponseWriterDelegator{ResponseWriter: w} + w = responsewriter.WrapForHTTP1Or2(delegate) + + // Use MonitorRequest instead of InstrumentHandlerFunc because the group, + // version, and deprecated status depend on per-request content negotiation. + // For text/plain requests, group and version remain empty. For structured + // responses (JSON/YAML/CBOR), they are set to the negotiated API group and + // version (e.g., config.k8s.io/v1alpha1). + var group, version string + var deprecated bool + defer func() { + metrics.MonitorRequest(r, "GET", group, version, + "flagz", // resource + "", // subresource + "", // scope + componentName, // component + deprecated, + "", // removedRelease + delegate.Status(), delegate.ContentLength(), time.Since(requestReceivedTimestamp)) + }() + acceptHeader := r.Header.Get("Accept") if strings.TrimSpace(acceptHeader) == "" { - writePlainTextResponse(obj, serializer, w, reg) + writePlainTextResponse(v1beta1Flagz(componentName, reg.reader), serializer, w, reg) return } @@ -94,11 +185,10 @@ func handleFlagz(componentName string, reg *registry, serializer runtime.Negotia return } - var targetGV schema.GroupVersion switch serializerInfo.MediaType { - case "application/json": + case "application/json", "application/yaml", "application/cbor": if mediaType.Convert == nil { - err := fmt.Errorf("content negotiation failed: mediaType.Convert is nil for application/json") + err := fmt.Errorf("content negotiation failed: mediaType.Convert is nil for %s", serializerInfo.MediaType) utilruntime.HandleError(err) responsewriters.ErrorNegotiated( err, @@ -109,15 +199,17 @@ func handleFlagz(componentName string, reg *registry, serializer runtime.Negotia ) return } - targetGV = mediaType.Convert.GroupVersion() - if reg.deprecatedVersions()[targetGV.Version] { + group = mediaType.Convert.Group + version = mediaType.Convert.Version + deprecated = reg.deprecatedVersions()[version] + if deprecated { w.Header().Set("Warning", `299 - "This version of the flagz endpoint is deprecated. Please use a newer version."`) } + handleStructuredResponse(w, r, componentName, reg, serializer, restrictions, mediaType) case "text/plain": - writePlainTextResponse(obj, serializer, w, reg) - return + writePlainTextResponse(v1beta1Flagz(componentName, reg.reader), serializer, w, reg) default: - err = fmt.Errorf("content negotiation failed: unsupported media type '%s'", serializerInfo.MediaType) + err := fmt.Errorf("unsupported media type: %s/%s", serializerInfo.MediaType, serializerInfo.MediaTypeSubType) utilruntime.HandleError(err) responsewriters.ErrorNegotiated( err, @@ -126,10 +218,7 @@ func handleFlagz(componentName string, reg *registry, serializer runtime.Negotia w, r, ) - return } - - writeResponse(obj, serializer, targetGV, restrictions, w, r) } } @@ -170,7 +259,7 @@ func writePlainTextResponse(obj runtime.Object, serializer runtime.NegotiatedSer } } -func writeResponse(obj runtime.Object, serializer runtime.NegotiatedSerializer, targetGV schema.GroupVersion, restrictions negotiate.FlagzEndpointRestrictions, w http.ResponseWriter, r *http.Request) { +func writeStructuredResponse(obj runtime.Object, serializer runtime.NegotiatedSerializer, targetGV schema.GroupVersion, restrictions negotiate.FlagzEndpointRestrictions, w http.ResponseWriter, r *http.Request) { responsewriters.WriteObjectNegotiated( serializer, restrictions, @@ -183,12 +272,45 @@ func writeResponse(obj runtime.Object, serializer runtime.NegotiatedSerializer, ) } -func flagz(componentName string, flagReader Reader) *v1alpha1.Flagz { +func handleStructuredResponse(w http.ResponseWriter, r *http.Request, componentName string, reg *registry, serializer runtime.NegotiatedSerializer, restrictions negotiate.FlagzEndpointRestrictions, mediaType negotiation.MediaTypeOptions) { + switch *mediaType.Convert { + case v1alpha1FlagzKind: + writeStructuredResponse(v1alpha1Flagz(componentName, reg.reader), serializer, v1alpha1FlagzKind.GroupVersion(), restrictions, w, r) + case v1beta1FlagzKind: + writeStructuredResponse(v1beta1Flagz(componentName, reg.reader), serializer, v1beta1FlagzKind.GroupVersion(), restrictions, w, r) + default: + err := fmt.Errorf("unsupported media type: %s", mediaType.Convert.String()) + utilruntime.HandleError(err) + responsewriters.ErrorNegotiated( + err, + serializer, + schema.GroupVersion{}, + w, + r, + ) + } +} + +func v1alpha1Flagz(componentName string, flagReader Reader) *v1alpha1.Flagz { flags := flagReader.GetFlagz() return &v1alpha1.Flagz{ TypeMeta: metav1.TypeMeta{ - Kind: Kind, - APIVersion: fmt.Sprintf("%s/%s", GroupName, Version), + Kind: v1alpha1FlagzKind.Kind, + APIVersion: v1alpha1FlagzKind.GroupVersion().String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: componentName, + }, + Flags: flags, + } +} + +func v1beta1Flagz(componentName string, flagReader Reader) *v1beta1.Flagz { + flags := flagReader.GetFlagz() + return &v1beta1.Flagz{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1FlagzKind.Kind, + APIVersion: v1beta1FlagzKind.GroupVersion().String(), }, ObjectMeta: metav1.ObjectMeta{ Name: componentName, diff --git a/vendor/k8s.io/apiserver/pkg/server/flagz/negotiate/negotiation.go b/vendor/k8s.io/apiserver/pkg/server/flagz/negotiate/negotiation.go index f3edc8f3c1..ec2d28e67c 100644 --- a/vendor/k8s.io/apiserver/pkg/server/flagz/negotiate/negotiation.go +++ b/vendor/k8s.io/apiserver/pkg/server/flagz/negotiate/negotiation.go @@ -20,16 +20,21 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" ) -// FlagzEndpointRestrictions implements content negotiation restrictions for the z-pages. +// FlagzEndpointRestrictions implements content negotiation restrictions for the flagz endpoint. // It is used to validate and restrict which GroupVersionKinds are allowed for structured responses. -type FlagzEndpointRestrictions struct{} +type FlagzEndpointRestrictions struct { + RecognizedStructuredKinds map[schema.GroupVersionKind]bool +} -// AllowsMediaTypeTransform checks if the provided GVK is supported for structured z-page responses. -func (FlagzEndpointRestrictions) AllowsMediaTypeTransform(mimeType string, mimeSubType string, gvk *schema.GroupVersionKind) bool { +// AllowsMediaTypeTransform checks if the provided GVK is supported for structured flagz responses. +func (f FlagzEndpointRestrictions) AllowsMediaTypeTransform(mimeType string, mimeSubType string, gvk *schema.GroupVersionKind) bool { if mimeType == "text" && mimeSubType == "plain" { return gvk == nil } - return isStructured(gvk) + if gvk != nil { + return f.RecognizedStructuredKinds[*gvk] + } + return false } func (FlagzEndpointRestrictions) AllowsServerVersion(string) bool { @@ -39,15 +44,3 @@ func (FlagzEndpointRestrictions) AllowsServerVersion(string) bool { func (FlagzEndpointRestrictions) AllowsStreamSchema(s string) bool { return false } - -func isStructured(gvk *schema.GroupVersionKind) bool { - if gvk != nil { - if gvk.Group == "config.k8s.io" && gvk.Version == "v1alpha1" { - if gvk.Kind == "Flagz" { - return true - } - } - } - - return false -} diff --git a/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go b/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go index 99017eb5e6..715501f67c 100644 --- a/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go +++ b/vendor/k8s.io/apiserver/pkg/server/genericapiserver.go @@ -49,6 +49,7 @@ import ( discoveryendpoint "k8s.io/apiserver/pkg/endpoints/discovery/aggregated" "k8s.io/apiserver/pkg/features" "k8s.io/apiserver/pkg/registry/rest" + "k8s.io/apiserver/pkg/server/flagz" "k8s.io/apiserver/pkg/server/healthz" "k8s.io/apiserver/pkg/server/routes" "k8s.io/apiserver/pkg/server/statusz" @@ -113,6 +114,9 @@ type GenericAPIServer struct { // LoopbackClientConfig is a config for a privileged loopback connection to the API server LoopbackClientConfig *restclient.Config + // Flagz is used to set up flagz endpoint. + Flagz flagz.Reader + // minRequestTimeout is how short the request timeout can be. This is used to build the RESTHandler minRequestTimeout time.Duration @@ -463,8 +467,15 @@ func (s *GenericAPIServer) PrepareRun() preparedGenericAPIServer { } s.installReadyz() + componentName := "apiserver" + if utilfeature.DefaultFeatureGate.Enabled(zpagesfeatures.ComponentFlagz) { + if s.Flagz != nil { + flagz.Install(s.Handler.NonGoRestfulMux, componentName, s.Flagz) + } + } + // statusz is installed last so that it can list all the paths that have been registered if utilfeature.DefaultFeatureGate.Enabled(zpagesfeatures.ComponentStatusz) { - statusz.Install(s.Handler.NonGoRestfulMux, "apiserver", statusz.NewRegistry(s.EffectiveVersion, statusz.WithListedPaths(s.ListedPaths()))) + statusz.Install(s.Handler.NonGoRestfulMux, componentName, statusz.NewRegistry(s.EffectiveVersion, statusz.WithListedPaths(s.ListedPaths()))) } return preparedGenericAPIServer{s} @@ -533,7 +544,7 @@ func (s preparedGenericAPIServer) RunWithContext(ctx context.Context) error { // If UDS profiling is enabled, start a local http server listening on that socket if s.UnprotectedDebugSocket != nil { go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) klog.Error(s.UnprotectedDebugSocket.RunWithContext(ctx)) }() } diff --git a/vendor/k8s.io/apiserver/pkg/server/hooks.go b/vendor/k8s.io/apiserver/pkg/server/hooks.go index 150b40b475..3a828061e8 100644 --- a/vendor/k8s.io/apiserver/pkg/server/hooks.go +++ b/vendor/k8s.io/apiserver/pkg/server/hooks.go @@ -195,8 +195,7 @@ func (s *GenericAPIServer) isPostStartHookRegistered(name string) bool { func runPostStartHook(name string, entry postStartHookEntry, context PostStartHookContext) { var err error func() { - // don't let the hook *accidentally* panic and kill the server - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(context) err = entry.hook(context) }() // if the hook intentionally wants to kill server, let it. diff --git a/vendor/k8s.io/apiserver/pkg/server/options/admission.go b/vendor/k8s.io/apiserver/pkg/server/options/admission.go index 2a7ddf4d8e..2a8c8fd9c3 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/admission.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/admission.go @@ -157,7 +157,7 @@ func (a *AdmissionOptions) ApplyTo( discoveryRESTMapper := restmapper.NewDeferredDiscoveryRESTMapper(discoveryClient) genericInitializer := initializer.New(kubeClient, dynamicClient, informers, c.Authorization.Authorizer, features, effectiveVersion, c.DrainedNotify(), discoveryRESTMapper) - initializersChain := admission.PluginInitializers{genericInitializer} + initializersChain := admission.PluginInitializers{initializer.NewAPIServerIDInitializer(c.APIServerID), genericInitializer} initializersChain = append(initializersChain, pluginInitializers...) admissionPostStartHook := func(hookContext server.PostStartHookContext) error { diff --git a/vendor/k8s.io/apiserver/pkg/server/options/api_enablement.go b/vendor/k8s.io/apiserver/pkg/server/options/api_enablement.go index 81e4899f08..6698c73a2d 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/api_enablement.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/api_enablement.go @@ -22,6 +22,7 @@ import ( "github.com/spf13/pflag" + "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apiserver/pkg/server" "k8s.io/apiserver/pkg/server/resourceconfig" serverstore "k8s.io/apiserver/pkg/server/storage" @@ -70,20 +71,22 @@ func (s *APIEnablementOptions) Validate(registries ...GroupRegistry) []error { errors := []error{} if s.RuntimeConfig[resourceconfig.APIAll] == "false" && len(s.RuntimeConfig) == 1 { // Do not allow only set api/all=false, in such case apiserver startup has no meaning. - return append(errors, fmt.Errorf("invalid key with only %v=false", resourceconfig.APIAll)) + return append(errors, fmt.Errorf("invalid runtime-config with only %v=false", resourceconfig.APIAll)) } - groups, err := resourceconfig.ParseGroups(s.RuntimeConfig) + groupVersions, err := resourceconfig.ParseGroupVersions(s.RuntimeConfig) if err != nil { return append(errors, err) } - for _, registry := range registries { - // filter out known groups - groups = unknownGroups(groups, registry) + unknownGroupVersions := sets.New[string]() + for _, groupVersion := range groupVersions { + if !isGroupRegistered(groupVersion.Group, registries) { + unknownGroupVersions.Insert(groupVersion.String()) + } } - if len(groups) != 0 { - errors = append(errors, fmt.Errorf("unknown api groups %s", strings.Join(groups, ","))) + if len(unknownGroupVersions) != 0 { + errors = append(errors, fmt.Errorf("unknown api groups %s", strings.Join(sets.List(unknownGroupVersions), ","))) } return errors @@ -129,18 +132,17 @@ func (s *APIEnablementOptions) ApplyTo(c *server.Config, defaultResourceConfig * return err } -func unknownGroups(groups []string, registry GroupRegistry) []string { - unknownGroups := []string{} - for _, group := range groups { - if !registry.IsGroupRegistered(group) { - unknownGroups = append(unknownGroups, group) - } - } - return unknownGroups -} - // GroupRegistry provides a method to check whether given group is registered. type GroupRegistry interface { - // IsRegistered returns true if given group is registered. + // IsGroupRegistered returns true if given group is registered. IsGroupRegistered(group string) bool } + +func isGroupRegistered(group string, registries []GroupRegistry) bool { + for _, registry := range registries { + if registry.IsGroupRegistered(group) { + return true + } + } + return false +} diff --git a/vendor/k8s.io/apiserver/pkg/server/options/audit.go b/vendor/k8s.io/apiserver/pkg/server/options/audit.go index af5b06a5bd..74e2e71971 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/audit.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/audit.go @@ -154,6 +154,10 @@ func NewAuditOptions() *AuditOptions { GroupVersionString: "audit.k8s.io/v1", }, LogOptions: AuditLogOptions{ + MaxSize: 100, + MaxAge: 366, + MaxBackups: 100, + Format: pluginlog.FormatJson, BatchOptions: AuditBatchOptions{ Mode: ModeBlocking, @@ -436,11 +440,11 @@ func (o *AuditLogOptions) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&o.Path, "audit-log-path", o.Path, "If set, all requests coming to the apiserver will be logged to this file. '-' means standard out.") fs.IntVar(&o.MaxAge, "audit-log-maxage", o.MaxAge, - "The maximum number of days to retain old audit log files based on the timestamp encoded in their filename.") + "The maximum number of days to retain old audit log files based on the timestamp encoded in their filename. Setting a value of 0 means old audit log files are not removed based on age.") fs.IntVar(&o.MaxBackups, "audit-log-maxbackup", o.MaxBackups, "The maximum number of old audit log files to retain. Setting a value of 0 will mean there's no restriction on the number of files.") fs.IntVar(&o.MaxSize, "audit-log-maxsize", o.MaxSize, - "The maximum size in megabytes of the audit log file before it gets rotated.") + "The maximum size in megabytes of the audit log file before it gets rotated. Setting to 0 disables rotation (not recommended).") fs.StringVar(&o.Format, "audit-log-format", o.Format, "Format of saved audits. \"legacy\" indicates 1-line text format for each event."+ " \"json\" indicates structured json format. Known formats are "+ @@ -506,6 +510,10 @@ func (o *AuditLogOptions) getWriter() (io.Writer, error) { return nil, fmt.Errorf("ensureLogFile: %w", err) } + if o.MaxSize == 0 { + return os.OpenFile(o.Path, os.O_APPEND|os.O_WRONLY, 0644) + } + return &lumberjack.Logger{ Filename: o.Path, MaxAge: o.MaxAge, diff --git a/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go b/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go index e340c9d2ce..2d481bc6f7 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/config.go @@ -282,8 +282,6 @@ func getTransformerOverridesAndKMSPluginProbes(ctx context.Context, config *apis // For each entry in the configuration for _, resourceConfig := range config.Resources { - resourceConfig := resourceConfig - transformers, p, used, err := prefixTransformersAndProbes(ctx, resourceConfig, apiServerID) if err != nil { return nil, nil, nil, err @@ -292,7 +290,6 @@ func getTransformerOverridesAndKMSPluginProbes(ctx context.Context, config *apis // For each resource, create a list of providers to use for _, resource := range resourceConfig.Resources { - resource := resource gr := schema.ParseGroupResource(resource) // check if resource is masked by *.group rule @@ -317,8 +314,6 @@ func getTransformerOverridesAndKMSPluginProbes(ctx context.Context, config *apis transformers := make(map[schema.GroupResource]storagevalue.Transformer, len(resourceToPrefixTransformer)) for gr, transList := range resourceToPrefixTransformer { - gr := gr - transList := transList transformers[gr] = storagevalue.NewPrefixTransformers(fmt.Errorf("no matching prefix found"), transList...) } @@ -567,7 +562,6 @@ func prefixTransformersAndProbes(ctx context.Context, config apiserver.ResourceC var kmsUsed kmsState for _, provider := range config.Providers { - provider := provider var ( transformer storagevalue.PrefixTransformer transformerErr error @@ -624,7 +618,6 @@ func aesPrefixTransformer(config *apiserver.AESConfiguration, fn blockTransforme return result, fmt.Errorf("aes provider has no valid keys") } for _, key := range config.Keys { - key := key if key.Name == "" { return result, fmt.Errorf("key with invalid name provided") } @@ -636,7 +629,6 @@ func aesPrefixTransformer(config *apiserver.AESConfiguration, fn blockTransforme keyTransformers := []storagevalue.PrefixTransformer{} for _, keyData := range config.Keys { - keyData := keyData key, err := base64.StdEncoding.DecodeString(keyData.Secret) if err != nil { return result, fmt.Errorf("could not obtain secret for named key %s: %w", keyData.Name, err) @@ -677,7 +669,6 @@ func secretboxPrefixTransformer(config *apiserver.SecretboxConfiguration) (stora return result, fmt.Errorf("secretbox provider has no valid keys") } for _, key := range config.Keys { - key := key if key.Name == "" { return result, fmt.Errorf("key with invalid name provided") } @@ -689,7 +680,6 @@ func secretboxPrefixTransformer(config *apiserver.SecretboxConfiguration) (stora keyTransformers := []storagevalue.PrefixTransformer{} for _, keyData := range config.Keys { - keyData := keyData key, err := base64.StdEncoding.DecodeString(keyData.Secret) if err != nil { return result, fmt.Errorf("could not obtain secret for named key %s: %s", keyData.Name, err) diff --git a/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/controller/controller.go b/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/controller/controller.go index 5c249bcc08..9314d6d125 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/controller/controller.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/encryptionconfig/controller/controller.go @@ -92,7 +92,7 @@ func NewDynamicEncryptionConfiguration( // Run starts the controller and blocks until ctx is canceled. func (d *DynamicEncryptionConfigContent) Run(ctx context.Context) { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) klog.InfoS("Starting controller", "name", d.name) defer klog.InfoS("Shutting down controller", "name", d.name) @@ -101,7 +101,7 @@ func (d *DynamicEncryptionConfigContent) Run(ctx context.Context) { wg.Add(1) go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) defer wg.Done() defer d.queue.ShutDown() <-ctx.Done() @@ -109,7 +109,7 @@ func (d *DynamicEncryptionConfigContent) Run(ctx context.Context) { wg.Add(1) go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) defer wg.Done() d.runWorker(ctx) }() diff --git a/vendor/k8s.io/apiserver/pkg/server/options/recommended.go b/vendor/k8s.io/apiserver/pkg/server/options/recommended.go index a80c3f9ed4..9721797787 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/recommended.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/recommended.go @@ -105,7 +105,7 @@ func (o *RecommendedOptions) ApplyTo(config *server.RecommendedConfig) error { if err := o.Traces.ApplyTo(config.Config.EgressSelector, &config.Config); err != nil { return err } - if err := o.SecureServing.ApplyTo(&config.Config.SecureServing, &config.Config.LoopbackClientConfig); err != nil { + if err := o.SecureServing.ApplyToConfig(&config.Config); err != nil { return err } if err := o.Authentication.ApplyTo(&config.Config.Authentication, config.SecureServing, config.OpenAPIConfig); err != nil { diff --git a/vendor/k8s.io/apiserver/pkg/server/options/serving.go b/vendor/k8s.io/apiserver/pkg/server/options/serving.go index 21a2736e10..fbcb072470 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/serving.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/serving.go @@ -64,6 +64,14 @@ type SecureServingOptions struct { // CipherSuites is the list of allowed cipher suites for the server. // Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). CipherSuites []string + // CurvePreferences is the set of allowed key exchange mechanisms for the server, + // specified as numeric Go crypto/tls CurveID values. + // The supported values depend on the Go version used. + // See https://pkg.go.dev/crypto/tls#CurveID for values supported for each Go version. + // The order of the list is ignored, and key exchange mechanisms are + // chosen by Go from this list using an internal preference order. + // If empty, the default Go curves will be used. + CurvePreferences []int32 // MinTLSVersion is the minimum TLS version supported. // Values are from tls package constants (https://golang.org/pkg/crypto/tls/#pkg-constants). MinTLSVersion string @@ -189,6 +197,15 @@ func (s *SecureServingOptions) AddFlags(fs *pflag.FlagSet) { "Preferred values: "+strings.Join(tlsCipherPreferredValues, ", ")+". \n"+ "Insecure values: "+strings.Join(tlsCipherInsecureValues, ", ")+".") + fs.Int32SliceVar(&s.CurvePreferences, "tls-curve-preferences", s.CurvePreferences, + "Comma-separated list of numeric Go crypto/tls CurveID values, "+ + "as the allowed key exchange mechanisms for the server. "+ + "The supported values depend on the Go version used. "+ + "See https://pkg.go.dev/crypto/tls#CurveID for values supported for each Go version. "+ + "The order of the list is ignored, and key exchange mechanisms are chosen "+ + "by Go from this list using an internal preference order. "+ + "If omitted, the default Go curves will be used.") + tlsPossibleVersions := cliflag.TLSPossibleVersions() fs.StringVar(&s.MinTLSVersion, "tls-min-version", s.MinTLSVersion, "Minimum TLS version supported. "+ @@ -317,6 +334,14 @@ func (s *SecureServingOptions) ApplyTo(config **server.SecureServingInfo) error c.CipherSuites = cipherSuites } + if len(s.CurvePreferences) != 0 { + curvePreferences, err := cliflag.TLSCurvePreferences(s.CurvePreferences) + if err != nil { + return err + } + c.CurvePreferences = curvePreferences + } + var err error c.MinTLSVersion, err = cliflag.TLSVersion(s.MinTLSVersion) if err != nil { diff --git a/vendor/k8s.io/apiserver/pkg/server/options/serving_unix.go b/vendor/k8s.io/apiserver/pkg/server/options/serving_unix.go index 483eac79b2..6f484ac376 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/serving_unix.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/serving_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2020 The Kubernetes Authors. diff --git a/vendor/k8s.io/apiserver/pkg/server/options/serving_windows.go b/vendor/k8s.io/apiserver/pkg/server/options/serving_windows.go index 844de61883..f8fb141098 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/serving_windows.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/serving_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows /* Copyright 2020 The Kubernetes Authors. diff --git a/vendor/k8s.io/apiserver/pkg/server/options/serving_with_loopback.go b/vendor/k8s.io/apiserver/pkg/server/options/serving_with_loopback.go index 980ddc61a4..2dea7d2db1 100644 --- a/vendor/k8s.io/apiserver/pkg/server/options/serving_with_loopback.go +++ b/vendor/k8s.io/apiserver/pkg/server/options/serving_with_loopback.go @@ -18,26 +18,48 @@ package options import ( "fmt" + "net/http" "time" "github.com/google/uuid" "k8s.io/apiserver/pkg/server" "k8s.io/apiserver/pkg/server/dynamiccertificates" + "k8s.io/apiserver/pkg/server/healthz" "k8s.io/client-go/rest" certutil "k8s.io/client-go/util/cert" + "k8s.io/utils/clock" ) type SecureServingOptionsWithLoopback struct { *SecureServingOptions + clock clock.PassiveClock } func (o *SecureServingOptions) WithLoopback() *SecureServingOptionsWithLoopback { - return &SecureServingOptionsWithLoopback{o} + return &SecureServingOptionsWithLoopback{ + SecureServingOptions: o, + clock: clock.RealClock{}, + } } +// Set a validity period of approximately 3 years for the loopback certificate +// to avoid kube-apiserver disruptions due to certificate expiration. +// When this certificate expires, restarting kube-apiserver will automatically +// regenerate a new certificate with fresh validity dates. +const maxAge = (3*365 + 1) * 24 * time.Hour + // ApplyTo fills up serving information in the server configuration. func (s *SecureServingOptionsWithLoopback) ApplyTo(secureServingInfo **server.SecureServingInfo, loopbackClientConfig **rest.Config) error { + return s.applyTo(secureServingInfo, loopbackClientConfig, nil) +} + +type HealthzLivezHealthChecksAdder interface { + AddHealthzChecks(checks ...healthz.HealthChecker) + AddLivezChecks(checks ...healthz.HealthChecker) +} + +func (s *SecureServingOptionsWithLoopback) applyTo(secureServingInfo **server.SecureServingInfo, loopbackClientConfig **rest.Config, healthCheckAdder HealthzLivezHealthChecksAdder) error { if s == nil || s.SecureServingOptions == nil || secureServingInfo == nil { return nil } @@ -50,12 +72,6 @@ func (s *SecureServingOptionsWithLoopback) ApplyTo(secureServingInfo **server.Se return nil } - // Set a validity period of approximately 3 years for the loopback certificate - // to avoid kube-apiserver disruptions due to certificate expiration. - // When this certificate expires, restarting kube-apiserver will automatically - // regenerate a new certificate with fresh validity dates. - maxAge := (3*365 + 1) * 24 * time.Hour - // create self-signed cert+key with the fake server.LoopbackClientServerNameOverride and // let the server return it when the loopback client connects. certPem, keyPem, err := certutil.GenerateSelfSignedCertKeyWithOptions(certutil.SelfSignedCertKeyOptions{ @@ -85,7 +101,37 @@ func (s *SecureServingOptionsWithLoopback) ApplyTo(secureServingInfo **server.Se default: *loopbackClientConfig = secureLoopbackClientConfig + if healthCheckAdder != nil { + s.addLoopbackServingCertificateHealthCheck(healthCheckAdder) + } } return nil } + +func (s *SecureServingOptionsWithLoopback) ApplyToConfig(cfg *server.Config) error { + return s.applyTo(&cfg.SecureServing, &cfg.LoopbackClientConfig, cfg) +} + +// addLoopbackServingCertificateHealthCheck adds a health check called `loopback-certificate-expiry` to the +// server that fails when the loopback client certificate has expired, enabling +// liveness probes to be used to automatically restart the apiserver. +func (s *SecureServingOptionsWithLoopback) addLoopbackServingCertificateHealthCheck(healthCheckAdder HealthzLivezHealthChecksAdder) { + expirationDate := s.clock.Now().Add(maxAge) + check := healthz.NamedCheck("loopback-serving-certificate", func(r *http.Request) error { + if s.clock.Now().After(expirationDate) { + return LoopbackCertificateExpiredError{} + } + + return nil + }) + + healthCheckAdder.AddHealthzChecks(check) + healthCheckAdder.AddLivezChecks(check) +} + +type LoopbackCertificateExpiredError struct{} + +func (lcee LoopbackCertificateExpiredError) Error() string { + return "loopback serving certificate is expired" +} diff --git a/vendor/k8s.io/apiserver/pkg/server/resourceconfig/helpers.go b/vendor/k8s.io/apiserver/pkg/server/resourceconfig/helpers.go index c546112ec9..d99d8b8b2a 100644 --- a/vendor/k8s.io/apiserver/pkg/server/resourceconfig/helpers.go +++ b/vendor/k8s.io/apiserver/pkg/server/resourceconfig/helpers.go @@ -221,24 +221,37 @@ func getRuntimeConfigValue(overrides cliflag.ConfigurationMap, apiKey string, de // ParseGroups takes in resourceConfig and returns parsed groups. func ParseGroups(resourceConfig cliflag.ConfigurationMap) ([]string, error) { + groupVersions, err := ParseGroupVersions(resourceConfig) + if err != nil { + return nil, err + } groups := []string{} + for _, gv := range groupVersions { + groups = append(groups, gv.Group) + } + return groups, nil +} + +// ParseGroupVersions takes in resourceConfig and returns parsed group versions. +func ParseGroupVersions(resourceConfig cliflag.ConfigurationMap) ([]schema.GroupVersion, error) { + groupVersions := []schema.GroupVersion{} for key := range resourceConfig { if _, ok := groupVersionMatchers[key]; ok { continue } tokens := strings.Split(key, "/") if len(tokens) != 2 && len(tokens) != 3 { - return groups, fmt.Errorf("runtime-config invalid key %s", key) + return nil, fmt.Errorf("runtime-config invalid key %s", key) } groupVersionString := tokens[0] + "/" + tokens[1] groupVersion, err := schema.ParseGroupVersion(groupVersionString) if err != nil { return nil, fmt.Errorf("runtime-config invalid key %s", key) } - groups = append(groups, groupVersion.Group) + groupVersions = append(groupVersions, groupVersion) } - return groups, nil + return groupVersions, nil } // EmulationForwardCompatibleResourceConfig creates a new ResourceConfig that besides all the enabled resources in resourceConfig, diff --git a/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go b/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go index 8fd4d55999..644020049a 100644 --- a/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/server/routes/metrics.go @@ -24,6 +24,7 @@ import ( etcd3metrics "k8s.io/apiserver/pkg/storage/etcd3/metrics" flowcontrolmetrics "k8s.io/apiserver/pkg/util/flowcontrol/metrics" peerproxymetrics "k8s.io/apiserver/pkg/util/peerproxy/metrics" + proxymetrics "k8s.io/apiserver/pkg/util/proxy/metrics" "k8s.io/component-base/metrics/legacyregistry" ) @@ -54,4 +55,5 @@ func register() { flowcontrolmetrics.Register() peerproxymetrics.Register() handlersmetrics.Register() + proxymetrics.Register() } diff --git a/vendor/k8s.io/apiserver/pkg/server/routes/openapi.go b/vendor/k8s.io/apiserver/pkg/server/routes/openapi.go index 12c8b1ad91..ee830a2675 100644 --- a/vendor/k8s.io/apiserver/pkg/server/routes/openapi.go +++ b/vendor/k8s.io/apiserver/pkg/server/routes/openapi.go @@ -17,6 +17,8 @@ limitations under the License. package routes import ( + "strings" + restful "github.com/emicklei/go-restful/v3" "k8s.io/klog/v2" @@ -27,6 +29,7 @@ import ( "k8s.io/kube-openapi/pkg/common/restfuladapter" "k8s.io/kube-openapi/pkg/handler" "k8s.io/kube-openapi/pkg/handler3" + "k8s.io/kube-openapi/pkg/spec3" "k8s.io/kube-openapi/pkg/validation/spec" ) @@ -49,7 +52,9 @@ func (oa OpenAPI) InstallV2(c *restful.Container, mux *mux.PathRecorderMux) (*ha return openAPIVersionedService, spec } -// InstallV3 adds the static group/versions defined in the RegisteredWebServices to the OpenAPI v3 spec +// InstallV3 adds the static group/versions defined in the RegisteredWebServices to the OpenAPI v3 spec. +// This only covers built-in resources served via go-restful; CRDs and aggregated APIs publish +// their OpenAPI v3 specs through separate code paths. func (oa OpenAPI) InstallV3(c *restful.Container, mux *mux.PathRecorderMux) *handler3.OpenAPIService { openAPIVersionedService := handler3.NewOpenAPIService() err := openAPIVersionedService.RegisterOpenAPIV3VersionedService("/openapi/v3", mux) @@ -69,9 +74,111 @@ func (oa OpenAPI) InstallV3(c *restful.Container, mux *mux.PathRecorderMux) *han spec, err := builder3.BuildOpenAPISpecFromRoutes(restfuladapter.AdaptWebServices(ws), oa.V3Config) if err != nil { klog.Errorf("Failed to build OpenAPI v3 for group %s, %q", gv, err) - + continue + } + if group, version, ok := groupVersionFromPath(gv); ok { + filterScopedGVKs(spec, group, version) } openAPIVersionedService.UpdateGroupVersion(gv, spec) } return openAPIVersionedService } + +// groupVersionFromPath extracts the API group and version from a root path like "apis/apps/v1" or "api/v1". +func groupVersionFromPath(path string) (group, version string, ok bool) { + // "api/v1" → ("", "v1", true) + // "apis/apps/v1" → ("apps", "v1", true) + // "apis/networking.k8s.io/v1" → ("networking.k8s.io", "v1", true) + parts := strings.SplitN(path, "/", 4) + switch { + case len(parts) < 2: + return "", "", false + case parts[0] == "api" && len(parts) == 2: + return "", parts[1], true + case parts[0] == "apis" && len(parts) == 3: + return parts[1], parts[2], true + default: + return "", "", false + } +} + +// crossRegisteredKinds lists the kinds that AddToGroupVersion (in +// k8s.io/apimachinery/pkg/apis/meta/v1) registers into every API group. +// Only these types get their x-kubernetes-group-version-kind list filtered +// in per-GV v3 specs. +var crossRegisteredKinds = map[string]bool{ + "WatchEvent": true, + "DeleteOptions": true, +} + +// filterScopedGVKs narrows x-kubernetes-group-version-kind on the meta types +// that AddToGroupVersion cross-registers into every API group (WatchEvent and +// DeleteOptions). Without filtering, each per-GV v3 spec carries ~60 GVKs for +// these types. This filter keeps only the entry matching this spec's group/version +// plus the canonical core/v1 entry. +// +// Only the meta types listed in crossRegisteredKinds are filtered. Other types +// that are intentionally registered into specific groups (like autoscaling/v1 +// Scale into apps/v1 and core/v1) are left unchanged. +// +// This only affects built-in resource specs generated by InstallV3 above. +// CRDs and aggregated APIs are not affected as they publish specs through separate paths. +func filterScopedGVKs(s *spec3.OpenAPI, group, version string) { + if s == nil || s.Components == nil { + return + } + for _, schema := range s.Components.Schemas { + if schema == nil { + continue + } + ext, ok := schema.Extensions["x-kubernetes-group-version-kind"] + if !ok { + continue + } + gvks, ok := ext.([]interface{}) + if !ok || len(gvks) <= 1 { + continue + } + if !isCrossRegisteredKind(gvks) { + continue + } + var filtered []interface{} + for _, item := range gvks { + m, ok := item.(map[string]interface{}) + if !ok { + continue + } + g, ok := m["group"].(string) + if !ok { + continue + } + v, ok := m["version"].(string) + if !ok { + continue + } + if (g == group && v == version) || (g == "" && v == "v1") { + filtered = append(filtered, item) + } + } + if len(filtered) > 0 { + schema.Extensions["x-kubernetes-group-version-kind"] = filtered + } else { + klog.Warningf("Unexpected: filtering x-kubernetes-group-version-kind for %s/%s produced no matches", group, version) + delete(schema.Extensions, "x-kubernetes-group-version-kind") + } + } +} + +// isCrossRegisteredKind checks whether a GVK list represents one of the +// meta types from crossRegisteredKinds by inspecting the first entry's kind. +func isCrossRegisteredKind(gvks []interface{}) bool { + if len(gvks) == 0 { + return false + } + m, ok := gvks[0].(map[string]interface{}) + if !ok { + return false + } + kind, _ := m["kind"].(string) + return crossRegisteredKinds[kind] +} diff --git a/vendor/k8s.io/apiserver/pkg/server/secure_serving.go b/vendor/k8s.io/apiserver/pkg/server/secure_serving.go index 867c7efac2..0c14893a74 100644 --- a/vendor/k8s.io/apiserver/pkg/server/secure_serving.go +++ b/vendor/k8s.io/apiserver/pkg/server/secure_serving.go @@ -71,6 +71,9 @@ func (s *SecureServingInfo) tlsConfig(stopCh <-chan struct{}) (*tls.Config, erro } } } + if len(s.CurvePreferences) > 0 { + tlsConfig.CurvePreferences = s.CurvePreferences + } if s.ClientCA != nil { // Populate PeerCertificates in requests, but don't reject connections without certificates diff --git a/vendor/k8s.io/apiserver/pkg/server/signal_posix.go b/vendor/k8s.io/apiserver/pkg/server/signal_posix.go index 7acb2038a1..fc0ab2d671 100644 --- a/vendor/k8s.io/apiserver/pkg/server/signal_posix.go +++ b/vendor/k8s.io/apiserver/pkg/server/signal_posix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2017 The Kubernetes Authors. diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/doc.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/doc.go index aa0fdaed0b..9a542b0970 100644 --- a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/doc.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1alpha1/doc.go @@ -18,5 +18,5 @@ limitations under the License. // +k8s:openapi-gen=true // +k8s:openapi-model-package=io.k8s.apiserver.pkg.server.statusz.api.v1alpha1 -// Package v1alpha1 contains API Schema definitions for the zpages v1alpha1 API group +// Package v1alpha1 contains API Schema definitions for the statusz v1alpha1 API group package v1alpha1 diff --git a/vendor/k8s.io/api/autoscaling/v2beta1/doc.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/doc.go similarity index 73% rename from vendor/k8s.io/api/autoscaling/v2beta1/doc.go rename to vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/doc.go index 58cc1f89dc..8237e4776f 100644 --- a/vendor/k8s.io/api/autoscaling/v2beta1/doc.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/doc.go @@ -1,5 +1,5 @@ /* -Copyright 2016 The Kubernetes Authors. +Copyright 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. @@ -15,9 +15,8 @@ limitations under the License. */ // +k8s:deepcopy-gen=package -// +k8s:protobuf-gen=package // +k8s:openapi-gen=true -// +k8s:prerelease-lifecycle-gen=true -// +k8s:openapi-model-package=io.k8s.api.autoscaling.v2beta1 +// +k8s:openapi-model-package=io.k8s.apiserver.pkg.server.statusz.api.v1beta1 -package v2beta1 +// Package v1beta1 contains API Schema definitions for the statusz v1beta1 API group +package v1beta1 diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/register.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/register.go new file mode 100644 index 0000000000..c41806b69d --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/register.go @@ -0,0 +1,47 @@ +/* +Copyright 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. +*/ + +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +const ( + GroupName = "config.k8s.io" + Version = "v1beta1" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} + +var ( + // SchemeBuilder initializes a scheme builder + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme is a global function that adds this group's types to a scheme + AddToScheme = SchemeBuilder.AddToScheme +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &Statusz{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go new file mode 100644 index 0000000000..a8898826bb --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/types.go @@ -0,0 +1,50 @@ +/* +Copyright 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. +*/ + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// Statusz is a struct used for versioned statusz endpoint. +type Statusz struct { + // TypeMeta is the type metadata for the object. + metav1.TypeMeta `json:",inline"` + // Standard object's metadata. + // +optional + metav1.ObjectMeta `json:"metadata,omitempty"` + // StartTime is the time the component process was initiated. + StartTime metav1.Time `json:"startTime"` + // UptimeSeconds is the duration in seconds for which the component has been running continuously. + UptimeSeconds int64 `json:"uptimeSeconds"` + // GoVersion is the version of the Go programming language used to build the binary. + // The format is not guaranteed to be consistent across different Go builds. + // +optional + GoVersion string `json:"goVersion"` + // BinaryVersion is the version of the component's binary. + // The format is not guaranteed to be semantic versioning and may be an arbitrary string. + BinaryVersion string `json:"binaryVersion"` + // EmulationVersion is the Kubernetes API version which this component is emulating. + // if present, formatted as "." + // +optional + EmulationVersion string `json:"emulationVersion,omitempty"` + // Paths contains relative URLs to other essential read-only endpoints for debugging and troubleshooting. + // +optional + // +listType=set + Paths []string `json:"paths"` +} diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/zz_generated.deepcopy.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..e879af624c --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,58 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1beta1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Statusz) DeepCopyInto(out *Statusz) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.StartTime.DeepCopyInto(&out.StartTime) + if in.Paths != nil { + in, out := &in.Paths, &out.Paths + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Statusz. +func (in *Statusz) DeepCopy() *Statusz { + if in == nil { + return nil + } + out := new(Statusz) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Statusz) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/vendor/k8s.io/api/admission/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/zz_generated.model_name.go similarity index 66% rename from vendor/k8s.io/api/admission/v1beta1/generated.protomessage.pb.go rename to vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/zz_generated.model_name.go index 95c7022932..8a4134750b 100644 --- a/vendor/k8s.io/api/admission/v1beta1/generated.protomessage.pb.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/api/v1beta1/zz_generated.model_name.go @@ -1,5 +1,5 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release +//go:build !ignore_autogenerated +// +build !ignore_autogenerated /* Copyright The Kubernetes Authors. @@ -17,12 +17,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Code generated by go-to-protobuf. DO NOT EDIT. +// Code generated by openapi-gen. DO NOT EDIT. package v1beta1 -func (*AdmissionRequest) ProtoMessage() {} - -func (*AdmissionResponse) ProtoMessage() {} - -func (*AdmissionReview) ProtoMessage() {} +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in Statusz) OpenAPIModelName() string { + return "io.k8s.apiserver.pkg.server.statusz.api.v1beta1.Statusz" +} diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/negotiate/negotiation.go b/vendor/k8s.io/apiserver/pkg/server/statusz/negotiate/negotiation.go index 04c6943774..cd314e4aea 100644 --- a/vendor/k8s.io/apiserver/pkg/server/statusz/negotiate/negotiation.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/negotiate/negotiation.go @@ -20,34 +20,29 @@ import ( "k8s.io/apimachinery/pkg/runtime/schema" ) -// StatuszEndpointRestrictions implements content negotiation restrictions for the z-pages. +// StatuszEndpointRestrictions implements content negotiation restrictions for statusz. // It is used to validate and restrict which GroupVersionKinds are allowed for structured responses. -type StatuszEndpointRestrictions struct{} +type StatuszEndpointRestrictions struct { + RecognizedStructuredKinds map[schema.GroupVersionKind]bool +} -// AllowsMediaTypeTransform checks if the provided GVK is supported for structured z-page responses. -func (StatuszEndpointRestrictions) AllowsMediaTypeTransform(mimeType string, mimeSubType string, gvk *schema.GroupVersionKind) bool { +// AllowsMediaTypeTransform checks if the provided GVK is supported for structured statusz responses. +func (s StatuszEndpointRestrictions) AllowsMediaTypeTransform(mimeType string, mimeSubType string, gvk *schema.GroupVersionKind) bool { if mimeType == "text" && mimeSubType == "plain" { return gvk == nil } - return isStructured(gvk) -} -func (StatuszEndpointRestrictions) AllowsServerVersion(string) bool { + if gvk != nil { + return s.RecognizedStructuredKinds[*gvk] + } + return false } -func (StatuszEndpointRestrictions) AllowsStreamSchema(s string) bool { +func (StatuszEndpointRestrictions) AllowsServerVersion(s string) bool { return false } -func isStructured(gvk *schema.GroupVersionKind) bool { - if gvk != nil { - if gvk.Group == "config.k8s.io" && gvk.Version == "v1alpha1" { - if gvk.Kind == "Statusz" { - return true - } - } - } - +func (StatuszEndpointRestrictions) AllowsStreamSchema(s string) bool { return false } diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/statusz.go b/vendor/k8s.io/apiserver/pkg/server/statusz/statusz.go index f9f24dfbd7..1b334b1699 100644 --- a/vendor/k8s.io/apiserver/pkg/server/statusz/statusz.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/statusz.go @@ -26,15 +26,22 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" + "k8s.io/apimachinery/pkg/runtime/serializer/cbor" "k8s.io/component-base/compatibility" "k8s.io/apiserver/pkg/endpoints/handlers/negotiation" "k8s.io/apiserver/pkg/endpoints/handlers/responsewriters" + "k8s.io/apiserver/pkg/endpoints/metrics" + "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/endpoints/responsewriter" + "k8s.io/apiserver/pkg/features" + "k8s.io/apiserver/pkg/server/statusz/api/v1alpha1" + "k8s.io/apiserver/pkg/server/statusz/api/v1beta1" "k8s.io/apiserver/pkg/server/statusz/negotiate" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" utilruntime "k8s.io/apimachinery/pkg/util/runtime" - v1alpha1 "k8s.io/apiserver/pkg/server/statusz/api/v1alpha1" + utilfeature "k8s.io/apiserver/pkg/util/feature" ) var ( @@ -46,21 +53,27 @@ var ( "/openapi": true, "/.well-known": true, } + v1alpha1StatuszKind = v1alpha1.SchemeGroupVersion.WithKind("Statusz") + v1beta1StatuszKind = v1beta1.SchemeGroupVersion.WithKind("Statusz") + recognizedStructuredKinds = map[schema.GroupVersionKind]bool{ + v1alpha1StatuszKind: true, + v1beta1StatuszKind: true, + } ) -const ( - DefaultStatuszPath = "/statusz" - Kind = "Statusz" - GroupName = "config.k8s.io" - Version = "v1alpha1" -) +const DefaultStatuszPath = "/statusz" const headerFmt = ` %s statusz Warning: This endpoint is not meant to be machine parseable, has no formatting compatibility guarantees and is for debugging purposes only. ` -var schemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: Version} +// statuszCodecFactory wraps a CodecFactory to filter out unsupported media types (like protobuf) +// from the supported media types list, so error messages only show actually supported types. +type statuszCodecFactory struct { + serializer.CodecFactory + supportedMediaTypes []runtime.SerializerInfo +} type mux interface { Handle(path string, handler http.Handler) @@ -70,7 +83,8 @@ type ListedPathsOption []string func NewRegistry(effectiveVersion compatibility.EffectiveVersion, opts ...Option) statuszRegistry { r := ®istry{ - effectiveVersion: effectiveVersion, + effectiveVersion: effectiveVersion, + deprecatedVersionsMap: map[string]bool{"v1alpha1": true}, } for _, opt := range opts { opt(r) @@ -82,8 +96,21 @@ func NewRegistry(effectiveVersion compatibility.EffectiveVersion, opts ...Option func Install(m mux, componentName string, reg statuszRegistry) { scheme := runtime.NewScheme() utilruntime.Must(v1alpha1.AddToScheme(scheme)) - codecFactory := serializer.NewCodecFactory( - scheme, + utilruntime.Must(v1beta1.AddToScheme(scheme)) + filteredCodecFactory, err := newStatuszCodecFactory(scheme, componentName, reg) + if err != nil { + utilruntime.HandleError(err) + } + restrictions := negotiate.StatuszEndpointRestrictions{ + RecognizedStructuredKinds: recognizedStructuredKinds, + } + m.Handle(DefaultStatuszPath, handleStatusz(componentName, reg, filteredCodecFactory, restrictions)) +} + +// newStatuszCodecFactory creates a codec factory with the standard serializers for statusz, +// filtering out unsupported media types (e.g., protobuf). +func newStatuszCodecFactory(scheme *runtime.Scheme, componentName string, reg statuszRegistry) (*statuszCodecFactory, error) { + codecFactoryOpts := []serializer.CodecFactoryOptionsMutator{ serializer.WithSerializer(func(_ runtime.ObjectCreater, _ runtime.ObjectTyper) runtime.SerializerInfo { textSerializer := statuszTextSerializer{componentName, reg} return runtime.SerializerInfo{ @@ -95,16 +122,75 @@ func Install(m mux, componentName string, reg statuszRegistry) { PrettySerializer: textSerializer, } }), - ) - m.Handle(DefaultStatuszPath, handleStatusz(componentName, reg, codecFactory, negotiate.StatuszEndpointRestrictions{})) + } + // TODO: remove this explicit check when https://github.com/kubernetes/enhancements/pull/5740 is implemented. + if utilfeature.DefaultFeatureGate.Enabled(features.CBORServingAndStorage) { + codecFactoryOpts = append(codecFactoryOpts, serializer.WithSerializer(cbor.NewSerializerInfo)) + } + + codecFactory := serializer.NewCodecFactory(scheme, codecFactoryOpts...) + allTypes := codecFactory.SupportedMediaTypes() + filtered := make([]runtime.SerializerInfo, 0, len(allTypes)) + + var unknownTypes []string + for _, info := range allTypes { + switch info.MediaType { + // Supported media types + case "text/plain", runtime.ContentTypeJSON, runtime.ContentTypeYAML, runtime.ContentTypeCBOR: + filtered = append(filtered, info) + // Unsupported media types + case runtime.ContentTypeProtobuf: + continue + default: + unknownTypes = append(unknownTypes, info.MediaType) + } + } + + var err error + if len(unknownTypes) > 0 { + err = fmt.Errorf("statusz: unknown media type(s) %v, excluding from supported types", unknownTypes) + } + + return &statuszCodecFactory{ + CodecFactory: codecFactory, + supportedMediaTypes: filtered, + }, err +} + +func (f *statuszCodecFactory) SupportedMediaTypes() []runtime.SerializerInfo { + return f.supportedMediaTypes } func handleStatusz(componentName string, reg statuszRegistry, serializer runtime.NegotiatedSerializer, restrictions negotiate.StatuszEndpointRestrictions) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - obj := statusz(componentName, reg) + requestReceivedTimestamp, ok := request.ReceivedTimestampFrom(r.Context()) + if !ok { + requestReceivedTimestamp = time.Now() + } + delegate := &metrics.ResponseWriterDelegator{ResponseWriter: w} + w = responsewriter.WrapForHTTP1Or2(delegate) + + // Use MonitorRequest instead of InstrumentHandlerFunc because the group, + // version, and deprecated status depend on per-request content negotiation. + // For text/plain requests, group and version remain empty. For structured + // responses (JSON/YAML/CBOR), they are set to the negotiated API group and + // version (e.g., config.k8s.io/v1alpha1). + var group, version string + var deprecated bool + defer func() { + metrics.MonitorRequest(r, "GET", group, version, + "statusz", // resource + "", // subresource + "", // scope + componentName, // component + deprecated, + "", // removedRelease + delegate.Status(), delegate.ContentLength(), time.Since(requestReceivedTimestamp)) + }() + acceptHeader := r.Header.Get("Accept") if strings.TrimSpace(acceptHeader) == "" { - writePlainTextResponse(obj, serializer, w) + writePlainTextResponse(v1beta1Statusz(componentName, reg), serializer, w) return } @@ -121,11 +207,10 @@ func handleStatusz(componentName string, reg statuszRegistry, serializer runtime return } - var targetGV schema.GroupVersion switch serializerInfo.MediaType { - case "application/json": + case "application/json", "application/yaml", "application/cbor": if mediaType.Convert == nil { - err := fmt.Errorf("content negotiation failed: mediaType.Convert is nil for application/json") + err := fmt.Errorf("content negotiation failed: mediaType.Convert is nil for %s", serializerInfo.MediaType) utilruntime.HandleError(err) responsewriters.ErrorNegotiated( err, @@ -136,18 +221,19 @@ func handleStatusz(componentName string, reg statuszRegistry, serializer runtime ) return } - targetGV = mediaType.Convert.GroupVersion() - deprecated := reg.deprecatedVersions()[targetGV.Version] + // Set group, version, and deprecated from the negotiated target so + // the deferred MonitorRequest records the actual requested API version. + group = mediaType.Convert.Group + version = mediaType.Convert.Version + deprecated = reg.deprecatedVersions()[version] if deprecated { w.Header().Set("Warning", `299 - "This version of the statusz endpoint is deprecated. Please use a newer version."`) } + handleStructuredResponse(w, r, componentName, reg, serializer, restrictions, mediaType) case "text/plain": - // Even though text/plain serialization does not use the group/version, - // the serialization machinery expects a non-zero schema.GroupVersion to be passed. - // Passing the zero value can cause errors or unexpected behavior in the negotiation logic. - targetGV = schemeGroupVersion + writePlainTextResponse(v1beta1Statusz(componentName, reg), serializer, w) default: - err = fmt.Errorf("content negotiation failed: unsupported media type '%s'", serializerInfo.MediaType) + err := fmt.Errorf("unsupported media type: %s/%s", serializerInfo.MediaType, serializerInfo.MediaTypeSubType) utilruntime.HandleError(err) responsewriters.ErrorNegotiated( err, @@ -156,14 +242,29 @@ func handleStatusz(componentName string, reg statuszRegistry, serializer runtime w, r, ) - return } + } +} - writeResponse(obj, serializer, targetGV, restrictions, w, r) +func handleStructuredResponse(w http.ResponseWriter, r *http.Request, componentName string, reg statuszRegistry, serializer runtime.NegotiatedSerializer, restrictions negotiate.StatuszEndpointRestrictions, mediaType negotiation.MediaTypeOptions) { + switch *mediaType.Convert { + case v1alpha1StatuszKind: + writeStructuredResponse(v1alpha1Statusz(componentName, reg), serializer, mediaType.Convert.GroupVersion(), restrictions, w, r) + case v1beta1StatuszKind: + writeStructuredResponse(v1beta1Statusz(componentName, reg), serializer, mediaType.Convert.GroupVersion(), restrictions, w, r) + default: + err := fmt.Errorf("unsupported media type: %s", mediaType.Convert.String()) + utilruntime.HandleError(err) + responsewriters.ErrorNegotiated( + err, + serializer, + schema.GroupVersion{}, + w, + r, + ) } } -// writePlainTextResponse writes the statusz response as text/plain using the registered serializer. func writePlainTextResponse(obj runtime.Object, serializer runtime.NegotiatedSerializer, w http.ResponseWriter) { w.Header().Set("Content-Type", "text/plain; charset=utf-8") // Find the text/plain serializer @@ -185,7 +286,7 @@ func writePlainTextResponse(obj runtime.Object, serializer runtime.NegotiatedSer } } -func writeResponse(obj runtime.Object, serializer runtime.NegotiatedSerializer, targetGV schema.GroupVersion, restrictions negotiate.StatuszEndpointRestrictions, w http.ResponseWriter, r *http.Request) { +func writeStructuredResponse(obj runtime.Object, serializer runtime.NegotiatedSerializer, targetGV schema.GroupVersion, restrictions negotiate.StatuszEndpointRestrictions, w http.ResponseWriter, r *http.Request) { responsewriters.WriteObjectNegotiated( serializer, restrictions, @@ -198,7 +299,7 @@ func writeResponse(obj runtime.Object, serializer runtime.NegotiatedSerializer, ) } -func statusz(componentName string, reg statuszRegistry) *v1alpha1.Statusz { +func v1alpha1Statusz(componentName string, reg statuszRegistry) *v1alpha1.Statusz { startTime := reg.processStartTime() upTimeSeconds := max(0, int64(time.Since(startTime).Seconds())) goVersion := reg.goVersion() @@ -211,8 +312,38 @@ func statusz(componentName string, reg statuszRegistry) *v1alpha1.Statusz { paths := aggregatePaths(reg.paths()) data := &v1alpha1.Statusz{ TypeMeta: metav1.TypeMeta{ - Kind: Kind, - APIVersion: fmt.Sprintf("%s/%s", GroupName, Version), + Kind: v1alpha1StatuszKind.Kind, + APIVersion: v1alpha1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Name: componentName, + }, + StartTime: metav1.Time{Time: startTime}, + UptimeSeconds: upTimeSeconds, + GoVersion: goVersion, + BinaryVersion: binaryVersion, + EmulationVersion: emulationVersion, + Paths: paths, + } + + return data +} + +func v1beta1Statusz(componentName string, reg statuszRegistry) *v1beta1.Statusz { + startTime := reg.processStartTime() + upTimeSeconds := max(0, int64(time.Since(startTime).Seconds())) + goVersion := reg.goVersion() + binaryVersion := reg.binaryVersion().String() + var emulationVersion string + if reg.emulationVersion() != nil { + emulationVersion = reg.emulationVersion().String() + } + + paths := aggregatePaths(reg.paths()) + data := &v1beta1.Statusz{ + TypeMeta: metav1.TypeMeta{ + Kind: v1beta1StatuszKind.Kind, + APIVersion: v1beta1.SchemeGroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: componentName, diff --git a/vendor/k8s.io/apiserver/pkg/server/statusz/textserializer.go b/vendor/k8s.io/apiserver/pkg/server/statusz/textserializer.go index c8bdc2c72a..5c97923a0b 100644 --- a/vendor/k8s.io/apiserver/pkg/server/statusz/textserializer.go +++ b/vendor/k8s.io/apiserver/pkg/server/statusz/textserializer.go @@ -27,7 +27,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - v1alpha1 "k8s.io/apiserver/pkg/server/statusz/api/v1alpha1" + v1beta1 "k8s.io/apiserver/pkg/server/statusz/api/v1beta1" ) // statuszTextSerializer implements runtime.Serializer for text/plain output. @@ -45,9 +45,9 @@ func (s statuszTextSerializer) Encode(obj runtime.Object, w io.Writer) error { randomIndex := rand.Intn(len(delimiters)) delim := html.EscapeString(delimiters[randomIndex]) - statuszObj, ok := obj.(*v1alpha1.Statusz) + statuszObj, ok := obj.(*v1beta1.Statusz) if !ok { - return fmt.Errorf("expected *v1alpha1.Statusz, got %T", obj) + return fmt.Errorf("expected *v1beta1.Statusz, got %T", obj) } startTime := html.EscapeString(statuszObj.StartTime.Time.Format(time.UnixDate)) diff --git a/vendor/k8s.io/apiserver/pkg/sharding/parser.go b/vendor/k8s.io/apiserver/pkg/sharding/parser.go new file mode 100644 index 0000000000..fe08eac0c9 --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/sharding/parser.go @@ -0,0 +1,217 @@ +/* +Copyright 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. +*/ + +package sharding + +import ( + "fmt" + "strings" + + celparser "github.com/google/cel-go/parser" + + "github.com/google/cel-go/common" + "github.com/google/cel-go/common/ast" + "github.com/google/cel-go/common/operators" + + apisharding "k8s.io/apimachinery/pkg/sharding" +) + +// Parse parses a CEL-based shard selector expression into a Selector. +// +// The expression format is: +// +// shardRange(object.metadata.uid, '0x0', '0x8000000000000000') +// shardRange(object.metadata.uid, '0x0', '0x8000000000000000') || shardRange(...) +// +// Only the shardRange() function and || operator are permitted. The CEL +// expression is parsed but never evaluated — the AST is walked to extract +// shard range requirements. +func Parse(expr string) (apisharding.Selector, error) { + expr = strings.TrimSpace(expr) + if expr == "" { + return nil, fmt.Errorf("empty shard selector is not allowed; omit the parameter for unfiltered lists") + } + + p, err := celparser.NewParser(celparser.Macros( /* no macros */ )) + if err != nil { + return nil, fmt.Errorf("failed to create CEL parser: %w", err) + } + + parsed, errs := p.Parse(common.NewTextSource(expr)) + if errs != nil && len(errs.GetErrors()) > 0 { + return nil, fmt.Errorf("CEL parse error: %s", errs.GetErrors()[0].Message) + } + + reqs, err := walkExpr(parsed.Expr()) + if err != nil { + return nil, err + } + + // Validate that all requirements use the same field key. + for i := 1; i < len(reqs); i++ { + if reqs[i].Key != reqs[0].Key { + return nil, fmt.Errorf("all shard ranges must use the same field, got %q and %q", reqs[0].Key, reqs[i].Key) + } + } + + return apisharding.NewSelector(reqs...), nil +} + +// walkExpr recursively walks the CEL AST and extracts ShardRangeRequirement values. +// The root expression must be either a shardRange() call or a chain of || operators +// combining shardRange() calls. +func walkExpr(e ast.Expr) ([]apisharding.ShardRangeRequirement, error) { + if e.Kind() == ast.CallKind { + call := e.AsCall() + fn := call.FunctionName() + + if fn == operators.LogicalOr { + // _||_ operator: recurse into both sides + args := call.Args() + if len(args) != 2 { + return nil, fmt.Errorf("|| operator requires exactly 2 arguments") + } + left, err := walkExpr(args[0]) + if err != nil { + return nil, err + } + right, err := walkExpr(args[1]) + if err != nil { + return nil, err + } + return append(left, right...), nil + } + + if fn == "shardRange" { + req, err := parseShardRangeCall(call) + if err != nil { + return nil, err + } + return []apisharding.ShardRangeRequirement{req}, nil + } + + return nil, fmt.Errorf("unsupported function %q; only shardRange() and || are allowed", fn) + } + + return nil, fmt.Errorf("unexpected expression kind %v; expected shardRange() call or || operator", e.Kind()) +} + +// parseShardRangeCall extracts a ShardRangeRequirement from a shardRange(field, start, end) call. +func parseShardRangeCall(call ast.CallExpr) (apisharding.ShardRangeRequirement, error) { + args := call.Args() + if len(args) != 3 { + return apisharding.ShardRangeRequirement{}, fmt.Errorf("shardRange() requires exactly 3 arguments, got %d", len(args)) + } + + // Arg 0: field path (select chain like object.metadata.uid) + fieldPath, err := extractFieldPath(args[0]) + if err != nil { + return apisharding.ShardRangeRequirement{}, fmt.Errorf("shardRange() first argument: %w", err) + } + + // Validate field path + switch fieldPath { + case "object.metadata.uid", "object.metadata.namespace": + // ok + default: + return apisharding.ShardRangeRequirement{}, fmt.Errorf("unsupported field path %q; supported: object.metadata.uid, object.metadata.namespace", fieldPath) + } + + // Arg 1: hex start (string literal) + hexStart, err := extractHexLiteral(args[1], "hexStart") + if err != nil { + return apisharding.ShardRangeRequirement{}, err + } + + // Arg 2: hex end (string literal) + hexEnd, err := extractHexLiteral(args[2], "hexEnd") + if err != nil { + return apisharding.ShardRangeRequirement{}, err + } + + // Validate start < end using the canonical hex comparison. + if !apisharding.HexLess(hexStart, hexEnd) { + return apisharding.ShardRangeRequirement{}, fmt.Errorf("shard range start %s must be less than end %s", hexStart, hexEnd) + } + + return apisharding.ShardRangeRequirement{ + Key: fieldPath, + Start: hexStart, + End: hexEnd, + }, nil +} + +// extractFieldPath walks a select chain (object.metadata.uid) and returns the dot-joined path. +func extractFieldPath(e ast.Expr) (string, error) { + switch e.Kind() { + case ast.IdentKind: + return e.AsIdent(), nil + case ast.SelectKind: + sel := e.AsSelect() + operand, err := extractFieldPath(sel.Operand()) + if err != nil { + return "", err + } + return operand + "." + sel.FieldName(), nil + default: + return "", fmt.Errorf("expected field path (e.g. object.metadata.uid), got expression kind %v", e.Kind()) + } +} + +// extractHexLiteral extracts a hex string from a CEL string literal. +// The literal must be a single-quoted string like '0xff' with a 0x prefix. +func extractHexLiteral(e ast.Expr, name string) (string, error) { + if e.Kind() != ast.LiteralKind { + return "", fmt.Errorf("%s must be a string literal (e.g. '0xff'), got expression kind %v", name, e.Kind()) + } + + val := e.AsLiteral() + s, ok := val.Value().(string) + if !ok { + return "", fmt.Errorf("%s must be a string literal, got %T", name, val.Value()) + } + + if !strings.HasPrefix(s, "0x") { + return "", fmt.Errorf("%s must have '0x' prefix, got %q", name, s) + } + + hex := s[2:] + if hex == "" { + return "", fmt.Errorf("%s: hex value is required after '0x'", name) + } + if len(hex) > 17 { + return "", fmt.Errorf("%s: hex value too long (%d chars, max 17): %q", name, len(hex), hex) + } + + for _, c := range hex { + if (c < '0' || c > '9') && (c < 'a' || c > 'f') { + return "", fmt.Errorf("%s: invalid hex character %q in %q", name, string(c), s) + } + } + + // Require exactly 16 hex digits, except for the special case + // "0x10000000000000000" (2^64) which is the exclusive upper bound. + if len(hex) == 17 { + if s != "0x10000000000000000" { + return "", fmt.Errorf("%s: 17-digit hex value must be '0x10000000000000000' (2^64), got %q", name, s) + } + } else if len(hex) != 16 { + padded := "0x" + strings.Repeat("0", 16-len(hex)) + hex + return "", fmt.Errorf("%s must be a 0x-prefixed 16-digit hex value, got %q (did you mean %q?)", name, s, padded) + } + + return s, nil +} diff --git a/vendor/k8s.io/apiserver/pkg/storage/OWNERS b/vendor/k8s.io/apiserver/pkg/storage/OWNERS index b68cef1fe5..39822f47de 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/OWNERS +++ b/vendor/k8s.io/apiserver/pkg/storage/OWNERS @@ -3,6 +3,7 @@ approvers: - liggitt - wojtek-t + - serathius reviewers: - smarterclayton - wojtek-t @@ -14,6 +15,7 @@ reviewers: - enj - stevekuznetsov - MadhavJivrajani + - serathius emeritus_approvers: - xiang90 - timothysc diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go index a74cf8d4a3..8711596a3c 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go @@ -371,10 +371,10 @@ func (c *cacheWatcher) convertToWatchEvent(event *watchCacheEvent) *watch.Event return e } - curObjPasses := event.Type != watch.Deleted && c.filter(event.Key, event.ObjLabels, event.ObjFields) + curObjPasses := event.Type != watch.Deleted && c.filter(event.Key, event.ObjLabels, event.ObjFields, event.Object) oldObjPasses := false if event.PrevObject != nil { - oldObjPasses = c.filter(event.Key, event.PrevObjLabels, event.PrevObjFields) + oldObjPasses = c.filter(event.Key, event.PrevObjLabels, event.PrevObjFields, event.PrevObject) } if !curObjPasses && !oldObjPasses { // Watcher is not interested in that object. @@ -434,7 +434,7 @@ func (c *cacheWatcher) sendWatchCacheEvent(event *watchCacheEvent) { } func (c *cacheWatcher) processInterval(ctx context.Context, cacheInterval *watchCacheInterval, resourceVersion uint64) { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) defer close(c.result) defer c.Stop() diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go index a5f7ab6d69..326ed27c80 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/cacher.go @@ -36,6 +36,7 @@ import ( "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" "k8s.io/apiserver/pkg/audit" @@ -45,6 +46,7 @@ import ( "k8s.io/apiserver/pkg/storage/cacher/delegator" "k8s.io/apiserver/pkg/storage/cacher/metrics" "k8s.io/apiserver/pkg/storage/cacher/progress" + "k8s.io/apiserver/pkg/storage/cacher/store" etcdfeature "k8s.io/apiserver/pkg/storage/feature" utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/tools/cache" @@ -246,7 +248,7 @@ func (t *watcherBookmarkTimeBuckets) popExpiredWatchersThreadUnsafe() [][]*cache return expiredWatchers } -type filterWithAttrsFunc func(key string, l labels.Set, f fields.Set) bool +type filterWithAttrsFunc func(key string, l labels.Set, f fields.Set, obj runtime.Object) bool type indexedTriggerFunc struct { indexName string @@ -505,6 +507,10 @@ type namespacedName struct { } func (c *Cacher) Watch(ctx context.Context, key string, opts storage.ListOptions) (watch.Interface, error) { + ctx, span := tracing.Start(ctx, "cacher.Watch", + attribute.String("audit-id", audit.GetAuditIDTruncated(ctx)), + attribute.Stringer("type", c.groupResource)) + defer span.End(500 * time.Millisecond) key, err := c.prepareKey(key, opts.Recursive) if err != nil { return nil, err @@ -597,7 +603,7 @@ func (c *Cacher) Watch(ctx context.Context, key string, opts storage.ListOptions // to compute watcher.forget function (which has to happen under lock). watcher := newCacheWatcher( chanSize, - filterWithAttrsAndPrefixFunction(key, pred), + filterWithAttrsAndPrefixFunction(key, pred, c.groupResource), emptyFunc, c.versioner, deadline, @@ -671,6 +677,15 @@ func (c *Cacher) Watch(ctx context.Context, key string, opts storage.ListOptions return newImmediateCloseWatcher(), nil } + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) && pred.ShardSelector != nil && !pred.ShardSelector.Empty() { + metrics.RecordShardedWatchStarted(c.groupResource) + originalForget := watcher.forget + watcher.forget = func(drainWatcher bool) { + metrics.RecordShardedWatchStopped(c.groupResource) + originalForget(drainWatcher) + } + } + go watcher.processInterval(ctx, cacheInterval, requiredResourceVersion) return watcher, nil } @@ -696,9 +711,9 @@ func (c *Cacher) Get(ctx context.Context, key string, opts storage.GetOptions, o } if exists { - elem, ok := obj.(*storeElement) + elem, ok := obj.(*store.Element) if !ok { - return fmt.Errorf("non *storeElement returned from storage: %v", obj) + return fmt.Errorf("non *store.Element returned from storage: %v", obj) } objVal.Set(reflect.ValueOf(elem.Object).Elem()) } else { @@ -785,11 +800,19 @@ func (c *Cacher) GetList(ctx context.Context, key string, opts storage.ListOptio var hasMoreListItems bool limit := computeListLimit(opts) for i, obj := range resp.Items { - elem, ok := obj.(*storeElement) + elem, ok := obj.(*store.Element) if !ok { - return fmt.Errorf("non *storeElement returned from storage: %v", obj) + return fmt.Errorf("non *store.Element returned from storage: %v", obj) } - if opts.Predicate.MatchesObjectAttributes(elem.Labels, elem.Fields) { + shardMatch := true + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + var err error + shardMatch, err = opts.Predicate.MatchesSharding(elem.Object) + if err != nil { + return fmt.Errorf("shard matching failed: %w", err) + } + } + if shardMatch && opts.Predicate.MatchesObjectAttributes(elem.Labels, elem.Fields) { selectedObjects = append(selectedObjects, elem.Object) lastSelectedObjectKey = elem.Key } @@ -820,6 +843,9 @@ func (c *Cacher) GetList(ctx context.Context, key string, opts storage.ListOptio return err } } + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + opts.Predicate.SetShardInfoOnList(listObj) + } metrics.RecordListCacheMetrics(c.groupResource, indexUsed, len(resp.Items), listVal.Len()) return nil } @@ -1198,11 +1224,23 @@ func forgetWatcher(c *Cacher, w *cacheWatcher, index int, scope namespacedName, } } -func filterWithAttrsAndPrefixFunction(key string, p storage.SelectionPredicate) filterWithAttrsFunc { - filterFunc := func(objKey string, label labels.Set, field fields.Set) bool { +func filterWithAttrsAndPrefixFunction(key string, p storage.SelectionPredicate, groupResource schema.GroupResource) filterWithAttrsFunc { + isSharded := utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) && p.ShardSelector != nil && !p.ShardSelector.Empty() + filterFunc := func(objKey string, label labels.Set, field fields.Set, obj runtime.Object) bool { if !hasPathPrefix(objKey, key) { return false } + if isSharded { + matches, err := p.MatchesSharding(obj) + if err != nil { + utilruntime.HandleError(fmt.Errorf("shard matching failed for %v: %w", groupResource, err)) + return false + } + if !matches { + metrics.RecordWatchFilteredEvent(groupResource) + return false + } + } return p.MatchesObjectAttributes(label, field) } return filterFunc @@ -1238,6 +1276,7 @@ func (c *Cacher) getBookmarkAfterResourceVersionLockedFunc(parsedResourceVersion } } +// isListWatchRequest is mirrored in staging/src/k8s.io/apiserver/pkg/endpoints/handlers/get.go func isListWatchRequest(opts storage.ListOptions) bool { return opts.SendInitialEvents != nil && *opts.SendInitialEvents && opts.Predicate.AllowWatchBookmarks } @@ -1258,7 +1297,7 @@ func (c *Cacher) getWatchCacheResourceVersion(ctx context.Context, parsedWatchRe return parsedWatchResourceVersion, nil } // legacy case - if !utilfeature.DefaultFeatureGate.Enabled(features.WatchFromStorageWithoutResourceVersion) && opts.SendInitialEvents == nil && opts.ResourceVersion == "" { + if opts.SendInitialEvents == nil && opts.ResourceVersion == "" { return 0, nil } rv, err := c.storage.GetCurrentResourceVersion(ctx) diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go index b08c1fd5a4..4e1fabfaba 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/delegator.go @@ -39,6 +39,7 @@ import ( "k8s.io/apiserver/pkg/storage" "k8s.io/apiserver/pkg/storage/cacher/delegator" "k8s.io/apiserver/pkg/storage/cacher/metrics" + "k8s.io/apiserver/pkg/storage/cacher/store" utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/component-base/tracing" "k8s.io/klog/v2" @@ -111,7 +112,7 @@ func (c *CacheDelegator) Delete(ctx context.Context, key string, out runtime.Obj } else if exists { // DeepCopy the object since we modify resource version when serializing the // current object. - currObj := elem.(*storeElement).Object.DeepCopyObject() + currObj := elem.(*store.Element).Object.DeepCopyObject() return c.storage.Delete(ctx, key, out, preconditions, validateDeletion, currObj, opts) } // If we couldn't get the object, fallback to no-suggestion. @@ -129,10 +130,6 @@ func (c *CacheDelegator) Watch(ctx context.Context, key string, opts storage.Lis if !utilfeature.DefaultFeatureGate.Enabled(features.WatchList) && opts.SendInitialEvents != nil { opts.SendInitialEvents = nil } - // TODO: we should eventually get rid of this legacy case - if utilfeature.DefaultFeatureGate.Enabled(features.WatchFromStorageWithoutResourceVersion) && opts.SendInitialEvents == nil && opts.ResourceVersion == "" { - return c.storage.Watch(ctx, key, opts) - } return c.cacher.Watch(ctx, key, opts) } @@ -254,7 +251,7 @@ func (c *CacheDelegator) GuaranteedUpdate(ctx context.Context, key string, desti } else if exists { // DeepCopy the object since we modify resource version when serializing the // current object. - currObj := elem.(*storeElement).Object.DeepCopyObject() + currObj := elem.(*store.Element).Object.DeepCopyObject() return c.storage.GuaranteedUpdate(ctx, key, destination, ignoreNotFound, preconditions, tryUpdate, currObj) } // If we couldn't get the object, fallback to no-suggestion. @@ -344,10 +341,10 @@ func (c *consistencyChecker) check(ctx context.Context) { c.cacher.MarkConsistent(true) return } - klog.ErrorS(nil, "Cache consistency check failed", "group", c.groupResource.Group, "resource", c.groupResource.Resource, "resourceVersion", digests.ResourceVersion, "etcdDigest", digests.EtcdDigest, "cacheDigest", digests.CacheDigest) + klog.ErrorS(nil, "Cache consistency check failed", "group", c.groupResource.Group, "resource", c.groupResource.Resource, "resourceVersion", digests.ResourceVersion, "etcdDigest", digests.EtcdDigest, "cacheDigest", digests.CacheDigest, "diffDetail", digests.DiffDetail) metrics.StorageConsistencyCheckTotal.WithLabelValues(c.groupResource.Group, c.groupResource.Resource, "failure").Inc() if panicOnCacheInconsistency { - panic(fmt.Sprintf("Cache consistency check failed, group: %q, resource: %q, resourceVersion: %q, etcdDigest: %q, cacheDigest: %q", c.groupResource.Group, c.groupResource.Resource, digests.ResourceVersion, digests.EtcdDigest, digests.CacheDigest)) + panic(fmt.Sprintf("Cache consistency check failed, group: %q, resource: %q, resourceVersion: %q, etcdDigest: %q, cacheDigest: %q, diffDetail: %v", c.groupResource.Group, c.groupResource.Resource, digests.ResourceVersion, digests.EtcdDigest, digests.CacheDigest, digests.DiffDetail)) } c.cacher.MarkConsistent(false) } @@ -356,14 +353,43 @@ func (c *consistencyChecker) calculateDigests(ctx context.Context) (*storageDige if !c.cacher.Ready() { return nil, fmt.Errorf("cache is not ready") } - cacheDigest, cacheResourceVersion, err := c.calculateStoreDigest(ctx, c.cacher, "0", 0) + // variables for tracking the diff in consistency checker + cacheItems := []namespaceNameRV{} + var foundDiff *diffDetail + var etcdIndex int + + cacheDigest, cacheResourceVersion, err := c.calculateStoreDigest(ctx, c.cacher, "0", 0, func(obj metav1.Object) { + // collect items from cacher's list + cacheItems = append(cacheItems, namespaceNameRV{Namespace: obj.GetNamespace(), Name: obj.GetName(), RV: obj.GetResourceVersion()}) + }) if err != nil { return nil, fmt.Errorf("failed calculating cache digest: %w", err) } - etcdDigest, etcdResourceVersion, err := c.calculateStoreDigest(ctx, c.etcd, cacheResourceVersion, storageWatchListPageSize) + etcdDigest, etcdResourceVersion, err := c.calculateStoreDigest(ctx, c.etcd, cacheResourceVersion, storageWatchListPageSize, func(obj metav1.Object) { + // compare the item in etcd's list against cacheItems which is cacher's list + if foundDiff != nil { + return + } + etcdItem := namespaceNameRV{Namespace: obj.GetNamespace(), Name: obj.GetName(), RV: obj.GetResourceVersion()} + if len(cacheItems) <= etcdIndex { + foundDiff = &diffDetail{Index: etcdIndex, EtcdItem: &etcdItem} + cacheItems = nil // don't need it any more and nil it to allow GC to collect it + return + } + if cacheItem := cacheItems[etcdIndex]; cacheItem != etcdItem { + foundDiff = &diffDetail{Index: etcdIndex, EtcdItem: &etcdItem, CacheItem: &cacheItem} + cacheItems = nil // don't need it any more and nil it to allow GC to collect it + return + } + etcdIndex += 1 + }) if err != nil { return nil, fmt.Errorf("failed calculating etcd digest: %w", err) } + if len(cacheItems) > etcdIndex { + cacheItem := cacheItems[etcdIndex] + foundDiff = &diffDetail{Index: etcdIndex, CacheItem: &cacheItem} + } if cacheResourceVersion != etcdResourceVersion { return nil, fmt.Errorf("etcd returned different resource version then expected, cache: %q, etcd: %q", cacheResourceVersion, etcdResourceVersion) } @@ -371,16 +397,30 @@ func (c *consistencyChecker) calculateDigests(ctx context.Context) (*storageDige ResourceVersion: cacheResourceVersion, CacheDigest: cacheDigest, EtcdDigest: etcdDigest, + DiffDetail: foundDiff, }, nil } +type namespaceNameRV struct { + Namespace string + Name string + RV string +} + +type diffDetail struct { + Index int + CacheItem *namespaceNameRV + EtcdItem *namespaceNameRV +} + type storageDigest struct { ResourceVersion string CacheDigest string EtcdDigest string + DiffDetail *diffDetail } -func (c *consistencyChecker) calculateStoreDigest(ctx context.Context, store getLister, resourceVersion string, limit int64) (digest, rv string, err error) { +func (c *consistencyChecker) calculateStoreDigest(ctx context.Context, store getLister, resourceVersion string, limit int64, metaVisitor func(objectMeta metav1.Object)) (digest, rv string, err error) { opts := storage.ListOptions{ Recursive: true, Predicate: storage.Everything, @@ -399,7 +439,7 @@ func (c *consistencyChecker) calculateStoreDigest(ctx context.Context, store get if err != nil { return "", "", err } - err = addListToDigest(h, resp) + err = addListToDigest(h, resp, metaVisitor) if err != nil { return "", "", err } @@ -420,7 +460,7 @@ func (c *consistencyChecker) calculateStoreDigest(ctx context.Context, store get } } -func addListToDigest(h hash.Hash64, list runtime.Object) error { +func addListToDigest(h hash.Hash64, list runtime.Object, metaVisitor func(objectMeta metav1.Object)) error { return meta.EachListItem(list, func(obj runtime.Object) error { objectMeta, err := meta.Accessor(obj) if err != nil { @@ -430,6 +470,7 @@ func addListToDigest(h hash.Hash64, list runtime.Object) error { if err != nil { return err } + metaVisitor(objectMeta) return nil }) } diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go index 0f507cf121..0981d45739 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/metrics/metrics.go @@ -20,6 +20,8 @@ import ( "sync" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" compbasemetrics "k8s.io/component-base/metrics" "k8s.io/component-base/metrics/legacyregistry" ) @@ -112,7 +114,7 @@ var ( Namespace: namespace, Subsystem: subsystem, Name: "resource_version", - Help: "Current resource version of watch cache broken by resource type.", + Help: "Current resource version of watch cache broken by resource type. This is truncated to the 15 least significant digits.", StabilityLevel: compbasemetrics.ALPHA, }, []string{"group", "resource"}, @@ -185,6 +187,26 @@ var ( Help: "Counter for status of consistency checks between etcd and watch cache", StabilityLevel: compbasemetrics.ALPHA, }, []string{"group", "resource", "status"}) + + WatchShardsTotal = compbasemetrics.NewGaugeVec( + &compbasemetrics.GaugeOpts{ + Namespace: namespace, + Name: "watch_shards_total", + Help: "Number of active sharded watch connections broken by resource type.", + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"group", "resource"}, + ) + + WatchFilteredEventsTotal = compbasemetrics.NewCounterVec( + &compbasemetrics.CounterOpts{ + Namespace: namespace, + Name: "watch_filtered_events_total", + Help: "Counter of events filtered out by shard selector during watch dispatch, broken by resource type.", + StabilityLevel: compbasemetrics.ALPHA, + }, + []string{"group", "resource"}, + ) ) var registerMetrics sync.Once @@ -208,6 +230,10 @@ func Register() { legacyregistry.MustRegister(WatchCacheReadWait) legacyregistry.MustRegister(ConsistentReadTotal) legacyregistry.MustRegister(StorageConsistencyCheckTotal) + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + legacyregistry.MustRegister(WatchShardsTotal) + legacyregistry.MustRegister(WatchFilteredEventsTotal) + } }) } @@ -219,11 +245,28 @@ func RecordListCacheMetrics(groupResource schema.GroupResource, indexName string } // RecordResourceVersion sets the current resource version for a given resource type. +// The resource version is truncated to the 15 least significant digits to prevent +// the metric from growing indefinitely and losing precision when it exceeds 2^53-1. func RecordResourceVersion(groupResource schema.GroupResource, resourceVersion uint64) { - watchCacheResourceVersion.WithLabelValues(groupResource.Group, groupResource.Resource).Set(float64(resourceVersion)) + watchCacheResourceVersion.WithLabelValues(groupResource.Group, groupResource.Resource).Set(float64(resourceVersion % 1000000000000000)) +} + +// RecordShardedWatchStarted increments the active sharded watch gauge for the given resource. +func RecordShardedWatchStarted(groupResource schema.GroupResource) { + WatchShardsTotal.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() +} + +// RecordShardedWatchStopped decrements the active sharded watch gauge for the given resource. +func RecordShardedWatchStopped(groupResource schema.GroupResource) { + WatchShardsTotal.WithLabelValues(groupResource.Group, groupResource.Resource).Dec() +} + +// RecordWatchFilteredEvent increments the counter for events filtered by shard selector. +func RecordWatchFilteredEvent(groupResource schema.GroupResource) { + WatchFilteredEventsTotal.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() } -// RecordsWatchCacheCapacityChange record watchCache capacity resize(increase or decrease) operations. +// RecordsWatchCacheCapacityChange records watchCache capacity resize(increase or decrease) operations. func RecordsWatchCacheCapacityChange(groupResource schema.GroupResource, old, new int) { WatchCacheCapacity.WithLabelValues(groupResource.Group, groupResource.Resource).Set(float64(new)) if old < new { diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/progress/watch_progress.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/progress/watch_progress.go index 76fe73f136..9880fc6c36 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/progress/watch_progress.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/progress/watch_progress.go @@ -71,7 +71,7 @@ func (pr *ConditionalProgressRequester) Run(stopCh <-chan struct{}) { ctx = metadata.NewOutgoingContext(ctx, pr.contextMetadata) } go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) <-stopCh pr.mux.Lock() defer pr.mux.Unlock() diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/store.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store.go similarity index 92% rename from vendor/k8s.io/apiserver/pkg/storage/cacher/store.go rename to vendor/k8s.io/apiserver/pkg/storage/cacher/store/store.go index 9ec654e7d1..00dbc21298 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/store.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cacher +package store import ( "fmt" @@ -60,7 +60,7 @@ const ( btreeDegree = 16 ) -type storeIndexer interface { +type Indexer interface { Add(obj interface{}) error Update(obj interface{}) error Delete(obj interface{}) error @@ -72,17 +72,17 @@ type storeIndexer interface { ByIndex(indexName, indexedValue string) ([]interface{}, error) } -type orderedLister interface { +type OrderedLister interface { ListPrefix(prefix, continueKey string) []interface{} Count(prefix, continueKey string) (count int) - Clone() orderedLister + Clone() OrderedLister } -func newStoreIndexer(indexers *cache.Indexers) storeIndexer { +func NewIndexer(indexers *cache.Indexers) Indexer { if utilfeature.DefaultFeatureGate.Enabled(features.BtreeWatchCache) { - return newThreadedBtreeStoreIndexer(storeElementIndexers(indexers), btreeDegree) + return newThreadedBtreeStoreIndexer(ElementIndexers(indexers), btreeDegree) } - return cache.NewIndexer(storeElementKey, storeElementIndexers(indexers)) + return cache.NewIndexer(ElementKey, ElementIndexers(indexers)) } // Computing a key of an object is generally non-trivial (it performs @@ -90,32 +90,32 @@ func newStoreIndexer(indexers *cache.Indexers) storeIndexer { // labels. To avoid computing them multiple times (to serve the event // in different List/Watch requests), in the underlying store we are // keeping structs (key, object, labels, fields). -type storeElement struct { +type Element struct { Key string Object runtime.Object Labels labels.Set Fields fields.Set } -func storeElementKey(obj interface{}) (string, error) { - elem, ok := obj.(*storeElement) +func ElementKey(obj interface{}) (string, error) { + elem, ok := obj.(*Element) if !ok { return "", fmt.Errorf("not a storeElement: %v", obj) } return elem.Key, nil } -func storeElementObject(obj interface{}) (runtime.Object, error) { - elem, ok := obj.(*storeElement) +func ElementObject(obj interface{}) (runtime.Object, error) { + elem, ok := obj.(*Element) if !ok { return nil, fmt.Errorf("not a storeElement: %v", obj) } return elem.Object, nil } -func storeElementIndexFunc(objIndexFunc cache.IndexFunc) cache.IndexFunc { +func ElementIndexFunc(objIndexFunc cache.IndexFunc) cache.IndexFunc { return func(obj interface{}) (strings []string, e error) { - seo, err := storeElementObject(obj) + seo, err := ElementObject(obj) if err != nil { return nil, err } @@ -123,13 +123,13 @@ func storeElementIndexFunc(objIndexFunc cache.IndexFunc) cache.IndexFunc { } } -func storeElementIndexers(indexers *cache.Indexers) cache.Indexers { +func ElementIndexers(indexers *cache.Indexers) cache.Indexers { if indexers == nil { return cache.Indexers{} } ret := cache.Indexers{} for indexName, indexFunc := range *indexers { - ret[indexName] = storeElementIndexFunc(indexFunc) + ret[indexName] = ElementIndexFunc(indexFunc) } return ret } diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/store_btree.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store_btree.go similarity index 86% rename from vendor/k8s.io/apiserver/pkg/storage/cacher/store_btree.go rename to vendor/k8s.io/apiserver/pkg/storage/cacher/store/store_btree.go index 9908e2f64b..33e8e4f102 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/store_btree.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/store/store_btree.go @@ -14,15 +14,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cacher +package store import ( "fmt" "strings" "sync" - "github.com/google/btree" "k8s.io/client-go/tools/cache" + "k8s.io/utils/third_party/forked/golang/btree" ) // newThreadedBtreeStoreIndexer returns a storage for cacher by adding locking over the two 2 data structures: @@ -43,7 +43,7 @@ type threadedStoreIndexer struct { indexer indexer } -var _ orderedLister = (*threadedStoreIndexer)(nil) +var _ OrderedLister = (*threadedStoreIndexer)(nil) func (si *threadedStoreIndexer) Count(prefix, continueKey string) (count int) { si.lock.RLock() @@ -51,7 +51,7 @@ func (si *threadedStoreIndexer) Count(prefix, continueKey string) (count int) { return si.store.Count(prefix, continueKey) } -func (si *threadedStoreIndexer) Clone() orderedLister { +func (si *threadedStoreIndexer) Clone() OrderedLister { si.lock.RLock() defer si.lock.RUnlock() return si.store.Clone() @@ -69,7 +69,7 @@ func (si *threadedStoreIndexer) addOrUpdate(obj interface{}) error { if obj == nil { return fmt.Errorf("obj cannot be nil") } - newElem, ok := obj.(*storeElement) + newElem, ok := obj.(*Element) if !ok { return fmt.Errorf("obj not a storeElement: %#v", obj) } @@ -80,7 +80,7 @@ func (si *threadedStoreIndexer) addOrUpdate(obj interface{}) error { } func (si *threadedStoreIndexer) Delete(obj interface{}) error { - storeElem, ok := obj.(*storeElement) + storeElem, ok := obj.(*Element) if !ok { return fmt.Errorf("obj not a storeElement: %#v", obj) } @@ -141,17 +141,17 @@ func (si *threadedStoreIndexer) ByIndex(indexName, indexValue string) ([]interfa func newBtreeStore(degree int) btreeStore { return btreeStore{ - tree: btree.NewG(degree, func(a, b *storeElement) bool { + tree: btree.New(degree, func(a, b *Element) bool { return a.Key < b.Key }), } } type btreeStore struct { - tree *btree.BTreeG[*storeElement] + tree *btree.BTree[*Element] } -func (s *btreeStore) Clone() orderedLister { +func (s *btreeStore) Clone() OrderedLister { return &btreeStore{ tree: s.tree.Clone(), } @@ -161,7 +161,7 @@ func (s *btreeStore) Add(obj interface{}) error { if obj == nil { return fmt.Errorf("obj cannot be nil") } - storeElem, ok := obj.(*storeElement) + storeElem, ok := obj.(*Element) if !ok { return fmt.Errorf("obj not a storeElement: %#v", obj) } @@ -173,7 +173,7 @@ func (s *btreeStore) Update(obj interface{}) error { if obj == nil { return fmt.Errorf("obj cannot be nil") } - storeElem, ok := obj.(*storeElement) + storeElem, ok := obj.(*Element) if !ok { return fmt.Errorf("obj not a storeElement: %#v", obj) } @@ -185,7 +185,7 @@ func (s *btreeStore) Delete(obj interface{}) error { if obj == nil { return fmt.Errorf("obj cannot be nil") } - storeElem, ok := obj.(*storeElement) + storeElem, ok := obj.(*Element) if !ok { return fmt.Errorf("obj not a storeElement: %#v", obj) } @@ -193,13 +193,13 @@ func (s *btreeStore) Delete(obj interface{}) error { return nil } -func (s *btreeStore) deleteElem(storeElem *storeElement) (*storeElement, bool) { +func (s *btreeStore) deleteElem(storeElem *Element) (*Element, bool) { return s.tree.Delete(storeElem) } func (s *btreeStore) List() []interface{} { items := make([]interface{}, 0, s.tree.Len()) - s.tree.Ascend(func(item *storeElement) bool { + s.tree.Ascend(func(item *Element) bool { items = append(items, item) return true }) @@ -208,7 +208,7 @@ func (s *btreeStore) List() []interface{} { func (s *btreeStore) ListKeys() []string { items := make([]string, 0, s.tree.Len()) - s.tree.Ascend(func(item *storeElement) bool { + s.tree.Ascend(func(item *Element) bool { items = append(items, item.Key) return true }) @@ -216,7 +216,7 @@ func (s *btreeStore) ListKeys() []string { } func (s *btreeStore) Get(obj interface{}) (item interface{}, exists bool, err error) { - storeElem, ok := obj.(*storeElement) + storeElem, ok := obj.(*Element) if !ok { return nil, false, fmt.Errorf("obj is not a storeElement") } @@ -231,7 +231,7 @@ func (s *btreeStore) GetByKey(key string) (item interface{}, exists bool, err er func (s *btreeStore) Replace(objs []interface{}, _ string) error { s.tree.Clear(false) for _, obj := range objs { - storeElem, ok := obj.(*storeElement) + storeElem, ok := obj.(*Element) if !ok { return fmt.Errorf("obj not a storeElement: %#v", obj) } @@ -242,13 +242,13 @@ func (s *btreeStore) Replace(objs []interface{}, _ string) error { // addOrUpdateLocked assumes a lock is held and is used for Add // and Update operations. -func (s *btreeStore) addOrUpdateElem(storeElem *storeElement) *storeElement { +func (s *btreeStore) addOrUpdateElem(storeElem *Element) *Element { oldObj, _ := s.tree.ReplaceOrInsert(storeElem) return oldObj } func (s *btreeStore) getByKey(key string) (item interface{}, exists bool, err error) { - keyElement := &storeElement{Key: key} + keyElement := &Element{Key: key} item, exists = s.tree.Get(keyElement) return item, exists, nil } @@ -258,7 +258,7 @@ func (s *btreeStore) ListPrefix(prefix, continueKey string) []interface{} { continueKey = prefix } var result []interface{} - s.tree.AscendGreaterOrEqual(&storeElement{Key: continueKey}, func(item *storeElement) bool { + s.tree.AscendGreaterOrEqual(&Element{Key: continueKey}, func(item *Element) bool { if !strings.HasPrefix(item.Key, prefix) { return false } @@ -272,7 +272,7 @@ func (s *btreeStore) Count(prefix, continueKey string) (count int) { if continueKey == "" { continueKey = prefix } - s.tree.AscendGreaterOrEqual(&storeElement{Key: continueKey}, func(item *storeElement) bool { + s.tree.AscendGreaterOrEqual(&Element{Key: continueKey}, func(item *Element) bool { if !strings.HasPrefix(item.Key, prefix) { return false } @@ -292,13 +292,13 @@ func (s *btreeStore) Count(prefix, continueKey string) (count int) { // Difference in mutability of stored values is used for optimizing some operations in client-go Indexer. func newIndexer(indexers cache.Indexers) indexer { return indexer{ - indices: map[string]map[string]map[string]*storeElement{}, + indices: map[string]map[string]map[string]*Element{}, indexers: indexers, } } type indexer struct { - indices map[string]map[string]map[string]*storeElement + indices map[string]map[string]map[string]*Element indexers cache.Indexers } @@ -317,9 +317,9 @@ func (i *indexer) ByIndex(indexName, indexValue string) ([]interface{}, error) { } func (i *indexer) Replace(objs []interface{}, resourceVersion string) error { - i.indices = map[string]map[string]map[string]*storeElement{} + i.indices = map[string]map[string]map[string]*Element{} for _, obj := range objs { - storeElem, ok := obj.(*storeElement) + storeElem, ok := obj.(*Element) if !ok { return fmt.Errorf("obj not a storeElement: %#v", obj) } @@ -331,7 +331,7 @@ func (i *indexer) Replace(objs []interface{}, resourceVersion string) error { return nil } -func (i *indexer) updateElem(key string, oldObj, newObj *storeElement) (err error) { +func (i *indexer) updateElem(key string, oldObj, newObj *Element) (err error) { var oldIndexValues, indexValues []string for name, indexFunc := range i.indexers { if oldObj != nil { @@ -352,7 +352,7 @@ func (i *indexer) updateElem(key string, oldObj, newObj *storeElement) (err erro } index := i.indices[name] if index == nil { - index = map[string]map[string]*storeElement{} + index = map[string]map[string]*Element{} i.indices[name] = index } if len(indexValues) == 1 && len(oldIndexValues) == 1 && indexValues[0] == oldIndexValues[0] { @@ -370,16 +370,16 @@ func (i *indexer) updateElem(key string, oldObj, newObj *storeElement) (err erro return nil } -func (i *indexer) add(key, value string, obj *storeElement, index map[string]map[string]*storeElement) { +func (i *indexer) add(key, value string, obj *Element, index map[string]map[string]*Element) { set := index[value] if set == nil { - set = map[string]*storeElement{} + set = map[string]*Element{} index[value] = set } set[key] = obj } -func (i *indexer) delete(key, value string, index map[string]map[string]*storeElement) { +func (i *indexer) delete(key, value string, index map[string]map[string]*Element) { set := index[value] if set == nil { return @@ -426,9 +426,9 @@ func (i *indexer) delete(key, value string, index map[string]map[string]*storeEl // However, this solution is more complex and is deferred for future implementation. // // TODO: Rewrite to use a cyclic buffer -func newStoreSnapshotter() *storeSnapshotter { +func NewSnapshotter() Snapshotter { s := &storeSnapshotter{ - snapshots: btree.NewG[rvSnapshot](btreeDegree, func(a, b rvSnapshot) bool { + snapshots: btree.New(btreeDegree, func(a, b rvSnapshot) bool { return a.resourceVersion < b.resourceVersion }), } @@ -439,20 +439,20 @@ var _ Snapshotter = (*storeSnapshotter)(nil) type Snapshotter interface { Reset() - GetLessOrEqual(rv uint64) (orderedLister, bool) - Add(rv uint64, indexer orderedLister) + GetLessOrEqual(rv uint64) (OrderedLister, bool) + Add(rv uint64, indexer OrderedLister) RemoveLess(rv uint64) Len() int } type storeSnapshotter struct { mux sync.RWMutex - snapshots *btree.BTreeG[rvSnapshot] + snapshots *btree.BTree[rvSnapshot] } type rvSnapshot struct { resourceVersion uint64 - snapshot orderedLister + snapshot OrderedLister } func (s *storeSnapshotter) Reset() { @@ -461,7 +461,7 @@ func (s *storeSnapshotter) Reset() { s.snapshots.Clear(false) } -func (s *storeSnapshotter) GetLessOrEqual(rv uint64) (orderedLister, bool) { +func (s *storeSnapshotter) GetLessOrEqual(rv uint64) (OrderedLister, bool) { s.mux.RLock() defer s.mux.RUnlock() @@ -476,7 +476,7 @@ func (s *storeSnapshotter) GetLessOrEqual(rv uint64) (orderedLister, bool) { return result.snapshot, true } -func (s *storeSnapshotter) Add(rv uint64, indexer orderedLister) { +func (s *storeSnapshotter) Add(rv uint64, indexer OrderedLister) { s.mux.Lock() defer s.mux.Unlock() s.snapshots.ReplaceOrInsert(rvSnapshot{resourceVersion: rv, snapshot: indexer.Clone()}) diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go index 620b0f36bd..fc73708a8c 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache.go @@ -37,6 +37,7 @@ import ( "k8s.io/apiserver/pkg/storage/cacher/delegator" "k8s.io/apiserver/pkg/storage/cacher/metrics" "k8s.io/apiserver/pkg/storage/cacher/progress" + "k8s.io/apiserver/pkg/storage/cacher/store" utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/tools/cache" "k8s.io/component-base/tracing" @@ -121,7 +122,7 @@ type watchCache struct { // history" i.e. from the moment just after the newest cached watched event. // It is necessary to effectively allow clients to start watching at now. // NOTE: We assume that is thread-safe. - store storeIndexer + store store.Indexer // ResourceVersion up to which the watchCache is propagated. resourceVersion uint64 @@ -156,7 +157,7 @@ type watchCache struct { waitingUntilFresh *progress.ConditionalProgressRequester // Stores previous snapshots of orderedLister to allow serving requests from previous revisions. - snapshots Snapshotter + snapshots store.Snapshotter snapshottingEnabled atomic.Bool getCurrentRV func(context.Context) (uint64, error) @@ -183,7 +184,7 @@ func newWatchCache( upperBoundCapacity: capacityUpperBound(eventFreshDuration), startIndex: 0, endIndex: 0, - store: newStoreIndexer(indexers), + store: store.NewIndexer(indexers), resourceVersion: 0, listResourceVersion: 0, eventHandler: eventHandler, @@ -196,7 +197,7 @@ func newWatchCache( } if utilfeature.DefaultFeatureGate.Enabled(features.ListFromCacheSnapshot) { wc.snapshottingEnabled.Store(true) - wc.snapshots = newStoreSnapshotter() + wc.snapshots = store.NewSnapshotter() } metrics.WatchCacheCapacity.WithLabelValues(groupResource.Group, groupResource.Resource).Set(float64(wc.capacity)) wc.cond = sync.NewCond(wc.RLocker()) @@ -237,7 +238,7 @@ func (w *watchCache) Add(obj interface{}) error { } event := watch.Event{Type: watch.Added, Object: object} - f := func(elem *storeElement) error { return w.store.Add(elem) } + f := func(elem *store.Element) error { return w.store.Add(elem) } return w.processEvent(event, resourceVersion, f) } @@ -249,7 +250,7 @@ func (w *watchCache) Update(obj interface{}) error { } event := watch.Event{Type: watch.Modified, Object: object} - f := func(elem *storeElement) error { return w.store.Update(elem) } + f := func(elem *store.Element) error { return w.store.Update(elem) } return w.processEvent(event, resourceVersion, f) } @@ -261,7 +262,7 @@ func (w *watchCache) Delete(obj interface{}) error { } event := watch.Event{Type: watch.Deleted, Object: object} - f := func(elem *storeElement) error { return w.store.Delete(elem) } + f := func(elem *store.Element) error { return w.store.Delete(elem) } return w.processEvent(event, resourceVersion, f) } @@ -279,14 +280,14 @@ func (w *watchCache) objectToVersionedRuntimeObject(obj interface{}) (runtime.Ob // processEvent is safe as long as there is at most one call to it in flight // at any point in time. -func (w *watchCache) processEvent(event watch.Event, resourceVersion uint64, updateFunc func(*storeElement) error) error { +func (w *watchCache) processEvent(event watch.Event, resourceVersion uint64, updateFunc func(*store.Element) error) error { metrics.EventsReceivedCounter.WithLabelValues(w.groupResource.Group, w.groupResource.Resource).Inc() key, err := w.keyFunc(event.Object) if err != nil { return fmt.Errorf("couldn't compute key: %v", err) } - elem := &storeElement{Key: key, Object: event.Object} + elem := &store.Element{Key: key, Object: event.Object} elem.Labels, elem.Fields, err = w.getAttrsFunc(event.Object) if err != nil { return err @@ -312,7 +313,7 @@ func (w *watchCache) processEvent(event watch.Event, resourceVersion uint64, upd return err } if exists { - previousElem := previous.(*storeElement) + previousElem := previous.(*store.Element) wcEvent.PrevObject = previousElem.Object wcEvent.PrevObjLabels = previousElem.Labels wcEvent.PrevObjFields = previousElem.Fields @@ -331,7 +332,7 @@ func (w *watchCache) processEvent(event watch.Event, resourceVersion uint64, upd return err } if w.snapshots != nil && w.snapshottingEnabled.Load() { - if orderedLister, ordered := w.store.(orderedLister); ordered { + if orderedLister, ordered := w.store.(store.OrderedLister); ordered { if w.isCacheFullLocked() { oldestRV := w.cache[w.startIndex%w.capacity].ResourceVersion w.snapshots.RemoveLess(oldestRV) @@ -437,7 +438,7 @@ func (w *watchCache) UpdateResourceVersion(resourceVersion string) { metrics.RecordResourceVersion(w.groupResource, rv) } -// List returns list of pointers to objects. +// List returns list of pointers to objects. func (w *watchCache) List() []interface{} { return w.store.List() } @@ -495,7 +496,7 @@ func (s sortableStoreElements) Len() int { } func (s sortableStoreElements) Less(i, j int) bool { - return s[i].(*storeElement).Key < s[j].(*storeElement).Key + return s[i].(*store.Element).Key < s[j].(*store.Element).Key } func (s sortableStoreElements) Swap(i, j int) { @@ -652,7 +653,7 @@ func (w *watchCache) listLatestRV(key, continueKey string, matchValues []storage }, matchValue.IndexName, err } } - if store, ok := w.store.(orderedLister); ok { + if store, ok := w.store.(store.OrderedLister); ok { result := store.ListPrefix(key, continueKey) return listResp{ Items: result, @@ -670,9 +671,9 @@ func (w *watchCache) listLatestRV(key, continueKey string, matchValues []storage func filterPrefixAndOrder(prefix string, items []interface{}) ([]interface{}, error) { var result []interface{} for _, item := range items { - elem, ok := item.(*storeElement) + elem, ok := item.(*store.Element) if !ok { - return nil, fmt.Errorf("non *storeElement returned from storage: %v", item) + return nil, fmt.Errorf("non *store.Element returned from storage: %v", item) } if !hasPathPrefix(elem.Key, prefix) { continue @@ -723,7 +724,7 @@ func (w *watchCache) Get(obj interface{}) (interface{}, bool, error) { return nil, false, fmt.Errorf("couldn't compute key: %v", err) } - return w.store.Get(&storeElement{Key: key, Object: object}) + return w.store.Get(&store.Element{Key: key, Object: object}) } // GetByKey returns pointer to . @@ -752,7 +753,7 @@ func (w *watchCache) Replace(objs []interface{}, resourceVersion string) error { if err != nil { return err } - toReplace = append(toReplace, &storeElement{ + toReplace = append(toReplace, &store.Element{ Key: key, Object: object, Labels: objLabels, @@ -777,7 +778,7 @@ func (w *watchCache) Replace(objs []interface{}, resourceVersion string) error { } if w.snapshots != nil { w.snapshots.Reset() - if orderedLister, ordered := w.store.(orderedLister); ordered && w.snapshottingEnabled.Load() { + if orderedLister, ordered := w.store.(store.OrderedLister); ordered && w.snapshottingEnabled.Load() { w.snapshots.Add(version, orderedLister) } } diff --git a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go index b74b3ca917..8cdcac370f 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go +++ b/vendor/k8s.io/apiserver/pkg/storage/cacher/watch_cache_interval.go @@ -22,6 +22,7 @@ import ( "sync" "k8s.io/apimachinery/pkg/watch" + "k8s.io/apiserver/pkg/storage/cacher/store" ) // watchCacheInterval serves as an abstraction over a source @@ -136,11 +137,11 @@ func (s sortableWatchCacheEvents) Swap(i, j int) { // returned by Next() need to be events from a List() done on the underlying store of // the watch cache. // The items returned in the interval will be sorted by Key. -func newCacheIntervalFromStore(resourceVersion uint64, store storeIndexer, key string, matchesSingle bool) (*watchCacheInterval, error) { +func newCacheIntervalFromStore(resourceVersion uint64, indexer store.Indexer, key string, matchesSingle bool) (*watchCacheInterval, error) { buffer := &watchCacheIntervalBuffer{} var allItems []interface{} if matchesSingle { - item, exists, err := store.GetByKey(key) + item, exists, err := indexer.GetByKey(key) if err != nil { return nil, err } @@ -149,11 +150,11 @@ func newCacheIntervalFromStore(resourceVersion uint64, store storeIndexer, key s allItems = append(allItems, item) } } else { - allItems = store.List() + allItems = indexer.List() } buffer.buffer = make([]*watchCacheEvent, len(allItems)) for i, item := range allItems { - elem, ok := item.(*storeElement) + elem, ok := item.(*store.Element) if !ok { return nil, fmt.Errorf("not a storeElement: %v", elem) } diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go index 78f08fb615..6bfec87116 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/metrics/metrics.go @@ -112,13 +112,22 @@ var ( Subsystem: "apiserver", Name: "storage_events_received_total", Help: "Number of etcd events received split by kind.", - StabilityLevel: compbasemetrics.ALPHA, + StabilityLevel: compbasemetrics.BETA, }, []string{"group", "resource"}, ) etcdBookmarkCounts = compbasemetrics.NewGaugeVec( &compbasemetrics.GaugeOpts{ - Name: "etcd_bookmark_counts", + Name: "etcd_bookmark_counts", + Help: "Number of etcd bookmarks (progress notify events) split by kind.", + StabilityLevel: compbasemetrics.ALPHA, + DeprecatedVersion: "1.36.0", + }, + []string{"group", "resource"}, + ) + etcdBookmarkTotal = compbasemetrics.NewCounterVec( + &compbasemetrics.CounterOpts{ + Name: "etcd_bookmark_total", Help: "Number of etcd bookmarks (progress notify events) split by kind.", StabilityLevel: compbasemetrics.ALPHA, }, @@ -192,6 +201,7 @@ func Register() { legacyregistry.CustomMustRegister(storageMonitor) legacyregistry.MustRegister(etcdEventsReceivedCounts) legacyregistry.MustRegister(etcdBookmarkCounts) + legacyregistry.MustRegister(etcdBookmarkTotal) legacyregistry.MustRegister(etcdLeaseObjectCounts) legacyregistry.MustRegister(listStorageCount) legacyregistry.MustRegister(listStorageNumFetched) @@ -246,9 +256,10 @@ func RecordEtcdEvent(groupResource schema.GroupResource) { etcdEventsReceivedCounts.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() } -// RecordEtcdBookmark updates the etcd_bookmark_counts metric. +// RecordEtcdBookmark updates the etcd_bookmark_total metric. func RecordEtcdBookmark(groupResource schema.GroupResource) { etcdBookmarkCounts.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() + etcdBookmarkTotal.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() } // RecordDecodeError sets the storage_decode_errors metrics. @@ -286,7 +297,7 @@ func UpdateLeaseObjectCount(count int64) { etcdLeaseObjectCounts.WithLabelValues().Observe(float64(count)) } -// RecordListEtcd3Metrics notes various metrics of the cost to serve a LIST request +// RecordStorageListMetrics notes various metrics of the cost to serve a LIST request func RecordStorageListMetrics(groupResource schema.GroupResource, numFetched, numEvald, numReturned int) { listStorageCount.WithLabelValues(groupResource.Group, groupResource.Resource).Inc() listStorageNumFetched.WithLabelValues(groupResource.Group, groupResource.Resource).Add(float64(numFetched)) diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go index 798567d1cd..8384832335 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/store.go @@ -895,7 +895,13 @@ func (s *store) GetList(ctx context.Context, key string, opts storage.ListOption if err != nil { return err } - return s.versioner.UpdateList(listObj, uint64(withRev), continueValue, remainingItemCount) + if err := s.versioner.UpdateList(listObj, uint64(withRev), continueValue, remainingItemCount); err != nil { + return err + } + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + opts.Predicate.SetShardInfoOnList(listObj) + } + return nil } func (s *store) getList(ctx context.Context, keyPrefix string, recursive bool, options kubernetes.ListOptions) (resp kubernetes.ListResponse, err error) { diff --git a/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go b/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go index cf16606bc5..0559383f8d 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go +++ b/vendor/k8s.io/apiserver/pkg/storage/etcd3/watcher.go @@ -24,6 +24,7 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "time" clientv3 "go.etcd.io/etcd/client/v3" @@ -55,17 +56,17 @@ const ( var defaultWatcherMaxLimit int64 = maxLimit // fatalOnDecodeError is used during testing to panic the server if watcher encounters a decoding error -var fatalOnDecodeError = false +var fatalOnDecodeError atomic.Bool func init() { // check to see if we are running in a test environment - TestOnlySetFatalOnDecodeError(true) - fatalOnDecodeError, _ = strconv.ParseBool(os.Getenv("KUBE_PANIC_WATCH_DECODE_ERROR")) + b, _ := strconv.ParseBool(os.Getenv("KUBE_PANIC_WATCH_DECODE_ERROR")) + TestOnlySetFatalOnDecodeError(b) } // TestOnlySetFatalOnDecodeError should only be used for cases where decode errors are expected and need to be tested. e.g. conversion webhooks. func TestOnlySetFatalOnDecodeError(b bool) { - fatalOnDecodeError = b + fatalOnDecodeError.Store(b) } type watcher struct { @@ -758,7 +759,7 @@ func (w *watcher) transformIfCorruptObjectError(e *event, err error) error { func decodeObj(codec runtime.Codec, versioner storage.Versioner, data []byte, rev int64) (_ runtime.Object, err error) { obj, err := runtime.Decode(codec, []byte(data)) if err != nil { - if fatalOnDecodeError { + if fatalOnDecodeError.Load() { // we are running in a test environment and thus an // error here is due to a coder mistake if the defer // does not catch it diff --git a/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go b/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go index 77f5ab05c9..e664d22a64 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go +++ b/vendor/k8s.io/apiserver/pkg/storage/feature/feature_support_checker.go @@ -109,7 +109,7 @@ func (f *defaultFeatureSupportChecker) checkClient(ctx context.Context, c client } f.checkingEndpoint[ep] = struct{}{} go func(ep string) { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithContext(ctx) err := delayFunc.Until(ctx, true, true, func(ctx context.Context) (done bool, err error) { internalErr := f.clientSupportsRequestWatchProgress(ctx, c, ep) return internalErr == nil, nil diff --git a/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go b/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go index 480b5a8934..37d470b254 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go +++ b/vendor/k8s.io/apiserver/pkg/storage/selection_predicate.go @@ -20,10 +20,14 @@ import ( "context" "k8s.io/apimachinery/pkg/api/meta" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/sharding" "k8s.io/apiserver/pkg/endpoints/request" + "k8s.io/apiserver/pkg/features" + utilfeature "k8s.io/apiserver/pkg/util/feature" ) // AttrFunc returns label and field sets and the uninitialized flag for List or Watch to match. @@ -82,12 +86,19 @@ type SelectionPredicate struct { Limit int64 Continue string AllowWatchBookmarks bool + // ShardSelector is the parsed shard selector for filtering objects by hash range. + ShardSelector sharding.Selector } // Matches returns true if the given object's labels and fields (as // returned by s.GetAttrs) match s.Label and s.Field. An error is // returned if s.GetAttrs fails. func (s *SelectionPredicate) Matches(obj runtime.Object) (bool, error) { + if utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + if matched, err := s.MatchesSharding(obj); err != nil || !matched { + return matched, err + } + } if s.Empty() { return true, nil } @@ -168,6 +179,30 @@ func (s *SelectionPredicate) MatcherIndex(ctx context.Context) []MatchValue { return result } +// MatchesSharding returns true if the given object matches the sharding configuration. +// If ShardSelector is set and non-empty, it delegates to ShardSelector.Matches(). +func (s *SelectionPredicate) MatchesSharding(obj runtime.Object) (bool, error) { + if !utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + return true, nil + } + if s.ShardSelector != nil && !s.ShardSelector.Empty() { + return s.ShardSelector.Matches(obj) + } + return true, nil +} + +// SetShardInfoOnList sets shard metadata on the list response if sharding is active. +func (s *SelectionPredicate) SetShardInfoOnList(listObj runtime.Object) { + if !utilfeature.DefaultFeatureGate.Enabled(features.ShardedListAndWatch) { + return + } + if s.ShardSelector != nil && !s.ShardSelector.Empty() { + if setter, ok := listObj.(metav1.ShardedListInterface); ok { + setter.SetShardInfo(&metav1.ShardInfo{Selector: s.ShardSelector.String()}) + } + } +} + func isNamespaceScopedRequest(ctx context.Context) (string, bool) { re, _ := request.RequestInfoFrom(ctx) if re == nil || len(re.Namespace) == 0 { diff --git a/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go b/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go index 53fc9f97a7..6b60601a78 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go +++ b/vendor/k8s.io/apiserver/pkg/storage/storagebackend/factory/etcd3.go @@ -29,7 +29,7 @@ import ( "sync" "time" - grpcprom "github.com/grpc-ecosystem/go-grpc-prometheus" + grpcprom "github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus" "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/client/pkg/v3/transport" clientv3 "go.etcd.io/etcd/client/v3" @@ -79,12 +79,15 @@ const ( // https://github.com/kubernetes/kubernetes/issues/111476 for more. var etcd3ClientLogger *zap.Logger +// grpcpromClientMetrics is a singleton instance of grpc client prometheus metrics. +var grpcpromClientMetrics = grpcprom.NewClientMetrics() + func init() { - // grpcprom auto-registers (via an init function) their client metrics, since we are opting out of - // using the global prometheus registry and using our own wrapped global registry, - // we need to explicitly register these metrics to our global registry here. + // Since we are opting out of using the global prometheus registry and using + // our own wrapped global registry, we need to explicitly register the client + // metrics to our global registry here. // For reference: https://github.com/kubernetes/kubernetes/pull/81387 - legacyregistry.RawMustRegister(grpcprom.DefaultClientMetrics) + legacyregistry.RawMustRegister(grpcpromClientMetrics) dbMetricsMonitors = make(map[string]struct{}) l, err := logutil.CreateDefaultZapLogger(etcdClientDebugLevel()) @@ -313,8 +316,8 @@ var newETCD3Client = func(c storagebackend.TransportConfig) (*kubernetes.Client, // // these optional interceptors will be placed after the default ones. // which seems to be what we want as the metrics will be collected on each attempt (retry) - grpc.WithChainUnaryInterceptor(grpcprom.UnaryClientInterceptor), - grpc.WithChainStreamInterceptor(grpcprom.StreamClientInterceptor), + grpc.WithChainUnaryInterceptor(grpcpromClientMetrics.UnaryClientInterceptor()), + grpc.WithChainStreamInterceptor(grpcpromClientMetrics.StreamClientInterceptor()), } if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIServerTracing) { tracingOpts := []otelgrpc.Option{ diff --git a/vendor/k8s.io/apiserver/pkg/storage/util.go b/vendor/k8s.io/apiserver/pkg/storage/util.go index 3ca9acf3bd..941422ef5e 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/util.go +++ b/vendor/k8s.io/apiserver/pkg/storage/util.go @@ -22,7 +22,7 @@ import ( "sync/atomic" "k8s.io/apimachinery/pkg/api/meta" - "k8s.io/apimachinery/pkg/api/validation/path" + "k8s.io/apimachinery/pkg/api/validate/content" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" ) @@ -46,7 +46,7 @@ func NamespaceKeyFunc(prefix string, obj runtime.Object) (string, error) { return "", err } name := meta.GetName() - if msgs := path.IsValidPathSegmentName(name); len(msgs) != 0 { + if msgs := content.IsPathSegmentName(name); len(msgs) != 0 { return "", fmt.Errorf("invalid name: %v", msgs) } return prefix + meta.GetNamespace() + "/" + name, nil @@ -61,7 +61,7 @@ func NoNamespaceKeyFunc(prefix string, obj runtime.Object) (string, error) { return "", err } name := meta.GetName() - if msgs := path.IsValidPathSegmentName(name); len(msgs) != 0 { + if msgs := content.IsPathSegmentName(name); len(msgs) != 0 { return "", fmt.Errorf("invalid name: %v", msgs) } return prefix + name, nil diff --git a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/grpc_service.go b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/grpc_service.go index b2a5fd145c..a5987c7893 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/grpc_service.go +++ b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/grpc_service.go @@ -86,7 +86,7 @@ func NewGRPCService(ctx context.Context, endpoint string, callTimeout time.Durat s.kmsClient = kmsapi.NewKeyManagementServiceClient(s.connection) go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) <-ctx.Done() _ = s.connection.Close() diff --git a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/envelope.go b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/envelope.go index 4549257a03..01947eb053 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/envelope.go +++ b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/envelope.go @@ -523,7 +523,6 @@ func generateCacheKey(encryptedDEKSourceType kmstypes.EncryptedDEKSourceType, en // Sort the annotations by key. keys := make([]string, 0, len(annotations)) for k := range annotations { - k := k keys = append(keys, k) } sort.Strings(keys) diff --git a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/grpc_service.go b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/grpc_service.go index 78cc02e57a..7cd7d1ce2b 100644 --- a/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/grpc_service.go +++ b/vendor/k8s.io/apiserver/pkg/storage/value/encrypt/envelope/kmsv2/grpc_service.go @@ -83,7 +83,7 @@ func NewGRPCService(ctx context.Context, endpoint, providerName string, callTime s.kmsClient = kmsapi.NewKeyManagementServiceClient(s.connection) go func() { - defer utilruntime.HandleCrash() + defer utilruntime.HandleCrashWithContext(ctx) <-ctx.Done() _ = s.connection.Close() diff --git a/vendor/k8s.io/apiserver/pkg/util/filesystem/watchuntil.go b/vendor/k8s.io/apiserver/pkg/util/filesystem/watchuntil.go new file mode 100644 index 0000000000..fe594e4bfb --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/util/filesystem/watchuntil.go @@ -0,0 +1,149 @@ +/* +Copyright 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. +*/ + +package filesystem + +import ( + "context" + "fmt" + "time" + + "github.com/fsnotify/fsnotify" +) + +type watchAddRemover interface { + Add(path string) error + Remove(path string) error +} + +type noopWatcher struct{} + +func (noopWatcher) Add(path string) error { return nil } +func (noopWatcher) Remove(path string) error { return nil } + +// WatchUntil watches the specified path for changes and blocks until ctx is canceled. +// eventHandler() must be non-nil, and pollInterval must be greater than 0. +// eventHandler() is invoked whenever a change event is observed or pollInterval elapses. +// errorHandler() is invoked (if non-nil) whenever an error occurs initializing or watching the specified path. +// +// If path is a directory, only the directory and immediate children are watched. +// +// If path does not exist or cannot be watched, an error is passed to errorHandler() and eventHandler() is called at pollInterval. +// +// Multiple observed events may collapse to a single invocation of eventHandler(). +// +// eventHandler() is invoked immediately after successful initialization of the filesystem watch, +// in case the path changed concurrent with calling WatchUntil(). +func WatchUntil(ctx context.Context, pollInterval time.Duration, path string, eventHandler func(), errorHandler func(err error)) { + if pollInterval <= 0 { + panic(fmt.Errorf("pollInterval must be > 0")) + } + if eventHandler == nil { + panic(fmt.Errorf("eventHandler must be non-nil")) + } + if errorHandler == nil { + errorHandler = func(err error) {} + } + + // Initialize watcher, fall back to no-op + var ( + eventsCh chan fsnotify.Event + errorCh chan error + watcher watchAddRemover + ) + if w, err := fsnotify.NewWatcher(); err != nil { + errorHandler(fmt.Errorf("error creating file watcher, falling back to poll at interval %s: %w", pollInterval, err)) + watcher = noopWatcher{} + } else { + watcher = w + eventsCh = w.Events + errorCh = w.Errors + defer func() { + _ = w.Close() + }() + } + + // Initialize background poll + t := time.NewTicker(pollInterval) + defer t.Stop() + + attemptPeriodicRewatch := false + + // Start watching the path + if err := watcher.Add(path); err != nil { + errorHandler(err) + attemptPeriodicRewatch = true + } else { + // Invoke handle() at least once after successfully registering the listener, + // in case the file changed concurrent with calling WatchUntil. + eventHandler() + } + + for { + select { + case <-ctx.Done(): + return + + case <-t.C: + // Prioritize exiting if context is canceled + if ctx.Err() != nil { + return + } + + // Try to re-establish the watcher if we previously got a watch error + if attemptPeriodicRewatch { + _ = watcher.Remove(path) + if err := watcher.Add(path); err != nil { + errorHandler(err) + } else { + attemptPeriodicRewatch = false + } + } + + // Handle + eventHandler() + + case e := <-eventsCh: + // Prioritize exiting if context is canceled + if ctx.Err() != nil { + return + } + + // Try to re-establish the watcher for events which dropped the existing watch + if e.Name == path && (e.Has(fsnotify.Remove) || e.Has(fsnotify.Rename)) { + _ = watcher.Remove(path) + if err := watcher.Add(path); err != nil { + errorHandler(err) + attemptPeriodicRewatch = true + } + } + + // Handle + eventHandler() + + case err := <-errorCh: + // Prioritize exiting if context is canceled + if ctx.Err() != nil { + return + } + + // If the error occurs in response to calling watcher.Add, re-adding here could hot-loop. + // The periodic poll will attempt to re-establish the watch. + errorHandler(err) + attemptPeriodicRewatch = true + } + } +} diff --git a/vendor/k8s.io/apiserver/pkg/util/peerproxy/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/util/peerproxy/metrics/metrics.go index 9b7aee4eaa..9c7c5e0410 100644 --- a/vendor/k8s.io/apiserver/pkg/util/peerproxy/metrics/metrics.go +++ b/vendor/k8s.io/apiserver/pkg/util/peerproxy/metrics/metrics.go @@ -27,6 +27,22 @@ import ( const ( subsystem = "apiserver" statuscode = "code" + group = "group" + version = "version" + resource = "resource" + errorType = "type" + + // ProxyErrorEndpointResolution indicates a failure to resolve the network address of a peer apiserver. + ProxyErrorEndpointResolution = "endpoint_resolution" + // ProxyErrorTransport indicates a failure to build the proxy transport for the request. + ProxyErrorTransport = "proxy_transport" + + // DiscoveryErrorLeaseList indicates a failure to list apiserver identity leases. + DiscoveryErrorLeaseList = "lease_list" + // DiscoveryErrorHostPortResolution indicates a failure to resolve host/port from an identity lease. + DiscoveryErrorHostPortResolution = "hostport_resolution" + // DiscoveryErrorFetch indicates a failure to fetch discovery document from a peer. + DiscoveryErrorFetch = "fetch_discovery" ) var registerMetricsOnce sync.Once @@ -37,16 +53,40 @@ var ( &metrics.CounterOpts{ Subsystem: subsystem, Name: "rerouted_request_total", - Help: "Total number of requests that were proxied to a peer kube apiserver because the local apiserver was not capable of serving it", + Help: `Total number of requests that were proxied to a peer kube-apiserver because the local apiserver was not capable of serving it, broken down by 'group', 'version', and 'resource' indicating the GVR of the request. If all three are empty (""), the request is a discovery request.`, + StabilityLevel: metrics.ALPHA, + }, + []string{statuscode, group, version, resource}, + ) + + // peerProxyErrorsTotal counts the number of errors encountered while proxying requests to a peer kube-apiserver. + peerProxyErrorsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Subsystem: subsystem, + Name: "peer_proxy_errors_total", + Help: "Total number of errors encountered while proxying requests to a peer kube apiserver", + StabilityLevel: metrics.ALPHA, + }, + []string{errorType, group, version, resource}, + ) + + // peerDiscoverySyncErrorsTotal counts the number of errors encountered while syncing discovery information from a peer kube-apiserver. + peerDiscoverySyncErrorsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Subsystem: subsystem, + Name: "peer_discovery_sync_errors_total", + Help: "Total number of errors encountered while syncing discovery information from a peer kube-apiserver", StabilityLevel: metrics.ALPHA, }, - []string{statuscode}, + []string{errorType}, ) ) func Register() { registerMetricsOnce.Do(func() { legacyregistry.MustRegister(peerProxiedRequestsTotal) + legacyregistry.MustRegister(peerProxyErrorsTotal) + legacyregistry.MustRegister(peerDiscoverySyncErrorsTotal) }) } @@ -56,6 +96,16 @@ func Reset() { } // IncPeerProxiedRequest increments the # of proxied requests to peer kube-apiserver -func IncPeerProxiedRequest(ctx context.Context, status string) { - peerProxiedRequestsTotal.WithContext(ctx).WithLabelValues(status).Add(1) +func IncPeerProxiedRequest(ctx context.Context, status, g, v, r string) { + peerProxiedRequestsTotal.WithContext(ctx).WithLabelValues(status, g, v, r).Add(1) +} + +// IncPeerProxyError increments the # of errors encountered during peer proxying +func IncPeerProxyError(ctx context.Context, e, g, v, r string) { + peerProxyErrorsTotal.WithContext(ctx).WithLabelValues(e, g, v, r).Add(1) +} + +// IncPeerDiscoverySyncError increments the # of errors encountered during peer discovery sync +func IncPeerDiscoverySyncError(ctx context.Context, e string) { + peerDiscoverySyncErrorsTotal.WithContext(ctx).WithLabelValues(e).Add(1) } diff --git a/vendor/k8s.io/apiserver/pkg/util/proxy/metrics/metrics.go b/vendor/k8s.io/apiserver/pkg/util/proxy/metrics/metrics.go new file mode 100644 index 0000000000..f09724716d --- /dev/null +++ b/vendor/k8s.io/apiserver/pkg/util/proxy/metrics/metrics.go @@ -0,0 +1,101 @@ +/* +Copyright 2024 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. +*/ + +package metrics + +import ( + "context" + "sync" + + "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" +) + +const ( + subsystem = "apiserver" + statuscode = "code" +) + +var registerMetricsOnce sync.Once + +var ( + // streamTranslatorRequestsTotal counts the number of requests that were handled by + // the StreamTranslatorProxy (RemoteCommand subprotocol). + streamTranslatorRequestsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Subsystem: subsystem, + Name: "stream_translator_requests_total", + Help: "Total number of requests that were handled by the StreamTranslatorProxy, which processes streaming RemoteCommand/V5", + StabilityLevel: metrics.ALPHA, + }, + []string{statuscode}, + ) + // streamTunnelRequestsTotal counts the number of requests that were handled by + // the StreamTunnelProxy (PortForward subprotocol). + streamTunnelRequestsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Subsystem: subsystem, + Name: "stream_tunnel_requests_total", + Help: "Total number of requests that were handled by the StreamTunnelProxy, which processes streaming PortForward/V2", + StabilityLevel: metrics.ALPHA, + }, + []string{statuscode}, + ) + // websocketStreamingRequestsTotal counts WebSocket streaming requests (exec/attach/portforward) + // routed by the API server, labeled by subresource and proxy_type. + websocketStreamingRequestsTotal = metrics.NewCounterVec( + &metrics.CounterOpts{ + Subsystem: subsystem, + Name: "websocket_streaming_requests_total", + Help: "Total number of WebSocket streaming requests (exec/attach/portforward) routed by the API server, " + + "labeled by subresource and proxy_type. proxy_type is proxied_to_kubelet when the kubelet " + + "handles the request directly; otherwise translated_at_apiserver.", + StabilityLevel: metrics.ALPHA, + }, + []string{"subresource", "proxy_type"}, + ) +) + +func Register() { + registerMetricsOnce.Do(func() { + legacyregistry.MustRegister(streamTranslatorRequestsTotal) + legacyregistry.MustRegister(streamTunnelRequestsTotal) + legacyregistry.MustRegister(websocketStreamingRequestsTotal) + }) +} + +func ResetForTest() { + streamTranslatorRequestsTotal.Reset() + streamTunnelRequestsTotal.Reset() + websocketStreamingRequestsTotal.Reset() +} + +// IncStreamTranslatorRequest increments the # of requests handled by the StreamTranslatorProxy. +func IncStreamTranslatorRequest(ctx context.Context, status string) { + streamTranslatorRequestsTotal.WithContext(ctx).WithLabelValues(status).Add(1) +} + +// IncStreamTunnelRequest increments the # of requests handled by the StreamTunnelProxy. +func IncStreamTunnelRequest(ctx context.Context, status string) { + streamTunnelRequestsTotal.WithContext(ctx).WithLabelValues(status).Add(1) +} + +// IncWebSocketStreamingRequest increments the count of WebSocket streaming requests +// routed by the API server with the given subresource (exec/attach/portforward) and +// proxy_type (proxied_to_kubelet or translated_at_apiserver). +func IncWebSocketStreamingRequest(ctx context.Context, subresource, proxyType string) { + websocketStreamingRequestsTotal.WithContext(ctx).WithLabelValues(subresource, proxyType).Add(1) +} diff --git a/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go b/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go index 3df8e580e4..65bf08ee59 100644 --- a/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go +++ b/vendor/k8s.io/apiserver/plugin/pkg/authorizer/webhook/webhook.go @@ -204,21 +204,18 @@ func (w *WebhookAuthorizer) Authorize(ctx context.Context, attr authorizer.Attri Verb: attr.GetVerb(), } } - // skipping match when feature is not enabled - if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.StructuredAuthorizationConfiguration) { - // Process Match Conditions before calling the webhook - matches, err := w.match(ctx, r) - // If at least one matchCondition evaluates to an error (but none are FALSE): - // If failurePolicy=Deny, then the webhook rejects the request - // If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped - if err != nil { - return w.decisionOnError, "", err - } - // If at least one matchCondition successfully evaluates to FALSE, - // then the webhook is skipped. - if !matches { - return authorizer.DecisionNoOpinion, "", nil - } + // Process Match Conditions before calling the webhook + matches, err := w.match(ctx, r) + // If at least one matchCondition evaluates to an error (but none are FALSE): + // If failurePolicy=Deny, then the webhook rejects the request + // If failurePolicy=NoOpinion, then the error is ignored and the webhook is skipped + if err != nil { + return w.decisionOnError, "", err + } + // If at least one matchCondition successfully evaluates to FALSE, + // then the webhook is skipped. + if !matches { + return authorizer.DecisionNoOpinion, "", nil } // If all evaluated successfully and ALL matchConditions evaluate to TRUE, // then the webhook is called. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/applyconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/applyconfiguration.go new file mode 100644 index 0000000000..63582a6365 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/applyconfiguration.go @@ -0,0 +1,81 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ApplyConfigurationApplyConfiguration represents a declarative configuration of the ApplyConfiguration type for use +// with apply. +// +// ApplyConfiguration defines the desired configuration values of an object. +type ApplyConfigurationApplyConfiguration struct { + // expression will be evaluated by CEL to create an apply configuration. + // ref: https://github.com/google/cel-spec + // + // Apply configurations are declared in CEL using object initialization. For example, this CEL expression + // returns an apply configuration to set a single field: + // + // Object{ + // spec: Object.spec{ + // serviceAccountName: "example" + // } + // } + // + // Apply configurations may not modify atomic structs, maps or arrays due to the risk of accidental deletion of + // values not included in the apply configuration. + // + // CEL expressions have access to the object types needed to create apply configurations: + // + // - 'Object' - CEL type of the resource object. + // - 'Object.' - CEL type of object field (such as 'Object.spec') + // - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + // + // CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + // + // - 'object' - The object from the incoming request. The value is null for DELETE requests. + // - 'oldObject' - The existing object. The value is null for CREATE requests. + // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + // - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + // For example, a variable named 'foo' can be accessed as 'variables.foo'. + // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + // request resource. + // + // The `apiVersion`, `kind`, `metadata.name` and `metadata.generateName` are always accessible from the root of the + // object. No other metadata properties are accessible. + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Required. + Expression *string `json:"expression,omitempty"` +} + +// ApplyConfigurationApplyConfiguration constructs a declarative configuration of the ApplyConfiguration type for use with +// apply. +func ApplyConfiguration() *ApplyConfigurationApplyConfiguration { + return &ApplyConfigurationApplyConfiguration{} +} + +// WithExpression sets the Expression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Expression field is set to the value of the last call. +func (b *ApplyConfigurationApplyConfiguration) WithExpression(value string) *ApplyConfigurationApplyConfiguration { + b.Expression = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/expressionwarning.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/expressionwarning.go index 31219c7e80..44105d0167 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/expressionwarning.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/expressionwarning.go @@ -23,11 +23,11 @@ package v1 // // ExpressionWarning is a warning information that targets a specific expression. type ExpressionWarningApplyConfiguration struct { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" FieldRef *string `json:"fieldRef,omitempty"` - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. Warning *string `json:"warning,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/jsonpatch.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/jsonpatch.go new file mode 100644 index 0000000000..800a835a47 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/jsonpatch.go @@ -0,0 +1,105 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// JSONPatchApplyConfiguration represents a declarative configuration of the JSONPatch type for use +// with apply. +// +// JSONPatch defines a JSON Patch. +type JSONPatchApplyConfiguration struct { + // expression will be evaluated by CEL to create a [JSON patch](https://jsonpatch.com/). + // ref: https://github.com/google/cel-spec + // + // expression must return an array of JSONPatch values. + // + // For example, this CEL expression returns a JSON patch to conditionally modify a value: + // + // [ + // JSONPatch{op: "test", path: "/spec/example", value: "Red"}, + // JSONPatch{op: "replace", path: "/spec/example", value: "Green"} + // ] + // + // To define an object for the patch value, use Object types. For example: + // + // [ + // JSONPatch{ + // op: "add", + // path: "/spec/selector", + // value: Object.spec.selector{matchLabels: {"environment": "test"}} + // } + // ] + // + // To use strings containing '/' and '~' as JSONPatch path keys, use "jsonpatch.escapeKey". For example: + // + // [ + // JSONPatch{ + // op: "add", + // path: "/metadata/labels/" + jsonpatch.escapeKey("example.com/environment"), + // value: "test" + // }, + // ] + // + // CEL expressions have access to the types needed to create JSON patches and objects: + // + // - 'JSONPatch' - CEL type of JSON Patch operations. JSONPatch has the fields 'op', 'from', 'path' and 'value'. + // See [JSON patch](https://jsonpatch.com/) for more details. The 'value' field may be set to any of: string, + // integer, array, map or object. If set, the 'path' and 'from' fields must be set to a + // [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901/) string, where the 'jsonpatch.escapeKey()' CEL + // function may be used to escape path keys containing '/' and '~'. + // - 'Object' - CEL type of the resource object. + // - 'Object.' - CEL type of object field (such as 'Object.spec') + // - 'Object.....` - CEL type of nested field (such as 'Object.spec.containers') + // + // CEL expressions have access to the contents of the API request, organized into CEL variables as well as some other useful variables: + // + // - 'object' - The object from the incoming request. The value is null for DELETE requests. + // - 'oldObject' - The existing object. The value is null for CREATE requests. + // - 'request' - Attributes of the API request([ref](/pkg/apis/admission/types.go#AdmissionRequest)). + // - 'params' - Parameter resource referred to by the policy binding being evaluated. Only populated if the policy has a ParamKind. + // - 'namespaceObject' - The namespace object that the incoming object belongs to. The value is null for cluster-scoped resources. + // - 'variables' - Map of composited variables, from its name to its lazily evaluated value. + // For example, a variable named 'foo' can be accessed as 'variables.foo'. + // - 'authorizer' - A CEL Authorizer. May be used to perform authorization checks for the principal (user or service account) of the request. + // See https://pkg.go.dev/k8s.io/apiserver/pkg/cel/library#Authz + // - 'authorizer.requestResource' - A CEL ResourceCheck constructed from the 'authorizer' and configured with the + // request resource. + // + // CEL expressions have access to [Kubernetes CEL function libraries](https://kubernetes.io/docs/reference/using-api/cel/#cel-options-language-features-and-libraries) + // as well as: + // + // - 'jsonpatch.escapeKey' - Performs JSONPatch key escaping. '~' and '/' are escaped as '~0' and `~1' respectively). + // + // Only property names of the form `[a-zA-Z_.-/][a-zA-Z0-9_.-/]*` are accessible. + // Required. + Expression *string `json:"expression,omitempty"` +} + +// JSONPatchApplyConfiguration constructs a declarative configuration of the JSONPatch type for use with +// apply. +func JSONPatch() *JSONPatchApplyConfiguration { + return &JSONPatchApplyConfiguration{} +} + +// WithExpression sets the Expression field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Expression field is set to the value of the last call. +func (b *JSONPatchApplyConfiguration) WithExpression(value string) *JSONPatchApplyConfiguration { + b.Expression = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchcondition.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchcondition.go index 1e149da4ec..785fbbf023 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchcondition.go @@ -23,7 +23,7 @@ package v1 // // MatchCondition represents a condition which must by fulfilled for a request to be sent to a webhook. type MatchConditionApplyConfiguration struct { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -33,7 +33,7 @@ type MatchConditionApplyConfiguration struct { // // Required. Name *string `json:"name,omitempty"` - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchresources.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchresources.go index cd1a3d5fcf..29ee198b3a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchresources.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/matchresources.go @@ -30,7 +30,7 @@ import ( // on whether it meets the match criteria. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) type MatchResourcesApplyConfiguration struct { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -74,7 +74,7 @@ type MatchResourcesApplyConfiguration struct { // // Default to the empty LabelSelector, which matches everything. NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - // ObjectSelector decides whether to run the validation based on if the + // objectSelector decides whether to run the validation based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the cel validation, and // is considered to match if either object matches the selector. A null @@ -86,10 +86,10 @@ type MatchResourcesApplyConfiguration struct { // users may skip the admission webhook by setting the labels. // Default to the empty LabelSelector, which matches everything. ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` - // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. + // resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. // The policy cares about an operation if it matches _any_ Rule. ResourceRules []NamedRuleWithOperationsApplyConfiguration `json:"resourceRules,omitempty"` - // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) ExcludeResourceRules []NamedRuleWithOperationsApplyConfiguration `json:"excludeResourceRules,omitempty"` // matchPolicy defines how the "MatchResources" list is used to match incoming requests. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go new file mode 100644 index 0000000000..f99f055b3c --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicy.go @@ -0,0 +1,274 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MutatingAdmissionPolicyApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicy type for use +// with apply. +// +// MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. +type MutatingAdmissionPolicyApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the desired behavior of the MutatingAdmissionPolicy. + Spec *MutatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"` +} + +// MutatingAdmissionPolicy constructs a declarative configuration of the MutatingAdmissionPolicy type for use with +// apply. +func MutatingAdmissionPolicy(name string) *MutatingAdmissionPolicyApplyConfiguration { + b := &MutatingAdmissionPolicyApplyConfiguration{} + b.WithName(name) + b.WithKind("MutatingAdmissionPolicy") + b.WithAPIVersion("admissionregistration.k8s.io/v1") + return b +} + +// ExtractMutatingAdmissionPolicyFrom extracts the applied configuration owned by fieldManager from +// mutatingAdmissionPolicy for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// mutatingAdmissionPolicy must be a unmodified MutatingAdmissionPolicy API object that was retrieved from the Kubernetes API. +// ExtractMutatingAdmissionPolicyFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMutatingAdmissionPolicyFrom(mutatingAdmissionPolicy *admissionregistrationv1.MutatingAdmissionPolicy, fieldManager string, subresource string) (*MutatingAdmissionPolicyApplyConfiguration, error) { + b := &MutatingAdmissionPolicyApplyConfiguration{} + err := managedfields.ExtractInto(mutatingAdmissionPolicy, internal.Parser().Type("io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicy"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(mutatingAdmissionPolicy.Name) + + b.WithKind("MutatingAdmissionPolicy") + b.WithAPIVersion("admissionregistration.k8s.io/v1") + return b, nil +} + +// ExtractMutatingAdmissionPolicy extracts the applied configuration owned by fieldManager from +// mutatingAdmissionPolicy. If no managedFields are found in mutatingAdmissionPolicy for fieldManager, a +// MutatingAdmissionPolicyApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// mutatingAdmissionPolicy must be a unmodified MutatingAdmissionPolicy API object that was retrieved from the Kubernetes API. +// ExtractMutatingAdmissionPolicy provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMutatingAdmissionPolicy(mutatingAdmissionPolicy *admissionregistrationv1.MutatingAdmissionPolicy, fieldManager string) (*MutatingAdmissionPolicyApplyConfiguration, error) { + return ExtractMutatingAdmissionPolicyFrom(mutatingAdmissionPolicy, fieldManager, "") +} + +func (b MutatingAdmissionPolicyApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithKind(value string) *MutatingAdmissionPolicyApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithAPIVersion(value string) *MutatingAdmissionPolicyApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithName(value string) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithGenerateName(value string) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithNamespace(value string) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithUID(value types.UID) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithResourceVersion(value string) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithGeneration(value int64) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithLabels(entries map[string]string) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithAnnotations(entries map[string]string) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithFinalizers(values ...string) *MutatingAdmissionPolicyApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MutatingAdmissionPolicyApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MutatingAdmissionPolicyApplyConfiguration) WithSpec(value *MutatingAdmissionPolicySpecApplyConfiguration) *MutatingAdmissionPolicyApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MutatingAdmissionPolicyApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MutatingAdmissionPolicyApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MutatingAdmissionPolicyApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MutatingAdmissionPolicyApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go new file mode 100644 index 0000000000..4bb30baa6f --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybinding.go @@ -0,0 +1,284 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + internal "k8s.io/client-go/applyconfigurations/internal" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// MutatingAdmissionPolicyBindingApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicyBinding type for use +// with apply. +// +// MutatingAdmissionPolicyBinding binds the MutatingAdmissionPolicy with parametrized resources. +// MutatingAdmissionPolicyBinding and the optional parameter resource together define how cluster administrators +// configure policies for clusters. +// +// For a given admission request, each binding will cause its policy to be +// evaluated N times, where N is 1 for policies/bindings that don't use +// params, otherwise N is the number of parameters selected by the binding. +// Each evaluation is constrained by a [runtime cost budget](https://kubernetes.io/docs/reference/using-api/cel/#runtime-cost-budget). +// +// Adding/removing policies, bindings, or params can not affect whether a +// given (policy, binding, param) combination is within its own CEL budget. +type MutatingAdmissionPolicyBindingApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. + Spec *MutatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"` +} + +// MutatingAdmissionPolicyBinding constructs a declarative configuration of the MutatingAdmissionPolicyBinding type for use with +// apply. +func MutatingAdmissionPolicyBinding(name string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b := &MutatingAdmissionPolicyBindingApplyConfiguration{} + b.WithName(name) + b.WithKind("MutatingAdmissionPolicyBinding") + b.WithAPIVersion("admissionregistration.k8s.io/v1") + return b +} + +// ExtractMutatingAdmissionPolicyBindingFrom extracts the applied configuration owned by fieldManager from +// mutatingAdmissionPolicyBinding for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// mutatingAdmissionPolicyBinding must be a unmodified MutatingAdmissionPolicyBinding API object that was retrieved from the Kubernetes API. +// ExtractMutatingAdmissionPolicyBindingFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMutatingAdmissionPolicyBindingFrom(mutatingAdmissionPolicyBinding *admissionregistrationv1.MutatingAdmissionPolicyBinding, fieldManager string, subresource string) (*MutatingAdmissionPolicyBindingApplyConfiguration, error) { + b := &MutatingAdmissionPolicyBindingApplyConfiguration{} + err := managedfields.ExtractInto(mutatingAdmissionPolicyBinding, internal.Parser().Type("io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBinding"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(mutatingAdmissionPolicyBinding.Name) + + b.WithKind("MutatingAdmissionPolicyBinding") + b.WithAPIVersion("admissionregistration.k8s.io/v1") + return b, nil +} + +// ExtractMutatingAdmissionPolicyBinding extracts the applied configuration owned by fieldManager from +// mutatingAdmissionPolicyBinding. If no managedFields are found in mutatingAdmissionPolicyBinding for fieldManager, a +// MutatingAdmissionPolicyBindingApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// mutatingAdmissionPolicyBinding must be a unmodified MutatingAdmissionPolicyBinding API object that was retrieved from the Kubernetes API. +// ExtractMutatingAdmissionPolicyBinding provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractMutatingAdmissionPolicyBinding(mutatingAdmissionPolicyBinding *admissionregistrationv1.MutatingAdmissionPolicyBinding, fieldManager string) (*MutatingAdmissionPolicyBindingApplyConfiguration, error) { + return ExtractMutatingAdmissionPolicyBindingFrom(mutatingAdmissionPolicyBinding, fieldManager, "") +} + +func (b MutatingAdmissionPolicyBindingApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithKind(value string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithAPIVersion(value string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithName(value string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithGenerateName(value string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithNamespace(value string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithUID(value types.UID) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithResourceVersion(value string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithGeneration(value int64) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithLabels(entries map[string]string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithAnnotations(entries map[string]string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithFinalizers(values ...string) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) WithSpec(value *MutatingAdmissionPolicyBindingSpecApplyConfiguration) *MutatingAdmissionPolicyBindingApplyConfiguration { + b.Spec = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *MutatingAdmissionPolicyBindingApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybindingspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybindingspec.go new file mode 100644 index 0000000000..a62e5dbb28 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicybindingspec.go @@ -0,0 +1,75 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// MutatingAdmissionPolicyBindingSpecApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicyBindingSpec type for use +// with apply. +// +// MutatingAdmissionPolicyBindingSpec defines the specification of the MutatingAdmissionPolicyBinding. +type MutatingAdmissionPolicyBindingSpecApplyConfiguration struct { + // policyName references a MutatingAdmissionPolicy name which the MutatingAdmissionPolicyBinding binds to. + // If the referenced resource does not exist, this binding is considered invalid and will be ignored + // Required. + PolicyName *string `json:"policyName,omitempty"` + // paramRef specifies the parameter resource used to configure the admission control policy. + // It should point to a resource of the type specified in spec.ParamKind of the bound MutatingAdmissionPolicy. + // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the MutatingAdmissionPolicy applied. + // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. + ParamRef *ParamRefApplyConfiguration `json:"paramRef,omitempty"` + // matchResources limits what resources match this binding and may be mutated by it. + // Note that if matchResources matches a resource, the resource must also match a policy's matchConstraints and + // matchConditions before the resource may be mutated. + // When matchResources is unset, it does not constrain resource matching, and only the policy's matchConstraints + // and matchConditions must match for the resource to be mutated. + // Additionally, matchResources.resourceRules are optional and do not constraint matching when unset. + // Note that this is differs from MutatingAdmissionPolicy matchConstraints, where resourceRules are required. + // The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + // '*' matches CREATE, UPDATE and CONNECT. + MatchResources *MatchResourcesApplyConfiguration `json:"matchResources,omitempty"` +} + +// MutatingAdmissionPolicyBindingSpecApplyConfiguration constructs a declarative configuration of the MutatingAdmissionPolicyBindingSpec type for use with +// apply. +func MutatingAdmissionPolicyBindingSpec() *MutatingAdmissionPolicyBindingSpecApplyConfiguration { + return &MutatingAdmissionPolicyBindingSpecApplyConfiguration{} +} + +// WithPolicyName sets the PolicyName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PolicyName field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithPolicyName(value string) *MutatingAdmissionPolicyBindingSpecApplyConfiguration { + b.PolicyName = &value + return b +} + +// WithParamRef sets the ParamRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ParamRef field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithParamRef(value *ParamRefApplyConfiguration) *MutatingAdmissionPolicyBindingSpecApplyConfiguration { + b.ParamRef = value + return b +} + +// WithMatchResources sets the MatchResources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchResources field is set to the value of the last call. +func (b *MutatingAdmissionPolicyBindingSpecApplyConfiguration) WithMatchResources(value *MatchResourcesApplyConfiguration) *MutatingAdmissionPolicyBindingSpecApplyConfiguration { + b.MatchResources = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicyspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicyspec.go new file mode 100644 index 0000000000..fc52a5595f --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingadmissionpolicyspec.go @@ -0,0 +1,172 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" +) + +// MutatingAdmissionPolicySpecApplyConfiguration represents a declarative configuration of the MutatingAdmissionPolicySpec type for use +// with apply. +// +// MutatingAdmissionPolicySpec defines the desired behavior of the admission policy. +type MutatingAdmissionPolicySpecApplyConfiguration struct { + // paramKind specifies the kind of resources used to parameterize this policy. + // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. + // If paramKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. + // If paramKind is specified but paramRef is unset in MutatingAdmissionPolicyBinding, the params variable will be null. + ParamKind *ParamKindApplyConfiguration `json:"paramKind,omitempty"` + // matchConstraints specifies what resources this policy is designed to validate. + // The MutatingAdmissionPolicy cares about a request if it matches _all_ Constraints. + // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API + // MutatingAdmissionPolicy cannot match MutatingAdmissionPolicy and MutatingAdmissionPolicyBinding. + // The CREATE, UPDATE and CONNECT operations are allowed. The DELETE operation may not be matched. + // '*' matches CREATE, UPDATE and CONNECT. + // Required. + MatchConstraints *MatchResourcesApplyConfiguration `json:"matchConstraints,omitempty"` + // variables contain definitions of variables that can be used in composition of other expressions. + // Each variable is defined as a named CEL expression. + // The variables defined here will be available under `variables` in other expressions of the policy + // except matchConditions because matchConditions are evaluated before the rest of the policy. + // + // The expression of a variable can refer to other variables defined earlier in the list but not those after. + // Thus, variables must be sorted by the order of first appearance and acyclic. + Variables []VariableApplyConfiguration `json:"variables,omitempty"` + // mutations contain operations to perform on matching objects. + // mutations may not be empty; a minimum of one mutation is required. + // mutations are evaluated in order, and are reinvoked according to + // the reinvocationPolicy. + // The mutations of a policy are invoked for each binding of this policy + // and reinvocation of mutations occurs on a per binding basis. + Mutations []MutationApplyConfiguration `json:"mutations,omitempty"` + // failurePolicy defines how to handle failures for the admission policy. Failures can + // occur from CEL expression parse errors, type check errors, runtime errors and invalid + // or mis-configured policy definitions or bindings. + // + // A policy is invalid if paramKind refers to a non-existent Kind. + // A binding is invalid if paramRef.name refers to a non-existent resource. + // + // failurePolicy does not define how validations that evaluate to false are handled. + // + // Allowed values are Ignore or Fail. Defaults to Fail. + FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"` + // matchConditions is a list of conditions that must be met for a request to be validated. + // Match conditions filter requests that have already been matched by the matchConstraints. + // An empty list of matchConditions matches all requests. + // There are a maximum of 64 match conditions allowed. + // + // If a parameter object is provided, it can be accessed via the `params` handle in the same + // manner as validation expressions. + // + // The exact matching logic is (in order): + // 1. If ANY matchCondition evaluates to FALSE, the policy is skipped. + // 2. If ALL matchConditions evaluate to TRUE, the policy is evaluated. + // 3. If any matchCondition evaluates to an error (but none are FALSE): + // - If failurePolicy=Fail, reject the request + // - If failurePolicy=Ignore, the policy is skipped + MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` + // reinvocationPolicy indicates whether mutations may be called multiple times per MutatingAdmissionPolicyBinding + // as part of a single admission evaluation. + // Allowed values are "Never" and "IfNeeded". + // + // Never: These mutations will not be called more than once per binding in a single admission evaluation. + // + // IfNeeded: These mutations may be invoked more than once per binding for a single admission request and there is no guarantee of + // order with respect to other admission plugins, admission webhooks, bindings of this policy and admission policies. Mutations are only + // reinvoked when mutations change the object after this mutation is invoked. + // Required. + ReinvocationPolicy *admissionregistrationv1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"` +} + +// MutatingAdmissionPolicySpecApplyConfiguration constructs a declarative configuration of the MutatingAdmissionPolicySpec type for use with +// apply. +func MutatingAdmissionPolicySpec() *MutatingAdmissionPolicySpecApplyConfiguration { + return &MutatingAdmissionPolicySpecApplyConfiguration{} +} + +// WithParamKind sets the ParamKind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ParamKind field is set to the value of the last call. +func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithParamKind(value *ParamKindApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration { + b.ParamKind = value + return b +} + +// WithMatchConstraints sets the MatchConstraints field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchConstraints field is set to the value of the last call. +func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMatchConstraints(value *MatchResourcesApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration { + b.MatchConstraints = value + return b +} + +// WithVariables adds the given value to the Variables field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Variables field. +func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithVariables(values ...*VariableApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVariables") + } + b.Variables = append(b.Variables, *values[i]) + } + return b +} + +// WithMutations adds the given value to the Mutations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Mutations field. +func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMutations(values ...*MutationApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMutations") + } + b.Mutations = append(b.Mutations, *values[i]) + } + return b +} + +// WithFailurePolicy sets the FailurePolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FailurePolicy field is set to the value of the last call. +func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithFailurePolicy(value admissionregistrationv1.FailurePolicyType) *MutatingAdmissionPolicySpecApplyConfiguration { + b.FailurePolicy = &value + return b +} + +// WithMatchConditions adds the given value to the MatchConditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchConditions field. +func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithMatchConditions(values ...*MatchConditionApplyConfiguration) *MutatingAdmissionPolicySpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchConditions") + } + b.MatchConditions = append(b.MatchConditions, *values[i]) + } + return b +} + +// WithReinvocationPolicy sets the ReinvocationPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ReinvocationPolicy field is set to the value of the last call. +func (b *MutatingAdmissionPolicySpecApplyConfiguration) WithReinvocationPolicy(value admissionregistrationv1.ReinvocationPolicyType) *MutatingAdmissionPolicySpecApplyConfiguration { + b.ReinvocationPolicy = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhook.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhook.go index 498611b5dd..47e691f12d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhook.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhook.go @@ -28,23 +28,23 @@ import ( // // MutatingWebhook describes an admission webhook and the resources and operations it applies to. type MutatingWebhookApplyConfiguration struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name *string `json:"name,omitempty"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. Rules []RuleWithOperationsApplyConfiguration `json:"rules,omitempty"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Fail. FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"` // matchPolicy defines how the "rules" list is used to match incoming requests. @@ -62,7 +62,7 @@ type MutatingWebhookApplyConfiguration struct { // // Defaults to "Equivalent" MatchPolicy *admissionregistrationv1.MatchPolicyType `json:"matchPolicy,omitempty"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -106,7 +106,7 @@ type MutatingWebhookApplyConfiguration struct { // // Default to the empty LabelSelector, which matches everything. NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -118,20 +118,20 @@ type MutatingWebhookApplyConfiguration struct { // users may skip the admission webhook by setting the labels. // Default to the empty LabelSelector, which matches everything. ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. // Requests with the dryRun attribute will be auto-rejected if they match a webhook with // sideEffects == Unknown or Some. SideEffects *admissionregistrationv1.SideEffectClass `json:"sideEffects,omitempty"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. // Default to 10 seconds. TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -155,7 +155,7 @@ type MutatingWebhookApplyConfiguration struct { // // Defaults to "Never". ReinvocationPolicy *admissionregistrationv1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go index 87909f254b..dcb0b81cca 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -33,9 +33,9 @@ import ( // MutatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and may change the object. type MutatingWebhookConfigurationApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. Webhooks []MutatingWebhookApplyConfiguration `json:"webhooks,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutation.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutation.go new file mode 100644 index 0000000000..f47749d3cd --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutation.go @@ -0,0 +1,72 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" +) + +// MutationApplyConfiguration represents a declarative configuration of the Mutation type for use +// with apply. +// +// Mutation specifies the CEL expression which is used to apply the Mutation. +type MutationApplyConfiguration struct { + // patchType indicates the patch strategy used. + // Allowed values are "ApplyConfiguration" and "JSONPatch". + // Required. + PatchType *admissionregistrationv1.PatchType `json:"patchType,omitempty"` + // applyConfiguration defines the desired configuration values of an object. + // The configuration is applied to the admission object using + // [structured merge diff](https://github.com/kubernetes-sigs/structured-merge-diff). + // A CEL expression is used to create apply configuration. + ApplyConfiguration *ApplyConfigurationApplyConfiguration `json:"applyConfiguration,omitempty"` + // jsonPatch defines a [JSON patch](https://jsonpatch.com/) operation to perform a mutation to the object. + // A CEL expression is used to create the JSON patch. + JSONPatch *JSONPatchApplyConfiguration `json:"jsonPatch,omitempty"` +} + +// MutationApplyConfiguration constructs a declarative configuration of the Mutation type for use with +// apply. +func Mutation() *MutationApplyConfiguration { + return &MutationApplyConfiguration{} +} + +// WithPatchType sets the PatchType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PatchType field is set to the value of the last call. +func (b *MutationApplyConfiguration) WithPatchType(value admissionregistrationv1.PatchType) *MutationApplyConfiguration { + b.PatchType = &value + return b +} + +// WithApplyConfiguration sets the ApplyConfiguration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ApplyConfiguration field is set to the value of the last call. +func (b *MutationApplyConfiguration) WithApplyConfiguration(value *ApplyConfigurationApplyConfiguration) *MutationApplyConfiguration { + b.ApplyConfiguration = value + return b +} + +// WithJSONPatch sets the JSONPatch field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the JSONPatch field is set to the value of the last call. +func (b *MutationApplyConfiguration) WithJSONPatch(value *JSONPatchApplyConfiguration) *MutationApplyConfiguration { + b.JSONPatch = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go index fe7a6b8c0c..326337c8cc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/namedrulewithoperations.go @@ -27,7 +27,7 @@ import ( // // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. type NamedRuleWithOperationsApplyConfiguration struct { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` // RuleWithOperations is a tuple of Operations and Resources. RuleWithOperationsApplyConfiguration `json:",inline"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramkind.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramkind.go index 5c6729fc63..7a140feddc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramkind.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramkind.go @@ -23,11 +23,11 @@ package v1 // // ParamKind is a tuple of Group Kind and Version. type ParamKindApplyConfiguration struct { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. APIVersion *string `json:"apiVersion,omitempty"` - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. Kind *string `json:"kind,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramref.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramref.go index eb9f6c47aa..25690d06d1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramref.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/paramref.go @@ -62,7 +62,7 @@ type ParamRefApplyConfiguration struct { // One of `name` or `selector` must be set, but `name` and `selector` are // mutually exclusive properties. If one is set, the other must be unset. Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rule.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rule.go index 056e944fec..aa1d948a99 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rule.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rule.go @@ -28,15 +28,15 @@ import ( // Rule is a tuple of APIGroups, APIVersion, and Resources.It is recommended // to make sure that all the tuple expansions are valid. type RuleApplyConfiguration struct { - // APIGroups is the API groups the resources belong to. '*' is all groups. + // apiGroups is the API groups the resources belong to. '*' is all groups. // If '*' is present, the length of the slice must be one. // Required. APIGroups []string `json:"apiGroups,omitempty"` - // APIVersions is the API versions the resources belong to. '*' is all versions. + // apiVersions is the API versions the resources belong to. '*' is all versions. // If '*' is present, the length of the slice must be one. // Required. APIVersions []string `json:"apiVersions,omitempty"` - // Resources is a list of resources this rule applies to. + // resources is a list of resources this rule applies to. // // For example: // 'pods' means pods. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go index a4a1643fec..575e1ab35c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go @@ -28,7 +28,7 @@ import ( // RuleWithOperations is a tuple of Operations and Resources. It is recommended to make // sure that all the tuple expansions are valid. type RuleWithOperationsApplyConfiguration struct { - // Operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * + // operations is the operations the admission hook cares about - CREATE, UPDATE, DELETE, CONNECT or * // for all of those operations and any future admission operations that are added. // If '*' is present, the length of the slice must be one. // Required. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/servicereference.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/servicereference.go index c93b61150f..e15728ae18 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/servicereference.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/servicereference.go @@ -23,16 +23,16 @@ package v1 // // ServiceReference holds a reference to Service.legacy.k8s.io type ServiceReferenceApplyConfiguration struct { - // `namespace` is the namespace of the service. + // namespace is the namespace of the service. // Required Namespace *string `json:"namespace,omitempty"` - // `name` is the name of the service. + // name is the name of the service. // Required Name *string `json:"name,omitempty"` - // `path` is an optional URL path which will be sent in any request to + // path is an optional URL path which will be sent in any request to // this service. Path *string `json:"path,omitempty"` - // If specified, the port on the service that hosting webhook. + // port is the port on the service that hosts the webhook. // Default to 443 for backward compatibility. // `port` should be a valid port number (1-65535, inclusive). Port *int32 `json:"port,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/typechecking.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/typechecking.go index f6077ee39e..5140aedb51 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/typechecking.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/typechecking.go @@ -24,7 +24,7 @@ package v1 // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy type TypeCheckingApplyConfiguration struct { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. ExpressionWarnings []ExpressionWarningApplyConfiguration `json:"expressionWarnings,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go index 22d965fa81..6e06ed3e5f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicy.go @@ -33,11 +33,11 @@ import ( // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicyApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. Spec *ValidatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"` - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go index 5a083a0568..590aabda81 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybinding.go @@ -43,9 +43,9 @@ import ( // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBindingApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. Spec *ValidatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybindingspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybindingspec.go index 31d98bb947..d783b4c41c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybindingspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicybindingspec.go @@ -27,7 +27,7 @@ import ( // // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingSpecApplyConfiguration struct { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. PolicyName *string `json:"policyName,omitempty"` @@ -36,7 +36,7 @@ type ValidatingAdmissionPolicyBindingSpecApplyConfiguration struct { // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. ParamRef *ParamRefApplyConfiguration `json:"paramRef,omitempty"` - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicyspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicyspec.go index b3f6989a72..5f9336d4dd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicyspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicyspec.go @@ -27,18 +27,18 @@ import ( // // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. type ValidatingAdmissionPolicySpecApplyConfiguration struct { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. ParamKind *ParamKindApplyConfiguration `json:"paramKind,omitempty"` - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. MatchConstraints *MatchResourcesApplyConfiguration `json:"matchConstraints,omitempty"` - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. Validations []ValidationApplyConfiguration `json:"validations,omitempty"` @@ -61,7 +61,7 @@ type ValidatingAdmissionPolicySpecApplyConfiguration struct { // validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is // required. AuditAnnotations []AuditAnnotationApplyConfiguration `json:"auditAnnotations,omitempty"` - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -76,7 +76,7 @@ type ValidatingAdmissionPolicySpecApplyConfiguration struct { // - If failurePolicy=Fail, reject the request // - If failurePolicy=Ignore, the policy is skipped MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicystatus.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicystatus.go index 0b3ea76124..382ca9b260 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicystatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingadmissionpolicystatus.go @@ -27,12 +27,12 @@ import ( // // ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. type ValidatingAdmissionPolicyStatusApplyConfiguration struct { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. ObservedGeneration *int64 `json:"observedGeneration,omitempty"` - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. TypeChecking *TypeCheckingApplyConfiguration `json:"typeChecking,omitempty"` - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhook.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhook.go index 02298017cb..3312b9d27d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhook.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhook.go @@ -28,23 +28,23 @@ import ( // // ValidatingWebhook describes an admission webhook and the resources and operations it applies to. type ValidatingWebhookApplyConfiguration struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name *string `json:"name,omitempty"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. Rules []RuleWithOperationsApplyConfiguration `json:"rules,omitempty"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Fail. FailurePolicy *admissionregistrationv1.FailurePolicyType `json:"failurePolicy,omitempty"` // matchPolicy defines how the "rules" list is used to match incoming requests. @@ -62,7 +62,7 @@ type ValidatingWebhookApplyConfiguration struct { // // Defaults to "Equivalent" MatchPolicy *admissionregistrationv1.MatchPolicyType `json:"matchPolicy,omitempty"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -106,7 +106,7 @@ type ValidatingWebhookApplyConfiguration struct { // // Default to the empty LabelSelector, which matches everything. NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -118,20 +118,20 @@ type ValidatingWebhookApplyConfiguration struct { // users may skip the admission webhook by setting the labels. // Default to the empty LabelSelector, which matches everything. ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: None, NoneOnDryRun (webhooks created via v1beta1 may also specify Some or Unknown). // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. // Requests with the dryRun attribute will be auto-rejected if they match a webhook with // sideEffects == Unknown or Some. SideEffects *admissionregistrationv1.SideEffectClass `json:"sideEffects,omitempty"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. // Default to 10 seconds. TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -139,7 +139,7 @@ type ValidatingWebhookApplyConfiguration struct { // include any versions known to the API Server, calls to the webhook will fail // and be subject to the failure policy. AdmissionReviewVersions []string `json:"admissionReviewVersions,omitempty"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go index fdf7923e96..c3ac1fafdd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go @@ -33,9 +33,9 @@ import ( // ValidatingWebhookConfiguration describes the configuration of and admission webhook that accept or reject and object without changing it. type ValidatingWebhookConfigurationApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. Webhooks []ValidatingWebhookApplyConfiguration `json:"webhooks,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validation.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validation.go index 2ad6756d01..32dc38391a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validation.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validation.go @@ -27,7 +27,7 @@ import ( // // Validation specifies the CEL expression which is used to apply the validation. type ValidationApplyConfiguration struct { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -69,7 +69,7 @@ type ValidationApplyConfiguration struct { // non-intersecting keys are appended, retaining their partial order. // Required. Expression *string `json:"expression,omitempty"` - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -77,7 +77,7 @@ type ValidationApplyConfiguration struct { // The message must not contain line breaks. // If unset, the message is "failed Expression: {Expression}". Message *string `json:"message,omitempty"` - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/variable.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/variable.go index a99f837944..eb89ec088f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/variable.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/variable.go @@ -23,11 +23,11 @@ package v1 // // Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. type VariableApplyConfiguration struct { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` Name *string `json:"name,omitempty"` - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. Expression *string `json:"expression,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/webhookclientconfig.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/webhookclientconfig.go index 10f3d48de4..b379de8524 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/webhookclientconfig.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/webhookclientconfig.go @@ -24,7 +24,7 @@ package v1 // WebhookClientConfig contains the information to make a TLS // connection with the webhook type WebhookClientConfigApplyConfiguration struct { - // `url` gives the location of the webhook, in standard URL form + // url gives the location of the webhook, in standard URL form // (`scheme://host:port/path`). Exactly one of `url` or `service` // must be specified. // @@ -50,12 +50,12 @@ type WebhookClientConfigApplyConfiguration struct { // allowed. Fragments ("#...") and query parameters ("?...") are not // allowed, either. URL *string `json:"url,omitempty"` - // `service` is a reference to the service for this webhook. Either + // service is a reference to the service for this webhook. Either // `service` or `url` must be specified. // // If the webhook is running within the cluster, then you should use `service`. Service *ServiceReferenceApplyConfiguration `json:"service,omitempty"` - // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. // If unspecified, system trust roots on the apiserver are used. CABundle []byte `json:"caBundle,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/expressionwarning.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/expressionwarning.go index 220c5d2c93..c52e4d372a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/expressionwarning.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/expressionwarning.go @@ -23,11 +23,11 @@ package v1alpha1 // // ExpressionWarning is a warning information that targets a specific expression. type ExpressionWarningApplyConfiguration struct { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" FieldRef *string `json:"fieldRef,omitempty"` - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. Warning *string `json:"warning,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchcondition.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchcondition.go index 7b758dbf4b..34fdee402c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchcondition.go @@ -21,7 +21,7 @@ package v1alpha1 // MatchConditionApplyConfiguration represents a declarative configuration of the MatchCondition type for use // with apply. type MatchConditionApplyConfiguration struct { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -31,7 +31,7 @@ type MatchConditionApplyConfiguration struct { // // Required. Name *string `json:"name,omitempty"` - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchresources.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchresources.go index 5bdeab094b..e6b5a8acee 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchresources.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/matchresources.go @@ -30,7 +30,7 @@ import ( // on whether it meets the match criteria. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) type MatchResourcesApplyConfiguration struct { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -74,7 +74,7 @@ type MatchResourcesApplyConfiguration struct { // // Default to the empty LabelSelector, which matches everything. NamespaceSelector *v1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - // ObjectSelector decides whether to run the policy based on if the + // objectSelector decides whether to run the policy based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the policy's expression (CEL), and // is considered to match if either object matches the selector. A null @@ -86,10 +86,10 @@ type MatchResourcesApplyConfiguration struct { // users may skip the admission webhook by setting the labels. // Default to the empty LabelSelector, which matches everything. ObjectSelector *v1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` - // ResourceRules describes what operations on what resources/subresources the admission policy matches. + // resourceRules describes what operations on what resources/subresources the admission policy matches. // The policy cares about an operation if it matches _any_ Rule. ResourceRules []NamedRuleWithOperationsApplyConfiguration `json:"resourceRules,omitempty"` - // ExcludeResourceRules describes what operations on what resources/subresources the policy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the policy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) ExcludeResourceRules []NamedRuleWithOperationsApplyConfiguration `json:"excludeResourceRules,omitempty"` // matchPolicy defines how the "MatchResources" list is used to match incoming requests. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go index be5b791247..678e4d612a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicy.go @@ -33,9 +33,9 @@ import ( // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicyApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the MutatingAdmissionPolicy. + // spec defines the desired behavior of the MutatingAdmissionPolicy. Spec *MutatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go index 4964a3106d..5286ce24c5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go @@ -43,9 +43,9 @@ import ( // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBindingApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the MutatingAdmissionPolicyBinding. + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. Spec *MutatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go index b9e309edc2..45c12f191d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/namedrulewithoperations.go @@ -28,7 +28,7 @@ import ( // // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. type NamedRuleWithOperationsApplyConfiguration struct { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` // RuleWithOperations is a tuple of Operations and Resources. v1.RuleWithOperationsApplyConfiguration `json:",inline"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramkind.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramkind.go index 7e008e329c..26227c10a1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramkind.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramkind.go @@ -23,11 +23,11 @@ package v1alpha1 // // ParamKind is a tuple of Group Kind and Version. type ParamKindApplyConfiguration struct { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. APIVersion *string `json:"apiVersion,omitempty"` - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. Kind *string `json:"kind,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramref.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramref.go index 6b77cd0eae..ce2ecf1a00 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramref.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/paramref.go @@ -29,7 +29,7 @@ import ( // ParamRef describes how to locate the params to be used as input to // expressions of rules applied by a policy binding. type ParamRefApplyConfiguration struct { - // `name` is the name of the resource being referenced. + // name is the name of the resource being referenced. // // `name` and `selector` are mutually exclusive properties. If one is set, // the other must be unset. @@ -58,7 +58,7 @@ type ParamRefApplyConfiguration struct { // One of `name` or `selector` must be set, but `name` and `selector` are // mutually exclusive properties. If one is set, the other must be unset. Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/typechecking.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/typechecking.go index 3b5bff0f3c..c455b88165 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/typechecking.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/typechecking.go @@ -24,7 +24,7 @@ package v1alpha1 // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy type TypeCheckingApplyConfiguration struct { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. ExpressionWarnings []ExpressionWarningApplyConfiguration `json:"expressionWarnings,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go index 7f85ed8e2f..9191eaab20 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicy.go @@ -33,11 +33,11 @@ import ( // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicyApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. Spec *ValidatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"` - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go index 0760e92744..ad61dad084 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go @@ -43,9 +43,9 @@ import ( // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBindingApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. Spec *ValidatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybindingspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybindingspec.go index bbbd59c97a..f157dc55d9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybindingspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicybindingspec.go @@ -27,7 +27,7 @@ import ( // // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingSpecApplyConfiguration struct { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. PolicyName *string `json:"policyName,omitempty"` @@ -36,7 +36,7 @@ type ValidatingAdmissionPolicyBindingSpecApplyConfiguration struct { // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. ParamRef *ParamRefApplyConfiguration `json:"paramRef,omitempty"` - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicyspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicyspec.go index ba20af8851..969f718178 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicyspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicyspec.go @@ -27,18 +27,18 @@ import ( // // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. type ValidatingAdmissionPolicySpecApplyConfiguration struct { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. ParamKind *ParamKindApplyConfiguration `json:"paramKind,omitempty"` - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. MatchConstraints *MatchResourcesApplyConfiguration `json:"matchConstraints,omitempty"` - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. Validations []ValidationApplyConfiguration `json:"validations,omitempty"` @@ -61,7 +61,7 @@ type ValidatingAdmissionPolicySpecApplyConfiguration struct { // validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is // required. AuditAnnotations []AuditAnnotationApplyConfiguration `json:"auditAnnotations,omitempty"` - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -76,7 +76,7 @@ type ValidatingAdmissionPolicySpecApplyConfiguration struct { // - If failurePolicy=Fail, reject the request // - If failurePolicy=Ignore, the policy is skipped MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicystatus.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicystatus.go index bd33b85564..2158263448 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicystatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validatingadmissionpolicystatus.go @@ -27,12 +27,12 @@ import ( // // ValidatingAdmissionPolicyStatus represents the status of a ValidatingAdmissionPolicy. type ValidatingAdmissionPolicyStatusApplyConfiguration struct { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. ObservedGeneration *int64 `json:"observedGeneration,omitempty"` - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. TypeChecking *TypeCheckingApplyConfiguration `json:"typeChecking,omitempty"` - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validation.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validation.go index 24416b210e..b21800a8a3 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validation.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/validation.go @@ -27,7 +27,7 @@ import ( // // Validation specifies the CEL expression which is used to apply the validation. type ValidationApplyConfiguration struct { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -69,7 +69,7 @@ type ValidationApplyConfiguration struct { // non-intersecting keys are appended, retaining their partial order. // Required. Expression *string `json:"expression,omitempty"` - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -77,7 +77,7 @@ type ValidationApplyConfiguration struct { // The message must not contain line breaks. // If unset, the message is "failed Expression: {Expression}". Message *string `json:"message,omitempty"` - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/variable.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/variable.go index df7e1c9db6..284234926b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/variable.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1/variable.go @@ -23,11 +23,11 @@ package v1alpha1 // // Variable is the definition of a variable that is used for composition. type VariableApplyConfiguration struct { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` Name *string `json:"name,omitempty"` - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. Expression *string `json:"expression,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/expressionwarning.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/expressionwarning.go index 0b0235f6f0..39e6ca9d28 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/expressionwarning.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/expressionwarning.go @@ -23,11 +23,11 @@ package v1beta1 // // ExpressionWarning is a warning information that targets a specific expression. type ExpressionWarningApplyConfiguration struct { - // The path to the field that refers the expression. + // fieldRef is the path to the field that refers to the expression. // For example, the reference to the expression of the first item of // validations is "spec.validations[0].expression" FieldRef *string `json:"fieldRef,omitempty"` - // The content of type checking information in a human-readable form. + // warning contains the content of type checking information in a human-readable form. // Each line of the warning contains the type that the expression is checked // against, followed by the type check error from the compiler. Warning *string `json:"warning,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchcondition.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchcondition.go index a5c4b433ed..93c1aeb07c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchcondition.go @@ -23,7 +23,7 @@ package v1beta1 // // MatchCondition represents a condition which must be fulfilled for a request to be sent to a webhook. type MatchConditionApplyConfiguration struct { - // Name is an identifier for this match condition, used for strategic merging of MatchConditions, + // name is an identifier for this match condition, used for strategic merging of MatchConditions, // as well as providing an identifier for logging purposes. A good name should be descriptive of // the associated expression. // Name must be a qualified name consisting of alphanumeric characters, '-', '_' or '.', and @@ -33,7 +33,7 @@ type MatchConditionApplyConfiguration struct { // // Required. Name *string `json:"name,omitempty"` - // Expression represents the expression which will be evaluated by CEL. Must evaluate to bool. + // expression represents the expression which will be evaluated by CEL. Must evaluate to bool. // CEL expressions have access to the contents of the AdmissionRequest and Authorizer, organized into CEL variables: // // 'object' - The object from the incoming request. The value is null for DELETE requests. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchresources.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchresources.go index a74a65fd64..836b0a1218 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchresources.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/matchresources.go @@ -30,7 +30,7 @@ import ( // on whether it meets the match criteria. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) type MatchResourcesApplyConfiguration struct { - // NamespaceSelector decides whether to run the admission control policy on an object based + // namespaceSelector decides whether to run the admission control policy on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -74,7 +74,7 @@ type MatchResourcesApplyConfiguration struct { // // Default to the empty LabelSelector, which matches everything. NamespaceSelector *v1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - // ObjectSelector decides whether to run the validation based on if the + // objectSelector decides whether to run the validation based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the cel validation, and // is considered to match if either object matches the selector. A null @@ -86,10 +86,10 @@ type MatchResourcesApplyConfiguration struct { // users may skip the admission webhook by setting the labels. // Default to the empty LabelSelector, which matches everything. ObjectSelector *v1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` - // ResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. + // resourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy matches. // The policy cares about an operation if it matches _any_ Rule. ResourceRules []NamedRuleWithOperationsApplyConfiguration `json:"resourceRules,omitempty"` - // ExcludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. + // excludeResourceRules describes what operations on what resources/subresources the ValidatingAdmissionPolicy should not care about. // The exclude rules take precedence over include rules (if a resource matches both, it is excluded) ExcludeResourceRules []NamedRuleWithOperationsApplyConfiguration `json:"excludeResourceRules,omitempty"` // matchPolicy defines how the "MatchResources" list is used to match incoming requests. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go index 8812dee130..9dbdd7dbd9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicy.go @@ -33,9 +33,9 @@ import ( // MutatingAdmissionPolicy describes the definition of an admission mutation policy that mutates the object coming into admission chain. type MutatingAdmissionPolicyApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the MutatingAdmissionPolicy. + // spec defines the desired behavior of the MutatingAdmissionPolicy. Spec *MutatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go index 7ee4a731e1..560d1b1469 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go @@ -43,9 +43,9 @@ import ( // given (policy, binding, param) combination is within its own CEL budget. type MutatingAdmissionPolicyBindingApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the MutatingAdmissionPolicyBinding. + // spec defines the desired behavior of the MutatingAdmissionPolicyBinding. Spec *MutatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhook.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhook.go index af93de8a95..d70d551d3e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhook.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhook.go @@ -30,23 +30,23 @@ import ( // // MutatingWebhook describes an admission webhook and the resources and operations it applies to. type MutatingWebhookApplyConfiguration struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name *string `json:"name,omitempty"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. Rules []v1.RuleWithOperationsApplyConfiguration `json:"rules,omitempty"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Ignore. FailurePolicy *admissionregistrationv1beta1.FailurePolicyType `json:"failurePolicy,omitempty"` // matchPolicy defines how the "rules" list is used to match incoming requests. @@ -64,7 +64,7 @@ type MutatingWebhookApplyConfiguration struct { // // Defaults to "Exact" MatchPolicy *admissionregistrationv1beta1.MatchPolicyType `json:"matchPolicy,omitempty"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -108,7 +108,7 @@ type MutatingWebhookApplyConfiguration struct { // // Default to the empty LabelSelector, which matches everything. NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -120,20 +120,20 @@ type MutatingWebhookApplyConfiguration struct { // users may skip the admission webhook by setting the labels. // Default to the empty LabelSelector, which matches everything. ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: Unknown, None, Some, NoneOnDryRun // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. // Requests with the dryRun attribute will be auto-rejected if they match a webhook with // sideEffects == Unknown or Some. Defaults to Unknown. SideEffects *admissionregistrationv1beta1.SideEffectClass `json:"sideEffects,omitempty"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. // Default to 30 seconds. TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -158,7 +158,7 @@ type MutatingWebhookApplyConfiguration struct { // // Defaults to "Never". ReinvocationPolicy *admissionregistrationv1.ReinvocationPolicyType `json:"reinvocationPolicy,omitempty"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go index d51d71a328..63bce15404 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -34,9 +34,9 @@ import ( // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 MutatingWebhookConfiguration instead. type MutatingWebhookConfigurationApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. Webhooks []MutatingWebhookApplyConfiguration `json:"webhooks,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go index 8b189dbb89..0da66790cc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/namedrulewithoperations.go @@ -28,7 +28,7 @@ import ( // // NamedRuleWithOperations is a tuple of Operations and Resources with ResourceNames. type NamedRuleWithOperationsApplyConfiguration struct { - // ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. + // resourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. ResourceNames []string `json:"resourceNames,omitempty"` // RuleWithOperations is a tuple of Operations and Resources. v1.RuleWithOperationsApplyConfiguration `json:",inline"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramkind.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramkind.go index dbbef1b6e0..2ee21d0fc9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramkind.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramkind.go @@ -23,11 +23,11 @@ package v1beta1 // // ParamKind is a tuple of Group Kind and Version. type ParamKindApplyConfiguration struct { - // APIVersion is the API group version the resources belong to. + // apiVersion is the API group version the resources belong to. // In format of "group/version". // Required. APIVersion *string `json:"apiVersion,omitempty"` - // Kind is the API kind the resources belong to. + // kind is the API kind the resources belong to. // Required. Kind *string `json:"kind,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramref.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramref.go index 724cd1a0de..3e598a06d9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramref.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/paramref.go @@ -62,7 +62,7 @@ type ParamRefApplyConfiguration struct { // One of `name` or `selector` must be set, but `name` and `selector` are // mutually exclusive properties. If one is set, the other must be unset. Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - // `parameterNotFoundAction` controls the behavior of the binding when the resource + // parameterNotFoundAction controls the behavior of the binding when the resource // exists, and name or selector is valid, but there are no parameters // matched by the binding. If the value is set to `Allow`, then no // matched parameters will be treated as successful validation by the binding. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/servicereference.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/servicereference.go index 9591d48a87..b1c44013a2 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/servicereference.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/servicereference.go @@ -23,18 +23,18 @@ package v1beta1 // // ServiceReference holds a reference to Service.legacy.k8s.io type ServiceReferenceApplyConfiguration struct { - // `namespace` is the namespace of the service. + // namespace is the namespace of the service. // Required Namespace *string `json:"namespace,omitempty"` - // `name` is the name of the service. + // name is the name of the service. // Required Name *string `json:"name,omitempty"` - // `path` is an optional URL path which will be sent in any request to + // path is an optional URL path which will be sent in any request to // this service. Path *string `json:"path,omitempty"` - // If specified, the port on the service that hosting webhook. + // port is the port on the service that hosts the webhook. // Default to 443 for backward compatibility. - // `port` should be a valid port number (1-65535, inclusive). + // port should be a valid port number (1-65535, inclusive). Port *int32 `json:"port,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/typechecking.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/typechecking.go index b3b26edb83..87a0ea3be6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/typechecking.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/typechecking.go @@ -24,7 +24,7 @@ package v1beta1 // TypeChecking contains results of type checking the expressions in the // ValidatingAdmissionPolicy type TypeCheckingApplyConfiguration struct { - // The type checking warnings for each expression. + // expressionWarnings contains the type checking warnings for each expression. ExpressionWarnings []ExpressionWarningApplyConfiguration `json:"expressionWarnings,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go index b8eba927d3..bc1ad6473a 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicy.go @@ -33,11 +33,11 @@ import ( // ValidatingAdmissionPolicy describes the definition of an admission validation policy that accepts or rejects an object without changing it. type ValidatingAdmissionPolicyApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the ValidatingAdmissionPolicy. + // spec defines the desired behavior of the ValidatingAdmissionPolicy. Spec *ValidatingAdmissionPolicySpecApplyConfiguration `json:"spec,omitempty"` - // The status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy + // status represents the current status of the ValidatingAdmissionPolicy, including warnings that are useful to determine if the policy // behaves in the expected way. // Populated by the system. // Read-only. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go index db33d910c2..fd658f9a45 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybinding.go @@ -43,9 +43,9 @@ import ( // given (policy, binding, param) combination is within its own CEL budget. type ValidatingAdmissionPolicyBindingApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Specification of the desired behavior of the ValidatingAdmissionPolicyBinding. + // spec defines the desired behavior of the ValidatingAdmissionPolicyBinding. Spec *ValidatingAdmissionPolicyBindingSpecApplyConfiguration `json:"spec,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybindingspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybindingspec.go index 7b1c0af26b..874cb907b0 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybindingspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicybindingspec.go @@ -27,7 +27,7 @@ import ( // // ValidatingAdmissionPolicyBindingSpec is the specification of the ValidatingAdmissionPolicyBinding. type ValidatingAdmissionPolicyBindingSpecApplyConfiguration struct { - // PolicyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. + // policyName references a ValidatingAdmissionPolicy name which the ValidatingAdmissionPolicyBinding binds to. // If the referenced resource does not exist, this binding is considered invalid and will be ignored // Required. PolicyName *string `json:"policyName,omitempty"` @@ -36,7 +36,7 @@ type ValidatingAdmissionPolicyBindingSpecApplyConfiguration struct { // If the policy specifies a ParamKind and the resource referred to by ParamRef does not exist, this binding is considered mis-configured and the FailurePolicy of the ValidatingAdmissionPolicy applied. // If the policy does not specify a ParamKind then this field is ignored, and the rules are evaluated without a param. ParamRef *ParamRefApplyConfiguration `json:"paramRef,omitempty"` - // MatchResources declares what resources match this binding and will be validated by it. + // matchResources declares what resources match this binding and will be validated by it. // Note that this is intersected with the policy's matchConstraints, so only requests that are matched by the policy can be selected by this. // If this is unset, all resources matched by the policy are validated by this binding // When resourceRules is unset, it does not constrain resource matching. If a resource is matched by the other fields of this object, it will be validated. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicyspec.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicyspec.go index 4600fb9da4..1d599eabd4 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicyspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicyspec.go @@ -27,18 +27,18 @@ import ( // // ValidatingAdmissionPolicySpec is the specification of the desired behavior of the AdmissionPolicy. type ValidatingAdmissionPolicySpecApplyConfiguration struct { - // ParamKind specifies the kind of resources used to parameterize this policy. + // paramKind specifies the kind of resources used to parameterize this policy. // If absent, there are no parameters for this policy and the param CEL variable will not be provided to validation expressions. // If ParamKind refers to a non-existent kind, this policy definition is mis-configured and the FailurePolicy is applied. // If paramKind is specified but paramRef is unset in ValidatingAdmissionPolicyBinding, the params variable will be null. ParamKind *ParamKindApplyConfiguration `json:"paramKind,omitempty"` - // MatchConstraints specifies what resources this policy is designed to validate. + // matchConstraints specifies what resources this policy is designed to validate. // The AdmissionPolicy cares about a request if it matches _all_ Constraints. // However, in order to prevent clusters from being put into an unstable state that cannot be recovered from via the API // ValidatingAdmissionPolicy cannot match ValidatingAdmissionPolicy and ValidatingAdmissionPolicyBinding. // Required. MatchConstraints *MatchResourcesApplyConfiguration `json:"matchConstraints,omitempty"` - // Validations contain CEL expressions which is used to apply the validation. + // validations contain CEL expressions which is used to apply the validation. // Validations and AuditAnnotations may not both be empty; a minimum of one Validations or AuditAnnotations is // required. Validations []ValidationApplyConfiguration `json:"validations,omitempty"` @@ -61,7 +61,7 @@ type ValidatingAdmissionPolicySpecApplyConfiguration struct { // validations and auditAnnotations may not both be empty; a least one of validations or auditAnnotations is // required. AuditAnnotations []AuditAnnotationApplyConfiguration `json:"auditAnnotations,omitempty"` - // MatchConditions is a list of conditions that must be met for a request to be validated. + // matchConditions is a list of conditions that must be met for a request to be validated. // Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. @@ -76,7 +76,7 @@ type ValidatingAdmissionPolicySpecApplyConfiguration struct { // - If failurePolicy=Fail, reject the request // - If failurePolicy=Ignore, the policy is skipped MatchConditions []MatchConditionApplyConfiguration `json:"matchConditions,omitempty"` - // Variables contain definitions of variables that can be used in composition of other expressions. + // variables contain definitions of variables that can be used in composition of other expressions. // Each variable is defined as a named CEL expression. // The variables defined here will be available under `variables` in other expressions of the policy // except MatchConditions because MatchConditions are evaluated before the rest of the policy. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicystatus.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicystatus.go index 9e05da1395..573286c146 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicystatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingadmissionpolicystatus.go @@ -27,12 +27,12 @@ import ( // // ValidatingAdmissionPolicyStatus represents the status of an admission validation policy. type ValidatingAdmissionPolicyStatusApplyConfiguration struct { - // The generation observed by the controller. + // observedGeneration is the generation observed by the controller. ObservedGeneration *int64 `json:"observedGeneration,omitempty"` - // The results of type checking for each expression. + // typeChecking contains the results of type checking for each expression. // Presence of this field indicates the completion of the type checking. TypeChecking *TypeCheckingApplyConfiguration `json:"typeChecking,omitempty"` - // The conditions represent the latest available observations of a policy's current state. + // conditions represent the latest available observations of a policy's current state. Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhook.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhook.go index c3df12b87b..f50cb4668e 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhook.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhook.go @@ -29,23 +29,23 @@ import ( // // ValidatingWebhook describes an admission webhook and the resources and operations it applies to. type ValidatingWebhookApplyConfiguration struct { - // The name of the admission webhook. + // name is the name of the admission webhook. // Name should be fully qualified, e.g., imagepolicy.kubernetes.io, where // "imagepolicy" is the name of the webhook, and kubernetes.io is the name // of the organization. // Required. Name *string `json:"name,omitempty"` - // ClientConfig defines how to communicate with the hook. + // clientConfig defines how to communicate with the hook. // Required ClientConfig *WebhookClientConfigApplyConfiguration `json:"clientConfig,omitempty"` - // Rules describes what operations on what resources/subresources the webhook cares about. + // rules describes what operations on what resources/subresources the webhook cares about. // The webhook cares about an operation if it matches _any_ Rule. // However, in order to prevent ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks // from putting the cluster in a state which cannot be recovered from without completely // disabling the plugin, ValidatingAdmissionWebhooks and MutatingAdmissionWebhooks are never called // on admission requests for ValidatingWebhookConfiguration and MutatingWebhookConfiguration objects. Rules []v1.RuleWithOperationsApplyConfiguration `json:"rules,omitempty"` - // FailurePolicy defines how unrecognized errors from the admission endpoint are handled - + // failurePolicy defines how unrecognized errors from the admission endpoint are handled - // allowed values are Ignore or Fail. Defaults to Ignore. FailurePolicy *admissionregistrationv1beta1.FailurePolicyType `json:"failurePolicy,omitempty"` // matchPolicy defines how the "rules" list is used to match incoming requests. @@ -63,7 +63,7 @@ type ValidatingWebhookApplyConfiguration struct { // // Defaults to "Exact" MatchPolicy *admissionregistrationv1beta1.MatchPolicyType `json:"matchPolicy,omitempty"` - // NamespaceSelector decides whether to run the webhook on an object based + // namespaceSelector decides whether to run the webhook on an object based // on whether the namespace for that object matches the selector. If the // object itself is a namespace, the matching is performed on // object.metadata.labels. If the object is another cluster scoped resource, @@ -107,7 +107,7 @@ type ValidatingWebhookApplyConfiguration struct { // // Default to the empty LabelSelector, which matches everything. NamespaceSelector *metav1.LabelSelectorApplyConfiguration `json:"namespaceSelector,omitempty"` - // ObjectSelector decides whether to run the webhook based on if the + // objectSelector decides whether to run the webhook based on if the // object has matching labels. objectSelector is evaluated against both // the oldObject and newObject that would be sent to the webhook, and // is considered to match if either object matches the selector. A null @@ -119,20 +119,20 @@ type ValidatingWebhookApplyConfiguration struct { // users may skip the admission webhook by setting the labels. // Default to the empty LabelSelector, which matches everything. ObjectSelector *metav1.LabelSelectorApplyConfiguration `json:"objectSelector,omitempty"` - // SideEffects states whether this webhook has side effects. + // sideEffects states whether this webhook has side effects. // Acceptable values are: Unknown, None, Some, NoneOnDryRun // Webhooks with side effects MUST implement a reconciliation system, since a request may be // rejected by a future step in the admission chain and the side effects therefore need to be undone. // Requests with the dryRun attribute will be auto-rejected if they match a webhook with // sideEffects == Unknown or Some. Defaults to Unknown. SideEffects *admissionregistrationv1beta1.SideEffectClass `json:"sideEffects,omitempty"` - // TimeoutSeconds specifies the timeout for this webhook. After the timeout passes, + // timeoutSeconds specifies the timeout for this webhook. After the timeout passes, // the webhook call will be ignored or the API call will fail based on the // failure policy. // The timeout value must be between 1 and 30 seconds. // Default to 30 seconds. TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"` - // AdmissionReviewVersions is an ordered list of preferred `AdmissionReview` + // admissionReviewVersions is an ordered list of preferred `AdmissionReview` // versions the Webhook expects. API server will try to use first version in // the list which it supports. If none of the versions specified in this list // supported by API server, validation will fail for this object. @@ -141,7 +141,7 @@ type ValidatingWebhookApplyConfiguration struct { // and be subject to the failure policy. // Default to `['v1beta1']`. AdmissionReviewVersions []string `json:"admissionReviewVersions,omitempty"` - // MatchConditions is a list of conditions that must be met for a request to be sent to this + // matchConditions is a list of conditions that must be met for a request to be sent to this // webhook. Match conditions filter requests that have already been matched by the rules, // namespaceSelector, and objectSelector. An empty list of matchConditions matches all requests. // There are a maximum of 64 match conditions allowed. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go index 66b74b31d8..dd53f3b334 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -34,9 +34,9 @@ import ( // Deprecated in v1.16, planned for removal in v1.19. Use admissionregistration.k8s.io/v1 ValidatingWebhookConfiguration instead. type ValidatingWebhookConfigurationApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. + // metadata is the standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Webhooks is a list of webhooks and the affected resources and operations. + // webhooks is a list of webhooks and the affected resources and operations. Webhooks []ValidatingWebhookApplyConfiguration `json:"webhooks,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validation.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validation.go index 6505b8b498..47ccf0f316 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validation.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validation.go @@ -27,7 +27,7 @@ import ( // // Validation specifies the CEL expression which is used to apply the validation. type ValidationApplyConfiguration struct { - // Expression represents the expression which will be evaluated by CEL. + // expression represents the expression which will be evaluated by CEL. // ref: https://github.com/google/cel-spec // CEL expressions have access to the contents of the API request/response, organized into CEL variables as well as some other useful variables: // @@ -69,7 +69,7 @@ type ValidationApplyConfiguration struct { // non-intersecting keys are appended, retaining their partial order. // Required. Expression *string `json:"expression,omitempty"` - // Message represents the message displayed when validation fails. The message is required if the Expression contains + // message represents the message displayed when validation fails. The message is required if the Expression contains // line breaks. The message must not contain line breaks. // If unset, the message is "failed rule: {Rule}". // e.g. "must be a URL with the host matching spec.host" @@ -77,7 +77,7 @@ type ValidationApplyConfiguration struct { // The message must not contain line breaks. // If unset, the message is "failed Expression: {Expression}". Message *string `json:"message,omitempty"` - // Reason represents a machine-readable description of why this validation failed. + // reason represents a machine-readable description of why this validation failed. // If this is the first validation in the list to fail, this reason, as well as the // corresponding HTTP response code, are used in the // HTTP response to the client. diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/variable.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/variable.go index db334f2265..0419a986ca 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/variable.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/variable.go @@ -23,11 +23,11 @@ package v1beta1 // // Variable is the definition of a variable that is used for composition. A variable is defined as a named expression. type VariableApplyConfiguration struct { - // Name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. + // name is the name of the variable. The name must be a valid CEL identifier and unique among all variables. // The variable can be accessed in other expressions through `variables` // For example, if name is "foo", the variable will be available as `variables.foo` Name *string `json:"name,omitempty"` - // Expression is the expression that will be evaluated as the value of the variable. + // expression is the expression that will be evaluated as the value of the variable. // The CEL expression has access to the same identifiers as the CEL expressions in Validation. Expression *string `json:"expression,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/webhookclientconfig.go b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/webhookclientconfig.go index 593ff43ebf..6710952156 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/webhookclientconfig.go +++ b/vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/webhookclientconfig.go @@ -24,7 +24,7 @@ package v1beta1 // WebhookClientConfig contains the information to make a TLS // connection with the webhook type WebhookClientConfigApplyConfiguration struct { - // `url` gives the location of the webhook, in standard URL form + // url gives the location of the webhook, in standard URL form // (`scheme://host:port/path`). Exactly one of `url` or `service` // must be specified. // @@ -50,12 +50,12 @@ type WebhookClientConfigApplyConfiguration struct { // allowed. Fragments ("#...") and query parameters ("?...") are not // allowed, either. URL *string `json:"url,omitempty"` - // `service` is a reference to the service for this webhook. Either + // service is a reference to the service for this webhook. Either // `service` or `url` must be specified. // // If the webhook is running within the cluster, then you should use `service`. Service *ServiceReferenceApplyConfiguration `json:"service,omitempty"` - // `caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. + // caBundle is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. // If unspecified, system trust roots on the apiserver are used. CABundle []byte `json:"caBundle,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/serverstorageversion.go b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/serverstorageversion.go index 94379ddc5a..5d6e1446fc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/serverstorageversion.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/serverstorageversion.go @@ -24,15 +24,16 @@ package v1alpha1 // An API server instance reports the version it can decode and the version it // encodes objects to when persisting objects in the backend. type ServerStorageVersionApplyConfiguration struct { - // The ID of the reporting API server. + // apiServerID is the ID of the reporting API server. APIServerID *string `json:"apiServerID,omitempty"` - // The API server encodes the object to this version when persisting it in + // encodingVersion the API server encodes the object to when persisting it in // the backend (e.g., etcd). EncodingVersion *string `json:"encodingVersion,omitempty"` + // decodableVersions are the encoding versions the API server can handle to decode. // The API server can decode objects encoded in these versions. // The encodingVersion must be included in the decodableVersions. DecodableVersions []string `json:"decodableVersions,omitempty"` - // The API server can serve these versions. + // servedVersions lists all versions the API server can serve. // DecodableVersions must include all ServedVersions. ServedVersions []string `json:"servedVersions,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go index e9f41cc277..46b2349b1d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go @@ -33,11 +33,12 @@ import ( // Storage version of a specific resource. type StorageVersionApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` + // metadata is the standard object metadata. // The name is .. *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // Spec is an empty spec. It is here to comply with Kubernetes API style. + // spec is an empty spec. It is here to comply with Kubernetes API style. Spec *apiserverinternalv1alpha1.StorageVersionSpec `json:"spec,omitempty"` - // API server instances report the version they can decode and the version they + // status on the version the API server instance can decode from and // encode objects to when persisting objects in the backend. Status *StorageVersionStatusApplyConfiguration `json:"status,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversioncondition.go b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversioncondition.go index 84752a4599..c78cd9affe 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversioncondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversioncondition.go @@ -28,17 +28,17 @@ import ( // // Describes the state of the storageVersion at a certain point. type StorageVersionConditionApplyConfiguration struct { - // Type of the condition. + // type of the condition. Type *apiserverinternalv1alpha1.StorageVersionConditionType `json:"type,omitempty"` - // Status of the condition, one of True, False, Unknown. + // status of the condition, one of True, False, Unknown. Status *apiserverinternalv1alpha1.ConditionStatus `json:"status,omitempty"` - // If set, this represents the .metadata.generation that the condition was set based upon. + // observedGeneration represents the .metadata.generation that the condition was set based upon, if field is set. ObservedGeneration *int64 `json:"observedGeneration,omitempty"` - // Last time the condition transitioned from one status to another. + // lastTransitionTime is the last time the condition transitioned from one status to another. LastTransitionTime *v1.Time `json:"lastTransitionTime,omitempty"` - // The reason for the condition's last transition. + // reason for the condition's last transition. Reason *string `json:"reason,omitempty"` - // A human readable message indicating details about the transition. + // message is a human readable string indicating details about the transition. Message *string `json:"message,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversionstatus.go b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversionstatus.go index 00a71ad5a2..a24c66e245 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversionstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversionstatus.go @@ -24,14 +24,15 @@ package v1alpha1 // API server instances report the versions they can decode and the version they // encode objects to when persisting objects in the backend. type StorageVersionStatusApplyConfiguration struct { - // The reported versions per API server instance. + // storageVersions lists the reported versions per API server instance. StorageVersions []ServerStorageVersionApplyConfiguration `json:"storageVersions,omitempty"` - // If all API server instances agree on the same encoding storage version, - // then this field is set to that version. Otherwise this field is left empty. + // commonEncodingVersion is set to an encoding storage version if all API server + // instances share that same version. If they don't share one storage version, this + // field is left empty. // API servers should finish updating its storageVersionStatus entry before // serving write operations, so that this field will be in sync with the reality. CommonEncodingVersion *string `json:"commonEncodingVersion,omitempty"` - // The latest available observations of the storageVersion's state. + // conditions lists the latest available observations of the storageVersion's state. Conditions []StorageVersionConditionApplyConfiguration `json:"conditions,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricsource.go deleted file mode 100644 index 392e491cf9..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricsource.go +++ /dev/null @@ -1,87 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// ContainerResourceMetricSourceApplyConfiguration represents a declarative configuration of the ContainerResourceMetricSource type for use -// with apply. -// -// ContainerResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ContainerResourceMetricSourceApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // targetAverageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty"` - // targetAverageValue is the target value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty"` - // container is the name of the container in the pods of the scaling target - Container *string `json:"container,omitempty"` -} - -// ContainerResourceMetricSourceApplyConfiguration constructs a declarative configuration of the ContainerResourceMetricSource type for use with -// apply. -func ContainerResourceMetricSource() *ContainerResourceMetricSourceApplyConfiguration { - return &ContainerResourceMetricSourceApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ContainerResourceMetricSourceApplyConfiguration) WithName(value v1.ResourceName) *ContainerResourceMetricSourceApplyConfiguration { - b.Name = &value - return b -} - -// WithTargetAverageUtilization sets the TargetAverageUtilization field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetAverageUtilization field is set to the value of the last call. -func (b *ContainerResourceMetricSourceApplyConfiguration) WithTargetAverageUtilization(value int32) *ContainerResourceMetricSourceApplyConfiguration { - b.TargetAverageUtilization = &value - return b -} - -// WithTargetAverageValue sets the TargetAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetAverageValue field is set to the value of the last call. -func (b *ContainerResourceMetricSourceApplyConfiguration) WithTargetAverageValue(value resource.Quantity) *ContainerResourceMetricSourceApplyConfiguration { - b.TargetAverageValue = &value - return b -} - -// WithContainer sets the Container field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Container field is set to the value of the last call. -func (b *ContainerResourceMetricSourceApplyConfiguration) WithContainer(value string) *ContainerResourceMetricSourceApplyConfiguration { - b.Container = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricstatus.go deleted file mode 100644 index e69d2bad8a..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricstatus.go +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// ContainerResourceMetricStatusApplyConfiguration represents a declarative configuration of the ContainerResourceMetricStatus type for use -// with apply. -// -// ContainerResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing a single container in each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ContainerResourceMetricStatusApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // currentAverageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. It will only be - // present if `targetAverageValue` was set in the corresponding metric - // specification. - CurrentAverageUtilization *int32 `json:"currentAverageUtilization,omitempty"` - // currentAverageValue is the current value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // It will always be set, regardless of the corresponding metric specification. - CurrentAverageValue *resource.Quantity `json:"currentAverageValue,omitempty"` - // container is the name of the container in the pods of the scaling target - Container *string `json:"container,omitempty"` -} - -// ContainerResourceMetricStatusApplyConfiguration constructs a declarative configuration of the ContainerResourceMetricStatus type for use with -// apply. -func ContainerResourceMetricStatus() *ContainerResourceMetricStatusApplyConfiguration { - return &ContainerResourceMetricStatusApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ContainerResourceMetricStatusApplyConfiguration) WithName(value v1.ResourceName) *ContainerResourceMetricStatusApplyConfiguration { - b.Name = &value - return b -} - -// WithCurrentAverageUtilization sets the CurrentAverageUtilization field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentAverageUtilization field is set to the value of the last call. -func (b *ContainerResourceMetricStatusApplyConfiguration) WithCurrentAverageUtilization(value int32) *ContainerResourceMetricStatusApplyConfiguration { - b.CurrentAverageUtilization = &value - return b -} - -// WithCurrentAverageValue sets the CurrentAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentAverageValue field is set to the value of the last call. -func (b *ContainerResourceMetricStatusApplyConfiguration) WithCurrentAverageValue(value resource.Quantity) *ContainerResourceMetricStatusApplyConfiguration { - b.CurrentAverageValue = &value - return b -} - -// WithContainer sets the Container field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Container field is set to the value of the last call. -func (b *ContainerResourceMetricStatusApplyConfiguration) WithContainer(value string) *ContainerResourceMetricStatusApplyConfiguration { - b.Container = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/crossversionobjectreference.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/crossversionobjectreference.go deleted file mode 100644 index 40c8e450f5..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/crossversionobjectreference.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -// CrossVersionObjectReferenceApplyConfiguration represents a declarative configuration of the CrossVersionObjectReference type for use -// with apply. -// -// CrossVersionObjectReference contains enough information to let you identify the referred resource. -type CrossVersionObjectReferenceApplyConfiguration struct { - // Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - Kind *string `json:"kind,omitempty"` - // Name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - Name *string `json:"name,omitempty"` - // API version of the referent - APIVersion *string `json:"apiVersion,omitempty"` -} - -// CrossVersionObjectReferenceApplyConfiguration constructs a declarative configuration of the CrossVersionObjectReference type for use with -// apply. -func CrossVersionObjectReference() *CrossVersionObjectReferenceApplyConfiguration { - return &CrossVersionObjectReferenceApplyConfiguration{} -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *CrossVersionObjectReferenceApplyConfiguration) WithKind(value string) *CrossVersionObjectReferenceApplyConfiguration { - b.Kind = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *CrossVersionObjectReferenceApplyConfiguration) WithName(value string) *CrossVersionObjectReferenceApplyConfiguration { - b.Name = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *CrossVersionObjectReferenceApplyConfiguration) WithAPIVersion(value string) *CrossVersionObjectReferenceApplyConfiguration { - b.APIVersion = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricsource.go deleted file mode 100644 index 3b07217257..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricsource.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// ExternalMetricSourceApplyConfiguration represents a declarative configuration of the ExternalMetricSource type for use -// with apply. -// -// ExternalMetricSource indicates how to scale on a metric not associated with -// any Kubernetes object (for example length of queue in cloud -// messaging service, or QPS from loadbalancer running outside of cluster). -// Exactly one "target" type should be set. -type ExternalMetricSourceApplyConfiguration struct { - // metricName is the name of the metric in question. - MetricName *string `json:"metricName,omitempty"` - // metricSelector is used to identify a specific time series - // within a given metric. - MetricSelector *v1.LabelSelectorApplyConfiguration `json:"metricSelector,omitempty"` - // targetValue is the target value of the metric (as a quantity). - // Mutually exclusive with TargetAverageValue. - TargetValue *resource.Quantity `json:"targetValue,omitempty"` - // targetAverageValue is the target per-pod value of global metric (as a quantity). - // Mutually exclusive with TargetValue. - TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty"` -} - -// ExternalMetricSourceApplyConfiguration constructs a declarative configuration of the ExternalMetricSource type for use with -// apply. -func ExternalMetricSource() *ExternalMetricSourceApplyConfiguration { - return &ExternalMetricSourceApplyConfiguration{} -} - -// WithMetricName sets the MetricName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricName field is set to the value of the last call. -func (b *ExternalMetricSourceApplyConfiguration) WithMetricName(value string) *ExternalMetricSourceApplyConfiguration { - b.MetricName = &value - return b -} - -// WithMetricSelector sets the MetricSelector field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricSelector field is set to the value of the last call. -func (b *ExternalMetricSourceApplyConfiguration) WithMetricSelector(value *v1.LabelSelectorApplyConfiguration) *ExternalMetricSourceApplyConfiguration { - b.MetricSelector = value - return b -} - -// WithTargetValue sets the TargetValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetValue field is set to the value of the last call. -func (b *ExternalMetricSourceApplyConfiguration) WithTargetValue(value resource.Quantity) *ExternalMetricSourceApplyConfiguration { - b.TargetValue = &value - return b -} - -// WithTargetAverageValue sets the TargetAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetAverageValue field is set to the value of the last call. -func (b *ExternalMetricSourceApplyConfiguration) WithTargetAverageValue(value resource.Quantity) *ExternalMetricSourceApplyConfiguration { - b.TargetAverageValue = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricstatus.go deleted file mode 100644 index c7e3629a9a..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricstatus.go +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// ExternalMetricStatusApplyConfiguration represents a declarative configuration of the ExternalMetricStatus type for use -// with apply. -// -// ExternalMetricStatus indicates the current value of a global metric -// not associated with any Kubernetes object. -type ExternalMetricStatusApplyConfiguration struct { - // metricName is the name of a metric used for autoscaling in - // metric system. - MetricName *string `json:"metricName,omitempty"` - // metricSelector is used to identify a specific time series - // within a given metric. - MetricSelector *v1.LabelSelectorApplyConfiguration `json:"metricSelector,omitempty"` - // currentValue is the current value of the metric (as a quantity) - CurrentValue *resource.Quantity `json:"currentValue,omitempty"` - // currentAverageValue is the current value of metric averaged over autoscaled pods. - CurrentAverageValue *resource.Quantity `json:"currentAverageValue,omitempty"` -} - -// ExternalMetricStatusApplyConfiguration constructs a declarative configuration of the ExternalMetricStatus type for use with -// apply. -func ExternalMetricStatus() *ExternalMetricStatusApplyConfiguration { - return &ExternalMetricStatusApplyConfiguration{} -} - -// WithMetricName sets the MetricName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricName field is set to the value of the last call. -func (b *ExternalMetricStatusApplyConfiguration) WithMetricName(value string) *ExternalMetricStatusApplyConfiguration { - b.MetricName = &value - return b -} - -// WithMetricSelector sets the MetricSelector field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricSelector field is set to the value of the last call. -func (b *ExternalMetricStatusApplyConfiguration) WithMetricSelector(value *v1.LabelSelectorApplyConfiguration) *ExternalMetricStatusApplyConfiguration { - b.MetricSelector = value - return b -} - -// WithCurrentValue sets the CurrentValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentValue field is set to the value of the last call. -func (b *ExternalMetricStatusApplyConfiguration) WithCurrentValue(value resource.Quantity) *ExternalMetricStatusApplyConfiguration { - b.CurrentValue = &value - return b -} - -// WithCurrentAverageValue sets the CurrentAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentAverageValue field is set to the value of the last call. -func (b *ExternalMetricStatusApplyConfiguration) WithCurrentAverageValue(value resource.Quantity) *ExternalMetricStatusApplyConfiguration { - b.CurrentAverageValue = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalercondition.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalercondition.go deleted file mode 100644 index 302df35a73..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalercondition.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// HorizontalPodAutoscalerConditionApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscalerCondition type for use -// with apply. -// -// HorizontalPodAutoscalerCondition describes the state of -// a HorizontalPodAutoscaler at a certain point. -type HorizontalPodAutoscalerConditionApplyConfiguration struct { - // type describes the current condition - Type *autoscalingv2beta1.HorizontalPodAutoscalerConditionType `json:"type,omitempty"` - // status is the status of the condition (True, False, Unknown) - Status *v1.ConditionStatus `json:"status,omitempty"` - // lastTransitionTime is the last time the condition transitioned from - // one status to another - LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` - // reason is the reason for the condition's last transition. - Reason *string `json:"reason,omitempty"` - // message is a human-readable explanation containing details about - // the transition - Message *string `json:"message,omitempty"` -} - -// HorizontalPodAutoscalerConditionApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerCondition type for use with -// apply. -func HorizontalPodAutoscalerCondition() *HorizontalPodAutoscalerConditionApplyConfiguration { - return &HorizontalPodAutoscalerConditionApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithType(value autoscalingv2beta1.HorizontalPodAutoscalerConditionType) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Type = &value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Status = &value - return b -} - -// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LastTransitionTime field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.LastTransitionTime = &value - return b -} - -// WithReason sets the Reason field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Reason field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithReason(value string) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Reason = &value - return b -} - -// WithMessage sets the Message field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Message field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithMessage(value string) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Message = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerspec.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerspec.go deleted file mode 100644 index bbe6a8febf..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerspec.go +++ /dev/null @@ -1,89 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -// HorizontalPodAutoscalerSpecApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscalerSpec type for use -// with apply. -// -// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. -type HorizontalPodAutoscalerSpecApplyConfiguration struct { - // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics - // should be collected, as well as to actually change the replica count. - ScaleTargetRef *CrossVersionObjectReferenceApplyConfiguration `json:"scaleTargetRef,omitempty"` - // minReplicas is the lower limit for the number of replicas to which the autoscaler - // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the - // alpha feature gate HPAScaleToZero is enabled and at least one Object or External - // metric is configured. Scaling is active as long as at least one metric value is - // available. - MinReplicas *int32 `json:"minReplicas,omitempty"` - // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. - // It cannot be less that minReplicas. - MaxReplicas *int32 `json:"maxReplicas,omitempty"` - // metrics contains the specifications for which to use to calculate the - // desired replica count (the maximum replica count across all metrics will - // be used). The desired replica count is calculated multiplying the - // ratio between the target value and the current value by the current - // number of pods. Ergo, metrics used must decrease as the pod count is - // increased, and vice-versa. See the individual metric source types for - // more information about how each type of metric must respond. - Metrics []MetricSpecApplyConfiguration `json:"metrics,omitempty"` -} - -// HorizontalPodAutoscalerSpecApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerSpec type for use with -// apply. -func HorizontalPodAutoscalerSpec() *HorizontalPodAutoscalerSpecApplyConfiguration { - return &HorizontalPodAutoscalerSpecApplyConfiguration{} -} - -// WithScaleTargetRef sets the ScaleTargetRef field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ScaleTargetRef field is set to the value of the last call. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithScaleTargetRef(value *CrossVersionObjectReferenceApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { - b.ScaleTargetRef = value - return b -} - -// WithMinReplicas sets the MinReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MinReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMinReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { - b.MinReplicas = &value - return b -} - -// WithMaxReplicas sets the MaxReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MaxReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMaxReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { - b.MaxReplicas = &value - return b -} - -// WithMetrics adds the given value to the Metrics field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Metrics field. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMetrics(values ...*MetricSpecApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithMetrics") - } - b.Metrics = append(b.Metrics, *values[i]) - } - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerstatus.go deleted file mode 100644 index 831ad5cf6f..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerstatus.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// HorizontalPodAutoscalerStatusApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscalerStatus type for use -// with apply. -// -// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. -type HorizontalPodAutoscalerStatusApplyConfiguration struct { - // observedGeneration is the most recent generation observed by this autoscaler. - ObservedGeneration *int64 `json:"observedGeneration,omitempty"` - // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, - // used by the autoscaler to control how often the number of pods is changed. - LastScaleTime *v1.Time `json:"lastScaleTime,omitempty"` - // currentReplicas is current number of replicas of pods managed by this autoscaler, - // as last seen by the autoscaler. - CurrentReplicas *int32 `json:"currentReplicas,omitempty"` - // desiredReplicas is the desired number of replicas of pods managed by this autoscaler, - // as last calculated by the autoscaler. - DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` - // currentMetrics is the last read state of the metrics used by this autoscaler. - CurrentMetrics []MetricStatusApplyConfiguration `json:"currentMetrics,omitempty"` - // conditions is the set of conditions required for this autoscaler to scale its target, - // and indicates whether or not those conditions are met. - Conditions []HorizontalPodAutoscalerConditionApplyConfiguration `json:"conditions,omitempty"` -} - -// HorizontalPodAutoscalerStatusApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerStatus type for use with -// apply. -func HorizontalPodAutoscalerStatus() *HorizontalPodAutoscalerStatusApplyConfiguration { - return &HorizontalPodAutoscalerStatusApplyConfiguration{} -} - -// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ObservedGeneration field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithObservedGeneration(value int64) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.ObservedGeneration = &value - return b -} - -// WithLastScaleTime sets the LastScaleTime field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LastScaleTime field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithLastScaleTime(value v1.Time) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.LastScaleTime = &value - return b -} - -// WithCurrentReplicas sets the CurrentReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.CurrentReplicas = &value - return b -} - -// WithDesiredReplicas sets the DesiredReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DesiredReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithDesiredReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.DesiredReplicas = &value - return b -} - -// WithCurrentMetrics adds the given value to the CurrentMetrics field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the CurrentMetrics field. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentMetrics(values ...*MetricStatusApplyConfiguration) *HorizontalPodAutoscalerStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithCurrentMetrics") - } - b.CurrentMetrics = append(b.CurrentMetrics, *values[i]) - } - return b -} - -// WithConditions adds the given value to the Conditions field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Conditions field. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithConditions(values ...*HorizontalPodAutoscalerConditionApplyConfiguration) *HorizontalPodAutoscalerStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithConditions") - } - b.Conditions = append(b.Conditions, *values[i]) - } - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricspec.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricspec.go deleted file mode 100644 index d48043c322..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricspec.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" -) - -// MetricSpecApplyConfiguration represents a declarative configuration of the MetricSpec type for use -// with apply. -// -// MetricSpec specifies how to scale based on a single metric -// (only `type` and one other matching field should be set at once). -type MetricSpecApplyConfiguration struct { - // type is the type of metric source. It should be one of "ContainerResource", - // "External", "Object", "Pods" or "Resource", each mapping to a matching field in the object. - Type *autoscalingv2beta1.MetricSourceType `json:"type,omitempty"` - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - Object *ObjectMetricSourceApplyConfiguration `json:"object,omitempty"` - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - Pods *PodsMetricSourceApplyConfiguration `json:"pods,omitempty"` - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - Resource *ResourceMetricSourceApplyConfiguration `json:"resource,omitempty"` - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in - // each pod of the current scale target (e.g. CPU or memory). Such metrics are - // built in to Kubernetes, and have special scaling options on top of those - // available to normal per-pod metrics using the "pods" source. - ContainerResource *ContainerResourceMetricSourceApplyConfiguration `json:"containerResource,omitempty"` - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - External *ExternalMetricSourceApplyConfiguration `json:"external,omitempty"` -} - -// MetricSpecApplyConfiguration constructs a declarative configuration of the MetricSpec type for use with -// apply. -func MetricSpec() *MetricSpecApplyConfiguration { - return &MetricSpecApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithType(value autoscalingv2beta1.MetricSourceType) *MetricSpecApplyConfiguration { - b.Type = &value - return b -} - -// WithObject sets the Object field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Object field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithObject(value *ObjectMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.Object = value - return b -} - -// WithPods sets the Pods field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Pods field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithPods(value *PodsMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.Pods = value - return b -} - -// WithResource sets the Resource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Resource field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithResource(value *ResourceMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.Resource = value - return b -} - -// WithContainerResource sets the ContainerResource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ContainerResource field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithContainerResource(value *ContainerResourceMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.ContainerResource = value - return b -} - -// WithExternal sets the External field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the External field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithExternal(value *ExternalMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.External = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricstatus.go deleted file mode 100644 index 7ec38582de..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricstatus.go +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" -) - -// MetricStatusApplyConfiguration represents a declarative configuration of the MetricStatus type for use -// with apply. -// -// MetricStatus describes the last-read state of a single metric. -type MetricStatusApplyConfiguration struct { - // type is the type of metric source. It will be one of "ContainerResource", - // "External", "Object", "Pods" or "Resource", each corresponds to a matching field in the object. - Type *autoscalingv2beta1.MetricSourceType `json:"type,omitempty"` - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - Object *ObjectMetricStatusApplyConfiguration `json:"object,omitempty"` - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - Pods *PodsMetricStatusApplyConfiguration `json:"pods,omitempty"` - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - Resource *ResourceMetricStatusApplyConfiguration `json:"resource,omitempty"` - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - ContainerResource *ContainerResourceMetricStatusApplyConfiguration `json:"containerResource,omitempty"` - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - External *ExternalMetricStatusApplyConfiguration `json:"external,omitempty"` -} - -// MetricStatusApplyConfiguration constructs a declarative configuration of the MetricStatus type for use with -// apply. -func MetricStatus() *MetricStatusApplyConfiguration { - return &MetricStatusApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithType(value autoscalingv2beta1.MetricSourceType) *MetricStatusApplyConfiguration { - b.Type = &value - return b -} - -// WithObject sets the Object field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Object field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithObject(value *ObjectMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.Object = value - return b -} - -// WithPods sets the Pods field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Pods field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithPods(value *PodsMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.Pods = value - return b -} - -// WithResource sets the Resource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Resource field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithResource(value *ResourceMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.Resource = value - return b -} - -// WithContainerResource sets the ContainerResource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ContainerResource field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithContainerResource(value *ContainerResourceMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.ContainerResource = value - return b -} - -// WithExternal sets the External field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the External field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithExternal(value *ExternalMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.External = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricsource.go deleted file mode 100644 index 103280e268..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricsource.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// ObjectMetricSourceApplyConfiguration represents a declarative configuration of the ObjectMetricSource type for use -// with apply. -// -// ObjectMetricSource indicates how to scale on a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricSourceApplyConfiguration struct { - // target is the described Kubernetes object. - Target *CrossVersionObjectReferenceApplyConfiguration `json:"target,omitempty"` - // metricName is the name of the metric in question. - MetricName *string `json:"metricName,omitempty"` - // targetValue is the target value of the metric (as a quantity). - TargetValue *resource.Quantity `json:"targetValue,omitempty"` - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping - // When unset, just the metricName will be used to gather metrics. - Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - // averageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - AverageValue *resource.Quantity `json:"averageValue,omitempty"` -} - -// ObjectMetricSourceApplyConfiguration constructs a declarative configuration of the ObjectMetricSource type for use with -// apply. -func ObjectMetricSource() *ObjectMetricSourceApplyConfiguration { - return &ObjectMetricSourceApplyConfiguration{} -} - -// WithTarget sets the Target field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Target field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithTarget(value *CrossVersionObjectReferenceApplyConfiguration) *ObjectMetricSourceApplyConfiguration { - b.Target = value - return b -} - -// WithMetricName sets the MetricName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricName field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithMetricName(value string) *ObjectMetricSourceApplyConfiguration { - b.MetricName = &value - return b -} - -// WithTargetValue sets the TargetValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetValue field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithTargetValue(value resource.Quantity) *ObjectMetricSourceApplyConfiguration { - b.TargetValue = &value - return b -} - -// WithSelector sets the Selector field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Selector field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *ObjectMetricSourceApplyConfiguration { - b.Selector = value - return b -} - -// WithAverageValue sets the AverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AverageValue field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithAverageValue(value resource.Quantity) *ObjectMetricSourceApplyConfiguration { - b.AverageValue = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricstatus.go deleted file mode 100644 index b58d0e28db..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricstatus.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// ObjectMetricStatusApplyConfiguration represents a declarative configuration of the ObjectMetricStatus type for use -// with apply. -// -// ObjectMetricStatus indicates the current value of a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricStatusApplyConfiguration struct { - // target is the described Kubernetes object. - Target *CrossVersionObjectReferenceApplyConfiguration `json:"target,omitempty"` - // metricName is the name of the metric in question. - MetricName *string `json:"metricName,omitempty"` - // currentValue is the current value of the metric (as a quantity). - CurrentValue *resource.Quantity `json:"currentValue,omitempty"` - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set in the ObjectMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` - // averageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - AverageValue *resource.Quantity `json:"averageValue,omitempty"` -} - -// ObjectMetricStatusApplyConfiguration constructs a declarative configuration of the ObjectMetricStatus type for use with -// apply. -func ObjectMetricStatus() *ObjectMetricStatusApplyConfiguration { - return &ObjectMetricStatusApplyConfiguration{} -} - -// WithTarget sets the Target field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Target field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithTarget(value *CrossVersionObjectReferenceApplyConfiguration) *ObjectMetricStatusApplyConfiguration { - b.Target = value - return b -} - -// WithMetricName sets the MetricName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricName field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithMetricName(value string) *ObjectMetricStatusApplyConfiguration { - b.MetricName = &value - return b -} - -// WithCurrentValue sets the CurrentValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentValue field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithCurrentValue(value resource.Quantity) *ObjectMetricStatusApplyConfiguration { - b.CurrentValue = &value - return b -} - -// WithSelector sets the Selector field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Selector field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *ObjectMetricStatusApplyConfiguration { - b.Selector = value - return b -} - -// WithAverageValue sets the AverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AverageValue field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithAverageValue(value resource.Quantity) *ObjectMetricStatusApplyConfiguration { - b.AverageValue = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricsource.go deleted file mode 100644 index 47ceaee50b..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricsource.go +++ /dev/null @@ -1,73 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// PodsMetricSourceApplyConfiguration represents a declarative configuration of the PodsMetricSource type for use -// with apply. -// -// PodsMetricSource indicates how to scale on a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -// The values will be averaged together before being compared to the target -// value. -type PodsMetricSourceApplyConfiguration struct { - // metricName is the name of the metric in question - MetricName *string `json:"metricName,omitempty"` - // targetAverageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty"` - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping - // When unset, just the metricName will be used to gather metrics. - Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` -} - -// PodsMetricSourceApplyConfiguration constructs a declarative configuration of the PodsMetricSource type for use with -// apply. -func PodsMetricSource() *PodsMetricSourceApplyConfiguration { - return &PodsMetricSourceApplyConfiguration{} -} - -// WithMetricName sets the MetricName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricName field is set to the value of the last call. -func (b *PodsMetricSourceApplyConfiguration) WithMetricName(value string) *PodsMetricSourceApplyConfiguration { - b.MetricName = &value - return b -} - -// WithTargetAverageValue sets the TargetAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetAverageValue field is set to the value of the last call. -func (b *PodsMetricSourceApplyConfiguration) WithTargetAverageValue(value resource.Quantity) *PodsMetricSourceApplyConfiguration { - b.TargetAverageValue = &value - return b -} - -// WithSelector sets the Selector field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Selector field is set to the value of the last call. -func (b *PodsMetricSourceApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *PodsMetricSourceApplyConfiguration { - b.Selector = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricstatus.go deleted file mode 100644 index 140f0a2292..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricstatus.go +++ /dev/null @@ -1,71 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// PodsMetricStatusApplyConfiguration represents a declarative configuration of the PodsMetricStatus type for use -// with apply. -// -// PodsMetricStatus indicates the current value of a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -type PodsMetricStatusApplyConfiguration struct { - // metricName is the name of the metric in question - MetricName *string `json:"metricName,omitempty"` - // currentAverageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - CurrentAverageValue *resource.Quantity `json:"currentAverageValue,omitempty"` - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set in the PodsMetricSource, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` -} - -// PodsMetricStatusApplyConfiguration constructs a declarative configuration of the PodsMetricStatus type for use with -// apply. -func PodsMetricStatus() *PodsMetricStatusApplyConfiguration { - return &PodsMetricStatusApplyConfiguration{} -} - -// WithMetricName sets the MetricName field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MetricName field is set to the value of the last call. -func (b *PodsMetricStatusApplyConfiguration) WithMetricName(value string) *PodsMetricStatusApplyConfiguration { - b.MetricName = &value - return b -} - -// WithCurrentAverageValue sets the CurrentAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentAverageValue field is set to the value of the last call. -func (b *PodsMetricStatusApplyConfiguration) WithCurrentAverageValue(value resource.Quantity) *PodsMetricStatusApplyConfiguration { - b.CurrentAverageValue = &value - return b -} - -// WithSelector sets the Selector field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Selector field is set to the value of the last call. -func (b *PodsMetricStatusApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *PodsMetricStatusApplyConfiguration { - b.Selector = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricsource.go deleted file mode 100644 index 0c3c849e3c..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricsource.go +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// ResourceMetricSourceApplyConfiguration represents a declarative configuration of the ResourceMetricSource type for use -// with apply. -// -// ResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ResourceMetricSourceApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // targetAverageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - TargetAverageUtilization *int32 `json:"targetAverageUtilization,omitempty"` - // targetAverageValue is the target value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - TargetAverageValue *resource.Quantity `json:"targetAverageValue,omitempty"` -} - -// ResourceMetricSourceApplyConfiguration constructs a declarative configuration of the ResourceMetricSource type for use with -// apply. -func ResourceMetricSource() *ResourceMetricSourceApplyConfiguration { - return &ResourceMetricSourceApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ResourceMetricSourceApplyConfiguration) WithName(value v1.ResourceName) *ResourceMetricSourceApplyConfiguration { - b.Name = &value - return b -} - -// WithTargetAverageUtilization sets the TargetAverageUtilization field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetAverageUtilization field is set to the value of the last call. -func (b *ResourceMetricSourceApplyConfiguration) WithTargetAverageUtilization(value int32) *ResourceMetricSourceApplyConfiguration { - b.TargetAverageUtilization = &value - return b -} - -// WithTargetAverageValue sets the TargetAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the TargetAverageValue field is set to the value of the last call. -func (b *ResourceMetricSourceApplyConfiguration) WithTargetAverageValue(value resource.Quantity) *ResourceMetricSourceApplyConfiguration { - b.TargetAverageValue = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricstatus.go deleted file mode 100644 index 61db2eae0d..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricstatus.go +++ /dev/null @@ -1,78 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta1 - -import ( - v1 "k8s.io/api/core/v1" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// ResourceMetricStatusApplyConfiguration represents a declarative configuration of the ResourceMetricStatus type for use -// with apply. -// -// ResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ResourceMetricStatusApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // currentAverageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. It will only be - // present if `targetAverageValue` was set in the corresponding metric - // specification. - CurrentAverageUtilization *int32 `json:"currentAverageUtilization,omitempty"` - // currentAverageValue is the current value of the average of the - // resource metric across all relevant pods, as a raw value (instead of as - // a percentage of the request), similar to the "pods" metric source type. - // It will always be set, regardless of the corresponding metric specification. - CurrentAverageValue *resource.Quantity `json:"currentAverageValue,omitempty"` -} - -// ResourceMetricStatusApplyConfiguration constructs a declarative configuration of the ResourceMetricStatus type for use with -// apply. -func ResourceMetricStatus() *ResourceMetricStatusApplyConfiguration { - return &ResourceMetricStatusApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ResourceMetricStatusApplyConfiguration) WithName(value v1.ResourceName) *ResourceMetricStatusApplyConfiguration { - b.Name = &value - return b -} - -// WithCurrentAverageUtilization sets the CurrentAverageUtilization field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentAverageUtilization field is set to the value of the last call. -func (b *ResourceMetricStatusApplyConfiguration) WithCurrentAverageUtilization(value int32) *ResourceMetricStatusApplyConfiguration { - b.CurrentAverageUtilization = &value - return b -} - -// WithCurrentAverageValue sets the CurrentAverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentAverageValue field is set to the value of the last call. -func (b *ResourceMetricStatusApplyConfiguration) WithCurrentAverageValue(value resource.Quantity) *ResourceMetricStatusApplyConfiguration { - b.CurrentAverageValue = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricsource.go deleted file mode 100644 index babb8e8bb0..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricsource.go +++ /dev/null @@ -1,72 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - v1 "k8s.io/api/core/v1" -) - -// ContainerResourceMetricSourceApplyConfiguration represents a declarative configuration of the ContainerResourceMetricSource type for use -// with apply. -// -// ContainerResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ContainerResourceMetricSourceApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // target specifies the target value for the given metric - Target *MetricTargetApplyConfiguration `json:"target,omitempty"` - // container is the name of the container in the pods of the scaling target - Container *string `json:"container,omitempty"` -} - -// ContainerResourceMetricSourceApplyConfiguration constructs a declarative configuration of the ContainerResourceMetricSource type for use with -// apply. -func ContainerResourceMetricSource() *ContainerResourceMetricSourceApplyConfiguration { - return &ContainerResourceMetricSourceApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ContainerResourceMetricSourceApplyConfiguration) WithName(value v1.ResourceName) *ContainerResourceMetricSourceApplyConfiguration { - b.Name = &value - return b -} - -// WithTarget sets the Target field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Target field is set to the value of the last call. -func (b *ContainerResourceMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ContainerResourceMetricSourceApplyConfiguration { - b.Target = value - return b -} - -// WithContainer sets the Container field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Container field is set to the value of the last call. -func (b *ContainerResourceMetricSourceApplyConfiguration) WithContainer(value string) *ContainerResourceMetricSourceApplyConfiguration { - b.Container = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricstatus.go deleted file mode 100644 index 771e9fdfcf..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricstatus.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - v1 "k8s.io/api/core/v1" -) - -// ContainerResourceMetricStatusApplyConfiguration represents a declarative configuration of the ContainerResourceMetricStatus type for use -// with apply. -// -// ContainerResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing a single container in each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ContainerResourceMetricStatusApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // current contains the current value for the given metric - Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` - // container is the name of the container in the pods of the scaling target - Container *string `json:"container,omitempty"` -} - -// ContainerResourceMetricStatusApplyConfiguration constructs a declarative configuration of the ContainerResourceMetricStatus type for use with -// apply. -func ContainerResourceMetricStatus() *ContainerResourceMetricStatusApplyConfiguration { - return &ContainerResourceMetricStatusApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ContainerResourceMetricStatusApplyConfiguration) WithName(value v1.ResourceName) *ContainerResourceMetricStatusApplyConfiguration { - b.Name = &value - return b -} - -// WithCurrent sets the Current field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Current field is set to the value of the last call. -func (b *ContainerResourceMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ContainerResourceMetricStatusApplyConfiguration { - b.Current = value - return b -} - -// WithContainer sets the Container field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Container field is set to the value of the last call. -func (b *ContainerResourceMetricStatusApplyConfiguration) WithContainer(value string) *ContainerResourceMetricStatusApplyConfiguration { - b.Container = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/crossversionobjectreference.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/crossversionobjectreference.go deleted file mode 100644 index df6708a19d..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/crossversionobjectreference.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// CrossVersionObjectReferenceApplyConfiguration represents a declarative configuration of the CrossVersionObjectReference type for use -// with apply. -// -// CrossVersionObjectReference contains enough information to let you identify the referred resource. -type CrossVersionObjectReferenceApplyConfiguration struct { - // kind is the kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - Kind *string `json:"kind,omitempty"` - // name is the name of the referent; More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - Name *string `json:"name,omitempty"` - // apiVersion is the API version of the referent - APIVersion *string `json:"apiVersion,omitempty"` -} - -// CrossVersionObjectReferenceApplyConfiguration constructs a declarative configuration of the CrossVersionObjectReference type for use with -// apply. -func CrossVersionObjectReference() *CrossVersionObjectReferenceApplyConfiguration { - return &CrossVersionObjectReferenceApplyConfiguration{} -} - -// WithKind sets the Kind field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Kind field is set to the value of the last call. -func (b *CrossVersionObjectReferenceApplyConfiguration) WithKind(value string) *CrossVersionObjectReferenceApplyConfiguration { - b.Kind = &value - return b -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *CrossVersionObjectReferenceApplyConfiguration) WithName(value string) *CrossVersionObjectReferenceApplyConfiguration { - b.Name = &value - return b -} - -// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the APIVersion field is set to the value of the last call. -func (b *CrossVersionObjectReferenceApplyConfiguration) WithAPIVersion(value string) *CrossVersionObjectReferenceApplyConfiguration { - b.APIVersion = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricsource.go deleted file mode 100644 index 6baca7f05d..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricsource.go +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// ExternalMetricSourceApplyConfiguration represents a declarative configuration of the ExternalMetricSource type for use -// with apply. -// -// ExternalMetricSource indicates how to scale on a metric not associated with -// any Kubernetes object (for example length of queue in cloud -// messaging service, or QPS from loadbalancer running outside of cluster). -type ExternalMetricSourceApplyConfiguration struct { - // metric identifies the target metric by name and selector - Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` - // target specifies the target value for the given metric - Target *MetricTargetApplyConfiguration `json:"target,omitempty"` -} - -// ExternalMetricSourceApplyConfiguration constructs a declarative configuration of the ExternalMetricSource type for use with -// apply. -func ExternalMetricSource() *ExternalMetricSourceApplyConfiguration { - return &ExternalMetricSourceApplyConfiguration{} -} - -// WithMetric sets the Metric field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Metric field is set to the value of the last call. -func (b *ExternalMetricSourceApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ExternalMetricSourceApplyConfiguration { - b.Metric = value - return b -} - -// WithTarget sets the Target field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Target field is set to the value of the last call. -func (b *ExternalMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ExternalMetricSourceApplyConfiguration { - b.Target = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricstatus.go deleted file mode 100644 index 725f563544..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricstatus.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// ExternalMetricStatusApplyConfiguration represents a declarative configuration of the ExternalMetricStatus type for use -// with apply. -// -// ExternalMetricStatus indicates the current value of a global metric -// not associated with any Kubernetes object. -type ExternalMetricStatusApplyConfiguration struct { - // metric identifies the target metric by name and selector - Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` - // current contains the current value for the given metric - Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` -} - -// ExternalMetricStatusApplyConfiguration constructs a declarative configuration of the ExternalMetricStatus type for use with -// apply. -func ExternalMetricStatus() *ExternalMetricStatusApplyConfiguration { - return &ExternalMetricStatusApplyConfiguration{} -} - -// WithMetric sets the Metric field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Metric field is set to the value of the last call. -func (b *ExternalMetricStatusApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ExternalMetricStatusApplyConfiguration { - b.Metric = value - return b -} - -// WithCurrent sets the Current field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Current field is set to the value of the last call. -func (b *ExternalMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ExternalMetricStatusApplyConfiguration { - b.Current = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerbehavior.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerbehavior.go deleted file mode 100644 index 355e15ff52..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerbehavior.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// HorizontalPodAutoscalerBehaviorApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscalerBehavior type for use -// with apply. -// -// HorizontalPodAutoscalerBehavior configures the scaling behavior of the target -// in both Up and Down directions (scaleUp and scaleDown fields respectively). -type HorizontalPodAutoscalerBehaviorApplyConfiguration struct { - // scaleUp is scaling policy for scaling Up. - // If not set, the default value is the higher of: - // * increase no more than 4 pods per 60 seconds - // * double the number of pods per 60 seconds - // No stabilization is used. - ScaleUp *HPAScalingRulesApplyConfiguration `json:"scaleUp,omitempty"` - // scaleDown is scaling policy for scaling Down. - // If not set, the default value is to allow to scale down to minReplicas pods, with a - // 300 second stabilization window (i.e., the highest recommendation for - // the last 300sec is used). - ScaleDown *HPAScalingRulesApplyConfiguration `json:"scaleDown,omitempty"` -} - -// HorizontalPodAutoscalerBehaviorApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerBehavior type for use with -// apply. -func HorizontalPodAutoscalerBehavior() *HorizontalPodAutoscalerBehaviorApplyConfiguration { - return &HorizontalPodAutoscalerBehaviorApplyConfiguration{} -} - -// WithScaleUp sets the ScaleUp field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ScaleUp field is set to the value of the last call. -func (b *HorizontalPodAutoscalerBehaviorApplyConfiguration) WithScaleUp(value *HPAScalingRulesApplyConfiguration) *HorizontalPodAutoscalerBehaviorApplyConfiguration { - b.ScaleUp = value - return b -} - -// WithScaleDown sets the ScaleDown field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ScaleDown field is set to the value of the last call. -func (b *HorizontalPodAutoscalerBehaviorApplyConfiguration) WithScaleDown(value *HPAScalingRulesApplyConfiguration) *HorizontalPodAutoscalerBehaviorApplyConfiguration { - b.ScaleDown = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalercondition.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalercondition.go deleted file mode 100644 index a23e18b158..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalercondition.go +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// HorizontalPodAutoscalerConditionApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscalerCondition type for use -// with apply. -// -// HorizontalPodAutoscalerCondition describes the state of -// a HorizontalPodAutoscaler at a certain point. -type HorizontalPodAutoscalerConditionApplyConfiguration struct { - // type describes the current condition - Type *autoscalingv2beta2.HorizontalPodAutoscalerConditionType `json:"type,omitempty"` - // status is the status of the condition (True, False, Unknown) - Status *v1.ConditionStatus `json:"status,omitempty"` - // lastTransitionTime is the last time the condition transitioned from - // one status to another - LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` - // reason is the reason for the condition's last transition. - Reason *string `json:"reason,omitempty"` - // message is a human-readable explanation containing details about - // the transition - Message *string `json:"message,omitempty"` -} - -// HorizontalPodAutoscalerConditionApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerCondition type for use with -// apply. -func HorizontalPodAutoscalerCondition() *HorizontalPodAutoscalerConditionApplyConfiguration { - return &HorizontalPodAutoscalerConditionApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithType(value autoscalingv2beta2.HorizontalPodAutoscalerConditionType) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Type = &value - return b -} - -// WithStatus sets the Status field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Status field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Status = &value - return b -} - -// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LastTransitionTime field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.LastTransitionTime = &value - return b -} - -// WithReason sets the Reason field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Reason field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithReason(value string) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Reason = &value - return b -} - -// WithMessage sets the Message field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Message field is set to the value of the last call. -func (b *HorizontalPodAutoscalerConditionApplyConfiguration) WithMessage(value string) *HorizontalPodAutoscalerConditionApplyConfiguration { - b.Message = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerspec.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerspec.go deleted file mode 100644 index 50ee3fae7b..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerspec.go +++ /dev/null @@ -1,102 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// HorizontalPodAutoscalerSpecApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscalerSpec type for use -// with apply. -// -// HorizontalPodAutoscalerSpec describes the desired functionality of the HorizontalPodAutoscaler. -type HorizontalPodAutoscalerSpecApplyConfiguration struct { - // scaleTargetRef points to the target resource to scale, and is used to the pods for which metrics - // should be collected, as well as to actually change the replica count. - ScaleTargetRef *CrossVersionObjectReferenceApplyConfiguration `json:"scaleTargetRef,omitempty"` - // minReplicas is the lower limit for the number of replicas to which the autoscaler - // can scale down. It defaults to 1 pod. minReplicas is allowed to be 0 if the - // alpha feature gate HPAScaleToZero is enabled and at least one Object or External - // metric is configured. Scaling is active as long as at least one metric value is - // available. - MinReplicas *int32 `json:"minReplicas,omitempty"` - // maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up. - // It cannot be less that minReplicas. - MaxReplicas *int32 `json:"maxReplicas,omitempty"` - // metrics contains the specifications for which to use to calculate the - // desired replica count (the maximum replica count across all metrics will - // be used). The desired replica count is calculated multiplying the - // ratio between the target value and the current value by the current - // number of pods. Ergo, metrics used must decrease as the pod count is - // increased, and vice-versa. See the individual metric source types for - // more information about how each type of metric must respond. - // If not set, the default metric will be set to 80% average CPU utilization. - Metrics []MetricSpecApplyConfiguration `json:"metrics,omitempty"` - // behavior configures the scaling behavior of the target - // in both Up and Down directions (scaleUp and scaleDown fields respectively). - // If not set, the default HPAScalingRules for scale up and scale down are used. - Behavior *HorizontalPodAutoscalerBehaviorApplyConfiguration `json:"behavior,omitempty"` -} - -// HorizontalPodAutoscalerSpecApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerSpec type for use with -// apply. -func HorizontalPodAutoscalerSpec() *HorizontalPodAutoscalerSpecApplyConfiguration { - return &HorizontalPodAutoscalerSpecApplyConfiguration{} -} - -// WithScaleTargetRef sets the ScaleTargetRef field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ScaleTargetRef field is set to the value of the last call. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithScaleTargetRef(value *CrossVersionObjectReferenceApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { - b.ScaleTargetRef = value - return b -} - -// WithMinReplicas sets the MinReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MinReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMinReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { - b.MinReplicas = &value - return b -} - -// WithMaxReplicas sets the MaxReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the MaxReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMaxReplicas(value int32) *HorizontalPodAutoscalerSpecApplyConfiguration { - b.MaxReplicas = &value - return b -} - -// WithMetrics adds the given value to the Metrics field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Metrics field. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithMetrics(values ...*MetricSpecApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithMetrics") - } - b.Metrics = append(b.Metrics, *values[i]) - } - return b -} - -// WithBehavior sets the Behavior field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Behavior field is set to the value of the last call. -func (b *HorizontalPodAutoscalerSpecApplyConfiguration) WithBehavior(value *HorizontalPodAutoscalerBehaviorApplyConfiguration) *HorizontalPodAutoscalerSpecApplyConfiguration { - b.Behavior = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerstatus.go deleted file mode 100644 index ffbdc1c32f..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerstatus.go +++ /dev/null @@ -1,110 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -// HorizontalPodAutoscalerStatusApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscalerStatus type for use -// with apply. -// -// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler. -type HorizontalPodAutoscalerStatusApplyConfiguration struct { - // observedGeneration is the most recent generation observed by this autoscaler. - ObservedGeneration *int64 `json:"observedGeneration,omitempty"` - // lastScaleTime is the last time the HorizontalPodAutoscaler scaled the number of pods, - // used by the autoscaler to control how often the number of pods is changed. - LastScaleTime *v1.Time `json:"lastScaleTime,omitempty"` - // currentReplicas is current number of replicas of pods managed by this autoscaler, - // as last seen by the autoscaler. - CurrentReplicas *int32 `json:"currentReplicas,omitempty"` - // desiredReplicas is the desired number of replicas of pods managed by this autoscaler, - // as last calculated by the autoscaler. - DesiredReplicas *int32 `json:"desiredReplicas,omitempty"` - // currentMetrics is the last read state of the metrics used by this autoscaler. - CurrentMetrics []MetricStatusApplyConfiguration `json:"currentMetrics,omitempty"` - // conditions is the set of conditions required for this autoscaler to scale its target, - // and indicates whether or not those conditions are met. - Conditions []HorizontalPodAutoscalerConditionApplyConfiguration `json:"conditions,omitempty"` -} - -// HorizontalPodAutoscalerStatusApplyConfiguration constructs a declarative configuration of the HorizontalPodAutoscalerStatus type for use with -// apply. -func HorizontalPodAutoscalerStatus() *HorizontalPodAutoscalerStatusApplyConfiguration { - return &HorizontalPodAutoscalerStatusApplyConfiguration{} -} - -// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ObservedGeneration field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithObservedGeneration(value int64) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.ObservedGeneration = &value - return b -} - -// WithLastScaleTime sets the LastScaleTime field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the LastScaleTime field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithLastScaleTime(value v1.Time) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.LastScaleTime = &value - return b -} - -// WithCurrentReplicas sets the CurrentReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the CurrentReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.CurrentReplicas = &value - return b -} - -// WithDesiredReplicas sets the DesiredReplicas field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DesiredReplicas field is set to the value of the last call. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithDesiredReplicas(value int32) *HorizontalPodAutoscalerStatusApplyConfiguration { - b.DesiredReplicas = &value - return b -} - -// WithCurrentMetrics adds the given value to the CurrentMetrics field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the CurrentMetrics field. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithCurrentMetrics(values ...*MetricStatusApplyConfiguration) *HorizontalPodAutoscalerStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithCurrentMetrics") - } - b.CurrentMetrics = append(b.CurrentMetrics, *values[i]) - } - return b -} - -// WithConditions adds the given value to the Conditions field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Conditions field. -func (b *HorizontalPodAutoscalerStatusApplyConfiguration) WithConditions(values ...*HorizontalPodAutoscalerConditionApplyConfiguration) *HorizontalPodAutoscalerStatusApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithConditions") - } - b.Conditions = append(b.Conditions, *values[i]) - } - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingpolicy.go deleted file mode 100644 index ca07910b90..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingpolicy.go +++ /dev/null @@ -1,68 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" -) - -// HPAScalingPolicyApplyConfiguration represents a declarative configuration of the HPAScalingPolicy type for use -// with apply. -// -// HPAScalingPolicy is a single policy which must hold true for a specified past interval. -type HPAScalingPolicyApplyConfiguration struct { - // type is used to specify the scaling policy. - Type *autoscalingv2beta2.HPAScalingPolicyType `json:"type,omitempty"` - // value contains the amount of change which is permitted by the policy. - // It must be greater than zero - Value *int32 `json:"value,omitempty"` - // periodSeconds specifies the window of time for which the policy should hold true. - // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). - PeriodSeconds *int32 `json:"periodSeconds,omitempty"` -} - -// HPAScalingPolicyApplyConfiguration constructs a declarative configuration of the HPAScalingPolicy type for use with -// apply. -func HPAScalingPolicy() *HPAScalingPolicyApplyConfiguration { - return &HPAScalingPolicyApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *HPAScalingPolicyApplyConfiguration) WithType(value autoscalingv2beta2.HPAScalingPolicyType) *HPAScalingPolicyApplyConfiguration { - b.Type = &value - return b -} - -// WithValue sets the Value field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Value field is set to the value of the last call. -func (b *HPAScalingPolicyApplyConfiguration) WithValue(value int32) *HPAScalingPolicyApplyConfiguration { - b.Value = &value - return b -} - -// WithPeriodSeconds sets the PeriodSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PeriodSeconds field is set to the value of the last call. -func (b *HPAScalingPolicyApplyConfiguration) WithPeriodSeconds(value int32) *HPAScalingPolicyApplyConfiguration { - b.PeriodSeconds = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingrules.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingrules.go deleted file mode 100644 index a87dc3d3c9..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingrules.go +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" -) - -// HPAScalingRulesApplyConfiguration represents a declarative configuration of the HPAScalingRules type for use -// with apply. -// -// HPAScalingRules configures the scaling behavior for one direction. -// These Rules are applied after calculating DesiredReplicas from metrics for the HPA. -// They can limit the scaling velocity by specifying scaling policies. -// They can prevent flapping by specifying the stabilization window, so that the -// number of replicas is not set instantly, instead, the safest value from the stabilization -// window is chosen. -type HPAScalingRulesApplyConfiguration struct { - // stabilizationWindowSeconds is the number of seconds for which past recommendations should be - // considered while scaling up or scaling down. - // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). - // If not set, use the default values: - // - For scale up: 0 (i.e. no stabilization is done). - // - For scale down: 300 (i.e. the stabilization window is 300 seconds long). - StabilizationWindowSeconds *int32 `json:"stabilizationWindowSeconds,omitempty"` - // selectPolicy is used to specify which policy should be used. - // If not set, the default value MaxPolicySelect is used. - SelectPolicy *autoscalingv2beta2.ScalingPolicySelect `json:"selectPolicy,omitempty"` - // policies is a list of potential scaling polices which can be used during scaling. - // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid - Policies []HPAScalingPolicyApplyConfiguration `json:"policies,omitempty"` -} - -// HPAScalingRulesApplyConfiguration constructs a declarative configuration of the HPAScalingRules type for use with -// apply. -func HPAScalingRules() *HPAScalingRulesApplyConfiguration { - return &HPAScalingRulesApplyConfiguration{} -} - -// WithStabilizationWindowSeconds sets the StabilizationWindowSeconds field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the StabilizationWindowSeconds field is set to the value of the last call. -func (b *HPAScalingRulesApplyConfiguration) WithStabilizationWindowSeconds(value int32) *HPAScalingRulesApplyConfiguration { - b.StabilizationWindowSeconds = &value - return b -} - -// WithSelectPolicy sets the SelectPolicy field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the SelectPolicy field is set to the value of the last call. -func (b *HPAScalingRulesApplyConfiguration) WithSelectPolicy(value autoscalingv2beta2.ScalingPolicySelect) *HPAScalingRulesApplyConfiguration { - b.SelectPolicy = &value - return b -} - -// WithPolicies adds the given value to the Policies field in the declarative configuration -// and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the Policies field. -func (b *HPAScalingRulesApplyConfiguration) WithPolicies(values ...*HPAScalingPolicyApplyConfiguration) *HPAScalingRulesApplyConfiguration { - for i := range values { - if values[i] == nil { - panic("nil value passed to WithPolicies") - } - b.Policies = append(b.Policies, *values[i]) - } - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricidentifier.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricidentifier.go deleted file mode 100644 index 9fd064cb9c..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricidentifier.go +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - v1 "k8s.io/client-go/applyconfigurations/meta/v1" -) - -// MetricIdentifierApplyConfiguration represents a declarative configuration of the MetricIdentifier type for use -// with apply. -// -// MetricIdentifier defines the name and optionally selector for a metric -type MetricIdentifierApplyConfiguration struct { - // name is the name of the given metric - Name *string `json:"name,omitempty"` - // selector is the string-encoded form of a standard kubernetes label selector for the given metric - // When set, it is passed as an additional parameter to the metrics server for more specific metrics scoping. - // When unset, just the metricName will be used to gather metrics. - Selector *v1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` -} - -// MetricIdentifierApplyConfiguration constructs a declarative configuration of the MetricIdentifier type for use with -// apply. -func MetricIdentifier() *MetricIdentifierApplyConfiguration { - return &MetricIdentifierApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *MetricIdentifierApplyConfiguration) WithName(value string) *MetricIdentifierApplyConfiguration { - b.Name = &value - return b -} - -// WithSelector sets the Selector field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Selector field is set to the value of the last call. -func (b *MetricIdentifierApplyConfiguration) WithSelector(value *v1.LabelSelectorApplyConfiguration) *MetricIdentifierApplyConfiguration { - b.Selector = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricspec.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricspec.go deleted file mode 100644 index 92eb2fa644..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricspec.go +++ /dev/null @@ -1,113 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" -) - -// MetricSpecApplyConfiguration represents a declarative configuration of the MetricSpec type for use -// with apply. -// -// MetricSpec specifies how to scale based on a single metric -// (only `type` and one other matching field should be set at once). -type MetricSpecApplyConfiguration struct { - // type is the type of metric source. It should be one of "ContainerResource", "External", - // "Object", "Pods" or "Resource", each mapping to a matching field in the object. - Type *autoscalingv2beta2.MetricSourceType `json:"type,omitempty"` - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - Object *ObjectMetricSourceApplyConfiguration `json:"object,omitempty"` - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - Pods *PodsMetricSourceApplyConfiguration `json:"pods,omitempty"` - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - Resource *ResourceMetricSourceApplyConfiguration `json:"resource,omitempty"` - // container resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in - // each pod of the current scale target (e.g. CPU or memory). Such metrics are - // built in to Kubernetes, and have special scaling options on top of those - // available to normal per-pod metrics using the "pods" source. - ContainerResource *ContainerResourceMetricSourceApplyConfiguration `json:"containerResource,omitempty"` - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - External *ExternalMetricSourceApplyConfiguration `json:"external,omitempty"` -} - -// MetricSpecApplyConfiguration constructs a declarative configuration of the MetricSpec type for use with -// apply. -func MetricSpec() *MetricSpecApplyConfiguration { - return &MetricSpecApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithType(value autoscalingv2beta2.MetricSourceType) *MetricSpecApplyConfiguration { - b.Type = &value - return b -} - -// WithObject sets the Object field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Object field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithObject(value *ObjectMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.Object = value - return b -} - -// WithPods sets the Pods field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Pods field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithPods(value *PodsMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.Pods = value - return b -} - -// WithResource sets the Resource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Resource field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithResource(value *ResourceMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.Resource = value - return b -} - -// WithContainerResource sets the ContainerResource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ContainerResource field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithContainerResource(value *ContainerResourceMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.ContainerResource = value - return b -} - -// WithExternal sets the External field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the External field is set to the value of the last call. -func (b *MetricSpecApplyConfiguration) WithExternal(value *ExternalMetricSourceApplyConfiguration) *MetricSpecApplyConfiguration { - b.External = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricstatus.go deleted file mode 100644 index 16dc67814f..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricstatus.go +++ /dev/null @@ -1,112 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" -) - -// MetricStatusApplyConfiguration represents a declarative configuration of the MetricStatus type for use -// with apply. -// -// MetricStatus describes the last-read state of a single metric. -type MetricStatusApplyConfiguration struct { - // type is the type of metric source. It will be one of "ContainerResource", "External", - // "Object", "Pods" or "Resource", each corresponds to a matching field in the object. - Type *autoscalingv2beta2.MetricSourceType `json:"type,omitempty"` - // object refers to a metric describing a single kubernetes object - // (for example, hits-per-second on an Ingress object). - Object *ObjectMetricStatusApplyConfiguration `json:"object,omitempty"` - // pods refers to a metric describing each pod in the current scale target - // (for example, transactions-processed-per-second). The values will be - // averaged together before being compared to the target value. - Pods *PodsMetricStatusApplyConfiguration `json:"pods,omitempty"` - // resource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - Resource *ResourceMetricStatusApplyConfiguration `json:"resource,omitempty"` - // containerResource refers to a resource metric (such as those specified in - // requests and limits) known to Kubernetes describing a single container in each pod in the - // current scale target (e.g. CPU or memory). Such metrics are built in to - // Kubernetes, and have special scaling options on top of those available - // to normal per-pod metrics using the "pods" source. - ContainerResource *ContainerResourceMetricStatusApplyConfiguration `json:"containerResource,omitempty"` - // external refers to a global metric that is not associated - // with any Kubernetes object. It allows autoscaling based on information - // coming from components running outside of cluster - // (for example length of queue in cloud messaging service, or - // QPS from loadbalancer running outside of cluster). - External *ExternalMetricStatusApplyConfiguration `json:"external,omitempty"` -} - -// MetricStatusApplyConfiguration constructs a declarative configuration of the MetricStatus type for use with -// apply. -func MetricStatus() *MetricStatusApplyConfiguration { - return &MetricStatusApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithType(value autoscalingv2beta2.MetricSourceType) *MetricStatusApplyConfiguration { - b.Type = &value - return b -} - -// WithObject sets the Object field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Object field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithObject(value *ObjectMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.Object = value - return b -} - -// WithPods sets the Pods field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Pods field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithPods(value *PodsMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.Pods = value - return b -} - -// WithResource sets the Resource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Resource field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithResource(value *ResourceMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.Resource = value - return b -} - -// WithContainerResource sets the ContainerResource field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the ContainerResource field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithContainerResource(value *ContainerResourceMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.ContainerResource = value - return b -} - -// WithExternal sets the External field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the External field is set to the value of the last call. -func (b *MetricStatusApplyConfiguration) WithExternal(value *ExternalMetricStatusApplyConfiguration) *MetricStatusApplyConfiguration { - b.External = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metrictarget.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metrictarget.go deleted file mode 100644 index eedcd59d10..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metrictarget.go +++ /dev/null @@ -1,81 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// MetricTargetApplyConfiguration represents a declarative configuration of the MetricTarget type for use -// with apply. -// -// MetricTarget defines the target value, average value, or average utilization of a specific metric -type MetricTargetApplyConfiguration struct { - // type represents whether the metric type is Utilization, Value, or AverageValue - Type *autoscalingv2beta2.MetricTargetType `json:"type,omitempty"` - // value is the target value of the metric (as a quantity). - Value *resource.Quantity `json:"value,omitempty"` - // averageValue is the target value of the average of the - // metric across all relevant pods (as a quantity) - AverageValue *resource.Quantity `json:"averageValue,omitempty"` - // averageUtilization is the target value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - // Currently only valid for Resource metric source type - AverageUtilization *int32 `json:"averageUtilization,omitempty"` -} - -// MetricTargetApplyConfiguration constructs a declarative configuration of the MetricTarget type for use with -// apply. -func MetricTarget() *MetricTargetApplyConfiguration { - return &MetricTargetApplyConfiguration{} -} - -// WithType sets the Type field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Type field is set to the value of the last call. -func (b *MetricTargetApplyConfiguration) WithType(value autoscalingv2beta2.MetricTargetType) *MetricTargetApplyConfiguration { - b.Type = &value - return b -} - -// WithValue sets the Value field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Value field is set to the value of the last call. -func (b *MetricTargetApplyConfiguration) WithValue(value resource.Quantity) *MetricTargetApplyConfiguration { - b.Value = &value - return b -} - -// WithAverageValue sets the AverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AverageValue field is set to the value of the last call. -func (b *MetricTargetApplyConfiguration) WithAverageValue(value resource.Quantity) *MetricTargetApplyConfiguration { - b.AverageValue = &value - return b -} - -// WithAverageUtilization sets the AverageUtilization field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AverageUtilization field is set to the value of the last call. -func (b *MetricTargetApplyConfiguration) WithAverageUtilization(value int32) *MetricTargetApplyConfiguration { - b.AverageUtilization = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricvaluestatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricvaluestatus.go deleted file mode 100644 index 49141abcc6..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricvaluestatus.go +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - resource "k8s.io/apimachinery/pkg/api/resource" -) - -// MetricValueStatusApplyConfiguration represents a declarative configuration of the MetricValueStatus type for use -// with apply. -// -// MetricValueStatus holds the current value for a metric -type MetricValueStatusApplyConfiguration struct { - // value is the current value of the metric (as a quantity). - Value *resource.Quantity `json:"value,omitempty"` - // averageValue is the current value of the average of the - // metric across all relevant pods (as a quantity) - AverageValue *resource.Quantity `json:"averageValue,omitempty"` - // averageUtilization is the current value of the average of the - // resource metric across all relevant pods, represented as a percentage of - // the requested value of the resource for the pods. - AverageUtilization *int32 `json:"averageUtilization,omitempty"` -} - -// MetricValueStatusApplyConfiguration constructs a declarative configuration of the MetricValueStatus type for use with -// apply. -func MetricValueStatus() *MetricValueStatusApplyConfiguration { - return &MetricValueStatusApplyConfiguration{} -} - -// WithValue sets the Value field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Value field is set to the value of the last call. -func (b *MetricValueStatusApplyConfiguration) WithValue(value resource.Quantity) *MetricValueStatusApplyConfiguration { - b.Value = &value - return b -} - -// WithAverageValue sets the AverageValue field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AverageValue field is set to the value of the last call. -func (b *MetricValueStatusApplyConfiguration) WithAverageValue(value resource.Quantity) *MetricValueStatusApplyConfiguration { - b.AverageValue = &value - return b -} - -// WithAverageUtilization sets the AverageUtilization field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AverageUtilization field is set to the value of the last call. -func (b *MetricValueStatusApplyConfiguration) WithAverageUtilization(value int32) *MetricValueStatusApplyConfiguration { - b.AverageUtilization = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricsource.go deleted file mode 100644 index e99e081cea..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricsource.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// ObjectMetricSourceApplyConfiguration represents a declarative configuration of the ObjectMetricSource type for use -// with apply. -// -// ObjectMetricSource indicates how to scale on a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricSourceApplyConfiguration struct { - DescribedObject *CrossVersionObjectReferenceApplyConfiguration `json:"describedObject,omitempty"` - // target specifies the target value for the given metric - Target *MetricTargetApplyConfiguration `json:"target,omitempty"` - // metric identifies the target metric by name and selector - Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` -} - -// ObjectMetricSourceApplyConfiguration constructs a declarative configuration of the ObjectMetricSource type for use with -// apply. -func ObjectMetricSource() *ObjectMetricSourceApplyConfiguration { - return &ObjectMetricSourceApplyConfiguration{} -} - -// WithDescribedObject sets the DescribedObject field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DescribedObject field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithDescribedObject(value *CrossVersionObjectReferenceApplyConfiguration) *ObjectMetricSourceApplyConfiguration { - b.DescribedObject = value - return b -} - -// WithTarget sets the Target field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Target field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ObjectMetricSourceApplyConfiguration { - b.Target = value - return b -} - -// WithMetric sets the Metric field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Metric field is set to the value of the last call. -func (b *ObjectMetricSourceApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ObjectMetricSourceApplyConfiguration { - b.Metric = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricstatus.go deleted file mode 100644 index 4d5d016791..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricstatus.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// ObjectMetricStatusApplyConfiguration represents a declarative configuration of the ObjectMetricStatus type for use -// with apply. -// -// ObjectMetricStatus indicates the current value of a metric describing a -// kubernetes object (for example, hits-per-second on an Ingress object). -type ObjectMetricStatusApplyConfiguration struct { - // metric identifies the target metric by name and selector - Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` - // current contains the current value for the given metric - Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` - DescribedObject *CrossVersionObjectReferenceApplyConfiguration `json:"describedObject,omitempty"` -} - -// ObjectMetricStatusApplyConfiguration constructs a declarative configuration of the ObjectMetricStatus type for use with -// apply. -func ObjectMetricStatus() *ObjectMetricStatusApplyConfiguration { - return &ObjectMetricStatusApplyConfiguration{} -} - -// WithMetric sets the Metric field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Metric field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *ObjectMetricStatusApplyConfiguration { - b.Metric = value - return b -} - -// WithCurrent sets the Current field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Current field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ObjectMetricStatusApplyConfiguration { - b.Current = value - return b -} - -// WithDescribedObject sets the DescribedObject field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the DescribedObject field is set to the value of the last call. -func (b *ObjectMetricStatusApplyConfiguration) WithDescribedObject(value *CrossVersionObjectReferenceApplyConfiguration) *ObjectMetricStatusApplyConfiguration { - b.DescribedObject = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricsource.go deleted file mode 100644 index 11dd2f6e9b..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricsource.go +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// PodsMetricSourceApplyConfiguration represents a declarative configuration of the PodsMetricSource type for use -// with apply. -// -// PodsMetricSource indicates how to scale on a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -// The values will be averaged together before being compared to the target -// value. -type PodsMetricSourceApplyConfiguration struct { - // metric identifies the target metric by name and selector - Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` - // target specifies the target value for the given metric - Target *MetricTargetApplyConfiguration `json:"target,omitempty"` -} - -// PodsMetricSourceApplyConfiguration constructs a declarative configuration of the PodsMetricSource type for use with -// apply. -func PodsMetricSource() *PodsMetricSourceApplyConfiguration { - return &PodsMetricSourceApplyConfiguration{} -} - -// WithMetric sets the Metric field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Metric field is set to the value of the last call. -func (b *PodsMetricSourceApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *PodsMetricSourceApplyConfiguration { - b.Metric = value - return b -} - -// WithTarget sets the Target field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Target field is set to the value of the last call. -func (b *PodsMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *PodsMetricSourceApplyConfiguration { - b.Target = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricstatus.go deleted file mode 100644 index 929c02d4a4..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricstatus.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -// PodsMetricStatusApplyConfiguration represents a declarative configuration of the PodsMetricStatus type for use -// with apply. -// -// PodsMetricStatus indicates the current value of a metric describing each pod in -// the current scale target (for example, transactions-processed-per-second). -type PodsMetricStatusApplyConfiguration struct { - // metric identifies the target metric by name and selector - Metric *MetricIdentifierApplyConfiguration `json:"metric,omitempty"` - // current contains the current value for the given metric - Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` -} - -// PodsMetricStatusApplyConfiguration constructs a declarative configuration of the PodsMetricStatus type for use with -// apply. -func PodsMetricStatus() *PodsMetricStatusApplyConfiguration { - return &PodsMetricStatusApplyConfiguration{} -} - -// WithMetric sets the Metric field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Metric field is set to the value of the last call. -func (b *PodsMetricStatusApplyConfiguration) WithMetric(value *MetricIdentifierApplyConfiguration) *PodsMetricStatusApplyConfiguration { - b.Metric = value - return b -} - -// WithCurrent sets the Current field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Current field is set to the value of the last call. -func (b *PodsMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *PodsMetricStatusApplyConfiguration { - b.Current = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricsource.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricsource.go deleted file mode 100644 index ce7e7e5fe2..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricsource.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - v1 "k8s.io/api/core/v1" -) - -// ResourceMetricSourceApplyConfiguration represents a declarative configuration of the ResourceMetricSource type for use -// with apply. -// -// ResourceMetricSource indicates how to scale on a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). The values will be averaged -// together before being compared to the target. Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. Only one "target" type -// should be set. -type ResourceMetricSourceApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // target specifies the target value for the given metric - Target *MetricTargetApplyConfiguration `json:"target,omitempty"` -} - -// ResourceMetricSourceApplyConfiguration constructs a declarative configuration of the ResourceMetricSource type for use with -// apply. -func ResourceMetricSource() *ResourceMetricSourceApplyConfiguration { - return &ResourceMetricSourceApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ResourceMetricSourceApplyConfiguration) WithName(value v1.ResourceName) *ResourceMetricSourceApplyConfiguration { - b.Name = &value - return b -} - -// WithTarget sets the Target field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Target field is set to the value of the last call. -func (b *ResourceMetricSourceApplyConfiguration) WithTarget(value *MetricTargetApplyConfiguration) *ResourceMetricSourceApplyConfiguration { - b.Target = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricstatus.go b/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricstatus.go deleted file mode 100644 index 9a6f391900..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricstatus.go +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v2beta2 - -import ( - v1 "k8s.io/api/core/v1" -) - -// ResourceMetricStatusApplyConfiguration represents a declarative configuration of the ResourceMetricStatus type for use -// with apply. -// -// ResourceMetricStatus indicates the current value of a resource metric known to -// Kubernetes, as specified in requests and limits, describing each pod in the -// current scale target (e.g. CPU or memory). Such metrics are built in to -// Kubernetes, and have special scaling options on top of those available to -// normal per-pod metrics using the "pods" source. -type ResourceMetricStatusApplyConfiguration struct { - // name is the name of the resource in question. - Name *v1.ResourceName `json:"name,omitempty"` - // current contains the current value for the given metric - Current *MetricValueStatusApplyConfiguration `json:"current,omitempty"` -} - -// ResourceMetricStatusApplyConfiguration constructs a declarative configuration of the ResourceMetricStatus type for use with -// apply. -func ResourceMetricStatus() *ResourceMetricStatusApplyConfiguration { - return &ResourceMetricStatusApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *ResourceMetricStatusApplyConfiguration) WithName(value v1.ResourceName) *ResourceMetricStatusApplyConfiguration { - b.Name = &value - return b -} - -// WithCurrent sets the Current field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Current field is set to the value of the last call. -func (b *ResourceMetricStatusApplyConfiguration) WithCurrent(value *MetricValueStatusApplyConfiguration) *ResourceMetricStatusApplyConfiguration { - b.Current = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequestspec.go b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequestspec.go index 234420c40a..6e195e3837 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequestspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/podcertificaterequestspec.go @@ -62,8 +62,7 @@ type PodCertificateRequestSpecApplyConfiguration struct { // `kubernetes.io` signers will never issue certificates with a lifetime // longer than 24 hours. MaxExpirationSeconds *int32 `json:"maxExpirationSeconds,omitempty"` - // pkixPublicKey is the PKIX-serialized public key the signer will issue the - // certificate to. + // The PKIX-serialized public key the signer will issue the certificate to. // // The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, // or ED25519. Note that this list may be expanded in the future. @@ -74,9 +73,14 @@ type PodCertificateRequestSpecApplyConfiguration struct { // setting a status.conditions entry with a type of "Denied" and a reason of // "UnsupportedKeyType". It may also suggest a key type that it does support // in the message field. + // + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. Signer + // implementations should extract the public key from the StubPKCS10Request + // field. PKIXPublicKey []byte `json:"pkixPublicKey,omitempty"` - // proofOfPossession proves that the requesting kubelet holds the private - // key corresponding to pkixPublicKey. + // A proof that the requesting kubelet holds the private key corresponding + // to pkixPublicKey. // // It is contructed by signing the ASCII bytes of the pod's UID using // `pkixPublicKey`. @@ -93,9 +97,31 @@ type PodCertificateRequestSpecApplyConfiguration struct { // golang library function crypto/ecdsa.SignASN1) // // If the key is an ED25519 key, the the signature is as described by the - // [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by - // the golang library crypto/ed25519.Sign). + // [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the + // golang library crypto/ed25519.Sign). + // + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. ProofOfPossession []byte `json:"proofOfPossession,omitempty"` + // A PKCS#10 certificate signing request (DER-serialized) generated by + // Kubelet using the subject private key. + // + // Most signer implementations will ignore the contents of the CSR except to + // extract the subject public key. The API server automatically verifies the + // CSR signature during admission, so the signer does not need to repeat the + // verification. CSRs generated by kubelet are completely empty. + // + // The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + // ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + // the future. + // + // Signer implementations do not need to support all key types supported by + // kube-apiserver and kubelet. If a signer does not support the key type + // used for a given PodCertificateRequest, it must deny the request by + // setting a status.conditions entry with a type of "Denied" and a reason of + // "UnsupportedKeyType". It may also suggest a key type that it does support + // in the message field. + StubPKCS10Request []byte `json:"stubPKCS10Request,omitempty"` // unverifiedUserAnnotations allow pod authors to pass additional information to // the signer implementation. Kubernetes does not restrict or validate this // metadata in any way. @@ -199,6 +225,16 @@ func (b *PodCertificateRequestSpecApplyConfiguration) WithProofOfPossession(valu return b } +// WithStubPKCS10Request adds the given value to the StubPKCS10Request field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the StubPKCS10Request field. +func (b *PodCertificateRequestSpecApplyConfiguration) WithStubPKCS10Request(values ...byte) *PodCertificateRequestSpecApplyConfiguration { + for i := range values { + b.StubPKCS10Request = append(b.StubPKCS10Request, values[i]) + } + return b +} + // WithUnverifiedUserAnnotations puts the entries into the UnverifiedUserAnnotations field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the UnverifiedUserAnnotations field, diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/imagevolumestatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/imagevolumestatus.go new file mode 100644 index 0000000000..a16e44e508 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/imagevolumestatus.go @@ -0,0 +1,44 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ImageVolumeStatusApplyConfiguration represents a declarative configuration of the ImageVolumeStatus type for use +// with apply. +// +// ImageVolumeStatus represents the image-based volume status. +type ImageVolumeStatusApplyConfiguration struct { + // ImageRef is the digest of the image used for this volume. + // It should have a value that's similar to the pod's status.containerStatuses[i].imageID. + // The ImageRef length should not exceed 256 characters. + ImageRef *string `json:"imageRef,omitempty"` +} + +// ImageVolumeStatusApplyConfiguration constructs a declarative configuration of the ImageVolumeStatus type for use with +// apply. +func ImageVolumeStatus() *ImageVolumeStatusApplyConfiguration { + return &ImageVolumeStatusApplyConfiguration{} +} + +// WithImageRef sets the ImageRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImageRef field is set to the value of the last call. +func (b *ImageVolumeStatusApplyConfiguration) WithImageRef(value string) *ImageVolumeStatusApplyConfiguration { + b.ImageRef = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go new file mode 100644 index 0000000000..6e384b0028 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeallocatableresourceclaimstatus.go @@ -0,0 +1,75 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + corev1 "k8s.io/api/core/v1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableResourceClaimStatusApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceClaimStatus type for use +// with apply. +// +// NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA. +type NodeAllocatableResourceClaimStatusApplyConfiguration struct { + // ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation. + ResourceClaimName *string `json:"resourceClaimName,omitempty"` + // Containers lists the names of all containers in this pod that reference the claim. + Containers []string `json:"containers,omitempty"` + // Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim. + Resources map[corev1.ResourceName]resource.Quantity `json:"resources,omitempty"` +} + +// NodeAllocatableResourceClaimStatusApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceClaimStatus type for use with +// apply. +func NodeAllocatableResourceClaimStatus() *NodeAllocatableResourceClaimStatusApplyConfiguration { + return &NodeAllocatableResourceClaimStatusApplyConfiguration{} +} + +// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceClaimName field is set to the value of the last call. +func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithResourceClaimName(value string) *NodeAllocatableResourceClaimStatusApplyConfiguration { + b.ResourceClaimName = &value + return b +} + +// WithContainers adds the given value to the Containers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Containers field. +func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithContainers(values ...string) *NodeAllocatableResourceClaimStatusApplyConfiguration { + for i := range values { + b.Containers = append(b.Containers, values[i]) + } + return b +} + +// WithResources puts the entries into the Resources field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Resources field, +// overwriting an existing map entries in Resources field with the same key. +func (b *NodeAllocatableResourceClaimStatusApplyConfiguration) WithResources(entries map[corev1.ResourceName]resource.Quantity) *NodeAllocatableResourceClaimStatusApplyConfiguration { + if b.Resources == nil && len(entries) > 0 { + b.Resources = make(map[corev1.ResourceName]resource.Quantity, len(entries)) + } + for k, v := range entries { + b.Resources[k] = v + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumesource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumesource.go index 8627148bfc..2d9d1dd5da 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumesource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumesource.go @@ -94,8 +94,7 @@ type PersistentVolumeSourceApplyConfiguration struct { PhotonPersistentDisk *PhotonPersistentDiskVolumeSourceApplyConfiguration `json:"photonPersistentDisk,omitempty"` // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. PortworxVolume *PortworxVolumeSourceApplyConfiguration `json:"portworxVolume,omitempty"` // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. // Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported. diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcondition.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcondition.go index 55e55dd0f2..dc527cdf25 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcondition.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podcondition.go @@ -32,7 +32,6 @@ type PodConditionApplyConfiguration struct { // More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions Type *corev1.PodConditionType `json:"type,omitempty"` // If set, this represents the .metadata.generation that the pod condition was set based upon. - // The PodObservedGenerationTracking feature gate must be enabled to use this field. ObservedGeneration *int64 `json:"observedGeneration,omitempty"` // Status is the status of the condition. // Can be True, False, Unknown. diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaim.go index 93d2280f0d..554cfd0ffc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaim.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaim.go @@ -27,6 +27,14 @@ package v1 // // It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. // Containers that need access to the ResourceClaim reference it with this name. +// +// When the DRAWorkloadResourceClaims feature gate is enabled and this Pod +// belongs to a PodGroup, a PodResourceClaim is matched to a +// PodGroupResourceClaim if all of their fields are equal (Name, +// ResourceClaimName, and ResourceClaimTemplateName). A matched claim references +// a single ResourceClaim shared across all Pods in the PodGroup, reserved for +// the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual +// Pods. type PodResourceClaimApplyConfiguration struct { // Name uniquely identifies this resource claim inside the pod. // This must be a DNS_LABEL. @@ -46,6 +54,16 @@ type PodResourceClaimApplyConfiguration struct { // generated component, will be used to form a unique name for the // ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. // + // When the DRAWorkloadResourceClaims feature gate is enabled and the pod + // belongs to a PodGroup that defines a PodGroupResourceClaim with the same + // Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the + // ResourceClaim generated for the PodGroup. All pods in the group that + // define an equivalent PodResourceClaim matching the + // PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same + // generated ResourceClaim. ResourceClaims generated for a PodGroup are + // owned by the PodGroup and their lifecycles are tied to the PodGroup + // instead of any individual pod. + // // This field is immutable and no changes will be made to the // corresponding ResourceClaim by the control plane after creating the // ResourceClaim. diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaimstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaimstatus.go index f0673fa0f1..094e2b8747 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaimstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podresourceclaimstatus.go @@ -30,9 +30,16 @@ type PodResourceClaimStatusApplyConfiguration struct { // which implies that the string must be a DNS_LABEL. Name *string `json:"name,omitempty"` // ResourceClaimName is the name of the ResourceClaim that was - // generated for the Pod in the namespace of the Pod. If this is - // unset, then generating a ResourceClaim was not necessary. The - // pod.spec.resourceClaims entry can be ignored in this case. + // generated for the Pod in the namespace of the Pod. + // + // When the DRAWorkloadResourceClaims feature is enabled and the + // corresponding PodResourceClaim matches a PodGroupResourceClaim + // made by the Pod's PodGroup, then this is the name of the + // ResourceClaim generated and reserved for the PodGroup. + // + // If this is unset, then generating a ResourceClaim was not + // necessary. The pod.spec.resourceClaims entry can be ignored in + // this case. ResourceClaimName *string `json:"resourceClaimName,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podschedulinggroup.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podschedulinggroup.go new file mode 100644 index 0000000000..4dd3b23ba9 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podschedulinggroup.go @@ -0,0 +1,46 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// PodSchedulingGroupApplyConfiguration represents a declarative configuration of the PodSchedulingGroup type for use +// with apply. +// +// PodSchedulingGroup identifies the runtime scheduling group instance that a Pod belongs to. +// The scheduler uses this information to apply workload-aware scheduling semantics. +// Exactly one field must be specified. +type PodSchedulingGroupApplyConfiguration struct { + // PodGroupName specifies the name of the standalone PodGroup object + // that represents the runtime instance of this group. + // Must be a DNS subdomain. + PodGroupName *string `json:"podGroupName,omitempty"` +} + +// PodSchedulingGroupApplyConfiguration constructs a declarative configuration of the PodSchedulingGroup type for use with +// apply. +func PodSchedulingGroup() *PodSchedulingGroupApplyConfiguration { + return &PodSchedulingGroupApplyConfiguration{} +} + +// WithPodGroupName sets the PodGroupName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodGroupName field is set to the value of the last call. +func (b *PodSchedulingGroupApplyConfiguration) WithPodGroupName(value string) *PodSchedulingGroupApplyConfiguration { + b.PodGroupName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go index 1948c7131f..e67c18c41b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go @@ -233,7 +233,6 @@ type PodSpecApplyConfiguration struct { // When set to false, a new userns is created for the pod. Setting false is useful for // mitigating container breakout vulnerabilities even allowing users to run their // containers as root without actually having root privileges on the host. - // This field is alpha-level and is only honored by servers that enable the UserNamespacesSupport feature. HostUsers *bool `json:"hostUsers,omitempty"` // SchedulingGates is an opaque list of values that if specified will block scheduling the pod. // If schedulingGates is not empty, the pod will stay in the SchedulingGated state and the @@ -273,14 +272,19 @@ type PodSpecApplyConfiguration struct { // This field must be a valid DNS subdomain as defined in RFC 1123 and contain at most 64 characters. // Requires the HostnameOverride feature gate to be enabled. HostnameOverride *string `json:"hostnameOverride,omitempty"` - // WorkloadRef provides a reference to the Workload object that this Pod belongs to. - // This field is used by the scheduler to identify the PodGroup and apply the - // correct group scheduling policies. The Workload object referenced - // by this field may not exist at the time the Pod is created. - // This field is immutable, but a Workload object with the same name - // may be recreated with different policies. Doing this during pod scheduling + // SchedulingGroup provides a reference to the immediate scheduling runtime + // grouping object that this Pod belongs to. + // This field is used by the scheduler to identify the group and apply the + // correct group scheduling policies. The association with a group also + // impacts other lifecycle aspects of a Pod that are relevant in a wider context + // of scheduling like preemption, resource attachment, etc. If not specified, + // the Pod is treated as a single unit in all of these aspects. + // The group object referenced by this field may not exist at the time the + // Pod is created. + // This field is immutable, but a group object with the same name may be + // recreated with different policies. Doing this during pod scheduling // may result in the placement not conforming to the expected policies. - WorkloadRef *WorkloadReferenceApplyConfiguration `json:"workloadRef,omitempty"` + SchedulingGroup *PodSchedulingGroupApplyConfiguration `json:"schedulingGroup,omitempty"` } // PodSpecApplyConfiguration constructs a declarative configuration of the PodSpec type for use with @@ -678,10 +682,10 @@ func (b *PodSpecApplyConfiguration) WithHostnameOverride(value string) *PodSpecA return b } -// WithWorkloadRef sets the WorkloadRef field in the declarative configuration to the given value +// WithSchedulingGroup sets the SchedulingGroup field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the WorkloadRef field is set to the value of the last call. -func (b *PodSpecApplyConfiguration) WithWorkloadRef(value *WorkloadReferenceApplyConfiguration) *PodSpecApplyConfiguration { - b.WorkloadRef = value +// If called multiple times, the SchedulingGroup field is set to the value of the last call. +func (b *PodSpecApplyConfiguration) WithSchedulingGroup(value *PodSchedulingGroupApplyConfiguration) *PodSpecApplyConfiguration { + b.SchedulingGroup = value return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go index e50ca9335e..8328d9cdb1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go @@ -139,6 +139,12 @@ type PodStatusApplyConfiguration struct { // applied at the pod level if pod-level requests or limits are set in // PodSpec.Resources Resources *ResourceRequirementsApplyConfiguration `json:"resources,omitempty"` + // NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources + // that were allocated for this pod through DRA claims. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + NodeAllocatableResourceClaimStatuses []NodeAllocatableResourceClaimStatusApplyConfiguration `json:"nodeAllocatableResourceClaimStatuses,omitempty"` } // PodStatusApplyConfiguration constructs a declarative configuration of the PodStatus type for use with @@ -341,3 +347,16 @@ func (b *PodStatusApplyConfiguration) WithResources(value *ResourceRequirementsA b.Resources = value return b } + +// WithNodeAllocatableResourceClaimStatuses adds the given value to the NodeAllocatableResourceClaimStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NodeAllocatableResourceClaimStatuses field. +func (b *PodStatusApplyConfiguration) WithNodeAllocatableResourceClaimStatuses(values ...*NodeAllocatableResourceClaimStatusApplyConfiguration) *PodStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithNodeAllocatableResourceClaimStatuses") + } + b.NodeAllocatableResourceClaimStatuses = append(b.NodeAllocatableResourceClaimStatuses, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcehealth.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcehealth.go index 684153c49b..061535b8d9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcehealth.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcehealth.go @@ -41,6 +41,9 @@ type ResourceHealthApplyConfiguration struct { // // In future we may want to introduce the PermanentlyUnhealthy Status. Health *corev1.ResourceHealthStatus `json:"health,omitempty"` + // Message provides human-readable context for Health (e.g. "ECC error count exceeded threshold"). + // This field is populated by the kubelet when ResourceHealthStatusMessage is enabled if the DRA plugin returns a message, and is null otherwise. + Message *string `json:"message,omitempty"` } // ResourceHealthApplyConfiguration constructs a declarative configuration of the ResourceHealth type for use with @@ -64,3 +67,11 @@ func (b *ResourceHealthApplyConfiguration) WithHealth(value corev1.ResourceHealt b.Health = &value return b } + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *ResourceHealthApplyConfiguration) WithMessage(value string) *ResourceHealthApplyConfiguration { + b.Message = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/securitycontext.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/securitycontext.go index aee2635238..8147c54769 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/securitycontext.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/securitycontext.go @@ -83,7 +83,6 @@ type SecurityContextApplyConfiguration struct { // procMount denotes the type of proc mount to use for the containers. // The default value is Default which uses the container runtime defaults for // readonly paths and masked paths. - // This requires the ProcMountType feature flag to be enabled. // Note that this field cannot be set when spec.os.name is windows. ProcMount *corev1.ProcMountType `json:"procMount,omitempty"` // The seccomp options to use by this container. If seccomp options are diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemountstatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemountstatus.go index ad4965a17d..693268ecb1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemountstatus.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemountstatus.go @@ -37,6 +37,9 @@ type VolumeMountStatusApplyConfiguration struct { // An IfPossible value in the original VolumeMount must be translated to Disabled or Enabled, // depending on the mount result. RecursiveReadOnly *corev1.RecursiveReadOnlyMode `json:"recursiveReadOnly,omitempty"` + // volumeStatus represents volume-type-specific status about the mounted + // volume. + VolumeStatus *VolumeStatusApplyConfiguration `json:"volumeStatus,omitempty"` } // VolumeMountStatusApplyConfiguration constructs a declarative configuration of the VolumeMountStatus type for use with @@ -76,3 +79,11 @@ func (b *VolumeMountStatusApplyConfiguration) WithRecursiveReadOnly(value corev1 b.RecursiveReadOnly = &value return b } + +// WithVolumeStatus sets the VolumeStatus field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeStatus field is set to the value of the last call. +func (b *VolumeMountStatusApplyConfiguration) WithVolumeStatus(value *VolumeStatusApplyConfiguration) *VolumeMountStatusApplyConfiguration { + b.VolumeStatus = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumesource.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumesource.go index 5d9a6b0f6d..2ce585f541 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumesource.go +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumesource.go @@ -116,8 +116,7 @@ type VolumeSourceApplyConfiguration struct { Projected *ProjectedVolumeSourceApplyConfiguration `json:"projected,omitempty"` // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. PortworxVolume *PortworxVolumeSourceApplyConfiguration `json:"portworxVolume,omitempty"` // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. // Deprecated: ScaleIO is deprecated and the in-tree scaleIO type is no longer supported. @@ -163,7 +162,7 @@ type VolumeSourceApplyConfiguration struct { // A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. // The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. // The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. - // The volume will be mounted read-only (ro) and non-executable files (noexec). + // The volume will be mounted read-only (ro). // Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. // The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. Image *ImageVolumeSourceApplyConfiguration `json:"image,omitempty"` diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumestatus.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumestatus.go new file mode 100644 index 0000000000..3d6a7f85d9 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/core/v1/volumestatus.go @@ -0,0 +1,43 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// VolumeStatusApplyConfiguration represents a declarative configuration of the VolumeStatus type for use +// with apply. +// +// VolumeStatus represents the status of a mounted volume. +// At most one of its members must be specified. +type VolumeStatusApplyConfiguration struct { + // image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + Image *ImageVolumeStatusApplyConfiguration `json:"image,omitempty"` +} + +// VolumeStatusApplyConfiguration constructs a declarative configuration of the VolumeStatus type for use with +// apply. +func VolumeStatus() *VolumeStatusApplyConfiguration { + return &VolumeStatusApplyConfiguration{} +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithImage(value *ImageVolumeStatusApplyConfiguration) *VolumeStatusApplyConfiguration { + b.Image = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/core/v1/workloadreference.go b/vendor/k8s.io/client-go/applyconfigurations/core/v1/workloadreference.go deleted file mode 100644 index 758c4517df..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/core/v1/workloadreference.go +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1 - -// WorkloadReferenceApplyConfiguration represents a declarative configuration of the WorkloadReference type for use -// with apply. -// -// WorkloadReference identifies the Workload object and PodGroup membership -// that a Pod belongs to. The scheduler uses this information to apply -// workload-aware scheduling semantics. -type WorkloadReferenceApplyConfiguration struct { - // Name defines the name of the Workload object this Pod belongs to. - // Workload must be in the same namespace as the Pod. - // If it doesn't match any existing Workload, the Pod will remain unschedulable - // until a Workload object is created and observed by the kube-scheduler. - // It must be a DNS subdomain. - Name *string `json:"name,omitempty"` - // PodGroup is the name of the PodGroup within the Workload that this Pod - // belongs to. If it doesn't match any existing PodGroup within the Workload, - // the Pod will remain unschedulable until the Workload object is recreated - // and observed by the kube-scheduler. It must be a DNS label. - PodGroup *string `json:"podGroup,omitempty"` - // PodGroupReplicaKey specifies the replica key of the PodGroup to which this - // Pod belongs. It is used to distinguish pods belonging to different replicas - // of the same pod group. The pod group policy is applied separately to each replica. - // When set, it must be a DNS label. - PodGroupReplicaKey *string `json:"podGroupReplicaKey,omitempty"` -} - -// WorkloadReferenceApplyConfiguration constructs a declarative configuration of the WorkloadReference type for use with -// apply. -func WorkloadReference() *WorkloadReferenceApplyConfiguration { - return &WorkloadReferenceApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *WorkloadReferenceApplyConfiguration) WithName(value string) *WorkloadReferenceApplyConfiguration { - b.Name = &value - return b -} - -// WithPodGroup sets the PodGroup field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PodGroup field is set to the value of the last call. -func (b *WorkloadReferenceApplyConfiguration) WithPodGroup(value string) *WorkloadReferenceApplyConfiguration { - b.PodGroup = &value - return b -} - -// WithPodGroupReplicaKey sets the PodGroupReplicaKey field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PodGroupReplicaKey field is set to the value of the last call. -func (b *WorkloadReferenceApplyConfiguration) WithPodGroupReplicaKey(value string) *WorkloadReferenceApplyConfiguration { - b.PodGroupReplicaKey = &value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go b/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go index 2d66c9ba08..c0b255cc73 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go +++ b/vendor/k8s.io/client-go/applyconfigurations/internal/internal.go @@ -39,6 +39,12 @@ func Parser() *typed.Parser { var parserOnce sync.Once var parser *typed.Parser var schemaYAML = typed.YAMLObject(`types: +- name: io.k8s.api.admissionregistration.v1.ApplyConfiguration + map: + fields: + - name: expression + type: + scalar: string - name: io.k8s.api.admissionregistration.v1.AuditAnnotation map: fields: @@ -61,6 +67,12 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" +- name: io.k8s.api.admissionregistration.v1.JSONPatch + map: + fields: + - name: expression + type: + scalar: string - name: io.k8s.api.admissionregistration.v1.MatchCondition map: fields: @@ -97,6 +109,87 @@ var schemaYAML = typed.YAMLObject(`types: namedType: io.k8s.api.admissionregistration.v1.NamedRuleWithOperations elementRelationship: atomic elementRelationship: atomic +- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicy + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicySpec + default: {} +- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBinding + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBindingSpec + default: {} +- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicyBindingSpec + map: + fields: + - name: matchResources + type: + namedType: io.k8s.api.admissionregistration.v1.MatchResources + - name: paramRef + type: + namedType: io.k8s.api.admissionregistration.v1.ParamRef + - name: policyName + type: + scalar: string +- name: io.k8s.api.admissionregistration.v1.MutatingAdmissionPolicySpec + map: + fields: + - name: failurePolicy + type: + scalar: string + - name: matchConditions + type: + list: + elementType: + namedType: io.k8s.api.admissionregistration.v1.MatchCondition + elementRelationship: associative + keys: + - name + - name: matchConstraints + type: + namedType: io.k8s.api.admissionregistration.v1.MatchResources + - name: mutations + type: + list: + elementType: + namedType: io.k8s.api.admissionregistration.v1.Mutation + elementRelationship: atomic + - name: paramKind + type: + namedType: io.k8s.api.admissionregistration.v1.ParamKind + - name: reinvocationPolicy + type: + scalar: string + - name: variables + type: + list: + elementType: + namedType: io.k8s.api.admissionregistration.v1.Variable + elementRelationship: atomic - name: io.k8s.api.admissionregistration.v1.MutatingWebhook map: fields: @@ -170,6 +263,19 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name +- name: io.k8s.api.admissionregistration.v1.Mutation + map: + fields: + - name: applyConfiguration + type: + namedType: io.k8s.api.admissionregistration.v1.ApplyConfiguration + - name: jsonPatch + type: + namedType: io.k8s.api.admissionregistration.v1.JSONPatch + - name: patchType + type: + scalar: string + default: "" - name: io.k8s.api.admissionregistration.v1.NamedRuleWithOperations map: fields: @@ -3302,87 +3408,72 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" -- name: io.k8s.api.autoscaling.v2beta1.ContainerResourceMetricSource +- name: io.k8s.api.batch.v1.CronJob map: fields: - - name: container + - name: apiVersion type: scalar: string - default: "" - - name: name + - name: kind type: scalar: string - default: "" - - name: targetAverageUtilization + - name: metadata type: - scalar: numeric - - name: targetAverageValue + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity -- name: io.k8s.api.autoscaling.v2beta1.ContainerResourceMetricStatus + namedType: io.k8s.api.batch.v1.CronJobSpec + default: {} + - name: status + type: + namedType: io.k8s.api.batch.v1.CronJobStatus + default: {} +- name: io.k8s.api.batch.v1.CronJobSpec map: fields: - - name: container + - name: concurrencyPolicy type: scalar: string - default: "" - - name: currentAverageUtilization + - name: failedJobsHistoryLimit type: scalar: numeric - - name: currentAverageValue + - name: jobTemplate type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: name + namedType: io.k8s.api.batch.v1.JobTemplateSpec + default: {} + - name: schedule type: scalar: string default: "" -- name: io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference - map: - fields: - - name: apiVersion + - name: startingDeadlineSeconds type: - scalar: string - - name: kind + scalar: numeric + - name: successfulJobsHistoryLimit type: - scalar: string - default: "" - - name: name + scalar: numeric + - name: suspend type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta1.ExternalMetricSource - map: - fields: - - name: metricName + scalar: boolean + - name: timeZone type: scalar: string - default: "" - - name: metricSelector - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector - - name: targetAverageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: targetValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity -- name: io.k8s.api.autoscaling.v2beta1.ExternalMetricStatus +- name: io.k8s.api.batch.v1.CronJobStatus map: fields: - - name: currentAverageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: currentValue + - name: active type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: metricName + list: + elementType: + namedType: io.k8s.api.core.v1.ObjectReference + elementRelationship: atomic + - name: lastScheduleTime type: - scalar: string - default: "" - - name: metricSelector + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: lastSuccessfulTime type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector -- name: io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscaler + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time +- name: io.k8s.api.batch.v1.Job map: fields: - name: apiVersion @@ -3397,15 +3488,18 @@ var schemaYAML = typed.YAMLObject(`types: default: {} - name: spec type: - namedType: io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerSpec + namedType: io.k8s.api.batch.v1.JobSpec default: {} - name: status type: - namedType: io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerStatus + namedType: io.k8s.api.batch.v1.JobStatus default: {} -- name: io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerCondition +- name: io.k8s.api.batch.v1.JobCondition map: fields: + - name: lastProbeTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - name: lastTransitionTime type: namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time @@ -3423,719 +3517,71 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" -- name: io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerSpec +- name: io.k8s.api.batch.v1.JobSpec map: fields: - - name: maxReplicas + - name: activeDeadlineSeconds type: scalar: numeric - default: 0 - - name: metrics + - name: backoffLimit type: - list: - elementType: - namedType: io.k8s.api.autoscaling.v2beta1.MetricSpec - elementRelationship: atomic - - name: minReplicas + scalar: numeric + - name: backoffLimitPerIndex type: scalar: numeric - - name: scaleTargetRef + - name: completionMode type: - namedType: io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference - default: {} -- name: io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerStatus - map: - fields: - - name: conditions + scalar: string + - name: completions type: - list: - elementType: - namedType: io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscalerCondition - elementRelationship: atomic - - name: currentMetrics + scalar: numeric + - name: managedBy type: - list: - elementType: - namedType: io.k8s.api.autoscaling.v2beta1.MetricStatus - elementRelationship: atomic - - name: currentReplicas + scalar: string + - name: manualSelector type: - scalar: numeric - default: 0 - - name: desiredReplicas + scalar: boolean + - name: maxFailedIndexes type: scalar: numeric - default: 0 - - name: lastScaleTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - - name: observedGeneration + - name: parallelism type: scalar: numeric -- name: io.k8s.api.autoscaling.v2beta1.MetricSpec - map: - fields: - - name: containerResource + - name: podFailurePolicy type: - namedType: io.k8s.api.autoscaling.v2beta1.ContainerResourceMetricSource - - name: external + namedType: io.k8s.api.batch.v1.PodFailurePolicy + - name: podReplacementPolicy type: - namedType: io.k8s.api.autoscaling.v2beta1.ExternalMetricSource - - name: object + scalar: string + - name: selector type: - namedType: io.k8s.api.autoscaling.v2beta1.ObjectMetricSource - - name: pods + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: successPolicy type: - namedType: io.k8s.api.autoscaling.v2beta1.PodsMetricSource - - name: resource + namedType: io.k8s.api.batch.v1.SuccessPolicy + - name: suspend type: - namedType: io.k8s.api.autoscaling.v2beta1.ResourceMetricSource - - name: type + scalar: boolean + - name: template type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta1.MetricStatus + namedType: io.k8s.api.core.v1.PodTemplateSpec + default: {} + - name: ttlSecondsAfterFinished + type: + scalar: numeric +- name: io.k8s.api.batch.v1.JobStatus map: fields: - - name: containerResource - type: - namedType: io.k8s.api.autoscaling.v2beta1.ContainerResourceMetricStatus - - name: external + - name: active type: - namedType: io.k8s.api.autoscaling.v2beta1.ExternalMetricStatus - - name: object + scalar: numeric + - name: completedIndexes type: - namedType: io.k8s.api.autoscaling.v2beta1.ObjectMetricStatus - - name: pods + scalar: string + - name: completionTime type: - namedType: io.k8s.api.autoscaling.v2beta1.PodsMetricStatus - - name: resource - type: - namedType: io.k8s.api.autoscaling.v2beta1.ResourceMetricStatus - - name: type - type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta1.ObjectMetricSource - map: - fields: - - name: averageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: metricName - type: - scalar: string - default: "" - - name: selector - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector - - name: target - type: - namedType: io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference - default: {} - - name: targetValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity -- name: io.k8s.api.autoscaling.v2beta1.ObjectMetricStatus - map: - fields: - - name: averageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: currentValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: metricName - type: - scalar: string - default: "" - - name: selector - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector - - name: target - type: - namedType: io.k8s.api.autoscaling.v2beta1.CrossVersionObjectReference - default: {} -- name: io.k8s.api.autoscaling.v2beta1.PodsMetricSource - map: - fields: - - name: metricName - type: - scalar: string - default: "" - - name: selector - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector - - name: targetAverageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity -- name: io.k8s.api.autoscaling.v2beta1.PodsMetricStatus - map: - fields: - - name: currentAverageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: metricName - type: - scalar: string - default: "" - - name: selector - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector -- name: io.k8s.api.autoscaling.v2beta1.ResourceMetricSource - map: - fields: - - name: name - type: - scalar: string - default: "" - - name: targetAverageUtilization - type: - scalar: numeric - - name: targetAverageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity -- name: io.k8s.api.autoscaling.v2beta1.ResourceMetricStatus - map: - fields: - - name: currentAverageUtilization - type: - scalar: numeric - - name: currentAverageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: name - type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta2.ContainerResourceMetricSource - map: - fields: - - name: container - type: - scalar: string - default: "" - - name: name - type: - scalar: string - default: "" - - name: target - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricTarget - default: {} -- name: io.k8s.api.autoscaling.v2beta2.ContainerResourceMetricStatus - map: - fields: - - name: container - type: - scalar: string - default: "" - - name: current - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricValueStatus - default: {} - - name: name - type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta2.CrossVersionObjectReference - map: - fields: - - name: apiVersion - type: - scalar: string - - name: kind - type: - scalar: string - default: "" - - name: name - type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta2.ExternalMetricSource - map: - fields: - - name: metric - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricIdentifier - default: {} - - name: target - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricTarget - default: {} -- name: io.k8s.api.autoscaling.v2beta2.ExternalMetricStatus - map: - fields: - - name: current - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricValueStatus - default: {} - - name: metric - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricIdentifier - default: {} -- name: io.k8s.api.autoscaling.v2beta2.HPAScalingPolicy - map: - fields: - - name: periodSeconds - type: - scalar: numeric - default: 0 - - name: type - type: - scalar: string - default: "" - - name: value - type: - scalar: numeric - default: 0 -- name: io.k8s.api.autoscaling.v2beta2.HPAScalingRules - map: - fields: - - name: policies - type: - list: - elementType: - namedType: io.k8s.api.autoscaling.v2beta2.HPAScalingPolicy - elementRelationship: atomic - - name: selectPolicy - type: - scalar: string - - name: stabilizationWindowSeconds - type: - scalar: numeric -- name: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler - map: - fields: - - name: apiVersion - type: - scalar: string - - name: kind - type: - scalar: string - - name: metadata - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta - default: {} - - name: spec - type: - namedType: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerSpec - default: {} - - name: status - type: - namedType: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerStatus - default: {} -- name: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerBehavior - map: - fields: - - name: scaleDown - type: - namedType: io.k8s.api.autoscaling.v2beta2.HPAScalingRules - - name: scaleUp - type: - namedType: io.k8s.api.autoscaling.v2beta2.HPAScalingRules -- name: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerCondition - map: - fields: - - name: lastTransitionTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - - name: message - type: - scalar: string - - name: reason - type: - scalar: string - - name: status - type: - scalar: string - default: "" - - name: type - type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerSpec - map: - fields: - - name: behavior - type: - namedType: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerBehavior - - name: maxReplicas - type: - scalar: numeric - default: 0 - - name: metrics - type: - list: - elementType: - namedType: io.k8s.api.autoscaling.v2beta2.MetricSpec - elementRelationship: atomic - - name: minReplicas - type: - scalar: numeric - - name: scaleTargetRef - type: - namedType: io.k8s.api.autoscaling.v2beta2.CrossVersionObjectReference - default: {} -- name: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerStatus - map: - fields: - - name: conditions - type: - list: - elementType: - namedType: io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscalerCondition - elementRelationship: atomic - - name: currentMetrics - type: - list: - elementType: - namedType: io.k8s.api.autoscaling.v2beta2.MetricStatus - elementRelationship: atomic - - name: currentReplicas - type: - scalar: numeric - default: 0 - - name: desiredReplicas - type: - scalar: numeric - default: 0 - - name: lastScaleTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - - name: observedGeneration - type: - scalar: numeric -- name: io.k8s.api.autoscaling.v2beta2.MetricIdentifier - map: - fields: - - name: name - type: - scalar: string - default: "" - - name: selector - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector -- name: io.k8s.api.autoscaling.v2beta2.MetricSpec - map: - fields: - - name: containerResource - type: - namedType: io.k8s.api.autoscaling.v2beta2.ContainerResourceMetricSource - - name: external - type: - namedType: io.k8s.api.autoscaling.v2beta2.ExternalMetricSource - - name: object - type: - namedType: io.k8s.api.autoscaling.v2beta2.ObjectMetricSource - - name: pods - type: - namedType: io.k8s.api.autoscaling.v2beta2.PodsMetricSource - - name: resource - type: - namedType: io.k8s.api.autoscaling.v2beta2.ResourceMetricSource - - name: type - type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta2.MetricStatus - map: - fields: - - name: containerResource - type: - namedType: io.k8s.api.autoscaling.v2beta2.ContainerResourceMetricStatus - - name: external - type: - namedType: io.k8s.api.autoscaling.v2beta2.ExternalMetricStatus - - name: object - type: - namedType: io.k8s.api.autoscaling.v2beta2.ObjectMetricStatus - - name: pods - type: - namedType: io.k8s.api.autoscaling.v2beta2.PodsMetricStatus - - name: resource - type: - namedType: io.k8s.api.autoscaling.v2beta2.ResourceMetricStatus - - name: type - type: - scalar: string - default: "" -- name: io.k8s.api.autoscaling.v2beta2.MetricTarget - map: - fields: - - name: averageUtilization - type: - scalar: numeric - - name: averageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: type - type: - scalar: string - default: "" - - name: value - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity -- name: io.k8s.api.autoscaling.v2beta2.MetricValueStatus - map: - fields: - - name: averageUtilization - type: - scalar: numeric - - name: averageValue - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - - name: value - type: - namedType: io.k8s.apimachinery.pkg.api.resource.Quantity -- name: io.k8s.api.autoscaling.v2beta2.ObjectMetricSource - map: - fields: - - name: describedObject - type: - namedType: io.k8s.api.autoscaling.v2beta2.CrossVersionObjectReference - default: {} - - name: metric - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricIdentifier - default: {} - - name: target - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricTarget - default: {} -- name: io.k8s.api.autoscaling.v2beta2.ObjectMetricStatus - map: - fields: - - name: current - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricValueStatus - default: {} - - name: describedObject - type: - namedType: io.k8s.api.autoscaling.v2beta2.CrossVersionObjectReference - default: {} - - name: metric - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricIdentifier - default: {} -- name: io.k8s.api.autoscaling.v2beta2.PodsMetricSource - map: - fields: - - name: metric - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricIdentifier - default: {} - - name: target - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricTarget - default: {} -- name: io.k8s.api.autoscaling.v2beta2.PodsMetricStatus - map: - fields: - - name: current - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricValueStatus - default: {} - - name: metric - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricIdentifier - default: {} -- name: io.k8s.api.autoscaling.v2beta2.ResourceMetricSource - map: - fields: - - name: name - type: - scalar: string - default: "" - - name: target - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricTarget - default: {} -- name: io.k8s.api.autoscaling.v2beta2.ResourceMetricStatus - map: - fields: - - name: current - type: - namedType: io.k8s.api.autoscaling.v2beta2.MetricValueStatus - default: {} - - name: name - type: - scalar: string - default: "" -- name: io.k8s.api.batch.v1.CronJob - map: - fields: - - name: apiVersion - type: - scalar: string - - name: kind - type: - scalar: string - - name: metadata - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta - default: {} - - name: spec - type: - namedType: io.k8s.api.batch.v1.CronJobSpec - default: {} - - name: status - type: - namedType: io.k8s.api.batch.v1.CronJobStatus - default: {} -- name: io.k8s.api.batch.v1.CronJobSpec - map: - fields: - - name: concurrencyPolicy - type: - scalar: string - - name: failedJobsHistoryLimit - type: - scalar: numeric - - name: jobTemplate - type: - namedType: io.k8s.api.batch.v1.JobTemplateSpec - default: {} - - name: schedule - type: - scalar: string - default: "" - - name: startingDeadlineSeconds - type: - scalar: numeric - - name: successfulJobsHistoryLimit - type: - scalar: numeric - - name: suspend - type: - scalar: boolean - - name: timeZone - type: - scalar: string -- name: io.k8s.api.batch.v1.CronJobStatus - map: - fields: - - name: active - type: - list: - elementType: - namedType: io.k8s.api.core.v1.ObjectReference - elementRelationship: atomic - - name: lastScheduleTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - - name: lastSuccessfulTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time -- name: io.k8s.api.batch.v1.Job - map: - fields: - - name: apiVersion - type: - scalar: string - - name: kind - type: - scalar: string - - name: metadata - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta - default: {} - - name: spec - type: - namedType: io.k8s.api.batch.v1.JobSpec - default: {} - - name: status - type: - namedType: io.k8s.api.batch.v1.JobStatus - default: {} -- name: io.k8s.api.batch.v1.JobCondition - map: - fields: - - name: lastProbeTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - - name: lastTransitionTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - - name: message - type: - scalar: string - - name: reason - type: - scalar: string - - name: status - type: - scalar: string - default: "" - - name: type - type: - scalar: string - default: "" -- name: io.k8s.api.batch.v1.JobSpec - map: - fields: - - name: activeDeadlineSeconds - type: - scalar: numeric - - name: backoffLimit - type: - scalar: numeric - - name: backoffLimitPerIndex - type: - scalar: numeric - - name: completionMode - type: - scalar: string - - name: completions - type: - scalar: numeric - - name: managedBy - type: - scalar: string - - name: manualSelector - type: - scalar: boolean - - name: maxFailedIndexes - type: - scalar: numeric - - name: parallelism - type: - scalar: numeric - - name: podFailurePolicy - type: - namedType: io.k8s.api.batch.v1.PodFailurePolicy - - name: podReplacementPolicy - type: - scalar: string - - name: selector - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector - - name: successPolicy - type: - namedType: io.k8s.api.batch.v1.SuccessPolicy - - name: suspend - type: - scalar: boolean - - name: template - type: - namedType: io.k8s.api.core.v1.PodTemplateSpec - default: {} - - name: ttlSecondsAfterFinished - type: - scalar: numeric -- name: io.k8s.api.batch.v1.JobStatus - map: - fields: - - name: active - type: - scalar: numeric - - name: completedIndexes - type: - scalar: string - - name: completionTime - type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time - - name: conditions + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: conditions type: list: elementType: @@ -4643,6 +4089,9 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: stubPKCS10Request + type: + scalar: string - name: unverifiedUserAnnotations type: map: @@ -6292,6 +5741,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: reference type: scalar: string +- name: io.k8s.api.core.v1.ImageVolumeStatus + map: + fields: + - name: imageRef + type: + scalar: string - name: io.k8s.api.core.v1.KeyToPath map: fields: @@ -6585,6 +6040,24 @@ var schemaYAML = typed.YAMLObject(`types: - name: requiredDuringSchedulingIgnoredDuringExecution type: namedType: io.k8s.api.core.v1.NodeSelector +- name: io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus + map: + fields: + - name: containers + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: resourceClaimName + type: + scalar: string + default: "" + - name: resources + type: + map: + elementType: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity - name: io.k8s.api.core.v1.NodeCondition map: fields: @@ -7418,6 +6891,16 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" +- name: io.k8s.api.core.v1.PodSchedulingGroup + map: + fields: + - name: podGroupName + type: + scalar: string + unions: + - fields: + - fieldName: podGroupName + discriminatorValue: PodGroupName - name: io.k8s.api.core.v1.PodSecurityContext map: fields: @@ -7605,6 +7088,9 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name + - name: schedulingGroup + type: + namedType: io.k8s.api.core.v1.PodSchedulingGroup - name: securityContext type: namedType: io.k8s.api.core.v1.PodSecurityContext @@ -7649,9 +7135,6 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - name - - name: workloadRef - type: - namedType: io.k8s.api.core.v1.WorkloadReference - name: io.k8s.api.core.v1.PodStatus map: fields: @@ -7701,6 +7184,12 @@ var schemaYAML = typed.YAMLObject(`types: - name: message type: scalar: string + - name: nodeAllocatableResourceClaimStatuses + type: + list: + elementType: + namedType: io.k8s.api.core.v1.NodeAllocatableResourceClaimStatus + elementRelationship: atomic - name: nominatedNodeName type: scalar: string @@ -8064,6 +7553,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: health type: scalar: string + - name: message + type: + scalar: string - name: resourceID type: scalar: string @@ -8952,6 +8444,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: recursiveReadOnly type: scalar: string + - name: volumeStatus + type: + namedType: io.k8s.api.core.v1.VolumeStatus - name: io.k8s.api.core.v1.VolumeNodeAffinity map: fields: @@ -8992,6 +8487,12 @@ var schemaYAML = typed.YAMLObject(`types: map: elementType: namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: io.k8s.api.core.v1.VolumeStatus + map: + fields: + - name: image + type: + namedType: io.k8s.api.core.v1.ImageVolumeStatus - name: io.k8s.api.core.v1.VsphereVirtualDiskVolumeSource map: fields: @@ -9034,20 +8535,6 @@ var schemaYAML = typed.YAMLObject(`types: - name: runAsUserName type: scalar: string -- name: io.k8s.api.core.v1.WorkloadReference - map: - fields: - - name: name - type: - scalar: string - default: "" - - name: podGroup - type: - scalar: string - default: "" - - name: podGroupReplicaKey - type: - scalar: string - name: io.k8s.api.discovery.v1.Endpoint map: fields: @@ -12989,6 +12476,11 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: nodeAllocatableResourceMappings + type: + map: + elementType: + namedType: io.k8s.api.resource.v1.NodeAllocatableResourceMapping - name: nodeName type: scalar: string @@ -13038,15 +12530,39 @@ var schemaYAML = typed.YAMLObject(`types: - name: bool type: scalar: boolean + - name: bools + type: + list: + elementType: + scalar: boolean + elementRelationship: atomic - name: int type: scalar: numeric + - name: ints + type: + list: + elementType: + scalar: numeric + elementRelationship: atomic - name: string type: scalar: string + - name: strings + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: version type: scalar: string + - name: versions + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: io.k8s.api.resource.v1.DeviceCapacity map: fields: @@ -13341,6 +12857,15 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic +- name: io.k8s.api.resource.v1.NodeAllocatableResourceMapping + map: + fields: + - name: allocationMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: capacityKey + type: + scalar: string - name: io.k8s.api.resource.v1.OpaqueDeviceConfiguration map: fields: @@ -13534,7 +13059,95 @@ var schemaYAML = typed.YAMLObject(`types: - name: value type: scalar: string -- name: io.k8s.api.resource.v1alpha3.DeviceTaintRule +- name: io.k8s.api.resource.v1alpha3.DeviceTaintRule + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.resource.v1alpha3.DeviceTaintRuleSpec + default: {} + - name: status + type: + namedType: io.k8s.api.resource.v1alpha3.DeviceTaintRuleStatus + default: {} +- name: io.k8s.api.resource.v1alpha3.DeviceTaintRuleSpec + map: + fields: + - name: deviceSelector + type: + namedType: io.k8s.api.resource.v1alpha3.DeviceTaintSelector + - name: taint + type: + namedType: io.k8s.api.resource.v1alpha3.DeviceTaint + default: {} +- name: io.k8s.api.resource.v1alpha3.DeviceTaintRuleStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type +- name: io.k8s.api.resource.v1alpha3.DeviceTaintSelector + map: + fields: + - name: device + type: + scalar: string + - name: driver + type: + scalar: string + - name: pool + type: + scalar: string +- name: io.k8s.api.resource.v1alpha3.PoolStatus + map: + fields: + - name: allocatedDevices + type: + scalar: numeric + - name: availableDevices + type: + scalar: numeric + - name: driver + type: + scalar: string + - name: generation + type: + scalar: numeric + default: 0 + - name: nodeName + type: + scalar: string + - name: poolName + type: + scalar: string + - name: resourceSliceCount + type: + scalar: numeric + - name: totalDevices + type: + scalar: numeric + - name: unavailableDevices + type: + scalar: numeric + - name: validationError + type: + scalar: string +- name: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest map: fields: - name: apiVersion @@ -13549,23 +13162,26 @@ var schemaYAML = typed.YAMLObject(`types: default: {} - name: spec type: - namedType: io.k8s.api.resource.v1alpha3.DeviceTaintRuleSpec + namedType: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestSpec default: {} - name: status type: - namedType: io.k8s.api.resource.v1alpha3.DeviceTaintRuleStatus - default: {} -- name: io.k8s.api.resource.v1alpha3.DeviceTaintRuleSpec + namedType: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestStatus +- name: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestSpec map: fields: - - name: deviceSelector + - name: driver type: - namedType: io.k8s.api.resource.v1alpha3.DeviceTaintSelector - - name: taint + scalar: string + default: "" + - name: limit type: - namedType: io.k8s.api.resource.v1alpha3.DeviceTaint - default: {} -- name: io.k8s.api.resource.v1alpha3.DeviceTaintRuleStatus + scalar: numeric + default: 100 + - name: poolName + type: + scalar: string +- name: io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequestStatus map: fields: - name: conditions @@ -13576,18 +13192,15 @@ var schemaYAML = typed.YAMLObject(`types: elementRelationship: associative keys: - type -- name: io.k8s.api.resource.v1alpha3.DeviceTaintSelector - map: - fields: - - name: device - type: - scalar: string - - name: driver + - name: poolCount type: - scalar: string - - name: pool + scalar: numeric + - name: pools type: - scalar: string + list: + elementType: + namedType: io.k8s.api.resource.v1alpha3.PoolStatus + elementRelationship: atomic - name: io.k8s.api.resource.v1beta1.AllocatedDeviceStatus map: fields: @@ -13673,6 +13286,11 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: io.k8s.api.resource.v1beta1.DeviceCounterConsumption elementRelationship: atomic + - name: nodeAllocatableResourceMappings + type: + map: + elementType: + namedType: io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping - name: nodeName type: scalar: string @@ -13792,15 +13410,39 @@ var schemaYAML = typed.YAMLObject(`types: - name: bool type: scalar: boolean + - name: bools + type: + list: + elementType: + scalar: boolean + elementRelationship: atomic - name: int type: scalar: numeric + - name: ints + type: + list: + elementType: + scalar: numeric + elementRelationship: atomic - name: string type: scalar: string + - name: strings + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: version type: scalar: string + - name: versions + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: io.k8s.api.resource.v1beta1.DeviceCapacity map: fields: @@ -14089,6 +13731,15 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic +- name: io.k8s.api.resource.v1beta1.NodeAllocatableResourceMapping + map: + fields: + - name: allocationMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: capacityKey + type: + scalar: string - name: io.k8s.api.resource.v1beta1.OpaqueDeviceConfiguration map: fields: @@ -14414,6 +14065,11 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" + - name: nodeAllocatableResourceMappings + type: + map: + elementType: + namedType: io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping - name: nodeName type: scalar: string @@ -14463,15 +14119,39 @@ var schemaYAML = typed.YAMLObject(`types: - name: bool type: scalar: boolean + - name: bools + type: + list: + elementType: + scalar: boolean + elementRelationship: atomic - name: int type: scalar: numeric + - name: ints + type: + list: + elementType: + scalar: numeric + elementRelationship: atomic - name: string type: scalar: string + - name: strings + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: version type: scalar: string + - name: versions + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: io.k8s.api.resource.v1beta2.DeviceCapacity map: fields: @@ -14701,6 +14381,60 @@ var schemaYAML = typed.YAMLObject(`types: - name: value type: scalar: string +- name: io.k8s.api.resource.v1beta2.DeviceTaintRule + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec + default: {} + - name: status + type: + namedType: io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus + default: {} +- name: io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec + map: + fields: + - name: deviceSelector + type: + namedType: io.k8s.api.resource.v1beta2.DeviceTaintSelector + - name: taint + type: + namedType: io.k8s.api.resource.v1beta2.DeviceTaint + default: {} +- name: io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type +- name: io.k8s.api.resource.v1beta2.DeviceTaintSelector + map: + fields: + - name: device + type: + scalar: string + - name: driver + type: + scalar: string + - name: pool + type: + scalar: string - name: io.k8s.api.resource.v1beta2.DeviceToleration map: fields: @@ -14766,6 +14500,15 @@ var schemaYAML = typed.YAMLObject(`types: elementType: scalar: string elementRelationship: atomic +- name: io.k8s.api.resource.v1beta2.NodeAllocatableResourceMapping + map: + fields: + - name: allocationMultiplier + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: capacityKey + type: + scalar: string - name: io.k8s.api.resource.v1beta2.OpaqueDeviceConfiguration map: fields: @@ -14968,7 +14711,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: numeric default: 0 -- name: io.k8s.api.scheduling.v1alpha1.BasicSchedulingPolicy +- name: io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy map: elementType: scalar: untyped @@ -14980,60 +14723,180 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: __untyped_deduced_ elementRelationship: separable -- name: io.k8s.api.scheduling.v1alpha1.GangSchedulingPolicy +- name: io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy map: fields: - name: minCount type: scalar: numeric default: 0 -- name: io.k8s.api.scheduling.v1alpha1.PodGroup +- name: io.k8s.api.scheduling.v1alpha2.PodGroup + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSpec + default: {} + - name: status + type: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupStatus + default: {} +- name: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim map: fields: - name: name type: scalar: string default: "" - - name: policy + - name: resourceClaimName type: - namedType: io.k8s.api.scheduling.v1alpha1.PodGroupPolicy - default: {} -- name: io.k8s.api.scheduling.v1alpha1.PodGroupPolicy + scalar: string + - name: resourceClaimTemplateName + type: + scalar: string +- name: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: resourceClaimName + type: + scalar: string +- name: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints + map: + fields: + - name: topology + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha2.TopologyConstraint + elementRelationship: atomic +- name: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy map: fields: - name: basic type: - namedType: io.k8s.api.scheduling.v1alpha1.BasicSchedulingPolicy + namedType: io.k8s.api.scheduling.v1alpha2.BasicSchedulingPolicy - name: gang type: - namedType: io.k8s.api.scheduling.v1alpha1.GangSchedulingPolicy -- name: io.k8s.api.scheduling.v1alpha1.PriorityClass + namedType: io.k8s.api.scheduling.v1alpha2.GangSchedulingPolicy + unions: + - fields: + - fieldName: basic + discriminatorValue: Basic + - fieldName: gang + discriminatorValue: Gang +- name: io.k8s.api.scheduling.v1alpha2.PodGroupSpec map: fields: - - name: apiVersion + - name: disruptionMode type: scalar: string - - name: description + default: Pod + - name: podGroupTemplateRef type: - scalar: string - - name: globalDefault + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference + - name: priority type: - scalar: boolean - - name: kind + scalar: numeric + - name: priorityClassName type: scalar: string - - name: metadata + - name: resourceClaims type: - namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim + elementRelationship: associative + keys: + - name + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy default: {} - - name: preemptionPolicy +- name: io.k8s.api.scheduling.v1alpha2.PodGroupStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: associative + keys: + - type + - name: resourceClaimStatuses + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaimStatus + elementRelationship: associative + keys: + - name +- name: io.k8s.api.scheduling.v1alpha2.PodGroupTemplate + map: + fields: + - name: disruptionMode type: scalar: string - - name: value + - name: name + type: + scalar: string + default: "" + - name: priority type: scalar: numeric - default: 0 -- name: io.k8s.api.scheduling.v1alpha1.TypedLocalObjectReference + - name: priorityClassName + type: + scalar: string + - name: resourceClaims + type: + list: + elementType: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupResourceClaim + elementRelationship: associative + keys: + - name + - name: schedulingConstraints + type: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingConstraints + - name: schedulingPolicy + type: + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupSchedulingPolicy + default: {} +- name: io.k8s.api.scheduling.v1alpha2.PodGroupTemplateReference + map: + fields: + - name: workload + type: + namedType: io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference + unions: + - fields: + - fieldName: workload + discriminatorValue: Workload +- name: io.k8s.api.scheduling.v1alpha2.TopologyConstraint + map: + fields: + - name: key + type: + scalar: string + default: "" +- name: io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference map: fields: - name: apiGroup @@ -15047,7 +14910,7 @@ var schemaYAML = typed.YAMLObject(`types: type: scalar: string default: "" -- name: io.k8s.api.scheduling.v1alpha1.Workload +- name: io.k8s.api.scheduling.v1alpha2.Workload map: fields: - name: apiVersion @@ -15062,19 +14925,30 @@ var schemaYAML = typed.YAMLObject(`types: default: {} - name: spec type: - namedType: io.k8s.api.scheduling.v1alpha1.WorkloadSpec + namedType: io.k8s.api.scheduling.v1alpha2.WorkloadSpec default: {} -- name: io.k8s.api.scheduling.v1alpha1.WorkloadSpec +- name: io.k8s.api.scheduling.v1alpha2.WorkloadPodGroupTemplateReference + map: + fields: + - name: podGroupTemplateName + type: + scalar: string + default: "" + - name: workloadName + type: + scalar: string + default: "" +- name: io.k8s.api.scheduling.v1alpha2.WorkloadSpec map: fields: - name: controllerRef type: - namedType: io.k8s.api.scheduling.v1alpha1.TypedLocalObjectReference - - name: podGroups + namedType: io.k8s.api.scheduling.v1alpha2.TypedLocalObjectReference + - name: podGroupTemplates type: list: elementType: - namedType: io.k8s.api.scheduling.v1alpha1.PodGroup + namedType: io.k8s.api.scheduling.v1alpha2.PodGroupTemplate elementRelationship: associative keys: - name @@ -15136,6 +15010,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: podInfoOnMount type: scalar: boolean + - name: preventPodSchedulingIfMissing + type: + scalar: boolean - name: requiresRepublish type: scalar: boolean @@ -15545,6 +15422,9 @@ var schemaYAML = typed.YAMLObject(`types: - name: podInfoOnMount type: scalar: boolean + - name: preventPodSchedulingIfMissing + type: + scalar: boolean - name: requiresRepublish type: scalar: boolean diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/allocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/allocationresult.go index 83f0b96895..6e380790ea 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/allocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/allocationresult.go @@ -36,7 +36,7 @@ type AllocationResultApplyConfiguration struct { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. AllocationTimestamp *metav1.Time `json:"allocationTimestamp,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go index 5a77aac95f..15ec20da40 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/celdeviceselector.go @@ -72,6 +72,14 @@ type CELDeviceSelectorApplyConfiguration struct { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go index ca50f6024a..f19b9000cd 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/device.go @@ -19,6 +19,7 @@ limitations under the License. package v1 import ( + apicorev1 "k8s.io/api/core/v1" resourcev1 "k8s.io/api/resource/v1" corev1 "k8s.io/client-go/applyconfigurations/core/v1" ) @@ -74,7 +75,7 @@ type DeviceApplyConfiguration struct { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"` // BindsToNode indicates if the usage of an allocation involving this device @@ -82,7 +83,7 @@ type DeviceApplyConfiguration struct { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindsToNode *bool `json:"bindsToNode,omitempty"` // BindingConditions defines the conditions for proceeding with binding. @@ -94,7 +95,7 @@ type DeviceApplyConfiguration struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingConditions []string `json:"bindingConditions,omitempty"` // BindingFailureConditions defines the conditions for binding failure. @@ -105,7 +106,7 @@ type DeviceApplyConfiguration struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -113,6 +114,18 @@ type DeviceApplyConfiguration struct { // If AllowMultipleAllocations is set to true, the device can be allocated more than once, // and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not. AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"` + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + NodeAllocatableResourceMappings map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"` } // DeviceApplyConfiguration constructs a declarative configuration of the Device type for use with @@ -242,3 +255,17 @@ func (b *DeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) *Dev b.AllowMultipleAllocations = &value return b } + +// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResourceMappings field, +// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key. +func (b *DeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *DeviceApplyConfiguration { + if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 { + b.NodeAllocatableResourceMappings = make(map[apicorev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.NodeAllocatableResourceMappings[k] = v + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceattribute.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceattribute.go index e41696ab88..9d5b16f271 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceattribute.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceattribute.go @@ -32,6 +32,22 @@ type DeviceAttributeApplyConfiguration struct { // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. VersionValue *string `json:"version,omitempty"` + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + IntValues []int64 `json:"ints,omitempty"` + // BoolValues is a non-empty list of true/false values. + BoolValues []bool `json:"bools,omitempty"` + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + StringValues []string `json:"strings,omitempty"` + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + VersionValues []string `json:"versions,omitempty"` } // DeviceAttributeApplyConfiguration constructs a declarative configuration of the DeviceAttribute type for use with @@ -71,3 +87,43 @@ func (b *DeviceAttributeApplyConfiguration) WithVersionValue(value string) *Devi b.VersionValue = &value return b } + +// WithIntValues adds the given value to the IntValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IntValues field. +func (b *DeviceAttributeApplyConfiguration) WithIntValues(values ...int64) *DeviceAttributeApplyConfiguration { + for i := range values { + b.IntValues = append(b.IntValues, values[i]) + } + return b +} + +// WithBoolValues adds the given value to the BoolValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the BoolValues field. +func (b *DeviceAttributeApplyConfiguration) WithBoolValues(values ...bool) *DeviceAttributeApplyConfiguration { + for i := range values { + b.BoolValues = append(b.BoolValues, values[i]) + } + return b +} + +// WithStringValues adds the given value to the StringValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the StringValues field. +func (b *DeviceAttributeApplyConfiguration) WithStringValues(values ...string) *DeviceAttributeApplyConfiguration { + for i := range values { + b.StringValues = append(b.StringValues, values[i]) + } + return b +} + +// WithVersionValues adds the given value to the VersionValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VersionValues field. +func (b *DeviceAttributeApplyConfiguration) WithVersionValues(values ...string) *DeviceAttributeApplyConfiguration { + for i := range values { + b.VersionValues = append(b.VersionValues, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go index 6d3bc7e76d..478f90bb04 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclass.go @@ -34,9 +34,6 @@ import ( // device configuration and selectors. It can be referenced in // the device requests of a claim to apply these presets. // Cluster scoped. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type DeviceClassApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` // Standard object metadata diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go index a304c7d8d2..a6a3992c92 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceclassspec.go @@ -41,7 +41,7 @@ type DeviceClassSpecApplyConfiguration struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. ExtendedResourceName *string `json:"extendedResourceName,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceconstraint.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceconstraint.go index cd2467e694..ba13edbb84 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceconstraint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/deviceconstraint.go @@ -48,11 +48,21 @@ type DeviceConstraintApplyConfiguration struct { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as single-element lists for backward compatibility. + // // Must include the domain qualifier. MatchAttribute *resourcev1.FullyQualifiedName `json:"matchAttribute,omitempty"` // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go index 8b38fd2887..592a641756 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicerequestallocationresult.go @@ -57,8 +57,7 @@ type DeviceRequestAllocationResultApplyConfiguration struct { // administrative access. See the corresponding request field // for a definition of mode. // - // This is an alpha field and requires enabling the DRAAdminAccess - // feature gate. Admin access is disabled if this field is unset or + // Admin access is disabled if this field is unset or // set to false, otherwise it is enabled. AdminAccess *bool `json:"adminAccess,omitempty"` // A copy of all tolerations specified in the request at the time @@ -66,19 +65,19 @@ type DeviceRequestAllocationResultApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingConditions []string `json:"bindingConditions,omitempty"` // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"` // ShareID uniquely identifies an individual allocation share of the device, diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go index f3ee27af3c..d554522fa1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicesubrequest.go @@ -93,7 +93,7 @@ type DeviceSubRequestApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // Capacity define resource requirements against each capacity. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaint.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaint.go index db98da8b87..c65c88e05b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/devicetaint.go @@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct { // nodes is not valid here. More effects may get added in the future. // Consumers must treat unknown effects like None. Effect *resourcev1.DeviceTaintEffect `json:"effect,omitempty"` - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. + // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). TimeAdded *metav1.Time `json:"timeAdded,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go index 130893c6d6..8eb0fd3526 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/exactdevicerequest.go @@ -72,8 +72,7 @@ type ExactDeviceRequestApplyConfiguration struct { // all ordinary claims to the device with respect to access modes and // any resource allocations. // - // This is an alpha field and requires enabling the DRAAdminAccess - // feature gate. Admin access is disabled if this field is unset or + // Admin access is disabled if this field is unset or // set to false, otherwise it is enabled. AdminAccess *bool `json:"adminAccess,omitempty"` // If specified, the request's tolerations. @@ -91,7 +90,7 @@ type ExactDeviceRequestApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // Capacity define resource requirements against each capacity. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/networkdevicedata.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/networkdevicedata.go index 5d0ee8fc50..9cb1b4dea5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/networkdevicedata.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/networkdevicedata.go @@ -29,7 +29,7 @@ type NetworkDeviceDataApplyConfiguration struct { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. InterfaceName *string `json:"interfaceName,omitempty"` // IPs lists the network addresses assigned to the device's network interface. // This can include both IPv4 and IPv6 addresses. @@ -39,7 +39,7 @@ type NetworkDeviceDataApplyConfiguration struct { IPs []string `json:"ips,omitempty"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. HardwareAddress *string `json:"hardwareAddress,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresourcemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresourcemapping.go new file mode 100644 index 0000000000..600d96af89 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/nodeallocatableresourcemapping.go @@ -0,0 +1,84 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + resourcev1 "k8s.io/api/resource/v1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use +// with apply. +// +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +type NodeAllocatableResourceMappingApplyConfiguration struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + CapacityKey *resourcev1.QualifiedName `json:"capacityKey,omitempty"` + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"` +} + +// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with +// apply. +func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration { + return &NodeAllocatableResourceMappingApplyConfiguration{} +} + +// WithCapacityKey sets the CapacityKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CapacityKey field is set to the value of the last call. +func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration { + b.CapacityKey = &value + return b +} + +// WithAllocationMultiplier sets the AllocationMultiplier field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocationMultiplier field is set to the value of the last call. +func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration { + b.AllocationMultiplier = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go index 240e181846..5a87ea3cbc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaim.go @@ -35,9 +35,6 @@ import ( // with specific properties, this is how that request is expressed. The status // stanza tracks whether this claim has been satisfied and what specific // resources have been allocated. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type ResourceClaimApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` // Standard object metadata diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go index 7bbadb7009..cee18f3797 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceclaimtemplate.go @@ -31,9 +31,6 @@ import ( // with apply. // // ResourceClaimTemplate is used to produce ResourceClaim objects. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type ResourceClaimTemplateApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` // Standard object metadata diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go index 6c7ddf41e3..7a3eec9d5c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1/resourceslice.go @@ -51,9 +51,6 @@ import ( // // For resources that are not local to a node, the node name is not set. Instead, // the driver may use a node selector to specify where the devices are available. -// -// This is an alpha type and requires enabling the DynamicResourceAllocation -// feature gate. type ResourceSliceApplyConfiguration struct { metav1.TypeMetaApplyConfiguration `json:",inline"` // Standard object metadata diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaint.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaint.go index d9c2c6f48d..719168dbee 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/devicetaint.go @@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct { // nodes is not valid here. More effects may get added in the future. // Consumers must treat unknown effects like None. Effect *resourcev1alpha3.DeviceTaintEffect `json:"effect,omitempty"` - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. + // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). TimeAdded *v1.Time `json:"timeAdded,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go new file mode 100644 index 0000000000..343fe8247d --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/poolstatus.go @@ -0,0 +1,152 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha3 + +// PoolStatusApplyConfiguration represents a declarative configuration of the PoolStatus type for use +// with apply. +// +// PoolStatus contains status information for a single resource pool. +type PoolStatusApplyConfiguration struct { + // Driver is the DRA driver name for this pool. + // Must be a DNS subdomain (e.g., "gpu.example.com"). + Driver *string `json:"driver,omitempty"` + // PoolName is the name of the pool. + // Must be a valid resource pool name (DNS subdomains separated by "/"). + PoolName *string `json:"poolName,omitempty"` + // Generation is the pool generation observed across all ResourceSlices + // in this pool. Only the latest generation is reported. During a generation + // rollout, if not all slices at the latest generation have been published, + // the pool is included with a validationError and device counts unset. + Generation *int64 `json:"generation,omitempty"` + // ResourceSliceCount is the number of ResourceSlices that make up this pool. + // May be unset when validationError is set. + ResourceSliceCount *int32 `json:"resourceSliceCount,omitempty"` + // TotalDevices is the total number of devices in the pool across all slices. + // A value of 0 means the pool has no devices. + // May be unset when validationError is set. + TotalDevices *int32 `json:"totalDevices,omitempty"` + // AllocatedDevices is the number of devices currently allocated to claims. + // A value of 0 means no devices are allocated. + // May be unset when validationError is set. + AllocatedDevices *int32 `json:"allocatedDevices,omitempty"` + // AvailableDevices is the number of devices available for allocation. + // This equals TotalDevices - AllocatedDevices - UnavailableDevices. + // A value of 0 means no devices are currently available. + // May be unset when validationError is set. + AvailableDevices *int32 `json:"availableDevices,omitempty"` + // UnavailableDevices is the number of devices that are not available + // due to taints or other conditions, but are not allocated. + // A value of 0 means all unallocated devices are available. + // May be unset when validationError is set. + UnavailableDevices *int32 `json:"unavailableDevices,omitempty"` + // NodeName is the node this pool is associated with. + // When omitted, the pool is not associated with a specific node. + // Must be a valid DNS subdomain name (RFC1123). + NodeName *string `json:"nodeName,omitempty"` + // ValidationError is set when the pool's data could not be fully + // validated (e.g., incomplete slice publication). When set, device + // count fields and ResourceSliceCount may be unset. + ValidationError *string `json:"validationError,omitempty"` +} + +// PoolStatusApplyConfiguration constructs a declarative configuration of the PoolStatus type for use with +// apply. +func PoolStatus() *PoolStatusApplyConfiguration { + return &PoolStatusApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithDriver(value string) *PoolStatusApplyConfiguration { + b.Driver = &value + return b +} + +// WithPoolName sets the PoolName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PoolName field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithPoolName(value string) *PoolStatusApplyConfiguration { + b.PoolName = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithGeneration(value int64) *PoolStatusApplyConfiguration { + b.Generation = &value + return b +} + +// WithResourceSliceCount sets the ResourceSliceCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceSliceCount field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithResourceSliceCount(value int32) *PoolStatusApplyConfiguration { + b.ResourceSliceCount = &value + return b +} + +// WithTotalDevices sets the TotalDevices field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TotalDevices field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithTotalDevices(value int32) *PoolStatusApplyConfiguration { + b.TotalDevices = &value + return b +} + +// WithAllocatedDevices sets the AllocatedDevices field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocatedDevices field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithAllocatedDevices(value int32) *PoolStatusApplyConfiguration { + b.AllocatedDevices = &value + return b +} + +// WithAvailableDevices sets the AvailableDevices field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AvailableDevices field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithAvailableDevices(value int32) *PoolStatusApplyConfiguration { + b.AvailableDevices = &value + return b +} + +// WithUnavailableDevices sets the UnavailableDevices field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UnavailableDevices field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithUnavailableDevices(value int32) *PoolStatusApplyConfiguration { + b.UnavailableDevices = &value + return b +} + +// WithNodeName sets the NodeName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NodeName field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithNodeName(value string) *PoolStatusApplyConfiguration { + b.NodeName = &value + return b +} + +// WithValidationError sets the ValidationError field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ValidationError field is set to the value of the last call. +func (b *PoolStatusApplyConfiguration) WithValidationError(value string) *PoolStatusApplyConfiguration { + b.ValidationError = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go similarity index 57% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/priorityclass.go rename to vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go index 1735a6deae..aee4d0ed90 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/priorityclass.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequest.go @@ -16,11 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha3 import ( - corev1 "k8s.io/api/core/v1" - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + resourcev1alpha3 "k8s.io/api/resource/v1alpha3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" @@ -28,85 +27,81 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// PriorityClassApplyConfiguration represents a declarative configuration of the PriorityClass type for use +// ResourcePoolStatusRequestApplyConfiguration represents a declarative configuration of the ResourcePoolStatusRequest type for use // with apply. // -// DEPRECATED - This group version of PriorityClass is deprecated by scheduling.k8s.io/v1/PriorityClass. -// PriorityClass defines mapping from a priority class name to the priority -// integer value. The value can be any valid integer. -type PriorityClassApplyConfiguration struct { +// ResourcePoolStatusRequest triggers a one-time calculation of resource pool status +// based on the provided filters. Once status is set, the request is considered complete and will not be reprocessed. +// Users should delete and recreate requests to get updated information. +type ResourcePoolStatusRequestApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // Standard object's metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // value represents the integer value of this priority class. This is the actual priority that pods - // receive when they have the name of this class in their pod spec. - Value *int32 `json:"value,omitempty"` - // globalDefault specifies whether this PriorityClass should be considered as - // the default priority for pods that do not have any priority class. - // Only one PriorityClass can be marked as `globalDefault`. However, if more than - // one PriorityClasses exists with their `globalDefault` field set to true, - // the smallest value of such global default PriorityClasses will be used as the default priority. - GlobalDefault *bool `json:"globalDefault,omitempty"` - // description is an arbitrary string that usually provides guidelines on - // when this priority class should be used. - Description *string `json:"description,omitempty"` - // preemptionPolicy is the Policy for preempting pods with lower priority. - // One of Never, PreemptLowerPriority. - // Defaults to PreemptLowerPriority if unset. - PreemptionPolicy *corev1.PreemptionPolicy `json:"preemptionPolicy,omitempty"` + // Spec defines the filters for which pools to include in the status. + // The spec is immutable once created. + Spec *ResourcePoolStatusRequestSpecApplyConfiguration `json:"spec,omitempty"` + // Status is populated by the controller with the calculated pool status. + // When status is non-nil, the request is considered complete and the + // entire object becomes immutable. + Status *ResourcePoolStatusRequestStatusApplyConfiguration `json:"status,omitempty"` } -// PriorityClass constructs a declarative configuration of the PriorityClass type for use with +// ResourcePoolStatusRequest constructs a declarative configuration of the ResourcePoolStatusRequest type for use with // apply. -func PriorityClass(name string) *PriorityClassApplyConfiguration { - b := &PriorityClassApplyConfiguration{} +func ResourcePoolStatusRequest(name string) *ResourcePoolStatusRequestApplyConfiguration { + b := &ResourcePoolStatusRequestApplyConfiguration{} b.WithName(name) - b.WithKind("PriorityClass") - b.WithAPIVersion("scheduling.k8s.io/v1alpha1") + b.WithKind("ResourcePoolStatusRequest") + b.WithAPIVersion("resource.k8s.io/v1alpha3") return b } -// ExtractPriorityClassFrom extracts the applied configuration owned by fieldManager from -// priorityClass for the specified subresource. Pass an empty string for subresource to extract +// ExtractResourcePoolStatusRequestFrom extracts the applied configuration owned by fieldManager from +// resourcePoolStatusRequest for the specified subresource. Pass an empty string for subresource to extract // the main resource. Common subresources include "status", "scale", etc. -// priorityClass must be a unmodified PriorityClass API object that was retrieved from the Kubernetes API. -// ExtractPriorityClassFrom provides a way to perform a extract/modify-in-place/apply workflow. +// resourcePoolStatusRequest must be a unmodified ResourcePoolStatusRequest API object that was retrieved from the Kubernetes API. +// ExtractResourcePoolStatusRequestFrom provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractPriorityClassFrom(priorityClass *schedulingv1alpha1.PriorityClass, fieldManager string, subresource string) (*PriorityClassApplyConfiguration, error) { - b := &PriorityClassApplyConfiguration{} - err := managedfields.ExtractInto(priorityClass, internal.Parser().Type("io.k8s.api.scheduling.v1alpha1.PriorityClass"), fieldManager, b, subresource) +func ExtractResourcePoolStatusRequestFrom(resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, fieldManager string, subresource string) (*ResourcePoolStatusRequestApplyConfiguration, error) { + b := &ResourcePoolStatusRequestApplyConfiguration{} + err := managedfields.ExtractInto(resourcePoolStatusRequest, internal.Parser().Type("io.k8s.api.resource.v1alpha3.ResourcePoolStatusRequest"), fieldManager, b, subresource) if err != nil { return nil, err } - b.WithName(priorityClass.Name) + b.WithName(resourcePoolStatusRequest.Name) - b.WithKind("PriorityClass") - b.WithAPIVersion("scheduling.k8s.io/v1alpha1") + b.WithKind("ResourcePoolStatusRequest") + b.WithAPIVersion("resource.k8s.io/v1alpha3") return b, nil } -// ExtractPriorityClass extracts the applied configuration owned by fieldManager from -// priorityClass. If no managedFields are found in priorityClass for fieldManager, a -// PriorityClassApplyConfiguration is returned with only the Name, Namespace (if applicable), +// ExtractResourcePoolStatusRequest extracts the applied configuration owned by fieldManager from +// resourcePoolStatusRequest. If no managedFields are found in resourcePoolStatusRequest for fieldManager, a +// ResourcePoolStatusRequestApplyConfiguration is returned with only the Name, Namespace (if applicable), // APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. -// priorityClass must be a unmodified PriorityClass API object that was retrieved from the Kubernetes API. -// ExtractPriorityClass provides a way to perform a extract/modify-in-place/apply workflow. +// resourcePoolStatusRequest must be a unmodified ResourcePoolStatusRequest API object that was retrieved from the Kubernetes API. +// ExtractResourcePoolStatusRequest provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractPriorityClass(priorityClass *schedulingv1alpha1.PriorityClass, fieldManager string) (*PriorityClassApplyConfiguration, error) { - return ExtractPriorityClassFrom(priorityClass, fieldManager, "") +func ExtractResourcePoolStatusRequest(resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, fieldManager string) (*ResourcePoolStatusRequestApplyConfiguration, error) { + return ExtractResourcePoolStatusRequestFrom(resourcePoolStatusRequest, fieldManager, "") } -func (b PriorityClassApplyConfiguration) IsApplyConfiguration() {} +// ExtractResourcePoolStatusRequestStatus extracts the applied configuration owned by fieldManager from +// resourcePoolStatusRequest for the status subresource. +func ExtractResourcePoolStatusRequestStatus(resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, fieldManager string) (*ResourcePoolStatusRequestApplyConfiguration, error) { + return ExtractResourcePoolStatusRequestFrom(resourcePoolStatusRequest, fieldManager, "status") +} + +func (b ResourcePoolStatusRequestApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Kind field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithKind(value string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithKind(value string) *ResourcePoolStatusRequestApplyConfiguration { b.TypeMetaApplyConfiguration.Kind = &value return b } @@ -114,7 +109,7 @@ func (b *PriorityClassApplyConfiguration) WithKind(value string) *PriorityClassA // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the APIVersion field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithAPIVersion(value string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithAPIVersion(value string) *ResourcePoolStatusRequestApplyConfiguration { b.TypeMetaApplyConfiguration.APIVersion = &value return b } @@ -122,7 +117,7 @@ func (b *PriorityClassApplyConfiguration) WithAPIVersion(value string) *Priority // WithName sets the Name field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Name field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithName(value string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithName(value string) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Name = &value return b @@ -131,7 +126,7 @@ func (b *PriorityClassApplyConfiguration) WithName(value string) *PriorityClassA // WithGenerateName sets the GenerateName field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the GenerateName field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithGenerateName(value string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithGenerateName(value string) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.GenerateName = &value return b @@ -140,7 +135,7 @@ func (b *PriorityClassApplyConfiguration) WithGenerateName(value string) *Priori // WithNamespace sets the Namespace field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Namespace field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithNamespace(value string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithNamespace(value string) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Namespace = &value return b @@ -149,7 +144,7 @@ func (b *PriorityClassApplyConfiguration) WithNamespace(value string) *PriorityC // WithUID sets the UID field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the UID field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithUID(value types.UID) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithUID(value types.UID) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.UID = &value return b @@ -158,7 +153,7 @@ func (b *PriorityClassApplyConfiguration) WithUID(value types.UID) *PriorityClas // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithResourceVersion(value string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithResourceVersion(value string) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.ResourceVersion = &value return b @@ -167,7 +162,7 @@ func (b *PriorityClassApplyConfiguration) WithResourceVersion(value string) *Pri // WithGeneration sets the Generation field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Generation field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithGeneration(value int64) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithGeneration(value int64) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Generation = &value return b @@ -176,7 +171,7 @@ func (b *PriorityClassApplyConfiguration) WithGeneration(value int64) *PriorityC // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithCreationTimestamp(value metav1.Time) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.CreationTimestamp = &value return b @@ -185,7 +180,7 @@ func (b *PriorityClassApplyConfiguration) WithCreationTimestamp(value metav1.Tim // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value return b @@ -194,7 +189,7 @@ func (b *PriorityClassApplyConfiguration) WithDeletionTimestamp(value metav1.Tim // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value return b @@ -204,7 +199,7 @@ func (b *PriorityClassApplyConfiguration) WithDeletionGracePeriodSeconds(value i // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Labels field, // overwriting an existing map entries in Labels field with the same key. -func (b *PriorityClassApplyConfiguration) WithLabels(entries map[string]string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithLabels(entries map[string]string) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) @@ -219,7 +214,7 @@ func (b *PriorityClassApplyConfiguration) WithLabels(entries map[string]string) // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Annotations field, // overwriting an existing map entries in Annotations field with the same key. -func (b *PriorityClassApplyConfiguration) WithAnnotations(entries map[string]string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithAnnotations(entries map[string]string) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) @@ -233,7 +228,7 @@ func (b *PriorityClassApplyConfiguration) WithAnnotations(entries map[string]str // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *PriorityClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { if values[i] == nil { @@ -247,7 +242,7 @@ func (b *PriorityClassApplyConfiguration) WithOwnerReferences(values ...*v1.Owne // WithFinalizers adds the given value to the Finalizers field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *PriorityClassApplyConfiguration) WithFinalizers(values ...string) *PriorityClassApplyConfiguration { +func (b *ResourcePoolStatusRequestApplyConfiguration) WithFinalizers(values ...string) *ResourcePoolStatusRequestApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) @@ -255,62 +250,46 @@ func (b *PriorityClassApplyConfiguration) WithFinalizers(values ...string) *Prio return b } -func (b *PriorityClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { +func (b *ResourcePoolStatusRequestApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { if b.ObjectMetaApplyConfiguration == nil { b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} } } -// WithValue sets the Value field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Value field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithValue(value int32) *PriorityClassApplyConfiguration { - b.Value = &value - return b -} - -// WithGlobalDefault sets the GlobalDefault field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the GlobalDefault field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithGlobalDefault(value bool) *PriorityClassApplyConfiguration { - b.GlobalDefault = &value - return b -} - -// WithDescription sets the Description field in the declarative configuration to the given value +// WithSpec sets the Spec field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Description field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithDescription(value string) *PriorityClassApplyConfiguration { - b.Description = &value +// If called multiple times, the Spec field is set to the value of the last call. +func (b *ResourcePoolStatusRequestApplyConfiguration) WithSpec(value *ResourcePoolStatusRequestSpecApplyConfiguration) *ResourcePoolStatusRequestApplyConfiguration { + b.Spec = value return b } -// WithPreemptionPolicy sets the PreemptionPolicy field in the declarative configuration to the given value +// WithStatus sets the Status field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the PreemptionPolicy field is set to the value of the last call. -func (b *PriorityClassApplyConfiguration) WithPreemptionPolicy(value corev1.PreemptionPolicy) *PriorityClassApplyConfiguration { - b.PreemptionPolicy = &value +// If called multiple times, the Status field is set to the value of the last call. +func (b *ResourcePoolStatusRequestApplyConfiguration) WithStatus(value *ResourcePoolStatusRequestStatusApplyConfiguration) *ResourcePoolStatusRequestApplyConfiguration { + b.Status = value return b } // GetKind retrieves the value of the Kind field in the declarative configuration. -func (b *PriorityClassApplyConfiguration) GetKind() *string { +func (b *ResourcePoolStatusRequestApplyConfiguration) GetKind() *string { return b.TypeMetaApplyConfiguration.Kind } // GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. -func (b *PriorityClassApplyConfiguration) GetAPIVersion() *string { +func (b *ResourcePoolStatusRequestApplyConfiguration) GetAPIVersion() *string { return b.TypeMetaApplyConfiguration.APIVersion } // GetName retrieves the value of the Name field in the declarative configuration. -func (b *PriorityClassApplyConfiguration) GetName() *string { +func (b *ResourcePoolStatusRequestApplyConfiguration) GetName() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Name } // GetNamespace retrieves the value of the Namespace field in the declarative configuration. -func (b *PriorityClassApplyConfiguration) GetNamespace() *string { +func (b *ResourcePoolStatusRequestApplyConfiguration) GetNamespace() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Namespace } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go new file mode 100644 index 0000000000..bb86727321 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequestspec.go @@ -0,0 +1,73 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha3 + +// ResourcePoolStatusRequestSpecApplyConfiguration represents a declarative configuration of the ResourcePoolStatusRequestSpec type for use +// with apply. +// +// ResourcePoolStatusRequestSpec defines the filters for the pool status request. +type ResourcePoolStatusRequestSpecApplyConfiguration struct { + // Driver specifies the DRA driver name to filter pools. + // Only pools from ResourceSlices with this driver will be included. + // Must be a DNS subdomain (e.g., "gpu.example.com"). + Driver *string `json:"driver,omitempty"` + // PoolName optionally filters to a specific pool name. + // If not specified, all pools from the specified driver are included. + // When specified, must be a non-empty valid resource pool name + // (DNS subdomains separated by "/"). + PoolName *string `json:"poolName,omitempty"` + // Limit optionally specifies the maximum number of pools to return in the status. + // If more pools match the filter criteria, the response will be truncated + // (i.e., len(status.pools) < status.poolCount). + // + // Default: 100 + // Minimum: 1 + // Maximum: 1000 + Limit *int32 `json:"limit,omitempty"` +} + +// ResourcePoolStatusRequestSpecApplyConfiguration constructs a declarative configuration of the ResourcePoolStatusRequestSpec type for use with +// apply. +func ResourcePoolStatusRequestSpec() *ResourcePoolStatusRequestSpecApplyConfiguration { + return &ResourcePoolStatusRequestSpecApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithDriver(value string) *ResourcePoolStatusRequestSpecApplyConfiguration { + b.Driver = &value + return b +} + +// WithPoolName sets the PoolName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PoolName field is set to the value of the last call. +func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithPoolName(value string) *ResourcePoolStatusRequestSpecApplyConfiguration { + b.PoolName = &value + return b +} + +// WithLimit sets the Limit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Limit field is set to the value of the last call. +func (b *ResourcePoolStatusRequestSpecApplyConfiguration) WithLimit(value int32) *ResourcePoolStatusRequestSpecApplyConfiguration { + b.Limit = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequeststatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequeststatus.go new file mode 100644 index 0000000000..124c702900 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1alpha3/resourcepoolstatusrequeststatus.go @@ -0,0 +1,87 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// ResourcePoolStatusRequestStatusApplyConfiguration represents a declarative configuration of the ResourcePoolStatusRequestStatus type for use +// with apply. +// +// ResourcePoolStatusRequestStatus contains the calculated pool status information. +type ResourcePoolStatusRequestStatusApplyConfiguration struct { + // PoolCount is the total number of pools that matched the filter criteria, + // regardless of truncation. This helps users understand how many pools exist + // even when the response is truncated. A value of 0 means no pools matched + // the filter criteria. + PoolCount *int32 `json:"poolCount,omitempty"` + // Pools contains the first `spec.limit` matching pools, sorted by driver + // then pool name. If `len(pools) < poolCount`, the list was truncated. + // When omitted, no pools matched the request filters. + Pools []PoolStatusApplyConfiguration `json:"pools,omitempty"` + // Conditions provide information about the state of the request. + // A condition with type=Complete or type=Failed will always be set + // when the status is populated. + // + // Known condition types: + // - "Complete": True when the request has been processed successfully + // - "Failed": True when the request could not be processed + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// ResourcePoolStatusRequestStatusApplyConfiguration constructs a declarative configuration of the ResourcePoolStatusRequestStatus type for use with +// apply. +func ResourcePoolStatusRequestStatus() *ResourcePoolStatusRequestStatusApplyConfiguration { + return &ResourcePoolStatusRequestStatusApplyConfiguration{} +} + +// WithPoolCount sets the PoolCount field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PoolCount field is set to the value of the last call. +func (b *ResourcePoolStatusRequestStatusApplyConfiguration) WithPoolCount(value int32) *ResourcePoolStatusRequestStatusApplyConfiguration { + b.PoolCount = &value + return b +} + +// WithPools adds the given value to the Pools field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Pools field. +func (b *ResourcePoolStatusRequestStatusApplyConfiguration) WithPools(values ...*PoolStatusApplyConfiguration) *ResourcePoolStatusRequestStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPools") + } + b.Pools = append(b.Pools, *values[i]) + } + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *ResourcePoolStatusRequestStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *ResourcePoolStatusRequestStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/allocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/allocationresult.go index f6fd7e2034..594dc364bc 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/allocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/allocationresult.go @@ -36,7 +36,7 @@ type AllocationResultApplyConfiguration struct { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. AllocationTimestamp *metav1.Time `json:"allocationTimestamp,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go index 8a0241a2f3..64527b2938 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/basicdevice.go @@ -19,6 +19,7 @@ limitations under the License. package v1beta1 import ( + corev1 "k8s.io/api/core/v1" resourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/client-go/applyconfigurations/core/v1" ) @@ -70,7 +71,7 @@ type BasicDeviceApplyConfiguration struct { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"` // BindsToNode indicates if the usage of an allocation involving this device @@ -78,7 +79,7 @@ type BasicDeviceApplyConfiguration struct { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindsToNode *bool `json:"bindsToNode,omitempty"` // BindingConditions defines the conditions for proceeding with binding. @@ -90,7 +91,7 @@ type BasicDeviceApplyConfiguration struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingConditions []string `json:"bindingConditions,omitempty"` // BindingFailureConditions defines the conditions for binding failure. @@ -101,7 +102,7 @@ type BasicDeviceApplyConfiguration struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -109,6 +110,18 @@ type BasicDeviceApplyConfiguration struct { // If AllowMultipleAllocations is set to true, the device can be allocated more than once, // and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not. AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"` + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + NodeAllocatableResourceMappings map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"` } // BasicDeviceApplyConfiguration constructs a declarative configuration of the BasicDevice type for use with @@ -230,3 +243,17 @@ func (b *BasicDeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) b.AllowMultipleAllocations = &value return b } + +// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResourceMappings field, +// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key. +func (b *BasicDeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *BasicDeviceApplyConfiguration { + if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 { + b.NodeAllocatableResourceMappings = make(map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.NodeAllocatableResourceMappings[k] = v + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go index 42708c5c9f..ba65467ae5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/celdeviceselector.go @@ -72,6 +72,14 @@ type CELDeviceSelectorApplyConfiguration struct { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceattribute.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceattribute.go index a4e9fe8504..178f70fb76 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceattribute.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceattribute.go @@ -32,6 +32,22 @@ type DeviceAttributeApplyConfiguration struct { // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. VersionValue *string `json:"version,omitempty"` + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + IntValues []int64 `json:"ints,omitempty"` + // BoolValues is a non-empty list of true/false values. + BoolValues []bool `json:"bools,omitempty"` + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + StringValues []string `json:"strings,omitempty"` + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + VersionValues []string `json:"versions,omitempty"` } // DeviceAttributeApplyConfiguration constructs a declarative configuration of the DeviceAttribute type for use with @@ -71,3 +87,43 @@ func (b *DeviceAttributeApplyConfiguration) WithVersionValue(value string) *Devi b.VersionValue = &value return b } + +// WithIntValues adds the given value to the IntValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IntValues field. +func (b *DeviceAttributeApplyConfiguration) WithIntValues(values ...int64) *DeviceAttributeApplyConfiguration { + for i := range values { + b.IntValues = append(b.IntValues, values[i]) + } + return b +} + +// WithBoolValues adds the given value to the BoolValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the BoolValues field. +func (b *DeviceAttributeApplyConfiguration) WithBoolValues(values ...bool) *DeviceAttributeApplyConfiguration { + for i := range values { + b.BoolValues = append(b.BoolValues, values[i]) + } + return b +} + +// WithStringValues adds the given value to the StringValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the StringValues field. +func (b *DeviceAttributeApplyConfiguration) WithStringValues(values ...string) *DeviceAttributeApplyConfiguration { + for i := range values { + b.StringValues = append(b.StringValues, values[i]) + } + return b +} + +// WithVersionValues adds the given value to the VersionValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VersionValues field. +func (b *DeviceAttributeApplyConfiguration) WithVersionValues(values ...string) *DeviceAttributeApplyConfiguration { + for i := range values { + b.VersionValues = append(b.VersionValues, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go index 942da3efed..c234bdd732 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceclassspec.go @@ -41,7 +41,7 @@ type DeviceClassSpecApplyConfiguration struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. ExtendedResourceName *string `json:"extendedResourceName,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceconstraint.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceconstraint.go index 1716c92331..8cbdee16d9 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceconstraint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/deviceconstraint.go @@ -48,11 +48,21 @@ type DeviceConstraintApplyConfiguration struct { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as singleton sets for backward compatibility. + // // Must include the domain qualifier. MatchAttribute *resourcev1beta1.FullyQualifiedName `json:"matchAttribute,omitempty"` // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go index eab54ba01c..fdcb928a57 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequest.go @@ -133,7 +133,7 @@ type DeviceRequestApplyConfiguration struct { // This field can only be set when deviceClassName is set and no subrequests // are specified in the firstAvailable list. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // Capacity define resource requirements against each capacity. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go index 2171522a35..3a47b9c1f6 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicerequestallocationresult.go @@ -66,19 +66,19 @@ type DeviceRequestAllocationResultApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingConditions []string `json:"bindingConditions,omitempty"` // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"` // ShareID uniquely identifies an individual allocation share of the device, diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go index 2701074e90..ae7bf65a04 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicesubrequest.go @@ -94,7 +94,7 @@ type DeviceSubRequestApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // Capacity define resource requirements against each capacity. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicetaint.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicetaint.go index 55c7d58a68..32b37402c5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicetaint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/devicetaint.go @@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct { // nodes is not valid here. More effects may get added in the future. // Consumers must treat unknown effects like None. Effect *resourcev1beta1.DeviceTaintEffect `json:"effect,omitempty"` - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. + // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). TimeAdded *v1.Time `json:"timeAdded,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/networkdevicedata.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/networkdevicedata.go index 5c3edcfe88..f112f01454 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/networkdevicedata.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/networkdevicedata.go @@ -29,7 +29,7 @@ type NetworkDeviceDataApplyConfiguration struct { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. InterfaceName *string `json:"interfaceName,omitempty"` // IPs lists the network addresses assigned to the device's network interface. // This can include both IPv4 and IPv6 addresses. @@ -41,7 +41,7 @@ type NetworkDeviceDataApplyConfiguration struct { IPs []string `json:"ips,omitempty"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. HardwareAddress *string `json:"hardwareAddress,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresourcemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresourcemapping.go new file mode 100644 index 0000000000..5cdc2c7512 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta1/nodeallocatableresourcemapping.go @@ -0,0 +1,84 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta1 + +import ( + resourcev1beta1 "k8s.io/api/resource/v1beta1" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use +// with apply. +// +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +type NodeAllocatableResourceMappingApplyConfiguration struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + CapacityKey *resourcev1beta1.QualifiedName `json:"capacityKey,omitempty"` + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"` +} + +// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with +// apply. +func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration { + return &NodeAllocatableResourceMappingApplyConfiguration{} +} + +// WithCapacityKey sets the CapacityKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CapacityKey field is set to the value of the last call. +func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1beta1.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration { + b.CapacityKey = &value + return b +} + +// WithAllocationMultiplier sets the AllocationMultiplier field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocationMultiplier field is set to the value of the last call. +func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration { + b.AllocationMultiplier = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/allocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/allocationresult.go index 91db54f92e..540b37ed59 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/allocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/allocationresult.go @@ -36,7 +36,7 @@ type AllocationResultApplyConfiguration struct { // AllocationTimestamp stores the time when the resources were allocated. // This field is not guaranteed to be set, in which case that time is unknown. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gate. AllocationTimestamp *metav1.Time `json:"allocationTimestamp,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go index 861168b9e7..a184590ebe 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/celdeviceselector.go @@ -72,6 +72,14 @@ type CELDeviceSelectorApplyConfiguration struct { // // cel.bind(dra, device.attributes["dra.example.com"], dra.someBool && dra.anotherBool) // + // When the DRAListTypeAttributes feature gate is enabled, + // the includes() helper is available and it can work for both scalar + // and list-type attributes. It was introduced to support smooth migration + // from scalar attributes to list-type attributes while keeping + // CEL expressions simple. For example: + // + // device.attributes["dra.example.com"].models.includes("some-model") + // // The length of the expression must be smaller or equal to 10 Ki. The // cost of evaluating it is also limited based on the estimated number // of logical steps. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go index 607c9f5eb7..b3985b0ca5 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/device.go @@ -19,6 +19,7 @@ limitations under the License. package v1beta2 import ( + corev1 "k8s.io/api/core/v1" resourcev1beta2 "k8s.io/api/resource/v1beta2" v1 "k8s.io/client-go/applyconfigurations/core/v1" ) @@ -74,7 +75,7 @@ type DeviceApplyConfiguration struct { // any device in a ResourceSlice, then the maximum number of // allowed devices per ResourceSlice is 64 instead of 128. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"` // BindsToNode indicates if the usage of an allocation involving this device @@ -82,7 +83,7 @@ type DeviceApplyConfiguration struct { // If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector // to match the node where the allocation was made. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindsToNode *bool `json:"bindsToNode,omitempty"` // BindingConditions defines the conditions for proceeding with binding. @@ -94,7 +95,7 @@ type DeviceApplyConfiguration struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingConditions []string `json:"bindingConditions,omitempty"` // BindingFailureConditions defines the conditions for binding failure. @@ -105,7 +106,7 @@ type DeviceApplyConfiguration struct { // // The conditions must be a valid condition type string. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"` // AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. @@ -113,6 +114,18 @@ type DeviceApplyConfiguration struct { // If AllowMultipleAllocations is set to true, the device can be allocated more than once, // and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not. AllowMultipleAllocations *bool `json:"allowMultipleAllocations,omitempty"` + // NodeAllocatableResourceMappings defines the mapping of node resources + // that are managed by the DRA driver exposing this device. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // In addition to standard requests made through the Pod `spec`, these resources + // can also be requested through claims and allocated by the DRA driver. + // For example, a CPU DRA driver might allocate exclusive CPUs or auxiliary node memory + // dependencies of an accelerator device. + // The keys of this map are the node-allocatable resource names (e.g., "cpu", "memory"). + // Extended resource names are not permitted as keys. + NodeAllocatableResourceMappings map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration `json:"nodeAllocatableResourceMappings,omitempty"` } // DeviceApplyConfiguration constructs a declarative configuration of the Device type for use with @@ -242,3 +255,17 @@ func (b *DeviceApplyConfiguration) WithAllowMultipleAllocations(value bool) *Dev b.AllowMultipleAllocations = &value return b } + +// WithNodeAllocatableResourceMappings puts the entries into the NodeAllocatableResourceMappings field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the NodeAllocatableResourceMappings field, +// overwriting an existing map entries in NodeAllocatableResourceMappings field with the same key. +func (b *DeviceApplyConfiguration) WithNodeAllocatableResourceMappings(entries map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration) *DeviceApplyConfiguration { + if b.NodeAllocatableResourceMappings == nil && len(entries) > 0 { + b.NodeAllocatableResourceMappings = make(map[corev1.ResourceName]NodeAllocatableResourceMappingApplyConfiguration, len(entries)) + } + for k, v := range entries { + b.NodeAllocatableResourceMappings[k] = v + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceattribute.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceattribute.go index 63c7f20510..9929e54121 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceattribute.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceattribute.go @@ -32,6 +32,22 @@ type DeviceAttributeApplyConfiguration struct { // VersionValue is a semantic version according to semver.org spec 2.0.0. // Must not be longer than 64 characters. VersionValue *string `json:"version,omitempty"` + // IntValues is a non-empty list of numbers. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + IntValues []int64 `json:"ints,omitempty"` + // BoolValues is a non-empty list of true/false values. + BoolValues []bool `json:"bools,omitempty"` + // StringValues is a non-empty list of strings. + // Each string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + StringValues []string `json:"strings,omitempty"` + // VersionValues is a non-empty list of semantic versions according to semver.org spec 2.0.0. + // Each version string must not be longer than 64 characters. + // + // This is an alpha field and requires enabling the DRAListTypeAttributes feature gate. + VersionValues []string `json:"versions,omitempty"` } // DeviceAttributeApplyConfiguration constructs a declarative configuration of the DeviceAttribute type for use with @@ -71,3 +87,43 @@ func (b *DeviceAttributeApplyConfiguration) WithVersionValue(value string) *Devi b.VersionValue = &value return b } + +// WithIntValues adds the given value to the IntValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IntValues field. +func (b *DeviceAttributeApplyConfiguration) WithIntValues(values ...int64) *DeviceAttributeApplyConfiguration { + for i := range values { + b.IntValues = append(b.IntValues, values[i]) + } + return b +} + +// WithBoolValues adds the given value to the BoolValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the BoolValues field. +func (b *DeviceAttributeApplyConfiguration) WithBoolValues(values ...bool) *DeviceAttributeApplyConfiguration { + for i := range values { + b.BoolValues = append(b.BoolValues, values[i]) + } + return b +} + +// WithStringValues adds the given value to the StringValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the StringValues field. +func (b *DeviceAttributeApplyConfiguration) WithStringValues(values ...string) *DeviceAttributeApplyConfiguration { + for i := range values { + b.StringValues = append(b.StringValues, values[i]) + } + return b +} + +// WithVersionValues adds the given value to the VersionValues field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the VersionValues field. +func (b *DeviceAttributeApplyConfiguration) WithVersionValues(values ...string) *DeviceAttributeApplyConfiguration { + for i := range values { + b.VersionValues = append(b.VersionValues, values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go index e270c5908b..4ae2eaa29f 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceclassspec.go @@ -41,7 +41,7 @@ type DeviceClassSpecApplyConfiguration struct { // If two classes are created at the same time, then the name of the class // lexicographically sorted first is picked. // - // This is an alpha field. + // This is a beta field. ExtendedResourceName *string `json:"extendedResourceName,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceconstraint.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceconstraint.go index 81a682c82b..05d914af41 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceconstraint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/deviceconstraint.go @@ -48,11 +48,21 @@ type DeviceConstraintApplyConfiguration struct { // its specification, but if one device doesn't, then it also will not be // chosen. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics(i.e., element order and duplicates are ignored): list-valued attributes + // match when the intersection across all devices is non-empty. + // Scalar values are treated as singleton sets for backward compatibility. + // // Must include the domain qualifier. MatchAttribute *resourcev1beta2.FullyQualifiedName `json:"matchAttribute,omitempty"` // DistinctAttribute requires that all devices in question have this // attribute and that its type and value are unique across those devices. // + // When the DRAListTypeAttributes feature gate is enabled, comparison uses + // set semantics (i.e., element order and duplicates are ignored): + // list-valued attributes must be pairwise disjoint across devices. + // Scalar values are treated as singleton sets for backward compatibility. + // // This acts as the inverse of MatchAttribute. // // This constraint is used to avoid allocating multiple requests to the same device diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go index c1fd0266f5..a274e5706c 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicerequestallocationresult.go @@ -66,19 +66,19 @@ type DeviceRequestAllocationResultApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // BindingConditions contains a copy of the BindingConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingConditions []string `json:"bindingConditions,omitempty"` // BindingFailureConditions contains a copy of the BindingFailureConditions // from the corresponding ResourceSlice at the time of allocation. // - // This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus + // This is a beta field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus // feature gates. BindingFailureConditions []string `json:"bindingFailureConditions,omitempty"` // ShareID uniquely identifies an individual allocation share of the device, diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go index 79345cf6c5..d9f4a5cb57 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicesubrequest.go @@ -93,7 +93,7 @@ type DeviceSubRequestApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // Capacity define resource requirements against each capacity. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaint.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaint.go index 8049f52cc0..91abce3bb3 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaint.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaint.go @@ -43,8 +43,17 @@ type DeviceTaintApplyConfiguration struct { // nodes is not valid here. More effects may get added in the future. // Consumers must treat unknown effects like None. Effect *resourcev1beta2.DeviceTaintEffect `json:"effect,omitempty"` - // TimeAdded represents the time at which the taint was added. + // TimeAdded represents the time at which the taint was added or + // (only in a DeviceTaintRule) the effect was modified. // Added automatically during create or update if not set. + // + // In addition, in a DeviceTaintRule a value provided during + // an update gets replaced with the current time if the provided + // value is the same as the old one and the new effect is different. + // Changing the key and/or value while keeping the effect unchanged + // is possible and does not update the time stamp because the eviction + // which uses it is either already started (NoExecute) or + // not started yet (NoEffect, NoSchedule). TimeAdded *v1.Time `json:"timeAdded,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrule.go similarity index 60% rename from vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go rename to vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrule.go index 8a89398f9c..18b2aca188 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrule.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v2beta1 +package v1beta2 import ( - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" + resourcev1beta2 "k8s.io/api/resource/v1beta2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" @@ -27,82 +27,80 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// HorizontalPodAutoscalerApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscaler type for use +// DeviceTaintRuleApplyConfiguration represents a declarative configuration of the DeviceTaintRule type for use // with apply. // -// HorizontalPodAutoscaler is the configuration for a horizontal pod -// autoscaler, which automatically manages the replica count of any resource -// implementing the scale subresource based on the metrics specified. -type HorizontalPodAutoscalerApplyConfiguration struct { +// DeviceTaintRule adds one taint to all devices which match the selector. +// This has the same effect as if the taint was specified directly +// in the ResourceSlice by the DRA driver. +type DeviceTaintRuleApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // metadata is the standard object metadata. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // Standard object metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // spec is the specification for the behaviour of the autoscaler. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - Spec *HorizontalPodAutoscalerSpecApplyConfiguration `json:"spec,omitempty"` - // status is the current information about the autoscaler. - Status *HorizontalPodAutoscalerStatusApplyConfiguration `json:"status,omitempty"` + // Spec specifies the selector and one taint. + // + // Changing the spec automatically increments the metadata.generation number. + Spec *DeviceTaintRuleSpecApplyConfiguration `json:"spec,omitempty"` + // Status provides information about what was requested in the spec. + Status *DeviceTaintRuleStatusApplyConfiguration `json:"status,omitempty"` } -// HorizontalPodAutoscaler constructs a declarative configuration of the HorizontalPodAutoscaler type for use with +// DeviceTaintRule constructs a declarative configuration of the DeviceTaintRule type for use with // apply. -func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApplyConfiguration { - b := &HorizontalPodAutoscalerApplyConfiguration{} +func DeviceTaintRule(name string) *DeviceTaintRuleApplyConfiguration { + b := &DeviceTaintRuleApplyConfiguration{} b.WithName(name) - b.WithNamespace(namespace) - b.WithKind("HorizontalPodAutoscaler") - b.WithAPIVersion("autoscaling/v2beta1") + b.WithKind("DeviceTaintRule") + b.WithAPIVersion("resource.k8s.io/v1beta2") return b } -// ExtractHorizontalPodAutoscalerFrom extracts the applied configuration owned by fieldManager from -// horizontalPodAutoscaler for the specified subresource. Pass an empty string for subresource to extract +// ExtractDeviceTaintRuleFrom extracts the applied configuration owned by fieldManager from +// deviceTaintRule for the specified subresource. Pass an empty string for subresource to extract // the main resource. Common subresources include "status", "scale", etc. -// horizontalPodAutoscaler must be a unmodified HorizontalPodAutoscaler API object that was retrieved from the Kubernetes API. -// ExtractHorizontalPodAutoscalerFrom provides a way to perform a extract/modify-in-place/apply workflow. +// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API. +// ExtractDeviceTaintRuleFrom provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractHorizontalPodAutoscalerFrom(horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, fieldManager string, subresource string) (*HorizontalPodAutoscalerApplyConfiguration, error) { - b := &HorizontalPodAutoscalerApplyConfiguration{} - err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v2beta1.HorizontalPodAutoscaler"), fieldManager, b, subresource) +func ExtractDeviceTaintRuleFrom(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string, subresource string) (*DeviceTaintRuleApplyConfiguration, error) { + b := &DeviceTaintRuleApplyConfiguration{} + err := managedfields.ExtractInto(deviceTaintRule, internal.Parser().Type("io.k8s.api.resource.v1beta2.DeviceTaintRule"), fieldManager, b, subresource) if err != nil { return nil, err } - b.WithName(horizontalPodAutoscaler.Name) - b.WithNamespace(horizontalPodAutoscaler.Namespace) + b.WithName(deviceTaintRule.Name) - b.WithKind("HorizontalPodAutoscaler") - b.WithAPIVersion("autoscaling/v2beta1") + b.WithKind("DeviceTaintRule") + b.WithAPIVersion("resource.k8s.io/v1beta2") return b, nil } -// ExtractHorizontalPodAutoscaler extracts the applied configuration owned by fieldManager from -// horizontalPodAutoscaler. If no managedFields are found in horizontalPodAutoscaler for fieldManager, a -// HorizontalPodAutoscalerApplyConfiguration is returned with only the Name, Namespace (if applicable), +// ExtractDeviceTaintRule extracts the applied configuration owned by fieldManager from +// deviceTaintRule. If no managedFields are found in deviceTaintRule for fieldManager, a +// DeviceTaintRuleApplyConfiguration is returned with only the Name, Namespace (if applicable), // APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. -// horizontalPodAutoscaler must be a unmodified HorizontalPodAutoscaler API object that was retrieved from the Kubernetes API. -// ExtractHorizontalPodAutoscaler provides a way to perform a extract/modify-in-place/apply workflow. +// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API. +// ExtractDeviceTaintRule provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractHorizontalPodAutoscaler(horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { - return ExtractHorizontalPodAutoscalerFrom(horizontalPodAutoscaler, fieldManager, "") +func ExtractDeviceTaintRule(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) { + return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "") } -// ExtractHorizontalPodAutoscalerStatus extracts the applied configuration owned by fieldManager from -// horizontalPodAutoscaler for the status subresource. -func ExtractHorizontalPodAutoscalerStatus(horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { - return ExtractHorizontalPodAutoscalerFrom(horizontalPodAutoscaler, fieldManager, "status") +// ExtractDeviceTaintRuleStatus extracts the applied configuration owned by fieldManager from +// deviceTaintRule for the status subresource. +func ExtractDeviceTaintRuleStatus(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) { + return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "status") } -func (b HorizontalPodAutoscalerApplyConfiguration) IsApplyConfiguration() {} +func (b DeviceTaintRuleApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Kind field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithKind(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithKind(value string) *DeviceTaintRuleApplyConfiguration { b.TypeMetaApplyConfiguration.Kind = &value return b } @@ -110,7 +108,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithKind(value string) *Hori // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the APIVersion field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithAPIVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithAPIVersion(value string) *DeviceTaintRuleApplyConfiguration { b.TypeMetaApplyConfiguration.APIVersion = &value return b } @@ -118,7 +116,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithAPIVersion(value string) // WithName sets the Name field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Name field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithName(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithName(value string) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Name = &value return b @@ -127,7 +125,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithName(value string) *Hori // WithGenerateName sets the GenerateName field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the GenerateName field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithGenerateName(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithGenerateName(value string) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.GenerateName = &value return b @@ -136,7 +134,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithGenerateName(value strin // WithNamespace sets the Namespace field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Namespace field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithNamespace(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithNamespace(value string) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Namespace = &value return b @@ -145,7 +143,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithNamespace(value string) // WithUID sets the UID field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the UID field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithUID(value types.UID) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithUID(value types.UID) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.UID = &value return b @@ -154,7 +152,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithUID(value types.UID) *Ho // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithResourceVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithResourceVersion(value string) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.ResourceVersion = &value return b @@ -163,7 +161,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithResourceVersion(value st // WithGeneration sets the Generation field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Generation field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithGeneration(value int64) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithGeneration(value int64) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Generation = &value return b @@ -172,7 +170,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithGeneration(value int64) // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithCreationTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.CreationTimestamp = &value return b @@ -181,7 +179,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithCreationTimestamp(value // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value return b @@ -190,7 +188,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionTimestamp(value // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value return b @@ -200,7 +198,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionGracePeriodSecon // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Labels field, // overwriting an existing map entries in Labels field with the same key. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithLabels(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithLabels(entries map[string]string) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) @@ -215,7 +213,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithLabels(entries map[strin // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Annotations field, // overwriting an existing map entries in Annotations field with the same key. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithAnnotations(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithAnnotations(entries map[string]string) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) @@ -229,7 +227,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithAnnotations(entries map[ // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { if values[i] == nil { @@ -243,7 +241,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithOwnerReferences(values . // WithFinalizers adds the given value to the Finalizers field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithFinalizers(values ...string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithFinalizers(values ...string) *DeviceTaintRuleApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) @@ -251,7 +249,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithFinalizers(values ...str return b } -func (b *HorizontalPodAutoscalerApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { +func (b *DeviceTaintRuleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { if b.ObjectMetaApplyConfiguration == nil { b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} } @@ -260,7 +258,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) ensureObjectMetaApplyConfigu // WithSpec sets the Spec field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Spec field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithSpec(value *HorizontalPodAutoscalerSpecApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithSpec(value *DeviceTaintRuleSpecApplyConfiguration) *DeviceTaintRuleApplyConfiguration { b.Spec = value return b } @@ -268,29 +266,29 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithSpec(value *HorizontalPo // WithStatus sets the Status field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Status field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithStatus(value *HorizontalPodAutoscalerStatusApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { +func (b *DeviceTaintRuleApplyConfiguration) WithStatus(value *DeviceTaintRuleStatusApplyConfiguration) *DeviceTaintRuleApplyConfiguration { b.Status = value return b } // GetKind retrieves the value of the Kind field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetKind() *string { +func (b *DeviceTaintRuleApplyConfiguration) GetKind() *string { return b.TypeMetaApplyConfiguration.Kind } // GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetAPIVersion() *string { +func (b *DeviceTaintRuleApplyConfiguration) GetAPIVersion() *string { return b.TypeMetaApplyConfiguration.APIVersion } // GetName retrieves the value of the Name field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetName() *string { +func (b *DeviceTaintRuleApplyConfiguration) GetName() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Name } // GetNamespace retrieves the value of the Namespace field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetNamespace() *string { +func (b *DeviceTaintRuleApplyConfiguration) GetNamespace() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Namespace } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulespec.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulespec.go new file mode 100644 index 0000000000..7328296e7c --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulespec.go @@ -0,0 +1,55 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta2 + +// DeviceTaintRuleSpecApplyConfiguration represents a declarative configuration of the DeviceTaintRuleSpec type for use +// with apply. +// +// DeviceTaintRuleSpec specifies the selector and one taint. +type DeviceTaintRuleSpecApplyConfiguration struct { + // DeviceSelector defines which device(s) the taint is applied to. + // All selector criteria must be satisfied for a device to + // match. The empty selector matches all devices. Without + // a selector, no devices are matches. + DeviceSelector *DeviceTaintSelectorApplyConfiguration `json:"deviceSelector,omitempty"` + // The taint that gets applied to matching devices. + Taint *DeviceTaintApplyConfiguration `json:"taint,omitempty"` +} + +// DeviceTaintRuleSpecApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleSpec type for use with +// apply. +func DeviceTaintRuleSpec() *DeviceTaintRuleSpecApplyConfiguration { + return &DeviceTaintRuleSpecApplyConfiguration{} +} + +// WithDeviceSelector sets the DeviceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeviceSelector field is set to the value of the last call. +func (b *DeviceTaintRuleSpecApplyConfiguration) WithDeviceSelector(value *DeviceTaintSelectorApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration { + b.DeviceSelector = value + return b +} + +// WithTaint sets the Taint field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Taint field is set to the value of the last call. +func (b *DeviceTaintRuleSpecApplyConfiguration) WithTaint(value *DeviceTaintApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration { + b.Taint = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulestatus.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulestatus.go new file mode 100644 index 0000000000..7b92c5e8e0 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintrulestatus.go @@ -0,0 +1,70 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// DeviceTaintRuleStatusApplyConfiguration represents a declarative configuration of the DeviceTaintRuleStatus type for use +// with apply. +// +// DeviceTaintRuleStatus provides information about an on-going pod eviction. +type DeviceTaintRuleStatusApplyConfiguration struct { + // Conditions provide information about the state of the DeviceTaintRule + // and the cluster at some point in time, + // in a machine-readable and human-readable format. + // + // The following condition is currently defined as part of this API, more may + // get added: + // - Type: EvictionInProgress + // - Status: True if there are currently pods which need to be evicted, False otherwise + // (includes the effects which don't cause eviction). + // - Reason: not specified, may change + // - Message: includes information about number of pending pods and already evicted pods + // in a human-readable format, updated periodically, may change + // + // For `effect: None`, the condition above gets set once for each change to + // the spec, with the message containing information about what would happen + // if the effect was `NoExecute`. This feedback can be used to decide whether + // changing the effect to `NoExecute` will work as intended. It only gets + // set once to avoid having to constantly update the status. + // + // Must have 8 or fewer entries. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// DeviceTaintRuleStatusApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleStatus type for use with +// apply. +func DeviceTaintRuleStatus() *DeviceTaintRuleStatusApplyConfiguration { + return &DeviceTaintRuleStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *DeviceTaintRuleStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *DeviceTaintRuleStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintselector.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintselector.go new file mode 100644 index 0000000000..1aeaed7204 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/devicetaintselector.go @@ -0,0 +1,76 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta2 + +// DeviceTaintSelectorApplyConfiguration represents a declarative configuration of the DeviceTaintSelector type for use +// with apply. +// +// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. +// The empty selector matches all devices. Without a selector, no devices +// are matched. +type DeviceTaintSelectorApplyConfiguration struct { + // If driver is set, only devices from that driver are selected. + // This fields corresponds to slice.spec.driver. + Driver *string `json:"driver,omitempty"` + // If pool is set, only devices in that pool are selected. + // + // Also setting the driver name may be useful to avoid + // ambiguity when different drivers use the same pool name, + // but this is not required because selecting pools from + // different drivers may also be useful, for example when + // drivers with node-local devices use the node name as + // their pool name. + Pool *string `json:"pool,omitempty"` + // If device is set, only devices with that name are selected. + // This field corresponds to slice.spec.devices[].name. + // + // Setting also driver and pool may be required to avoid ambiguity, + // but is not required. + Device *string `json:"device,omitempty"` +} + +// DeviceTaintSelectorApplyConfiguration constructs a declarative configuration of the DeviceTaintSelector type for use with +// apply. +func DeviceTaintSelector() *DeviceTaintSelectorApplyConfiguration { + return &DeviceTaintSelectorApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *DeviceTaintSelectorApplyConfiguration) WithDriver(value string) *DeviceTaintSelectorApplyConfiguration { + b.Driver = &value + return b +} + +// WithPool sets the Pool field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Pool field is set to the value of the last call. +func (b *DeviceTaintSelectorApplyConfiguration) WithPool(value string) *DeviceTaintSelectorApplyConfiguration { + b.Pool = &value + return b +} + +// WithDevice sets the Device field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Device field is set to the value of the last call. +func (b *DeviceTaintSelectorApplyConfiguration) WithDevice(value string) *DeviceTaintSelectorApplyConfiguration { + b.Device = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go index e4c5d59963..bda1152701 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/exactdevicerequest.go @@ -91,7 +91,7 @@ type ExactDeviceRequestApplyConfiguration struct { // // The maximum number of tolerations is 16. // - // This is an alpha field and requires enabling the DRADeviceTaints + // This is a beta field and requires enabling the DRADeviceTaints // feature gate. Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"` // Capacity define resource requirements against each capacity. diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/networkdevicedata.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/networkdevicedata.go index 9621703268..238e5412f1 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/networkdevicedata.go +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/networkdevicedata.go @@ -29,7 +29,7 @@ type NetworkDeviceDataApplyConfiguration struct { // the allocated device. This might be the name of a physical or virtual // network interface being configured in the pod. // - // Must not be longer than 256 characters. + // Must not be longer than 256 bytes. InterfaceName *string `json:"interfaceName,omitempty"` // IPs lists the network addresses assigned to the device's network interface. // This can include both IPv4 and IPv6 addresses. @@ -39,7 +39,7 @@ type NetworkDeviceDataApplyConfiguration struct { IPs []string `json:"ips,omitempty"` // HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface. // - // Must not be longer than 128 characters. + // Must not be longer than 128 bytes. HardwareAddress *string `json:"hardwareAddress,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresourcemapping.go b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresourcemapping.go new file mode 100644 index 0000000000..b1490b5e75 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/resource/v1beta2/nodeallocatableresourcemapping.go @@ -0,0 +1,84 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1beta2 + +import ( + resourcev1beta2 "k8s.io/api/resource/v1beta2" + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// NodeAllocatableResourceMappingApplyConfiguration represents a declarative configuration of the NodeAllocatableResourceMapping type for use +// with apply. +// +// NodeAllocatableResourceMapping defines the translation between the DRA device/capacity +// units requested to the corresponding quantity of the node allocatable resource. +type NodeAllocatableResourceMappingApplyConfiguration struct { + // CapacityKey references a capacity name defined as a key in the + // `spec.devices[*].capacity` map. When this field is set, the value associated with + // this key in the `status.allocation.devices.results[*].consumedCapacity` map + // (for a specific claim allocation) determines the base quantity for + // the node allocatable resource. If `allocationMultiplier` is also set, it is + // multiplied with the base quantity. + // For example, if `spec.devices[*].capacity` has an entry "dra.example.com/memory": "128Gi", + // and this field is set to "dra.example.com/memory", then for a claim allocation + // that consumes { "dra.example.com/memory": "4Gi" } the base quantity for the + // node allocatable resource mapping will be "4Gi", and `allocationMultiplier` should + // be omitted or set to "1". + CapacityKey *resourcev1beta2.QualifiedName `json:"capacityKey,omitempty"` + // AllocationMultiplier is used as a multiplier for the allocated device count or the allocated capacity in the claim. + // It defaults to 1 if not specified. How the field is used also depends on whether `capacityKey` is set. + // 1. If `capacityKey` is NOT set: `allocationMultiplier` multiplies the device count allocated to the claim. + // a. A DRA driver representing each CPU core as a device would have + // {ResourceName: "cpu", allocationMultiplier: "2"} in its + // `nodeAllocatableResourceMappings`. If 4 devices are allocated to the claim, + // 4 * 2 CPUs would be considered as allocated and subtracted from the node's capacity. + // b. A GPU device that needs additional node memory per GPU allocation would + // have {ResourceName: "memory", allocationMultiplier: "2Gi"}. Each allocated + // GPU device instance of this type will account for 2Gi of memory. + // + // 2. If `capacityKey` IS set: `allocationMultiplier` is multiplied by the amount of that capacity consumed. + // The final node allocatable resource amount is `consumedCapacity[capacityKey]` * `allocationMultiplier`. + // For example, if a Device's capacity "dra.example.com/cores" is consumed, + // and each "core" provides 2 "cpu"s, the mapping would be: + // {ResourceName: "cpu", capacityKey: "dra.example.com/cores", allocationMultiplier: "2"}. + // If a claim consumes 8 "dra.example.com/cores", the CPU footprint is 8 * 2 = 16. + AllocationMultiplier *resource.Quantity `json:"allocationMultiplier,omitempty"` +} + +// NodeAllocatableResourceMappingApplyConfiguration constructs a declarative configuration of the NodeAllocatableResourceMapping type for use with +// apply. +func NodeAllocatableResourceMapping() *NodeAllocatableResourceMappingApplyConfiguration { + return &NodeAllocatableResourceMappingApplyConfiguration{} +} + +// WithCapacityKey sets the CapacityKey field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CapacityKey field is set to the value of the last call. +func (b *NodeAllocatableResourceMappingApplyConfiguration) WithCapacityKey(value resourcev1beta2.QualifiedName) *NodeAllocatableResourceMappingApplyConfiguration { + b.CapacityKey = &value + return b +} + +// WithAllocationMultiplier sets the AllocationMultiplier field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AllocationMultiplier field is set to the value of the last call. +func (b *NodeAllocatableResourceMappingApplyConfiguration) WithAllocationMultiplier(value resource.Quantity) *NodeAllocatableResourceMappingApplyConfiguration { + b.AllocationMultiplier = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/podgroup.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/podgroup.go deleted file mode 100644 index b1ce26179a..0000000000 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/podgroup.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by applyconfiguration-gen. DO NOT EDIT. - -package v1alpha1 - -// PodGroupApplyConfiguration represents a declarative configuration of the PodGroup type for use -// with apply. -// -// PodGroup represents a set of pods with a common scheduling policy. -type PodGroupApplyConfiguration struct { - // Name is a unique identifier for the PodGroup within the Workload. - // It must be a DNS label. This field is immutable. - Name *string `json:"name,omitempty"` - // Policy defines the scheduling policy for this PodGroup. - Policy *PodGroupPolicyApplyConfiguration `json:"policy,omitempty"` -} - -// PodGroupApplyConfiguration constructs a declarative configuration of the PodGroup type for use with -// apply. -func PodGroup() *PodGroupApplyConfiguration { - return &PodGroupApplyConfiguration{} -} - -// WithName sets the Name field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Name field is set to the value of the last call. -func (b *PodGroupApplyConfiguration) WithName(value string) *PodGroupApplyConfiguration { - b.Name = &value - return b -} - -// WithPolicy sets the Policy field in the declarative configuration to the given value -// and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the Policy field is set to the value of the last call. -func (b *PodGroupApplyConfiguration) WithPolicy(value *PodGroupPolicyApplyConfiguration) *PodGroupApplyConfiguration { - b.Policy = value - return b -} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/gangschedulingpolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/gangschedulingpolicy.go similarity index 99% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/gangschedulingpolicy.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/gangschedulingpolicy.go index 6bf41585cf..987a89013b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/gangschedulingpolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/gangschedulingpolicy.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 // GangSchedulingPolicyApplyConfiguration represents a declarative configuration of the GangSchedulingPolicy type for use // with apply. diff --git a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroup.go similarity index 61% rename from vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroup.go index 9a4588bc8c..ee28510624 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroup.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v2beta2 +package v1alpha2 import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" @@ -27,82 +27,82 @@ import ( v1 "k8s.io/client-go/applyconfigurations/meta/v1" ) -// HorizontalPodAutoscalerApplyConfiguration represents a declarative configuration of the HorizontalPodAutoscaler type for use +// PodGroupApplyConfiguration represents a declarative configuration of the PodGroup type for use // with apply. // -// HorizontalPodAutoscaler is the configuration for a horizontal pod -// autoscaler, which automatically manages the replica count of any resource -// implementing the scale subresource based on the metrics specified. -type HorizontalPodAutoscalerApplyConfiguration struct { +// PodGroup represents a runtime instance of pods grouped together. +// PodGroups are created by workload controllers (Job, LWS, JobSet, etc...) from +// Workload.podGroupTemplates. +// PodGroup API enablement is toggled by the GenericWorkload feature gate. +type PodGroupApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` - // metadata is the standard object metadata. + // Standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` - // spec is the specification for the behaviour of the autoscaler. - // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. - Spec *HorizontalPodAutoscalerSpecApplyConfiguration `json:"spec,omitempty"` - // status is the current information about the autoscaler. - Status *HorizontalPodAutoscalerStatusApplyConfiguration `json:"status,omitempty"` + // Spec defines the desired state of the PodGroup. + Spec *PodGroupSpecApplyConfiguration `json:"spec,omitempty"` + // Status represents the current observed state of the PodGroup. + Status *PodGroupStatusApplyConfiguration `json:"status,omitempty"` } -// HorizontalPodAutoscaler constructs a declarative configuration of the HorizontalPodAutoscaler type for use with +// PodGroup constructs a declarative configuration of the PodGroup type for use with // apply. -func HorizontalPodAutoscaler(name, namespace string) *HorizontalPodAutoscalerApplyConfiguration { - b := &HorizontalPodAutoscalerApplyConfiguration{} +func PodGroup(name, namespace string) *PodGroupApplyConfiguration { + b := &PodGroupApplyConfiguration{} b.WithName(name) b.WithNamespace(namespace) - b.WithKind("HorizontalPodAutoscaler") - b.WithAPIVersion("autoscaling/v2beta2") + b.WithKind("PodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1alpha2") return b } -// ExtractHorizontalPodAutoscalerFrom extracts the applied configuration owned by fieldManager from -// horizontalPodAutoscaler for the specified subresource. Pass an empty string for subresource to extract +// ExtractPodGroupFrom extracts the applied configuration owned by fieldManager from +// podGroup for the specified subresource. Pass an empty string for subresource to extract // the main resource. Common subresources include "status", "scale", etc. -// horizontalPodAutoscaler must be a unmodified HorizontalPodAutoscaler API object that was retrieved from the Kubernetes API. -// ExtractHorizontalPodAutoscalerFrom provides a way to perform a extract/modify-in-place/apply workflow. +// podGroup must be a unmodified PodGroup API object that was retrieved from the Kubernetes API. +// ExtractPodGroupFrom provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractHorizontalPodAutoscalerFrom(horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, fieldManager string, subresource string) (*HorizontalPodAutoscalerApplyConfiguration, error) { - b := &HorizontalPodAutoscalerApplyConfiguration{} - err := managedfields.ExtractInto(horizontalPodAutoscaler, internal.Parser().Type("io.k8s.api.autoscaling.v2beta2.HorizontalPodAutoscaler"), fieldManager, b, subresource) +func ExtractPodGroupFrom(podGroup *schedulingv1alpha2.PodGroup, fieldManager string, subresource string) (*PodGroupApplyConfiguration, error) { + b := &PodGroupApplyConfiguration{} + err := managedfields.ExtractInto(podGroup, internal.Parser().Type("io.k8s.api.scheduling.v1alpha2.PodGroup"), fieldManager, b, subresource) if err != nil { return nil, err } - b.WithName(horizontalPodAutoscaler.Name) - b.WithNamespace(horizontalPodAutoscaler.Namespace) + b.WithName(podGroup.Name) + b.WithNamespace(podGroup.Namespace) - b.WithKind("HorizontalPodAutoscaler") - b.WithAPIVersion("autoscaling/v2beta2") + b.WithKind("PodGroup") + b.WithAPIVersion("scheduling.k8s.io/v1alpha2") return b, nil } -// ExtractHorizontalPodAutoscaler extracts the applied configuration owned by fieldManager from -// horizontalPodAutoscaler. If no managedFields are found in horizontalPodAutoscaler for fieldManager, a -// HorizontalPodAutoscalerApplyConfiguration is returned with only the Name, Namespace (if applicable), +// ExtractPodGroup extracts the applied configuration owned by fieldManager from +// podGroup. If no managedFields are found in podGroup for fieldManager, a +// PodGroupApplyConfiguration is returned with only the Name, Namespace (if applicable), // APIVersion and Kind populated. It is possible that no managed fields were found for because other // field managers have taken ownership of all the fields previously owned by fieldManager, or because // the fieldManager never owned fields any fields. -// horizontalPodAutoscaler must be a unmodified HorizontalPodAutoscaler API object that was retrieved from the Kubernetes API. -// ExtractHorizontalPodAutoscaler provides a way to perform a extract/modify-in-place/apply workflow. +// podGroup must be a unmodified PodGroup API object that was retrieved from the Kubernetes API. +// ExtractPodGroup provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractHorizontalPodAutoscaler(horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { - return ExtractHorizontalPodAutoscalerFrom(horizontalPodAutoscaler, fieldManager, "") +func ExtractPodGroup(podGroup *schedulingv1alpha2.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { + return ExtractPodGroupFrom(podGroup, fieldManager, "") } -// ExtractHorizontalPodAutoscalerStatus extracts the applied configuration owned by fieldManager from -// horizontalPodAutoscaler for the status subresource. -func ExtractHorizontalPodAutoscalerStatus(horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, fieldManager string) (*HorizontalPodAutoscalerApplyConfiguration, error) { - return ExtractHorizontalPodAutoscalerFrom(horizontalPodAutoscaler, fieldManager, "status") +// ExtractPodGroupStatus extracts the applied configuration owned by fieldManager from +// podGroup for the status subresource. +func ExtractPodGroupStatus(podGroup *schedulingv1alpha2.PodGroup, fieldManager string) (*PodGroupApplyConfiguration, error) { + return ExtractPodGroupFrom(podGroup, fieldManager, "status") } -func (b HorizontalPodAutoscalerApplyConfiguration) IsApplyConfiguration() {} +func (b PodGroupApplyConfiguration) IsApplyConfiguration() {} // WithKind sets the Kind field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Kind field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithKind(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithKind(value string) *PodGroupApplyConfiguration { b.TypeMetaApplyConfiguration.Kind = &value return b } @@ -110,7 +110,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithKind(value string) *Hori // WithAPIVersion sets the APIVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the APIVersion field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithAPIVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithAPIVersion(value string) *PodGroupApplyConfiguration { b.TypeMetaApplyConfiguration.APIVersion = &value return b } @@ -118,7 +118,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithAPIVersion(value string) // WithName sets the Name field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Name field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithName(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithName(value string) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Name = &value return b @@ -127,7 +127,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithName(value string) *Hori // WithGenerateName sets the GenerateName field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the GenerateName field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithGenerateName(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithGenerateName(value string) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.GenerateName = &value return b @@ -136,7 +136,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithGenerateName(value strin // WithNamespace sets the Namespace field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Namespace field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithNamespace(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithNamespace(value string) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Namespace = &value return b @@ -145,7 +145,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithNamespace(value string) // WithUID sets the UID field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the UID field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithUID(value types.UID) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithUID(value types.UID) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.UID = &value return b @@ -154,7 +154,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithUID(value types.UID) *Ho // WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the ResourceVersion field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithResourceVersion(value string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithResourceVersion(value string) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.ResourceVersion = &value return b @@ -163,7 +163,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithResourceVersion(value st // WithGeneration sets the Generation field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Generation field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithGeneration(value int64) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithGeneration(value int64) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.Generation = &value return b @@ -172,7 +172,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithGeneration(value int64) // WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the CreationTimestamp field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithCreationTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.CreationTimestamp = &value return b @@ -181,7 +181,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithCreationTimestamp(value // WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionTimestamp field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value return b @@ -190,7 +190,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionTimestamp(value // WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value return b @@ -200,7 +200,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithDeletionGracePeriodSecon // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Labels field, // overwriting an existing map entries in Labels field with the same key. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithLabels(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithLabels(entries map[string]string) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) @@ -215,7 +215,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithLabels(entries map[strin // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, the entries provided by each call will be put on the Annotations field, // overwriting an existing map entries in Annotations field with the same key. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithAnnotations(entries map[string]string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithAnnotations(entries map[string]string) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) @@ -229,7 +229,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithAnnotations(entries map[ // WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the OwnerReferences field. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { if values[i] == nil { @@ -243,7 +243,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithOwnerReferences(values . // WithFinalizers adds the given value to the Finalizers field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. // If called multiple times, values provided by each call will be appended to the Finalizers field. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithFinalizers(values ...string) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithFinalizers(values ...string) *PodGroupApplyConfiguration { b.ensureObjectMetaApplyConfigurationExists() for i := range values { b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) @@ -251,7 +251,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithFinalizers(values ...str return b } -func (b *HorizontalPodAutoscalerApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { +func (b *PodGroupApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { if b.ObjectMetaApplyConfiguration == nil { b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} } @@ -260,7 +260,7 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) ensureObjectMetaApplyConfigu // WithSpec sets the Spec field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Spec field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithSpec(value *HorizontalPodAutoscalerSpecApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithSpec(value *PodGroupSpecApplyConfiguration) *PodGroupApplyConfiguration { b.Spec = value return b } @@ -268,29 +268,29 @@ func (b *HorizontalPodAutoscalerApplyConfiguration) WithSpec(value *HorizontalPo // WithStatus sets the Status field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Status field is set to the value of the last call. -func (b *HorizontalPodAutoscalerApplyConfiguration) WithStatus(value *HorizontalPodAutoscalerStatusApplyConfiguration) *HorizontalPodAutoscalerApplyConfiguration { +func (b *PodGroupApplyConfiguration) WithStatus(value *PodGroupStatusApplyConfiguration) *PodGroupApplyConfiguration { b.Status = value return b } // GetKind retrieves the value of the Kind field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetKind() *string { +func (b *PodGroupApplyConfiguration) GetKind() *string { return b.TypeMetaApplyConfiguration.Kind } // GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetAPIVersion() *string { +func (b *PodGroupApplyConfiguration) GetAPIVersion() *string { return b.TypeMetaApplyConfiguration.APIVersion } // GetName retrieves the value of the Name field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetName() *string { +func (b *PodGroupApplyConfiguration) GetName() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Name } // GetNamespace retrieves the value of the Namespace field in the declarative configuration. -func (b *HorizontalPodAutoscalerApplyConfiguration) GetNamespace() *string { +func (b *PodGroupApplyConfiguration) GetNamespace() *string { b.ensureObjectMetaApplyConfigurationExists() return b.ObjectMetaApplyConfiguration.Namespace } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaim.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaim.go new file mode 100644 index 0000000000..a7b21b530b --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaim.go @@ -0,0 +1,89 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +// PodGroupResourceClaimApplyConfiguration represents a declarative configuration of the PodGroupResourceClaim type for use +// with apply. +// +// PodGroupResourceClaim references exactly one ResourceClaim, either directly +// or by naming a ResourceClaimTemplate which is then turned into a ResourceClaim +// for the PodGroup. +// +// It adds a name to it that uniquely identifies the ResourceClaim inside the PodGroup. +// Pods that need access to the ResourceClaim define a matching reference in its +// own Spec.ResourceClaims. The Pod's claim must match all fields of the +// PodGroup's claim exactly. +type PodGroupResourceClaimApplyConfiguration struct { + // Name uniquely identifies this resource claim inside the PodGroup. + // This must be a DNS_LABEL. + Name *string `json:"name,omitempty"` + // ResourceClaimName is the name of a ResourceClaim object in the same + // namespace as this PodGroup. The ResourceClaim will be reserved for the + // PodGroup instead of its individual pods. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + ResourceClaimName *string `json:"resourceClaimName,omitempty"` + // ResourceClaimTemplateName is the name of a ResourceClaimTemplate + // object in the same namespace as this PodGroup. + // + // The template will be used to create a new ResourceClaim, which will + // be bound to this PodGroup. When this PodGroup is deleted, the ResourceClaim + // will also be deleted. The PodGroup name and resource name, along with a + // generated component, will be used to form a unique name for the + // ResourceClaim, which will be recorded in podgroup.status.resourceClaimStatuses. + // + // This field is immutable and no changes will be made to the + // corresponding ResourceClaim by the control plane after creating the + // ResourceClaim. + // + // Exactly one of ResourceClaimName and ResourceClaimTemplateName must + // be set. + ResourceClaimTemplateName *string `json:"resourceClaimTemplateName,omitempty"` +} + +// PodGroupResourceClaimApplyConfiguration constructs a declarative configuration of the PodGroupResourceClaim type for use with +// apply. +func PodGroupResourceClaim() *PodGroupResourceClaimApplyConfiguration { + return &PodGroupResourceClaimApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodGroupResourceClaimApplyConfiguration) WithName(value string) *PodGroupResourceClaimApplyConfiguration { + b.Name = &value + return b +} + +// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceClaimName field is set to the value of the last call. +func (b *PodGroupResourceClaimApplyConfiguration) WithResourceClaimName(value string) *PodGroupResourceClaimApplyConfiguration { + b.ResourceClaimName = &value + return b +} + +// WithResourceClaimTemplateName sets the ResourceClaimTemplateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceClaimTemplateName field is set to the value of the last call. +func (b *PodGroupResourceClaimApplyConfiguration) WithResourceClaimTemplateName(value string) *PodGroupResourceClaimApplyConfiguration { + b.ResourceClaimTemplateName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaimstatus.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaimstatus.go new file mode 100644 index 0000000000..5f8498b13e --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupresourceclaimstatus.go @@ -0,0 +1,59 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +// PodGroupResourceClaimStatusApplyConfiguration represents a declarative configuration of the PodGroupResourceClaimStatus type for use +// with apply. +// +// PodGroupResourceClaimStatus is stored in the PodGroupStatus for each +// PodGroupResourceClaim which references a ResourceClaimTemplate. It stores the +// generated name for the corresponding ResourceClaim. +type PodGroupResourceClaimStatusApplyConfiguration struct { + // Name uniquely identifies this resource claim inside the PodGroup. This + // must match the name of an entry in podgroup.spec.resourceClaims, which + // implies that the string must be a DNS_LABEL. + Name *string `json:"name,omitempty"` + // ResourceClaimName is the name of the ResourceClaim that was generated for + // the PodGroup in the namespace of the PodGroup. If this is unset, then + // generating a ResourceClaim was not necessary. The + // podgroup.spec.resourceClaims entry can be ignored in this case. + ResourceClaimName *string `json:"resourceClaimName,omitempty"` +} + +// PodGroupResourceClaimStatusApplyConfiguration constructs a declarative configuration of the PodGroupResourceClaimStatus type for use with +// apply. +func PodGroupResourceClaimStatus() *PodGroupResourceClaimStatusApplyConfiguration { + return &PodGroupResourceClaimStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodGroupResourceClaimStatusApplyConfiguration) WithName(value string) *PodGroupResourceClaimStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithResourceClaimName sets the ResourceClaimName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceClaimName field is set to the value of the last call. +func (b *PodGroupResourceClaimStatusApplyConfiguration) WithResourceClaimName(value string) *PodGroupResourceClaimStatusApplyConfiguration { + b.ResourceClaimName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingconstraints.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingconstraints.go new file mode 100644 index 0000000000..eda72ea50e --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingconstraints.go @@ -0,0 +1,48 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +// PodGroupSchedulingConstraintsApplyConfiguration represents a declarative configuration of the PodGroupSchedulingConstraints type for use +// with apply. +// +// PodGroupSchedulingConstraints defines scheduling constraints (e.g. topology) for a PodGroup. +type PodGroupSchedulingConstraintsApplyConfiguration struct { + // Topology defines the topology constraints for the pod group. + // Currently only a single topology constraint can be specified. This may change in the future. + Topology []TopologyConstraintApplyConfiguration `json:"topology,omitempty"` +} + +// PodGroupSchedulingConstraintsApplyConfiguration constructs a declarative configuration of the PodGroupSchedulingConstraints type for use with +// apply. +func PodGroupSchedulingConstraints() *PodGroupSchedulingConstraintsApplyConfiguration { + return &PodGroupSchedulingConstraintsApplyConfiguration{} +} + +// WithTopology adds the given value to the Topology field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Topology field. +func (b *PodGroupSchedulingConstraintsApplyConfiguration) WithTopology(values ...*TopologyConstraintApplyConfiguration) *PodGroupSchedulingConstraintsApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTopology") + } + b.Topology = append(b.Topology, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/podgrouppolicy.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingpolicy.go similarity index 60% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/podgrouppolicy.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingpolicy.go index d73c5e4409..02be5f27eb 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/podgrouppolicy.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupschedulingpolicy.go @@ -16,35 +16,36 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 import ( - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" ) -// PodGroupPolicyApplyConfiguration represents a declarative configuration of the PodGroupPolicy type for use +// PodGroupSchedulingPolicyApplyConfiguration represents a declarative configuration of the PodGroupSchedulingPolicy type for use // with apply. // -// PodGroupPolicy defines the scheduling configuration for a PodGroup. -type PodGroupPolicyApplyConfiguration struct { +// PodGroupSchedulingPolicy defines the scheduling configuration for a PodGroup. +// Exactly one policy must be set. +type PodGroupSchedulingPolicyApplyConfiguration struct { // Basic specifies that the pods in this group should be scheduled using // standard Kubernetes scheduling behavior. - Basic *schedulingv1alpha1.BasicSchedulingPolicy `json:"basic,omitempty"` + Basic *schedulingv1alpha2.BasicSchedulingPolicy `json:"basic,omitempty"` // Gang specifies that the pods in this group should be scheduled using // all-or-nothing semantics. Gang *GangSchedulingPolicyApplyConfiguration `json:"gang,omitempty"` } -// PodGroupPolicyApplyConfiguration constructs a declarative configuration of the PodGroupPolicy type for use with +// PodGroupSchedulingPolicyApplyConfiguration constructs a declarative configuration of the PodGroupSchedulingPolicy type for use with // apply. -func PodGroupPolicy() *PodGroupPolicyApplyConfiguration { - return &PodGroupPolicyApplyConfiguration{} +func PodGroupSchedulingPolicy() *PodGroupSchedulingPolicyApplyConfiguration { + return &PodGroupSchedulingPolicyApplyConfiguration{} } // WithBasic sets the Basic field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Basic field is set to the value of the last call. -func (b *PodGroupPolicyApplyConfiguration) WithBasic(value schedulingv1alpha1.BasicSchedulingPolicy) *PodGroupPolicyApplyConfiguration { +func (b *PodGroupSchedulingPolicyApplyConfiguration) WithBasic(value schedulingv1alpha2.BasicSchedulingPolicy) *PodGroupSchedulingPolicyApplyConfiguration { b.Basic = &value return b } @@ -52,7 +53,7 @@ func (b *PodGroupPolicyApplyConfiguration) WithBasic(value schedulingv1alpha1.Ba // WithGang sets the Gang field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. // If called multiple times, the Gang field is set to the value of the last call. -func (b *PodGroupPolicyApplyConfiguration) WithGang(value *GangSchedulingPolicyApplyConfiguration) *PodGroupPolicyApplyConfiguration { +func (b *PodGroupSchedulingPolicyApplyConfiguration) WithGang(value *GangSchedulingPolicyApplyConfiguration) *PodGroupSchedulingPolicyApplyConfiguration { b.Gang = value return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupspec.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupspec.go new file mode 100644 index 0000000000..76538c6221 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupspec.go @@ -0,0 +1,145 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" +) + +// PodGroupSpecApplyConfiguration represents a declarative configuration of the PodGroupSpec type for use +// with apply. +// +// PodGroupSpec defines the desired state of a PodGroup. +type PodGroupSpecApplyConfiguration struct { + // PodGroupTemplateRef references an optional PodGroup template within other object + // (e.g. Workload) that was used to create the PodGroup. This field is immutable. + PodGroupTemplateRef *PodGroupTemplateReferenceApplyConfiguration `json:"podGroupTemplateRef,omitempty"` + // SchedulingPolicy defines the scheduling policy for this instance of the PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroup. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // This field is immutable. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is an alpha-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` + // DisruptionMode defines the mode in which a given PodGroup can be disrupted. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // One of Pod, PodGroup. Defaults to Pod if unset. + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"` + // PriorityClassName defines the priority that should be considered when scheduling this pod group. + // Controllers are expected to fill this field by copying it from a PodGroupTemplate. + // Otherwise, it is validated and resolved similarly to the PriorityClassName on PodGroupTemplate + // (i.e. if no priority class is specified, admission control can set this to the global default + // priority class if it exists. Otherwise, the pod group's priority will be zero). + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // Priority is the value of priority of this pod group. Various system components + // use this field to find the priority of the pod group. When Priority Admission + // Controller is enabled, it prevents users from setting this field. The admission + // controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is immutable. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + Priority *int32 `json:"priority,omitempty"` +} + +// PodGroupSpecApplyConfiguration constructs a declarative configuration of the PodGroupSpec type for use with +// apply. +func PodGroupSpec() *PodGroupSpecApplyConfiguration { + return &PodGroupSpecApplyConfiguration{} +} + +// WithPodGroupTemplateRef sets the PodGroupTemplateRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodGroupTemplateRef field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithPodGroupTemplateRef(value *PodGroupTemplateReferenceApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.PodGroupTemplateRef = value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SchedulingPolicy field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithSchedulingPolicy(value *PodGroupSchedulingPolicyApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SchedulingConstraints field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithSchedulingConstraints(value *PodGroupSchedulingConstraintsApplyConfiguration) *PodGroupSpecApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithResourceClaims adds the given value to the ResourceClaims field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResourceClaims field. +func (b *PodGroupSpecApplyConfiguration) WithResourceClaims(values ...*PodGroupResourceClaimApplyConfiguration) *PodGroupSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaims") + } + b.ResourceClaims = append(b.ResourceClaims, *values[i]) + } + return b +} + +// WithDisruptionMode sets the DisruptionMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DisruptionMode field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupSpecApplyConfiguration { + b.DisruptionMode = &value + return b +} + +// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PriorityClassName field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithPriorityClassName(value string) *PodGroupSpecApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *PodGroupSpecApplyConfiguration) WithPriority(value int32) *PodGroupSpecApplyConfiguration { + b.Priority = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupstatus.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupstatus.go new file mode 100644 index 0000000000..c8c4b30da9 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgroupstatus.go @@ -0,0 +1,81 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// PodGroupStatusApplyConfiguration represents a declarative configuration of the PodGroupStatus type for use +// with apply. +// +// PodGroupStatus represents information about the status of a pod group. +type PodGroupStatusApplyConfiguration struct { + // Conditions represent the latest observations of the PodGroup's state. + // + // Known condition types: + // - "PodGroupScheduled": Indicates whether the scheduling requirement has been satisfied. + // - "DisruptionTarget": Indicates whether the PodGroup is about to be terminated + // due to disruption such as preemption. + // + // Known reasons for the PodGroupScheduled condition: + // - "Unschedulable": The PodGroup cannot be scheduled due to resource constraints, + // affinity/anti-affinity rules, or insufficient capacity for the gang. + // - "SchedulerError": The PodGroup cannot be scheduled due to some internal error + // that happened during scheduling, for example due to nodeAffinity parsing errors. + // + // Known reasons for the DisruptionTarget condition: + // - "PreemptionByScheduler": The PodGroup was preempted by the scheduler to make room for + // higher-priority PodGroups or Pods. + Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"` + // Status of resource claims. + ResourceClaimStatuses []PodGroupResourceClaimStatusApplyConfiguration `json:"resourceClaimStatuses,omitempty"` +} + +// PodGroupStatusApplyConfiguration constructs a declarative configuration of the PodGroupStatus type for use with +// apply. +func PodGroupStatus() *PodGroupStatusApplyConfiguration { + return &PodGroupStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *PodGroupStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *PodGroupStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithResourceClaimStatuses adds the given value to the ResourceClaimStatuses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResourceClaimStatuses field. +func (b *PodGroupStatusApplyConfiguration) WithResourceClaimStatuses(values ...*PodGroupResourceClaimStatusApplyConfiguration) *PodGroupStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaimStatuses") + } + b.ResourceClaimStatuses = append(b.ResourceClaimStatuses, *values[i]) + } + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplate.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplate.go new file mode 100644 index 0000000000..695caf2997 --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplate.go @@ -0,0 +1,136 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" +) + +// PodGroupTemplateApplyConfiguration represents a declarative configuration of the PodGroupTemplate type for use +// with apply. +// +// PodGroupTemplate represents a template for a set of pods with a scheduling policy. +type PodGroupTemplateApplyConfiguration struct { + // Name is a unique identifier for the PodGroupTemplate within the Workload. + // It must be a DNS label. This field is immutable. + Name *string `json:"name,omitempty"` + // SchedulingPolicy defines the scheduling policy for this PodGroupTemplate. + SchedulingPolicy *PodGroupSchedulingPolicyApplyConfiguration `json:"schedulingPolicy,omitempty"` + // SchedulingConstraints defines optional scheduling constraints (e.g. topology) for this PodGroupTemplate. + // This field is only available when the TopologyAwareWorkloadScheduling feature gate is enabled. + SchedulingConstraints *PodGroupSchedulingConstraintsApplyConfiguration `json:"schedulingConstraints,omitempty"` + // ResourceClaims defines which ResourceClaims may be shared among Pods in + // the group. Pods consume the devices allocated to a PodGroup's claim by + // defining a claim in its own Spec.ResourceClaims that matches the + // PodGroup's claim exactly. The claim must have the same name and refer to + // the same ResourceClaim or ResourceClaimTemplate. + // + // This is an alpha-level field and requires that the + // DRAWorkloadResourceClaims feature gate is enabled. + // + // This field is immutable. + ResourceClaims []PodGroupResourceClaimApplyConfiguration `json:"resourceClaims,omitempty"` + // DisruptionMode defines the mode in which a given PodGroup can be disrupted. + // One of Pod, PodGroup. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + DisruptionMode *schedulingv1alpha2.DisruptionMode `json:"disruptionMode,omitempty"` + // PriorityClassName indicates the priority that should be considered when scheduling + // a pod group created from this template. If no priority class is specified, admission + // control can set this to the global default priority class if it exists. Otherwise, + // pod groups created from this template will have the priority set to zero. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + PriorityClassName *string `json:"priorityClassName,omitempty"` + // Priority is the value of priority of pod groups created from this template. Various + // system components use this field to find the priority of the pod group. When + // Priority Admission Controller is enabled, it prevents users from setting this field. + // The admission controller populates this field from PriorityClassName. + // The higher the value, the higher the priority. + // This field is available only when the WorkloadAwarePreemption feature gate + // is enabled. + Priority *int32 `json:"priority,omitempty"` +} + +// PodGroupTemplateApplyConfiguration constructs a declarative configuration of the PodGroupTemplate type for use with +// apply. +func PodGroupTemplate() *PodGroupTemplateApplyConfiguration { + return &PodGroupTemplateApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithName(value string) *PodGroupTemplateApplyConfiguration { + b.Name = &value + return b +} + +// WithSchedulingPolicy sets the SchedulingPolicy field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SchedulingPolicy field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithSchedulingPolicy(value *PodGroupSchedulingPolicyApplyConfiguration) *PodGroupTemplateApplyConfiguration { + b.SchedulingPolicy = value + return b +} + +// WithSchedulingConstraints sets the SchedulingConstraints field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SchedulingConstraints field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithSchedulingConstraints(value *PodGroupSchedulingConstraintsApplyConfiguration) *PodGroupTemplateApplyConfiguration { + b.SchedulingConstraints = value + return b +} + +// WithResourceClaims adds the given value to the ResourceClaims field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the ResourceClaims field. +func (b *PodGroupTemplateApplyConfiguration) WithResourceClaims(values ...*PodGroupResourceClaimApplyConfiguration) *PodGroupTemplateApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithResourceClaims") + } + b.ResourceClaims = append(b.ResourceClaims, *values[i]) + } + return b +} + +// WithDisruptionMode sets the DisruptionMode field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DisruptionMode field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithDisruptionMode(value schedulingv1alpha2.DisruptionMode) *PodGroupTemplateApplyConfiguration { + b.DisruptionMode = &value + return b +} + +// WithPriorityClassName sets the PriorityClassName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PriorityClassName field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithPriorityClassName(value string) *PodGroupTemplateApplyConfiguration { + b.PriorityClassName = &value + return b +} + +// WithPriority sets the Priority field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Priority field is set to the value of the last call. +func (b *PodGroupTemplateApplyConfiguration) WithPriority(value int32) *PodGroupTemplateApplyConfiguration { + b.Priority = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplatereference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplatereference.go new file mode 100644 index 0000000000..f8b1f61ffc --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/podgrouptemplatereference.go @@ -0,0 +1,44 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +// PodGroupTemplateReferenceApplyConfiguration represents a declarative configuration of the PodGroupTemplateReference type for use +// with apply. +// +// PodGroupTemplateReference references a PodGroup template defined in some object (e.g. Workload). +// Exactly one reference must be set. +type PodGroupTemplateReferenceApplyConfiguration struct { + // Workload references the PodGroupTemplate within the Workload object that was used to create + // the PodGroup. + Workload *WorkloadPodGroupTemplateReferenceApplyConfiguration `json:"workload,omitempty"` +} + +// PodGroupTemplateReferenceApplyConfiguration constructs a declarative configuration of the PodGroupTemplateReference type for use with +// apply. +func PodGroupTemplateReference() *PodGroupTemplateReferenceApplyConfiguration { + return &PodGroupTemplateReferenceApplyConfiguration{} +} + +// WithWorkload sets the Workload field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Workload field is set to the value of the last call. +func (b *PodGroupTemplateReferenceApplyConfiguration) WithWorkload(value *WorkloadPodGroupTemplateReferenceApplyConfiguration) *PodGroupTemplateReferenceApplyConfiguration { + b.Workload = value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/topologyconstraint.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/topologyconstraint.go new file mode 100644 index 0000000000..92727eb2bb --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/topologyconstraint.go @@ -0,0 +1,45 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +// TopologyConstraintApplyConfiguration represents a declarative configuration of the TopologyConstraint type for use +// with apply. +// +// TopologyConstraint defines a topology constraint for a PodGroup. +type TopologyConstraintApplyConfiguration struct { + // Key specifies the key of the node label representing the topology domain. + // All pods within the PodGroup must be colocated within the same domain instance. + // Different PodGroups can land on different domain instances even if they derive from the same PodGroupTemplate. + // Examples: "topology.kubernetes.io/rack" + Key *string `json:"key,omitempty"` +} + +// TopologyConstraintApplyConfiguration constructs a declarative configuration of the TopologyConstraint type for use with +// apply. +func TopologyConstraint() *TopologyConstraintApplyConfiguration { + return &TopologyConstraintApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *TopologyConstraintApplyConfiguration) WithKey(value string) *TopologyConstraintApplyConfiguration { + b.Key = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/typedlocalobjectreference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/typedlocalobjectreference.go similarity index 99% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/typedlocalobjectreference.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/typedlocalobjectreference.go index 73c11c884e..cfbbc48e07 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/typedlocalobjectreference.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/typedlocalobjectreference.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 // TypedLocalObjectReferenceApplyConfiguration represents a declarative configuration of the TypedLocalObjectReference type for use // with apply. diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/workload.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workload.go similarity index 95% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/workload.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workload.go index 6530899aee..787095d238 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/workload.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workload.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 import ( - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" managedfields "k8s.io/apimachinery/pkg/util/managedfields" @@ -31,12 +31,13 @@ import ( // with apply. // // Workload allows for expressing scheduling constraints that should be used -// when managing lifecycle of workloads from scheduling perspective, +// when managing the lifecycle of workloads from the scheduling perspective, // including scheduling, preemption, eviction and other phases. +// Workload API enablement is toggled by the GenericWorkload feature gate. type WorkloadApplyConfiguration struct { v1.TypeMetaApplyConfiguration `json:",inline"` // Standard object's metadata. - // Name must be a DNS subdomain. + // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` // Spec defines the desired behavior of a Workload. Spec *WorkloadSpecApplyConfiguration `json:"spec,omitempty"` @@ -49,7 +50,7 @@ func Workload(name, namespace string) *WorkloadApplyConfiguration { b.WithName(name) b.WithNamespace(namespace) b.WithKind("Workload") - b.WithAPIVersion("scheduling.k8s.io/v1alpha1") + b.WithAPIVersion("scheduling.k8s.io/v1alpha2") return b } @@ -60,9 +61,9 @@ func Workload(name, namespace string) *WorkloadApplyConfiguration { // ExtractWorkloadFrom provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractWorkloadFrom(workload *schedulingv1alpha1.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) { +func ExtractWorkloadFrom(workload *schedulingv1alpha2.Workload, fieldManager string, subresource string) (*WorkloadApplyConfiguration, error) { b := &WorkloadApplyConfiguration{} - err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1alpha1.Workload"), fieldManager, b, subresource) + err := managedfields.ExtractInto(workload, internal.Parser().Type("io.k8s.api.scheduling.v1alpha2.Workload"), fieldManager, b, subresource) if err != nil { return nil, err } @@ -70,7 +71,7 @@ func ExtractWorkloadFrom(workload *schedulingv1alpha1.Workload, fieldManager str b.WithNamespace(workload.Namespace) b.WithKind("Workload") - b.WithAPIVersion("scheduling.k8s.io/v1alpha1") + b.WithAPIVersion("scheduling.k8s.io/v1alpha2") return b, nil } @@ -84,7 +85,7 @@ func ExtractWorkloadFrom(workload *schedulingv1alpha1.Workload, fieldManager str // ExtractWorkload provides a way to perform a extract/modify-in-place/apply workflow. // Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously // applied if another fieldManager has updated or force applied any of the previously applied fields. -func ExtractWorkload(workload *schedulingv1alpha1.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) { +func ExtractWorkload(workload *schedulingv1alpha2.Workload, fieldManager string) (*WorkloadApplyConfiguration, error) { return ExtractWorkloadFrom(workload, fieldManager, "") } diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadpodgrouptemplatereference.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadpodgrouptemplatereference.go new file mode 100644 index 0000000000..ff3ab06c8d --- /dev/null +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadpodgrouptemplatereference.go @@ -0,0 +1,52 @@ +/* +Copyright 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. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha2 + +// WorkloadPodGroupTemplateReferenceApplyConfiguration represents a declarative configuration of the WorkloadPodGroupTemplateReference type for use +// with apply. +// +// WorkloadPodGroupTemplateReference references the PodGroupTemplate within the Workload object. +type WorkloadPodGroupTemplateReferenceApplyConfiguration struct { + // WorkloadName defines the name of the Workload object. + WorkloadName *string `json:"workloadName,omitempty"` + // PodGroupTemplateName defines the PodGroupTemplate name within the Workload object. + PodGroupTemplateName *string `json:"podGroupTemplateName,omitempty"` +} + +// WorkloadPodGroupTemplateReferenceApplyConfiguration constructs a declarative configuration of the WorkloadPodGroupTemplateReference type for use with +// apply. +func WorkloadPodGroupTemplateReference() *WorkloadPodGroupTemplateReferenceApplyConfiguration { + return &WorkloadPodGroupTemplateReferenceApplyConfiguration{} +} + +// WithWorkloadName sets the WorkloadName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the WorkloadName field is set to the value of the last call. +func (b *WorkloadPodGroupTemplateReferenceApplyConfiguration) WithWorkloadName(value string) *WorkloadPodGroupTemplateReferenceApplyConfiguration { + b.WorkloadName = &value + return b +} + +// WithPodGroupTemplateName sets the PodGroupTemplateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PodGroupTemplateName field is set to the value of the last call. +func (b *WorkloadPodGroupTemplateReferenceApplyConfiguration) WithPodGroupTemplateName(value string) *WorkloadPodGroupTemplateReferenceApplyConfiguration { + b.PodGroupTemplateName = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/workloadspec.go b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadspec.go similarity index 75% rename from vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/workloadspec.go rename to vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadspec.go index 1ceb9210db..33eb8a5c09 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/workloadspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha2/workloadspec.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by applyconfiguration-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 // WorkloadSpecApplyConfiguration represents a declarative configuration of the WorkloadSpec type for use // with apply. @@ -26,11 +26,11 @@ type WorkloadSpecApplyConfiguration struct { // ControllerRef is an optional reference to the controlling object, such as a // Deployment or Job. This field is intended for use by tools like CLIs // to provide a link back to the original workload definition. - // When set, it cannot be changed. + // This field is immutable. ControllerRef *TypedLocalObjectReferenceApplyConfiguration `json:"controllerRef,omitempty"` - // PodGroups is the list of pod groups that make up the Workload. - // The maximum number of pod groups is 8. This field is immutable. - PodGroups []PodGroupApplyConfiguration `json:"podGroups,omitempty"` + // PodGroupTemplates is the list of templates that make up the Workload. + // The maximum number of templates is 8. This field is immutable. + PodGroupTemplates []PodGroupTemplateApplyConfiguration `json:"podGroupTemplates,omitempty"` } // WorkloadSpecApplyConfiguration constructs a declarative configuration of the WorkloadSpec type for use with @@ -47,15 +47,15 @@ func (b *WorkloadSpecApplyConfiguration) WithControllerRef(value *TypedLocalObje return b } -// WithPodGroups adds the given value to the PodGroups field in the declarative configuration +// WithPodGroupTemplates adds the given value to the PodGroupTemplates field in the declarative configuration // and returns the receiver, so that objects can be build by chaining "With" function invocations. -// If called multiple times, values provided by each call will be appended to the PodGroups field. -func (b *WorkloadSpecApplyConfiguration) WithPodGroups(values ...*PodGroupApplyConfiguration) *WorkloadSpecApplyConfiguration { +// If called multiple times, values provided by each call will be appended to the PodGroupTemplates field. +func (b *WorkloadSpecApplyConfiguration) WithPodGroupTemplates(values ...*PodGroupTemplateApplyConfiguration) *WorkloadSpecApplyConfiguration { for i := range values { if values[i] == nil { - panic("nil value passed to WithPodGroups") + panic("nil value passed to WithPodGroupTemplates") } - b.PodGroups = append(b.PodGroups, *values[i]) + b.PodGroupTemplates = append(b.PodGroupTemplates, *values[i]) } return b } diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go index 653329ecec..4a715c141b 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go @@ -154,7 +154,7 @@ type CSIDriverSpecApplyConfiguration struct { // occur (neither periodic nor upon detecting capacity-related failures), and the // allocatable.count remains static. The minimum allowed value for this field is 10 seconds. // - // This is a beta feature and requires the MutableCSINodeAllocatableCount feature gate to be enabled. + // This feature requires the MutableCSINodeAllocatableCount feature gate to be enabled. // // This field is mutable. NodeAllocatableUpdatePeriodSeconds *int64 `json:"nodeAllocatableUpdatePeriodSeconds,omitempty"` @@ -178,6 +178,24 @@ type CSIDriverSpecApplyConfiguration struct { // // Default behavior if unset is to pass tokens in the VolumeContext field. ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty"` + // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // scheduling if the CSI driver on the node is missing. + // + // Enabling this option will prevent the scheduler (or any other + // component which embeds default scheduler such as cluster-autoscaler) from + // scheduling pods to nodes where CSI driver is not installed. + // + // For components(such as cluster-autoscaler) that embed the scheduler and run + // pod placement simulations using scheduler plugins, they MUST be aware of + // CSI driver registration information via CSINode object. They must create simulated + // CSINode objects in addition to Node objects during scheduling simulation, otherwise + // if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any + // newly created node may be rejected by the scheduler because of missing CSI driver + // information from the node. + // + // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // Default is "false". + PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty"` } // CSIDriverSpecApplyConfiguration constructs a declarative configuration of the CSIDriverSpec type for use with @@ -272,3 +290,11 @@ func (b *CSIDriverSpecApplyConfiguration) WithServiceAccountTokenInSecrets(value b.ServiceAccountTokenInSecrets = &value return b } + +// WithPreventPodSchedulingIfMissing sets the PreventPodSchedulingIfMissing field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreventPodSchedulingIfMissing field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithPreventPodSchedulingIfMissing(value bool) *CSIDriverSpecApplyConfiguration { + b.PreventPodSchedulingIfMissing = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeerror.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeerror.go index b1a572f4eb..607a39ea11 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeerror.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeerror.go @@ -35,7 +35,7 @@ type VolumeErrorApplyConfiguration struct { Message *string `json:"message,omitempty"` // errorCode is a numeric gRPC code representing the error encountered during Attach or Detach operations. // - // This is an optional, beta field that requires the MutableCSINodeAllocatableCount feature gate being enabled to be set. + // This field requires the MutableCSINodeAllocatableCount feature gate being enabled to be set. ErrorCode *int32 `json:"errorCode,omitempty"` } diff --git a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go index 323065d2a4..cec76d9fd8 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go +++ b/vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go @@ -178,6 +178,24 @@ type CSIDriverSpecApplyConfiguration struct { // // Default behavior if unset is to pass tokens in the VolumeContext field. ServiceAccountTokenInSecrets *bool `json:"serviceAccountTokenInSecrets,omitempty"` + // PreventPodSchedulingIfMissing indicates that the CSI driver wants to prevent pod + // scheduling if the CSI driver on the node is missing. + // + // Enabling this option will prevent the scheduler (or any other + // component which embeds default scheduler such as cluster-autoscaler) from + // scheduling pods to nodes where CSI driver is not installed. + // + // For components(such as cluster-autoscaler) that embed the scheduler and run + // pod placement simulations using scheduler plugins, they MUST be aware of + // CSI driver registration information via CSINode object. They must create simulated + // CSINode objects in addition to Node objects during scheduling simulation, otherwise + // if PreventPodSchedulingIfMissing is enabled globally for CSIDriver object, any + // newly created node may be rejected by the scheduler because of missing CSI driver + // information from the node. + // + // This is an alpha feature and requires the VolumeLimitScaling feature gate to be enabled. + // Default is "false". + PreventPodSchedulingIfMissing *bool `json:"preventPodSchedulingIfMissing,omitempty"` } // CSIDriverSpecApplyConfiguration constructs a declarative configuration of the CSIDriverSpec type for use with @@ -272,3 +290,11 @@ func (b *CSIDriverSpecApplyConfiguration) WithServiceAccountTokenInSecrets(value b.ServiceAccountTokenInSecrets = &value return b } + +// WithPreventPodSchedulingIfMissing sets the PreventPodSchedulingIfMissing field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PreventPodSchedulingIfMissing field is set to the value of the last call. +func (b *CSIDriverSpecApplyConfiguration) WithPreventPodSchedulingIfMissing(value bool) *CSIDriverSpecApplyConfiguration { + b.PreventPodSchedulingIfMissing = &value + return b +} diff --git a/vendor/k8s.io/client-go/applyconfigurations/utils.go b/vendor/k8s.io/client-go/applyconfigurations/utils.go index ef6f16e83b..355051fc8d 100644 --- a/vendor/k8s.io/client-go/applyconfigurations/utils.go +++ b/vendor/k8s.io/client-go/applyconfigurations/utils.go @@ -28,8 +28,6 @@ import ( v1beta2 "k8s.io/api/apps/v1beta2" autoscalingv1 "k8s.io/api/autoscaling/v1" v2 "k8s.io/api/autoscaling/v2" - v2beta1 "k8s.io/api/autoscaling/v2beta1" - v2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1" certificatesv1 "k8s.io/api/certificates/v1" @@ -64,7 +62,7 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" @@ -83,8 +81,6 @@ import ( appsv1beta2 "k8s.io/client-go/applyconfigurations/apps/v1beta2" applyconfigurationsautoscalingv1 "k8s.io/client-go/applyconfigurations/autoscaling/v1" autoscalingv2 "k8s.io/client-go/applyconfigurations/autoscaling/v2" - autoscalingv2beta1 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta1" - autoscalingv2beta2 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta2" applyconfigurationsbatchv1 "k8s.io/client-go/applyconfigurations/batch/v1" applyconfigurationsbatchv1beta1 "k8s.io/client-go/applyconfigurations/batch/v1beta1" applyconfigurationscertificatesv1 "k8s.io/client-go/applyconfigurations/certificates/v1" @@ -121,7 +117,7 @@ import ( applyconfigurationsresourcev1beta1 "k8s.io/client-go/applyconfigurations/resource/v1beta1" applyconfigurationsresourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2" applyconfigurationsschedulingv1 "k8s.io/client-go/applyconfigurations/scheduling/v1" - applyconfigurationsschedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" + applyconfigurationsschedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" applyconfigurationsschedulingv1beta1 "k8s.io/client-go/applyconfigurations/scheduling/v1beta1" applyconfigurationsstoragev1 "k8s.io/client-go/applyconfigurations/storage/v1" applyconfigurationsstoragev1alpha1 "k8s.io/client-go/applyconfigurations/storage/v1alpha1" @@ -134,18 +130,32 @@ import ( func ForKind(kind schema.GroupVersionKind) interface{} { switch kind { // Group=admissionregistration.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithKind("ApplyConfiguration"): + return &admissionregistrationv1.ApplyConfigurationApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("AuditAnnotation"): return &admissionregistrationv1.AuditAnnotationApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("ExpressionWarning"): return &admissionregistrationv1.ExpressionWarningApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("JSONPatch"): + return &admissionregistrationv1.JSONPatchApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("MatchCondition"): return &admissionregistrationv1.MatchConditionApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("MatchResources"): return &admissionregistrationv1.MatchResourcesApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"): + return &admissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"): + return &admissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBindingSpec"): + return &admissionregistrationv1.MutatingAdmissionPolicyBindingSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicySpec"): + return &admissionregistrationv1.MutatingAdmissionPolicySpecApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("MutatingWebhook"): return &admissionregistrationv1.MutatingWebhookApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("MutatingWebhookConfiguration"): return &admissionregistrationv1.MutatingWebhookConfigurationApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("Mutation"): + return &admissionregistrationv1.MutationApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("NamedRuleWithOperations"): return &admissionregistrationv1.NamedRuleWithOperationsApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("ParamKind"): @@ -489,90 +499,6 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case v2.SchemeGroupVersion.WithKind("ResourceMetricStatus"): return &autoscalingv2.ResourceMetricStatusApplyConfiguration{} - // Group=autoscaling, Version=v2beta1 - case v2beta1.SchemeGroupVersion.WithKind("ContainerResourceMetricSource"): - return &autoscalingv2beta1.ContainerResourceMetricSourceApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("ContainerResourceMetricStatus"): - return &autoscalingv2beta1.ContainerResourceMetricStatusApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("CrossVersionObjectReference"): - return &autoscalingv2beta1.CrossVersionObjectReferenceApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("ExternalMetricSource"): - return &autoscalingv2beta1.ExternalMetricSourceApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("ExternalMetricStatus"): - return &autoscalingv2beta1.ExternalMetricStatusApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"): - return &autoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerCondition"): - return &autoscalingv2beta1.HorizontalPodAutoscalerConditionApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerSpec"): - return &autoscalingv2beta1.HorizontalPodAutoscalerSpecApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerStatus"): - return &autoscalingv2beta1.HorizontalPodAutoscalerStatusApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("MetricSpec"): - return &autoscalingv2beta1.MetricSpecApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("MetricStatus"): - return &autoscalingv2beta1.MetricStatusApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("ObjectMetricSource"): - return &autoscalingv2beta1.ObjectMetricSourceApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("ObjectMetricStatus"): - return &autoscalingv2beta1.ObjectMetricStatusApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("PodsMetricSource"): - return &autoscalingv2beta1.PodsMetricSourceApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("PodsMetricStatus"): - return &autoscalingv2beta1.PodsMetricStatusApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("ResourceMetricSource"): - return &autoscalingv2beta1.ResourceMetricSourceApplyConfiguration{} - case v2beta1.SchemeGroupVersion.WithKind("ResourceMetricStatus"): - return &autoscalingv2beta1.ResourceMetricStatusApplyConfiguration{} - - // Group=autoscaling, Version=v2beta2 - case v2beta2.SchemeGroupVersion.WithKind("ContainerResourceMetricSource"): - return &autoscalingv2beta2.ContainerResourceMetricSourceApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("ContainerResourceMetricStatus"): - return &autoscalingv2beta2.ContainerResourceMetricStatusApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("CrossVersionObjectReference"): - return &autoscalingv2beta2.CrossVersionObjectReferenceApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("ExternalMetricSource"): - return &autoscalingv2beta2.ExternalMetricSourceApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("ExternalMetricStatus"): - return &autoscalingv2beta2.ExternalMetricStatusApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"): - return &autoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerBehavior"): - return &autoscalingv2beta2.HorizontalPodAutoscalerBehaviorApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerCondition"): - return &autoscalingv2beta2.HorizontalPodAutoscalerConditionApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerSpec"): - return &autoscalingv2beta2.HorizontalPodAutoscalerSpecApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscalerStatus"): - return &autoscalingv2beta2.HorizontalPodAutoscalerStatusApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("HPAScalingPolicy"): - return &autoscalingv2beta2.HPAScalingPolicyApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("HPAScalingRules"): - return &autoscalingv2beta2.HPAScalingRulesApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("MetricIdentifier"): - return &autoscalingv2beta2.MetricIdentifierApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("MetricSpec"): - return &autoscalingv2beta2.MetricSpecApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("MetricStatus"): - return &autoscalingv2beta2.MetricStatusApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("MetricTarget"): - return &autoscalingv2beta2.MetricTargetApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("MetricValueStatus"): - return &autoscalingv2beta2.MetricValueStatusApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("ObjectMetricSource"): - return &autoscalingv2beta2.ObjectMetricSourceApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("ObjectMetricStatus"): - return &autoscalingv2beta2.ObjectMetricStatusApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("PodsMetricSource"): - return &autoscalingv2beta2.PodsMetricSourceApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("PodsMetricStatus"): - return &autoscalingv2beta2.PodsMetricStatusApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("ResourceMetricSource"): - return &autoscalingv2beta2.ResourceMetricSourceApplyConfiguration{} - case v2beta2.SchemeGroupVersion.WithKind("ResourceMetricStatus"): - return &autoscalingv2beta2.ResourceMetricStatusApplyConfiguration{} - // Group=batch, Version=v1 case batchv1.SchemeGroupVersion.WithKind("CronJob"): return &applyconfigurationsbatchv1.CronJobApplyConfiguration{} @@ -818,6 +744,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.HTTPHeaderApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("ImageVolumeSource"): return &applyconfigurationscorev1.ImageVolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("ImageVolumeStatus"): + return &applyconfigurationscorev1.ImageVolumeStatusApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("ISCSIPersistentVolumeSource"): return &applyconfigurationscorev1.ISCSIPersistentVolumeSourceApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("ISCSIVolumeSource"): @@ -862,6 +790,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.NodeAddressApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeAffinity"): return &applyconfigurationscorev1.NodeAffinityApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("NodeAllocatableResourceClaimStatus"): + return &applyconfigurationscorev1.NodeAllocatableResourceClaimStatusApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeCondition"): return &applyconfigurationscorev1.NodeConditionApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("NodeConfigSource"): @@ -946,6 +876,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.PodResourceClaimStatusApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("PodSchedulingGate"): return &applyconfigurationscorev1.PodSchedulingGateApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("PodSchedulingGroup"): + return &applyconfigurationscorev1.PodSchedulingGroupApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("PodSecurityContext"): return &applyconfigurationscorev1.PodSecurityContextApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("PodSpec"): @@ -1078,14 +1010,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationscorev1.VolumeResourceRequirementsApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("VolumeSource"): return &applyconfigurationscorev1.VolumeSourceApplyConfiguration{} + case corev1.SchemeGroupVersion.WithKind("VolumeStatus"): + return &applyconfigurationscorev1.VolumeStatusApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("VsphereVirtualDiskVolumeSource"): return &applyconfigurationscorev1.VsphereVirtualDiskVolumeSourceApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("WeightedPodAffinityTerm"): return &applyconfigurationscorev1.WeightedPodAffinityTermApplyConfiguration{} case corev1.SchemeGroupVersion.WithKind("WindowsSecurityContextOptions"): return &applyconfigurationscorev1.WindowsSecurityContextOptionsApplyConfiguration{} - case corev1.SchemeGroupVersion.WithKind("WorkloadReference"): - return &applyconfigurationscorev1.WorkloadReferenceApplyConfiguration{} // Group=discovery.k8s.io, Version=v1 case discoveryv1.SchemeGroupVersion.WithKind("Endpoint"): @@ -1690,6 +1622,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1.ExactDeviceRequestApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("NetworkDeviceData"): return &applyconfigurationsresourcev1.NetworkDeviceDataApplyConfiguration{} + case resourcev1.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"): + return &applyconfigurationsresourcev1.NodeAllocatableResourceMappingApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"): return &applyconfigurationsresourcev1.OpaqueDeviceConfigurationApplyConfiguration{} case resourcev1.SchemeGroupVersion.WithKind("ResourceClaim"): @@ -1722,6 +1656,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &resourcev1alpha3.DeviceTaintRuleStatusApplyConfiguration{} case v1alpha3.SchemeGroupVersion.WithKind("DeviceTaintSelector"): return &resourcev1alpha3.DeviceTaintSelectorApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("PoolStatus"): + return &resourcev1alpha3.PoolStatusApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequest"): + return &resourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequestSpec"): + return &resourcev1alpha3.ResourcePoolStatusRequestSpecApplyConfiguration{} + case v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequestStatus"): + return &resourcev1alpha3.ResourcePoolStatusRequestStatusApplyConfiguration{} // Group=resource.k8s.io, Version=v1beta1 case resourcev1beta1.SchemeGroupVersion.WithKind("AllocatedDeviceStatus"): @@ -1782,6 +1724,8 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1beta1.DeviceTolerationApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("NetworkDeviceData"): return &applyconfigurationsresourcev1beta1.NetworkDeviceDataApplyConfiguration{} + case resourcev1beta1.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"): + return &applyconfigurationsresourcev1beta1.NodeAllocatableResourceMappingApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"): return &applyconfigurationsresourcev1beta1.OpaqueDeviceConfigurationApplyConfiguration{} case resourcev1beta1.SchemeGroupVersion.WithKind("ResourceClaim"): @@ -1856,12 +1800,22 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &applyconfigurationsresourcev1beta2.DeviceSubRequestApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaint"): return &applyconfigurationsresourcev1beta2.DeviceTaintApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRule"): + return &applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRuleSpec"): + return &applyconfigurationsresourcev1beta2.DeviceTaintRuleSpecApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRuleStatus"): + return &applyconfigurationsresourcev1beta2.DeviceTaintRuleStatusApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintSelector"): + return &applyconfigurationsresourcev1beta2.DeviceTaintSelectorApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceToleration"): return &applyconfigurationsresourcev1beta2.DeviceTolerationApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("ExactDeviceRequest"): return &applyconfigurationsresourcev1beta2.ExactDeviceRequestApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("NetworkDeviceData"): return &applyconfigurationsresourcev1beta2.NetworkDeviceDataApplyConfiguration{} + case resourcev1beta2.SchemeGroupVersion.WithKind("NodeAllocatableResourceMapping"): + return &applyconfigurationsresourcev1beta2.NodeAllocatableResourceMappingApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("OpaqueDeviceConfiguration"): return &applyconfigurationsresourcev1beta2.OpaqueDeviceConfigurationApplyConfiguration{} case resourcev1beta2.SchemeGroupVersion.WithKind("ResourceClaim"): @@ -1887,21 +1841,37 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case schedulingv1.SchemeGroupVersion.WithKind("PriorityClass"): return &applyconfigurationsschedulingv1.PriorityClassApplyConfiguration{} - // Group=scheduling.k8s.io, Version=v1alpha1 - case schedulingv1alpha1.SchemeGroupVersion.WithKind("GangSchedulingPolicy"): - return &applyconfigurationsschedulingv1alpha1.GangSchedulingPolicyApplyConfiguration{} - case schedulingv1alpha1.SchemeGroupVersion.WithKind("PodGroup"): - return &applyconfigurationsschedulingv1alpha1.PodGroupApplyConfiguration{} - case schedulingv1alpha1.SchemeGroupVersion.WithKind("PodGroupPolicy"): - return &applyconfigurationsschedulingv1alpha1.PodGroupPolicyApplyConfiguration{} - case schedulingv1alpha1.SchemeGroupVersion.WithKind("PriorityClass"): - return &applyconfigurationsschedulingv1alpha1.PriorityClassApplyConfiguration{} - case schedulingv1alpha1.SchemeGroupVersion.WithKind("TypedLocalObjectReference"): - return &applyconfigurationsschedulingv1alpha1.TypedLocalObjectReferenceApplyConfiguration{} - case schedulingv1alpha1.SchemeGroupVersion.WithKind("Workload"): - return &applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration{} - case schedulingv1alpha1.SchemeGroupVersion.WithKind("WorkloadSpec"): - return &applyconfigurationsschedulingv1alpha1.WorkloadSpecApplyConfiguration{} + // Group=scheduling.k8s.io, Version=v1alpha2 + case schedulingv1alpha2.SchemeGroupVersion.WithKind("GangSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha2.GangSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroup"): + return &applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupResourceClaim"): + return &applyconfigurationsschedulingv1alpha2.PodGroupResourceClaimApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupResourceClaimStatus"): + return &applyconfigurationsschedulingv1alpha2.PodGroupResourceClaimStatusApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSchedulingConstraints"): + return &applyconfigurationsschedulingv1alpha2.PodGroupSchedulingConstraintsApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSchedulingPolicy"): + return &applyconfigurationsschedulingv1alpha2.PodGroupSchedulingPolicyApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupSpec"): + return &applyconfigurationsschedulingv1alpha2.PodGroupSpecApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupStatus"): + return &applyconfigurationsschedulingv1alpha2.PodGroupStatusApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupTemplate"): + return &applyconfigurationsschedulingv1alpha2.PodGroupTemplateApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("PodGroupTemplateReference"): + return &applyconfigurationsschedulingv1alpha2.PodGroupTemplateReferenceApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("TopologyConstraint"): + return &applyconfigurationsschedulingv1alpha2.TopologyConstraintApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("TypedLocalObjectReference"): + return &applyconfigurationsschedulingv1alpha2.TypedLocalObjectReferenceApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("Workload"): + return &applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("WorkloadPodGroupTemplateReference"): + return &applyconfigurationsschedulingv1alpha2.WorkloadPodGroupTemplateReferenceApplyConfiguration{} + case schedulingv1alpha2.SchemeGroupVersion.WithKind("WorkloadSpec"): + return &applyconfigurationsschedulingv1alpha2.WorkloadSpecApplyConfiguration{} // Group=scheduling.k8s.io, Version=v1beta1 case schedulingv1beta1.SchemeGroupVersion.WithKind("PriorityClass"): diff --git a/vendor/k8s.io/client-go/dynamic/fake/simple.go b/vendor/k8s.io/client-go/dynamic/fake/simple.go index 06ef859425..39b3b64600 100644 --- a/vendor/k8s.io/client-go/dynamic/fake/simple.go +++ b/vendor/k8s.io/client-go/dynamic/fake/simple.go @@ -114,9 +114,13 @@ func NewSimpleDynamicClientWithCustomListKinds(scheme *runtime.Scheme, gvrToList cs := &FakeDynamicClient{scheme: scheme, gvrToListKind: completeGVRToListKind, tracker: o} cs.AddReactor("*", "*", testing.ObjectReaction(o)) cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + var opts metav1.ListOptions + if watchAction, ok := action.(testing.WatchActionImpl); ok { + opts = watchAction.ListOptions + } gvr := action.GetResource() ns := action.GetNamespace() - watch, err := o.Watch(gvr, ns) + watch, err := o.Watch(gvr, ns, opts) if err != nil { return false, nil, err } diff --git a/vendor/k8s.io/client-go/features/envvar.go b/vendor/k8s.io/client-go/features/envvar.go index 8c3f887dc4..93aa21fa71 100644 --- a/vendor/k8s.io/client-go/features/envvar.go +++ b/vendor/k8s.io/client-go/features/envvar.go @@ -121,12 +121,28 @@ func (f *envVarFeatureGates) Enabled(key Feature) bool { // Features set via this method take precedence over // the features set via environment variables. func (f *envVarFeatureGates) Set(featureName Feature, featureValue bool) error { + return f.set(featureName, featureValue, false) +} + +// SetForTesting sets the given feature to the given value. This method +// bypasses the check for locked features and should only be used for +// testing purposes. +// +// Features set via this method take precedence over +// the features set via environment variables. +func (f *envVarFeatureGates) SetForTesting(featureName Feature, featureValue bool) error { + return f.set(featureName, featureValue, true) +} + +func (f *envVarFeatureGates) set(featureName Feature, featureValue bool, allowChangingLockedFeatures bool) error { feature, ok := f.known[featureName] if !ok { return fmt.Errorf("feature %q is not registered in FeatureGates %q", featureName, f.callSiteName) } - if feature.LockToDefault && feature.Default != featureValue { - return fmt.Errorf("cannot set feature gate %q to %v, feature is locked to %v", featureName, featureValue, feature.Default) + if !allowChangingLockedFeatures { + if feature.LockToDefault && feature.Default != featureValue { + return fmt.Errorf("cannot set feature gate %q to %v, feature is locked to %v", featureName, featureValue, feature.Default) + } } f.lockEnabledViaSetMethod.Lock() @@ -141,6 +157,13 @@ func (f *envVarFeatureGates) Set(featureName Feature, featureValue bool) error { // read from the corresponding environmental variable. func (f *envVarFeatureGates) getEnabledMapFromEnvVar() map[Feature]bool { f.readEnvVarsOnce.Do(func() { + // This code does not really support contextual logging. Making it do so has huge + // implications for several call chains because the Enabled call then needs + // a `*WithLogger` variant. This does not matter in Kubernetes itself because + // all Kubernetes components replace the feature gate implementation used + // by client-go, but it might matter elsewhere. + logger := klog.Background() + featureGatesState := map[Feature]bool{} for feature, featureSpec := range f.known { featureState, featureStateSet := os.LookupEnv(fmt.Sprintf("KUBE_FEATURE_%s", feature)) @@ -150,10 +173,10 @@ func (f *envVarFeatureGates) getEnabledMapFromEnvVar() map[Feature]bool { boolVal, boolErr := strconv.ParseBool(featureState) switch { case boolErr != nil: - utilruntime.HandleError(fmt.Errorf("cannot set feature gate %q to %q, due to %v", feature, featureState, boolErr)) + utilruntime.HandleErrorWithLogger(logger, boolErr, "Could not set feature gate", "feature", feature, "desiredState", featureState) case featureSpec.LockToDefault: if boolVal != featureSpec.Default { - utilruntime.HandleError(fmt.Errorf("cannot set feature gate %q to %q, feature is locked to %v", feature, featureState, featureSpec.Default)) + utilruntime.HandleErrorWithLogger(logger, nil, "Could not set feature gate, feature is locked", "feature", feature, "desiredState", featureState, "lockedState", featureSpec.Default) break } featureGatesState[feature] = featureSpec.Default @@ -166,10 +189,10 @@ func (f *envVarFeatureGates) getEnabledMapFromEnvVar() map[Feature]bool { for feature, featureSpec := range f.known { if featureState, ok := featureGatesState[feature]; ok { - klog.V(1).InfoS("Feature gate updated state", "feature", feature, "enabled", featureState) + logger.V(1).Info("Feature gate updated state", "feature", feature, "enabled", featureState) continue } - klog.V(1).InfoS("Feature gate default state", "feature", feature, "enabled", featureSpec.Default) + logger.V(1).Info("Feature gate default state", "feature", feature, "enabled", featureSpec.Default) } }) return f.enabledViaEnvVar.Load().(map[Feature]bool) diff --git a/vendor/k8s.io/client-go/features/features.go b/vendor/k8s.io/client-go/features/features.go index cabb7468d6..f21511dca2 100644 --- a/vendor/k8s.io/client-go/features/features.go +++ b/vendor/k8s.io/client-go/features/features.go @@ -17,7 +17,7 @@ limitations under the License. package features import ( - "errors" + "context" "sync/atomic" utilruntime "k8s.io/apimachinery/pkg/util/runtime" @@ -127,7 +127,9 @@ func AddVersionedFeaturesToExistingFeatureGates(registry VersionedRegistry) erro // clientgofeaturegate.ReplaceFeatureGates(utilfeature.DefaultMutableFeatureGate) func ReplaceFeatureGates(newFeatureGates Gates) { if replaceFeatureGatesWithWarningIndicator(newFeatureGates) { - utilruntime.HandleError(errors.New("the default feature gates implementation has already been used and now it's being overwritten. This might lead to unexpected behaviour. Check your initialization order")) + // TODO (?): A new API would be needed where callers pass in a context or logger. + // Probably not worth it. + utilruntime.HandleErrorWithContext(context.TODO(), nil, "The default feature gates implementation has already been used and now it's being overwritten. This might lead to unexpected behaviour. Check your initialization order.") } } diff --git a/vendor/k8s.io/client-go/features/known_features.go b/vendor/k8s.io/client-go/features/known_features.go index 4b022c4b4f..250188dbc2 100644 --- a/vendor/k8s.io/client-go/features/known_features.go +++ b/vendor/k8s.io/client-go/features/known_features.go @@ -31,6 +31,20 @@ import ( // of code conflicts because changes are more likely to be scattered // across the file. const ( + // owner: @michaelasp + // beta: v1.36 + // + // Allow the client to process events atomically rather than a stream of + // events for items popped off the FIFO. + AtomicFIFO Feature = "AtomicFIFO" + + // owner: @yt2985 + // beta: 1.36 + // + // If enabled, allows clients to gracefully handle Certificate Authority (CA) + // rotations without dropping connections or requiring a restart. + ClientsAllowCARotation Feature = "ClientsAllowCARotation" + // owner: @benluddy // kep: https://kep.k8s.io/4222 // alpha: 1.32 @@ -41,6 +55,13 @@ const ( // "application/json" or "application/apply-patch+yaml", respectively. ClientsAllowCBOR Feature = "ClientsAllowCBOR" + // owner: @enj + // beta: v1.36 + // + // If enabled, the client-go TLS transport cache uses weak pointers to allow + // garbage collection of unused transports, preventing unbounded cache growth. + ClientsAllowTLSCacheGC Feature = "ClientsAllowTLSCacheGC" + // owner: @benluddy // kep: https://kep.k8s.io/4222 // alpha: 1.32 @@ -69,6 +90,12 @@ const ( // GA: v1.35 InformerResourceVersion Feature = "InformerResourceVersion" + // owner: @michaelasp + // beta: v1.36 + // + // Allow the FIFO to unlock while processing items to allow other goroutines to add items to the queue. + UnlockWhileProcessingFIFO Feature = "UnlockWhileProcessingFIFO" + // owner: @p0lyn0mial // beta: v1.30 // @@ -82,14 +109,24 @@ const ( // After registering with the binary, the features are, by default, controllable using environment variables. // For more details, please see envVarFeatureGates implementation. var defaultVersionedKubernetesFeatureGates = map[Feature]VersionedSpecs{ + AtomicFIFO: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: Beta}, + }, + ClientsAllowCARotation: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: Beta}, + }, ClientsAllowCBOR: { {Version: version.MustParse("1.32"), Default: false, PreRelease: Alpha}, }, + ClientsAllowTLSCacheGC: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: Beta}, + }, ClientsPreferCBOR: { {Version: version.MustParse("1.32"), Default: false, PreRelease: Alpha}, }, InOrderInformers: { {Version: version.MustParse("1.33"), Default: true, PreRelease: Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: GA, LockToDefault: true}, }, InOrderInformersBatchProcess: { {Version: version.MustParse("1.35"), Default: true, PreRelease: Beta}, @@ -98,6 +135,9 @@ var defaultVersionedKubernetesFeatureGates = map[Feature]VersionedSpecs{ {Version: version.MustParse("1.30"), Default: false, PreRelease: Alpha}, {Version: version.MustParse("1.35"), Default: true, PreRelease: GA}, }, + UnlockWhileProcessingFIFO: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: Beta}, + }, WatchListClient: { {Version: version.MustParse("1.30"), Default: false, PreRelease: Beta}, {Version: version.MustParse("1.35"), Default: true, PreRelease: Beta}, diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go index 08769d3cca..4bfe9c4c6e 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/interface.go @@ -24,6 +24,10 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. + MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer + // MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. + MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer // ValidatingAdmissionPolicies returns a ValidatingAdmissionPolicyInformer. @@ -45,6 +49,16 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// MutatingAdmissionPolicies returns a MutatingAdmissionPolicyInformer. +func (v *version) MutatingAdmissionPolicies() MutatingAdmissionPolicyInformer { + return &mutatingAdmissionPolicyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + +// MutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindingInformer. +func (v *version) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInformer { + return &mutatingAdmissionPolicyBindingInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // MutatingWebhookConfigurations returns a MutatingWebhookConfigurationInformer. func (v *version) MutatingWebhookConfigurations() MutatingWebhookConfigurationInformer { return &mutatingWebhookConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go new file mode 100644 index 0000000000..65df1905a5 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicy.go @@ -0,0 +1,115 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + time "time" + + apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingAdmissionPolicyInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicies. +type MutatingAdmissionPolicyInformer interface { + Informer() cache.SharedIndexInformer + Lister() admissionregistrationv1.MutatingAdmissionPolicyLister +} + +type mutatingAdmissionPolicyInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingadmissionpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicies().List(context.Background(), opts) + }, + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicies().Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicies().List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicies().Watch(ctx, opts) + }, + }, client), + &apiadmissionregistrationv1.MutatingAdmissionPolicy{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicy{}, f.defaultInformer) +} + +func (f *mutatingAdmissionPolicyInformer) Lister() admissionregistrationv1.MutatingAdmissionPolicyLister { + return admissionregistrationv1.NewMutatingAdmissionPolicyLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go new file mode 100644 index 0000000000..d06ca0b4e1 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingadmissionpolicybinding.go @@ -0,0 +1,115 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + time "time" + + apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + admissionregistrationv1 "k8s.io/client-go/listers/admissionregistration/v1" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingAdmissionPolicyBindingInformer provides access to a shared informer and lister for +// MutatingAdmissionPolicyBindings. +type MutatingAdmissionPolicyBindingInformer interface { + Informer() cache.SharedIndexInformer + Lister() admissionregistrationv1.MutatingAdmissionPolicyBindingLister +} + +type mutatingAdmissionPolicyBindingInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingadmissionpolicybindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().List(context.Background(), opts) + }, + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.AdmissionregistrationV1().MutatingAdmissionPolicyBindings().Watch(ctx, opts) + }, + }, client), + &apiadmissionregistrationv1.MutatingAdmissionPolicyBinding{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiadmissionregistrationv1.MutatingAdmissionPolicyBinding{}, f.defaultInformer) +} + +func (f *mutatingAdmissionPolicyBindingInformer) Lister() admissionregistrationv1.MutatingAdmissionPolicyBindingLister { + return admissionregistrationv1.NewMutatingAdmissionPolicyBindingLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go index 77439c4bc7..d7c48e78a6 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/mutatingwebhookconfiguration.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type mutatingWebhookConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingWebhookConfigurationInformerWithOptions constructs a new informer for MutatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "mutatingwebhookconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.Background(), options) + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(context.Background(), options) + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(ctx, options) + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(ctx, options) + return client.AdmissionregistrationV1().MutatingWebhookConfigurations().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1.MutatingWebhookConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go index 89b86c09e1..bdc5c0b28a 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicy.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingAdmissionPolicyInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyInformer(client, resyncPeriod, indexers, nil) + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "validatingadmissionpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().List(context.Background(), options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().Watch(context.Background(), options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().List(ctx, options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().Watch(ctx, options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicies().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1.ValidatingAdmissionPolicy{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go index b318ed445b..1ecf9703a9 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingadmissionpolicybinding.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingAdmissionPolicyBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyBindingInformer(client, resyncPeriod, indexers, nil) + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "validatingadmissionpolicybindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().List(context.Background(), options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().Watch(context.Background(), options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().List(ctx, options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().Watch(ctx, options) + return client.AdmissionregistrationV1().ValidatingAdmissionPolicyBindings().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1.ValidatingAdmissionPolicyBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go index d1d3840795..07653c35ce 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1/validatingwebhookconfiguration.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1 "k8s.io/api/admissionregistration/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingWebhookConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingWebhookConfigurationInformerWithOptions constructs a new informer for ValidatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1", Resource: "validatingwebhookconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.Background(), options) + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(context.Background(), options) + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(ctx, options) + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(ctx, options) + return client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1.ValidatingWebhookConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go index 2a0cb2cfde..3441d6df44 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicy.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type mutatingAdmissionPolicyInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyInformer(client, resyncPeriod, indexers, nil) + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "mutatingadmissionpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().List(context.Background(), options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().Watch(context.Background(), options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().List(ctx, options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().Watch(ctx, options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicies().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1alpha1.MutatingAdmissionPolicy{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go index 23ef580fef..568c911159 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/mutatingadmissionpolicybinding.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type mutatingAdmissionPolicyBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyBindingInformer(client, resyncPeriod, indexers, nil) + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "mutatingadmissionpolicybindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().List(context.Background(), options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().Watch(context.Background(), options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().List(ctx, options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().Watch(ctx, options) + return client.AdmissionregistrationV1alpha1().MutatingAdmissionPolicyBindings().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1alpha1.MutatingAdmissionPolicyBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go index 9a896b70dd..c86ca6da62 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicy.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingAdmissionPolicyInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyInformer(client, resyncPeriod, indexers, nil) + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "validatingadmissionpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().List(context.Background(), options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().Watch(context.Background(), options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().List(ctx, options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().Watch(ctx, options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicies().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicy{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go index 630471e9e2..224049a254 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1alpha1/validatingadmissionpolicybinding.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1alpha1 "k8s.io/api/admissionregistration/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingAdmissionPolicyBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyBindingInformer(client, resyncPeriod, indexers, nil) + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1alpha1", Resource: "validatingadmissionpolicybindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().List(context.Background(), options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().Watch(context.Background(), options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().List(ctx, options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().Watch(ctx, options) + return client.AdmissionregistrationV1alpha1().ValidatingAdmissionPolicyBindings().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1alpha1.ValidatingAdmissionPolicyBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go index bfd1e4245d..edfe94417b 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicy.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type mutatingAdmissionPolicyInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyInformer(client, resyncPeriod, indexers, nil) + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredMutatingAdmissionPolicyInformer constructs a new informer for MutatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingAdmissionPolicyInformerWithOptions constructs a new informer for MutatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "mutatingadmissionpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().List(context.Background(), options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().Watch(context.Background(), options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().List(ctx, options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().Watch(ctx, options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicies().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1beta1.MutatingAdmissionPolicy{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *mutatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewMutatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go index 416590c0b7..bb833f4447 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingadmissionpolicybinding.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type mutatingAdmissionPolicyBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyBindingInformer(client, resyncPeriod, indexers, nil) + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredMutatingAdmissionPolicyBindingInformer constructs a new informer for MutatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for MutatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "mutatingadmissionpolicybindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().List(context.Background(), options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().Watch(context.Background(), options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().List(ctx, options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().Watch(ctx, options) + return client.AdmissionregistrationV1beta1().MutatingAdmissionPolicyBindings().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1beta1.MutatingAdmissionPolicyBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *mutatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMutatingAdmissionPolicyBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewMutatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go index 2f086798e2..bb077a1746 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/mutatingwebhookconfiguration.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type mutatingWebhookConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredMutatingWebhookConfigurationInformer constructs a new informer for MutatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredMutatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewMutatingWebhookConfigurationInformerWithOptions constructs a new informer for MutatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewMutatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "mutatingwebhookconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(context.Background(), options) + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(context.Background(), options) + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(ctx, options) + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(ctx, options) + return client.AdmissionregistrationV1beta1().MutatingWebhookConfigurations().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1beta1.MutatingWebhookConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *mutatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMutatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewMutatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *mutatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go index 18960ff9f8..a88a254d6f 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicy.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingAdmissionPolicyInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyInformer(client, resyncPeriod, indexers, nil) + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingAdmissionPolicyInformer constructs a new informer for ValidatingAdmissionPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingAdmissionPolicyInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingAdmissionPolicyInformerWithOptions constructs a new informer for ValidatingAdmissionPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingAdmissionPolicyInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "validatingadmissionpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().List(context.Background(), options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Watch(context.Background(), options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().List(ctx, options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Watch(ctx, options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicies().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1beta1.ValidatingAdmissionPolicy{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingAdmissionPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingAdmissionPolicyInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go index ab3febb15a..d1df5a3f2f 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingadmissionpolicybinding.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingAdmissionPolicyBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyBindingInformer(client, resyncPeriod, indexers, nil) + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingAdmissionPolicyBindingInformer constructs a new informer for ValidatingAdmissionPolicyBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingAdmissionPolicyBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingAdmissionPolicyBindingInformerWithOptions constructs a new informer for ValidatingAdmissionPolicyBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingAdmissionPolicyBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "validatingadmissionpolicybindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().List(context.Background(), options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().Watch(context.Background(), options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().List(ctx, options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().Watch(ctx, options) + return client.AdmissionregistrationV1beta1().ValidatingAdmissionPolicyBindings().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1beta1.ValidatingAdmissionPolicyBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingAdmissionPolicyBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingAdmissionPolicyBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingAdmissionPolicyBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingAdmissionPolicyBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go index ae88860543..41852cb03d 100644 --- a/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go +++ b/vendor/k8s.io/client-go/informers/admissionregistration/v1beta1/validatingwebhookconfiguration.go @@ -25,6 +25,7 @@ import ( apiadmissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type validatingWebhookConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredValidatingWebhookConfigurationInformer constructs a new informer for ValidatingWebhookConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredValidatingWebhookConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewValidatingWebhookConfigurationInformerWithOptions constructs a new informer for ValidatingWebhookConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewValidatingWebhookConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "admissionregistration.k8s.io", Version: "v1beta1", Resource: "validatingwebhookconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.Background(), options) + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(context.Background(), options) + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(ctx, options) + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(ctx, options) + return client.AdmissionregistrationV1beta1().ValidatingWebhookConfigurations().Watch(ctx, opts) }, }, client), &apiadmissionregistrationv1beta1.ValidatingWebhookConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *validatingWebhookConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredValidatingWebhookConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewValidatingWebhookConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *validatingWebhookConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go index 1f1cfd503f..6d164a317c 100644 --- a/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go +++ b/vendor/k8s.io/client-go/informers/apiserverinternal/v1alpha1/storageversion.go @@ -25,6 +25,7 @@ import ( apiapiserverinternalv1alpha1 "k8s.io/api/apiserverinternal/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type storageVersionInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredStorageVersionInformer(client, resyncPeriod, indexers, nil) + return NewStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredStorageVersionInformer constructs a new informer for StorageVersion type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStorageVersionInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewStorageVersionInformerWithOptions constructs a new informer for StorageVersion type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageVersionInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "internal.apiserver.k8s.io", Version: "v1alpha1", Resource: "storageversions"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.InternalV1alpha1().StorageVersions().List(context.Background(), options) + return client.InternalV1alpha1().StorageVersions().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.InternalV1alpha1().StorageVersions().Watch(context.Background(), options) + return client.InternalV1alpha1().StorageVersions().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.InternalV1alpha1().StorageVersions().List(ctx, options) + return client.InternalV1alpha1().StorageVersions().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.InternalV1alpha1().StorageVersions().Watch(ctx, options) + return client.InternalV1alpha1().StorageVersions().Watch(ctx, opts) }, }, client), &apiapiserverinternalv1alpha1.StorageVersion{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *storageVersionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredStorageVersionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewStorageVersionInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageVersionInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go index 1d306123ca..f58da53f18 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/controllerrevision.go @@ -25,6 +25,7 @@ import ( apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type controllerRevisionInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) + return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "controllerrevisions"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ControllerRevisions(namespace).List(context.Background(), options) + return client.AppsV1().ControllerRevisions(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ControllerRevisions(namespace).Watch(context.Background(), options) + return client.AppsV1().ControllerRevisions(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ControllerRevisions(namespace).List(ctx, options) + return client.AppsV1().ControllerRevisions(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ControllerRevisions(namespace).Watch(ctx, options) + return client.AppsV1().ControllerRevisions(namespace).Watch(ctx, opts) }, }, client), &apiappsv1.ControllerRevision{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go index 658d6b9ae0..dbdc401242 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/daemonset.go @@ -25,6 +25,7 @@ import ( apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type daemonSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "daemonsets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().DaemonSets(namespace).List(context.Background(), options) + return client.AppsV1().DaemonSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().DaemonSets(namespace).Watch(context.Background(), options) + return client.AppsV1().DaemonSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().DaemonSets(namespace).List(ctx, options) + return client.AppsV1().DaemonSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().DaemonSets(namespace).Watch(ctx, options) + return client.AppsV1().DaemonSets(namespace).Watch(ctx, opts) }, }, client), &apiappsv1.DaemonSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go index 4a8a29c246..dbf4df6a88 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/deployment.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/deployment.go @@ -25,6 +25,7 @@ import ( apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type deploymentInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "deployments"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().Deployments(namespace).List(context.Background(), options) + return client.AppsV1().Deployments(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().Deployments(namespace).Watch(context.Background(), options) + return client.AppsV1().Deployments(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().Deployments(namespace).List(ctx, options) + return client.AppsV1().Deployments(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().Deployments(namespace).Watch(ctx, options) + return client.AppsV1().Deployments(namespace).Watch(ctx, opts) }, }, client), &apiappsv1.Deployment{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go index d37292cb6d..1115e5adcc 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/replicaset.go @@ -25,6 +25,7 @@ import ( apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type replicaSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "replicasets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ReplicaSets(namespace).List(context.Background(), options) + return client.AppsV1().ReplicaSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ReplicaSets(namespace).Watch(context.Background(), options) + return client.AppsV1().ReplicaSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ReplicaSets(namespace).List(ctx, options) + return client.AppsV1().ReplicaSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().ReplicaSets(namespace).Watch(ctx, options) + return client.AppsV1().ReplicaSets(namespace).Watch(ctx, opts) }, }, client), &apiappsv1.ReplicaSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go index 70a5f9c0ba..998251edee 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1/statefulset.go @@ -25,6 +25,7 @@ import ( apiappsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type statefulSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1", Resource: "statefulsets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().StatefulSets(namespace).List(context.Background(), options) + return client.AppsV1().StatefulSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().StatefulSets(namespace).Watch(context.Background(), options) + return client.AppsV1().StatefulSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().StatefulSets(namespace).List(ctx, options) + return client.AppsV1().StatefulSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1().StatefulSets(namespace).Watch(ctx, options) + return client.AppsV1().StatefulSets(namespace).Watch(ctx, opts) }, }, client), &apiappsv1.StatefulSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go index deaaa24c6b..ee3b156e02 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/controllerrevision.go @@ -25,6 +25,7 @@ import ( apiappsv1beta1 "k8s.io/api/apps/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type controllerRevisionInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) + return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "controllerrevisions"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().ControllerRevisions(namespace).List(context.Background(), options) + return client.AppsV1beta1().ControllerRevisions(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().ControllerRevisions(namespace).Watch(context.Background(), options) + return client.AppsV1beta1().ControllerRevisions(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().ControllerRevisions(namespace).List(ctx, options) + return client.AppsV1beta1().ControllerRevisions(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().ControllerRevisions(namespace).Watch(ctx, options) + return client.AppsV1beta1().ControllerRevisions(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta1.ControllerRevision{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go index 4dbad1e983..699375e3e1 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/deployment.go @@ -25,6 +25,7 @@ import ( apiappsv1beta1 "k8s.io/api/apps/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type deploymentInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "deployments"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().Deployments(namespace).List(context.Background(), options) + return client.AppsV1beta1().Deployments(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().Deployments(namespace).Watch(context.Background(), options) + return client.AppsV1beta1().Deployments(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().Deployments(namespace).List(ctx, options) + return client.AppsV1beta1().Deployments(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().Deployments(namespace).Watch(ctx, options) + return client.AppsV1beta1().Deployments(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta1.Deployment{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go index 2c5aa846ec..480e68f9d1 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta1/statefulset.go @@ -25,6 +25,7 @@ import ( apiappsv1beta1 "k8s.io/api/apps/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type statefulSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "statefulsets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().StatefulSets(namespace).List(context.Background(), options) + return client.AppsV1beta1().StatefulSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().StatefulSets(namespace).Watch(context.Background(), options) + return client.AppsV1beta1().StatefulSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().StatefulSets(namespace).List(ctx, options) + return client.AppsV1beta1().StatefulSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta1().StatefulSets(namespace).Watch(ctx, options) + return client.AppsV1beta1().StatefulSets(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta1.StatefulSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go index f6cca7d574..41e3bf1563 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/controllerrevision.go @@ -25,6 +25,7 @@ import ( apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type controllerRevisionInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformer(client, namespace, resyncPeriod, indexers, nil) + return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredControllerRevisionInformer constructs a new informer for ControllerRevision type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredControllerRevisionInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewControllerRevisionInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewControllerRevisionInformerWithOptions constructs a new informer for ControllerRevision type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewControllerRevisionInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "controllerrevisions"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ControllerRevisions(namespace).List(context.Background(), options) + return client.AppsV1beta2().ControllerRevisions(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ControllerRevisions(namespace).Watch(context.Background(), options) + return client.AppsV1beta2().ControllerRevisions(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ControllerRevisions(namespace).List(ctx, options) + return client.AppsV1beta2().ControllerRevisions(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ControllerRevisions(namespace).Watch(ctx, options) + return client.AppsV1beta2().ControllerRevisions(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta2.ControllerRevision{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *controllerRevisionInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredControllerRevisionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewControllerRevisionInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *controllerRevisionInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go index aaec4988c2..5c339a78a0 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/daemonset.go @@ -25,6 +25,7 @@ import ( apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type daemonSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "daemonsets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().DaemonSets(namespace).List(context.Background(), options) + return client.AppsV1beta2().DaemonSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().DaemonSets(namespace).Watch(context.Background(), options) + return client.AppsV1beta2().DaemonSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().DaemonSets(namespace).List(ctx, options) + return client.AppsV1beta2().DaemonSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().DaemonSets(namespace).Watch(ctx, options) + return client.AppsV1beta2().DaemonSets(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta2.DaemonSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go index 69f6e3fb8e..1e0b64cb28 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/deployment.go @@ -25,6 +25,7 @@ import ( apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type deploymentInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "deployments"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().Deployments(namespace).List(context.Background(), options) + return client.AppsV1beta2().Deployments(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().Deployments(namespace).Watch(context.Background(), options) + return client.AppsV1beta2().Deployments(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().Deployments(namespace).List(ctx, options) + return client.AppsV1beta2().Deployments(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().Deployments(namespace).Watch(ctx, options) + return client.AppsV1beta2().Deployments(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta2.Deployment{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go index a65d451616..425ad55333 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/replicaset.go @@ -25,6 +25,7 @@ import ( apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type replicaSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "replicasets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ReplicaSets(namespace).List(context.Background(), options) + return client.AppsV1beta2().ReplicaSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ReplicaSets(namespace).Watch(context.Background(), options) + return client.AppsV1beta2().ReplicaSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ReplicaSets(namespace).List(ctx, options) + return client.AppsV1beta2().ReplicaSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().ReplicaSets(namespace).Watch(ctx, options) + return client.AppsV1beta2().ReplicaSets(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta2.ReplicaSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go index 5e90c39c7b..0fb22661cf 100644 --- a/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go +++ b/vendor/k8s.io/client-go/informers/apps/v1beta2/statefulset.go @@ -25,6 +25,7 @@ import ( apiappsv1beta2 "k8s.io/api/apps/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type statefulSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredStatefulSetInformer constructs a new informer for StatefulSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStatefulSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewStatefulSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewStatefulSetInformerWithOptions constructs a new informer for StatefulSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStatefulSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "apps", Version: "v1beta2", Resource: "statefulsets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().StatefulSets(namespace).List(context.Background(), options) + return client.AppsV1beta2().StatefulSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().StatefulSets(namespace).Watch(context.Background(), options) + return client.AppsV1beta2().StatefulSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().StatefulSets(namespace).List(ctx, options) + return client.AppsV1beta2().StatefulSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AppsV1beta2().StatefulSets(namespace).Watch(ctx, options) + return client.AppsV1beta2().StatefulSets(namespace).Watch(ctx, opts) }, }, client), &apiappsv1beta2.StatefulSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *statefulSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredStatefulSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewStatefulSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *statefulSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/autoscaling/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/interface.go index 2b3b2d0e50..439dd24beb 100644 --- a/vendor/k8s.io/client-go/informers/autoscaling/interface.go +++ b/vendor/k8s.io/client-go/informers/autoscaling/interface.go @@ -21,8 +21,6 @@ package autoscaling import ( v1 "k8s.io/client-go/informers/autoscaling/v1" v2 "k8s.io/client-go/informers/autoscaling/v2" - v2beta1 "k8s.io/client-go/informers/autoscaling/v2beta1" - v2beta2 "k8s.io/client-go/informers/autoscaling/v2beta2" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" ) @@ -32,10 +30,6 @@ type Interface interface { V1() v1.Interface // V2 provides access to shared informers for resources in V2. V2() v2.Interface - // V2beta1 provides access to shared informers for resources in V2beta1. - V2beta1() v2beta1.Interface - // V2beta2 provides access to shared informers for resources in V2beta2. - V2beta2() v2beta2.Interface } type group struct { @@ -58,13 +52,3 @@ func (g *group) V1() v1.Interface { func (g *group) V2() v2.Interface { return v2.New(g.factory, g.namespace, g.tweakListOptions) } - -// V2beta1 returns a new v2beta1.Interface. -func (g *group) V2beta1() v2beta1.Interface { - return v2beta1.New(g.factory, g.namespace, g.tweakListOptions) -} - -// V2beta2 returns a new v2beta2.Interface. -func (g *group) V2beta2() v2beta2.Interface { - return v2beta2.New(g.factory, g.namespace, g.tweakListOptions) -} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go index 98aacb1e3c..e49b035242 100644 --- a/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/informers/autoscaling/v1/horizontalpodautoscaler.go @@ -25,6 +25,7 @@ import ( apiautoscalingv1 "k8s.io/api/autoscaling/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type horizontalPodAutoscalerInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) + return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewHorizontalPodAutoscalerInformerWithOptions constructs a new informer for HorizontalPodAutoscaler type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscalers"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(context.Background(), options) + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(context.Background(), options) + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(ctx, options) + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(ctx, options) + return client.AutoscalingV1().HorizontalPodAutoscalers(namespace).Watch(ctx, opts) }, }, client), &apiautoscalingv1.HorizontalPodAutoscaler{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go index ce86ea8778..3605718d08 100644 --- a/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go +++ b/vendor/k8s.io/client-go/informers/autoscaling/v2/horizontalpodautoscaler.go @@ -25,6 +25,7 @@ import ( apiautoscalingv2 "k8s.io/api/autoscaling/v2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type horizontalPodAutoscalerInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) + return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewHorizontalPodAutoscalerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewHorizontalPodAutoscalerInformerWithOptions constructs a new informer for HorizontalPodAutoscaler type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewHorizontalPodAutoscalerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "autoscaling", Version: "v2", Resource: "horizontalpodautoscalers"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).List(context.Background(), options) + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).Watch(context.Background(), options) + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).List(ctx, options) + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).Watch(ctx, options) + return client.AutoscalingV2().HorizontalPodAutoscalers(namespace).Watch(ctx, opts) }, }, client), &apiautoscalingv2.HorizontalPodAutoscaler{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewHorizontalPodAutoscalerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go deleted file mode 100644 index 7136842006..0000000000 --- a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/horizontalpodautoscaler.go +++ /dev/null @@ -1,102 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2beta1 - -import ( - context "context" - time "time" - - apiautoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" - kubernetes "k8s.io/client-go/kubernetes" - autoscalingv2beta1 "k8s.io/client-go/listers/autoscaling/v2beta1" - cache "k8s.io/client-go/tools/cache" -) - -// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for -// HorizontalPodAutoscalers. -type HorizontalPodAutoscalerInformer interface { - Informer() cache.SharedIndexInformer - Lister() autoscalingv2beta1.HorizontalPodAutoscalerLister -} - -type horizontalPodAutoscalerInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).List(context.Background(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).Watch(context.Background(), options) - }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).List(ctx, options) - }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta1().HorizontalPodAutoscalers(namespace).Watch(ctx, options) - }, - }, client), - &apiautoscalingv2beta1.HorizontalPodAutoscaler{}, - resyncPeriod, - indexers, - ) -} - -func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiautoscalingv2beta1.HorizontalPodAutoscaler{}, f.defaultInformer) -} - -func (f *horizontalPodAutoscalerInformer) Lister() autoscalingv2beta1.HorizontalPodAutoscalerLister { - return autoscalingv2beta1.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go deleted file mode 100644 index ff5d44b09d..0000000000 --- a/vendor/k8s.io/client-go/informers/autoscaling/v2beta1/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2beta1 - -import ( - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. - HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. -func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { - return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go deleted file mode 100644 index 4ff8b10331..0000000000 --- a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/horizontalpodautoscaler.go +++ /dev/null @@ -1,102 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2beta2 - -import ( - context "context" - time "time" - - apiautoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" - kubernetes "k8s.io/client-go/kubernetes" - autoscalingv2beta2 "k8s.io/client-go/listers/autoscaling/v2beta2" - cache "k8s.io/client-go/tools/cache" -) - -// HorizontalPodAutoscalerInformer provides access to a shared informer and lister for -// HorizontalPodAutoscalers. -type HorizontalPodAutoscalerInformer interface { - Informer() cache.SharedIndexInformer - Lister() autoscalingv2beta2.HorizontalPodAutoscalerLister -} - -type horizontalPodAutoscalerInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredHorizontalPodAutoscalerInformer constructs a new informer for HorizontalPodAutoscaler type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredHorizontalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).List(context.Background(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).Watch(context.Background(), options) - }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).List(ctx, options) - }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.AutoscalingV2beta2().HorizontalPodAutoscalers(namespace).Watch(ctx, options) - }, - }, client), - &apiautoscalingv2beta2.HorizontalPodAutoscaler{}, - resyncPeriod, - indexers, - ) -} - -func (f *horizontalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *horizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apiautoscalingv2beta2.HorizontalPodAutoscaler{}, f.defaultInformer) -} - -func (f *horizontalPodAutoscalerInformer) Lister() autoscalingv2beta2.HorizontalPodAutoscalerLister { - return autoscalingv2beta2.NewHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go b/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go deleted file mode 100644 index e482c57925..0000000000 --- a/vendor/k8s.io/client-go/informers/autoscaling/v2beta2/interface.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v2beta2 - -import ( - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" -) - -// Interface provides access to all the informers in this group version. -type Interface interface { - // HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. - HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer -} - -type version struct { - factory internalinterfaces.SharedInformerFactory - namespace string - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// New returns a new Interface. -func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { - return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} -} - -// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer. -func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer { - return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} -} diff --git a/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go index 9875a88b5b..022710011b 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go +++ b/vendor/k8s.io/client-go/informers/batch/v1/cronjob.go @@ -25,6 +25,7 @@ import ( apibatchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type cronJobInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) + return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCronJobInformer constructs a new informer for CronJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCronJobInformerWithOptions constructs a new informer for CronJob type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "cronjobs"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().CronJobs(namespace).List(context.Background(), options) + return client.BatchV1().CronJobs(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().CronJobs(namespace).Watch(context.Background(), options) + return client.BatchV1().CronJobs(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().CronJobs(namespace).List(ctx, options) + return client.BatchV1().CronJobs(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().CronJobs(namespace).Watch(ctx, options) + return client.BatchV1().CronJobs(namespace).Watch(ctx, opts) }, }, client), &apibatchv1.CronJob{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCronJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/batch/v1/job.go b/vendor/k8s.io/client-go/informers/batch/v1/job.go index a68178d639..97e88927bf 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1/job.go +++ b/vendor/k8s.io/client-go/informers/batch/v1/job.go @@ -25,6 +25,7 @@ import ( apibatchv1 "k8s.io/api/batch/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type jobInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredJobInformer(client, namespace, resyncPeriod, indexers, nil) + return NewJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredJobInformer constructs a new informer for Job type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewJobInformerWithOptions constructs a new informer for Job type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().Jobs(namespace).List(context.Background(), options) + return client.BatchV1().Jobs(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().Jobs(namespace).Watch(context.Background(), options) + return client.BatchV1().Jobs(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().Jobs(namespace).List(ctx, options) + return client.BatchV1().Jobs(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1().Jobs(namespace).Watch(ctx, options) + return client.BatchV1().Jobs(namespace).Watch(ctx, opts) }, }, client), &apibatchv1.Job{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *jobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *jobInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go index 16644920c7..5d2129323b 100644 --- a/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go +++ b/vendor/k8s.io/client-go/informers/batch/v1beta1/cronjob.go @@ -25,6 +25,7 @@ import ( apibatchv1beta1 "k8s.io/api/batch/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type cronJobInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCronJobInformer(client, namespace, resyncPeriod, indexers, nil) + return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCronJobInformer constructs a new informer for CronJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCronJobInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCronJobInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCronJobInformerWithOptions constructs a new informer for CronJob type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCronJobInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1beta1().CronJobs(namespace).List(context.Background(), options) + return client.BatchV1beta1().CronJobs(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1beta1().CronJobs(namespace).Watch(context.Background(), options) + return client.BatchV1beta1().CronJobs(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1beta1().CronJobs(namespace).List(ctx, options) + return client.BatchV1beta1().CronJobs(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.BatchV1beta1().CronJobs(namespace).Watch(ctx, options) + return client.BatchV1beta1().CronJobs(namespace).Watch(ctx, opts) }, }, client), &apibatchv1beta1.CronJob{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cronJobInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCronJobInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cronJobInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go index a16eb3f3b0..0e0706893c 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1/certificatesigningrequest.go @@ -25,6 +25,7 @@ import ( apicertificatesv1 "k8s.io/api/certificates/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type certificateSigningRequestInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) + return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCertificateSigningRequestInformerWithOptions constructs a new informer for CertificateSigningRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1", Resource: "certificatesigningrequests"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1().CertificateSigningRequests().List(context.Background(), options) + return client.CertificatesV1().CertificateSigningRequests().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1().CertificateSigningRequests().Watch(context.Background(), options) + return client.CertificatesV1().CertificateSigningRequests().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1().CertificateSigningRequests().List(ctx, options) + return client.CertificatesV1().CertificateSigningRequests().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1().CertificateSigningRequests().Watch(ctx, options) + return client.CertificatesV1().CertificateSigningRequests().Watch(ctx, opts) }, }, client), &apicertificatesv1.CertificateSigningRequest{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go b/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go index 02d8800fb3..637cfd71da 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1alpha1/clustertrustbundle.go @@ -25,6 +25,7 @@ import ( apicertificatesv1alpha1 "k8s.io/api/certificates/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterTrustBundleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterTrustBundleInformer(client, resyncPeriod, indexers, nil) + return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1alpha1", Resource: "clustertrustbundles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1alpha1().ClusterTrustBundles().List(context.Background(), options) + return client.CertificatesV1alpha1().ClusterTrustBundles().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1alpha1().ClusterTrustBundles().Watch(context.Background(), options) + return client.CertificatesV1alpha1().ClusterTrustBundles().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1alpha1().ClusterTrustBundles().List(ctx, options) + return client.CertificatesV1alpha1().ClusterTrustBundles().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1alpha1().ClusterTrustBundles().Watch(ctx, options) + return client.CertificatesV1alpha1().ClusterTrustBundles().Watch(ctx, opts) }, }, client), &apicertificatesv1alpha1.ClusterTrustBundle{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterTrustBundleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterTrustBundleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTrustBundleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go index 57097b7a9b..4d4408d906 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/certificatesigningrequest.go @@ -25,6 +25,7 @@ import ( apicertificatesv1beta1 "k8s.io/api/certificates/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type certificateSigningRequestInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, indexers, nil) + return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCertificateSigningRequestInformer constructs a new informer for CertificateSigningRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCertificateSigningRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCertificateSigningRequestInformerWithOptions constructs a new informer for CertificateSigningRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCertificateSigningRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "certificatesigningrequests"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().CertificateSigningRequests().List(context.Background(), options) + return client.CertificatesV1beta1().CertificateSigningRequests().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().CertificateSigningRequests().Watch(context.Background(), options) + return client.CertificatesV1beta1().CertificateSigningRequests().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().CertificateSigningRequests().List(ctx, options) + return client.CertificatesV1beta1().CertificateSigningRequests().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().CertificateSigningRequests().Watch(ctx, options) + return client.CertificatesV1beta1().CertificateSigningRequests().Watch(ctx, opts) }, }, client), &apicertificatesv1beta1.CertificateSigningRequest{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *certificateSigningRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCertificateSigningRequestInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCertificateSigningRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *certificateSigningRequestInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go index 93b5d631db..f665d0b739 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/clustertrustbundle.go @@ -25,6 +25,7 @@ import ( apicertificatesv1beta1 "k8s.io/api/certificates/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterTrustBundleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterTrustBundleInformer(client, resyncPeriod, indexers, nil) + return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterTrustBundleInformer constructs a new informer for ClusterTrustBundle type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterTrustBundleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterTrustBundleInformerWithOptions constructs a new informer for ClusterTrustBundle type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterTrustBundleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "clustertrustbundles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().ClusterTrustBundles().List(context.Background(), options) + return client.CertificatesV1beta1().ClusterTrustBundles().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().ClusterTrustBundles().Watch(context.Background(), options) + return client.CertificatesV1beta1().ClusterTrustBundles().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().ClusterTrustBundles().List(ctx, options) + return client.CertificatesV1beta1().ClusterTrustBundles().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().ClusterTrustBundles().Watch(ctx, options) + return client.CertificatesV1beta1().ClusterTrustBundles().Watch(ctx, opts) }, }, client), &apicertificatesv1beta1.ClusterTrustBundle{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterTrustBundleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterTrustBundleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterTrustBundleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterTrustBundleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go b/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go index 2d41c76e92..03f7816cfd 100644 --- a/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go +++ b/vendor/k8s.io/client-go/informers/certificates/v1beta1/podcertificaterequest.go @@ -25,6 +25,7 @@ import ( apicertificatesv1beta1 "k8s.io/api/certificates/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type podCertificateRequestInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodCertificateRequestInformer(client, namespace, resyncPeriod, indexers, nil) + return NewPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPodCertificateRequestInformer constructs a new informer for PodCertificateRequest type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodCertificateRequestInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPodCertificateRequestInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPodCertificateRequestInformerWithOptions constructs a new informer for PodCertificateRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodCertificateRequestInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1beta1", Resource: "podcertificaterequests"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().PodCertificateRequests(namespace).List(context.Background(), options) + return client.CertificatesV1beta1().PodCertificateRequests(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().PodCertificateRequests(namespace).Watch(context.Background(), options) + return client.CertificatesV1beta1().PodCertificateRequests(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().PodCertificateRequests(namespace).List(ctx, options) + return client.CertificatesV1beta1().PodCertificateRequests(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CertificatesV1beta1().PodCertificateRequests(namespace).Watch(ctx, options) + return client.CertificatesV1beta1().PodCertificateRequests(namespace).Watch(ctx, opts) }, }, client), &apicertificatesv1beta1.PodCertificateRequest{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *podCertificateRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodCertificateRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPodCertificateRequestInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podCertificateRequestInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/coordination/v1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go index 1a34bf73f3..cce8ab4d13 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1/lease.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1/lease.go @@ -25,6 +25,7 @@ import ( apicoordinationv1 "k8s.io/api/coordination/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type leaseInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) + return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredLeaseInformer constructs a new informer for Lease type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewLeaseInformerWithOptions constructs a new informer for Lease type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1", Resource: "leases"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1().Leases(namespace).List(context.Background(), options) + return client.CoordinationV1().Leases(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1().Leases(namespace).Watch(context.Background(), options) + return client.CoordinationV1().Leases(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1().Leases(namespace).List(ctx, options) + return client.CoordinationV1().Leases(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1().Leases(namespace).Watch(ctx, options) + return client.CoordinationV1().Leases(namespace).Watch(ctx, opts) }, }, client), &apicoordinationv1.Lease{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewLeaseInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go b/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go index f029be068a..5aa0ff3ae2 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1alpha2/leasecandidate.go @@ -25,6 +25,7 @@ import ( apicoordinationv1alpha2 "k8s.io/api/coordination/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type leaseCandidateInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredLeaseCandidateInformer(client, namespace, resyncPeriod, indexers, nil) + return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredLeaseCandidateInformer constructs a new informer for LeaseCandidate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewLeaseCandidateInformerWithOptions constructs a new informer for LeaseCandidate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1alpha2", Resource: "leasecandidates"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1alpha2().LeaseCandidates(namespace).List(context.Background(), options) + return client.CoordinationV1alpha2().LeaseCandidates(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1alpha2().LeaseCandidates(namespace).Watch(context.Background(), options) + return client.CoordinationV1alpha2().LeaseCandidates(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1alpha2().LeaseCandidates(namespace).List(ctx, options) + return client.CoordinationV1alpha2().LeaseCandidates(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1alpha2().LeaseCandidates(namespace).Watch(ctx, options) + return client.CoordinationV1alpha2().LeaseCandidates(namespace).Watch(ctx, opts) }, }, client), &apicoordinationv1alpha2.LeaseCandidate{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *leaseCandidateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredLeaseCandidateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewLeaseCandidateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseCandidateInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go index f254e30da3..66802fd949 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/lease.go @@ -25,6 +25,7 @@ import ( apicoordinationv1beta1 "k8s.io/api/coordination/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type leaseInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredLeaseInformer(client, namespace, resyncPeriod, indexers, nil) + return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredLeaseInformer constructs a new informer for Lease type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLeaseInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewLeaseInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewLeaseInformerWithOptions constructs a new informer for Lease type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1beta1", Resource: "leases"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().Leases(namespace).List(context.Background(), options) + return client.CoordinationV1beta1().Leases(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().Leases(namespace).Watch(context.Background(), options) + return client.CoordinationV1beta1().Leases(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().Leases(namespace).List(ctx, options) + return client.CoordinationV1beta1().Leases(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().Leases(namespace).Watch(ctx, options) + return client.CoordinationV1beta1().Leases(namespace).Watch(ctx, opts) }, }, client), &apicoordinationv1beta1.Lease{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *leaseInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredLeaseInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewLeaseInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go b/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go index bdb3e1be13..ee83397f4c 100644 --- a/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go +++ b/vendor/k8s.io/client-go/informers/coordination/v1beta1/leasecandidate.go @@ -25,6 +25,7 @@ import ( apicoordinationv1beta1 "k8s.io/api/coordination/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type leaseCandidateInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredLeaseCandidateInformer(client, namespace, resyncPeriod, indexers, nil) + return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredLeaseCandidateInformer constructs a new informer for LeaseCandidate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLeaseCandidateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewLeaseCandidateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewLeaseCandidateInformerWithOptions constructs a new informer for LeaseCandidate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLeaseCandidateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "coordination.k8s.io", Version: "v1beta1", Resource: "leasecandidates"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().LeaseCandidates(namespace).List(context.Background(), options) + return client.CoordinationV1beta1().LeaseCandidates(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().LeaseCandidates(namespace).Watch(context.Background(), options) + return client.CoordinationV1beta1().LeaseCandidates(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().LeaseCandidates(namespace).List(ctx, options) + return client.CoordinationV1beta1().LeaseCandidates(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoordinationV1beta1().LeaseCandidates(namespace).Watch(ctx, options) + return client.CoordinationV1beta1().LeaseCandidates(namespace).Watch(ctx, opts) }, }, client), &apicoordinationv1beta1.LeaseCandidate{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *leaseCandidateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredLeaseCandidateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewLeaseCandidateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *leaseCandidateInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go index 9cf1a062aa..5b6f6556c3 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go +++ b/vendor/k8s.io/client-go/informers/core/v1/componentstatus.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type componentStatusInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredComponentStatusInformer(client, resyncPeriod, indexers, nil) + return NewComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredComponentStatusInformer constructs a new informer for ComponentStatus type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredComponentStatusInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewComponentStatusInformerWithOptions constructs a new informer for ComponentStatus type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewComponentStatusInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "componentstatuss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ComponentStatuses().List(context.Background(), options) + return client.CoreV1().ComponentStatuses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ComponentStatuses().Watch(context.Background(), options) + return client.CoreV1().ComponentStatuses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ComponentStatuses().List(ctx, options) + return client.CoreV1().ComponentStatuses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ComponentStatuses().Watch(ctx, options) + return client.CoreV1().ComponentStatuses().Watch(ctx, opts) }, }, client), &apicorev1.ComponentStatus{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *componentStatusInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredComponentStatusInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewComponentStatusInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *componentStatusInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/configmap.go b/vendor/k8s.io/client-go/informers/core/v1/configmap.go index 5772678bfa..5b6389884b 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/configmap.go +++ b/vendor/k8s.io/client-go/informers/core/v1/configmap.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type configMapInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredConfigMapInformer(client, namespace, resyncPeriod, indexers, nil) + return NewConfigMapInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredConfigMapInformer constructs a new informer for ConfigMap type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredConfigMapInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewConfigMapInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewConfigMapInformerWithOptions constructs a new informer for ConfigMap type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewConfigMapInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ConfigMaps(namespace).List(context.Background(), options) + return client.CoreV1().ConfigMaps(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ConfigMaps(namespace).Watch(context.Background(), options) + return client.CoreV1().ConfigMaps(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ConfigMaps(namespace).List(ctx, options) + return client.CoreV1().ConfigMaps(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ConfigMaps(namespace).Watch(ctx, options) + return client.CoreV1().ConfigMaps(namespace).Watch(ctx, opts) }, }, client), &apicorev1.ConfigMap{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *configMapInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredConfigMapInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewConfigMapInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *configMapInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/endpoints.go b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go index 6c55df9887..1609ce7f7e 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/endpoints.go +++ b/vendor/k8s.io/client-go/informers/core/v1/endpoints.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type endpointsInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEndpointsInformer(client, namespace, resyncPeriod, indexers, nil) + return NewEndpointsInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredEndpointsInformer constructs a new informer for Endpoints type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEndpointsInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewEndpointsInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewEndpointsInformerWithOptions constructs a new informer for Endpoints type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointsInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "endpointss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Endpoints(namespace).List(context.Background(), options) + return client.CoreV1().Endpoints(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Endpoints(namespace).Watch(context.Background(), options) + return client.CoreV1().Endpoints(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Endpoints(namespace).List(ctx, options) + return client.CoreV1().Endpoints(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Endpoints(namespace).Watch(ctx, options) + return client.CoreV1().Endpoints(namespace).Watch(ctx, opts) }, }, client), &apicorev1.Endpoints{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *endpointsInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEndpointsInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewEndpointsInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *endpointsInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/event.go b/vendor/k8s.io/client-go/informers/core/v1/event.go index 63df621b66..ff9c3c5847 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/event.go +++ b/vendor/k8s.io/client-go/informers/core/v1/event.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type eventInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) + return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewEventInformerWithOptions constructs a new informer for Event type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "events"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Events(namespace).List(context.Background(), options) + return client.CoreV1().Events(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Events(namespace).Watch(context.Background(), options) + return client.CoreV1().Events(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Events(namespace).List(ctx, options) + return client.CoreV1().Events(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Events(namespace).Watch(ctx, options) + return client.CoreV1().Events(namespace).Watch(ctx, opts) }, }, client), &apicorev1.Event{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *eventInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/limitrange.go b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go index 229adb2b8f..a3a01de6dc 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/limitrange.go +++ b/vendor/k8s.io/client-go/informers/core/v1/limitrange.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type limitRangeInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredLimitRangeInformer(client, namespace, resyncPeriod, indexers, nil) + return NewLimitRangeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredLimitRangeInformer constructs a new informer for LimitRange type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredLimitRangeInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewLimitRangeInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewLimitRangeInformerWithOptions constructs a new informer for LimitRange type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewLimitRangeInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "limitranges"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().LimitRanges(namespace).List(context.Background(), options) + return client.CoreV1().LimitRanges(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().LimitRanges(namespace).Watch(context.Background(), options) + return client.CoreV1().LimitRanges(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().LimitRanges(namespace).List(ctx, options) + return client.CoreV1().LimitRanges(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().LimitRanges(namespace).Watch(ctx, options) + return client.CoreV1().LimitRanges(namespace).Watch(ctx, opts) }, }, client), &apicorev1.LimitRange{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *limitRangeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredLimitRangeInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewLimitRangeInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *limitRangeInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/namespace.go b/vendor/k8s.io/client-go/informers/core/v1/namespace.go index d45d2eee62..c2a9894417 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/namespace.go +++ b/vendor/k8s.io/client-go/informers/core/v1/namespace.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type namespaceInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNamespaceInformer(client, resyncPeriod, indexers, nil) + return NewNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredNamespaceInformer constructs a new informer for Namespace type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNamespaceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewNamespaceInformerWithOptions constructs a new informer for Namespace type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNamespaceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Namespaces().List(context.Background(), options) + return client.CoreV1().Namespaces().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Namespaces().Watch(context.Background(), options) + return client.CoreV1().Namespaces().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Namespaces().List(ctx, options) + return client.CoreV1().Namespaces().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Namespaces().Watch(ctx, options) + return client.CoreV1().Namespaces().Watch(ctx, opts) }, }, client), &apicorev1.Namespace{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *namespaceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNamespaceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewNamespaceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *namespaceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/node.go b/vendor/k8s.io/client-go/informers/core/v1/node.go index a5224761f9..48e8d7d6aa 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/node.go +++ b/vendor/k8s.io/client-go/informers/core/v1/node.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type nodeInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNodeInformer(client, resyncPeriod, indexers, nil) + return NewNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredNodeInformer constructs a new informer for Node type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewNodeInformerWithOptions constructs a new informer for Node type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Nodes().List(context.Background(), options) + return client.CoreV1().Nodes().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Nodes().Watch(context.Background(), options) + return client.CoreV1().Nodes().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Nodes().List(ctx, options) + return client.CoreV1().Nodes().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Nodes().Watch(ctx, options) + return client.CoreV1().Nodes().Watch(ctx, opts) }, }, client), &apicorev1.Node{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *nodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewNodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *nodeInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go index 0458fc1956..aebe7ffa81 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolume.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type persistentVolumeInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPersistentVolumeInformer(client, resyncPeriod, indexers, nil) + return NewPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPersistentVolumeInformer constructs a new informer for PersistentVolume type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPersistentVolumeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPersistentVolumeInformerWithOptions constructs a new informer for PersistentVolume type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumes"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumes().List(context.Background(), options) + return client.CoreV1().PersistentVolumes().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumes().Watch(context.Background(), options) + return client.CoreV1().PersistentVolumes().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumes().List(ctx, options) + return client.CoreV1().PersistentVolumes().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumes().Watch(ctx, options) + return client.CoreV1().PersistentVolumes().Watch(ctx, opts) }, }, client), &apicorev1.PersistentVolume{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *persistentVolumeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPersistentVolumeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPersistentVolumeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *persistentVolumeInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go index dd75924def..973b5571ed 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go +++ b/vendor/k8s.io/client-go/informers/core/v1/persistentvolumeclaim.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type persistentVolumeClaimInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPersistentVolumeClaimInformer(client, namespace, resyncPeriod, indexers, nil) + return NewPersistentVolumeClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPersistentVolumeClaimInformer constructs a new informer for PersistentVolumeClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPersistentVolumeClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPersistentVolumeClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPersistentVolumeClaimInformerWithOptions constructs a new informer for PersistentVolumeClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPersistentVolumeClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumeclaims"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumeClaims(namespace).List(context.Background(), options) + return client.CoreV1().PersistentVolumeClaims(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumeClaims(namespace).Watch(context.Background(), options) + return client.CoreV1().PersistentVolumeClaims(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumeClaims(namespace).List(ctx, options) + return client.CoreV1().PersistentVolumeClaims(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PersistentVolumeClaims(namespace).Watch(ctx, options) + return client.CoreV1().PersistentVolumeClaims(namespace).Watch(ctx, opts) }, }, client), &apicorev1.PersistentVolumeClaim{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *persistentVolumeClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPersistentVolumeClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPersistentVolumeClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *persistentVolumeClaimInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/pod.go b/vendor/k8s.io/client-go/informers/core/v1/pod.go index b68ebc1dd5..f49dee3dee 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/pod.go +++ b/vendor/k8s.io/client-go/informers/core/v1/pod.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type podInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodInformer(client, namespace, resyncPeriod, indexers, nil) + return NewPodInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPodInformer constructs a new informer for Pod type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPodInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPodInformerWithOptions constructs a new informer for Pod type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Pods(namespace).List(context.Background(), options) + return client.CoreV1().Pods(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Pods(namespace).Watch(context.Background(), options) + return client.CoreV1().Pods(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Pods(namespace).List(ctx, options) + return client.CoreV1().Pods(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Pods(namespace).Watch(ctx, options) + return client.CoreV1().Pods(namespace).Watch(ctx, opts) }, }, client), &apicorev1.Pod{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *podInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPodInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go index c4b4cd12be..940ae25999 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go +++ b/vendor/k8s.io/client-go/informers/core/v1/podtemplate.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type podTemplateInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodTemplateInformer(client, namespace, resyncPeriod, indexers, nil) + return NewPodTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPodTemplateInformer constructs a new informer for PodTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPodTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPodTemplateInformerWithOptions constructs a new informer for PodTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "podtemplates"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PodTemplates(namespace).List(context.Background(), options) + return client.CoreV1().PodTemplates(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PodTemplates(namespace).Watch(context.Background(), options) + return client.CoreV1().PodTemplates(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PodTemplates(namespace).List(ctx, options) + return client.CoreV1().PodTemplates(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().PodTemplates(namespace).Watch(ctx, options) + return client.CoreV1().PodTemplates(namespace).Watch(ctx, opts) }, }, client), &apicorev1.PodTemplate{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *podTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPodTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podTemplateInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go index 58b66c2bd5..ec323d3c63 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go +++ b/vendor/k8s.io/client-go/informers/core/v1/replicationcontroller.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type replicationControllerInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredReplicationControllerInformer(client, namespace, resyncPeriod, indexers, nil) + return NewReplicationControllerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredReplicationControllerInformer constructs a new informer for ReplicationController type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicationControllerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewReplicationControllerInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewReplicationControllerInformerWithOptions constructs a new informer for ReplicationController type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicationControllerInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "replicationcontrollers"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ReplicationControllers(namespace).List(context.Background(), options) + return client.CoreV1().ReplicationControllers(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ReplicationControllers(namespace).Watch(context.Background(), options) + return client.CoreV1().ReplicationControllers(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ReplicationControllers(namespace).List(ctx, options) + return client.CoreV1().ReplicationControllers(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ReplicationControllers(namespace).Watch(ctx, options) + return client.CoreV1().ReplicationControllers(namespace).Watch(ctx, opts) }, }, client), &apicorev1.ReplicationController{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *replicationControllerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredReplicationControllerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewReplicationControllerInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicationControllerInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go index 408c024581..490a31212b 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go +++ b/vendor/k8s.io/client-go/informers/core/v1/resourcequota.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type resourceQuotaInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceQuotaInformer(client, namespace, resyncPeriod, indexers, nil) + return NewResourceQuotaInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceQuotaInformer constructs a new informer for ResourceQuota type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceQuotaInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceQuotaInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceQuotaInformerWithOptions constructs a new informer for ResourceQuota type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceQuotaInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "resourcequotas"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ResourceQuotas(namespace).List(context.Background(), options) + return client.CoreV1().ResourceQuotas(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ResourceQuotas(namespace).Watch(context.Background(), options) + return client.CoreV1().ResourceQuotas(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ResourceQuotas(namespace).List(ctx, options) + return client.CoreV1().ResourceQuotas(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ResourceQuotas(namespace).Watch(ctx, options) + return client.CoreV1().ResourceQuotas(namespace).Watch(ctx, opts) }, }, client), &apicorev1.ResourceQuota{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceQuotaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceQuotaInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceQuotaInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceQuotaInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/secret.go b/vendor/k8s.io/client-go/informers/core/v1/secret.go index 7f7338d063..86458285d9 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/secret.go +++ b/vendor/k8s.io/client-go/informers/core/v1/secret.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type secretInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredSecretInformer(client, namespace, resyncPeriod, indexers, nil) + return NewSecretInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredSecretInformer constructs a new informer for Secret type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredSecretInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewSecretInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewSecretInformerWithOptions constructs a new informer for Secret type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewSecretInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Secrets(namespace).List(context.Background(), options) + return client.CoreV1().Secrets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Secrets(namespace).Watch(context.Background(), options) + return client.CoreV1().Secrets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Secrets(namespace).List(ctx, options) + return client.CoreV1().Secrets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Secrets(namespace).Watch(ctx, options) + return client.CoreV1().Secrets(namespace).Watch(ctx, opts) }, }, client), &apicorev1.Secret{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *secretInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredSecretInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewSecretInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *secretInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/service.go b/vendor/k8s.io/client-go/informers/core/v1/service.go index b4dcb75d79..4ec10b3227 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/service.go +++ b/vendor/k8s.io/client-go/informers/core/v1/service.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type serviceInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredServiceInformer(client, namespace, resyncPeriod, indexers, nil) + return NewServiceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredServiceInformer constructs a new informer for Service type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredServiceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewServiceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewServiceInformerWithOptions constructs a new informer for Service type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Services(namespace).List(context.Background(), options) + return client.CoreV1().Services(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Services(namespace).Watch(context.Background(), options) + return client.CoreV1().Services(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Services(namespace).List(ctx, options) + return client.CoreV1().Services(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().Services(namespace).Watch(ctx, options) + return client.CoreV1().Services(namespace).Watch(ctx, opts) }, }, client), &apicorev1.Service{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *serviceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewServiceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go index 5ddc98b24e..32751b6a38 100644 --- a/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go +++ b/vendor/k8s.io/client-go/informers/core/v1/serviceaccount.go @@ -25,6 +25,7 @@ import ( apicorev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type serviceAccountInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredServiceAccountInformer(client, namespace, resyncPeriod, indexers, nil) + return NewServiceAccountInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredServiceAccountInformer constructs a new informer for ServiceAccount type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredServiceAccountInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewServiceAccountInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewServiceAccountInformerWithOptions constructs a new informer for ServiceAccount type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceAccountInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "", Version: "v1", Resource: "serviceaccounts"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ServiceAccounts(namespace).List(context.Background(), options) + return client.CoreV1().ServiceAccounts(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ServiceAccounts(namespace).Watch(context.Background(), options) + return client.CoreV1().ServiceAccounts(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ServiceAccounts(namespace).List(ctx, options) + return client.CoreV1().ServiceAccounts(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.CoreV1().ServiceAccounts(namespace).Watch(ctx, options) + return client.CoreV1().ServiceAccounts(namespace).Watch(ctx, opts) }, }, client), &apicorev1.ServiceAccount{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *serviceAccountInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredServiceAccountInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewServiceAccountInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceAccountInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go index 1291912816..999d514598 100644 --- a/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go +++ b/vendor/k8s.io/client-go/informers/discovery/v1/endpointslice.go @@ -25,6 +25,7 @@ import ( apidiscoveryv1 "k8s.io/api/discovery/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type endpointSliceInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) + return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewEndpointSliceInformerWithOptions constructs a new informer for EndpointSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "discovery.k8s.io", Version: "v1", Resource: "endpointslices"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1().EndpointSlices(namespace).List(context.Background(), options) + return client.DiscoveryV1().EndpointSlices(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1().EndpointSlices(namespace).Watch(context.Background(), options) + return client.DiscoveryV1().EndpointSlices(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1().EndpointSlices(namespace).List(ctx, options) + return client.DiscoveryV1().EndpointSlices(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1().EndpointSlices(namespace).Watch(ctx, options) + return client.DiscoveryV1().EndpointSlices(namespace).Watch(ctx, opts) }, }, client), &apidiscoveryv1.EndpointSlice{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewEndpointSliceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go index 80147e2438..918e30485f 100644 --- a/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go +++ b/vendor/k8s.io/client-go/informers/discovery/v1beta1/endpointslice.go @@ -25,6 +25,7 @@ import ( apidiscoveryv1beta1 "k8s.io/api/discovery/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type endpointSliceInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEndpointSliceInformer(client, namespace, resyncPeriod, indexers, nil) + return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredEndpointSliceInformer constructs a new informer for EndpointSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEndpointSliceInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewEndpointSliceInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewEndpointSliceInformerWithOptions constructs a new informer for EndpointSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEndpointSliceInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "discovery.k8s.io", Version: "v1beta1", Resource: "endpointslices"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1beta1().EndpointSlices(namespace).List(context.Background(), options) + return client.DiscoveryV1beta1().EndpointSlices(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(context.Background(), options) + return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1beta1().EndpointSlices(namespace).List(ctx, options) + return client.DiscoveryV1beta1().EndpointSlices(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(ctx, options) + return client.DiscoveryV1beta1().EndpointSlices(namespace).Watch(ctx, opts) }, }, client), &apidiscoveryv1beta1.EndpointSlice{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *endpointSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEndpointSliceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewEndpointSliceInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *endpointSliceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/events/v1/event.go b/vendor/k8s.io/client-go/informers/events/v1/event.go index 68eafe312c..23aaa68479 100644 --- a/vendor/k8s.io/client-go/informers/events/v1/event.go +++ b/vendor/k8s.io/client-go/informers/events/v1/event.go @@ -25,6 +25,7 @@ import ( apieventsv1 "k8s.io/api/events/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type eventInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) + return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewEventInformerWithOptions constructs a new informer for Event type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1", Resource: "events"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1().Events(namespace).List(context.Background(), options) + return client.EventsV1().Events(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1().Events(namespace).Watch(context.Background(), options) + return client.EventsV1().Events(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1().Events(namespace).List(ctx, options) + return client.EventsV1().Events(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1().Events(namespace).Watch(ctx, options) + return client.EventsV1().Events(namespace).Watch(ctx, opts) }, }, client), &apieventsv1.Event{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *eventInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/events/v1beta1/event.go b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go index b26c208938..ea0117eaca 100644 --- a/vendor/k8s.io/client-go/informers/events/v1beta1/event.go +++ b/vendor/k8s.io/client-go/informers/events/v1beta1/event.go @@ -25,6 +25,7 @@ import ( apieventsv1beta1 "k8s.io/api/events/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type eventInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredEventInformer(client, namespace, resyncPeriod, indexers, nil) + return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredEventInformer constructs a new informer for Event type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredEventInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewEventInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewEventInformerWithOptions constructs a new informer for Event type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewEventInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "events.k8s.io", Version: "v1beta1", Resource: "events"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1beta1().Events(namespace).List(context.Background(), options) + return client.EventsV1beta1().Events(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1beta1().Events(namespace).Watch(context.Background(), options) + return client.EventsV1beta1().Events(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1beta1().Events(namespace).List(ctx, options) + return client.EventsV1beta1().Events(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.EventsV1beta1().Events(namespace).Watch(ctx, options) + return client.EventsV1beta1().Events(namespace).Watch(ctx, opts) }, }, client), &apieventsv1beta1.Event{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *eventInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredEventInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewEventInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *eventInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go index fdfbb02306..ed8b023038 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/daemonset.go @@ -25,6 +25,7 @@ import ( apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type daemonSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDaemonSetInformer constructs a new informer for DaemonSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDaemonSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDaemonSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDaemonSetInformerWithOptions constructs a new informer for DaemonSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDaemonSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "daemonsets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().DaemonSets(namespace).List(context.Background(), options) + return client.ExtensionsV1beta1().DaemonSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().DaemonSets(namespace).Watch(context.Background(), options) + return client.ExtensionsV1beta1().DaemonSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().DaemonSets(namespace).List(ctx, options) + return client.ExtensionsV1beta1().DaemonSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().DaemonSets(namespace).Watch(ctx, options) + return client.ExtensionsV1beta1().DaemonSets(namespace).Watch(ctx, opts) }, }, client), &apiextensionsv1beta1.DaemonSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *daemonSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDaemonSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDaemonSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *daemonSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go index 6442266250..ee328bb517 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/deployment.go @@ -25,6 +25,7 @@ import ( apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type deploymentInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, namespace, resyncPeriod, indexers, nil) + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeploymentInformer constructs a new informer for Deployment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeploymentInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeploymentInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeploymentInformerWithOptions constructs a new informer for Deployment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeploymentInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Deployments(namespace).List(context.Background(), options) + return client.ExtensionsV1beta1().Deployments(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Deployments(namespace).Watch(context.Background(), options) + return client.ExtensionsV1beta1().Deployments(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Deployments(namespace).List(ctx, options) + return client.ExtensionsV1beta1().Deployments(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Deployments(namespace).Watch(ctx, options) + return client.ExtensionsV1beta1().Deployments(namespace).Watch(ctx, opts) }, }, client), &apiextensionsv1beta1.Deployment{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deploymentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeploymentInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deploymentInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go index bbd7286843..852238a481 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/ingress.go @@ -25,6 +25,7 @@ import ( apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type ingressInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) + return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewIngressInformerWithOptions constructs a new informer for Ingress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "ingresss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Ingresses(namespace).List(context.Background(), options) + return client.ExtensionsV1beta1().Ingresses(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Ingresses(namespace).Watch(context.Background(), options) + return client.ExtensionsV1beta1().Ingresses(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Ingresses(namespace).List(ctx, options) + return client.ExtensionsV1beta1().Ingresses(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().Ingresses(namespace).Watch(ctx, options) + return client.ExtensionsV1beta1().Ingresses(namespace).Watch(ctx, opts) }, }, client), &apiextensionsv1beta1.Ingress{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go index 45eb5e95bb..fda46c1d96 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/networkpolicy.go @@ -25,6 +25,7 @@ import ( apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type networkPolicyInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) + return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewNetworkPolicyInformerWithOptions constructs a new informer for NetworkPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "networkpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().NetworkPolicies(namespace).List(context.Background(), options) + return client.ExtensionsV1beta1().NetworkPolicies(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().NetworkPolicies(namespace).Watch(context.Background(), options) + return client.ExtensionsV1beta1().NetworkPolicies(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().NetworkPolicies(namespace).List(ctx, options) + return client.ExtensionsV1beta1().NetworkPolicies(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().NetworkPolicies(namespace).Watch(ctx, options) + return client.ExtensionsV1beta1().NetworkPolicies(namespace).Watch(ctx, opts) }, }, client), &apiextensionsv1beta1.NetworkPolicy{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewNetworkPolicyInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go index 82a183b3c7..eb0685147f 100644 --- a/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go +++ b/vendor/k8s.io/client-go/informers/extensions/v1beta1/replicaset.go @@ -25,6 +25,7 @@ import ( apiextensionsv1beta1 "k8s.io/api/extensions/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type replicaSetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredReplicaSetInformer constructs a new informer for ReplicaSet type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredReplicaSetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewReplicaSetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewReplicaSetInformerWithOptions constructs a new informer for ReplicaSet type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewReplicaSetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "replicasets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().ReplicaSets(namespace).List(context.Background(), options) + return client.ExtensionsV1beta1().ReplicaSets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(context.Background(), options) + return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().ReplicaSets(namespace).List(ctx, options) + return client.ExtensionsV1beta1().ReplicaSets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(ctx, options) + return client.ExtensionsV1beta1().ReplicaSets(namespace).Watch(ctx, opts) }, }, client), &apiextensionsv1beta1.ReplicaSet{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *replicaSetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredReplicaSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewReplicaSetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *replicaSetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/factory.go b/vendor/k8s.io/client-go/informers/factory.go index bd3d16c010..19901079f8 100644 --- a/vendor/k8s.io/client-go/informers/factory.go +++ b/vendor/k8s.io/client-go/informers/factory.go @@ -19,6 +19,7 @@ limitations under the License. package informers import ( + context "context" reflect "reflect" sync "sync" time "time" @@ -26,6 +27,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" + wait "k8s.io/apimachinery/pkg/util/wait" admissionregistration "k8s.io/client-go/informers/admissionregistration" apiserverinternal "k8s.io/client-go/informers/apiserverinternal" apps "k8s.io/client-go/informers/apps" @@ -62,6 +64,7 @@ type sharedInformerFactory struct { defaultResync time.Duration customResync map[reflect.Type]time.Duration transform cache.TransformFunc + informerName *cache.InformerName informers map[reflect.Type]cache.SharedIndexInformer // startedInformers is used for tracking which informers have been started. @@ -108,6 +111,21 @@ func WithTransform(transform cache.TransformFunc) SharedInformerOption { } } +// WithInformerName sets the InformerName for informer identity used in metrics. +// The InformerName must be created via cache.NewInformerName() at startup, +// which validates global uniqueness. Each informer type will register its +// GVR under this name. +func WithInformerName(informerName *cache.InformerName) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.informerName = informerName + return factory + } +} + +func (f *sharedInformerFactory) InformerName() *cache.InformerName { + return f.informerName +} + // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client kubernetes.Interface, defaultResync time.Duration) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -142,6 +160,10 @@ func NewSharedInformerFactoryWithOptions(client kubernetes.Interface, defaultRes } func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.StartWithContext(wait.ContextForChannel(stopCh)) +} + +func (f *sharedInformerFactory) StartWithContext(ctx context.Context) { f.lock.Lock() defer f.lock.Unlock() @@ -151,15 +173,9 @@ func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { for informerType, informer := range f.informers { if !f.startedInformers[informerType] { - f.wg.Add(1) - // We need a new variable in each loop iteration, - // otherwise the goroutine would use the loop variable - // and that keeps changing. - informer := informer - go func() { - defer f.wg.Done() - informer.Run(stopCh) - }() + f.wg.Go(func() { + informer.RunWithContext(ctx) + }) f.startedInformers[informerType] = true } } @@ -172,9 +188,15 @@ func (f *sharedInformerFactory) Shutdown() { // Will return immediately if there is nothing to wait for. f.wg.Wait() + f.informerName.Release() } func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { + result := f.WaitForCacheSyncWithContext(wait.ContextForChannel(stopCh)) + return result.Synced +} + +func (f *sharedInformerFactory) WaitForCacheSyncWithContext(ctx context.Context) cache.SyncResult { informers := func() map[reflect.Type]cache.SharedIndexInformer { f.lock.Lock() defer f.lock.Unlock() @@ -188,10 +210,31 @@ func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[ref return informers }() - res := map[reflect.Type]bool{} + // Wait for informers to sync, without polling. + cacheSyncs := make([]cache.DoneChecker, 0, len(informers)) + for _, informer := range informers { + cacheSyncs = append(cacheSyncs, informer.HasSyncedChecker()) + } + cache.WaitFor(ctx, "" /* no logging */, cacheSyncs...) + + res := cache.SyncResult{ + Synced: make(map[reflect.Type]bool, len(informers)), + } + failed := false for informType, informer := range informers { - res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) + hasSynced := informer.HasSynced() + if !hasSynced { + failed = true + } + res.Synced[informType] = hasSynced } + if failed { + // context.Cause is more informative than ctx.Err(). + // This must be non-nil, otherwise WaitFor wouldn't have stopped + // prematurely. + res.Err = context.Cause(ctx) + } + return res } @@ -213,7 +256,9 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal } informer = newFunc(f.client, resyncPeriod) - informer.SetTransform(f.transform) + if f.transform != nil { + informer.SetTransform(f.transform) + } f.informers[informerType] = informer return informer @@ -230,27 +275,46 @@ func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFunc internal // defer factory.WaitForStop() // Returns immediately if nothing was started. // genericInformer := factory.ForResource(resource) // typedInformer := factory.SomeAPIGroup().V1().SomeType() -// factory.Start(ctx.Done()) // Start processing these informers. -// synced := factory.WaitForCacheSync(ctx.Done()) -// for v, ok := range synced { -// if !ok { -// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) -// return -// } +// handle, err := typeInformer.Informer().AddEventHandler(...) +// if err != nil { +// return fmt.Errorf("register event handler: %v", err) +// } +// defer typeInformer.Informer().RemoveEventHandler(handle) // Avoids leaking goroutines. +// factory.StartWithContext(ctx) // Start processing these informers. +// synced := factory.WaitForCacheSyncWithContext(ctx) +// if err := synced.AsError(); err != nil { +// return err +// } +// for v := range synced { +// // Only if desired log some information similar to this. +// fmt.Fprintf(os.Stdout, "cache synced: %s", v) +// } +// +// // Also make sure that all of the initial cache events have been delivered. +// if !WaitFor(ctx, "event handler sync", handle.HasSyncedChecker()) { +// // Must have failed because of context. +// return fmt.Errorf("sync event handler: %w", context.Cause(ctx)) // } // // // Creating informers can also be created after Start, but then // // Start must be called again: // anotherGenericInformer := factory.ForResource(resource) -// factory.Start(ctx.Done()) +// factory.StartWithContext(ctx) type SharedInformerFactory interface { internalinterfaces.SharedInformerFactory // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. + // + // Contextual logging: StartWithContext should be used instead of Start in code which supports contextual logging. Start(stopCh <-chan struct{}) + // StartWithContext initializes all requested informers. They are handled in goroutines + // which run until the context gets canceled. + // Warning: StartWithContext does not block. When run in a go-routine, it will race with a later WaitForCacheSync. + StartWithContext(ctx context.Context) + // Shutdown marks a factory as shutting down. At that point no new // informers can be started anymore and Start will return without // doing anything. @@ -265,8 +329,14 @@ type SharedInformerFactory interface { // WaitForCacheSync blocks until all started informers' caches were synced // or the stop channel gets closed. + // + // Contextual logging: WaitForCacheSync should be used instead of WaitForCacheSync in code which supports contextual logging. It also returns a more useful result. WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + // WaitForCacheSyncWithContext blocks until all started informers' caches were synced + // or the context gets canceled. + WaitForCacheSyncWithContext(ctx context.Context) cache.SyncResult + // ForResource gives generic access to a shared informer of the matching type. ForResource(resource schema.GroupVersionResource) (GenericInformer, error) diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go index 734ee0ebf4..624c2f5d6d 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1/flowschema.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1 "k8s.io/api/flowcontrol/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type flowSchemaInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1", Resource: "flowschemas"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().FlowSchemas().List(context.Background(), options) + return client.FlowcontrolV1().FlowSchemas().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().FlowSchemas().Watch(context.Background(), options) + return client.FlowcontrolV1().FlowSchemas().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().FlowSchemas().List(ctx, options) + return client.FlowcontrolV1().FlowSchemas().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().FlowSchemas().Watch(ctx, options) + return client.FlowcontrolV1().FlowSchemas().Watch(ctx, opts) }, }, client), &apiflowcontrolv1.FlowSchema{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go index a5f23218ef..5a42509553 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1/prioritylevelconfiguration.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1 "k8s.io/api/flowcontrol/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type priorityLevelConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1", Resource: "prioritylevelconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().PriorityLevelConfigurations().List(context.Background(), options) + return client.FlowcontrolV1().PriorityLevelConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().PriorityLevelConfigurations().Watch(context.Background(), options) + return client.FlowcontrolV1().PriorityLevelConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().PriorityLevelConfigurations().List(ctx, options) + return client.FlowcontrolV1().PriorityLevelConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1().PriorityLevelConfigurations().Watch(ctx, options) + return client.FlowcontrolV1().PriorityLevelConfigurations().Watch(ctx, opts) }, }, client), &apiflowcontrolv1.PriorityLevelConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go index 5e88fe8cb9..2e0098e664 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/flowschema.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type flowSchemaInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Resource: "flowschemas"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().FlowSchemas().List(context.Background(), options) + return client.FlowcontrolV1beta1().FlowSchemas().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().FlowSchemas().Watch(context.Background(), options) + return client.FlowcontrolV1beta1().FlowSchemas().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().FlowSchemas().List(ctx, options) + return client.FlowcontrolV1beta1().FlowSchemas().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().FlowSchemas().Watch(ctx, options) + return client.FlowcontrolV1beta1().FlowSchemas().Watch(ctx, opts) }, }, client), &apiflowcontrolv1beta1.FlowSchema{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go index f86a96e38c..9c94839a1a 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1/prioritylevelconfiguration.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type priorityLevelConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Resource: "prioritylevelconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.Background(), options) + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(context.Background(), options) + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(ctx, options) + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(ctx, options) + return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(ctx, opts) }, }, client), &apiflowcontrolv1beta1.PriorityLevelConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go index e17e4c9fa2..aba4d712af 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/flowschema.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type flowSchemaInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta2", Resource: "flowschemas"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().FlowSchemas().List(context.Background(), options) + return client.FlowcontrolV1beta2().FlowSchemas().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().FlowSchemas().Watch(context.Background(), options) + return client.FlowcontrolV1beta2().FlowSchemas().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().FlowSchemas().List(ctx, options) + return client.FlowcontrolV1beta2().FlowSchemas().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().FlowSchemas().Watch(ctx, options) + return client.FlowcontrolV1beta2().FlowSchemas().Watch(ctx, opts) }, }, client), &apiflowcontrolv1beta2.FlowSchema{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go index 1db6efa6fe..0ce811759a 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta2/prioritylevelconfiguration.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type priorityLevelConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta2", Resource: "prioritylevelconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().PriorityLevelConfigurations().List(context.Background(), options) + return client.FlowcontrolV1beta2().PriorityLevelConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().PriorityLevelConfigurations().Watch(context.Background(), options) + return client.FlowcontrolV1beta2().PriorityLevelConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().PriorityLevelConfigurations().List(ctx, options) + return client.FlowcontrolV1beta2().PriorityLevelConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta2().PriorityLevelConfigurations().Watch(ctx, options) + return client.FlowcontrolV1beta2().PriorityLevelConfigurations().Watch(ctx, opts) }, }, client), &apiflowcontrolv1beta2.PriorityLevelConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go index 626a20d620..16ce2ba23c 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/flowschema.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type flowSchemaInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewFlowSchemaInformerWithOptions constructs a new informer for FlowSchema type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFlowSchemaInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta3", Resource: "flowschemas"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().FlowSchemas().List(context.Background(), options) + return client.FlowcontrolV1beta3().FlowSchemas().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().FlowSchemas().Watch(context.Background(), options) + return client.FlowcontrolV1beta3().FlowSchemas().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().FlowSchemas().List(ctx, options) + return client.FlowcontrolV1beta3().FlowSchemas().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().FlowSchemas().Watch(ctx, options) + return client.FlowcontrolV1beta3().FlowSchemas().Watch(ctx, opts) }, }, client), &apiflowcontrolv1beta3.FlowSchema{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFlowSchemaInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go index 43f6974234..ab63c8e62b 100644 --- a/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go +++ b/vendor/k8s.io/client-go/informers/flowcontrol/v1beta3/prioritylevelconfiguration.go @@ -25,6 +25,7 @@ import ( apiflowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type priorityLevelConfigurationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPriorityLevelConfigurationInformerWithOptions constructs a new informer for PriorityLevelConfiguration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityLevelConfigurationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta3", Resource: "prioritylevelconfigurations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().PriorityLevelConfigurations().List(context.Background(), options) + return client.FlowcontrolV1beta3().PriorityLevelConfigurations().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().PriorityLevelConfigurations().Watch(context.Background(), options) + return client.FlowcontrolV1beta3().PriorityLevelConfigurations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().PriorityLevelConfigurations().List(ctx, options) + return client.FlowcontrolV1beta3().PriorityLevelConfigurations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.FlowcontrolV1beta3().PriorityLevelConfigurations().Watch(ctx, options) + return client.FlowcontrolV1beta3().PriorityLevelConfigurations().Watch(ctx, opts) }, }, client), &apiflowcontrolv1beta3.PriorityLevelConfiguration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPriorityLevelConfigurationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/generic.go b/vendor/k8s.io/client-go/informers/generic.go index 2b7efe7f4a..03c45c71cf 100644 --- a/vendor/k8s.io/client-go/informers/generic.go +++ b/vendor/k8s.io/client-go/informers/generic.go @@ -30,8 +30,6 @@ import ( v1beta2 "k8s.io/api/apps/v1beta2" autoscalingv1 "k8s.io/api/autoscaling/v1" v2 "k8s.io/api/autoscaling/v2" - v2beta1 "k8s.io/api/autoscaling/v2beta1" - v2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1" certificatesv1 "k8s.io/api/certificates/v1" @@ -65,7 +63,7 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" @@ -102,6 +100,10 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=admissionregistration.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingAdmissionPolicies().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingAdmissionPolicyBindings().Informer()}, nil case v1.SchemeGroupVersion.WithResource("mutatingwebhookconfigurations"): return &genericInformer{resource: resource.GroupResource(), informer: f.Admissionregistration().V1().MutatingWebhookConfigurations().Informer()}, nil case v1.SchemeGroupVersion.WithResource("validatingadmissionpolicies"): @@ -175,14 +177,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2().HorizontalPodAutoscalers().Informer()}, nil - // Group=autoscaling, Version=v2beta1 - case v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta1().HorizontalPodAutoscalers().Informer()}, nil - - // Group=autoscaling, Version=v2beta2 - case v2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta2().HorizontalPodAutoscalers().Informer()}, nil - // Group=batch, Version=v1 case batchv1.SchemeGroupVersion.WithResource("cronjobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1().CronJobs().Informer()}, nil @@ -398,6 +392,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=resource.k8s.io, Version=v1alpha3 case v1alpha3.SchemeGroupVersion.WithResource("devicetaintrules"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().DeviceTaintRules().Informer()}, nil + case v1alpha3.SchemeGroupVersion.WithResource("resourcepoolstatusrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1alpha3().ResourcePoolStatusRequests().Informer()}, nil // Group=resource.k8s.io, Version=v1beta1 case resourcev1beta1.SchemeGroupVersion.WithResource("deviceclasses"): @@ -412,6 +408,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=resource.k8s.io, Version=v1beta2 case resourcev1beta2.SchemeGroupVersion.WithResource("deviceclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().DeviceClasses().Informer()}, nil + case resourcev1beta2.SchemeGroupVersion.WithResource("devicetaintrules"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().DeviceTaintRules().Informer()}, nil case resourcev1beta2.SchemeGroupVersion.WithResource("resourceclaims"): return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().ResourceClaims().Informer()}, nil case resourcev1beta2.SchemeGroupVersion.WithResource("resourceclaimtemplates"): @@ -423,11 +421,11 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case schedulingv1.SchemeGroupVersion.WithResource("priorityclasses"): return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1().PriorityClasses().Informer()}, nil - // Group=scheduling.k8s.io, Version=v1alpha1 - case schedulingv1alpha1.SchemeGroupVersion.WithResource("priorityclasses"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().PriorityClasses().Informer()}, nil - case schedulingv1alpha1.SchemeGroupVersion.WithResource("workloads"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha1().Workloads().Informer()}, nil + // Group=scheduling.k8s.io, Version=v1alpha2 + case schedulingv1alpha2.SchemeGroupVersion.WithResource("podgroups"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().PodGroups().Informer()}, nil + case schedulingv1alpha2.SchemeGroupVersion.WithResource("workloads"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduling().V1alpha2().Workloads().Informer()}, nil // Group=scheduling.k8s.io, Version=v1beta1 case schedulingv1beta1.SchemeGroupVersion.WithResource("priorityclasses"): diff --git a/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go b/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go index b00ed70cfd..8740840d73 100644 --- a/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go +++ b/vendor/k8s.io/client-go/informers/internalinterfaces/factory_interfaces.go @@ -34,7 +34,26 @@ type NewInformerFunc func(kubernetes.Interface, time.Duration) cache.SharedIndex type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer + InformerName() *cache.InformerName } // TweakListOptionsFunc is a function that transforms a v1.ListOptions. type TweakListOptionsFunc func(*v1.ListOptions) + +// InformerOptions holds the options for creating an informer. +type InformerOptions struct { + // ResyncPeriod is the resync period for this informer. + // If not set, defaults to 0 (no resync). + ResyncPeriod time.Duration + + // Indexers are the indexers for this informer. + Indexers cache.Indexers + + // InformerName is used to uniquely identify this informer for metrics. + // If not set, metrics will not be published for this informer. + // Use cache.NewInformerName() to create an InformerName at startup. + InformerName *cache.InformerName + + // TweakListOptions is an optional function to modify the list options. + TweakListOptions TweakListOptionsFunc +} diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go index fa7252dfa7..65be7320d1 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/ingress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingress.go @@ -25,6 +25,7 @@ import ( apinetworkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type ingressInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) + return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewIngressInformerWithOptions constructs a new informer for Ingress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ingresss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().Ingresses(namespace).List(context.Background(), options) + return client.NetworkingV1().Ingresses(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().Ingresses(namespace).Watch(context.Background(), options) + return client.NetworkingV1().Ingresses(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().Ingresses(namespace).List(ctx, options) + return client.NetworkingV1().Ingresses(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().Ingresses(namespace).Watch(ctx, options) + return client.NetworkingV1().Ingresses(namespace).Watch(ctx, opts) }, }, client), &apinetworkingv1.Ingress{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go index bd6696a37f..bcb118f991 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/ingressclass.go @@ -25,6 +25,7 @@ import ( apinetworkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type ingressClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) + return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredIngressClassInformer constructs a new informer for IngressClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewIngressClassInformerWithOptions constructs a new informer for IngressClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ingressclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IngressClasses().List(context.Background(), options) + return client.NetworkingV1().IngressClasses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IngressClasses().Watch(context.Background(), options) + return client.NetworkingV1().IngressClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IngressClasses().List(ctx, options) + return client.NetworkingV1().IngressClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IngressClasses().Watch(ctx, options) + return client.NetworkingV1().IngressClasses().Watch(ctx, opts) }, }, client), &apinetworkingv1.IngressClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go b/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go index 8ab3ac5d63..ea4bb280c8 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/ipaddress.go @@ -25,6 +25,7 @@ import ( apinetworkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type iPAddressInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIPAddressInformer(client, resyncPeriod, indexers, nil) + return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredIPAddressInformer constructs a new informer for IPAddress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewIPAddressInformerWithOptions constructs a new informer for IPAddress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIPAddressInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "ipaddresss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IPAddresses().List(context.Background(), options) + return client.NetworkingV1().IPAddresses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IPAddresses().Watch(context.Background(), options) + return client.NetworkingV1().IPAddresses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IPAddresses().List(ctx, options) + return client.NetworkingV1().IPAddresses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().IPAddresses().Watch(ctx, options) + return client.NetworkingV1().IPAddresses().Watch(ctx, opts) }, }, client), &apinetworkingv1.IPAddress{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *iPAddressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIPAddressInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *iPAddressInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go index 1b39b0e6cf..237fe6266d 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/networkpolicy.go @@ -25,6 +25,7 @@ import ( apinetworkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type networkPolicyInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredNetworkPolicyInformer(client, namespace, resyncPeriod, indexers, nil) + return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredNetworkPolicyInformer constructs a new informer for NetworkPolicy type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredNetworkPolicyInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewNetworkPolicyInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewNetworkPolicyInformerWithOptions constructs a new informer for NetworkPolicy type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewNetworkPolicyInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "networkpolicys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().NetworkPolicies(namespace).List(context.Background(), options) + return client.NetworkingV1().NetworkPolicies(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().NetworkPolicies(namespace).Watch(context.Background(), options) + return client.NetworkingV1().NetworkPolicies(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().NetworkPolicies(namespace).List(ctx, options) + return client.NetworkingV1().NetworkPolicies(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().NetworkPolicies(namespace).Watch(ctx, options) + return client.NetworkingV1().NetworkPolicies(namespace).Watch(ctx, opts) }, }, client), &apinetworkingv1.NetworkPolicy{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *networkPolicyInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredNetworkPolicyInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewNetworkPolicyInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *networkPolicyInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go b/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go index 299e40611e..ee1810f817 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go +++ b/vendor/k8s.io/client-go/informers/networking/v1/servicecidr.go @@ -25,6 +25,7 @@ import ( apinetworkingv1 "k8s.io/api/networking/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type serviceCIDRInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredServiceCIDRInformer(client, resyncPeriod, indexers, nil) + return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewServiceCIDRInformerWithOptions constructs a new informer for ServiceCIDR type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceCIDRInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1", Resource: "servicecidrs"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().ServiceCIDRs().List(context.Background(), options) + return client.NetworkingV1().ServiceCIDRs().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().ServiceCIDRs().Watch(context.Background(), options) + return client.NetworkingV1().ServiceCIDRs().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().ServiceCIDRs().List(ctx, options) + return client.NetworkingV1().ServiceCIDRs().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1().ServiceCIDRs().Watch(ctx, options) + return client.NetworkingV1().ServiceCIDRs().Watch(ctx, opts) }, }, client), &apinetworkingv1.ServiceCIDR{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *serviceCIDRInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredServiceCIDRInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceCIDRInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go index 3e279cb544..ba35b8ac70 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingress.go @@ -25,6 +25,7 @@ import ( apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type ingressInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIngressInformer(client, namespace, resyncPeriod, indexers, nil) + return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredIngressInformer constructs a new informer for Ingress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewIngressInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewIngressInformerWithOptions constructs a new informer for Ingress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "ingresss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().Ingresses(namespace).List(context.Background(), options) + return client.NetworkingV1beta1().Ingresses(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().Ingresses(namespace).Watch(context.Background(), options) + return client.NetworkingV1beta1().Ingresses(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().Ingresses(namespace).List(ctx, options) + return client.NetworkingV1beta1().Ingresses(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().Ingresses(namespace).Watch(ctx, options) + return client.NetworkingV1beta1().Ingresses(namespace).Watch(ctx, opts) }, }, client), &apinetworkingv1beta1.Ingress{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *ingressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIngressInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewIngressInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go index 296abfa8c4..97d761a633 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ingressclass.go @@ -25,6 +25,7 @@ import ( apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type ingressClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIngressClassInformer(client, resyncPeriod, indexers, nil) + return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredIngressClassInformer constructs a new informer for IngressClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIngressClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewIngressClassInformerWithOptions constructs a new informer for IngressClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIngressClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "ingressclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IngressClasses().List(context.Background(), options) + return client.NetworkingV1beta1().IngressClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IngressClasses().Watch(context.Background(), options) + return client.NetworkingV1beta1().IngressClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IngressClasses().List(ctx, options) + return client.NetworkingV1beta1().IngressClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IngressClasses().Watch(ctx, options) + return client.NetworkingV1beta1().IngressClasses().Watch(ctx, opts) }, }, client), &apinetworkingv1beta1.IngressClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *ingressClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIngressClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewIngressClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *ingressClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go index 94f785f10d..fd94392393 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/ipaddress.go @@ -25,6 +25,7 @@ import ( apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type iPAddressInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredIPAddressInformer(client, resyncPeriod, indexers, nil) + return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredIPAddressInformer constructs a new informer for IPAddress type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredIPAddressInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewIPAddressInformerWithOptions constructs a new informer for IPAddress type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewIPAddressInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "ipaddresss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IPAddresses().List(context.Background(), options) + return client.NetworkingV1beta1().IPAddresses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IPAddresses().Watch(context.Background(), options) + return client.NetworkingV1beta1().IPAddresses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IPAddresses().List(ctx, options) + return client.NetworkingV1beta1().IPAddresses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().IPAddresses().Watch(ctx, options) + return client.NetworkingV1beta1().IPAddresses().Watch(ctx, opts) }, }, client), &apinetworkingv1beta1.IPAddress{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *iPAddressInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredIPAddressInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewIPAddressInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *iPAddressInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go b/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go index 6777646396..6fe8c3bd11 100644 --- a/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go +++ b/vendor/k8s.io/client-go/informers/networking/v1beta1/servicecidr.go @@ -25,6 +25,7 @@ import ( apinetworkingv1beta1 "k8s.io/api/networking/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type serviceCIDRInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredServiceCIDRInformer(client, resyncPeriod, indexers, nil) + return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredServiceCIDRInformer constructs a new informer for ServiceCIDR type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredServiceCIDRInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewServiceCIDRInformerWithOptions constructs a new informer for ServiceCIDR type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewServiceCIDRInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "networking.k8s.io", Version: "v1beta1", Resource: "servicecidrs"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().ServiceCIDRs().List(context.Background(), options) + return client.NetworkingV1beta1().ServiceCIDRs().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().ServiceCIDRs().Watch(context.Background(), options) + return client.NetworkingV1beta1().ServiceCIDRs().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().ServiceCIDRs().List(ctx, options) + return client.NetworkingV1beta1().ServiceCIDRs().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NetworkingV1beta1().ServiceCIDRs().Watch(ctx, options) + return client.NetworkingV1beta1().ServiceCIDRs().Watch(ctx, opts) }, }, client), &apinetworkingv1beta1.ServiceCIDR{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *serviceCIDRInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredServiceCIDRInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewServiceCIDRInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *serviceCIDRInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go index d794c56951..3b7d4a25d2 100644 --- a/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go +++ b/vendor/k8s.io/client-go/informers/node/v1/runtimeclass.go @@ -25,6 +25,7 @@ import ( apinodev1 "k8s.io/api/node/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type runtimeClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "node.k8s.io", Version: "v1", Resource: "runtimeclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1().RuntimeClasses().List(context.Background(), options) + return client.NodeV1().RuntimeClasses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1().RuntimeClasses().Watch(context.Background(), options) + return client.NodeV1().RuntimeClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1().RuntimeClasses().List(ctx, options) + return client.NodeV1().RuntimeClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1().RuntimeClasses().Watch(ctx, options) + return client.NodeV1().RuntimeClasses().Watch(ctx, opts) }, }, client), &apinodev1.RuntimeClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go index 01718ac102..1907a122d2 100644 --- a/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go +++ b/vendor/k8s.io/client-go/informers/node/v1alpha1/runtimeclass.go @@ -25,6 +25,7 @@ import ( apinodev1alpha1 "k8s.io/api/node/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type runtimeClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "node.k8s.io", Version: "v1alpha1", Resource: "runtimeclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1alpha1().RuntimeClasses().List(context.Background(), options) + return client.NodeV1alpha1().RuntimeClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1alpha1().RuntimeClasses().Watch(context.Background(), options) + return client.NodeV1alpha1().RuntimeClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1alpha1().RuntimeClasses().List(ctx, options) + return client.NodeV1alpha1().RuntimeClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1alpha1().RuntimeClasses().Watch(ctx, options) + return client.NodeV1alpha1().RuntimeClasses().Watch(ctx, opts) }, }, client), &apinodev1alpha1.RuntimeClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go index 09390f58b4..ca7e9307ac 100644 --- a/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go +++ b/vendor/k8s.io/client-go/informers/node/v1beta1/runtimeclass.go @@ -25,6 +25,7 @@ import ( apinodev1beta1 "k8s.io/api/node/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type runtimeClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformer(client, resyncPeriod, indexers, nil) + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRuntimeClassInformer constructs a new informer for RuntimeClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRuntimeClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRuntimeClassInformerWithOptions constructs a new informer for RuntimeClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRuntimeClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "node.k8s.io", Version: "v1beta1", Resource: "runtimeclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1beta1().RuntimeClasses().List(context.Background(), options) + return client.NodeV1beta1().RuntimeClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1beta1().RuntimeClasses().Watch(context.Background(), options) + return client.NodeV1beta1().RuntimeClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1beta1().RuntimeClasses().List(ctx, options) + return client.NodeV1beta1().RuntimeClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.NodeV1beta1().RuntimeClasses().Watch(ctx, options) + return client.NodeV1beta1().RuntimeClasses().Watch(ctx, opts) }, }, client), &apinodev1beta1.RuntimeClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *runtimeClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRuntimeClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRuntimeClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *runtimeClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go index 10e45d851e..2945e543d7 100644 --- a/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go +++ b/vendor/k8s.io/client-go/informers/policy/v1/poddisruptionbudget.go @@ -25,6 +25,7 @@ import ( apipolicyv1 "k8s.io/api/policy/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type podDisruptionBudgetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPodDisruptionBudgetInformerWithOptions constructs a new informer for PodDisruptionBudget type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "policy", Version: "v1", Resource: "poddisruptionbudgets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1().PodDisruptionBudgets(namespace).List(context.Background(), options) + return client.PolicyV1().PodDisruptionBudgets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1().PodDisruptionBudgets(namespace).Watch(context.Background(), options) + return client.PolicyV1().PodDisruptionBudgets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1().PodDisruptionBudgets(namespace).List(ctx, options) + return client.PolicyV1().PodDisruptionBudgets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1().PodDisruptionBudgets(namespace).Watch(ctx, options) + return client.PolicyV1().PodDisruptionBudgets(namespace).Watch(ctx, opts) }, }, client), &apipolicyv1.PodDisruptionBudget{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPodDisruptionBudgetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go index a45d753eb6..70c79683fe 100644 --- a/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go +++ b/vendor/k8s.io/client-go/informers/policy/v1beta1/poddisruptionbudget.go @@ -25,6 +25,7 @@ import ( apipolicyv1beta1 "k8s.io/api/policy/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type podDisruptionBudgetInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPodDisruptionBudgetInformer(client, namespace, resyncPeriod, indexers, nil) + return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPodDisruptionBudgetInformer constructs a new informer for PodDisruptionBudget type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPodDisruptionBudgetInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPodDisruptionBudgetInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPodDisruptionBudgetInformerWithOptions constructs a new informer for PodDisruptionBudget type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodDisruptionBudgetInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "policy", Version: "v1beta1", Resource: "poddisruptionbudgets"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1beta1().PodDisruptionBudgets(namespace).List(context.Background(), options) + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1beta1().PodDisruptionBudgets(namespace).Watch(context.Background(), options) + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1beta1().PodDisruptionBudgets(namespace).List(ctx, options) + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.PolicyV1beta1().PodDisruptionBudgets(namespace).Watch(ctx, options) + return client.PolicyV1beta1().PodDisruptionBudgets(namespace).Watch(ctx, opts) }, }, client), &apipolicyv1beta1.PodDisruptionBudget{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *podDisruptionBudgetInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPodDisruptionBudgetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPodDisruptionBudgetInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *podDisruptionBudgetInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go index 02dab4f9a6..d938be79ee 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrole.go @@ -25,6 +25,7 @@ import ( apirbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterRoleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterroles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoles().List(context.Background(), options) + return client.RbacV1().ClusterRoles().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoles().Watch(context.Background(), options) + return client.RbacV1().ClusterRoles().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoles().List(ctx, options) + return client.RbacV1().ClusterRoles().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoles().Watch(ctx, options) + return client.RbacV1().ClusterRoles().Watch(ctx, opts) }, }, client), &apirbacv1.ClusterRole{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go index 182009da85..72fe655da8 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/clusterrolebinding.go @@ -25,6 +25,7 @@ import ( apirbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterRoleBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "clusterrolebindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoleBindings().List(context.Background(), options) + return client.RbacV1().ClusterRoleBindings().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoleBindings().Watch(context.Background(), options) + return client.RbacV1().ClusterRoleBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoleBindings().List(ctx, options) + return client.RbacV1().ClusterRoleBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().ClusterRoleBindings().Watch(ctx, options) + return client.RbacV1().ClusterRoleBindings().Watch(ctx, opts) }, }, client), &apirbacv1.ClusterRoleBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1/role.go index 5a0a1f8003..f66decf040 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/role.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/role.go @@ -25,6 +25,7 @@ import ( apirbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type roleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) + return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRoleInformerWithOptions constructs a new informer for Role type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "roles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().Roles(namespace).List(context.Background(), options) + return client.RbacV1().Roles(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().Roles(namespace).Watch(context.Background(), options) + return client.RbacV1().Roles(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().Roles(namespace).List(ctx, options) + return client.RbacV1().Roles(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().Roles(namespace).Watch(ctx, options) + return client.RbacV1().Roles(namespace).Watch(ctx, opts) }, }, client), &apirbacv1.Role{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go index 0f0eec60f8..c17b1c474f 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1/rolebinding.go @@ -25,6 +25,7 @@ import ( apirbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type roleBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) + return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1", Resource: "rolebindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().RoleBindings(namespace).List(context.Background(), options) + return client.RbacV1().RoleBindings(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().RoleBindings(namespace).Watch(context.Background(), options) + return client.RbacV1().RoleBindings(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().RoleBindings(namespace).List(ctx, options) + return client.RbacV1().RoleBindings(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1().RoleBindings(namespace).Watch(ctx, options) + return client.RbacV1().RoleBindings(namespace).Watch(ctx, opts) }, }, client), &apirbacv1.RoleBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go index e1b25180b9..cac4ba05b9 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrole.go @@ -25,6 +25,7 @@ import ( apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterRoleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterroles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoles().List(context.Background(), options) + return client.RbacV1alpha1().ClusterRoles().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoles().Watch(context.Background(), options) + return client.RbacV1alpha1().ClusterRoles().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoles().List(ctx, options) + return client.RbacV1alpha1().ClusterRoles().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoles().Watch(ctx, options) + return client.RbacV1alpha1().ClusterRoles().Watch(ctx, opts) }, }, client), &apirbacv1alpha1.ClusterRole{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go index d61e8b2930..944e16cef6 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/clusterrolebinding.go @@ -25,6 +25,7 @@ import ( apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterRoleBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterrolebindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoleBindings().List(context.Background(), options) + return client.RbacV1alpha1().ClusterRoleBindings().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoleBindings().Watch(context.Background(), options) + return client.RbacV1alpha1().ClusterRoleBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoleBindings().List(ctx, options) + return client.RbacV1alpha1().ClusterRoleBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().ClusterRoleBindings().Watch(ctx, options) + return client.RbacV1alpha1().ClusterRoleBindings().Watch(ctx, opts) }, }, client), &apirbacv1alpha1.ClusterRoleBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go index 497bccbba1..c4e2a6cf6c 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/role.go @@ -25,6 +25,7 @@ import ( apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type roleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) + return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRoleInformerWithOptions constructs a new informer for Role type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "roles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().Roles(namespace).List(context.Background(), options) + return client.RbacV1alpha1().Roles(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().Roles(namespace).Watch(context.Background(), options) + return client.RbacV1alpha1().Roles(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().Roles(namespace).List(ctx, options) + return client.RbacV1alpha1().Roles(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().Roles(namespace).Watch(ctx, options) + return client.RbacV1alpha1().Roles(namespace).Watch(ctx, opts) }, }, client), &apirbacv1alpha1.Role{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go index 0d8b390b30..ef1e246f5b 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1alpha1/rolebinding.go @@ -25,6 +25,7 @@ import ( apirbacv1alpha1 "k8s.io/api/rbac/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type roleBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) + return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "rolebindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().RoleBindings(namespace).List(context.Background(), options) + return client.RbacV1alpha1().RoleBindings(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().RoleBindings(namespace).Watch(context.Background(), options) + return client.RbacV1alpha1().RoleBindings(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().RoleBindings(namespace).List(ctx, options) + return client.RbacV1alpha1().RoleBindings(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1alpha1().RoleBindings(namespace).Watch(ctx, options) + return client.RbacV1alpha1().RoleBindings(namespace).Watch(ctx, opts) }, }, client), &apirbacv1alpha1.RoleBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go index 1cc1a0dd00..df87d468ca 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrole.go @@ -25,6 +25,7 @@ import ( apirbacv1beta1 "k8s.io/api/rbac/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterRoleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformer(client, resyncPeriod, indexers, nil) + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterRoleInformer constructs a new informer for ClusterRole type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterRoleInformerWithOptions constructs a new informer for ClusterRole type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterroles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoles().List(context.Background(), options) + return client.RbacV1beta1().ClusterRoles().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoles().Watch(context.Background(), options) + return client.RbacV1beta1().ClusterRoles().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoles().List(ctx, options) + return client.RbacV1beta1().ClusterRoles().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoles().Watch(ctx, options) + return client.RbacV1beta1().ClusterRoles().Watch(ctx, opts) }, }, client), &apirbacv1beta1.ClusterRole{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterRoleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterRoleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterRoleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go index a96ed0889a..9f14c10daf 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/clusterrolebinding.go @@ -25,6 +25,7 @@ import ( apirbacv1beta1 "k8s.io/api/rbac/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type clusterRoleBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, indexers, nil) + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredClusterRoleBindingInformer constructs a new informer for ClusterRoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredClusterRoleBindingInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewClusterRoleBindingInformerWithOptions constructs a new informer for ClusterRoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewClusterRoleBindingInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "clusterrolebindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoleBindings().List(context.Background(), options) + return client.RbacV1beta1().ClusterRoleBindings().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoleBindings().Watch(context.Background(), options) + return client.RbacV1beta1().ClusterRoleBindings().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoleBindings().List(ctx, options) + return client.RbacV1beta1().ClusterRoleBindings().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().ClusterRoleBindings().Watch(ctx, options) + return client.RbacV1beta1().ClusterRoleBindings().Watch(ctx, opts) }, }, client), &apirbacv1beta1.ClusterRoleBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *clusterRoleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredClusterRoleBindingInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewClusterRoleBindingInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *clusterRoleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go index 922ac5dc5c..4dd948f167 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/role.go @@ -25,6 +25,7 @@ import ( apirbacv1beta1 "k8s.io/api/rbac/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type roleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRoleInformer(client, namespace, resyncPeriod, indexers, nil) + return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRoleInformer constructs a new informer for Role type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRoleInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRoleInformerWithOptions constructs a new informer for Role type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "roles"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().Roles(namespace).List(context.Background(), options) + return client.RbacV1beta1().Roles(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().Roles(namespace).Watch(context.Background(), options) + return client.RbacV1beta1().Roles(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().Roles(namespace).List(ctx, options) + return client.RbacV1beta1().Roles(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().Roles(namespace).Watch(ctx, options) + return client.RbacV1beta1().Roles(namespace).Watch(ctx, opts) }, }, client), &apirbacv1beta1.Role{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *roleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRoleInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRoleInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go index 5fcd488493..882d59471e 100644 --- a/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go +++ b/vendor/k8s.io/client-go/informers/rbac/v1beta1/rolebinding.go @@ -25,6 +25,7 @@ import ( apirbacv1beta1 "k8s.io/api/rbac/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type roleBindingInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformer(client, namespace, resyncPeriod, indexers, nil) + return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredRoleBindingInformer constructs a new informer for RoleBinding type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredRoleBindingInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewRoleBindingInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewRoleBindingInformerWithOptions constructs a new informer for RoleBinding type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewRoleBindingInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1beta1", Resource: "rolebindings"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().RoleBindings(namespace).List(context.Background(), options) + return client.RbacV1beta1().RoleBindings(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().RoleBindings(namespace).Watch(context.Background(), options) + return client.RbacV1beta1().RoleBindings(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().RoleBindings(namespace).List(ctx, options) + return client.RbacV1beta1().RoleBindings(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.RbacV1beta1().RoleBindings(namespace).Watch(ctx, options) + return client.RbacV1beta1().RoleBindings(namespace).Watch(ctx, opts) }, }, client), &apirbacv1beta1.RoleBinding{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *roleBindingInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredRoleBindingInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewRoleBindingInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *roleBindingInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go b/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go index 867bb7b35e..bacc65a28f 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/deviceclass.go @@ -25,6 +25,7 @@ import ( apiresourcev1 "k8s.io/api/resource/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type deviceClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeviceClassInformer(client, resyncPeriod, indexers, nil) + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "deviceclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().DeviceClasses().List(context.Background(), options) + return client.ResourceV1().DeviceClasses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().DeviceClasses().Watch(context.Background(), options) + return client.ResourceV1().DeviceClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().DeviceClasses().List(ctx, options) + return client.ResourceV1().DeviceClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().DeviceClasses().Watch(ctx, options) + return client.ResourceV1().DeviceClasses().Watch(ctx, opts) }, }, client), &apiresourcev1.DeviceClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeviceClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go index 64deaed694..996cc77f61 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaim.go @@ -25,6 +25,7 @@ import ( apiresourcev1 "k8s.io/api/resource/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type resourceClaimInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceClaimInformer(client, namespace, resyncPeriod, indexers, nil) + return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "resourceclaims"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaims(namespace).List(context.Background(), options) + return client.ResourceV1().ResourceClaims(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaims(namespace).Watch(context.Background(), options) + return client.ResourceV1().ResourceClaims(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaims(namespace).List(ctx, options) + return client.ResourceV1().ResourceClaims(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaims(namespace).Watch(ctx, options) + return client.ResourceV1().ResourceClaims(namespace).Watch(ctx, opts) }, }, client), &apiresourcev1.ResourceClaim{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go index 131e159ef9..e562314dc1 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/resourceclaimtemplate.go @@ -25,6 +25,7 @@ import ( apiresourcev1 "k8s.io/api/resource/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type resourceClaimTemplateInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceClaimTemplateInformer(client, namespace, resyncPeriod, indexers, nil) + return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "resourceclaimtemplates"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaimTemplates(namespace).List(context.Background(), options) + return client.ResourceV1().ResourceClaimTemplates(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaimTemplates(namespace).Watch(context.Background(), options) + return client.ResourceV1().ResourceClaimTemplates(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaimTemplates(namespace).List(ctx, options) + return client.ResourceV1().ResourceClaimTemplates(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceClaimTemplates(namespace).Watch(ctx, options) + return client.ResourceV1().ResourceClaimTemplates(namespace).Watch(ctx, opts) }, }, client), &apiresourcev1.ResourceClaimTemplate{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceClaimTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go b/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go index a01abf0739..85c877f803 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go +++ b/vendor/k8s.io/client-go/informers/resource/v1/resourceslice.go @@ -25,6 +25,7 @@ import ( apiresourcev1 "k8s.io/api/resource/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type resourceSliceInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceSliceInformer(client, resyncPeriod, indexers, nil) + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1", Resource: "resourceslices"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceSlices().List(context.Background(), options) + return client.ResourceV1().ResourceSlices().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceSlices().Watch(context.Background(), options) + return client.ResourceV1().ResourceSlices().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceSlices().List(ctx, options) + return client.ResourceV1().ResourceSlices().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1().ResourceSlices().Watch(ctx, options) + return client.ResourceV1().ResourceSlices().Watch(ctx, opts) }, }, client), &apiresourcev1.ResourceSlice{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceSliceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go b/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go index 0fdc88ac59..0b0029ab54 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go +++ b/vendor/k8s.io/client-go/informers/resource/v1alpha3/devicetaintrule.go @@ -25,6 +25,7 @@ import ( apiresourcev1alpha3 "k8s.io/api/resource/v1alpha3" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type deviceTaintRuleInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeviceTaintRuleInformer(client, resyncPeriod, indexers, nil) + return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1alpha3", Resource: "devicetaintrules"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1alpha3().DeviceTaintRules().List(context.Background(), options) + return client.ResourceV1alpha3().DeviceTaintRules().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1alpha3().DeviceTaintRules().Watch(context.Background(), options) + return client.ResourceV1alpha3().DeviceTaintRules().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1alpha3().DeviceTaintRules().List(ctx, options) + return client.ResourceV1alpha3().DeviceTaintRules().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1alpha3().DeviceTaintRules().Watch(ctx, options) + return client.ResourceV1alpha3().DeviceTaintRules().Watch(ctx, opts) }, }, client), &apiresourcev1alpha3.DeviceTaintRule{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deviceTaintRuleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeviceTaintRuleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceTaintRuleInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go b/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go index 1fbab52b6f..b305681236 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go +++ b/vendor/k8s.io/client-go/informers/resource/v1alpha3/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // DeviceTaintRules returns a DeviceTaintRuleInformer. DeviceTaintRules() DeviceTaintRuleInformer + // ResourcePoolStatusRequests returns a ResourcePoolStatusRequestInformer. + ResourcePoolStatusRequests() ResourcePoolStatusRequestInformer } type version struct { @@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList func (v *version) DeviceTaintRules() DeviceTaintRuleInformer { return &deviceTaintRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } + +// ResourcePoolStatusRequests returns a ResourcePoolStatusRequestInformer. +func (v *version) ResourcePoolStatusRequests() ResourcePoolStatusRequestInformer { + return &resourcePoolStatusRequestInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go b/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go new file mode 100644 index 0000000000..f34d57e138 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/resource/v1alpha3/resourcepoolstatusrequest.go @@ -0,0 +1,115 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + time "time" + + apiresourcev1alpha3 "k8s.io/api/resource/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + resourcev1alpha3 "k8s.io/client-go/listers/resource/v1alpha3" + cache "k8s.io/client-go/tools/cache" +) + +// ResourcePoolStatusRequestInformer provides access to a shared informer and lister for +// ResourcePoolStatusRequests. +type ResourcePoolStatusRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() resourcev1alpha3.ResourcePoolStatusRequestLister +} + +type resourcePoolStatusRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewResourcePoolStatusRequestInformer constructs a new informer for ResourcePoolStatusRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourcePoolStatusRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredResourcePoolStatusRequestInformer constructs a new informer for ResourcePoolStatusRequest type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredResourcePoolStatusRequestInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourcePoolStatusRequestInformerWithOptions constructs a new informer for ResourcePoolStatusRequest type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourcePoolStatusRequestInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1alpha3", Resource: "resourcepoolstatusrequests"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1alpha3().ResourcePoolStatusRequests().List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1alpha3().ResourcePoolStatusRequests().Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1alpha3().ResourcePoolStatusRequests().List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1alpha3().ResourcePoolStatusRequests().Watch(ctx, opts) + }, + }, client), + &apiresourcev1alpha3.ResourcePoolStatusRequest{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *resourcePoolStatusRequestInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewResourcePoolStatusRequestInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *resourcePoolStatusRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiresourcev1alpha3.ResourcePoolStatusRequest{}, f.defaultInformer) +} + +func (f *resourcePoolStatusRequestInformer) Lister() resourcev1alpha3.ResourcePoolStatusRequestLister { + return resourcev1alpha3.NewResourcePoolStatusRequestLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go index cb15fbc08f..0a4d4bea64 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/deviceclass.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type deviceClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeviceClassInformer(client, resyncPeriod, indexers, nil) + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "deviceclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().DeviceClasses().List(context.Background(), options) + return client.ResourceV1beta1().DeviceClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().DeviceClasses().Watch(context.Background(), options) + return client.ResourceV1beta1().DeviceClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().DeviceClasses().List(ctx, options) + return client.ResourceV1beta1().DeviceClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().DeviceClasses().Watch(ctx, options) + return client.ResourceV1beta1().DeviceClasses().Watch(ctx, opts) }, }, client), &apiresourcev1beta1.DeviceClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeviceClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go index 982c598515..9ec1ece317 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaim.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type resourceClaimInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceClaimInformer(client, namespace, resyncPeriod, indexers, nil) + return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "resourceclaims"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaims(namespace).List(context.Background(), options) + return client.ResourceV1beta1().ResourceClaims(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaims(namespace).Watch(context.Background(), options) + return client.ResourceV1beta1().ResourceClaims(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaims(namespace).List(ctx, options) + return client.ResourceV1beta1().ResourceClaims(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaims(namespace).Watch(ctx, options) + return client.ResourceV1beta1().ResourceClaims(namespace).Watch(ctx, opts) }, }, client), &apiresourcev1beta1.ResourceClaim{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go index 51a6381af6..b6aa9cb919 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceclaimtemplate.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type resourceClaimTemplateInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceClaimTemplateInformer(client, namespace, resyncPeriod, indexers, nil) + return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "resourceclaimtemplates"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaimTemplates(namespace).List(context.Background(), options) + return client.ResourceV1beta1().ResourceClaimTemplates(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaimTemplates(namespace).Watch(context.Background(), options) + return client.ResourceV1beta1().ResourceClaimTemplates(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaimTemplates(namespace).List(ctx, options) + return client.ResourceV1beta1().ResourceClaimTemplates(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceClaimTemplates(namespace).Watch(ctx, options) + return client.ResourceV1beta1().ResourceClaimTemplates(namespace).Watch(ctx, opts) }, }, client), &apiresourcev1beta1.ResourceClaimTemplate{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceClaimTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go index b6b1cc1fdc..39e971aec2 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta1/resourceslice.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta1 "k8s.io/api/resource/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type resourceSliceInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceSliceInformer(client, resyncPeriod, indexers, nil) + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta1", Resource: "resourceslices"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceSlices().List(context.Background(), options) + return client.ResourceV1beta1().ResourceSlices().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceSlices().Watch(context.Background(), options) + return client.ResourceV1beta1().ResourceSlices().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceSlices().List(ctx, options) + return client.ResourceV1beta1().ResourceSlices().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta1().ResourceSlices().Watch(ctx, options) + return client.ResourceV1beta1().ResourceSlices().Watch(ctx, opts) }, }, client), &apiresourcev1beta1.ResourceSlice{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceSliceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go index a940a214f4..d98b4d658e 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/deviceclass.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta2 "k8s.io/api/resource/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type deviceClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredDeviceClassInformer(client, resyncPeriod, indexers, nil) + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredDeviceClassInformer constructs a new informer for DeviceClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredDeviceClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeviceClassInformerWithOptions constructs a new informer for DeviceClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeviceClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "deviceclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().DeviceClasses().List(context.Background(), options) + return client.ResourceV1beta2().DeviceClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().DeviceClasses().Watch(context.Background(), options) + return client.ResourceV1beta2().DeviceClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().DeviceClasses().List(ctx, options) + return client.ResourceV1beta2().DeviceClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().DeviceClasses().Watch(ctx, options) + return client.ResourceV1beta2().DeviceClasses().Watch(ctx, opts) }, }, client), &apiresourcev1beta2.DeviceClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *deviceClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredDeviceClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewDeviceClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *deviceClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go new file mode 100644 index 0000000000..328a9c3939 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/devicetaintrule.go @@ -0,0 +1,115 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1beta2 + +import ( + context "context" + time "time" + + apiresourcev1beta2 "k8s.io/api/resource/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + resourcev1beta2 "k8s.io/client-go/listers/resource/v1beta2" + cache "k8s.io/client-go/tools/cache" +) + +// DeviceTaintRuleInformer provides access to a shared informer and lister for +// DeviceTaintRules. +type DeviceTaintRuleInformer interface { + Informer() cache.SharedIndexInformer + Lister() resourcev1beta2.DeviceTaintRuleLister +} + +type deviceTaintRuleInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "devicetaintrules"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1beta2().DeviceTaintRules().List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1beta2().DeviceTaintRules().Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1beta2().DeviceTaintRules().List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.ResourceV1beta2().DeviceTaintRules().Watch(ctx, opts) + }, + }, client), + &apiresourcev1beta2.DeviceTaintRule{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *deviceTaintRuleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *deviceTaintRuleInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apiresourcev1beta2.DeviceTaintRule{}, f.defaultInformer) +} + +func (f *deviceTaintRuleInformer) Lister() resourcev1beta2.DeviceTaintRuleLister { + return resourcev1beta2.NewDeviceTaintRuleLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go index 4627d6f3e2..a05e518e2e 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // DeviceClasses returns a DeviceClassInformer. DeviceClasses() DeviceClassInformer + // DeviceTaintRules returns a DeviceTaintRuleInformer. + DeviceTaintRules() DeviceTaintRuleInformer // ResourceClaims returns a ResourceClaimInformer. ResourceClaims() ResourceClaimInformer // ResourceClaimTemplates returns a ResourceClaimTemplateInformer. @@ -50,6 +52,11 @@ func (v *version) DeviceClasses() DeviceClassInformer { return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// DeviceTaintRules returns a DeviceTaintRuleInformer. +func (v *version) DeviceTaintRules() DeviceTaintRuleInformer { + return &deviceTaintRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // ResourceClaims returns a ResourceClaimInformer. func (v *version) ResourceClaims() ResourceClaimInformer { return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go index a5c085c2f0..61dc6db17d 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaim.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta2 "k8s.io/api/resource/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type resourceClaimInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceClaimInformer(client, namespace, resyncPeriod, indexers, nil) + return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceClaimInformer constructs a new informer for ResourceClaim type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceClaimInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceClaimInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceClaimInformerWithOptions constructs a new informer for ResourceClaim type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceClaimInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "resourceclaims"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaims(namespace).List(context.Background(), options) + return client.ResourceV1beta2().ResourceClaims(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaims(namespace).Watch(context.Background(), options) + return client.ResourceV1beta2().ResourceClaims(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaims(namespace).List(ctx, options) + return client.ResourceV1beta2().ResourceClaims(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaims(namespace).Watch(ctx, options) + return client.ResourceV1beta2().ResourceClaims(namespace).Watch(ctx, opts) }, }, client), &apiresourcev1beta2.ResourceClaim{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceClaimInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceClaimInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceClaimInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go index 7df9f74dd5..ee22977a39 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceclaimtemplate.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta2 "k8s.io/api/resource/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type resourceClaimTemplateInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceClaimTemplateInformer(client, namespace, resyncPeriod, indexers, nil) + return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceClaimTemplateInformer constructs a new informer for ResourceClaimTemplate type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceClaimTemplateInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceClaimTemplateInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceClaimTemplateInformerWithOptions constructs a new informer for ResourceClaimTemplate type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceClaimTemplateInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "resourceclaimtemplates"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaimTemplates(namespace).List(context.Background(), options) + return client.ResourceV1beta2().ResourceClaimTemplates(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaimTemplates(namespace).Watch(context.Background(), options) + return client.ResourceV1beta2().ResourceClaimTemplates(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaimTemplates(namespace).List(ctx, options) + return client.ResourceV1beta2().ResourceClaimTemplates(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceClaimTemplates(namespace).Watch(ctx, options) + return client.ResourceV1beta2().ResourceClaimTemplates(namespace).Watch(ctx, opts) }, }, client), &apiresourcev1beta2.ResourceClaimTemplate{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceClaimTemplateInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceClaimTemplateInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceClaimTemplateInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceClaimTemplateInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go index 83e6cc037a..7a8027886e 100644 --- a/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go +++ b/vendor/k8s.io/client-go/informers/resource/v1beta2/resourceslice.go @@ -25,6 +25,7 @@ import ( apiresourcev1beta2 "k8s.io/api/resource/v1beta2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type resourceSliceInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredResourceSliceInformer(client, resyncPeriod, indexers, nil) + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredResourceSliceInformer constructs a new informer for ResourceSlice type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredResourceSliceInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewResourceSliceInformerWithOptions constructs a new informer for ResourceSlice type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewResourceSliceInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "resourceslices"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceSlices().List(context.Background(), options) + return client.ResourceV1beta2().ResourceSlices().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceSlices().Watch(context.Background(), options) + return client.ResourceV1beta2().ResourceSlices().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceSlices().List(ctx, options) + return client.ResourceV1beta2().ResourceSlices().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.ResourceV1beta2().ResourceSlices().Watch(ctx, options) + return client.ResourceV1beta2().ResourceSlices().Watch(ctx, opts) }, }, client), &apiresourcev1beta2.ResourceSlice{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *resourceSliceInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredResourceSliceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewResourceSliceInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *resourceSliceInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/scheduling/interface.go b/vendor/k8s.io/client-go/informers/scheduling/interface.go index 659089b531..e55a8410d1 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/interface.go +++ b/vendor/k8s.io/client-go/informers/scheduling/interface.go @@ -21,7 +21,7 @@ package scheduling import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" v1 "k8s.io/client-go/informers/scheduling/v1" - v1alpha1 "k8s.io/client-go/informers/scheduling/v1alpha1" + v1alpha2 "k8s.io/client-go/informers/scheduling/v1alpha2" v1beta1 "k8s.io/client-go/informers/scheduling/v1beta1" ) @@ -29,8 +29,8 @@ import ( type Interface interface { // V1 provides access to shared informers for resources in V1. V1() v1.Interface - // V1alpha1 provides access to shared informers for resources in V1alpha1. - V1alpha1() v1alpha1.Interface + // V1alpha2 provides access to shared informers for resources in V1alpha2. + V1alpha2() v1alpha2.Interface // V1beta1 provides access to shared informers for resources in V1beta1. V1beta1() v1beta1.Interface } @@ -51,9 +51,9 @@ func (g *group) V1() v1.Interface { return v1.New(g.factory, g.namespace, g.tweakListOptions) } -// V1alpha1 returns a new v1alpha1.Interface. -func (g *group) V1alpha1() v1alpha1.Interface { - return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +// V1alpha2 returns a new v1alpha2.Interface. +func (g *group) V1alpha2() v1alpha2.Interface { + return v1alpha2.New(g.factory, g.namespace, g.tweakListOptions) } // V1beta1 returns a new v1beta1.Interface. diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go index 8cce79ce23..f1d18f2a01 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1/priorityclass.go @@ -25,6 +25,7 @@ import ( apischedulingv1 "k8s.io/api/scheduling/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type priorityClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) + return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPriorityClassInformerWithOptions constructs a new informer for PriorityClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1", Resource: "priorityclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1().PriorityClasses().List(context.Background(), options) + return client.SchedulingV1().PriorityClasses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1().PriorityClasses().Watch(context.Background(), options) + return client.SchedulingV1().PriorityClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1().PriorityClasses().List(ctx, options) + return client.SchedulingV1().PriorityClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1().PriorityClasses().Watch(ctx, options) + return client.SchedulingV1().PriorityClasses().Watch(ctx, opts) }, }, client), &apischedulingv1.PriorityClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go deleted file mode 100644 index 88f99a7d00..0000000000 --- a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/priorityclass.go +++ /dev/null @@ -1,101 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - context "context" - time "time" - - apischedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" - kubernetes "k8s.io/client-go/kubernetes" - schedulingv1alpha1 "k8s.io/client-go/listers/scheduling/v1alpha1" - cache "k8s.io/client-go/tools/cache" -) - -// PriorityClassInformer provides access to a shared informer and lister for -// PriorityClasses. -type PriorityClassInformer interface { - Informer() cache.SharedIndexInformer - Lister() schedulingv1alpha1.PriorityClassLister -} - -type priorityClassInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc -} - -// NewPriorityClassInformer constructs a new informer for PriorityClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) -} - -// NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().PriorityClasses().List(context.Background(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().PriorityClasses().Watch(context.Background(), options) - }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().PriorityClasses().List(ctx, options) - }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().PriorityClasses().Watch(ctx, options) - }, - }, client), - &apischedulingv1alpha1.PriorityClass{}, - resyncPeriod, - indexers, - ) -} - -func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apischedulingv1alpha1.PriorityClass{}, f.defaultInformer) -} - -func (f *priorityClassInformer) Lister() schedulingv1alpha1.PriorityClassLister { - return schedulingv1alpha1.NewPriorityClassLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/workload.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/workload.go deleted file mode 100644 index c58e788946..0000000000 --- a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/workload.go +++ /dev/null @@ -1,102 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by informer-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - context "context" - time "time" - - apischedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - runtime "k8s.io/apimachinery/pkg/runtime" - watch "k8s.io/apimachinery/pkg/watch" - internalinterfaces "k8s.io/client-go/informers/internalinterfaces" - kubernetes "k8s.io/client-go/kubernetes" - schedulingv1alpha1 "k8s.io/client-go/listers/scheduling/v1alpha1" - cache "k8s.io/client-go/tools/cache" -) - -// WorkloadInformer provides access to a shared informer and lister for -// Workloads. -type WorkloadInformer interface { - Informer() cache.SharedIndexInformer - Lister() schedulingv1alpha1.WorkloadLister -} - -type workloadInformer struct { - factory internalinterfaces.SharedInformerFactory - tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string -} - -// NewWorkloadInformer constructs a new informer for Workload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredWorkloadInformer(client, namespace, resyncPeriod, indexers, nil) -} - -// NewFilteredWorkloadInformer constructs a new informer for Workload type. -// Always prefer using an informer factory to get a shared informer instead of getting an independent -// one. This reduces memory footprint and number of connections to the server. -func NewFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( - cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().Workloads(namespace).List(context.Background(), options) - }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().Workloads(namespace).Watch(context.Background(), options) - }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().Workloads(namespace).List(ctx, options) - }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { - if tweakListOptions != nil { - tweakListOptions(&options) - } - return client.SchedulingV1alpha1().Workloads(namespace).Watch(ctx, options) - }, - }, client), - &apischedulingv1alpha1.Workload{}, - resyncPeriod, - indexers, - ) -} - -func (f *workloadInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredWorkloadInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) -} - -func (f *workloadInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&apischedulingv1alpha1.Workload{}, f.defaultInformer) -} - -func (f *workloadInformer) Lister() schedulingv1alpha1.WorkloadLister { - return schedulingv1alpha1.NewWorkloadLister(f.Informer().GetIndexer()) -} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/interface.go similarity index 82% rename from vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go rename to vendor/k8s.io/client-go/informers/scheduling/v1alpha2/interface.go index fdfc4e6af4..8edc498b67 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1alpha1/interface.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/interface.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by informer-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 import ( internalinterfaces "k8s.io/client-go/informers/internalinterfaces" @@ -24,8 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // PriorityClasses returns a PriorityClassInformer. - PriorityClasses() PriorityClassInformer + // PodGroups returns a PodGroupInformer. + PodGroups() PodGroupInformer // Workloads returns a WorkloadInformer. Workloads() WorkloadInformer } @@ -41,9 +41,9 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// PriorityClasses returns a PriorityClassInformer. -func (v *version) PriorityClasses() PriorityClassInformer { - return &priorityClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +// PodGroups returns a PodGroupInformer. +func (v *version) PodGroups() PodGroupInformer { + return &podGroupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } // Workloads returns a WorkloadInformer. diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/podgroup.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/podgroup.go new file mode 100644 index 0000000000..5f39858c65 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/podgroup.go @@ -0,0 +1,116 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + context "context" + time "time" + + apischedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" + cache "k8s.io/client-go/tools/cache" +) + +// PodGroupInformer provides access to a shared informer and lister for +// PodGroups. +type PodGroupInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1alpha2.PodGroupLister +} + +type podGroupInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredPodGroupInformer constructs a new informer for PodGroup type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPodGroupInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewPodGroupInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPodGroupInformerWithOptions constructs a new informer for PodGroup type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPodGroupInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha2", Resource: "podgroups"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().PodGroups(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().PodGroups(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().PodGroups(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().PodGroups(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1alpha2.PodGroup{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *podGroupInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewPodGroupInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *podGroupInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apischedulingv1alpha2.PodGroup{}, f.defaultInformer) +} + +func (f *podGroupInformer) Lister() schedulingv1alpha2.PodGroupLister { + return schedulingv1alpha2.NewPodGroupLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/workload.go b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/workload.go new file mode 100644 index 0000000000..ffe2f4ece7 --- /dev/null +++ b/vendor/k8s.io/client-go/informers/scheduling/v1alpha2/workload.go @@ -0,0 +1,116 @@ +/* +Copyright 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. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + context "context" + time "time" + + apischedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + watch "k8s.io/apimachinery/pkg/watch" + internalinterfaces "k8s.io/client-go/informers/internalinterfaces" + kubernetes "k8s.io/client-go/kubernetes" + schedulingv1alpha2 "k8s.io/client-go/listers/scheduling/v1alpha2" + cache "k8s.io/client-go/tools/cache" +) + +// WorkloadInformer provides access to a shared informer and lister for +// Workloads. +type WorkloadInformer interface { + Informer() cache.SharedIndexInformer + Lister() schedulingv1alpha2.WorkloadLister +} + +type workloadInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) +} + +// NewFilteredWorkloadInformer constructs a new informer for Workload type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredWorkloadInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return NewWorkloadInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewWorkloadInformerWithOptions constructs a new informer for Workload type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewWorkloadInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1alpha2", Resource: "workloads"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().Workloads(namespace).List(context.Background(), opts) + }, + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().Workloads(namespace).Watch(context.Background(), opts) + }, + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().Workloads(namespace).List(ctx, opts) + }, + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&opts) + } + return client.SchedulingV1alpha2().Workloads(namespace).Watch(ctx, opts) + }, + }, client), + &apischedulingv1alpha2.Workload{}, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, + ) +} + +func (f *workloadInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewWorkloadInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) +} + +func (f *workloadInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apischedulingv1alpha2.Workload{}, f.defaultInformer) +} + +func (f *workloadInformer) Lister() schedulingv1alpha2.WorkloadLister { + return schedulingv1alpha2.NewWorkloadLister(f.Informer().GetIndexer()) +} diff --git a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go index e8057f921a..a5cae3ea56 100644 --- a/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go +++ b/vendor/k8s.io/client-go/informers/scheduling/v1beta1/priorityclass.go @@ -25,6 +25,7 @@ import ( apischedulingv1beta1 "k8s.io/api/scheduling/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type priorityClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformer(client, resyncPeriod, indexers, nil) + return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredPriorityClassInformer constructs a new informer for PriorityClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredPriorityClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewPriorityClassInformerWithOptions constructs a new informer for PriorityClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPriorityClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "scheduling.k8s.io", Version: "v1beta1", Resource: "priorityclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1beta1().PriorityClasses().List(context.Background(), options) + return client.SchedulingV1beta1().PriorityClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1beta1().PriorityClasses().Watch(context.Background(), options) + return client.SchedulingV1beta1().PriorityClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1beta1().PriorityClasses().List(ctx, options) + return client.SchedulingV1beta1().PriorityClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.SchedulingV1beta1().PriorityClasses().Watch(ctx, options) + return client.SchedulingV1beta1().PriorityClasses().Watch(ctx, opts) }, }, client), &apischedulingv1beta1.PriorityClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *priorityClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredPriorityClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewPriorityClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *priorityClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go index 3a1922edaa..56ed349e26 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/csidriver.go @@ -25,6 +25,7 @@ import ( apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type cSIDriverInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) + return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCSIDriverInformerWithOptions constructs a new informer for CSIDriver type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csidrivers"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIDrivers().List(context.Background(), options) + return client.StorageV1().CSIDrivers().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIDrivers().Watch(context.Background(), options) + return client.StorageV1().CSIDrivers().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIDrivers().List(ctx, options) + return client.StorageV1().CSIDrivers().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIDrivers().Watch(ctx, options) + return client.StorageV1().CSIDrivers().Watch(ctx, opts) }, }, client), &apistoragev1.CSIDriver{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go index 350ab61e57..c90686bf78 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/csinode.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/csinode.go @@ -25,6 +25,7 @@ import ( apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type cSINodeInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) + return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCSINodeInformer constructs a new informer for CSINode type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCSINodeInformerWithOptions constructs a new informer for CSINode type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csinodes"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSINodes().List(context.Background(), options) + return client.StorageV1().CSINodes().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSINodes().Watch(context.Background(), options) + return client.StorageV1().CSINodes().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSINodes().List(ctx, options) + return client.StorageV1().CSINodes().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSINodes().Watch(ctx, options) + return client.StorageV1().CSINodes().Watch(ctx, opts) }, }, client), &apistoragev1.CSINode{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go index 7c88e6e07b..52c0e281ac 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/csistoragecapacity.go @@ -25,6 +25,7 @@ import ( apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type cSIStorageCapacityInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) + return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "csistoragecapacitys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIStorageCapacities(namespace).List(context.Background(), options) + return client.StorageV1().CSIStorageCapacities(namespace).List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIStorageCapacities(namespace).Watch(context.Background(), options) + return client.StorageV1().CSIStorageCapacities(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIStorageCapacities(namespace).List(ctx, options) + return client.StorageV1().CSIStorageCapacities(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().CSIStorageCapacities(namespace).Watch(ctx, options) + return client.StorageV1().CSIStorageCapacities(namespace).Watch(ctx, opts) }, }, client), &apistoragev1.CSIStorageCapacity{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go index 620c1d3489..533d02fc86 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/storageclass.go @@ -25,6 +25,7 @@ import ( apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type storageClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) + return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredStorageClassInformer constructs a new informer for StorageClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewStorageClassInformerWithOptions constructs a new informer for StorageClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "storageclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().StorageClasses().List(context.Background(), options) + return client.StorageV1().StorageClasses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().StorageClasses().Watch(context.Background(), options) + return client.StorageV1().StorageClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().StorageClasses().List(ctx, options) + return client.StorageV1().StorageClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().StorageClasses().Watch(ctx, options) + return client.StorageV1().StorageClasses().Watch(ctx, opts) }, }, client), &apistoragev1.StorageClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go index 3b7c461144..49444340ad 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/volumeattachment.go @@ -25,6 +25,7 @@ import ( apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type volumeAttachmentInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "volumeattachments"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttachments().List(context.Background(), options) + return client.StorageV1().VolumeAttachments().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttachments().Watch(context.Background(), options) + return client.StorageV1().VolumeAttachments().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttachments().List(ctx, options) + return client.StorageV1().VolumeAttachments().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttachments().Watch(ctx, options) + return client.StorageV1().VolumeAttachments().Watch(ctx, opts) }, }, client), &apistoragev1.VolumeAttachment{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go b/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go index 34dc8b48d8..fa8acccfbd 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1/volumeattributesclass.go @@ -25,6 +25,7 @@ import ( apistoragev1 "k8s.io/api/storage/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type volumeAttributesClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, indexers, nil) + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1", Resource: "volumeattributesclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttributesClasses().List(context.Background(), options) + return client.StorageV1().VolumeAttributesClasses().List(context.Background(), opts) }, - WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttributesClasses().Watch(context.Background(), options) + return client.StorageV1().VolumeAttributesClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options metav1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttributesClasses().List(ctx, options) + return client.StorageV1().VolumeAttributesClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options metav1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1().VolumeAttributesClasses().Watch(ctx, options) + return client.StorageV1().VolumeAttributesClasses().Watch(ctx, opts) }, }, client), &apistoragev1.VolumeAttributesClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go index 3b2753200c..2f7accab3d 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/csistoragecapacity.go @@ -25,6 +25,7 @@ import ( apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type cSIStorageCapacityInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) + return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1alpha1", Resource: "csistoragecapacitys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().CSIStorageCapacities(namespace).List(context.Background(), options) + return client.StorageV1alpha1().CSIStorageCapacities(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().CSIStorageCapacities(namespace).Watch(context.Background(), options) + return client.StorageV1alpha1().CSIStorageCapacities(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().CSIStorageCapacities(namespace).List(ctx, options) + return client.StorageV1alpha1().CSIStorageCapacities(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().CSIStorageCapacities(namespace).Watch(ctx, options) + return client.StorageV1alpha1().CSIStorageCapacities(namespace).Watch(ctx, opts) }, }, client), &apistoragev1alpha1.CSIStorageCapacity{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go index 10ac7e55ed..1ab135906f 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattachment.go @@ -25,6 +25,7 @@ import ( apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type volumeAttachmentInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1alpha1", Resource: "volumeattachments"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttachments().List(context.Background(), options) + return client.StorageV1alpha1().VolumeAttachments().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttachments().Watch(context.Background(), options) + return client.StorageV1alpha1().VolumeAttachments().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttachments().List(ctx, options) + return client.StorageV1alpha1().VolumeAttachments().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttachments().Watch(ctx, options) + return client.StorageV1alpha1().VolumeAttachments().Watch(ctx, opts) }, }, client), &apistoragev1alpha1.VolumeAttachment{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go index 312a443e34..e649c665ee 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1alpha1/volumeattributesclass.go @@ -25,6 +25,7 @@ import ( apistoragev1alpha1 "k8s.io/api/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type volumeAttributesClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, indexers, nil) + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1alpha1", Resource: "volumeattributesclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttributesClasses().List(context.Background(), options) + return client.StorageV1alpha1().VolumeAttributesClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttributesClasses().Watch(context.Background(), options) + return client.StorageV1alpha1().VolumeAttributesClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttributesClasses().List(ctx, options) + return client.StorageV1alpha1().VolumeAttributesClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1alpha1().VolumeAttributesClasses().Watch(ctx, options) + return client.StorageV1alpha1().VolumeAttributesClasses().Watch(ctx, opts) }, }, client), &apistoragev1alpha1.VolumeAttributesClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go index 007caaab54..283dc6b17c 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csidriver.go @@ -25,6 +25,7 @@ import ( apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type cSIDriverInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCSIDriverInformer(client, resyncPeriod, indexers, nil) + return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCSIDriverInformer constructs a new informer for CSIDriver type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIDriverInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCSIDriverInformerWithOptions constructs a new informer for CSIDriver type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIDriverInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "csidrivers"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIDrivers().List(context.Background(), options) + return client.StorageV1beta1().CSIDrivers().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIDrivers().Watch(context.Background(), options) + return client.StorageV1beta1().CSIDrivers().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIDrivers().List(ctx, options) + return client.StorageV1beta1().CSIDrivers().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIDrivers().Watch(ctx, options) + return client.StorageV1beta1().CSIDrivers().Watch(ctx, opts) }, }, client), &apistoragev1beta1.CSIDriver{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cSIDriverInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCSIDriverInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCSIDriverInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIDriverInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go index ce518f0b2e..f304906ce7 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csinode.go @@ -25,6 +25,7 @@ import ( apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type cSINodeInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCSINodeInformer(client, resyncPeriod, indexers, nil) + return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCSINodeInformer constructs a new informer for CSINode type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSINodeInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCSINodeInformerWithOptions constructs a new informer for CSINode type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSINodeInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "csinodes"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSINodes().List(context.Background(), options) + return client.StorageV1beta1().CSINodes().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSINodes().Watch(context.Background(), options) + return client.StorageV1beta1().CSINodes().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSINodes().List(ctx, options) + return client.StorageV1beta1().CSINodes().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSINodes().Watch(ctx, options) + return client.StorageV1beta1().CSINodes().Watch(ctx, opts) }, }, client), &apistoragev1beta1.CSINode{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cSINodeInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCSINodeInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCSINodeInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSINodeInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go index 88446b7695..5b24a8c32b 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/csistoragecapacity.go @@ -25,6 +25,7 @@ import ( apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -49,48 +50,61 @@ type cSIStorageCapacityInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformer(client, namespace, resyncPeriod, indexers, nil) + return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredCSIStorageCapacityInformer constructs a new informer for CSIStorageCapacity type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredCSIStorageCapacityInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewCSIStorageCapacityInformerWithOptions(client, namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewCSIStorageCapacityInformerWithOptions constructs a new informer for CSIStorageCapacity type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewCSIStorageCapacityInformerWithOptions(client kubernetes.Interface, namespace string, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "csistoragecapacitys"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIStorageCapacities(namespace).List(context.Background(), options) + return client.StorageV1beta1().CSIStorageCapacities(namespace).List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(context.Background(), options) + return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIStorageCapacities(namespace).List(ctx, options) + return client.StorageV1beta1().CSIStorageCapacities(namespace).List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(ctx, options) + return client.StorageV1beta1().CSIStorageCapacities(namespace).Watch(ctx, opts) }, }, client), &apistoragev1beta1.CSIStorageCapacity{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *cSIStorageCapacityInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredCSIStorageCapacityInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewCSIStorageCapacityInformerWithOptions(client, f.namespace, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *cSIStorageCapacityInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go index 786d46d3a4..2052da70e9 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/storageclass.go @@ -25,6 +25,7 @@ import ( apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type storageClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredStorageClassInformer(client, resyncPeriod, indexers, nil) + return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredStorageClassInformer constructs a new informer for StorageClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStorageClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewStorageClassInformerWithOptions constructs a new informer for StorageClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "storageclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().StorageClasses().List(context.Background(), options) + return client.StorageV1beta1().StorageClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().StorageClasses().Watch(context.Background(), options) + return client.StorageV1beta1().StorageClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().StorageClasses().List(ctx, options) + return client.StorageV1beta1().StorageClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().StorageClasses().Watch(ctx, options) + return client.StorageV1beta1().StorageClasses().Watch(ctx, opts) }, }, client), &apistoragev1beta1.StorageClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *storageClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredStorageClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewStorageClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go index 0f1bf21613..11f9840b04 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattachment.go @@ -25,6 +25,7 @@ import ( apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type volumeAttachmentInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, indexers, nil) + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredVolumeAttachmentInformer constructs a new informer for VolumeAttachment type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttachmentInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewVolumeAttachmentInformerWithOptions constructs a new informer for VolumeAttachment type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttachmentInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "volumeattachments"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttachments().List(context.Background(), options) + return client.StorageV1beta1().VolumeAttachments().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttachments().Watch(context.Background(), options) + return client.StorageV1beta1().VolumeAttachments().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttachments().List(ctx, options) + return client.StorageV1beta1().VolumeAttachments().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttachments().Watch(ctx, options) + return client.StorageV1beta1().VolumeAttachments().Watch(ctx, opts) }, }, client), &apistoragev1beta1.VolumeAttachment{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *volumeAttachmentInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeAttachmentInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewVolumeAttachmentInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttachmentInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go index 90e79cc710..c91dfff0d1 100644 --- a/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go +++ b/vendor/k8s.io/client-go/informers/storage/v1beta1/volumeattributesclass.go @@ -25,6 +25,7 @@ import ( apistoragev1beta1 "k8s.io/api/storage/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type volumeAttributesClassInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, indexers, nil) + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredVolumeAttributesClassInformer constructs a new informer for VolumeAttributesClass type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredVolumeAttributesClassInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewVolumeAttributesClassInformerWithOptions constructs a new informer for VolumeAttributesClass type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewVolumeAttributesClassInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "volumeattributesclasss"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttributesClasses().List(context.Background(), options) + return client.StorageV1beta1().VolumeAttributesClasses().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttributesClasses().Watch(context.Background(), options) + return client.StorageV1beta1().VolumeAttributesClasses().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttributesClasses().List(ctx, options) + return client.StorageV1beta1().VolumeAttributesClasses().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StorageV1beta1().VolumeAttributesClasses().Watch(ctx, options) + return client.StorageV1beta1().VolumeAttributesClasses().Watch(ctx, opts) }, }, client), &apistoragev1beta1.VolumeAttributesClass{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *volumeAttributesClassInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredVolumeAttributesClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewVolumeAttributesClassInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *volumeAttributesClassInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go b/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go index 370d88f242..50e271e6fe 100644 --- a/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go +++ b/vendor/k8s.io/client-go/informers/storagemigration/v1beta1/storageversionmigration.go @@ -25,6 +25,7 @@ import ( apistoragemigrationv1beta1 "k8s.io/api/storagemigration/v1beta1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" watch "k8s.io/apimachinery/pkg/watch" internalinterfaces "k8s.io/client-go/informers/internalinterfaces" kubernetes "k8s.io/client-go/kubernetes" @@ -48,48 +49,61 @@ type storageVersionMigrationInformer struct { // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredStorageVersionMigrationInformer(client, resyncPeriod, indexers, nil) + return NewStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers}) } // NewFilteredStorageVersionMigrationInformer constructs a new informer for StorageVersionMigration type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFilteredStorageVersionMigrationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { - return cache.NewSharedIndexInformer( + return NewStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} + +// NewStorageVersionMigrationInformerWithOptions constructs a new informer for StorageVersionMigration type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewStorageVersionMigrationInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer { + gvr := schema.GroupVersionResource{Group: "storagemigration.k8s.io", Version: "v1beta1", Resource: "storageversionmigrations"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return cache.NewSharedIndexInformerWithOptions( cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ - ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + ListFunc: func(opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StoragemigrationV1beta1().StorageVersionMigrations().List(context.Background(), options) + return client.StoragemigrationV1beta1().StorageVersionMigrations().List(context.Background(), opts) }, - WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StoragemigrationV1beta1().StorageVersionMigrations().Watch(context.Background(), options) + return client.StoragemigrationV1beta1().StorageVersionMigrations().Watch(context.Background(), opts) }, - ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StoragemigrationV1beta1().StorageVersionMigrations().List(ctx, options) + return client.StoragemigrationV1beta1().StorageVersionMigrations().List(ctx, opts) }, - WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.StoragemigrationV1beta1().StorageVersionMigrations().Watch(ctx, options) + return client.StoragemigrationV1beta1().StorageVersionMigrations().Watch(ctx, opts) }, }, client), &apistoragemigrationv1beta1.StorageVersionMigration{}, - resyncPeriod, - indexers, + cache.SharedIndexInformerOptions{ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } func (f *storageVersionMigrationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredStorageVersionMigrationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewStorageVersionMigrationInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } func (f *storageVersionMigrationInformer) Informer() cache.SharedIndexInformer { diff --git a/vendor/k8s.io/client-go/kubernetes/clientset.go b/vendor/k8s.io/client-go/kubernetes/clientset.go index 1ef0ff4b2c..537609b718 100644 --- a/vendor/k8s.io/client-go/kubernetes/clientset.go +++ b/vendor/k8s.io/client-go/kubernetes/clientset.go @@ -37,8 +37,6 @@ import ( authorizationv1beta1 "k8s.io/client-go/kubernetes/typed/authorization/v1beta1" autoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1" autoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2" - autoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" - autoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" batchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" certificatesv1 "k8s.io/client-go/kubernetes/typed/certificates/v1" @@ -72,7 +70,7 @@ import ( resourcev1beta1 "k8s.io/client-go/kubernetes/typed/resource/v1beta1" resourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2" schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" - schedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" storagev1alpha1 "k8s.io/client-go/kubernetes/typed/storage/v1alpha1" @@ -98,8 +96,6 @@ type Interface interface { AuthorizationV1beta1() authorizationv1beta1.AuthorizationV1beta1Interface AutoscalingV1() autoscalingv1.AutoscalingV1Interface AutoscalingV2() autoscalingv2.AutoscalingV2Interface - AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface - AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface BatchV1() batchv1.BatchV1Interface BatchV1beta1() batchv1beta1.BatchV1beta1Interface CertificatesV1() certificatesv1.CertificatesV1Interface @@ -132,7 +128,7 @@ type Interface interface { ResourceV1beta2() resourcev1beta2.ResourceV1beta2Interface ResourceV1beta1() resourcev1beta1.ResourceV1beta1Interface ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interface - SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface + SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface SchedulingV1beta1() schedulingv1beta1.SchedulingV1beta1Interface SchedulingV1() schedulingv1.SchedulingV1Interface StorageV1beta1() storagev1beta1.StorageV1beta1Interface @@ -158,8 +154,6 @@ type Clientset struct { authorizationV1beta1 *authorizationv1beta1.AuthorizationV1beta1Client autoscalingV1 *autoscalingv1.AutoscalingV1Client autoscalingV2 *autoscalingv2.AutoscalingV2Client - autoscalingV2beta1 *autoscalingv2beta1.AutoscalingV2beta1Client - autoscalingV2beta2 *autoscalingv2beta2.AutoscalingV2beta2Client batchV1 *batchv1.BatchV1Client batchV1beta1 *batchv1beta1.BatchV1beta1Client certificatesV1 *certificatesv1.CertificatesV1Client @@ -192,7 +186,7 @@ type Clientset struct { resourceV1beta2 *resourcev1beta2.ResourceV1beta2Client resourceV1beta1 *resourcev1beta1.ResourceV1beta1Client resourceV1alpha3 *resourcev1alpha3.ResourceV1alpha3Client - schedulingV1alpha1 *schedulingv1alpha1.SchedulingV1alpha1Client + schedulingV1alpha2 *schedulingv1alpha2.SchedulingV1alpha2Client schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client schedulingV1 *schedulingv1.SchedulingV1Client storageV1beta1 *storagev1beta1.StorageV1beta1Client @@ -271,16 +265,6 @@ func (c *Clientset) AutoscalingV2() autoscalingv2.AutoscalingV2Interface { return c.autoscalingV2 } -// AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client -func (c *Clientset) AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface { - return c.autoscalingV2beta1 -} - -// AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client -func (c *Clientset) AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface { - return c.autoscalingV2beta2 -} - // BatchV1 retrieves the BatchV1Client func (c *Clientset) BatchV1() batchv1.BatchV1Interface { return c.batchV1 @@ -441,9 +425,9 @@ func (c *Clientset) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interfac return c.resourceV1alpha3 } -// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client -func (c *Clientset) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface { - return c.schedulingV1alpha1 +// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client +func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface { + return c.schedulingV1alpha2 } // SchedulingV1beta1 retrieves the SchedulingV1beta1Client @@ -576,14 +560,6 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } - cs.autoscalingV2beta1, err = autoscalingv2beta1.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } - cs.autoscalingV2beta2, err = autoscalingv2beta2.NewForConfigAndClient(&configShallowCopy, httpClient) - if err != nil { - return nil, err - } cs.batchV1, err = batchv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -712,7 +688,7 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } - cs.schedulingV1alpha1, err = schedulingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.schedulingV1alpha2, err = schedulingv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -775,8 +751,6 @@ func New(c rest.Interface) *Clientset { cs.authorizationV1beta1 = authorizationv1beta1.New(c) cs.autoscalingV1 = autoscalingv1.New(c) cs.autoscalingV2 = autoscalingv2.New(c) - cs.autoscalingV2beta1 = autoscalingv2beta1.New(c) - cs.autoscalingV2beta2 = autoscalingv2beta2.New(c) cs.batchV1 = batchv1.New(c) cs.batchV1beta1 = batchv1beta1.New(c) cs.certificatesV1 = certificatesv1.New(c) @@ -809,7 +783,7 @@ func New(c rest.Interface) *Clientset { cs.resourceV1beta2 = resourcev1beta2.New(c) cs.resourceV1beta1 = resourcev1beta1.New(c) cs.resourceV1alpha3 = resourcev1alpha3.New(c) - cs.schedulingV1alpha1 = schedulingv1alpha1.New(c) + cs.schedulingV1alpha2 = schedulingv1alpha2.New(c) cs.schedulingV1beta1 = schedulingv1beta1.New(c) cs.schedulingV1 = schedulingv1.New(c) cs.storageV1beta1 = storagev1beta1.New(c) diff --git a/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go b/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go index f729718bfb..618dd57511 100644 --- a/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go +++ b/vendor/k8s.io/client-go/kubernetes/fake/clientset_generated.go @@ -54,10 +54,6 @@ import ( fakeautoscalingv1 "k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake" autoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2" fakeautoscalingv2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake" - autoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" - fakeautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake" - autoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" - fakeautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake" batchv1 "k8s.io/client-go/kubernetes/typed/batch/v1" fakebatchv1 "k8s.io/client-go/kubernetes/typed/batch/v1/fake" batchv1beta1 "k8s.io/client-go/kubernetes/typed/batch/v1beta1" @@ -124,8 +120,8 @@ import ( fakeresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake" schedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1" fakeschedulingv1 "k8s.io/client-go/kubernetes/typed/scheduling/v1/fake" - schedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" - fakeschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake" + schedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" + fakeschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake" schedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1" fakeschedulingv1beta1 "k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake" storagev1 "k8s.io/client-go/kubernetes/typed/storage/v1" @@ -143,10 +139,6 @@ import ( // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, // without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. -// -// Deprecated: NewClientset replaces this with support for field management, which significantly improves -// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. -// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { @@ -192,7 +184,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } -// IsWatchListSemanticsSupported informs the reflector that this client +// IsWatchListSemanticsUnSupported informs the reflector that this client // doesn't support WatchList semantics. // // This is a synthetic method whose sole purpose is to satisfy the optional @@ -207,6 +199,10 @@ func (c *Clientset) IsWatchListSemanticsUnSupported() bool { // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, // without applying any validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// Compared to NewSimpleClientset, the Clientset returned here supports field tracking and thus +// server-side apply. Beware though that support in that for CRDs is missing +// (https://github.com/kubernetes/kubernetes/issues/126850). func NewClientset(objects ...runtime.Object) *Clientset { o := testing.NewFieldManagedObjectTracker( scheme, @@ -314,16 +310,6 @@ func (c *Clientset) AutoscalingV2() autoscalingv2.AutoscalingV2Interface { return &fakeautoscalingv2.FakeAutoscalingV2{Fake: &c.Fake} } -// AutoscalingV2beta1 retrieves the AutoscalingV2beta1Client -func (c *Clientset) AutoscalingV2beta1() autoscalingv2beta1.AutoscalingV2beta1Interface { - return &fakeautoscalingv2beta1.FakeAutoscalingV2beta1{Fake: &c.Fake} -} - -// AutoscalingV2beta2 retrieves the AutoscalingV2beta2Client -func (c *Clientset) AutoscalingV2beta2() autoscalingv2beta2.AutoscalingV2beta2Interface { - return &fakeautoscalingv2beta2.FakeAutoscalingV2beta2{Fake: &c.Fake} -} - // BatchV1 retrieves the BatchV1Client func (c *Clientset) BatchV1() batchv1.BatchV1Interface { return &fakebatchv1.FakeBatchV1{Fake: &c.Fake} @@ -484,9 +470,9 @@ func (c *Clientset) ResourceV1alpha3() resourcev1alpha3.ResourceV1alpha3Interfac return &fakeresourcev1alpha3.FakeResourceV1alpha3{Fake: &c.Fake} } -// SchedulingV1alpha1 retrieves the SchedulingV1alpha1Client -func (c *Clientset) SchedulingV1alpha1() schedulingv1alpha1.SchedulingV1alpha1Interface { - return &fakeschedulingv1alpha1.FakeSchedulingV1alpha1{Fake: &c.Fake} +// SchedulingV1alpha2 retrieves the SchedulingV1alpha2Client +func (c *Clientset) SchedulingV1alpha2() schedulingv1alpha2.SchedulingV1alpha2Interface { + return &fakeschedulingv1alpha2.FakeSchedulingV1alpha2{Fake: &c.Fake} } // SchedulingV1beta1 retrieves the SchedulingV1beta1Client diff --git a/vendor/k8s.io/client-go/kubernetes/fake/register.go b/vendor/k8s.io/client-go/kubernetes/fake/register.go index 7a2bacfb57..3b5d98c6a8 100644 --- a/vendor/k8s.io/client-go/kubernetes/fake/register.go +++ b/vendor/k8s.io/client-go/kubernetes/fake/register.go @@ -33,8 +33,6 @@ import ( authorizationv1beta1 "k8s.io/api/authorization/v1beta1" autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv2 "k8s.io/api/autoscaling/v2" - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1" certificatesv1 "k8s.io/api/certificates/v1" @@ -68,7 +66,7 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" @@ -99,8 +97,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ authorizationv1beta1.AddToScheme, autoscalingv1.AddToScheme, autoscalingv2.AddToScheme, - autoscalingv2beta1.AddToScheme, - autoscalingv2beta2.AddToScheme, batchv1.AddToScheme, batchv1beta1.AddToScheme, certificatesv1.AddToScheme, @@ -133,7 +129,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ resourcev1beta2.AddToScheme, resourcev1beta1.AddToScheme, resourcev1alpha3.AddToScheme, - schedulingv1alpha1.AddToScheme, + schedulingv1alpha2.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, storagev1beta1.AddToScheme, diff --git a/vendor/k8s.io/client-go/kubernetes/scheme/register.go b/vendor/k8s.io/client-go/kubernetes/scheme/register.go index 9557cba2b4..c36fe7eda4 100644 --- a/vendor/k8s.io/client-go/kubernetes/scheme/register.go +++ b/vendor/k8s.io/client-go/kubernetes/scheme/register.go @@ -33,8 +33,6 @@ import ( authorizationv1beta1 "k8s.io/api/authorization/v1beta1" autoscalingv1 "k8s.io/api/autoscaling/v1" autoscalingv2 "k8s.io/api/autoscaling/v2" - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1" certificatesv1 "k8s.io/api/certificates/v1" @@ -68,7 +66,7 @@ import ( resourcev1beta1 "k8s.io/api/resource/v1beta1" resourcev1beta2 "k8s.io/api/resource/v1beta2" schedulingv1 "k8s.io/api/scheduling/v1" - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" schedulingv1beta1 "k8s.io/api/scheduling/v1beta1" storagev1 "k8s.io/api/storage/v1" storagev1alpha1 "k8s.io/api/storage/v1alpha1" @@ -99,8 +97,6 @@ var localSchemeBuilder = runtime.SchemeBuilder{ authorizationv1beta1.AddToScheme, autoscalingv1.AddToScheme, autoscalingv2.AddToScheme, - autoscalingv2beta1.AddToScheme, - autoscalingv2beta2.AddToScheme, batchv1.AddToScheme, batchv1beta1.AddToScheme, certificatesv1.AddToScheme, @@ -133,7 +129,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{ resourcev1beta2.AddToScheme, resourcev1beta1.AddToScheme, resourcev1alpha3.AddToScheme, - schedulingv1alpha1.AddToScheme, + schedulingv1alpha2.AddToScheme, schedulingv1beta1.AddToScheme, schedulingv1.AddToScheme, storagev1beta1.AddToScheme, diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/admissionregistration_client.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/admissionregistration_client.go index 859ad913b9..e09930b7ce 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/admissionregistration_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/admissionregistration_client.go @@ -28,6 +28,8 @@ import ( type AdmissionregistrationV1Interface interface { RESTClient() rest.Interface + MutatingAdmissionPoliciesGetter + MutatingAdmissionPolicyBindingsGetter MutatingWebhookConfigurationsGetter ValidatingAdmissionPoliciesGetter ValidatingAdmissionPolicyBindingsGetter @@ -39,6 +41,14 @@ type AdmissionregistrationV1Client struct { restClient rest.Interface } +func (c *AdmissionregistrationV1Client) MutatingAdmissionPolicies() MutatingAdmissionPolicyInterface { + return newMutatingAdmissionPolicies(c) +} + +func (c *AdmissionregistrationV1Client) MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInterface { + return newMutatingAdmissionPolicyBindings(c) +} + func (c *AdmissionregistrationV1Client) MutatingWebhookConfigurations() MutatingWebhookConfigurationInterface { return newMutatingWebhookConfigurations(c) } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go index 1a948ad93d..fbe72e9e54 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_admissionregistration_client.go @@ -28,6 +28,14 @@ type FakeAdmissionregistrationV1 struct { *testing.Fake } +func (c *FakeAdmissionregistrationV1) MutatingAdmissionPolicies() v1.MutatingAdmissionPolicyInterface { + return newFakeMutatingAdmissionPolicies(c) +} + +func (c *FakeAdmissionregistrationV1) MutatingAdmissionPolicyBindings() v1.MutatingAdmissionPolicyBindingInterface { + return newFakeMutatingAdmissionPolicyBindings(c) +} + func (c *FakeAdmissionregistrationV1) MutatingWebhookConfigurations() v1.MutatingWebhookConfigurationInterface { return newFakeMutatingWebhookConfigurations(c) } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicy.go new file mode 100644 index 0000000000..80e703b1cd --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicy.go @@ -0,0 +1,53 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/api/admissionregistration/v1" + admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" + gentype "k8s.io/client-go/gentype" + typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1" +) + +// fakeMutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface +type fakeMutatingAdmissionPolicies struct { + *gentype.FakeClientWithListAndApply[*v1.MutatingAdmissionPolicy, *v1.MutatingAdmissionPolicyList, *admissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration] + Fake *FakeAdmissionregistrationV1 +} + +func newFakeMutatingAdmissionPolicies(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.MutatingAdmissionPolicyInterface { + return &fakeMutatingAdmissionPolicies{ + gentype.NewFakeClientWithListAndApply[*v1.MutatingAdmissionPolicy, *v1.MutatingAdmissionPolicyList, *admissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration]( + fake.Fake, + "", + v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicies"), + v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicy"), + func() *v1.MutatingAdmissionPolicy { return &v1.MutatingAdmissionPolicy{} }, + func() *v1.MutatingAdmissionPolicyList { return &v1.MutatingAdmissionPolicyList{} }, + func(dst, src *v1.MutatingAdmissionPolicyList) { dst.ListMeta = src.ListMeta }, + func(list *v1.MutatingAdmissionPolicyList) []*v1.MutatingAdmissionPolicy { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1.MutatingAdmissionPolicyList, items []*v1.MutatingAdmissionPolicy) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicybinding.go new file mode 100644 index 0000000000..eba7c8406e --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/fake/fake_mutatingadmissionpolicybinding.go @@ -0,0 +1,53 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "k8s.io/api/admissionregistration/v1" + admissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" + gentype "k8s.io/client-go/gentype" + typedadmissionregistrationv1 "k8s.io/client-go/kubernetes/typed/admissionregistration/v1" +) + +// fakeMutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface +type fakeMutatingAdmissionPolicyBindings struct { + *gentype.FakeClientWithListAndApply[*v1.MutatingAdmissionPolicyBinding, *v1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration] + Fake *FakeAdmissionregistrationV1 +} + +func newFakeMutatingAdmissionPolicyBindings(fake *FakeAdmissionregistrationV1) typedadmissionregistrationv1.MutatingAdmissionPolicyBindingInterface { + return &fakeMutatingAdmissionPolicyBindings{ + gentype.NewFakeClientWithListAndApply[*v1.MutatingAdmissionPolicyBinding, *v1.MutatingAdmissionPolicyBindingList, *admissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration]( + fake.Fake, + "", + v1.SchemeGroupVersion.WithResource("mutatingadmissionpolicybindings"), + v1.SchemeGroupVersion.WithKind("MutatingAdmissionPolicyBinding"), + func() *v1.MutatingAdmissionPolicyBinding { return &v1.MutatingAdmissionPolicyBinding{} }, + func() *v1.MutatingAdmissionPolicyBindingList { return &v1.MutatingAdmissionPolicyBindingList{} }, + func(dst, src *v1.MutatingAdmissionPolicyBindingList) { dst.ListMeta = src.ListMeta }, + func(list *v1.MutatingAdmissionPolicyBindingList) []*v1.MutatingAdmissionPolicyBinding { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1.MutatingAdmissionPolicyBindingList, items []*v1.MutatingAdmissionPolicyBinding) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/generated_expansion.go index d81e1c87fc..c449e9b7d7 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/generated_expansion.go @@ -18,6 +18,10 @@ limitations under the License. package v1 +type MutatingAdmissionPolicyExpansion interface{} + +type MutatingAdmissionPolicyBindingExpansion interface{} + type MutatingWebhookConfigurationExpansion interface{} type ValidatingAdmissionPolicyExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicy.go new file mode 100644 index 0000000000..d0e85396cc --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicy.go @@ -0,0 +1,75 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsadmissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// MutatingAdmissionPoliciesGetter has a method to return a MutatingAdmissionPolicyInterface. +// A group's client should implement this interface. +type MutatingAdmissionPoliciesGetter interface { + MutatingAdmissionPolicies() MutatingAdmissionPolicyInterface +} + +// MutatingAdmissionPolicyInterface has methods to work with MutatingAdmissionPolicy resources. +type MutatingAdmissionPolicyInterface interface { + Create(ctx context.Context, mutatingAdmissionPolicy *admissionregistrationv1.MutatingAdmissionPolicy, opts metav1.CreateOptions) (*admissionregistrationv1.MutatingAdmissionPolicy, error) + Update(ctx context.Context, mutatingAdmissionPolicy *admissionregistrationv1.MutatingAdmissionPolicy, opts metav1.UpdateOptions) (*admissionregistrationv1.MutatingAdmissionPolicy, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1.MutatingAdmissionPolicy, error) + List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1.MutatingAdmissionPolicyList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1.MutatingAdmissionPolicy, err error) + Apply(ctx context.Context, mutatingAdmissionPolicy *applyconfigurationsadmissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingAdmissionPolicy, err error) + MutatingAdmissionPolicyExpansion +} + +// mutatingAdmissionPolicies implements MutatingAdmissionPolicyInterface +type mutatingAdmissionPolicies struct { + *gentype.ClientWithListAndApply[*admissionregistrationv1.MutatingAdmissionPolicy, *admissionregistrationv1.MutatingAdmissionPolicyList, *applyconfigurationsadmissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration] +} + +// newMutatingAdmissionPolicies returns a MutatingAdmissionPolicies +func newMutatingAdmissionPolicies(c *AdmissionregistrationV1Client) *mutatingAdmissionPolicies { + return &mutatingAdmissionPolicies{ + gentype.NewClientWithListAndApply[*admissionregistrationv1.MutatingAdmissionPolicy, *admissionregistrationv1.MutatingAdmissionPolicyList, *applyconfigurationsadmissionregistrationv1.MutatingAdmissionPolicyApplyConfiguration]( + "mutatingadmissionpolicies", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *admissionregistrationv1.MutatingAdmissionPolicy { + return &admissionregistrationv1.MutatingAdmissionPolicy{} + }, + func() *admissionregistrationv1.MutatingAdmissionPolicyList { + return &admissionregistrationv1.MutatingAdmissionPolicyList{} + }, + gentype.PrefersProtobuf[*admissionregistrationv1.MutatingAdmissionPolicy](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicybinding.go new file mode 100644 index 0000000000..67b4aa9a6b --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingadmissionpolicybinding.go @@ -0,0 +1,75 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + context "context" + + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsadmissionregistrationv1 "k8s.io/client-go/applyconfigurations/admissionregistration/v1" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// MutatingAdmissionPolicyBindingsGetter has a method to return a MutatingAdmissionPolicyBindingInterface. +// A group's client should implement this interface. +type MutatingAdmissionPolicyBindingsGetter interface { + MutatingAdmissionPolicyBindings() MutatingAdmissionPolicyBindingInterface +} + +// MutatingAdmissionPolicyBindingInterface has methods to work with MutatingAdmissionPolicyBinding resources. +type MutatingAdmissionPolicyBindingInterface interface { + Create(ctx context.Context, mutatingAdmissionPolicyBinding *admissionregistrationv1.MutatingAdmissionPolicyBinding, opts metav1.CreateOptions) (*admissionregistrationv1.MutatingAdmissionPolicyBinding, error) + Update(ctx context.Context, mutatingAdmissionPolicyBinding *admissionregistrationv1.MutatingAdmissionPolicyBinding, opts metav1.UpdateOptions) (*admissionregistrationv1.MutatingAdmissionPolicyBinding, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*admissionregistrationv1.MutatingAdmissionPolicyBinding, error) + List(ctx context.Context, opts metav1.ListOptions) (*admissionregistrationv1.MutatingAdmissionPolicyBindingList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *admissionregistrationv1.MutatingAdmissionPolicyBinding, err error) + Apply(ctx context.Context, mutatingAdmissionPolicyBinding *applyconfigurationsadmissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration, opts metav1.ApplyOptions) (result *admissionregistrationv1.MutatingAdmissionPolicyBinding, err error) + MutatingAdmissionPolicyBindingExpansion +} + +// mutatingAdmissionPolicyBindings implements MutatingAdmissionPolicyBindingInterface +type mutatingAdmissionPolicyBindings struct { + *gentype.ClientWithListAndApply[*admissionregistrationv1.MutatingAdmissionPolicyBinding, *admissionregistrationv1.MutatingAdmissionPolicyBindingList, *applyconfigurationsadmissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration] +} + +// newMutatingAdmissionPolicyBindings returns a MutatingAdmissionPolicyBindings +func newMutatingAdmissionPolicyBindings(c *AdmissionregistrationV1Client) *mutatingAdmissionPolicyBindings { + return &mutatingAdmissionPolicyBindings{ + gentype.NewClientWithListAndApply[*admissionregistrationv1.MutatingAdmissionPolicyBinding, *admissionregistrationv1.MutatingAdmissionPolicyBindingList, *applyconfigurationsadmissionregistrationv1.MutatingAdmissionPolicyBindingApplyConfiguration]( + "mutatingadmissionpolicybindings", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *admissionregistrationv1.MutatingAdmissionPolicyBinding { + return &admissionregistrationv1.MutatingAdmissionPolicyBinding{} + }, + func() *admissionregistrationv1.MutatingAdmissionPolicyBindingList { + return &admissionregistrationv1.MutatingAdmissionPolicyBindingList{} + }, + gentype.PrefersProtobuf[*admissionregistrationv1.MutatingAdmissionPolicyBinding](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_autoscaling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_autoscaling_client.go deleted file mode 100644 index ca4b461c2e..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_autoscaling_client.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeAutoscalingV2beta1 struct { - *testing.Fake -} - -func (c *FakeAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) v2beta1.HorizontalPodAutoscalerInterface { - return newFakeHorizontalPodAutoscalers(c, namespace) -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeAutoscalingV2beta1) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_horizontalpodautoscaler.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_horizontalpodautoscaler.go deleted file mode 100644 index 8f28fb30c4..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/fake_horizontalpodautoscaler.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v2beta1 "k8s.io/api/autoscaling/v2beta1" - autoscalingv2beta1 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta1" - gentype "k8s.io/client-go/gentype" - typedautoscalingv2beta1 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1" -) - -// fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface -type fakeHorizontalPodAutoscalers struct { - *gentype.FakeClientWithListAndApply[*v2beta1.HorizontalPodAutoscaler, *v2beta1.HorizontalPodAutoscalerList, *autoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration] - Fake *FakeAutoscalingV2beta1 -} - -func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV2beta1, namespace string) typedautoscalingv2beta1.HorizontalPodAutoscalerInterface { - return &fakeHorizontalPodAutoscalers{ - gentype.NewFakeClientWithListAndApply[*v2beta1.HorizontalPodAutoscaler, *v2beta1.HorizontalPodAutoscalerList, *autoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration]( - fake.Fake, - namespace, - v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"), - v2beta1.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"), - func() *v2beta1.HorizontalPodAutoscaler { return &v2beta1.HorizontalPodAutoscaler{} }, - func() *v2beta1.HorizontalPodAutoscalerList { return &v2beta1.HorizontalPodAutoscalerList{} }, - func(dst, src *v2beta1.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta }, - func(list *v2beta1.HorizontalPodAutoscalerList) []*v2beta1.HorizontalPodAutoscaler { - return gentype.ToPointerSlice(list.Items) - }, - func(list *v2beta1.HorizontalPodAutoscalerList, items []*v2beta1.HorizontalPodAutoscaler) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/horizontalpodautoscaler.go deleted file mode 100644 index c1dc75ccc3..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/horizontalpodautoscaler.go +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2beta1 - -import ( - context "context" - - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - applyconfigurationsautoscalingv2beta1 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta1" - gentype "k8s.io/client-go/gentype" - scheme "k8s.io/client-go/kubernetes/scheme" -) - -// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface. -// A group's client should implement this interface. -type HorizontalPodAutoscalersGetter interface { - HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface -} - -// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources. -type HorizontalPodAutoscalerInterface interface { - Create(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, opts v1.CreateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) - Update(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta1.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) - List(ctx context.Context, opts v1.ListOptions) (*autoscalingv2beta1.HorizontalPodAutoscalerList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) - Apply(ctx context.Context, horizontalPodAutoscaler *applyconfigurationsautoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) - // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). - ApplyStatus(ctx context.Context, horizontalPodAutoscaler *applyconfigurationsautoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *autoscalingv2beta1.HorizontalPodAutoscaler, err error) - HorizontalPodAutoscalerExpansion -} - -// horizontalPodAutoscalers implements HorizontalPodAutoscalerInterface -type horizontalPodAutoscalers struct { - *gentype.ClientWithListAndApply[*autoscalingv2beta1.HorizontalPodAutoscaler, *autoscalingv2beta1.HorizontalPodAutoscalerList, *applyconfigurationsautoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration] -} - -// newHorizontalPodAutoscalers returns a HorizontalPodAutoscalers -func newHorizontalPodAutoscalers(c *AutoscalingV2beta1Client, namespace string) *horizontalPodAutoscalers { - return &horizontalPodAutoscalers{ - gentype.NewClientWithListAndApply[*autoscalingv2beta1.HorizontalPodAutoscaler, *autoscalingv2beta1.HorizontalPodAutoscalerList, *applyconfigurationsautoscalingv2beta1.HorizontalPodAutoscalerApplyConfiguration]( - "horizontalpodautoscalers", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *autoscalingv2beta1.HorizontalPodAutoscaler { - return &autoscalingv2beta1.HorizontalPodAutoscaler{} - }, - func() *autoscalingv2beta1.HorizontalPodAutoscalerList { - return &autoscalingv2beta1.HorizontalPodAutoscalerList{} - }, - gentype.PrefersProtobuf[*autoscalingv2beta1.HorizontalPodAutoscaler](), - ), - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_autoscaling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_autoscaling_client.go deleted file mode 100644 index 99b5026bf7..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_autoscaling_client.go +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" - rest "k8s.io/client-go/rest" - testing "k8s.io/client-go/testing" -) - -type FakeAutoscalingV2beta2 struct { - *testing.Fake -} - -func (c *FakeAutoscalingV2beta2) HorizontalPodAutoscalers(namespace string) v2beta2.HorizontalPodAutoscalerInterface { - return newFakeHorizontalPodAutoscalers(c, namespace) -} - -// RESTClient returns a RESTClient that is used to communicate -// with API server by this client implementation. -func (c *FakeAutoscalingV2beta2) RESTClient() rest.Interface { - var ret *rest.RESTClient - return ret -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_horizontalpodautoscaler.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_horizontalpodautoscaler.go deleted file mode 100644 index f747da9d0f..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake/fake_horizontalpodautoscaler.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v2beta2 "k8s.io/api/autoscaling/v2beta2" - autoscalingv2beta2 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta2" - gentype "k8s.io/client-go/gentype" - typedautoscalingv2beta2 "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2" -) - -// fakeHorizontalPodAutoscalers implements HorizontalPodAutoscalerInterface -type fakeHorizontalPodAutoscalers struct { - *gentype.FakeClientWithListAndApply[*v2beta2.HorizontalPodAutoscaler, *v2beta2.HorizontalPodAutoscalerList, *autoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration] - Fake *FakeAutoscalingV2beta2 -} - -func newFakeHorizontalPodAutoscalers(fake *FakeAutoscalingV2beta2, namespace string) typedautoscalingv2beta2.HorizontalPodAutoscalerInterface { - return &fakeHorizontalPodAutoscalers{ - gentype.NewFakeClientWithListAndApply[*v2beta2.HorizontalPodAutoscaler, *v2beta2.HorizontalPodAutoscalerList, *autoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration]( - fake.Fake, - namespace, - v2beta2.SchemeGroupVersion.WithResource("horizontalpodautoscalers"), - v2beta2.SchemeGroupVersion.WithKind("HorizontalPodAutoscaler"), - func() *v2beta2.HorizontalPodAutoscaler { return &v2beta2.HorizontalPodAutoscaler{} }, - func() *v2beta2.HorizontalPodAutoscalerList { return &v2beta2.HorizontalPodAutoscalerList{} }, - func(dst, src *v2beta2.HorizontalPodAutoscalerList) { dst.ListMeta = src.ListMeta }, - func(list *v2beta2.HorizontalPodAutoscalerList) []*v2beta2.HorizontalPodAutoscaler { - return gentype.ToPointerSlice(list.Items) - }, - func(list *v2beta2.HorizontalPodAutoscalerList, items []*v2beta2.HorizontalPodAutoscaler) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/horizontalpodautoscaler.go deleted file mode 100644 index 017b3e1fc0..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/horizontalpodautoscaler.go +++ /dev/null @@ -1,79 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v2beta2 - -import ( - context "context" - - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - applyconfigurationsautoscalingv2beta2 "k8s.io/client-go/applyconfigurations/autoscaling/v2beta2" - gentype "k8s.io/client-go/gentype" - scheme "k8s.io/client-go/kubernetes/scheme" -) - -// HorizontalPodAutoscalersGetter has a method to return a HorizontalPodAutoscalerInterface. -// A group's client should implement this interface. -type HorizontalPodAutoscalersGetter interface { - HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerInterface -} - -// HorizontalPodAutoscalerInterface has methods to work with HorizontalPodAutoscaler resources. -type HorizontalPodAutoscalerInterface interface { - Create(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, opts v1.CreateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) - Update(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) - // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - UpdateStatus(ctx context.Context, horizontalPodAutoscaler *autoscalingv2beta2.HorizontalPodAutoscaler, opts v1.UpdateOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) - List(ctx context.Context, opts v1.ListOptions) (*autoscalingv2beta2.HorizontalPodAutoscalerList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) - Apply(ctx context.Context, horizontalPodAutoscaler *applyconfigurationsautoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) - // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). - ApplyStatus(ctx context.Context, horizontalPodAutoscaler *applyconfigurationsautoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration, opts v1.ApplyOptions) (result *autoscalingv2beta2.HorizontalPodAutoscaler, err error) - HorizontalPodAutoscalerExpansion -} - -// horizontalPodAutoscalers implements HorizontalPodAutoscalerInterface -type horizontalPodAutoscalers struct { - *gentype.ClientWithListAndApply[*autoscalingv2beta2.HorizontalPodAutoscaler, *autoscalingv2beta2.HorizontalPodAutoscalerList, *applyconfigurationsautoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration] -} - -// newHorizontalPodAutoscalers returns a HorizontalPodAutoscalers -func newHorizontalPodAutoscalers(c *AutoscalingV2beta2Client, namespace string) *horizontalPodAutoscalers { - return &horizontalPodAutoscalers{ - gentype.NewClientWithListAndApply[*autoscalingv2beta2.HorizontalPodAutoscaler, *autoscalingv2beta2.HorizontalPodAutoscalerList, *applyconfigurationsautoscalingv2beta2.HorizontalPodAutoscalerApplyConfiguration]( - "horizontalpodautoscalers", - c.RESTClient(), - scheme.ParameterCodec, - namespace, - func() *autoscalingv2beta2.HorizontalPodAutoscaler { - return &autoscalingv2beta2.HorizontalPodAutoscaler{} - }, - func() *autoscalingv2beta2.HorizontalPodAutoscalerList { - return &autoscalingv2beta2.HorizontalPodAutoscalerList{} - }, - gentype.PrefersProtobuf[*autoscalingv2beta2.HorizontalPodAutoscaler](), - ), - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go index 3fbb89ad43..2b607298ca 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/core/v1/fake/fake_pod_expansion.go @@ -17,16 +17,17 @@ limitations under the License. package fake import ( + "bytes" "context" "fmt" "io" "net/http" - "strings" v1 "k8s.io/api/core/v1" policyv1 "k8s.io/api/policy/v1" policyv1beta1 "k8s.io/api/policy/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/kubernetes/scheme" restclient "k8s.io/client-go/rest" fakerest "k8s.io/client-go/rest/fake" @@ -63,12 +64,26 @@ func (c *fakePods) GetLogs(name string, opts *v1.PodLogOptions) *restclient.Requ action.Subresource = "log" action.Value = opts - _, _ = c.Fake.Invokes(action, &v1.Pod{}) + defaultLogResponse := &runtime.Unknown{Raw: []byte("fake logs")} + obj, err := c.Fake.Invokes(action, defaultLogResponse) + logs := defaultLogResponse.Raw + if err == nil { + unknown, ok := obj.(*runtime.Unknown) + if !ok || unknown == nil { + err = fmt.Errorf("fake Pods.GetLogs expected reactor to return *runtime.Unknown, got %T", obj) + } else { + logs = unknown.Raw + } + } + fakeClient := &fakerest.RESTClient{ Client: fakerest.CreateHTTPClient(func(request *http.Request) (*http.Response, error) { + if err != nil { + return nil, err + } resp := &http.Response{ StatusCode: http.StatusOK, - Body: io.NopCloser(strings.NewReader("fake logs")), + Body: io.NopCloser(bytes.NewReader(logs)), } return resp, nil }), diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resource_client.go index 75bc9f9d33..99a5e8d877 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resource_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resource_client.go @@ -32,6 +32,10 @@ func (c *FakeResourceV1alpha3) DeviceTaintRules() v1alpha3.DeviceTaintRuleInterf return newFakeDeviceTaintRules(c) } +func (c *FakeResourceV1alpha3) ResourcePoolStatusRequests() v1alpha3.ResourcePoolStatusRequestInterface { + return newFakeResourcePoolStatusRequests(c) +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakeResourceV1alpha3) RESTClient() rest.Interface { diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resourcepoolstatusrequest.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resourcepoolstatusrequest.go new file mode 100644 index 0000000000..6196ddc1f6 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/fake/fake_resourcepoolstatusrequest.go @@ -0,0 +1,53 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha3 "k8s.io/api/resource/v1alpha3" + resourcev1alpha3 "k8s.io/client-go/applyconfigurations/resource/v1alpha3" + gentype "k8s.io/client-go/gentype" + typedresourcev1alpha3 "k8s.io/client-go/kubernetes/typed/resource/v1alpha3" +) + +// fakeResourcePoolStatusRequests implements ResourcePoolStatusRequestInterface +type fakeResourcePoolStatusRequests struct { + *gentype.FakeClientWithListAndApply[*v1alpha3.ResourcePoolStatusRequest, *v1alpha3.ResourcePoolStatusRequestList, *resourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration] + Fake *FakeResourceV1alpha3 +} + +func newFakeResourcePoolStatusRequests(fake *FakeResourceV1alpha3) typedresourcev1alpha3.ResourcePoolStatusRequestInterface { + return &fakeResourcePoolStatusRequests{ + gentype.NewFakeClientWithListAndApply[*v1alpha3.ResourcePoolStatusRequest, *v1alpha3.ResourcePoolStatusRequestList, *resourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration]( + fake.Fake, + "", + v1alpha3.SchemeGroupVersion.WithResource("resourcepoolstatusrequests"), + v1alpha3.SchemeGroupVersion.WithKind("ResourcePoolStatusRequest"), + func() *v1alpha3.ResourcePoolStatusRequest { return &v1alpha3.ResourcePoolStatusRequest{} }, + func() *v1alpha3.ResourcePoolStatusRequestList { return &v1alpha3.ResourcePoolStatusRequestList{} }, + func(dst, src *v1alpha3.ResourcePoolStatusRequestList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha3.ResourcePoolStatusRequestList) []*v1alpha3.ResourcePoolStatusRequest { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha3.ResourcePoolStatusRequestList, items []*v1alpha3.ResourcePoolStatusRequest) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/generated_expansion.go index 66e7c2b4b1..f5f9f8c840 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/generated_expansion.go @@ -19,3 +19,5 @@ limitations under the License. package v1alpha3 type DeviceTaintRuleExpansion interface{} + +type ResourcePoolStatusRequestExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resource_client.go index a7e2212fe7..ad36c69048 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resource_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resource_client.go @@ -29,6 +29,7 @@ import ( type ResourceV1alpha3Interface interface { RESTClient() rest.Interface DeviceTaintRulesGetter + ResourcePoolStatusRequestsGetter } // ResourceV1alpha3Client is used to interact with features provided by the resource.k8s.io group. @@ -40,6 +41,10 @@ func (c *ResourceV1alpha3Client) DeviceTaintRules() DeviceTaintRuleInterface { return newDeviceTaintRules(c) } +func (c *ResourceV1alpha3Client) ResourcePoolStatusRequests() ResourcePoolStatusRequestInterface { + return newResourcePoolStatusRequests(c) +} + // NewForConfig creates a new ResourceV1alpha3Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resourcepoolstatusrequest.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resourcepoolstatusrequest.go new file mode 100644 index 0000000000..964e488416 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1alpha3/resourcepoolstatusrequest.go @@ -0,0 +1,79 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + context "context" + + resourcev1alpha3 "k8s.io/api/resource/v1alpha3" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsresourcev1alpha3 "k8s.io/client-go/applyconfigurations/resource/v1alpha3" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// ResourcePoolStatusRequestsGetter has a method to return a ResourcePoolStatusRequestInterface. +// A group's client should implement this interface. +type ResourcePoolStatusRequestsGetter interface { + ResourcePoolStatusRequests() ResourcePoolStatusRequestInterface +} + +// ResourcePoolStatusRequestInterface has methods to work with ResourcePoolStatusRequest resources. +type ResourcePoolStatusRequestInterface interface { + Create(ctx context.Context, resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, opts v1.CreateOptions) (*resourcev1alpha3.ResourcePoolStatusRequest, error) + Update(ctx context.Context, resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, opts v1.UpdateOptions) (*resourcev1alpha3.ResourcePoolStatusRequest, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, resourcePoolStatusRequest *resourcev1alpha3.ResourcePoolStatusRequest, opts v1.UpdateOptions) (*resourcev1alpha3.ResourcePoolStatusRequest, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*resourcev1alpha3.ResourcePoolStatusRequest, error) + List(ctx context.Context, opts v1.ListOptions) (*resourcev1alpha3.ResourcePoolStatusRequestList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *resourcev1alpha3.ResourcePoolStatusRequest, err error) + Apply(ctx context.Context, resourcePoolStatusRequest *applyconfigurationsresourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration, opts v1.ApplyOptions) (result *resourcev1alpha3.ResourcePoolStatusRequest, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, resourcePoolStatusRequest *applyconfigurationsresourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration, opts v1.ApplyOptions) (result *resourcev1alpha3.ResourcePoolStatusRequest, err error) + ResourcePoolStatusRequestExpansion +} + +// resourcePoolStatusRequests implements ResourcePoolStatusRequestInterface +type resourcePoolStatusRequests struct { + *gentype.ClientWithListAndApply[*resourcev1alpha3.ResourcePoolStatusRequest, *resourcev1alpha3.ResourcePoolStatusRequestList, *applyconfigurationsresourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration] +} + +// newResourcePoolStatusRequests returns a ResourcePoolStatusRequests +func newResourcePoolStatusRequests(c *ResourceV1alpha3Client) *resourcePoolStatusRequests { + return &resourcePoolStatusRequests{ + gentype.NewClientWithListAndApply[*resourcev1alpha3.ResourcePoolStatusRequest, *resourcev1alpha3.ResourcePoolStatusRequestList, *applyconfigurationsresourcev1alpha3.ResourcePoolStatusRequestApplyConfiguration]( + "resourcepoolstatusrequests", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *resourcev1alpha3.ResourcePoolStatusRequest { + return &resourcev1alpha3.ResourcePoolStatusRequest{} + }, + func() *resourcev1alpha3.ResourcePoolStatusRequestList { + return &resourcev1alpha3.ResourcePoolStatusRequestList{} + }, + gentype.PrefersProtobuf[*resourcev1alpha3.ResourcePoolStatusRequest](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/devicetaintrule.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/devicetaintrule.go new file mode 100644 index 0000000000..da915c51f1 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/devicetaintrule.go @@ -0,0 +1,75 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1beta2 + +import ( + context "context" + + resourcev1beta2 "k8s.io/api/resource/v1beta2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsresourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// DeviceTaintRulesGetter has a method to return a DeviceTaintRuleInterface. +// A group's client should implement this interface. +type DeviceTaintRulesGetter interface { + DeviceTaintRules() DeviceTaintRuleInterface +} + +// DeviceTaintRuleInterface has methods to work with DeviceTaintRule resources. +type DeviceTaintRuleInterface interface { + Create(ctx context.Context, deviceTaintRule *resourcev1beta2.DeviceTaintRule, opts v1.CreateOptions) (*resourcev1beta2.DeviceTaintRule, error) + Update(ctx context.Context, deviceTaintRule *resourcev1beta2.DeviceTaintRule, opts v1.UpdateOptions) (*resourcev1beta2.DeviceTaintRule, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, deviceTaintRule *resourcev1beta2.DeviceTaintRule, opts v1.UpdateOptions) (*resourcev1beta2.DeviceTaintRule, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*resourcev1beta2.DeviceTaintRule, error) + List(ctx context.Context, opts v1.ListOptions) (*resourcev1beta2.DeviceTaintRuleList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *resourcev1beta2.DeviceTaintRule, err error) + Apply(ctx context.Context, deviceTaintRule *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration, opts v1.ApplyOptions) (result *resourcev1beta2.DeviceTaintRule, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, deviceTaintRule *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration, opts v1.ApplyOptions) (result *resourcev1beta2.DeviceTaintRule, err error) + DeviceTaintRuleExpansion +} + +// deviceTaintRules implements DeviceTaintRuleInterface +type deviceTaintRules struct { + *gentype.ClientWithListAndApply[*resourcev1beta2.DeviceTaintRule, *resourcev1beta2.DeviceTaintRuleList, *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration] +} + +// newDeviceTaintRules returns a DeviceTaintRules +func newDeviceTaintRules(c *ResourceV1beta2Client) *deviceTaintRules { + return &deviceTaintRules{ + gentype.NewClientWithListAndApply[*resourcev1beta2.DeviceTaintRule, *resourcev1beta2.DeviceTaintRuleList, *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration]( + "devicetaintrules", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *resourcev1beta2.DeviceTaintRule { return &resourcev1beta2.DeviceTaintRule{} }, + func() *resourcev1beta2.DeviceTaintRuleList { return &resourcev1beta2.DeviceTaintRuleList{} }, + gentype.PrefersProtobuf[*resourcev1beta2.DeviceTaintRule](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_devicetaintrule.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_devicetaintrule.go new file mode 100644 index 0000000000..13797c6cfd --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_devicetaintrule.go @@ -0,0 +1,53 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1beta2 "k8s.io/api/resource/v1beta2" + resourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2" + gentype "k8s.io/client-go/gentype" + typedresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2" +) + +// fakeDeviceTaintRules implements DeviceTaintRuleInterface +type fakeDeviceTaintRules struct { + *gentype.FakeClientWithListAndApply[*v1beta2.DeviceTaintRule, *v1beta2.DeviceTaintRuleList, *resourcev1beta2.DeviceTaintRuleApplyConfiguration] + Fake *FakeResourceV1beta2 +} + +func newFakeDeviceTaintRules(fake *FakeResourceV1beta2) typedresourcev1beta2.DeviceTaintRuleInterface { + return &fakeDeviceTaintRules{ + gentype.NewFakeClientWithListAndApply[*v1beta2.DeviceTaintRule, *v1beta2.DeviceTaintRuleList, *resourcev1beta2.DeviceTaintRuleApplyConfiguration]( + fake.Fake, + "", + v1beta2.SchemeGroupVersion.WithResource("devicetaintrules"), + v1beta2.SchemeGroupVersion.WithKind("DeviceTaintRule"), + func() *v1beta2.DeviceTaintRule { return &v1beta2.DeviceTaintRule{} }, + func() *v1beta2.DeviceTaintRuleList { return &v1beta2.DeviceTaintRuleList{} }, + func(dst, src *v1beta2.DeviceTaintRuleList) { dst.ListMeta = src.ListMeta }, + func(list *v1beta2.DeviceTaintRuleList) []*v1beta2.DeviceTaintRule { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1beta2.DeviceTaintRuleList, items []*v1beta2.DeviceTaintRule) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resource_client.go index 10c5c0e337..718bdd9e0d 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resource_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake/fake_resource_client.go @@ -32,6 +32,10 @@ func (c *FakeResourceV1beta2) DeviceClasses() v1beta2.DeviceClassInterface { return newFakeDeviceClasses(c) } +func (c *FakeResourceV1beta2) DeviceTaintRules() v1beta2.DeviceTaintRuleInterface { + return newFakeDeviceTaintRules(c) +} + func (c *FakeResourceV1beta2) ResourceClaims(namespace string) v1beta2.ResourceClaimInterface { return newFakeResourceClaims(c, namespace) } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/generated_expansion.go index 230ab8ccd3..06a1dc6e93 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/generated_expansion.go @@ -20,6 +20,8 @@ package v1beta2 type DeviceClassExpansion interface{} +type DeviceTaintRuleExpansion interface{} + type ResourceClaimExpansion interface{} type ResourceClaimTemplateExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/resource_client.go b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/resource_client.go index aadde5be95..45465a480d 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/resource_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/resource/v1beta2/resource_client.go @@ -29,6 +29,7 @@ import ( type ResourceV1beta2Interface interface { RESTClient() rest.Interface DeviceClassesGetter + DeviceTaintRulesGetter ResourceClaimsGetter ResourceClaimTemplatesGetter ResourceSlicesGetter @@ -43,6 +44,10 @@ func (c *ResourceV1beta2Client) DeviceClasses() DeviceClassInterface { return newDeviceClasses(c) } +func (c *ResourceV1beta2Client) DeviceTaintRules() DeviceTaintRuleInterface { + return newDeviceTaintRules(c) +} + func (c *ResourceV1beta2Client) ResourceClaims(namespace string) ResourceClaimInterface { return newResourceClaims(c, namespace) } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/doc.go deleted file mode 100644 index 16f4439906..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -// Package fake has the automatically generated clients. -package fake diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_priorityclass.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_priorityclass.go deleted file mode 100644 index 7d5a8e2630..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_priorityclass.go +++ /dev/null @@ -1,53 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha1 "k8s.io/api/scheduling/v1alpha1" - schedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" - gentype "k8s.io/client-go/gentype" - typedschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" -) - -// fakePriorityClasses implements PriorityClassInterface -type fakePriorityClasses struct { - *gentype.FakeClientWithListAndApply[*v1alpha1.PriorityClass, *v1alpha1.PriorityClassList, *schedulingv1alpha1.PriorityClassApplyConfiguration] - Fake *FakeSchedulingV1alpha1 -} - -func newFakePriorityClasses(fake *FakeSchedulingV1alpha1) typedschedulingv1alpha1.PriorityClassInterface { - return &fakePriorityClasses{ - gentype.NewFakeClientWithListAndApply[*v1alpha1.PriorityClass, *v1alpha1.PriorityClassList, *schedulingv1alpha1.PriorityClassApplyConfiguration]( - fake.Fake, - "", - v1alpha1.SchemeGroupVersion.WithResource("priorityclasses"), - v1alpha1.SchemeGroupVersion.WithKind("PriorityClass"), - func() *v1alpha1.PriorityClass { return &v1alpha1.PriorityClass{} }, - func() *v1alpha1.PriorityClassList { return &v1alpha1.PriorityClassList{} }, - func(dst, src *v1alpha1.PriorityClassList) { dst.ListMeta = src.ListMeta }, - func(list *v1alpha1.PriorityClassList) []*v1alpha1.PriorityClass { - return gentype.ToPointerSlice(list.Items) - }, - func(list *v1alpha1.PriorityClassList, items []*v1alpha1.PriorityClass) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_workload.go deleted file mode 100644 index 06a48d24e0..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_workload.go +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha1 "k8s.io/api/scheduling/v1alpha1" - schedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" - gentype "k8s.io/client-go/gentype" - typedschedulingv1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" -) - -// fakeWorkloads implements WorkloadInterface -type fakeWorkloads struct { - *gentype.FakeClientWithListAndApply[*v1alpha1.Workload, *v1alpha1.WorkloadList, *schedulingv1alpha1.WorkloadApplyConfiguration] - Fake *FakeSchedulingV1alpha1 -} - -func newFakeWorkloads(fake *FakeSchedulingV1alpha1, namespace string) typedschedulingv1alpha1.WorkloadInterface { - return &fakeWorkloads{ - gentype.NewFakeClientWithListAndApply[*v1alpha1.Workload, *v1alpha1.WorkloadList, *schedulingv1alpha1.WorkloadApplyConfiguration]( - fake.Fake, - namespace, - v1alpha1.SchemeGroupVersion.WithResource("workloads"), - v1alpha1.SchemeGroupVersion.WithKind("Workload"), - func() *v1alpha1.Workload { return &v1alpha1.Workload{} }, - func() *v1alpha1.WorkloadList { return &v1alpha1.WorkloadList{} }, - func(dst, src *v1alpha1.WorkloadList) { dst.ListMeta = src.ListMeta }, - func(list *v1alpha1.WorkloadList) []*v1alpha1.Workload { return gentype.ToPointerSlice(list.Items) }, - func(list *v1alpha1.WorkloadList, items []*v1alpha1.Workload) { - list.Items = gentype.FromPointerSlice(items) - }, - ), - fake, - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/priorityclass.go deleted file mode 100644 index e7125f9fc3..0000000000 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/priorityclass.go +++ /dev/null @@ -1,71 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha1 - -import ( - context "context" - - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - applyconfigurationsschedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" - gentype "k8s.io/client-go/gentype" - scheme "k8s.io/client-go/kubernetes/scheme" -) - -// PriorityClassesGetter has a method to return a PriorityClassInterface. -// A group's client should implement this interface. -type PriorityClassesGetter interface { - PriorityClasses() PriorityClassInterface -} - -// PriorityClassInterface has methods to work with PriorityClass resources. -type PriorityClassInterface interface { - Create(ctx context.Context, priorityClass *schedulingv1alpha1.PriorityClass, opts v1.CreateOptions) (*schedulingv1alpha1.PriorityClass, error) - Update(ctx context.Context, priorityClass *schedulingv1alpha1.PriorityClass, opts v1.UpdateOptions) (*schedulingv1alpha1.PriorityClass, error) - Delete(ctx context.Context, name string, opts v1.DeleteOptions) error - DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha1.PriorityClass, error) - List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha1.PriorityClassList, error) - Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha1.PriorityClass, err error) - Apply(ctx context.Context, priorityClass *applyconfigurationsschedulingv1alpha1.PriorityClassApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha1.PriorityClass, err error) - PriorityClassExpansion -} - -// priorityClasses implements PriorityClassInterface -type priorityClasses struct { - *gentype.ClientWithListAndApply[*schedulingv1alpha1.PriorityClass, *schedulingv1alpha1.PriorityClassList, *applyconfigurationsschedulingv1alpha1.PriorityClassApplyConfiguration] -} - -// newPriorityClasses returns a PriorityClasses -func newPriorityClasses(c *SchedulingV1alpha1Client) *priorityClasses { - return &priorityClasses{ - gentype.NewClientWithListAndApply[*schedulingv1alpha1.PriorityClass, *schedulingv1alpha1.PriorityClassList, *applyconfigurationsschedulingv1alpha1.PriorityClassApplyConfiguration]( - "priorityclasses", - c.RESTClient(), - scheme.ParameterCodec, - "", - func() *schedulingv1alpha1.PriorityClass { return &schedulingv1alpha1.PriorityClass{} }, - func() *schedulingv1alpha1.PriorityClassList { return &schedulingv1alpha1.PriorityClassList{} }, - gentype.PrefersProtobuf[*schedulingv1alpha1.PriorityClass](), - ), - } -} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go similarity index 97% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/doc.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go index df51baa4d4..baaf2d9853 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/doc.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/doc.go @@ -17,4 +17,4 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. // This package has the automatically generated typed clients. -package v1alpha1 +package v1alpha2 diff --git a/vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/doc.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go similarity index 100% rename from vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake/doc.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/doc.go diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go new file mode 100644 index 0000000000..3709cf5214 --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_podgroup.go @@ -0,0 +1,51 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" + gentype "k8s.io/client-go/gentype" + typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" +) + +// fakePodGroups implements PodGroupInterface +type fakePodGroups struct { + *gentype.FakeClientWithListAndApply[*v1alpha2.PodGroup, *v1alpha2.PodGroupList, *schedulingv1alpha2.PodGroupApplyConfiguration] + Fake *FakeSchedulingV1alpha2 +} + +func newFakePodGroups(fake *FakeSchedulingV1alpha2, namespace string) typedschedulingv1alpha2.PodGroupInterface { + return &fakePodGroups{ + gentype.NewFakeClientWithListAndApply[*v1alpha2.PodGroup, *v1alpha2.PodGroupList, *schedulingv1alpha2.PodGroupApplyConfiguration]( + fake.Fake, + namespace, + v1alpha2.SchemeGroupVersion.WithResource("podgroups"), + v1alpha2.SchemeGroupVersion.WithKind("PodGroup"), + func() *v1alpha2.PodGroup { return &v1alpha2.PodGroup{} }, + func() *v1alpha2.PodGroupList { return &v1alpha2.PodGroupList{} }, + func(dst, src *v1alpha2.PodGroupList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha2.PodGroupList) []*v1alpha2.PodGroup { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha2.PodGroupList, items []*v1alpha2.PodGroup) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go similarity index 70% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go index 2be1412662..1d21b2d914 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake/fake_scheduling_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_scheduling_client.go @@ -19,26 +19,26 @@ limitations under the License. package fake import ( - v1alpha1 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1" + v1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" rest "k8s.io/client-go/rest" testing "k8s.io/client-go/testing" ) -type FakeSchedulingV1alpha1 struct { +type FakeSchedulingV1alpha2 struct { *testing.Fake } -func (c *FakeSchedulingV1alpha1) PriorityClasses() v1alpha1.PriorityClassInterface { - return newFakePriorityClasses(c) +func (c *FakeSchedulingV1alpha2) PodGroups(namespace string) v1alpha2.PodGroupInterface { + return newFakePodGroups(c, namespace) } -func (c *FakeSchedulingV1alpha1) Workloads(namespace string) v1alpha1.WorkloadInterface { +func (c *FakeSchedulingV1alpha2) Workloads(namespace string) v1alpha2.WorkloadInterface { return newFakeWorkloads(c, namespace) } // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *FakeSchedulingV1alpha1) RESTClient() rest.Interface { +func (c *FakeSchedulingV1alpha2) RESTClient() rest.Interface { var ret *rest.RESTClient return ret } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go new file mode 100644 index 0000000000..29768874cf --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake/fake_workload.go @@ -0,0 +1,51 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "k8s.io/api/scheduling/v1alpha2" + schedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" + gentype "k8s.io/client-go/gentype" + typedschedulingv1alpha2 "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2" +) + +// fakeWorkloads implements WorkloadInterface +type fakeWorkloads struct { + *gentype.FakeClientWithListAndApply[*v1alpha2.Workload, *v1alpha2.WorkloadList, *schedulingv1alpha2.WorkloadApplyConfiguration] + Fake *FakeSchedulingV1alpha2 +} + +func newFakeWorkloads(fake *FakeSchedulingV1alpha2, namespace string) typedschedulingv1alpha2.WorkloadInterface { + return &fakeWorkloads{ + gentype.NewFakeClientWithListAndApply[*v1alpha2.Workload, *v1alpha2.WorkloadList, *schedulingv1alpha2.WorkloadApplyConfiguration]( + fake.Fake, + namespace, + v1alpha2.SchemeGroupVersion.WithResource("workloads"), + v1alpha2.SchemeGroupVersion.WithKind("Workload"), + func() *v1alpha2.Workload { return &v1alpha2.Workload{} }, + func() *v1alpha2.WorkloadList { return &v1alpha2.WorkloadList{} }, + func(dst, src *v1alpha2.WorkloadList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha2.WorkloadList) []*v1alpha2.Workload { return gentype.ToPointerSlice(list.Items) }, + func(list *v1alpha2.WorkloadList, items []*v1alpha2.Workload) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go similarity index 91% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go index 24946041af..60668af04d 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/generated_expansion.go @@ -16,8 +16,8 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 -type PriorityClassExpansion interface{} +type PodGroupExpansion interface{} type WorkloadExpansion interface{} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go new file mode 100644 index 0000000000..bbe91d35ab --- /dev/null +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/podgroup.go @@ -0,0 +1,75 @@ +/* +Copyright 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + context "context" + + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + applyconfigurationsschedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" + gentype "k8s.io/client-go/gentype" + scheme "k8s.io/client-go/kubernetes/scheme" +) + +// PodGroupsGetter has a method to return a PodGroupInterface. +// A group's client should implement this interface. +type PodGroupsGetter interface { + PodGroups(namespace string) PodGroupInterface +} + +// PodGroupInterface has methods to work with PodGroup resources. +type PodGroupInterface interface { + Create(ctx context.Context, podGroup *schedulingv1alpha2.PodGroup, opts v1.CreateOptions) (*schedulingv1alpha2.PodGroup, error) + Update(ctx context.Context, podGroup *schedulingv1alpha2.PodGroup, opts v1.UpdateOptions) (*schedulingv1alpha2.PodGroup, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, podGroup *schedulingv1alpha2.PodGroup, opts v1.UpdateOptions) (*schedulingv1alpha2.PodGroup, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha2.PodGroup, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.PodGroupList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha2.PodGroup, err error) + Apply(ctx context.Context, podGroup *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha2.PodGroup, err error) + // Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). + ApplyStatus(ctx context.Context, podGroup *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha2.PodGroup, err error) + PodGroupExpansion +} + +// podGroups implements PodGroupInterface +type podGroups struct { + *gentype.ClientWithListAndApply[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList, *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration] +} + +// newPodGroups returns a PodGroups +func newPodGroups(c *SchedulingV1alpha2Client, namespace string) *podGroups { + return &podGroups{ + gentype.NewClientWithListAndApply[*schedulingv1alpha2.PodGroup, *schedulingv1alpha2.PodGroupList, *applyconfigurationsschedulingv1alpha2.PodGroupApplyConfiguration]( + "podgroups", + c.RESTClient(), + scheme.ParameterCodec, + namespace, + func() *schedulingv1alpha2.PodGroup { return &schedulingv1alpha2.PodGroup{} }, + func() *schedulingv1alpha2.PodGroupList { return &schedulingv1alpha2.PodGroupList{} }, + gentype.PrefersProtobuf[*schedulingv1alpha2.PodGroup](), + ), + } +} diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go similarity index 67% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go index 0c53bc368a..8ccdc178b9 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/scheduling_client.go @@ -16,39 +16,39 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 import ( http "net/http" - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" scheme "k8s.io/client-go/kubernetes/scheme" rest "k8s.io/client-go/rest" ) -type SchedulingV1alpha1Interface interface { +type SchedulingV1alpha2Interface interface { RESTClient() rest.Interface - PriorityClassesGetter + PodGroupsGetter WorkloadsGetter } -// SchedulingV1alpha1Client is used to interact with features provided by the scheduling.k8s.io group. -type SchedulingV1alpha1Client struct { +// SchedulingV1alpha2Client is used to interact with features provided by the scheduling.k8s.io group. +type SchedulingV1alpha2Client struct { restClient rest.Interface } -func (c *SchedulingV1alpha1Client) PriorityClasses() PriorityClassInterface { - return newPriorityClasses(c) +func (c *SchedulingV1alpha2Client) PodGroups(namespace string) PodGroupInterface { + return newPodGroups(c, namespace) } -func (c *SchedulingV1alpha1Client) Workloads(namespace string) WorkloadInterface { +func (c *SchedulingV1alpha2Client) Workloads(namespace string) WorkloadInterface { return newWorkloads(c, namespace) } -// NewForConfig creates a new SchedulingV1alpha1Client for the given config. +// NewForConfig creates a new SchedulingV1alpha2Client for the given config. // NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), // where httpClient was generated with rest.HTTPClientFor(c). -func NewForConfig(c *rest.Config) (*SchedulingV1alpha1Client, error) { +func NewForConfig(c *rest.Config) (*SchedulingV1alpha2Client, error) { config := *c setConfigDefaults(&config) httpClient, err := rest.HTTPClientFor(&config) @@ -58,21 +58,21 @@ func NewForConfig(c *rest.Config) (*SchedulingV1alpha1Client, error) { return NewForConfigAndClient(&config, httpClient) } -// NewForConfigAndClient creates a new SchedulingV1alpha1Client for the given config and http client. +// NewForConfigAndClient creates a new SchedulingV1alpha2Client for the given config and http client. // Note the http client provided takes precedence over the configured transport values. -func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SchedulingV1alpha1Client, error) { +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*SchedulingV1alpha2Client, error) { config := *c setConfigDefaults(&config) client, err := rest.RESTClientForConfigAndClient(&config, h) if err != nil { return nil, err } - return &SchedulingV1alpha1Client{client}, nil + return &SchedulingV1alpha2Client{client}, nil } -// NewForConfigOrDie creates a new SchedulingV1alpha1Client for the given config and +// NewForConfigOrDie creates a new SchedulingV1alpha2Client for the given config and // panics if there is an error in the config. -func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha1Client { +func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha2Client { client, err := NewForConfig(c) if err != nil { panic(err) @@ -80,13 +80,13 @@ func NewForConfigOrDie(c *rest.Config) *SchedulingV1alpha1Client { return client } -// New creates a new SchedulingV1alpha1Client for the given RESTClient. -func New(c rest.Interface) *SchedulingV1alpha1Client { - return &SchedulingV1alpha1Client{c} +// New creates a new SchedulingV1alpha2Client for the given RESTClient. +func New(c rest.Interface) *SchedulingV1alpha2Client { + return &SchedulingV1alpha2Client{c} } func setConfigDefaults(config *rest.Config) { - gv := schedulingv1alpha1.SchemeGroupVersion + gv := schedulingv1alpha2.SchemeGroupVersion config.GroupVersion = &gv config.APIPath = "/apis" config.NegotiatedSerializer = rest.CodecFactoryForGeneratedClient(scheme.Scheme, scheme.Codecs).WithoutConversion() @@ -98,7 +98,7 @@ func setConfigDefaults(config *rest.Config) { // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. -func (c *SchedulingV1alpha1Client) RESTClient() rest.Interface { +func (c *SchedulingV1alpha2Client) RESTClient() rest.Interface { if c == nil { return nil } diff --git a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/workload.go b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go similarity index 60% rename from vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/workload.go rename to vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go index 9c906b5e89..89790940bc 100644 --- a/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/workload.go +++ b/vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/workload.go @@ -16,16 +16,16 @@ limitations under the License. // Code generated by client-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 import ( context "context" - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" watch "k8s.io/apimachinery/pkg/watch" - applyconfigurationsschedulingv1alpha1 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha1" + applyconfigurationsschedulingv1alpha2 "k8s.io/client-go/applyconfigurations/scheduling/v1alpha2" gentype "k8s.io/client-go/gentype" scheme "k8s.io/client-go/kubernetes/scheme" ) @@ -38,34 +38,34 @@ type WorkloadsGetter interface { // WorkloadInterface has methods to work with Workload resources. type WorkloadInterface interface { - Create(ctx context.Context, workload *schedulingv1alpha1.Workload, opts v1.CreateOptions) (*schedulingv1alpha1.Workload, error) - Update(ctx context.Context, workload *schedulingv1alpha1.Workload, opts v1.UpdateOptions) (*schedulingv1alpha1.Workload, error) + Create(ctx context.Context, workload *schedulingv1alpha2.Workload, opts v1.CreateOptions) (*schedulingv1alpha2.Workload, error) + Update(ctx context.Context, workload *schedulingv1alpha2.Workload, opts v1.UpdateOptions) (*schedulingv1alpha2.Workload, error) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error - Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha1.Workload, error) - List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha1.WorkloadList, error) + Get(ctx context.Context, name string, opts v1.GetOptions) (*schedulingv1alpha2.Workload, error) + List(ctx context.Context, opts v1.ListOptions) (*schedulingv1alpha2.WorkloadList, error) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) - Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha1.Workload, err error) - Apply(ctx context.Context, workload *applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha1.Workload, err error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *schedulingv1alpha2.Workload, err error) + Apply(ctx context.Context, workload *applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration, opts v1.ApplyOptions) (result *schedulingv1alpha2.Workload, err error) WorkloadExpansion } // workloads implements WorkloadInterface type workloads struct { - *gentype.ClientWithListAndApply[*schedulingv1alpha1.Workload, *schedulingv1alpha1.WorkloadList, *applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration] + *gentype.ClientWithListAndApply[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList, *applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration] } // newWorkloads returns a Workloads -func newWorkloads(c *SchedulingV1alpha1Client, namespace string) *workloads { +func newWorkloads(c *SchedulingV1alpha2Client, namespace string) *workloads { return &workloads{ - gentype.NewClientWithListAndApply[*schedulingv1alpha1.Workload, *schedulingv1alpha1.WorkloadList, *applyconfigurationsschedulingv1alpha1.WorkloadApplyConfiguration]( + gentype.NewClientWithListAndApply[*schedulingv1alpha2.Workload, *schedulingv1alpha2.WorkloadList, *applyconfigurationsschedulingv1alpha2.WorkloadApplyConfiguration]( "workloads", c.RESTClient(), scheme.ParameterCodec, namespace, - func() *schedulingv1alpha1.Workload { return &schedulingv1alpha1.Workload{} }, - func() *schedulingv1alpha1.WorkloadList { return &schedulingv1alpha1.WorkloadList{} }, - gentype.PrefersProtobuf[*schedulingv1alpha1.Workload](), + func() *schedulingv1alpha2.Workload { return &schedulingv1alpha2.Workload{} }, + func() *schedulingv1alpha2.WorkloadList { return &schedulingv1alpha2.WorkloadList{} }, + gentype.PrefersProtobuf[*schedulingv1alpha2.Workload](), ), } } diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go index 9002ad6ea3..d3c96490fc 100644 --- a/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/expansion_generated.go @@ -18,6 +18,14 @@ limitations under the License. package v1 +// MutatingAdmissionPolicyListerExpansion allows custom methods to be added to +// MutatingAdmissionPolicyLister. +type MutatingAdmissionPolicyListerExpansion interface{} + +// MutatingAdmissionPolicyBindingListerExpansion allows custom methods to be added to +// MutatingAdmissionPolicyBindingLister. +type MutatingAdmissionPolicyBindingListerExpansion interface{} + // MutatingWebhookConfigurationListerExpansion allows custom methods to be added to // MutatingWebhookConfigurationLister. type MutatingWebhookConfigurationListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicy.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicy.go new file mode 100644 index 0000000000..3f5567f5cd --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicy.go @@ -0,0 +1,48 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingAdmissionPolicyLister helps list MutatingAdmissionPolicies. +// All objects returned here must be treated as read-only. +type MutatingAdmissionPolicyLister interface { + // List lists all MutatingAdmissionPolicies in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*admissionregistrationv1.MutatingAdmissionPolicy, err error) + // Get retrieves the MutatingAdmissionPolicy from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*admissionregistrationv1.MutatingAdmissionPolicy, error) + MutatingAdmissionPolicyListerExpansion +} + +// mutatingAdmissionPolicyLister implements the MutatingAdmissionPolicyLister interface. +type mutatingAdmissionPolicyLister struct { + listers.ResourceIndexer[*admissionregistrationv1.MutatingAdmissionPolicy] +} + +// NewMutatingAdmissionPolicyLister returns a new MutatingAdmissionPolicyLister. +func NewMutatingAdmissionPolicyLister(indexer cache.Indexer) MutatingAdmissionPolicyLister { + return &mutatingAdmissionPolicyLister{listers.New[*admissionregistrationv1.MutatingAdmissionPolicy](indexer, admissionregistrationv1.Resource("mutatingadmissionpolicy"))} +} diff --git a/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicybinding.go b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicybinding.go new file mode 100644 index 0000000000..686a9cc55c --- /dev/null +++ b/vendor/k8s.io/client-go/listers/admissionregistration/v1/mutatingadmissionpolicybinding.go @@ -0,0 +1,48 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + admissionregistrationv1 "k8s.io/api/admissionregistration/v1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// MutatingAdmissionPolicyBindingLister helps list MutatingAdmissionPolicyBindings. +// All objects returned here must be treated as read-only. +type MutatingAdmissionPolicyBindingLister interface { + // List lists all MutatingAdmissionPolicyBindings in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*admissionregistrationv1.MutatingAdmissionPolicyBinding, err error) + // Get retrieves the MutatingAdmissionPolicyBinding from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*admissionregistrationv1.MutatingAdmissionPolicyBinding, error) + MutatingAdmissionPolicyBindingListerExpansion +} + +// mutatingAdmissionPolicyBindingLister implements the MutatingAdmissionPolicyBindingLister interface. +type mutatingAdmissionPolicyBindingLister struct { + listers.ResourceIndexer[*admissionregistrationv1.MutatingAdmissionPolicyBinding] +} + +// NewMutatingAdmissionPolicyBindingLister returns a new MutatingAdmissionPolicyBindingLister. +func NewMutatingAdmissionPolicyBindingLister(indexer cache.Indexer) MutatingAdmissionPolicyBindingLister { + return &mutatingAdmissionPolicyBindingLister{listers.New[*admissionregistrationv1.MutatingAdmissionPolicyBinding](indexer, admissionregistrationv1.Resource("mutatingadmissionpolicybinding"))} +} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go deleted file mode 100644 index 8d46a4b6e3..0000000000 --- a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2beta1 - -// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to -// HorizontalPodAutoscalerLister. -type HorizontalPodAutoscalerListerExpansion interface{} - -// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to -// HorizontalPodAutoscalerNamespaceLister. -type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go deleted file mode 100644 index b7ad8e79b5..0000000000 --- a/vendor/k8s.io/client-go/listers/autoscaling/v2beta1/horizontalpodautoscaler.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2beta1 - -import ( - autoscalingv2beta1 "k8s.io/api/autoscaling/v2beta1" - labels "k8s.io/apimachinery/pkg/labels" - listers "k8s.io/client-go/listers" - cache "k8s.io/client-go/tools/cache" -) - -// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. -// All objects returned here must be treated as read-only. -type HorizontalPodAutoscalerLister interface { - // List lists all HorizontalPodAutoscalers in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*autoscalingv2beta1.HorizontalPodAutoscaler, err error) - // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. - HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister - HorizontalPodAutoscalerListerExpansion -} - -// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. -type horizontalPodAutoscalerLister struct { - listers.ResourceIndexer[*autoscalingv2beta1.HorizontalPodAutoscaler] -} - -// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. -func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { - return &horizontalPodAutoscalerLister{listers.New[*autoscalingv2beta1.HorizontalPodAutoscaler](indexer, autoscalingv2beta1.Resource("horizontalpodautoscaler"))} -} - -// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. -func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { - return horizontalPodAutoscalerNamespaceLister{listers.NewNamespaced[*autoscalingv2beta1.HorizontalPodAutoscaler](s.ResourceIndexer, namespace)} -} - -// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. -// All objects returned here must be treated as read-only. -type HorizontalPodAutoscalerNamespaceLister interface { - // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*autoscalingv2beta1.HorizontalPodAutoscaler, err error) - // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*autoscalingv2beta1.HorizontalPodAutoscaler, error) - HorizontalPodAutoscalerNamespaceListerExpansion -} - -// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister -// interface. -type horizontalPodAutoscalerNamespaceLister struct { - listers.ResourceIndexer[*autoscalingv2beta1.HorizontalPodAutoscaler] -} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go deleted file mode 100644 index 5127945a9c..0000000000 --- a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/expansion_generated.go +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2beta2 - -// HorizontalPodAutoscalerListerExpansion allows custom methods to be added to -// HorizontalPodAutoscalerLister. -type HorizontalPodAutoscalerListerExpansion interface{} - -// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to -// HorizontalPodAutoscalerNamespaceLister. -type HorizontalPodAutoscalerNamespaceListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go b/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go deleted file mode 100644 index 8d0fa6e798..0000000000 --- a/vendor/k8s.io/client-go/listers/autoscaling/v2beta2/horizontalpodautoscaler.go +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v2beta2 - -import ( - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" - labels "k8s.io/apimachinery/pkg/labels" - listers "k8s.io/client-go/listers" - cache "k8s.io/client-go/tools/cache" -) - -// HorizontalPodAutoscalerLister helps list HorizontalPodAutoscalers. -// All objects returned here must be treated as read-only. -type HorizontalPodAutoscalerLister interface { - // List lists all HorizontalPodAutoscalers in the indexer. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*autoscalingv2beta2.HorizontalPodAutoscaler, err error) - // HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. - HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister - HorizontalPodAutoscalerListerExpansion -} - -// horizontalPodAutoscalerLister implements the HorizontalPodAutoscalerLister interface. -type horizontalPodAutoscalerLister struct { - listers.ResourceIndexer[*autoscalingv2beta2.HorizontalPodAutoscaler] -} - -// NewHorizontalPodAutoscalerLister returns a new HorizontalPodAutoscalerLister. -func NewHorizontalPodAutoscalerLister(indexer cache.Indexer) HorizontalPodAutoscalerLister { - return &horizontalPodAutoscalerLister{listers.New[*autoscalingv2beta2.HorizontalPodAutoscaler](indexer, autoscalingv2beta2.Resource("horizontalpodautoscaler"))} -} - -// HorizontalPodAutoscalers returns an object that can list and get HorizontalPodAutoscalers. -func (s *horizontalPodAutoscalerLister) HorizontalPodAutoscalers(namespace string) HorizontalPodAutoscalerNamespaceLister { - return horizontalPodAutoscalerNamespaceLister{listers.NewNamespaced[*autoscalingv2beta2.HorizontalPodAutoscaler](s.ResourceIndexer, namespace)} -} - -// HorizontalPodAutoscalerNamespaceLister helps list and get HorizontalPodAutoscalers. -// All objects returned here must be treated as read-only. -type HorizontalPodAutoscalerNamespaceLister interface { - // List lists all HorizontalPodAutoscalers in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*autoscalingv2beta2.HorizontalPodAutoscaler, err error) - // Get retrieves the HorizontalPodAutoscaler from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*autoscalingv2beta2.HorizontalPodAutoscaler, error) - HorizontalPodAutoscalerNamespaceListerExpansion -} - -// horizontalPodAutoscalerNamespaceLister implements the HorizontalPodAutoscalerNamespaceLister -// interface. -type horizontalPodAutoscalerNamespaceLister struct { - listers.ResourceIndexer[*autoscalingv2beta2.HorizontalPodAutoscaler] -} diff --git a/vendor/k8s.io/client-go/listers/resource/v1alpha3/expansion_generated.go b/vendor/k8s.io/client-go/listers/resource/v1alpha3/expansion_generated.go index 8685199a24..0b9d51cd09 100644 --- a/vendor/k8s.io/client-go/listers/resource/v1alpha3/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/resource/v1alpha3/expansion_generated.go @@ -21,3 +21,7 @@ package v1alpha3 // DeviceTaintRuleListerExpansion allows custom methods to be added to // DeviceTaintRuleLister. type DeviceTaintRuleListerExpansion interface{} + +// ResourcePoolStatusRequestListerExpansion allows custom methods to be added to +// ResourcePoolStatusRequestLister. +type ResourcePoolStatusRequestListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/resource/v1alpha3/resourcepoolstatusrequest.go b/vendor/k8s.io/client-go/listers/resource/v1alpha3/resourcepoolstatusrequest.go new file mode 100644 index 0000000000..f12dccdd84 --- /dev/null +++ b/vendor/k8s.io/client-go/listers/resource/v1alpha3/resourcepoolstatusrequest.go @@ -0,0 +1,48 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha3 + +import ( + resourcev1alpha3 "k8s.io/api/resource/v1alpha3" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// ResourcePoolStatusRequestLister helps list ResourcePoolStatusRequests. +// All objects returned here must be treated as read-only. +type ResourcePoolStatusRequestLister interface { + // List lists all ResourcePoolStatusRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*resourcev1alpha3.ResourcePoolStatusRequest, err error) + // Get retrieves the ResourcePoolStatusRequest from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*resourcev1alpha3.ResourcePoolStatusRequest, error) + ResourcePoolStatusRequestListerExpansion +} + +// resourcePoolStatusRequestLister implements the ResourcePoolStatusRequestLister interface. +type resourcePoolStatusRequestLister struct { + listers.ResourceIndexer[*resourcev1alpha3.ResourcePoolStatusRequest] +} + +// NewResourcePoolStatusRequestLister returns a new ResourcePoolStatusRequestLister. +func NewResourcePoolStatusRequestLister(indexer cache.Indexer) ResourcePoolStatusRequestLister { + return &resourcePoolStatusRequestLister{listers.New[*resourcev1alpha3.ResourcePoolStatusRequest](indexer, resourcev1alpha3.Resource("resourcepoolstatusrequest"))} +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go b/vendor/k8s.io/client-go/listers/resource/v1beta2/devicetaintrule.go similarity index 50% rename from vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go rename to vendor/k8s.io/client-go/listers/resource/v1beta2/devicetaintrule.go index 7beaf46322..a567777944 100644 --- a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/priorityclass.go +++ b/vendor/k8s.io/client-go/listers/resource/v1beta2/devicetaintrule.go @@ -16,33 +16,33 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha1 +package v1beta2 import ( - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + resourcev1beta2 "k8s.io/api/resource/v1beta2" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" ) -// PriorityClassLister helps list PriorityClasses. +// DeviceTaintRuleLister helps list DeviceTaintRules. // All objects returned here must be treated as read-only. -type PriorityClassLister interface { - // List lists all PriorityClasses in the indexer. +type DeviceTaintRuleLister interface { + // List lists all DeviceTaintRules in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*schedulingv1alpha1.PriorityClass, err error) - // Get retrieves the PriorityClass from the index for a given name. + List(selector labels.Selector) (ret []*resourcev1beta2.DeviceTaintRule, err error) + // Get retrieves the DeviceTaintRule from the index for a given name. // Objects returned here must be treated as read-only. - Get(name string) (*schedulingv1alpha1.PriorityClass, error) - PriorityClassListerExpansion + Get(name string) (*resourcev1beta2.DeviceTaintRule, error) + DeviceTaintRuleListerExpansion } -// priorityClassLister implements the PriorityClassLister interface. -type priorityClassLister struct { - listers.ResourceIndexer[*schedulingv1alpha1.PriorityClass] +// deviceTaintRuleLister implements the DeviceTaintRuleLister interface. +type deviceTaintRuleLister struct { + listers.ResourceIndexer[*resourcev1beta2.DeviceTaintRule] } -// NewPriorityClassLister returns a new PriorityClassLister. -func NewPriorityClassLister(indexer cache.Indexer) PriorityClassLister { - return &priorityClassLister{listers.New[*schedulingv1alpha1.PriorityClass](indexer, schedulingv1alpha1.Resource("priorityclass"))} +// NewDeviceTaintRuleLister returns a new DeviceTaintRuleLister. +func NewDeviceTaintRuleLister(indexer cache.Indexer) DeviceTaintRuleLister { + return &deviceTaintRuleLister{listers.New[*resourcev1beta2.DeviceTaintRule](indexer, resourcev1beta2.Resource("devicetaintrule"))} } diff --git a/vendor/k8s.io/client-go/listers/resource/v1beta2/expansion_generated.go b/vendor/k8s.io/client-go/listers/resource/v1beta2/expansion_generated.go index 590f26bd74..dcf80d2228 100644 --- a/vendor/k8s.io/client-go/listers/resource/v1beta2/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/resource/v1beta2/expansion_generated.go @@ -22,6 +22,10 @@ package v1beta2 // DeviceClassLister. type DeviceClassListerExpansion interface{} +// DeviceTaintRuleListerExpansion allows custom methods to be added to +// DeviceTaintRuleLister. +type DeviceTaintRuleListerExpansion interface{} + // ResourceClaimListerExpansion allows custom methods to be added to // ResourceClaimLister. type ResourceClaimListerExpansion interface{} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/expansion_generated.go similarity index 75% rename from vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go rename to vendor/k8s.io/client-go/listers/scheduling/v1alpha2/expansion_generated.go index 8617325d8b..3a63d7891c 100644 --- a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/expansion_generated.go +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/expansion_generated.go @@ -16,11 +16,15 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 -// PriorityClassListerExpansion allows custom methods to be added to -// PriorityClassLister. -type PriorityClassListerExpansion interface{} +// PodGroupListerExpansion allows custom methods to be added to +// PodGroupLister. +type PodGroupListerExpansion interface{} + +// PodGroupNamespaceListerExpansion allows custom methods to be added to +// PodGroupNamespaceLister. +type PodGroupNamespaceListerExpansion interface{} // WorkloadListerExpansion allows custom methods to be added to // WorkloadLister. diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/podgroup.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/podgroup.go new file mode 100644 index 0000000000..292e5d62be --- /dev/null +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/podgroup.go @@ -0,0 +1,70 @@ +/* +Copyright 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// PodGroupLister helps list PodGroups. +// All objects returned here must be treated as read-only. +type PodGroupLister interface { + // List lists all PodGroups in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha2.PodGroup, err error) + // PodGroups returns an object that can list and get PodGroups. + PodGroups(namespace string) PodGroupNamespaceLister + PodGroupListerExpansion +} + +// podGroupLister implements the PodGroupLister interface. +type podGroupLister struct { + listers.ResourceIndexer[*schedulingv1alpha2.PodGroup] +} + +// NewPodGroupLister returns a new PodGroupLister. +func NewPodGroupLister(indexer cache.Indexer) PodGroupLister { + return &podGroupLister{listers.New[*schedulingv1alpha2.PodGroup](indexer, schedulingv1alpha2.Resource("podgroup"))} +} + +// PodGroups returns an object that can list and get PodGroups. +func (s *podGroupLister) PodGroups(namespace string) PodGroupNamespaceLister { + return podGroupNamespaceLister{listers.NewNamespaced[*schedulingv1alpha2.PodGroup](s.ResourceIndexer, namespace)} +} + +// PodGroupNamespaceLister helps list and get PodGroups. +// All objects returned here must be treated as read-only. +type PodGroupNamespaceLister interface { + // List lists all PodGroups in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*schedulingv1alpha2.PodGroup, err error) + // Get retrieves the PodGroup from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*schedulingv1alpha2.PodGroup, error) + PodGroupNamespaceListerExpansion +} + +// podGroupNamespaceLister implements the PodGroupNamespaceLister +// interface. +type podGroupNamespaceLister struct { + listers.ResourceIndexer[*schedulingv1alpha2.PodGroup] +} diff --git a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/workload.go b/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/workload.go similarity index 80% rename from vendor/k8s.io/client-go/listers/scheduling/v1alpha1/workload.go rename to vendor/k8s.io/client-go/listers/scheduling/v1alpha2/workload.go index 24f51a5ef3..9526da3b5a 100644 --- a/vendor/k8s.io/client-go/listers/scheduling/v1alpha1/workload.go +++ b/vendor/k8s.io/client-go/listers/scheduling/v1alpha2/workload.go @@ -16,10 +16,10 @@ limitations under the License. // Code generated by lister-gen. DO NOT EDIT. -package v1alpha1 +package v1alpha2 import ( - schedulingv1alpha1 "k8s.io/api/scheduling/v1alpha1" + schedulingv1alpha2 "k8s.io/api/scheduling/v1alpha2" labels "k8s.io/apimachinery/pkg/labels" listers "k8s.io/client-go/listers" cache "k8s.io/client-go/tools/cache" @@ -30,7 +30,7 @@ import ( type WorkloadLister interface { // List lists all Workloads in the indexer. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*schedulingv1alpha1.Workload, err error) + List(selector labels.Selector) (ret []*schedulingv1alpha2.Workload, err error) // Workloads returns an object that can list and get Workloads. Workloads(namespace string) WorkloadNamespaceLister WorkloadListerExpansion @@ -38,17 +38,17 @@ type WorkloadLister interface { // workloadLister implements the WorkloadLister interface. type workloadLister struct { - listers.ResourceIndexer[*schedulingv1alpha1.Workload] + listers.ResourceIndexer[*schedulingv1alpha2.Workload] } // NewWorkloadLister returns a new WorkloadLister. func NewWorkloadLister(indexer cache.Indexer) WorkloadLister { - return &workloadLister{listers.New[*schedulingv1alpha1.Workload](indexer, schedulingv1alpha1.Resource("workload"))} + return &workloadLister{listers.New[*schedulingv1alpha2.Workload](indexer, schedulingv1alpha2.Resource("workload"))} } // Workloads returns an object that can list and get Workloads. func (s *workloadLister) Workloads(namespace string) WorkloadNamespaceLister { - return workloadNamespaceLister{listers.NewNamespaced[*schedulingv1alpha1.Workload](s.ResourceIndexer, namespace)} + return workloadNamespaceLister{listers.NewNamespaced[*schedulingv1alpha2.Workload](s.ResourceIndexer, namespace)} } // WorkloadNamespaceLister helps list and get Workloads. @@ -56,15 +56,15 @@ func (s *workloadLister) Workloads(namespace string) WorkloadNamespaceLister { type WorkloadNamespaceLister interface { // List lists all Workloads in the indexer for a given namespace. // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*schedulingv1alpha1.Workload, err error) + List(selector labels.Selector) (ret []*schedulingv1alpha2.Workload, err error) // Get retrieves the Workload from the indexer for a given namespace and name. // Objects returned here must be treated as read-only. - Get(name string) (*schedulingv1alpha1.Workload, error) + Get(name string) (*schedulingv1alpha2.Workload, error) WorkloadNamespaceListerExpansion } // workloadNamespaceLister implements the WorkloadNamespaceLister // interface. type workloadNamespaceLister struct { - listers.ResourceIndexer[*schedulingv1alpha1.Workload] + listers.ResourceIndexer[*schedulingv1alpha2.Workload] } diff --git a/vendor/k8s.io/client-go/metadata/metadatainformer/informer.go b/vendor/k8s.io/client-go/metadata/metadatainformer/informer.go index 665198f12a..de32bc3ffc 100644 --- a/vendor/k8s.io/client-go/metadata/metadatainformer/informer.go +++ b/vendor/k8s.io/client-go/metadata/metadatainformer/informer.go @@ -25,6 +25,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/informers" "k8s.io/client-go/metadata" @@ -117,8 +118,15 @@ func (f *metadataSharedInformerFactory) ForResource(gvr schema.GroupVersionResou return informer } -// Start initializes all requested informers. +// Start is a legacy wrapper that initializes all requested informers. +// +//logcheck:context // StartWithContext should be used instead of Start in code which supports contextual logging. func (f *metadataSharedInformerFactory) Start(stopCh <-chan struct{}) { + f.StartWithContext(wait.ContextForChannel(stopCh)) +} + +// StartWithContext initializes all requested informers. +func (f *metadataSharedInformerFactory) StartWithContext(ctx context.Context) { f.lock.Lock() defer f.lock.Unlock() @@ -135,7 +143,7 @@ func (f *metadataSharedInformerFactory) Start(stopCh <-chan struct{}) { informer := informer.Informer() go func() { defer f.wg.Done() - informer.Run(stopCh) + informer.RunWithContext(ctx) }() f.startedInformers[informerType] = true } diff --git a/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go b/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go index 1af2afdb91..b2393f4dd3 100644 --- a/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go +++ b/vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go @@ -38,7 +38,6 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/serializer" - "k8s.io/apimachinery/pkg/util/dump" utilnet "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/pkg/apis/clientauthentication" @@ -51,6 +50,7 @@ import ( "k8s.io/client-go/util/connrotation" "k8s.io/klog/v2" "k8s.io/utils/clock" + "k8s.io/utils/dump" ) const execInfoEnv = "KUBERNETES_EXEC_INFO" @@ -185,8 +185,8 @@ func newAuthenticator(c *cache, isTerminalFunc func(int) bool, config *api.ExecC allowlistLookup := sets.New[string]() for _, entry := range config.PluginPolicy.Allowlist { - if entry.Name != "" { - allowlistLookup.Insert(entry.Name) + if entry.Command != "" { + allowlistLookup.Insert(entry.Command) } } @@ -641,14 +641,14 @@ func (a *Authenticator) checkAllowlistLocked(cmd *exec.Cmd) error { func (a *Authenticator) resolveAllowListEntriesLocked(commandHint string) { hintName := filepath.Base(commandHint) for _, entry := range a.execPluginPolicy.Allowlist { - entryBasename := filepath.Base(entry.Name) + entryBasename := filepath.Base(entry.Command) if hintName != "" && hintName != entryBasename { // we got a hint, and this allowlist entry does not match it continue } - entryResolvedPath, err := exec.LookPath(entry.Name) + entryResolvedPath, err := exec.LookPath(entry.Command) if err != nil { - klog.V(5).ErrorS(err, "resolving credential plugin allowlist", "name", entry.Name) + klog.V(5).ErrorS(err, "resolving credential plugin allowlist", "name", entry.Command) continue } if entryResolvedPath != "" { @@ -691,10 +691,10 @@ func validateAllowlist(list []api.AllowlistEntry) error { return fmt.Errorf("misconfigured credential plugin allowlist: empty allowlist entry #%d", i+1) } - if cleaned := filepath.Clean(item.Name); cleaned != item.Name { - return fmt.Errorf("non-normalized file path: %q vs %q", item.Name, cleaned) - } else if item.Name == "" { - return fmt.Errorf("empty file path: %q", item.Name) + if cleaned := filepath.Clean(item.Command); cleaned != item.Command { + return fmt.Errorf("non-normalized file path: %q vs %q", item.Command, cleaned) + } else if item.Command == "" { + return fmt.Errorf("empty file path: %q", item.Command) } } diff --git a/vendor/k8s.io/client-go/testing/doc.go b/vendor/k8s.io/client-go/testing/doc.go new file mode 100644 index 0000000000..991535703f --- /dev/null +++ b/vendor/k8s.io/client-go/testing/doc.go @@ -0,0 +1,70 @@ +/* +Copyright 2015 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. +*/ + +// Package testing provides a fake Kubernetes client suitable for use in unit +// tests. The fake client simulates interactions with a kube-apiserver without +// requiring one to be running, making tests fast and self-contained. +// +// # Scope and Limitations +// +// This fake client is intentionally simplified. It does not, and will never, +// fully replicate the behavior of a real kube-apiserver. Many server-side +// behaviors such as field defaulting, validation, status management, +// strategic merge patch, server-side apply semantics, and advanced +// field selectors are not supported by this client and there are no plans +// to add them. +// +// This is by design. Maintaining a high-fidelity mock of the entire +// kube-apiserver API surface would introduce significant complexity that is +// difficult to justify for a test utility. +// +// # When to Use This Package +// +// The fake client works well for unit tests that need to verify how your code +// interacts with the Kubernetes API at a structural level, for example: +// +// - Verifying that the correct API calls are made. +// - Supplying canned responses to drive specific code paths. +// +// # When Not to Use This Package +// +// If your tests depend on the kube-apiserver behaving correctly (e.g., +// enforcing validation, persisting resources accurately, handling apply +// semantics, or producing realistic watch events), you should write +// integration tests against a real kube-apiserver instead. +// +// # Contributing +// +// Issues requesting that the fake client more closely match kube-apiserver +// behavior should be limiting to bugs in how the fake behaves for unit test +// scenarios it is clearly intended to support. Pull requests that improve the fake +// client will only be accepted when they meet all of the following criteria: +// +// - The change makes the fake client easier to use for common unit testing +// patterns. +// - The change does not introduce significant complexity to the fake client. +// - The use cases motivating the change are clearly better served by a fake +// client than by integration tests against a real kube-apiserver. +// +// We hold a high bar for these changes. If the test scenarios in question can +// be reasonably addressed through integration testing, we will prefer that +// path over expanding the fake client. +// +// We understand this stance may be inconvenient, and we appreciate your +// understanding. Our goal is to keep this package simple, maintainable, and +// honest about what it provides so that it remains a reliable tool for the +// cases it is designed to handle. +package testing diff --git a/vendor/k8s.io/client-go/testing/fixture.go b/vendor/k8s.io/client-go/testing/fixture.go index 152a5c1bac..4a91a99c70 100644 --- a/vendor/k8s.io/client-go/testing/fixture.go +++ b/vendor/k8s.io/client-go/testing/fixture.go @@ -20,6 +20,7 @@ import ( "fmt" "reflect" "sort" + "strconv" "strings" "sync" @@ -288,13 +289,46 @@ type tracker struct { scheme ObjectScheme decoder runtime.Decoder lock sync.RWMutex - objects map[schema.GroupVersionResource]map[types.NamespacedName]runtime.Object + objects map[schema.GroupVersionResource]map[types.NamespacedName]versionedObject // The value type of watchers is a map of which the key is either a namespace or // all/non namespace aka "" and its value is list of fake watchers. // Manipulations on resources will broadcast the notification events into the // watchers' channel. Note that too many unhandled events (currently 100, // see apimachinery/pkg/watch.DefaultChanSize) will cause a panic. watchers map[schema.GroupVersionResource]map[string][]*watch.RaceFreeFakeWatcher + // resourceVersions is the highest resource version of any tracked object with + // a certain gvr. Conceptually it starts at 1 when no objects are stored (0 is + // special in queries) but the map contains no entries in that case. + // The resource version for that set of objects gets bumped before + // storing a new or modified object. + // + // Object content does not get changed to preserve the traditional behavior + // (hence also the versionedObject type instead of storing a runtime.Object + // with modified ResourceVersion). + // + // Resource version support (https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions) + // is very limited. It only supports one particular use case: + // List (no resource version check, returned ListMeta has ResourceVersion set) + + // Watch (Exact match for the ResourceVersion returned by List). + // + // This is sufficient for Reflector.ListAndWatch (https://github.com/kubernetes/kubernetes/blob/b53b9fb5573323484af9a19cf3f5bfe80760abba/staging/src/k8s.io/client-go/tools/cache/reflector.go#L401) + // when setting up informers in an informer factory. + // + // Strictly speaking, this should be by GroupVersion. But objects are + // also tracked by GroupVersionResource instead of GroupVersion, so the + // same is done here to match how List is implemented. + resourceVersions map[schema.GroupVersionResource]int64 +} + +// versionedObject stores an object together with the resource version that was +// assigned to it by the tracker. The version could be stored inline in the object, +// but this is not how fake client-go has traditionally worked and starting to do +// that now might break tests. +type versionedObject struct { + // resourceVersion is always > 1 for a stored object because 1 + // is the initial value for an empty set of objects. + resourceVersion int64 + runtime.Object } var _ ObjectTracker = &tracker{} @@ -303,10 +337,11 @@ var _ ObjectTracker = &tracker{} // of objects for the fake clientset. Mostly useful for unit tests. func NewObjectTracker(scheme ObjectScheme, decoder runtime.Decoder) ObjectTracker { return &tracker{ - scheme: scheme, - decoder: decoder, - objects: make(map[schema.GroupVersionResource]map[types.NamespacedName]runtime.Object), - watchers: make(map[schema.GroupVersionResource]map[string][]*watch.RaceFreeFakeWatcher), + scheme: scheme, + decoder: decoder, + objects: make(map[schema.GroupVersionResource]map[types.NamespacedName]versionedObject), + watchers: make(map[schema.GroupVersionResource]map[string][]*watch.RaceFreeFakeWatcher), + resourceVersions: make(map[schema.GroupVersionResource]int64), } } @@ -338,15 +373,27 @@ func (t *tracker) List(gvr schema.GroupVersionResource, gvk schema.GroupVersionK t.lock.RLock() defer t.lock.RUnlock() + if listMeta, err := meta.ListAccessor(list); err == nil { + resourceVersion, ok := t.resourceVersions[gvr] + if !ok { + resourceVersion = 1 + } + listMeta.SetResourceVersion(fmt.Sprintf("%d", resourceVersion)) + } + objs, ok := t.objects[gvr] if !ok { return list, nil } - matchingObjs, err := filterByNamespace(objs, ns) + matchingVersionedObjs, err := filterByNamespace(objs, ns) if err != nil { return nil, err } + matchingObjs := make([]runtime.Object, len(matchingVersionedObjs)) + for i, obj := range matchingVersionedObjs { + matchingObjs[i] = obj.Object + } if err := meta.SetList(list, matchingObjs); err != nil { return nil, err } @@ -359,6 +406,27 @@ func (t *tracker) Watch(gvr schema.GroupVersionResource, ns string, opts ...meta return nil, err } + // By default, emulate the traditional behavior of the tracker and don't deliver + // *any* existing objects unless list options are provided. + addExisting := false + addFromRV := int64(0) + if len(opts) > 0 { + // Providing options, as the generated client-go fake does, enables support + // for existing objects depending on the resource version. + // + // The default if ResourceVersion is empty is "start at most recent", + // which includes delivering all existing objects. addFromRV == 0 + // matches all objects below because all stored objects have addFromRV > 0. + addExisting = true + if opts[0].ResourceVersion != "" { + rv, err := strconv.ParseInt(opts[0].ResourceVersion, 10, 64) + if err != nil { + return nil, fmt.Errorf("invalid ResourceVersion %q in ListOptions, must be int64: %w", opts[0].ResourceVersion, err) + } + addFromRV = rv + } + } + t.lock.Lock() defer t.lock.Unlock() @@ -368,6 +436,22 @@ func (t *tracker) Watch(gvr schema.GroupVersionResource, ns string, opts ...meta t.watchers[gvr] = make(map[string][]*watch.RaceFreeFakeWatcher) } t.watchers[gvr][ns] = append(t.watchers[gvr][ns], fakewatcher) + + // Deliver all objects that match the list options, for example + // between the initial List and the following Watch. + if addExisting { + objs := t.objects[gvr] + matchingObjs, err := filterByNamespace(objs, ns) + if err != nil { + return nil, err + } + for _, obj := range matchingObjs { + if addFromRV < obj.resourceVersion { + fakewatcher.Add(obj.Object) + } + } + } + return fakewatcher, nil } @@ -565,17 +649,26 @@ func (t *tracker) add(gvr schema.GroupVersionResource, obj runtime.Object, ns st _, ok := t.objects[gvr] if !ok { - t.objects[gvr] = make(map[types.NamespacedName]runtime.Object) + t.objects[gvr] = make(map[types.NamespacedName]versionedObject) } + // Determine resource version for the new or updated object. + resourceVersion, ok := t.resourceVersions[gvr] + if !ok { + resourceVersion = 1 + } + resourceVersion++ + namespacedName := types.NamespacedName{Namespace: newMeta.GetNamespace(), Name: newMeta.GetName()} if _, ok = t.objects[gvr][namespacedName]; ok { if replaceExisting { + t.resourceVersions[gvr] = resourceVersion + t.objects[gvr][namespacedName] = versionedObject{resourceVersion, obj} + for _, w := range t.getWatches(gvr, ns) { // To avoid the object from being accidentally modified by watcher w.Modify(obj.DeepCopyObject()) } - t.objects[gvr][namespacedName] = obj return nil } return apierrors.NewAlreadyExists(gr, newMeta.GetName()) @@ -586,7 +679,8 @@ func (t *tracker) add(gvr schema.GroupVersionResource, obj runtime.Object, ns st return apierrors.NewNotFound(gr, newMeta.GetName()) } - t.objects[gvr][namespacedName] = obj + t.resourceVersions[gvr] = resourceVersion + t.objects[gvr][namespacedName] = versionedObject{resourceVersion, obj} for _, w := range t.getWatches(gvr, ns) { // To avoid the object from being accidentally modified by watcher @@ -841,11 +935,11 @@ func (d *objectDefaulter) Default(_ runtime.Object) {} // filterByNamespace returns all objects in the collection that // match provided namespace. Empty namespace matches // non-namespaced objects. -func filterByNamespace(objs map[types.NamespacedName]runtime.Object, ns string) ([]runtime.Object, error) { - var res []runtime.Object +func filterByNamespace(objs map[types.NamespacedName]versionedObject, ns string) ([]versionedObject, error) { + var res []versionedObject for _, obj := range objs { - acc, err := meta.Accessor(obj) + acc, err := meta.Accessor(obj.Object) if err != nil { return nil, err } @@ -857,8 +951,8 @@ func filterByNamespace(objs map[types.NamespacedName]runtime.Object, ns string) // Sort res to get deterministic order. sort.Slice(res, func(i, j int) bool { - acc1, _ := meta.Accessor(res[i]) - acc2, _ := meta.Accessor(res[j]) + acc1, _ := meta.Accessor(res[i].Object) + acc2, _ := meta.Accessor(res[j].Object) if acc1.GetNamespace() != acc2.GetNamespace() { return acc1.GetNamespace() < acc2.GetNamespace() } diff --git a/vendor/k8s.io/client-go/tools/cache/OWNERS b/vendor/k8s.io/client-go/tools/cache/OWNERS index fc441e0efa..77d7e4d28a 100644 --- a/vendor/k8s.io/client-go/tools/cache/OWNERS +++ b/vendor/k8s.io/client-go/tools/cache/OWNERS @@ -22,6 +22,7 @@ reviewers: - jsafrane - dims - ingvagabund + - michaelasp emeritus_approvers: - lavalamp - ncdc diff --git a/vendor/k8s.io/client-go/tools/cache/controller.go b/vendor/k8s.io/client-go/tools/cache/controller.go index 51e0a4659f..b78ed522e2 100644 --- a/vendor/k8s.io/client-go/tools/cache/controller.go +++ b/vendor/k8s.io/client-go/tools/cache/controller.go @@ -27,6 +27,7 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/wait" clientgofeaturegate "k8s.io/client-go/features" + "k8s.io/klog/v2" "k8s.io/utils/clock" ) @@ -141,6 +142,11 @@ type Controller interface { // HasSynced delegates to the Config's Queue HasSynced() bool + // HasSyncedChecker enables waiting for syncing without polling. + // The returned DoneChecker can be passed to WaitFor. + // It delegates to the Config's Queue. + HasSyncedChecker() DoneChecker + // LastSyncResourceVersion delegates to the Reflector when there // is one, otherwise returns the empty string LastSyncResourceVersion() string @@ -167,11 +173,13 @@ func (c *controller) RunWithContext(ctx context.Context) { <-ctx.Done() c.config.Queue.Close() }() + logger := klog.FromContext(ctx) r := NewReflectorWithOptions( c.config.ListerWatcher, c.config.ObjectType, c.config.Queue, ReflectorOptions{ + Logger: &logger, ResyncPeriod: c.config.FullResyncPeriod, MinWatchTimeout: c.config.MinWatchTimeout, TypeDescription: c.config.ObjectDescription, @@ -205,6 +213,13 @@ func (c *controller) HasSynced() bool { return c.config.Queue.HasSynced() } +// HasSyncedChecker enables waiting for syncing without polling. +// The returned DoneChecker can be passed to [WaitFor]. +// It delegates to the Config's Queue. +func (c *controller) HasSyncedChecker() DoneChecker { + return c.config.Queue.HasSyncedChecker() +} + func (c *controller) LastSyncResourceVersion() string { c.reflectorMutex.RLock() defer c.reflectorMutex.RUnlock() @@ -231,7 +246,7 @@ func (c *controller) processLoop(ctx context.Context) { default: var err error if useBatchProcess { - err = batchQueue.PopBatch(c.config.ProcessBatch) + err = batchQueue.PopBatch(c.config.ProcessBatch, PopProcessFunc(c.config.Process)) } else { // otherwise fallback to non-batch process behavior _, err = c.config.Pop(PopProcessFunc(c.config.Process)) @@ -395,6 +410,9 @@ func DeletionHandlingObjectToName(obj interface{}) (ObjectName, error) { // InformerOptions configure a Reflector. type InformerOptions struct { + // Logger, if not nil, is used instead of klog.Background() for logging. + Logger *klog.Logger + // ListerWatcher implements List and Watch functions for the source of the resource // the informer will be informing about. ListerWatcher ListerWatcher @@ -429,6 +447,14 @@ type InformerOptions struct { // for them. // Optional - if unset no additional transforming is happening. Transform TransformFunc + + // Identifier is used to identify the FIFO for metrics and logging purposes. + // If not set, metrics will not be published. + Identifier InformerNameAndResource + + // InformerMetricsProvider is the metrics provider for the informer. + // If not set, metrics will be no-ops. + InformerMetricsProvider InformerMetricsProvider } // NewInformerWithOptions returns a Store and a controller for populating the store @@ -438,11 +464,11 @@ type InformerOptions struct { func NewInformerWithOptions(options InformerOptions) (Store, Controller) { var clientState Store if options.Indexers == nil { - clientState = NewStore(DeletionHandlingMetaNamespaceKeyFunc) + clientState = NewStore(DeletionHandlingMetaNamespaceKeyFunc, WithStoreMetrics(options.Identifier, options.InformerMetricsProvider)) } else { - clientState = NewIndexer(DeletionHandlingMetaNamespaceKeyFunc, options.Indexers) + clientState = NewIndexer(DeletionHandlingMetaNamespaceKeyFunc, options.Indexers, WithStoreMetrics(options.Identifier, options.InformerMetricsProvider)) } - return clientState, newInformer(clientState, options) + return clientState, newInformer(clientState, options, DeletionHandlingMetaNamespaceKeyFunc) } // NewInformer returns a Store and a controller for populating the store @@ -476,7 +502,7 @@ func NewInformer( Handler: h, ResyncPeriod: resyncPeriod, } - return clientState, newInformer(clientState, options) + return clientState, newInformer(clientState, options, DeletionHandlingMetaNamespaceKeyFunc) } // NewIndexerInformer returns an Indexer and a Controller for populating the index @@ -513,7 +539,7 @@ func NewIndexerInformer( ResyncPeriod: resyncPeriod, Indexers: indexers, } - return clientState, newInformer(clientState, options) + return clientState, newInformer(clientState, options, DeletionHandlingMetaNamespaceKeyFunc) } // NewTransformingInformer returns a Store and a controller for populating @@ -542,7 +568,7 @@ func NewTransformingInformer( ResyncPeriod: resyncPeriod, Transform: transformer, } - return clientState, newInformer(clientState, options) + return clientState, newInformer(clientState, options, DeletionHandlingMetaNamespaceKeyFunc) } // NewTransformingIndexerInformer returns an Indexer and a controller for @@ -573,23 +599,43 @@ func NewTransformingIndexerInformer( Indexers: indexers, Transform: transformer, } - return clientState, newInformer(clientState, options) + return clientState, newInformer(clientState, options, DeletionHandlingMetaNamespaceKeyFunc) } // Multiplexes updates in the form of a list of Deltas into a Store, and informs // a given handler of events OnUpdate, OnAdd, OnDelete func processDeltas( + logger klog.Logger, // Object which receives event notifications from the given deltas handler ResourceEventHandler, clientState Store, deltas Deltas, isInInitialList bool, + keyFunc KeyFunc, ) error { // from oldest to newest for _, d := range deltas { obj := d.Object switch d.Type { + case ReplacedAll: + info, ok := obj.(ReplacedAllInfo) + if !ok { + return fmt.Errorf("ReplacedAll did not contain ReplacedAllInfo: %T", obj) + } + if err := processReplacedAllInfo(logger, handler, info, clientState, isInInitialList, keyFunc); err != nil { + return err + } + case SyncAll: + _, ok := obj.(SyncAllInfo) + if !ok { + return fmt.Errorf("SyncAll did not contain SyncAllInfo: %T", obj) + } + objs := clientState.List() + for _, obj := range objs { + handler.OnUpdate(obj, obj) + } + return nil case Sync, Replaced, Added, Updated: if old, exists, err := clientState.Get(obj); err == nil && exists { if err := clientState.Update(obj); err != nil { @@ -607,6 +653,12 @@ func processDeltas( return err } handler.OnDelete(obj) + case Bookmark: + info, ok := obj.(BookmarkInfo) + if !ok { + return fmt.Errorf("bookmark delta did not contain BookmarkInfo: %T", obj) + } + clientState.Bookmark(info.ResourceVersion) } } return nil @@ -622,10 +674,12 @@ func processDeltas( // Returns an error if any Delta or transaction fails. For TransactionError, // only successful operations trigger callbacks. func processDeltasInBatch( + logger klog.Logger, handler ResourceEventHandler, clientState Store, deltas []Delta, isInInitialList bool, + keyFunc KeyFunc, ) error { // from oldest to newest txns := make([]Transaction, 0) @@ -634,7 +688,7 @@ func processDeltasInBatch( if !txnSupported { var errs []error for _, delta := range deltas { - if err := processDeltas(handler, clientState, Deltas{delta}, isInInitialList); err != nil { + if err := processDeltas(logger, handler, clientState, Deltas{delta}, isInInitialList, keyFunc); err != nil { errs = append(errs, err) } } @@ -677,6 +731,8 @@ func processDeltasInBatch( callbacks = append(callbacks, func() { handler.OnDelete(obj) }) + default: + return fmt.Errorf("Delta type %s is not supported in batch processing", d.Type) } } @@ -697,18 +753,68 @@ func processDeltasInBatch( return nil } +func processReplacedAllInfo(logger klog.Logger, handler ResourceEventHandler, info ReplacedAllInfo, clientState Store, isInInitialList bool, keyFunc KeyFunc) error { + var deletions []DeletedFinalStateUnknown + type replacement struct { + oldObj interface{} + newObj interface{} + } + replacements := make([]replacement, 0, len(info.Objects)) + + err := reconcileReplacement(logger, nil, clientState, info.Objects, keyFunc, + func(obj DeletedFinalStateUnknown) error { + deletions = append(deletions, obj) + return nil + }, + func(obj interface{}) error { + // This behavior matches processDeltas handling of Replace deltas + if old, exists, err := clientState.Get(obj); err == nil && exists { + replacements = append(replacements, replacement{newObj: obj, oldObj: old}) + } else { + replacements = append(replacements, replacement{newObj: obj}) + } + return nil + }, + ) + if err != nil { + return err + } + + // Replace the client state first so the store reflects the events handlers are given + if err := clientState.Replace(info.Objects, info.ResourceVersion); err != nil { + return err + } + // Processing all deletions first matches behavior of RealFIFO#Replace + for _, objToDelete := range deletions { + handler.OnDelete(objToDelete) + } + // Processing adds/updates in order observed by reconcileReplacement matches behavior of RealFIFO#Replace + for _, r := range replacements { + if r.oldObj != nil { + handler.OnUpdate(r.oldObj, r.newObj) + } else { + handler.OnAdd(r.newObj, isInInitialList) + } + } + return nil +} + // newInformer returns a controller for populating the store while also // providing event notifications. // // Parameters // - clientState is the store you want to populate // - options contain the options to configure the controller -func newInformer(clientState Store, options InformerOptions) Controller { +func newInformer(clientState Store, options InformerOptions, keyFunc KeyFunc) Controller { // This will hold incoming changes. Note how we pass clientState in as a // KeyLister, that way resync operations will result in the correct set // of update/delete deltas. - fifo := newQueueFIFO(clientState, options.Transform) + logger := klog.Background() + if options.Logger != nil { + logger = *options.Logger + } + logger, fifo := newQueueFIFO(logger, options.ObjectType, clientState, options.Transform, options.Identifier, options.InformerMetricsProvider) cfg := &Config{ Queue: fifo, @@ -719,29 +825,54 @@ func newInformer(clientState Store, options InformerOptions) Controller { Process: func(obj interface{}, isInInitialList bool) error { if deltas, ok := obj.(Deltas); ok { - return processDeltas(options.Handler, clientState, deltas, isInInitialList) + // This must be the logger *of the fifo*. + return processDeltas(logger, options.Handler, clientState, deltas, isInInitialList, keyFunc) } return errors.New("object given as Process argument is not Deltas") }, ProcessBatch: func(deltaList []Delta, isInInitialList bool) error { - return processDeltasInBatch(options.Handler, clientState, deltaList, isInInitialList) + // Same here. + return processDeltasInBatch(logger, options.Handler, clientState, deltaList, isInInitialList, keyFunc) }, } return New(cfg) } -func newQueueFIFO(clientState Store, transform TransformFunc) Queue { +// newQueueFIFO constructs a new FIFO, choosing between real and delta FIFO +// depending on the InOrderInformers feature gate. +// +// It returns the FIFO and the logger used by the FIFO. +// That logger includes the name used for the FIFO, +// in contrast to the logger which was passed in. +func newQueueFIFO(logger klog.Logger, objectType any, clientState Store, transform TransformFunc, identifier InformerNameAndResource, metricsProvider InformerMetricsProvider) (klog.Logger, Queue) { if clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.InOrderInformers) { - return NewRealFIFOWithOptions(RealFIFOOptions{ - KeyFunction: MetaNamespaceKeyFunc, - KnownObjects: clientState, - Transformer: transform, - }) + options := RealFIFOOptions{ + Logger: &logger, + Name: fmt.Sprintf("RealFIFO %T", objectType), + KeyFunction: MetaNamespaceKeyFunc, + Transformer: transform, + Identifier: identifier, + MetricsProvider: metricsProvider, + } + // If atomic events are enabled, unset clientState in the case of atomic events as we cannot pass a + // store to an atomic fifo. + if clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.AtomicFIFO) { + options.AtomicEvents = true + options.UnlockWhileProcessing = clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.UnlockWhileProcessingFIFO) + options.EmitDeltaTypeBookmark = true + } else { + options.KnownObjects = clientState + } + f := NewRealFIFOWithOptions(options) + return f.logger, f } else { - return NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + f := NewDeltaFIFOWithOptions(DeltaFIFOOptions{ + Logger: &logger, + Name: fmt.Sprintf("DeltaFIFO %T", objectType), KnownObjects: clientState, EmitDeltaTypeReplaced: true, Transformer: transform, }) + return f.logger, f } } diff --git a/vendor/k8s.io/client-go/tools/cache/delta_fifo.go b/vendor/k8s.io/client-go/tools/cache/delta_fifo.go index 217bcf8b7a..b2a191f78a 100644 --- a/vendor/k8s.io/client-go/tools/cache/delta_fifo.go +++ b/vendor/k8s.io/client-go/tools/cache/delta_fifo.go @@ -22,6 +22,7 @@ import ( "sync" "time" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog/v2" @@ -31,6 +32,12 @@ import ( // DeltaFIFOOptions is the configuration parameters for DeltaFIFO. All are // optional. type DeltaFIFOOptions struct { + // If set, log output will go to this logger instead of klog.Background(). + // The name of the fifo gets added automatically. + Logger *klog.Logger + + // Name can be used to override the default "DeltaFIFO" name for the new instance. + Name string // KeyFunction is used to figure out what key an object should have. (It's // exposed in the returned DeltaFIFO's KeyOf() method, with additional @@ -55,9 +62,6 @@ type DeltaFIFOOptions struct { // If set, will be called for objects before enqueueing them. Please // see the comment on TransformFunc for details. Transformer TransformFunc - - // If set, log output will go to this logger instead of klog.Background(). - Logger *klog.Logger } // DeltaFIFO is like FIFO, but differs in two ways. One is that the @@ -102,6 +106,13 @@ type DeltaFIFOOptions struct { // threads, you could end up with multiple threads processing slightly // different versions of the same object. type DeltaFIFO struct { + // logger is a per-instance logger. This gets chosen when constructing + // the instance, with klog.Background() as default. + logger klog.Logger + + // name is the name of the fifo. It is included in the logger. + name string + // lock/cond protects access to 'items' and 'queue'. lock sync.RWMutex cond sync.Cond @@ -115,6 +126,11 @@ type DeltaFIFO struct { // A key is in `queue` if and only if it is in `items`. queue []string + // synced is initially an open channel. It gets closed (once!) by checkSynced_locked + // as soon as the initial sync is considered complete. + synced chan struct{} + syncedClosed bool + // populated is true if the first batch of items inserted by Replace() has been populated // or Delete/Add/Update/AddIfNotPresent was called first. populated bool @@ -139,10 +155,6 @@ type DeltaFIFO struct { // Called with every object if non-nil. transformer TransformFunc - - // logger is a per-instance logger. This gets chosen when constructing - // the instance, with klog.Background() as default. - logger klog.Logger } // TransformFunc allows for transforming an object before it will be processed. @@ -172,14 +184,27 @@ const ( Updated DeltaType = "Updated" Deleted DeltaType = "Deleted" // Replaced is emitted when we encountered watch errors and had to do a - // relist. We don't know if the replaced object has changed. + // relist, or on initial listing of objects. We don't know if the replaced + // object has changed. // // NOTE: Previous versions of DeltaFIFO would use Sync for Replace events // as well. Hence, Replaced is only emitted when the option // EmitDeltaTypeReplaced is true. Replaced DeltaType = "Replaced" + // ReplacedAll is emitted when we encountered watch errors and had to do + // a relist, or on initial listing of objects. This is the same reason as + // Replaced but will be emitted instead when the FIFO supports atomic + // replacement. This event will return the full list of replaced items + // instead of a single object. + ReplacedAll DeltaType = "ReplacedAll" // Sync is for synthetic events during a periodic resync. Sync DeltaType = "Sync" + // SyncAll indicates all known objects should be reprocessed. + // This event contains an object of type SyncAllInfo. + SyncAll DeltaType = "SyncAll" + // Bookmark is emitted on Bookmark calls and Replace calls to pass resource + // version information to the consumer. + Bookmark DeltaType = "Bookmark" ) // Delta is a member of Deltas (a list of Delta objects) which @@ -253,6 +278,9 @@ func NewDeltaFIFOWithOptions(opts DeltaFIFOOptions) *DeltaFIFO { } f := &DeltaFIFO{ + logger: klog.Background(), + name: "DeltaFIFO", + synced: make(chan struct{}), items: map[string]Deltas{}, queue: []string{}, keyFunc: opts.KeyFunction, @@ -260,11 +288,14 @@ func NewDeltaFIFOWithOptions(opts DeltaFIFOOptions) *DeltaFIFO { emitDeltaTypeReplaced: opts.EmitDeltaTypeReplaced, transformer: opts.Transformer, - logger: klog.Background(), } if opts.Logger != nil { f.logger = *opts.Logger } + if name := opts.Name; name != "" { + f.name = name + } + f.logger = klog.LoggerWithName(f.logger, f.name) f.cond.L = &f.lock return f } @@ -272,6 +303,7 @@ func NewDeltaFIFOWithOptions(opts DeltaFIFOOptions) *DeltaFIFO { var ( _ = Queue(&DeltaFIFO{}) // DeltaFIFO is a Queue _ = TransformingStore(&DeltaFIFO{}) // DeltaFIFO implements TransformingStore to allow memory optimizations + _ = DoneChecker(&DeltaFIFO{}) // DeltaFIFO implements DoneChecker. ) var ( @@ -317,8 +349,36 @@ func (f *DeltaFIFO) HasSynced() bool { return f.hasSynced_locked() } +// HasSyncedChecker is done if an Add/Update/Delete/AddIfNotPresent are called first, +// or the first batch of items inserted by Replace() has been popped. +func (f *DeltaFIFO) HasSyncedChecker() DoneChecker { + return f +} + +// Name implements [DoneChecker.Name] +func (f *DeltaFIFO) Name() string { + return f.name +} + +// Done implements [DoneChecker.Done] +func (f *DeltaFIFO) Done() <-chan struct{} { + return f.synced +} + +// hasSynced_locked returns the result of a prior checkSynced_locked call. func (f *DeltaFIFO) hasSynced_locked() bool { - return f.populated && f.initialPopulationCount == 0 + return f.syncedClosed +} + +// checkSynced_locked checks whether the initial is completed. +// It must be called whenever populated or initialPopulationCount change. +func (f *DeltaFIFO) checkSynced_locked() { + synced := f.populated && f.initialPopulationCount == 0 + if synced && !f.syncedClosed { + // Initial sync is complete. + f.syncedClosed = true + close(f.synced) + } } // Add inserts an item, and puts it in the queue. The item is only enqueued @@ -327,6 +387,7 @@ func (f *DeltaFIFO) Add(obj interface{}) error { f.lock.Lock() defer f.lock.Unlock() f.populated = true + f.checkSynced_locked() return f.queueActionLocked(Added, obj) } @@ -335,6 +396,7 @@ func (f *DeltaFIFO) Update(obj interface{}) error { f.lock.Lock() defer f.lock.Unlock() f.populated = true + f.checkSynced_locked() return f.queueActionLocked(Updated, obj) } @@ -351,6 +413,7 @@ func (f *DeltaFIFO) Delete(obj interface{}) error { f.lock.Lock() defer f.lock.Unlock() f.populated = true + f.checkSynced_locked() if f.knownObjects == nil { if _, exists := f.items[id]; !exists { // Presumably, this was deleted when a relist happened. @@ -467,10 +530,10 @@ func (f *DeltaFIFO) queueActionInternalLocked(actionType, internalActionType Del // when given a non-empty list (as it is here). // If somehow it happens anyway, deal with it but complain. if oldDeltas == nil { - f.logger.Error(nil, "Impossible dedupDeltas, ignoring", "id", id, "oldDeltas", oldDeltas, "obj", obj) + utilruntime.HandleErrorWithLogger(f.logger, nil, "Impossible dedupDeltas, ignoring", "id", id, "oldDeltas", oldDeltas, "obj", obj) return nil } - f.logger.Error(nil, "Impossible dedupDeltas, breaking invariant by storing empty Deltas", "id", id, "oldDeltas", oldDeltas, "obj", obj) + utilruntime.HandleErrorWithLogger(f.logger, nil, "Impossible dedupDeltas, breaking invariant by storing empty Deltas", "id", id, "oldDeltas", oldDeltas, "obj", obj) f.items[id] = newDeltas return fmt.Errorf("Impossible dedupDeltas for id=%q: oldDeltas=%#+v, obj=%#+v; broke DeltaFIFO invariant by storing empty Deltas", id, oldDeltas, obj) } @@ -516,11 +579,12 @@ func (f *DeltaFIFO) Pop(process PopProcessFunc) (interface{}, error) { depth := len(f.queue) if f.initialPopulationCount > 0 { f.initialPopulationCount-- + f.checkSynced_locked() } item, ok := f.items[id] if !ok { // This should never happen - f.logger.Error(nil, "Inconceivable! Item was in f.queue but not f.items; ignoring", "id", id) + utilruntime.HandleErrorWithLogger(f.logger, nil, "Inconceivable! Item was in f.queue but not f.items; ignoring", "id", id) continue } delete(f.items, id) @@ -613,7 +677,7 @@ func (f *DeltaFIFO) Replace(list []interface{}, _ string) error { deletedObj, exists, err := f.knownObjects.GetByKey(k) if err != nil { deletedObj = nil - f.logger.Error(err, "Unexpected error during lookup, placing DeleteFinalStateUnknown marker without object", "key", k) + utilruntime.HandleErrorWithLogger(f.logger, err, "Unexpected error during lookup, placing DeleteFinalStateUnknown marker without object", "key", k) } else if !exists { deletedObj = nil f.logger.Info("Key does not exist in known objects store, placing DeleteFinalStateUnknown marker without object", "key", k) @@ -628,6 +692,7 @@ func (f *DeltaFIFO) Replace(list []interface{}, _ string) error { if !f.populated { f.populated = true f.initialPopulationCount = keys.Len() + queuedDeletions + f.checkSynced_locked() } return nil @@ -656,7 +721,7 @@ func (f *DeltaFIFO) Resync() error { func (f *DeltaFIFO) syncKeyLocked(key string) error { obj, exists, err := f.knownObjects.GetByKey(key) if err != nil { - f.logger.Error(err, "Unexpected error during lookup, unable to queue object for sync", "key", key) + utilruntime.HandleErrorWithLogger(f.logger, err, "Unexpected error during lookup, unable to queue object for sync", "key", key) return nil } else if !exists { f.logger.Info("Key does not exist in known objects store, unable to queue object for sync", "key", key) diff --git a/vendor/k8s.io/client-go/tools/cache/event_handler_name.go b/vendor/k8s.io/client-go/tools/cache/event_handler_name.go new file mode 100644 index 0000000000..d466fc6e2d --- /dev/null +++ b/vendor/k8s.io/client-go/tools/cache/event_handler_name.go @@ -0,0 +1,121 @@ +/* +Copyright 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. +*/ + +package cache + +import ( + "fmt" + "reflect" + "runtime" + "strings" +) + +func nameForHandler(handler ResourceEventHandler) (name string) { + defer func() { + // Last resort: let Sprintf handle it. + if name == "" { + name = fmt.Sprintf("%T", handler) + } + }() + + if handler == nil { + return "" + } + switch handler := handler.(type) { + case *ResourceEventHandlerFuncs: + return nameForHandlerFuncs(*handler) + case ResourceEventHandlerFuncs: + return nameForHandlerFuncs(handler) + default: + // We can use the fully qualified name of whatever + // provides the interface. We don't care whether + // it contains fields or methods which provide + // the interface methods. + value := reflect.ValueOf(handler) + if value.Type().Kind() == reflect.Interface { + // Probably not needed, but let's play it safe. + value = value.Elem() + } + if value.Type().Kind() == reflect.Pointer { + if !value.IsNil() { + value = value.Elem() + } + } + name := value.Type().PkgPath() + if name != "" { + name += "." + } + if typeName := value.Type().Name(); typeName != "" { + name += typeName + } + return name + } +} + +func nameForHandlerFuncs(funcs ResourceEventHandlerFuncs) string { + return nameForFunctions(funcs.AddFunc, funcs.UpdateFunc, funcs.DeleteFunc) +} + +func nameForFunctions(fs ...any) string { + // If all functions are defined in the same place, then we + // don't care about the actual function name in + // e.g. "main.FuncName" or "main.(*Foo).FuncName-fm", instead + // we use the common qualifier. + // + // But we don't know that yet, so we also collect all names. + var qualifier string + singleQualifier := true + var names []string + for _, f := range fs { + if f == nil { + continue + } + name := nameForFunction(f) + if name == "" { + continue + } + names = append(names, name) + + newQualifier := name + index := strings.LastIndexByte(newQualifier, '.') + if index > 0 { + newQualifier = newQualifier[:index] + } + switch qualifier { + case "": + qualifier = newQualifier + case newQualifier: + // So far, so good... + default: + // Nope, different. + singleQualifier = false + } + } + + if singleQualifier { + return qualifier + } + + return strings.Join(names, "+") +} + +func nameForFunction(f any) string { + fn := runtime.FuncForPC(reflect.ValueOf(f).Pointer()) + if fn == nil { + return "" + } + return fn.Name() +} diff --git a/vendor/k8s.io/client-go/tools/cache/expiration_cache.go b/vendor/k8s.io/client-go/tools/cache/expiration_cache.go index 813916ebf0..19c2226b94 100644 --- a/vendor/k8s.io/client-go/tools/cache/expiration_cache.go +++ b/vendor/k8s.io/client-go/tools/cache/expiration_cache.go @@ -137,6 +137,16 @@ func (c *ExpirationCache) List() []interface{} { return list } +// LastStoreSyncResourceVersion returns the latest resource version that the cache has seen. +func (c *ExpirationCache) LastStoreSyncResourceVersion() string { + return c.cacheStorage.LastStoreSyncResourceVersion() +} + +// Bookmark observes a new resource version in the cache. +func (c *ExpirationCache) Bookmark(rv string) { + c.cacheStorage.Bookmark(rv) +} + // ListKeys returns a list of all keys in the expiration cache. func (c *ExpirationCache) ListKeys() []string { return c.cacheStorage.ListKeys() @@ -170,7 +180,7 @@ func (c *ExpirationCache) Delete(obj interface{}) error { } c.expirationLock.Lock() defer c.expirationLock.Unlock() - c.cacheStorage.Delete(key) + c.cacheStorage.DeleteWithObject(key, obj) return nil } diff --git a/vendor/k8s.io/client-go/tools/cache/fifo.go b/vendor/k8s.io/client-go/tools/cache/fifo.go index eb3ef589bd..e31e2d2703 100644 --- a/vendor/k8s.io/client-go/tools/cache/fifo.go +++ b/vendor/k8s.io/client-go/tools/cache/fifo.go @@ -47,7 +47,9 @@ type Queue interface { // may return an ErrRequeue{inner} and in this case Pop will (a) // return that (key, accumulator) association to the Queue as part // of the atomic processing and (b) return the inner error from - // Pop. + // Pop. It is expected that the caller of Pop will be a single + // threaded consumer since otherwise it is possible for multiple + // PopProcessFuncs to be running simultaneously. Pop(PopProcessFunc) (interface{}, error) // HasSynced returns true if the first batch of keys have all been @@ -56,6 +58,12 @@ type Queue interface { // Update, or Delete; otherwise the first batch is empty. HasSynced() bool + // HasSyncedChecker is done once the first batch of keys have all been + // popped. The first batch of keys are those of the first Replace + // operation if that happened before any Add, AddIfNotPresent, + // Update, or Delete; otherwise the first batch is empty. + HasSyncedChecker() DoneChecker + // Close the queue Close() } @@ -73,23 +81,14 @@ type QueueWithBatch interface { // PopBatch behaves similarly to Queue#Pop, but processes multiple keys // as a batch. The implementation determines the batching strategy, - // such as the number of keys to include per batch. - PopBatch(ProcessBatchFunc) error -} - -// Pop is helper function for popping from Queue. -// WARNING: Do NOT use this function in non-test code to avoid races -// unless you really really really really know what you are doing. -// -// NOTE: This function is deprecated and may be removed in the future without -// additional warning. -func Pop(queue Queue) interface{} { - var result interface{} - queue.Pop(func(obj interface{}, isInInitialList bool) error { - result = obj - return nil - }) - return result + // such as the number of keys to include per batch. The ProcessBatchFunc + // is called when a batch is ready to be processed. The PopProcessFunc + // is called when a singleton item is ready to be processed. The + // ProcessBatchFunc and PopProcessFunc must do the same processing to + // ensure consistent behavior. It is expected that the caller of PopBatch + // will be a single threaded consumer since otherwise it is possible for + // multiple ProcessBatchFuncs/PopProcessFuncs to be running simultaneously. + PopBatch(processBatch ProcessBatchFunc, processSingle PopProcessFunc) error } // FIFO is a Queue in which (a) each accumulator is simply the most @@ -117,6 +116,11 @@ type FIFO struct { items map[string]interface{} queue []string + // synced is initially an open channel. It gets closed (once!) by checkSynced + // as soon as the initial sync is considered complete. + synced chan struct{} + syncedClosed bool + // populated is true if the first batch of items inserted by Replace() has been populated // or Delete/Add/Update was called first. populated bool @@ -134,7 +138,8 @@ type FIFO struct { } var ( - _ = Queue(&FIFO{}) // FIFO is a Queue + _ = Queue(&FIFO{}) // FIFO is a Queue + _ = DoneChecker(&FIFO{}) // ... and implements DoneChecker. ) // Close the queue. @@ -153,8 +158,36 @@ func (f *FIFO) HasSynced() bool { return f.hasSynced_locked() } +// HasSyncedChecker is done if an Add/Update/Delete/AddIfNotPresent are called first, +// or the first batch of items inserted by Replace() has been popped. +func (f *FIFO) HasSyncedChecker() DoneChecker { + return f +} + +// Name implements [DoneChecker.Name] +func (f *FIFO) Name() string { + return "FIFO" // FIFO doesn't seem to be used outside of a few tests, so changing the NewFIFO API to pass in a name doesn't seem worth it. +} + +// Done implements [DoneChecker.Done] +func (f *FIFO) Done() <-chan struct{} { + return f.synced +} + +// hasSynced_locked returns the result of a prior checkSynced call. func (f *FIFO) hasSynced_locked() bool { - return f.populated && f.initialPopulationCount == 0 + return f.syncedClosed +} + +// checkSynced checks whether the initial sync is completed. +// It must be called whenever populated or initialPopulationCount change +// while the mutex is still locked. +func (f *FIFO) checkSynced() { + synced := f.populated && f.initialPopulationCount == 0 + if synced && !f.syncedClosed { + f.syncedClosed = true + close(f.synced) + } } // Add inserts an item, and puts it in the queue. The item is only enqueued @@ -167,6 +200,7 @@ func (f *FIFO) Add(obj interface{}) error { f.lock.Lock() defer f.lock.Unlock() f.populated = true + f.checkSynced() if _, exists := f.items[id]; !exists { f.queue = append(f.queue, id) } @@ -191,6 +225,7 @@ func (f *FIFO) Delete(obj interface{}) error { f.lock.Lock() defer f.lock.Unlock() f.populated = true + f.checkSynced() delete(f.items, id) return err } @@ -227,6 +262,8 @@ func (f *FIFO) Pop(process PopProcessFunc) (interface{}, error) { f.queue = f.queue[1:] if f.initialPopulationCount > 0 { f.initialPopulationCount-- + // Must be done *after* process has completed. + defer f.checkSynced() } item, ok := f.items[id] if !ok { @@ -259,6 +296,7 @@ func (f *FIFO) Replace(list []interface{}, resourceVersion string) error { if !f.populated { f.populated = true f.initialPopulationCount = len(items) + f.checkSynced() } f.items = items @@ -297,6 +335,7 @@ func (f *FIFO) Resync() error { // process. func NewFIFO(keyFunc KeyFunc) *FIFO { f := &FIFO{ + synced: make(chan struct{}), items: map[string]interface{}{}, queue: []string{}, keyFunc: keyFunc, diff --git a/vendor/k8s.io/client-go/tools/cache/fifo_metrics.go b/vendor/k8s.io/client-go/tools/cache/fifo_metrics.go new file mode 100644 index 0000000000..7a67817240 --- /dev/null +++ b/vendor/k8s.io/client-go/tools/cache/fifo_metrics.go @@ -0,0 +1,122 @@ +/* +Copyright 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. +*/ + +// Package cache is a client-side caching mechanism. It is useful for +// reducing the number of server calls you'd otherwise need to make. +// Reflector watches a server and updates a Store. Two stores are provided; +// one that simply caches objects (for example, to allow a scheduler to +// list currently available nodes), and one that additionally acts as +// a FIFO queue (for example, to allow a scheduler to process incoming +// pods). +package cache + +import ( + "sync" +) + +var ( + globalInformerMetricsProvider InformerMetricsProvider = noopInformerMetricsProvider{} + setInformerMetricsProviderOnce sync.Once +) + +type noopInformerMetricsProvider struct{} + +// InformerMetricsProvider defines an interface for creating metrics that track informer operations. +type InformerMetricsProvider interface { + // NewQueuedItemMetric returns a gauge metric for tracking the total number of items + // currently queued and waiting to be processed. + // The returned metric should check id.Reserved() before updating to support + // dynamic informers that may shut down while the process is still running. + // + // For DeltaFIFO: Represents len(f.items) - the number of unique keys with pending deltas + // For RealFIFO: Represents len(f.items) - the total number of individual delta events queued + NewQueuedItemMetric(id InformerNameAndResource) GaugeMetric + + // NewProcessingLatencyMetric returns a histogram metric for tracking the time taken + // to process events (execute handlers) after they are popped from the queue. + // The latency is measured in seconds. + // The returned metric should check id.Reserved() before updating to support + // dynamic informers that may shut down while the process is still running. + NewProcessingLatencyMetric(id InformerNameAndResource) HistogramMetric + + // NewStoreResourceVersionMetric returns a gauge metric for tracking the resource version of the store. + // The returned metric should check id.Reserved() before updating to support + // dynamic informers that may shut down while the process is still running. + NewStoreResourceVersionMetric(id InformerNameAndResource) GaugeMetric +} + +// fifoMetrics holds all metrics for a FIFO. +type fifoMetrics struct { + numberOfQueuedItem GaugeMetric + processingLatency HistogramMetric +} + +// storeMetrics holds all metrics for a store. +type storeMetrics struct { + storeResourceVersion GaugeMetric +} + +// SetInformerMetricsProvider sets the metrics provider for all subsequently created +// FIFOs. Only the first call has an effect. +func SetInformerMetricsProvider(metricsProvider InformerMetricsProvider) { + setInformerMetricsProviderOnce.Do(func() { + globalInformerMetricsProvider = metricsProvider + }) +} + +func newFIFOMetrics(id InformerNameAndResource, metricsProvider InformerMetricsProvider) *fifoMetrics { + if metricsProvider == nil { + metricsProvider = globalInformerMetricsProvider + } + metrics := &fifoMetrics{ + numberOfQueuedItem: noopMetric{}, + processingLatency: noopMetric{}, + } + + if id.Reserved() { + metrics.numberOfQueuedItem = metricsProvider.NewQueuedItemMetric(id) + metrics.processingLatency = metricsProvider.NewProcessingLatencyMetric(id) + } + + return metrics +} + +func newStoreMetrics(id InformerNameAndResource, metricsProvider InformerMetricsProvider) *storeMetrics { + if metricsProvider == nil { + metricsProvider = globalInformerMetricsProvider + } + metrics := &storeMetrics{ + storeResourceVersion: noopMetric{}, + } + + if id.Reserved() { + metrics.storeResourceVersion = metricsProvider.NewStoreResourceVersionMetric(id) + } + + return metrics +} + +func (noopInformerMetricsProvider) NewQueuedItemMetric(InformerNameAndResource) GaugeMetric { + return noopMetric{} +} + +func (noopInformerMetricsProvider) NewProcessingLatencyMetric(InformerNameAndResource) HistogramMetric { + return noopMetric{} +} + +func (noopInformerMetricsProvider) NewStoreResourceVersionMetric(InformerNameAndResource) GaugeMetric { + return noopMetric{} +} diff --git a/vendor/k8s.io/client-go/tools/cache/identity.go b/vendor/k8s.io/client-go/tools/cache/identity.go new file mode 100644 index 0000000000..eed278dc06 --- /dev/null +++ b/vendor/k8s.io/client-go/tools/cache/identity.go @@ -0,0 +1,217 @@ +/* +Copyright 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. +*/ + +// Package cache is a client-side caching mechanism. It is useful for +// reducing the number of server calls you'd otherwise need to make. +// Reflector watches a server and updates a Store. Two stores are provided; +// one that simply caches objects (for example, to allow a scheduler to +// list currently available nodes), and one that additionally acts as +// a FIFO queue (for example, to allow a scheduler to process incoming +// pods). +package cache + +import ( + "fmt" + "sync" + "sync/atomic" + + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/klog/v2" +) + +// informerNameRegistry tracks all registered InformerName instances to detect collisions. +// Names must be globally unique across a process. +var informerNameRegistry = struct { + sync.Mutex + names map[string]*InformerName +}{ + names: make(map[string]*InformerName), +} + +// InformerName represents a named informer identity used for metrics. +// It is created once at startup (e.g., in cmd/kube-controller-manager) and passed to +// the SharedInformerFactory. The name must be globally unique within a process. +// +// InformerName tracks which GVRs have been registered under +// this name. When an informer requests a name+GVR combination, the first one wins +// and gets metrics enabled. Subsequent requests for the same GVR silently get +// metrics disabled. +type InformerName struct { + name string + // lock protects gvrs map modifications + lock sync.Mutex + // reserved is flipped to false when Release() is called + reserved *atomic.Bool + // gvrs maps each registered GVR to its atomic bool for lock-free Reserved() checks + gvrs map[schema.GroupVersionResource]*atomic.Bool +} + +// NewInformerName creates a new InformerName with the given name. +// The name must be globally unique within the process. If a name collision +// is detected, an error is returned. +// +// The caller should call Release() when the informer name is no longer needed +// (eg. at shutdown) to allow the name to be reused. +func NewInformerName(name string) (*InformerName, error) { + if name == "" { + return nil, fmt.Errorf("informer name cannot be empty") + } + + informerNameRegistry.Lock() + defer informerNameRegistry.Unlock() + + if existing, ok := informerNameRegistry.names[name]; ok { + // Check if the existing one is still reserved + if existing.reserved.Load() { + return nil, fmt.Errorf("informer name %q is already registered", name) + } + // Previous one was released, we can reuse the name + delete(informerNameRegistry.names, name) + } + + reserved := &atomic.Bool{} + reserved.Store(true) + + n := &InformerName{ + name: name, + reserved: reserved, + gvrs: make(map[schema.GroupVersionResource]*atomic.Bool), + } + + informerNameRegistry.names[name] = n + return n, nil +} + +// WithResource registers a GVR under this InformerName and returns an +// InformerNameAndResource that can be passed to FIFO/SharedIndexInformer. +// +// If this is the first time this GVR is registered under this name, the +// returned InformerNameAndResource will have Reserved() return true. +// If the GVR was already registered, the returned InformerNameAndResource +// will have Reserved() return false to prevent duplicate metrics. +func (n *InformerName) WithResource(gvr schema.GroupVersionResource) InformerNameAndResource { + if n == nil { + return InformerNameAndResource{gvr: gvr} + } + + n.lock.Lock() + defer n.lock.Unlock() + + retval := InformerNameAndResource{name: n.name, gvr: gvr, reserved: &atomic.Bool{}} + if n.reserved.Load() { + if _, gvrExists := n.gvrs[gvr]; !gvrExists { + retval.reserved.Store(true) + n.gvrs[gvr] = retval.reserved + } else { + // WithResource is called by generated informer code and probably + // not worth converting to contextual logging, which would require + // changing all those generated APIs. + klog.TODO().Error(nil, "Duplicate informer registration - metrics will not be published", "informerName", n.name, "group", gvr.Group, "version", gvr.Version, "resource", gvr.Resource) + } + } + return retval +} + +// Release marks this InformerName as no longer in use. +// All InformerNameAndResource instances created from this InformerName +// will have their Reserved() return false after this call. +// The name can be reused by a subsequent NewInformerName call. +func (n *InformerName) Release() { + if n == nil { + return + } + + n.lock.Lock() + defer n.lock.Unlock() + + // Flip all GVR-specific flags so that any InformerNameAndResource + // instances that were returned from WithResource() will have + // Reserved() return false. These instances hold pointers to the + // same atomic bools, so we must flip them before clearing the map. + for _, reserved := range n.gvrs { + reserved.Store(false) + } + + // Clear the map + n.gvrs = make(map[schema.GroupVersionResource]*atomic.Bool) + + // Flip the main reserved flag + n.reserved.Store(false) + + // Remove from global registry + informerNameRegistry.Lock() + defer informerNameRegistry.Unlock() + delete(informerNameRegistry.names, n.name) +} + +// Name returns the name of this InformerName. +func (n *InformerName) Name() string { + if n == nil { + return "" + } + return n.name +} + +// InformerNameAndResource represents a specific informer identity with both +// a name and a GVR. This is passed to FIFO and SharedIndexInformer for metrics. +// +// The Reserved() method provides a lock-free check to determine +// if metrics should be published. This is called on every queue operation +// so it must be fast. +type InformerNameAndResource struct { + name string + gvr schema.GroupVersionResource + reserved *atomic.Bool +} + +// Reserved returns true if this informer identity is reserved for metrics. +// This is a lock-free atomic load, safe and fast for hot-path usage. +// +// Returns false if: +// - The InformerNameAndResource is zero-valued (no name was configured) +// - The parent InformerName was released +// - This was a duplicate GVR registration +func (n InformerNameAndResource) Reserved() bool { + if n.reserved == nil { + return false + } + return n.reserved.Load() +} + +// Name returns the informer name. +func (n InformerNameAndResource) Name() string { + return n.name +} + +// GroupVersionResource returns the GVR for this informer identity. +func (n InformerNameAndResource) GroupVersionResource() schema.GroupVersionResource { + return n.gvr +} + +// ResetInformerNamesForTesting clears the informer name registry. +// This is exported for testing purposes only. +func ResetInformerNamesForTesting() { + informerNameRegistry.Lock() + names := make([]*InformerName, 0, len(informerNameRegistry.names)) + for _, name := range informerNameRegistry.names { + names = append(names, name) + } + informerNameRegistry.Unlock() + + for _, name := range names { + name.Release() + } +} diff --git a/vendor/k8s.io/client-go/tools/cache/reflector.go b/vendor/k8s.io/client-go/tools/cache/reflector.go index af2c7a22d0..a0e3a701cd 100644 --- a/vendor/k8s.io/client-go/tools/cache/reflector.go +++ b/vendor/k8s.io/client-go/tools/cache/reflector.go @@ -21,6 +21,7 @@ import ( "errors" "fmt" "io" + "math" "math/rand" "reflect" "strings" @@ -50,9 +51,21 @@ import ( const defaultExpectedTypeName = "" -// We try to spread the load on apiserver by setting timeouts for -// watch requests - it is random in [minWatchTimeout, 2*minWatchTimeout]. -var defaultMinWatchTimeout = 5 * time.Minute +var ( + // We try to spread the load on apiserver by setting timeouts for + // watch requests - it is random in [minWatchTimeout, 2*minWatchTimeout]. + defaultMinWatchTimeout = 5 * time.Minute + defaultMaxWatchTimeout = 2 * defaultMinWatchTimeout + // We used to make the call every 1sec (1 QPS), the goal here is to achieve ~98% traffic reduction when + // API server is not healthy. With these parameters, backoff will stop at [30,60) sec interval which is + // 0.22 QPS. + defaultBackoffInit = 800 * time.Millisecond + defaultBackoffMax = 30 * time.Second + // If we don't backoff for 2min, assume API server is healthy and we reset the backoff. + defaultBackoffReset = 2 * time.Minute + defaultBackoffFactor = 2.0 + defaultBackoffJitter = 1.0 +) // ReflectorStore is the subset of cache.Store that the reflector uses type ReflectorStore interface { @@ -76,6 +89,12 @@ type ReflectorStore interface { Resync() error } +// ReflectorBookmarkStore is an optional interface that allows a store +// to be informed of bookmark events received by the reflector. +type ReflectorBookmarkStore interface { + Bookmark(resourceVersion string) error +} + // TransformingStore is an optional interface that can be implemented by the provided store. // If implemented on the provided store reflector will use the same transformer in its internal stores. type TransformingStore interface { @@ -85,6 +104,7 @@ type TransformingStore interface { // Reflector watches a specified resource and causes all changes to be reflected in the given store. type Reflector struct { + logger klog.Logger // name identifies this reflector. By default, it will be a file:line if possible. name string // The name of the type we expect to place in the store. The name @@ -103,11 +123,14 @@ type Reflector struct { store ReflectorStore // listerWatcher is used to perform lists and watches. listerWatcher ListerWatcherWithContext - // backoff manages backoff of ListWatch - backoffManager wait.BackoffManager - resyncPeriod time.Duration + // delay returns the next backoff interval for retries. + resyncPeriod time.Duration + delayHandler wait.DelayFunc // minWatchTimeout defines the minimum timeout for watch requests. minWatchTimeout time.Duration + // maxWatchTimeout defines the maximum timeout for watch requests. + // Actual timeout is random in [minWatchTimeout, maxWatchTimeout]. + maxWatchTimeout time.Duration // clock allows tests to manipulate time clock clock.Clock // paginatedResult defines whether pagination should be forced for list calls. @@ -227,6 +250,10 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{}, // ReflectorOptions configures a Reflector. type ReflectorOptions struct { + // Logger, if not nil, is used instead of klog.Background() for logging. + // The name of the reflector gets added automatically. + Logger *klog.Logger + // Name is the Reflector's name. If unset/unspecified, the name defaults to the closest source_file.go:line // in the call stack that is outside this package. Name string @@ -248,6 +275,12 @@ type ReflectorOptions struct { // Clock allows tests to control time. If unset defaults to clock.RealClock{} Clock clock.Clock + + // Backoff is an optional custom backoff configuration. + // If set, it will be used instead of the default exponential backoff. + // DelayWithReset(clock, resetDuration) will be called on it to create the delay function. + // TODO(#136943): Expose this configuration through SharedInformerFactory. + Backoff *wait.Backoff } // NewReflectorWithOptions creates a new Reflector object which will keep the @@ -265,21 +298,42 @@ func NewReflectorWithOptions(lw ListerWatcher, expectedType interface{}, store R if reflectorClock == nil { reflectorClock = clock.RealClock{} } + minWatchTimeout := defaultMinWatchTimeout + maxWatchTimeout := defaultMaxWatchTimeout if options.MinWatchTimeout > defaultMinWatchTimeout { minWatchTimeout = options.MinWatchTimeout + maxWatchTimeout = 2 * minWatchTimeout + } + if maxWatchTimeout < minWatchTimeout { + klog.TODO().V(3).Info( + "maxWatchTimeout was less than minWatchTimeout, overriding to minWatchTimeout. Watch timeout randomization is disabled.", + "minWatchTimeout", minWatchTimeout, + "maxWatchTimeout", maxWatchTimeout, + ) + maxWatchTimeout = minWatchTimeout } + + backoff := options.Backoff + if backoff == nil { + backoff = &wait.Backoff{ + Duration: defaultBackoffInit, + Cap: defaultBackoffMax, + Steps: int(math.Ceil(float64(defaultBackoffMax) / float64(defaultBackoffInit))), + Factor: defaultBackoffFactor, + Jitter: defaultBackoffJitter, + } + } + r := &Reflector{ - name: options.Name, - resyncPeriod: options.ResyncPeriod, - minWatchTimeout: minWatchTimeout, - typeDescription: options.TypeDescription, - listerWatcher: ToListerWatcherWithContext(lw), - store: store, - // We used to make the call every 1sec (1 QPS), the goal here is to achieve ~98% traffic reduction when - // API server is not healthy. With these parameters, backoff will stop at [30,60) sec interval which is - // 0.22 QPS. If we don't backoff for 2min, assume API server is healthy and we reset the backoff. - backoffManager: wait.NewExponentialBackoffManager(800*time.Millisecond, 30*time.Second, 2*time.Minute, 2.0, 1.0, reflectorClock), + name: options.Name, + resyncPeriod: options.ResyncPeriod, + minWatchTimeout: minWatchTimeout, + maxWatchTimeout: maxWatchTimeout, + typeDescription: options.TypeDescription, + listerWatcher: ToListerWatcherWithContext(lw), + store: store, + delayHandler: backoff.DelayWithReset(reflectorClock, defaultBackoffReset), clock: reflectorClock, watchErrorHandler: WatchErrorHandlerWithContext(DefaultWatchErrorHandler), expectedType: reflect.TypeOf(expectedType), @@ -289,6 +343,13 @@ func NewReflectorWithOptions(lw ListerWatcher, expectedType interface{}, store R r.name = naming.GetNameFromCallsite(internalPackages...) } + logger := klog.Background() + if options.Logger != nil { + logger = *options.Logger + } + logger = klog.LoggerWithName(logger, r.name) + r.logger = logger + if r.typeDescription == "" { r.typeDescription = getTypeDescriptionFromObject(expectedType) } @@ -299,11 +360,8 @@ func NewReflectorWithOptions(lw ListerWatcher, expectedType interface{}, store R r.useWatchList = clientfeatures.FeatureGates().Enabled(clientfeatures.WatchListClient) if r.useWatchList && watchlist.DoesClientNotSupportWatchListSemantics(lw) { - // Using klog.TODO() here because switching to a caller-provided contextual logger - // would require an API change and updating all existing call sites. - klog.TODO().V(2).Info( - "The provided ListWatcher doesn't support WatchList semantics. The feature will be disabled. If you are using a custom client, check the documentation of watchlist.DoesClientNotSupportWatchListSemantics() method", - "listWatcherType", fmt.Sprintf("%T", lw), + r.logger.V(2).Info( + "The client used to build this informer/reflector doesn't support WatchList semantics. The feature will be disabled. This is expected in unit tests but not in production. For details, see the documentation of watchlist.DoesClientNotSupportWatchListSemantics().", "feature", clientfeatures.WatchListClient, ) r.useWatchList = false @@ -365,11 +423,14 @@ func (r *Reflector) Run(stopCh <-chan struct{}) { func (r *Reflector) RunWithContext(ctx context.Context) { logger := klog.FromContext(ctx) logger.V(3).Info("Starting reflector", "type", r.typeDescription, "resyncPeriod", r.resyncPeriod, "reflector", r.name) - wait.BackoffUntil(func() { + // Until runs the loop immediately (immediate=true) and resets the backoff timer after each + // successful iteration (sliding=true). See backoff constants at top of file for generalized QPS targets (~0.22 QPS). + _ = r.delayHandler.Until(ctx, true, true, func(ctx context.Context) (bool, error) { if err := r.ListAndWatchWithContext(ctx); err != nil { r.watchErrorHandler(ctx, r, err) } - }, r.backoffManager, true, ctx.Done()) + return false, nil + }) logger.V(3).Info("Stopping reflector", "type", r.typeDescription, "resyncPeriod", r.resyncPeriod, "reflector", r.name) } @@ -521,8 +582,10 @@ func (r *Reflector) watch(ctx context.Context, w watch.Interface, resyncerrc cha // start the clock before sending the request, since some proxies won't flush headers until after the first watch event is sent start := r.clock.Now() + // if w is already initialized, it must be past any synthetic non-rv-ordered added events + propagateRVFromStart := true if w == nil { - timeoutSeconds := int64(r.minWatchTimeout.Seconds() * (rand.Float64() + 1.0)) + timeoutSeconds := int64(r.minWatchTimeout.Seconds() + rand.Float64()*(r.maxWatchTimeout.Seconds()-r.minWatchTimeout.Seconds())) options := metav1.ListOptions{ ResourceVersion: r.LastSyncResourceVersion(), // We want to avoid situations of hanging watchers. Stop any watchers that do not @@ -533,6 +596,11 @@ func (r *Reflector) watch(ctx context.Context, w watch.Interface, resyncerrc cha // watch bookmarks, it will ignore this field). AllowWatchBookmarks: true, } + if options.ResourceVersion == "" || options.ResourceVersion == "0" { + // if we're starting the watch at a resource version that will get synthetic ADDED events in non-rv order, + // wait until we're through that set of events before propagating the RV + propagateRVFromStart = false + } w, err = r.listerWatcher.WatchWithContext(ctx, options) if err != nil { @@ -541,7 +609,7 @@ func (r *Reflector) watch(ctx context.Context, w watch.Interface, resyncerrc cha select { case <-stopCh: return nil - case <-r.backoffManager.Backoff().C(): + case <-r.clock.After(r.delayHandler()): continue } } @@ -549,7 +617,25 @@ func (r *Reflector) watch(ctx context.Context, w watch.Interface, resyncerrc cha } } - err = handleWatch(ctx, start, w, r.store, r.expectedType, r.expectedGVK, r.name, r.typeDescription, r.setLastSyncResourceVersion, + err = handleWatch(ctx, start, w, r.store, r.expectedType, r.expectedGVK, r.name, r.typeDescription, + func(rv string, eventReceivedBesidesAdded bool) { + // We update the resource version in the store only if we have received at least one event that is + // not an added event, or if the resource version has been set previously. This is because we can + // encounter 2 scenarios: + // 1. The watch is started from a resource version specified by the LastSyncResourceVersion field. + // In this case, we can update the resource version in the store without worrying about it being + // out of order since we will not receive any synthetic added events for resources that may be + // out of order. + // 2. The watch is started when the LastSyncResourceVersion field is empty. In this case, we may not + // update the LastSyncResourceVersion until we receive at least one event that is not an added + // event, since that is the only way to ensure that the watch has exited the initial list phase. + if propagateRVFromStart || eventReceivedBesidesAdded { + r.setLastSyncResourceVersion(rv) + if rvu, ok := r.store.(ResourceVersionUpdater); ok { + rvu.UpdateResourceVersion(rv) + } + } + }, r.clock, resyncerrc) // handleWatch always stops the watcher. So we don't need to here. // Just set it to nil to trigger a retry on the next loop. @@ -568,7 +654,7 @@ func (r *Reflector) watch(ctx context.Context, w watch.Interface, resyncerrc cha select { case <-stopCh: return nil - case <-r.backoffManager.Backoff().C(): + case <-r.clock.After(r.delayHandler()): continue } case apierrors.IsInternalError(err) && retry.ShouldRetry(): @@ -641,6 +727,11 @@ func (r *Reflector) list(ctx context.Context) error { // the reflector makes forward progress. list, paginatedResult, err = pager.ListWithAlloc(context.Background(), metav1.ListOptions{ResourceVersion: r.relistResourceVersion()}) } + if err == nil { + if unsupportedList, unsupportedListGVK := isUnsupportedTableListObject(list); unsupportedList { + err = fmt.Errorf("unsupported list gvk: %v, type: %v", unsupportedListGVK, r.typeDescription) + } + } close(listCh) }() select { @@ -650,6 +741,7 @@ func (r *Reflector) list(ctx context.Context) error { panic(r) case <-listCh: } + initTrace.Step("Objects listed", trace.Field{Key: "error", Value: err}) if err != nil { return fmt.Errorf("failed to list %v: %w", r.typeDescription, err) @@ -722,7 +814,7 @@ func (r *Reflector) watchList(ctx context.Context) (watch.Interface, error) { isErrorRetriableWithSideEffectsFn := func(err error) bool { if canRetry := isWatchErrorRetriable(err); canRetry { logger.V(2).Info("watch-list failed - backing off", "reflector", r.name, "type", r.typeDescription, "err", err) - <-r.backoffManager.Backoff().C() + <-r.clock.After(r.delayHandler()) return true } if isExpiredError(err) || isTooLargeResourceVersionError(err) { @@ -758,7 +850,7 @@ func (r *Reflector) watchList(ctx context.Context) (watch.Interface, error) { // TODO(#115478): large "list", slow clients, slow network, p&f // might slow down streaming and eventually fail. // maybe in such a case we should retry with an increased timeout? - timeoutSeconds := int64(r.minWatchTimeout.Seconds() * (rand.Float64() + 1.0)) + timeoutSeconds := int64(r.minWatchTimeout.Seconds() + rand.Float64()*(r.maxWatchTimeout.Seconds()-r.minWatchTimeout.Seconds())) options := metav1.ListOptions{ ResourceVersion: lastKnownRV, AllowWatchBookmarks: true, @@ -776,7 +868,11 @@ func (r *Reflector) watchList(ctx context.Context) (watch.Interface, error) { return nil, err } watchListBookmarkReceived, err := handleListWatch(ctx, start, w, temporaryStore, r.expectedType, r.expectedGVK, r.name, r.typeDescription, - func(rv string) { resourceVersion = rv }, + func(rv string, eventReceivedBesidesAdded bool) { + if eventReceivedBesidesAdded { + resourceVersion = rv + } + }, r.clock, make(chan error)) if err != nil { w.Stop() // stop and retry with clean state @@ -833,7 +929,7 @@ func handleListWatch( expectedGVK *schema.GroupVersionKind, name string, expectedTypeName string, - setLastSyncResourceVersion func(string), + setLastSyncResourceVersion func(string, bool), clock clock.Clock, errCh chan error, ) (bool, error) { @@ -854,7 +950,7 @@ func handleWatch( expectedGVK *schema.GroupVersionKind, name string, expectedTypeName string, - setLastSyncResourceVersion func(string), + setLastSyncResourceVersion func(string, bool), clock clock.Clock, errCh chan error, ) error { @@ -882,12 +978,13 @@ func handleAnyWatch( expectedGVK *schema.GroupVersionKind, name string, expectedTypeName string, - setLastSyncResourceVersion func(string), + setLastSyncResourceVersion func(string, bool), exitOnWatchListBookmarkReceived bool, clock clock.Clock, errCh chan error, ) (bool, error) { watchListBookmarkReceived := false + eventReceivedBesidesAdded := false eventCount := 0 logger := klog.FromContext(ctx) initialEventsEndBookmarkWarningTicker := newInitialEventsEndBookmarkTicker(logger, name, clock, start, exitOnWatchListBookmarkReceived) @@ -925,14 +1022,11 @@ loop: continue } } - // For now, let’s block unsupported Table - // resources for watchlist only + // we don't support receiving resources in Table format // see #132926 for more info - if exitOnWatchListBookmarkReceived { - if unsupportedGVK := isUnsupportedTableObject(event.Object); unsupportedGVK { - utilruntime.HandleErrorWithContext(ctx, nil, "Unsupported watch event object gvk", "reflector", name, "actualGVK", event.Object.GetObjectKind().GroupVersionKind()) - continue - } + if unsupportedGVK := isUnsupportedTableObject(event.Object); unsupportedGVK { + utilruntime.HandleErrorWithContext(ctx, nil, "Unsupported watch event object gvk", "reflector", name, "actualGVK", event.Object.GetObjectKind().GroupVersionKind()) + continue } meta, err := meta.Accessor(event.Object) if err != nil { @@ -947,6 +1041,7 @@ loop: utilruntime.HandleErrorWithContext(ctx, err, "Unable to add watch event object to store", "reflector", name, "object", event.Object) } case watch.Modified: + eventReceivedBesidesAdded = true err := store.Update(event.Object) if err != nil { utilruntime.HandleErrorWithContext(ctx, err, "Unable to update watch event object to store", "reflector", name, "object", event.Object) @@ -955,22 +1050,29 @@ loop: // TODO: Will any consumers need access to the "last known // state", which is passed in event.Object? If so, may need // to change this. + eventReceivedBesidesAdded = true err := store.Delete(event.Object) if err != nil { utilruntime.HandleErrorWithContext(ctx, err, "Unable to delete watch event object from store", "reflector", name, "object", event.Object) } case watch.Bookmark: // A `Bookmark` means watch has synced here, just update the resourceVersion + eventReceivedBesidesAdded = true if meta.GetAnnotations()[metav1.InitialEventsAnnotationKey] == "true" { watchListBookmarkReceived = true } + // Propagate the resource version from the bookmark event to stores which indicate they want it + if bookmarkStore, ok := store.(ReflectorBookmarkStore); ok { + err := bookmarkStore.Bookmark(resourceVersion) + if err != nil { + utilruntime.HandleErrorWithContext(ctx, err, "Unable to send bookmark event to store", "reflector", name, "object", event.Object) + } + } default: utilruntime.HandleErrorWithContext(ctx, err, "Unknown watch event", "reflector", name, "event", event) } - setLastSyncResourceVersion(resourceVersion) - if rvu, ok := store.(ResourceVersionUpdater); ok { - rvu.UpdateResourceVersion(resourceVersion) - } + // when eventReceivedBesidesAdded is true, that indicates we are definitely past any initial synthetic Added events + setLastSyncResourceVersion(resourceVersion, eventReceivedBesidesAdded) eventCount++ if exitOnWatchListBookmarkReceived && watchListBookmarkReceived { stopWatcher = false @@ -1220,3 +1322,12 @@ func isUnsupportedTableObject(rawObject runtime.Object) bool { return unsupportedTableGVK[rawObject.GetObjectKind().GroupVersionKind()] } + +func isUnsupportedTableListObject(rawObject runtime.Object) (bool, schema.GroupVersionKind) { + unstructuredObj, ok := rawObject.(*unstructured.UnstructuredList) + if !ok { + return false, schema.GroupVersionKind{} + } + + return unsupportedTableGVK[unstructuredObj.GetObjectKind().GroupVersionKind()], unstructuredObj.GetObjectKind().GroupVersionKind() +} diff --git a/vendor/k8s.io/client-go/tools/cache/reflector_metrics.go b/vendor/k8s.io/client-go/tools/cache/reflector_metrics.go index 5c00115f59..65e8a38afb 100644 --- a/vendor/k8s.io/client-go/tools/cache/reflector_metrics.go +++ b/vendor/k8s.io/client-go/tools/cache/reflector_metrics.go @@ -40,6 +40,12 @@ type SummaryMetric interface { Observe(float64) } +// HistogramMetric captures individual observations into configurable buckets. +// It also provides a sum and count of observations. +type HistogramMetric interface { + Observe(float64) +} + type noopMetric struct{} func (noopMetric) Inc() {} diff --git a/vendor/k8s.io/client-go/tools/cache/shared_informer.go b/vendor/k8s.io/client-go/tools/cache/shared_informer.go index 8973a33e8f..4cec4283f1 100644 --- a/vendor/k8s.io/client-go/tools/cache/shared_informer.go +++ b/vendor/k8s.io/client-go/tools/cache/shared_informer.go @@ -20,7 +20,11 @@ import ( "context" "errors" "fmt" + "reflect" + "slices" + "strings" "sync" + "sync/atomic" "time" "k8s.io/apimachinery/pkg/api/meta" @@ -31,6 +35,7 @@ import ( "k8s.io/utils/buffer" "k8s.io/utils/clock" "k8s.io/utils/ptr" + utiltrace "k8s.io/utils/trace" "k8s.io/klog/v2" @@ -193,6 +198,14 @@ type SharedInformer interface { // For that, please call HasSynced on the handle returned by // AddEventHandler. HasSynced() bool + // HasSyncedChecker completes if the shared informer's store has been + // informed by at least one full LIST of the authoritative state + // of the informer's object collection. This is unrelated to "resync". + // + // Note that this doesn't tell you if an individual handler is synced!! + // For that, please use HasSyncedChecker on the handle returned by + // AddEventHandler. + HasSyncedChecker() DoneChecker // LastSyncResourceVersion is the resource version observed when last synced with the underlying // store. The value returned is not synchronized with access to the underlying store and is not // thread-safe. @@ -246,6 +259,10 @@ type ResourceEventHandlerRegistration interface { // HasSynced reports if both the parent has synced and all pre-sync // events have been delivered. HasSynced() bool + + // HasSyncedChecker reports if both the parent has synced and all pre-sync + // events have been delivered. + HasSyncedChecker() DoneChecker } // Optional configuration options for [SharedInformer.AddEventHandlerWithOptions]. @@ -302,9 +319,13 @@ func NewSharedIndexInformer(lw ListerWatcher, exampleObject runtime.Object, defa func NewSharedIndexInformerWithOptions(lw ListerWatcher, exampleObject runtime.Object, options SharedIndexInformerOptions) SharedIndexInformer { realClock := &clock.RealClock{} + processor := &sharedProcessor{clock: realClock} + processor.listenersRCond = sync.NewCond(processor.listenersLock.RLocker()) + return &sharedIndexInformer{ - indexer: NewIndexer(DeletionHandlingMetaNamespaceKeyFunc, options.Indexers), - processor: &sharedProcessor{clock: realClock}, + indexer: NewIndexer(DeletionHandlingMetaNamespaceKeyFunc, options.Indexers, WithStoreMetrics(options.Identifier, options.InformerMetricsProvider)), + processor: processor, + synced: make(chan struct{}), listerWatcher: lw, objectType: exampleObject, objectDescription: options.ObjectDescription, @@ -312,6 +333,9 @@ func NewSharedIndexInformerWithOptions(lw ListerWatcher, exampleObject runtime.O defaultEventHandlerResyncPeriod: options.ResyncPeriod, clock: realClock, cacheMutationDetector: NewCacheMutationDetector(fmt.Sprintf("%T", exampleObject)), + identifier: options.Identifier, + informerMetricsProvider: options.InformerMetricsProvider, + keyFunc: DeletionHandlingMetaNamespaceKeyFunc, } } @@ -327,6 +351,14 @@ type SharedIndexInformerOptions struct { // ObjectDescription is the sharedIndexInformer's object description. This is passed through to the // underlying Reflector's type description. ObjectDescription string + + // Identifier is used to identify the FIFO for metrics and logging purposes. + // If not set, metrics will not be published. + Identifier InformerNameAndResource + + // InformerMetricsProvider is the metrics provider for the FIFO queue. + // If not set, metrics will be no-ops. + InformerMetricsProvider InformerMetricsProvider } // InformerSynced is a function that can be used to determine if an informer has synced. This is useful for determining if caches have synced. @@ -399,6 +431,147 @@ func WaitForCacheSync(stopCh <-chan struct{}, cacheSyncs ...InformerSynced) bool return true } +// WaitFor waits for a set of activities to complete, like cache syncing. +// It returns true if it was successful, false if the context was canceled +// before all activities are completed. +// +// If a non-nil "what" is provided, then progress information is logged +// while waiting ("Waiting", for=""). Verbosity is V(0). This can +// be made less verbose by the caller with: +// +// WaitFor(klog.NewContext(ctx, klog.FromContext(ctx).V(2)), ...) +// +// In contrast to other WaitForCacheSync alternatives, this one here doesn't +// need polling, which makes it react immediately. When used in a synctest unit +// test, waiting completes without moving time forward randomly, which +// makes tests more predictable. +func WaitFor(ctx context.Context, what string, checkers ...DoneChecker) bool { + logger := klog.FromContext(ctx) + if what != "" { + helper, l := logger.WithCallStackHelper() + logger = l + helper() + logger.Info("Waiting", "for", what) + } + + // Check in parallel to ensure that we log "Done waiting" as soon + // as possible for each checker. The timing may be useful to know. + // We cannot log inside the goroutine, the stack unwinding wouldn't + // work, so instead each goroutine just notifies the parent + // goroutine when it's checker is done and the main goroutine then + // logs it. + var wg sync.WaitGroup + type result struct { + checker DoneChecker + done bool + } + doneChecker := make(chan result) + for _, checker := range checkers { + wg.Go(func() { + select { + case <-checker.Done(): + doneChecker <- result{checker, true} + case <-ctx.Done(): + // We can end up here even when the checker is already done, + // select is not deterministic. Check once more without blocking + // before finally giving up. + select { + case <-checker.Done(): + doneChecker <- result{checker, true} + default: + doneChecker <- result{checker, false} + } + } + }) + } + instances := make([]string, 0, len(checkers)) + for range len(checkers) { + // We are guaranteed to get exactly one result from each goroutine, so this won't block forever. + result := <-doneChecker + if result.done { + if what != "" { + logger.Info("Done waiting", "for", what, "instance", result.checker.Name()) + } + } else { + // We don't need this information unless we are a) logging or b) debugging interactively. + instances = append(instances, result.checker.Name()) + } + } + wg.Wait() + + if what != "" && len(instances) > 0 { + slices.Sort(instances) + logger.Info("Timed out waiting", "for", what, "cause", context.Cause(ctx), "instances", instances) + } + + done := len(instances) == 0 + return done +} + +// DoneChecker, in contrast to [InformerSynced], supports waiting +// for some activity to finish without polling and has a name +// that describes itself. +// +// To check for completion without blocking, use [IsDone]. +type DoneChecker interface { + // Name returns a string describing the entity that is being waited for. + // + // Note that this name might be computed, so callers should only + // get the name outside of a hot code path. + Name() string + + // Done returns a channel that will be closed on completion + // of the activity. + Done() <-chan struct{} +} + +// IsDone returns true if the activity is done, false otherwise. +func IsDone(checker DoneChecker) bool { + select { + case <-checker.Done(): + return true + default: + return false + } +} + +// SyncResult is the result of a shared informer factory's WaitForCacheSyncWithContext. +// Under the hood such factories use [WaitFor] to wait for all instantiated informers, +// then provide this summary of what was synced. +// +// Note that the informers may have synced already before all event handlers registered with +// those informers have synced. Code which wants to be sure that all of its state is up-to-date +// should do its own WaitFor with the informer's HasSyncedChecker() *and* the +// registration handle's HasSyncChecker() results. +type SyncResult struct { + // Err is nil if all informer caches were synced, otherwise it is + // the reason why waiting for cache syncing stopped (= context.Cause(ctx)). + Err error + + // Synced maps each registered informer in a SharedInformerFactory to + // true if it has synced, false otherwise. + Synced map[reflect.Type]bool +} + +// AsError turns a SyncResult into an error if not all caches were synced, +// otherwise it returns nil. The error wraps context.Cause(ctx) and +// includes information about the informers which were not synced. +func (c SyncResult) AsError() error { + if c.Err == nil { + return nil + } + + unsynced := make([]string, 0, len(c.Synced)) + for t, synced := range c.Synced { + if !synced { + unsynced = append(unsynced, t.String()) + } + } + slices.Sort(unsynced) + + return fmt.Errorf("failed to sync all caches: %s: %w", strings.Join(unsynced, ", "), c.Err) +} + // `*sharedIndexInformer` implements SharedIndexInformer and has three // main components. One is an indexed local cache, `indexer Indexer`. // The second main component is a Controller that pulls @@ -416,6 +589,10 @@ type sharedIndexInformer struct { indexer Indexer controller Controller + // synced gets created when creating the sharedIndexInformer. + // It gets closed when Run detects that the processor created + synced chan struct{} + processor *sharedProcessor cacheMutationDetector MutationDetector @@ -449,6 +626,15 @@ type sharedIndexInformer struct { watchErrorHandler WatchErrorHandlerWithContext transform TransformFunc + + // identifier is used to identify this informer for metrics and logging purposes. + identifier InformerNameAndResource + + // informerMetricsProvider is the metrics provider for the FIFO queue. + informerMetricsProvider InformerMetricsProvider + + // keyFunc is called when processing deltas by the underlying process function. + keyFunc KeyFunc } // dummyController hides the fact that a SharedInformer is different from a dedicated one @@ -470,6 +656,10 @@ func (v *dummyController) HasSynced() bool { return v.informer.HasSynced() } +func (v *dummyController) HasSyncedChecker() DoneChecker { + return v.informer.HasSyncedChecker() +} + func (v *dummyController) LastSyncResourceVersion() string { if clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.InformerResourceVersion) { return v.informer.LastSyncResourceVersion() @@ -539,7 +729,7 @@ func (s *sharedIndexInformer) RunWithContext(ctx context.Context) { s.startedLock.Lock() defer s.startedLock.Unlock() - fifo := newQueueFIFO(s.indexer, s.transform) + logger, fifo := newQueueFIFO(logger, s.objectType, s.indexer, s.transform, s.identifier, s.informerMetricsProvider) cfg := &Config{ Queue: fifo, @@ -549,8 +739,12 @@ func (s *sharedIndexInformer) RunWithContext(ctx context.Context) { FullResyncPeriod: s.resyncCheckPeriod, ShouldResync: s.processor.shouldResync, - Process: s.HandleDeltas, - ProcessBatch: s.HandleBatchDeltas, + Process: func(obj interface{}, isInInitialList bool) error { + return s.handleDeltas(logger, obj, isInInitialList) + }, + ProcessBatch: func(deltas []Delta, isInInitialList bool) error { + return s.handleBatchDeltas(logger, deltas, isInInitialList) + }, WatchErrorHandlerWithContext: s.watchErrorHandler, } @@ -570,6 +764,15 @@ func (s *sharedIndexInformer) RunWithContext(ctx context.Context) { // has a RunWithContext method that we can use here. wg.StartWithChannel(processorStopCtx.Done(), s.cacheMutationDetector.Run) wg.StartWithContext(processorStopCtx, s.processor.run) + wg.Start(func() { + select { + case <-ctx.Done(): + // We were stopped without completing the sync. + case <-s.controller.HasSyncedChecker().Done(): + // Controller has synced and thus so have we. + close(s.synced) + } + }) defer func() { s.startedLock.Lock() @@ -586,13 +789,31 @@ func (s *sharedIndexInformer) HasStarted() bool { } func (s *sharedIndexInformer) HasSynced() bool { - s.startedLock.Lock() - defer s.startedLock.Unlock() - - if s.controller == nil { + select { + case <-s.synced: + return true + default: return false } - return s.controller.HasSynced() +} + +func (s *sharedIndexInformer) HasSyncedChecker() DoneChecker { + return &sharedIndexInformerDone{ + s: s, + } +} + +// sharedIndexInformerDone implements [NamedCacheSync] for a [sharedIndexInformer]. +type sharedIndexInformerDone struct { + s *sharedIndexInformer +} + +func (sd *sharedIndexInformerDone) Name() string { + return fmt.Sprintf("SharedIndexInformer %T", sd.s.objectType) +} + +func (sd *sharedIndexInformerDone) Done() <-chan struct{} { + return sd.s.synced } func (s *sharedIndexInformer) LastSyncResourceVersion() string { @@ -684,10 +905,11 @@ func (s *sharedIndexInformer) AddEventHandlerWithOptions(handler ResourceEventHa } } - listener := newProcessListener(logger, handler, resyncPeriod, determineResyncPeriod(logger, resyncPeriod, s.resyncCheckPeriod), s.clock.Now(), initialBufferSize, s.HasSynced) + listener := newProcessListener(logger, handler, resyncPeriod, determineResyncPeriod(logger, resyncPeriod, s.resyncCheckPeriod), s.clock.Now(), initialBufferSize, s.HasSyncedChecker()) if !s.started { - return s.processor.addListener(listener), nil + handle, _ := s.processor.addListener(listener) + return handle, nil } // in order to safely join, we have to @@ -698,7 +920,7 @@ func (s *sharedIndexInformer) AddEventHandlerWithOptions(handler ResourceEventHa s.blockDeltas.Lock() defer s.blockDeltas.Unlock() - handle := s.processor.addListener(listener) + handle, started := s.processor.addListener(listener) for _, item := range s.indexer.List() { // Note that we enqueue these notifications with the lock held // and before returning the handle. That means there is never a @@ -710,23 +932,29 @@ func (s *sharedIndexInformer) AddEventHandlerWithOptions(handler ResourceEventHa // thread adding them and the counter is temporarily zero). listener.add(addNotification{newObj: item, isInInitialList: true}) } + + // Initial list is added, now we can allow the listener to detect that "upstream has synced". + if started { + s.processor.wg.Start(listener.watchSynced) + } + return handle, nil } -func (s *sharedIndexInformer) HandleDeltas(obj interface{}, isInInitialList bool) error { +func (s *sharedIndexInformer) handleDeltas(logger klog.Logger, obj interface{}, isInInitialList bool) error { s.blockDeltas.Lock() defer s.blockDeltas.Unlock() if deltas, ok := obj.(Deltas); ok { - return processDeltas(s, s.indexer, deltas, isInInitialList) + return processDeltas(logger, s, s.indexer, deltas, isInInitialList, s.keyFunc) } return errors.New("object given as Process argument is not Deltas") } -func (s *sharedIndexInformer) HandleBatchDeltas(deltas []Delta, isInInitialList bool) error { +func (s *sharedIndexInformer) handleBatchDeltas(logger klog.Logger, deltas []Delta, isInInitialList bool) error { s.blockDeltas.Lock() defer s.blockDeltas.Unlock() - return processDeltasInBatch(s, s.indexer, deltas, isInInitialList) + return processDeltasInBatch(logger, s, s.indexer, deltas, isInInitialList, s.keyFunc) } // Conforms to ResourceEventHandler @@ -795,6 +1023,7 @@ func (s *sharedIndexInformer) RemoveEventHandler(handle ResourceEventHandlerRegi type sharedProcessor struct { listenersStarted bool listenersLock sync.RWMutex + listenersRCond *sync.Cond // Caller of Wait must hold a read lock on listenersLock. // Map from listeners to whether or not they are currently syncing listeners map[*processorListener]bool clock clock.Clock @@ -818,7 +1047,7 @@ func (p *sharedProcessor) getListener(registration ResourceEventHandlerRegistrat return nil } -func (p *sharedProcessor) addListener(listener *processorListener) ResourceEventHandlerRegistration { +func (p *sharedProcessor) addListener(listener *processorListener) (ResourceEventHandlerRegistration, bool) { p.listenersLock.Lock() defer p.listenersLock.Unlock() @@ -829,11 +1058,13 @@ func (p *sharedProcessor) addListener(listener *processorListener) ResourceEvent p.listeners[listener] = true if p.listenersStarted { + // Not starting listener.watchSynced! + // The caller must first add the initial list, then start it. p.wg.Start(listener.run) p.wg.Start(listener.pop) } - return listener + return listener, p.listenersStarted } func (p *sharedProcessor) removeListener(handle ResourceEventHandlerRegistration) error { @@ -864,6 +1095,14 @@ func (p *sharedProcessor) distribute(obj interface{}, sync bool) { p.listenersLock.RLock() defer p.listenersLock.RUnlock() + // Before we start blocking on writes to the listeners' channels, + // ensure that they all have been started. If the processor stops, + // p.listeners gets cleared, in which case we also continue here + // and return without doing anything. + for !p.listenersStarted && len(p.listeners) > 0 { + p.listenersRCond.Wait() + } + for listener, isSyncing := range p.listeners { switch { case !sync: @@ -878,15 +1117,26 @@ func (p *sharedProcessor) distribute(obj interface{}, sync bool) { } } +// sharedProcessorRunHook can be used inside tests to execute additional code +// at the start of sharedProcessor.run. +var sharedProcessorRunHook atomic.Pointer[func()] + func (p *sharedProcessor) run(ctx context.Context) { func() { - p.listenersLock.RLock() - defer p.listenersLock.RUnlock() + hook := sharedProcessorRunHook.Load() + if hook != nil { + (*hook)() + } + // Changing listenersStarted needs a write lock. + p.listenersLock.Lock() + defer p.listenersLock.Unlock() for listener := range p.listeners { + p.wg.Start(listener.watchSynced) p.wg.Start(listener.run) p.wg.Start(listener.pop) } p.listenersStarted = true + p.listenersRCond.Signal() }() <-ctx.Done() @@ -903,6 +1153,9 @@ func (p *sharedProcessor) run(ctx context.Context) { // Reset to false since no listeners are running p.listenersStarted = false + // Wake up sharedProcessor.distribute. + p.listenersRCond.Signal() + p.wg.Wait() // Wait for all .pop() and .run() to stop } @@ -940,7 +1193,7 @@ func (p *sharedProcessor) resyncCheckPeriodChanged(logger klog.Logger, resyncChe } // processorListener relays notifications from a sharedProcessor to -// one ResourceEventHandler --- using two goroutines, two unbuffered +// one ResourceEventHandler --- using three goroutines, two unbuffered // channels, and an unbounded ring buffer. The `add(notification)` // function sends the given notification to `addCh`. One goroutine // runs `pop()`, which pumps notifications from `addCh` to `nextCh` @@ -948,16 +1201,24 @@ func (p *sharedProcessor) resyncCheckPeriodChanged(logger klog.Logger, resyncChe // Another goroutine runs `run()`, which receives notifications from // `nextCh` and synchronously invokes the appropriate handler method. // +// The third goroutine watches the upstream "has synced" channel +// and notifies a SingleFileTracker instance. That instance then +// combines the upstream state and the processListener state to +// implement the overall "event handler has synced". +// // processorListener also keeps track of the adjusted requested resync // period of the listener. type processorListener struct { logger klog.Logger nextCh chan interface{} addCh chan interface{} + done chan struct{} - handler ResourceEventHandler + handler ResourceEventHandler + handlerName string - syncTracker *synctrack.SingleFileTracker + syncTracker *synctrack.SingleFileTracker + upstreamHasSynced DoneChecker // pendingNotifications is an unbounded ring buffer that holds all notifications not yet distributed. // There is one per listener, but a failing/stalled listener will have infinite pendingNotifications @@ -965,6 +1226,9 @@ type processorListener struct { // TODO: This is no worse than before, since reflectors were backed by unbounded DeltaFIFOs, but // we should try to do something better. pendingNotifications buffer.RingGrowing + // pendingNotificationsLength tracks pendingNotifications size and is only mutated by pop(). + // run() reads this to decide when to enable expensive time tracing. + pendingNotificationsLength atomic.Int64 // requestedResyncPeriod is how frequently the listener wants a // full resync from the shared informer, but modified by two @@ -995,13 +1259,23 @@ func (p *processorListener) HasSynced() bool { return p.syncTracker.HasSynced() } -func newProcessListener(logger klog.Logger, handler ResourceEventHandler, requestedResyncPeriod, resyncPeriod time.Duration, now time.Time, bufferSize int, hasSynced func() bool) *processorListener { +// HasNamedSync is done if the source informer has synced, and all +// corresponding events have been delivered. +func (p *processorListener) HasSyncedChecker() DoneChecker { + return p.syncTracker +} + +func newProcessListener(logger klog.Logger, handler ResourceEventHandler, requestedResyncPeriod, resyncPeriod time.Duration, now time.Time, bufferSize int, hasSynced DoneChecker) *processorListener { + handlerName := nameForHandler(handler) ret := &processorListener{ logger: logger, nextCh: make(chan interface{}), addCh: make(chan interface{}), + done: make(chan struct{}), + upstreamHasSynced: hasSynced, handler: handler, - syncTracker: &synctrack.SingleFileTracker{UpstreamHasSynced: hasSynced}, + handlerName: handlerName, + syncTracker: synctrack.NewSingleFileTracker(fmt.Sprintf("%s + event handler %s", hasSynced.Name(), handlerName)), pendingNotifications: *buffer.NewRingGrowing(bufferSize), requestedResyncPeriod: requestedResyncPeriod, resyncPeriod: resyncPeriod, @@ -1022,6 +1296,7 @@ func (p *processorListener) add(notification interface{}) { func (p *processorListener) pop() { defer utilruntime.HandleCrashWithLogger(p.logger) defer close(p.nextCh) // Tell .run() to stop + defer close(p.done) // Tell .watchSynced() to stop var nextCh chan<- interface{} var notification interface{} @@ -1031,7 +1306,9 @@ func (p *processorListener) pop() { // Notification dispatched var ok bool notification, ok = p.pendingNotifications.ReadOne() - if !ok { // Nothing to pop + if ok { + p.pendingNotificationsLength.Add(-1) + } else { // Nothing to pop nextCh = nil // Disable this select case } case notificationToAdd, ok := <-p.addCh: @@ -1044,6 +1321,7 @@ func (p *processorListener) pop() { nextCh = p.nextCh } else { // There is already a notification waiting to be dispatched p.pendingNotifications.WriteOne(notificationToAdd) + p.pendingNotificationsLength.Add(1) } } } @@ -1066,6 +1344,14 @@ func (p *processorListener) run() { // Gets reset below, but only if we get that far. sleepAfterCrash = true defer utilruntime.HandleCrashWithLogger(p.logger) + pendingNotifications := p.pendingNotificationsLength.Load() + if pendingNotifications > initialBufferSize { + trace := utiltrace.New("processorListener handler", + utiltrace.Field{Key: "handler", Value: p.handlerName}, + utiltrace.Field{Key: "pendingNotifications", Value: pendingNotifications}, + ) + defer trace.LogIfLong(100 * time.Millisecond) + } switch notification := next.(type) { case updateNotification: @@ -1085,6 +1371,16 @@ func (p *processorListener) run() { } } +func (p *processorListener) watchSynced() { + select { + case <-p.upstreamHasSynced.Done(): + // Notify tracker that the upstream has synced. + p.syncTracker.UpstreamHasSynced() + case <-p.done: + // Give up waiting for sync. + } +} + // shouldResync determines if the listener needs a resync. If the listener's resyncPeriod is 0, // this always returns false. func (p *processorListener) shouldResync(now time.Time) bool { diff --git a/vendor/k8s.io/client-go/tools/cache/store.go b/vendor/k8s.io/client-go/tools/cache/store.go index a412fd7014..261ed60d9c 100644 --- a/vendor/k8s.io/client-go/tools/cache/store.go +++ b/vendor/k8s.io/client-go/tools/cache/store.go @@ -55,6 +55,15 @@ type Store interface { // ListKeys returns a list of all the keys currently associated with non-empty accumulators ListKeys() []string + // LastStoreSyncResourceVersion returns the latest resource version that the store has seen. + // This is used to determine the latest resource version the store has seen from objects + // observed being written to the store. + LastStoreSyncResourceVersion() string + + // Bookmark observes a new resource version passed into it and + // will be used to get the latest resource version of the store. + Bookmark(rv string) + // Get returns the accumulator associated with the given object's key Get(obj interface{}) (item interface{}, exists bool, err error) @@ -200,6 +209,10 @@ type cache struct { keyFunc KeyFunc // Called with every object put in the cache. transformer TransformFunc + // identifier is used to identify the store for metrics. + identifier InformerNameAndResource + // metrics is the metrics provider for the store. + metrics InformerMetricsProvider } var _ Store = &cache{} @@ -276,7 +289,7 @@ func (c *cache) Delete(obj interface{}) error { if err != nil { return KeyError{obj, err} } - c.cacheStorage.Delete(key) + c.cacheStorage.DeleteWithObject(key, obj) return nil } @@ -292,6 +305,14 @@ func (c *cache) ListKeys() []string { return c.cacheStorage.ListKeys() } +func (c *cache) LastStoreSyncResourceVersion() string { + return c.cacheStorage.LastStoreSyncResourceVersion() +} + +func (c *cache) Bookmark(rv string) { + c.cacheStorage.Bookmark(rv) +} + // GetIndexers returns the indexers of cache func (c *cache) GetIndexers() Indexers { return c.cacheStorage.GetIndexers() @@ -378,22 +399,41 @@ func WithTransformer(transformer TransformFunc) StoreOption { } } +func WithStoreMetrics(identifier InformerNameAndResource, metrics InformerMetricsProvider) StoreOption { + return func(c *cache) { + c.identifier = identifier + c.metrics = metrics + } +} + // NewStore returns a Store implemented simply with a map and a lock. func NewStore(keyFunc KeyFunc, opts ...StoreOption) Store { c := &cache{ - cacheStorage: NewThreadSafeStore(Indexers{}, Indices{}), - keyFunc: keyFunc, + keyFunc: keyFunc, } for _, opt := range opts { opt(c) } + threadSafeOpts := []ThreadSafeStoreOption{} + if c.metrics != nil { + threadSafeOpts = append(threadSafeOpts, WithThreadSafeStoreMetrics(c.identifier, c.metrics)) + } + c.cacheStorage = NewThreadSafeStore(Indexers{}, Indices{}, threadSafeOpts...) return c } // NewIndexer returns an Indexer implemented simply with a map and a lock. -func NewIndexer(keyFunc KeyFunc, indexers Indexers) Indexer { - return &cache{ - cacheStorage: NewThreadSafeStore(indexers, Indices{}), - keyFunc: keyFunc, +func NewIndexer(keyFunc KeyFunc, indexers Indexers, opts ...StoreOption) Indexer { + c := &cache{ + keyFunc: keyFunc, + } + for _, opt := range opts { + opt(c) } + threadSafeOpts := []ThreadSafeStoreOption{} + if c.metrics != nil { + threadSafeOpts = append(threadSafeOpts, WithThreadSafeStoreMetrics(c.identifier, c.metrics)) + } + c.cacheStorage = NewThreadSafeStore(indexers, Indices{}, threadSafeOpts...) + return c } diff --git a/vendor/k8s.io/client-go/tools/cache/synctrack/synctrack.go b/vendor/k8s.io/client-go/tools/cache/synctrack/synctrack.go index 3fa2beb6b7..e941dafb85 100644 --- a/vendor/k8s.io/client-go/tools/cache/synctrack/synctrack.go +++ b/vendor/k8s.io/client-go/tools/cache/synctrack/synctrack.go @@ -20,6 +20,7 @@ limitations under the License. package synctrack import ( + "context" "sync" "sync/atomic" @@ -27,11 +28,32 @@ import ( ) // AsyncTracker helps propagate HasSynced in the face of multiple worker threads. +// The user has to monitor the upstream "has synced" +// and notify the tracker when that changes from false to true. type AsyncTracker[T comparable] struct { - UpstreamHasSynced func() bool + // name describes the instance. + name string + + // upstreamHasSynced is changed from false (initial value) to true + // when UpstreamHasSynced is called. + upstreamHasSynced atomic.Bool lock sync.Mutex waiting sets.Set[T] + + // synced gets canceled once both the tracker and upstream are synced. + // A context is convenient for this because it gives us a channel + // and handles thread-safety. + synced context.Context + cancel func() +} + +func NewAsyncTracker[T comparable](name string) *AsyncTracker[T] { + t := &AsyncTracker[T]{ + name: name, + } + t.synced, t.cancel = context.WithCancel(context.Background()) + return t } // Start should be called prior to processing each key which is part of the @@ -57,6 +79,28 @@ func (t *AsyncTracker[T]) Finished(key T) { if t.waiting != nil { t.waiting.Delete(key) } + + // Maybe synced now? + if t.upstreamHasSynced.Load() && len(t.waiting) == 0 { + // Mark as synced. + t.cancel() + } +} + +// UpstreamHasSynced needs to be called at least once as soon as +// the upstream "has synced" becomes true. It tells AsyncTracker +// that the source is synced. +// +// Must be called after handing over the initial list to Start. +func (t *AsyncTracker[T]) UpstreamHasSynced() { + // Upstream is done, but we might not be yet. + t.upstreamHasSynced.Store(true) + t.lock.Lock() + defer t.lock.Unlock() + if len(t.waiting) == 0 { + // Mark as synced. + t.cancel() + } } // HasSynced returns true if the source is synced and every key present in the @@ -64,27 +108,51 @@ func (t *AsyncTracker[T]) Finished(key T) { // itself synced until *after* it has delivered the notification for the last // key, and that notification handler must have called Start. func (t *AsyncTracker[T]) HasSynced() bool { - // Call UpstreamHasSynced first: it might take a lock, which might take - // a significant amount of time, and we can't hold our lock while - // waiting on that or a user is likely to get a deadlock. - if !t.UpstreamHasSynced() { - return false - } - t.lock.Lock() - defer t.lock.Unlock() - return t.waiting.Len() == 0 + return t.synced.Err() != nil +} + +// Done returns a channel that is closed if the source is synced and every key present in the +// initial list has been processed. This relies on the source not considering +// itself synced until *after* it has delivered the notification for the last +// key, and that notification handler must have called Start. +func (t *AsyncTracker[T]) Done() <-chan struct{} { + return t.synced.Done() +} + +func (t *AsyncTracker[T]) Name() string { + return t.name } // SingleFileTracker helps propagate HasSynced when events are processed in -// order (i.e. via a queue). +// order (i.e. via a queue). The user has to monitor the upstream "has synced" +// and notify the tracker when that changes from false to true. type SingleFileTracker struct { + // name describes the instance. + name string + // Important: count is used with atomic operations so it must be 64-bit // aligned, otherwise atomic operations will panic. Having it at the top of // the struct will guarantee that, even on 32-bit arches. // See https://pkg.go.dev/sync/atomic#pkg-note-BUG for more information. count int64 - UpstreamHasSynced func() bool + // upstreamHasSynced is changed from false (initial value) to true + // when UpstreamHasSynced is called. + upstreamHasSynced atomic.Bool + + // synced gets canceled once both the tracker and upstream are synced. + // A context is convenient for this because it gives us a channel + // and handles thread-safety. + synced context.Context + cancel func() +} + +func NewSingleFileTracker(name string) *SingleFileTracker { + t := &SingleFileTracker{ + name: name, + } + t.synced, t.cancel = context.WithCancel(context.Background()) + return t } // Start should be called prior to processing each key which is part of the @@ -103,6 +171,26 @@ func (t *SingleFileTracker) Finished() { if result < 0 { panic("synctrack: negative counter; this logic error means HasSynced may return incorrect value") } + + // Maybe synced now? + if result == 0 && t.upstreamHasSynced.Load() { + // Mark as synced. + t.cancel() + } +} + +// UpstreamHasSynced needs to be called at least once as soon as +// the upstream "has synced" becomes true. It tells SingleFileTracker +// that the source is synced. +// +// Must be called after handing over the initial list to Start. +func (t *SingleFileTracker) UpstreamHasSynced() { + // Upstream is done, but we might not be yet. + t.upstreamHasSynced.Store(true) + if atomic.LoadInt64(&t.count) == 0 { + // Mark as synced. + t.cancel() + } } // HasSynced returns true if the source is synced and every key present in the @@ -110,11 +198,17 @@ func (t *SingleFileTracker) Finished() { // itself synced until *after* it has delivered the notification for the last // key, and that notification handler must have called Start. func (t *SingleFileTracker) HasSynced() bool { - // Call UpstreamHasSynced first: it might take a lock, which might take - // a significant amount of time, and we don't want to then act on a - // stale count value. - if !t.UpstreamHasSynced() { - return false - } - return atomic.LoadInt64(&t.count) <= 0 + return t.synced.Err() != nil +} + +// Done returns a channel that is closed if the source is synced and every key present in the +// initial list has been processed. This relies on the source not considering +// itself synced until *after* it has delivered the notification for the last +// key, and that notification handler must have called Start. +func (t *SingleFileTracker) Done() <-chan struct{} { + return t.synced.Done() +} + +func (t *SingleFileTracker) Name() string { + return t.name } diff --git a/vendor/k8s.io/client-go/tools/cache/the_real_fifo.go b/vendor/k8s.io/client-go/tools/cache/the_real_fifo.go index 933e41bbdc..f29c66653c 100644 --- a/vendor/k8s.io/client-go/tools/cache/the_real_fifo.go +++ b/vendor/k8s.io/client-go/tools/cache/the_real_fifo.go @@ -23,11 +23,20 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/klog/v2" utiltrace "k8s.io/utils/trace" ) // RealFIFOOptions is the configuration parameters for RealFIFO. type RealFIFOOptions struct { + // If set, log output will go to this logger instead of klog.Background(). + // The name of the fifo gets added automatically. + Logger *klog.Logger + + // Name can be used to override the default "RealFIFO" name for the new instance. + // Optional. Used only if Identifier.Name returns an empty string. + Name string + // KeyFunction is used to figure out what key an object should have. (It's // exposed in the returned RealFIFO's keyOf() method, with additional // handling around deleted objects and queue state). @@ -37,12 +46,37 @@ type RealFIFOOptions struct { // KnownObjects is expected to return a list of keys that the consumer of // this queue "knows about". It is used to decide which items are missing // when Replace() is called; 'Deleted' deltas are produced for the missing items. - // KnownObjects is required. + // KnownObjects is required if AtomicEvents is false since it is used to + // query the state of the internal store for Replace and Resync handling. KnownObjects KeyListerGetter // If set, will be called for objects before enqueueing them. Please // see the comment on TransformFunc for details. Transformer TransformFunc + + // AtomicEvents is used to specify whether the RealFIFO will emit events + // atomically or not. If it is set, a single event will be emitted + // atomically for Replace and Resync operations. + // If AtomicEvents is true, KnownObjects must be nil. + AtomicEvents bool + + // UnlockWhileProcessing is used to specify whether the RealFIFO can unlock + // the lock while processing events. If it is set, the lock can be unlocked + // while processing events to allow other goroutines to add items to the queue. + // If UnlockWhileProcessing is true, AtomicEvents must be true as well. + UnlockWhileProcessing bool + + // Identifier is used to identify this FIFO for metrics and logging purposes. + // Optional. If zero value, metrics will not be published and trace logs will not + // include Name or Resource fields. + Identifier InformerNameAndResource + + // MetricsProvider is used to create metrics for the FIFO. + MetricsProvider InformerMetricsProvider + + // EmitDeltaTypeBookmark is used to specify whether the RealFIFO will emit + // bookmark deltas or not. This can only be set if AtomicEvents is true. + EmitDeltaTypeBookmark bool } const ( @@ -57,11 +91,23 @@ var _ QueueWithBatch = &RealFIFO{} // 1. delivers notifications for items that have been deleted // 2. delivers multiple notifications per item instead of simply the most recent value type RealFIFO struct { + // logger is a per-instance logger. This gets chosen when constructing + // the instance, with klog.Background() as default. + logger klog.Logger + + // name is the name of the fifo. It is included in the logger. + name string + lock sync.RWMutex cond sync.Cond items []Delta + // synced is initially an open channel. It gets closed (once!) by checkSynced_locked + // as soon as the initial sync is considered complete. + synced chan struct{} + syncedClosed bool + // populated is true if the first batch of items inserted by Replace() has been populated // or Delete/Add/Update was called first. populated bool @@ -73,7 +119,8 @@ type RealFIFO struct { keyFunc KeyFunc // knownObjects list keys that are "known" --- affecting Delete(), - // Replace(), and Resync() + // Replace(), and Resync(). + // It is nil if emitAtomicEvents is true. knownObjects KeyListerGetter // Indication the queue is closed. @@ -86,11 +133,55 @@ type RealFIFO struct { // batchSize determines the maximum number of objects we can combine into a batch. batchSize int + + // emitAtomicEvents defines whether events like Replace and Resync should be emitted + // atomically rather than as a series of events. This means that any call to the FIFO + // will emit a single event. + // If it is set: + // * a single ReplacedAll event will be emitted instead of multiple Replace events + // * a single SyncAll event will be emitted instead of multiple Sync events + emitAtomicEvents bool + + // unlockWhileProcessing defines whether we can unlock while processing events. + // This may only be set if emitAtomicEvents is true. If unlockWhileProcessing is true, + // Pop and PopBatch must be called from a single threaded consumer. + unlockWhileProcessing bool + + // identifier is used to identify this FIFO for metrics and logging purposes. + identifier InformerNameAndResource + + // metrics holds all metrics for this FIFO. + metrics *fifoMetrics + + // emitDeltaTypeBookmark defines whether bookmark deltas should be emitted. + // This may only be set if emitAtomicEvents is true, which avoids events + // propagating out of RV order during Replace and Resync. + emitDeltaTypeBookmark bool } +// ReplacedAllInfo is the object associated with a Delta of type=ReplacedAll +type ReplacedAllInfo struct { + // ResourceVersion is the resource version passed to the Replace() call that created this Delta + ResourceVersion string + // Objects are the list of objects passed to the Replace() call that created this Delta, + // with any configured transformation already applied. + Objects []interface{} +} + +// BookmarkInfo is the object associated with a Delta of type=Bookmark +type BookmarkInfo struct { + // ResourceVersion is the resource version passed to the Bookmark() call that created this Delta + ResourceVersion string +} + +// SyncAllInfo is the object associated with a Delta of type=SyncAll +// It is used to trigger a resync of the entire queue. +type SyncAllInfo struct{} + var ( _ = Queue(&RealFIFO{}) // RealFIFO is a Queue _ = TransformingStore(&RealFIFO{}) // RealFIFO implements TransformingStore to allow memory optimizations + _ = DoneChecker(&RealFIFO{}) // RealFIFO and implements DoneChecker. ) // Close the queue. @@ -127,11 +218,37 @@ func (f *RealFIFO) HasSynced() bool { return f.hasSynced_locked() } -// ignoring lint to reduce delta to the original for review. It's ok adjust later. -// -//lint:file-ignore ST1003: should not use underscores in Go names +// HasSyncedChecker is done if an Add/Update/Delete/AddIfNotPresent are called first, +// or the first batch of items inserted by Replace() has been popped. +func (f *RealFIFO) HasSyncedChecker() DoneChecker { + return f +} + +// Name implements [DoneChecker.Name] +func (f *RealFIFO) Name() string { + return f.name +} + +// Done implements [DoneChecker.Done] +func (f *RealFIFO) Done() <-chan struct{} { + return f.synced +} + +// hasSynced_locked returns the result of a prior checkSynced_locked call. func (f *RealFIFO) hasSynced_locked() bool { - return f.populated && f.initialPopulationCount == 0 + return f.syncedClosed +} + +// checkSynced_locked checks whether the initial batch of items (set via Replace) has been delivered +// and closes the synced channel as needed. It must be called after changing f.populated and/or +// f.initialPopulationCount while the mutex is still locked. +func (f *RealFIFO) checkSynced_locked() { + synced := f.populated && f.initialPopulationCount == 0 + if synced && !f.syncedClosed { + // Initial sync is complete. + f.syncedClosed = true + close(f.synced) + } } // addToItems_locked appends to the delta list. @@ -169,6 +286,48 @@ func (f *RealFIFO) addToItems_locked(deltaActionType DeltaType, skipTransform bo Object: obj, }) f.cond.Broadcast() + f.metrics.numberOfQueuedItem.Set(float64(len(f.items))) + + return nil +} + +// addReplaceToItemsLocked appends to the delta list. +func (f *RealFIFO) addReplaceToItemsLocked(objs []interface{}, resourceVersion string) error { + // Replaced items must be transformed before being added to the queue. These objects must + // all be objects that have not been transformed yet. + if f.transformer != nil { + transformedObjs := make([]interface{}, len(objs)) + for i, obj := range objs { + transformedObj, err := f.transformer(obj) + if err != nil { + return err + } + transformedObjs[i] = transformedObj + } + objs = transformedObjs + } + + info := ReplacedAllInfo{ + ResourceVersion: resourceVersion, + Objects: objs, + } + f.items = append(f.items, Delta{ + Type: ReplacedAll, + Object: info, + }) + f.cond.Broadcast() + f.metrics.numberOfQueuedItem.Set(float64(len(f.items))) + + return nil +} + +func (f *RealFIFO) addResyncToItemsLocked() error { + f.items = append(f.items, Delta{ + Type: SyncAll, + Object: SyncAllInfo{}, + }) + f.cond.Broadcast() + f.metrics.numberOfQueuedItem.Set(float64(len(f.items))) return nil } @@ -180,6 +339,7 @@ func (f *RealFIFO) Add(obj interface{}) error { defer f.lock.Unlock() f.populated = true + f.checkSynced_locked() retErr := f.addToItems_locked(Added, false, obj) return retErr @@ -191,6 +351,7 @@ func (f *RealFIFO) Update(obj interface{}) error { defer f.lock.Unlock() f.populated = true + f.checkSynced_locked() retErr := f.addToItems_locked(Updated, false, obj) return retErr @@ -204,6 +365,7 @@ func (f *RealFIFO) Delete(obj interface{}) error { defer f.lock.Unlock() f.populated = true + f.checkSynced_locked() retErr := f.addToItems_locked(Deleted, false, obj) return retErr @@ -217,10 +379,14 @@ func (f *RealFIFO) IsClosed() bool { } // Pop waits until an item is ready and processes it. If multiple items are -// ready, they are returned in the order in which they were added/updated. -// The item is removed from the queue (and the store) before it is processed. -// process function is called under lock, so it is safe -// update data structures in it that need to be in sync with the queue. +// ready, they are returned in the order in which they were added/updated. The +// item is removed from the queue (and the store) before it is processed. The +// process function is only guaranteed to be called under lock if +// UnlockWhileProcessing is false. If the process function is updating data +// structures that need to be in sync with the queue, ensure +// UnlockWhileProcessing is false. It is expected that the caller of Pop will be +// a single threaded consumer since otherwise it is possible for multiple +// PopProcessFuncs to be running simultaneously. func (f *RealFIFO) Pop(process PopProcessFunc) (interface{}, error) { f.lock.Lock() defer f.lock.Unlock() @@ -241,9 +407,15 @@ func (f *RealFIFO) Pop(process PopProcessFunc) (interface{}, error) { // The underlying array still exists and references this object, so the object will not be garbage collected unless we zero the reference. f.items[0] = Delta{} f.items = f.items[1:] - if f.initialPopulationCount > 0 { - f.initialPopulationCount-- - } + // Decrement initialPopulationCount if needed. + // This is done in a defer so we only do this *after* processing is complete, + // so concurrent calls to hasSynced will not incorrectly return true while processing is still happening. + defer func() { + if f.initialPopulationCount > 0 { + f.initialPopulationCount-- + f.checkSynced_locked() + } + }() // Only log traces if the queue depth is greater than 10 and it takes more than // 100 milliseconds to process one item from the queue. @@ -252,19 +424,66 @@ func (f *RealFIFO) Pop(process PopProcessFunc) (interface{}, error) { // https://github.com/kubernetes/kubernetes/issues/103789 if len(f.items) > 10 { id, _ := f.keyOf(item) - trace := utiltrace.New("RealFIFO Pop Process", - utiltrace.Field{Key: "ID", Value: id}, - utiltrace.Field{Key: "Depth", Value: len(f.items)}, - utiltrace.Field{Key: "Reason", Value: "slow event handlers blocking the queue"}) + fields := []utiltrace.Field{ + {Key: "ID", Value: id}, + {Key: "Depth", Value: len(f.items)}, + {Key: "Reason", Value: "slow event handlers blocking the queue"}, + } + if name := f.identifier.Name(); len(name) > 0 { + fields = append(fields, utiltrace.Field{Key: "Name", Value: name}) + } + if gvr := f.identifier.GroupVersionResource(); !gvr.Empty() { + fields = append(fields, utiltrace.Field{Key: "Resource", Value: gvr}) + } + trace := utiltrace.New("RealFIFO Pop Process", fields...) defer trace.LogIfLong(100 * time.Millisecond) } + f.metrics.numberOfQueuedItem.Set(float64(len(f.items))) - // we wrap in Deltas here to be compatible with preview Pop functions and those interpreting the return value. - err := process(Deltas{item}, isInInitialList) + // Process the item, this may unlock the lock, and allow other goroutines to add items to the queue. + err := f.whileProcessing_locked(func() error { + // we wrap in Deltas here to be compatible with preview Pop functions and those interpreting the return value. + return process(Deltas{item}, isInInitialList) + }) return Deltas{item}, err } -func (f *RealFIFO) PopBatch(process ProcessBatchFunc) error { +// whileProcessing_locked calls the `process` function and records processing latency. +// The lock must be held before calling `whileProcessing_locked`, and is held when `whileProcessing_locked` returns. +// whileProcessing_locked releases the lock during the call to `process` if f.unlockWhileProcessing is true and the f.items queue is not too long. +func (f *RealFIFO) whileProcessing_locked(process func() error) error { + // Unlock before calling `process` so new items can be enqueued during processing. + // Only do this if the queue contains less than 2 full batches of items, + // to prevent the queue from growing unboundedly. + if f.unlockWhileProcessing && len(f.items) < f.batchSize*2 { + f.lock.Unlock() + defer f.lock.Lock() + } + startTime := time.Now() + err := process() + f.metrics.processingLatency.Observe(time.Since(startTime).Seconds()) + return err +} + +// batchable stores the delta types that can be batched +var batchable = map[DeltaType]bool{ + Sync: true, + Replaced: true, + Added: true, + Updated: true, + Deleted: true, +} + +// PopBatch pops as many items as possible to be processed as a batch using processBatch, +// or pop a single item using processSingle if multiple items cannot be batched. +// +// The processBatch and processSingle functions are only guaranteed to be called +// under lock if UnlockWhileProcessing is false. If the process functions are +// updating data structures that need to be in sync with the queue, ensure +// UnlockWhileProcessing is false. It is expected that the caller of PopBatch +// will be a single threaded consumer, since otherwise it is possible for +// multiple ProcessBatchFunc or PopProcessFunc's to be running simultaneously. +func (f *RealFIFO) PopBatch(processBatch ProcessBatchFunc, processSingle PopProcessFunc) error { f.lock.Lock() defer f.lock.Unlock() @@ -282,12 +501,25 @@ func (f *RealFIFO) PopBatch(process ProcessBatchFunc) error { isInInitialList := !f.hasSynced_locked() unique := sets.NewString() deltas := make([]Delta, 0, min(len(f.items), f.batchSize)) + moveDeltaToProcessList := func(i int) { + deltas = append(deltas, f.items[i]) + // The underlying array still exists and references this object, so the object will not be garbage collected unless we zero the reference. + f.items[i] = Delta{} + } // only bundle unique items into a batch for i := 0; i < f.batchSize && i < len(f.items); i++ { if f.initialPopulationCount > 0 && i >= f.initialPopulationCount { break } item := f.items[i] + if !batchable[item.Type] { + if len(deltas) == 0 { + // if an unbatchable delta is first in the list, process just that one by itself + moveDeltaToProcessList(i) + } + // close the batch when an unbatchable delta is encountered + break + } id, err := f.keyOf(item) if err != nil { // close the batch here if error happens @@ -295,23 +527,26 @@ func (f *RealFIFO) PopBatch(process ProcessBatchFunc) error { // still pop the broken item out of queue to be compatible with the non-batch behavior it should be safe // when 1st element is broken, however for Nth broken element, there's possible risk that broken item // still can be processed and broke the uniqueness of the batch unexpectedly. - deltas = append(deltas, item) - // The underlying array still exists and references this object, so the object will not be garbage collected unless we zero the reference. - f.items[i] = Delta{} + moveDeltaToProcessList(i) break } if unique.Has(id) { + // close the batch if a duplicate item is encountered break } unique.Insert(id) - deltas = append(deltas, item) - // The underlying array still exists and references this object, so the object will not be garbage collected unless we zero the reference. - f.items[i] = Delta{} - } - if f.initialPopulationCount > 0 { - f.initialPopulationCount -= len(deltas) + moveDeltaToProcessList(i) } f.items = f.items[len(deltas):] + // Decrement initialPopulationCount if needed. + // This is done in a defer so we only do this *after* processing is complete, + // so concurrent calls to hasSynced will not incorrectly return true while processing is still happening. + defer func() { + if f.initialPopulationCount > 0 { + f.initialPopulationCount -= len(deltas) + f.checkSynced_locked() + } + }() // Only log traces if the queue depth is greater than 10 and it takes more than // 100 milliseconds to process one item from the queue (with a max of 1 second for the whole batch) @@ -320,16 +555,46 @@ func (f *RealFIFO) PopBatch(process ProcessBatchFunc) error { // https://github.com/kubernetes/kubernetes/issues/103789 if len(f.items) > 10 { id, _ := f.keyOf(deltas[0]) - trace := utiltrace.New("RealFIFO PopBatch Process", - utiltrace.Field{Key: "ID", Value: id}, - utiltrace.Field{Key: "Depth", Value: len(f.items)}, - utiltrace.Field{Key: "Reason", Value: "slow event handlers blocking the queue"}, - utiltrace.Field{Key: "BatchSize", Value: len(deltas)}) + fields := []utiltrace.Field{ + {Key: "ID", Value: id}, + {Key: "Depth", Value: len(f.items)}, + {Key: "Reason", Value: "slow event handlers blocking the queue"}, + {Key: "BatchSize", Value: len(deltas)}, + } + if name := f.identifier.Name(); len(name) > 0 { + fields = append(fields, utiltrace.Field{Key: "Name", Value: name}) + } + if gvr := f.identifier.GroupVersionResource(); !gvr.Empty() { + fields = append(fields, utiltrace.Field{Key: "Resource", Value: gvr}) + } + trace := utiltrace.New("RealFIFO PopBatch Process", fields...) defer trace.LogIfLong(min(100*time.Millisecond*time.Duration(len(deltas)), time.Second)) } + f.metrics.numberOfQueuedItem.Set(float64(len(f.items))) - err := process(deltas, isInInitialList) - return err + if len(deltas) == 1 { + return f.whileProcessing_locked(func() error { + return processSingle(Deltas{deltas[0]}, isInInitialList) + }) + } + return f.whileProcessing_locked(func() error { + return processBatch(deltas, isInInitialList) + }) +} + +func (f *RealFIFO) Bookmark(resourceVersion string) error { + if !f.emitDeltaTypeBookmark { + return nil + } + f.lock.Lock() + defer f.lock.Unlock() + + f.items = append(f.items, Delta{ + Type: Bookmark, + Object: BookmarkInfo{ResourceVersion: resourceVersion}, + }) + f.cond.Broadcast() + return nil } // Replace @@ -340,22 +605,58 @@ func (f *RealFIFO) Replace(newItems []interface{}, resourceVersion string) error f.lock.Lock() defer f.lock.Unlock() + var err error + if f.emitAtomicEvents { + err = f.addReplaceToItemsLocked(newItems, resourceVersion) + } else { + err = reconcileReplacement(f.logger, f.items, f.knownObjects, newItems, f.keyOf, + func(obj DeletedFinalStateUnknown) error { + return f.addToItems_locked(Deleted, true, obj) + }, + func(obj interface{}) error { + return f.addToItems_locked(Replaced, false, obj) + }) + } + if err != nil { + return err + } + + if !f.populated { + f.populated = true + f.initialPopulationCount = len(f.items) + f.checkSynced_locked() + } + + return nil +} + +// reconcileReplacement takes the items that are already in the queue and the set of new items +// and based upon the state of the items in the queue and known objects will call onDelete and onReplace +// depending upon whether the item is being deleted or replaced/added. +func reconcileReplacement( + logger klog.Logger, + queuedItems []Delta, + knownObjects KeyListerGetter, + newItems []interface{}, + keyOf func(obj interface{}) (string, error), + onDelete func(obj DeletedFinalStateUnknown) error, + onReplace func(obj interface{}) error, +) error { // determine the keys of everything we're adding. We cannot add the items until after the synthetic deletes have been // created for items that don't existing in newItems newKeys := sets.Set[string]{} for _, obj := range newItems { - key, err := f.keyOf(obj) + key, err := keyOf(obj) if err != nil { return KeyError{obj, err} } newKeys.Insert(key) } - queuedItems := f.items queuedKeys := []string{} lastQueuedItemForKey := map[string]Delta{} for _, queuedItem := range queuedItems { - queuedKey, err := f.keyOf(queuedItem.Object) + queuedKey, err := keyOf(queuedItem.Object) if err != nil { return KeyError{queuedItem.Object, err} } @@ -387,7 +688,7 @@ func (f *RealFIFO) Replace(newItems []interface{}, resourceVersion string) error // if we got here, then the last entry we have for the queued item is *not* a deletion and we need to add a delete deletedObj := lastQueuedItem.Object - retErr := f.addToItems_locked(Deleted, true, DeletedFinalStateUnknown{ + retErr := onDelete(DeletedFinalStateUnknown{ Key: queuedKey, Obj: deletedObj, }) @@ -397,7 +698,7 @@ func (f *RealFIFO) Replace(newItems []interface{}, resourceVersion string) error } // Detect deletions for objects not present in the queue, but present in KnownObjects - knownKeys := f.knownObjects.ListKeys() + knownKeys := knownObjects.ListKeys() for _, knownKey := range knownKeys { if newKeys.Has(knownKey) { // still present continue @@ -406,15 +707,15 @@ func (f *RealFIFO) Replace(newItems []interface{}, resourceVersion string) error continue } - deletedObj, exists, err := f.knownObjects.GetByKey(knownKey) + deletedObj, exists, err := knownObjects.GetByKey(knownKey) if err != nil { deletedObj = nil - utilruntime.HandleError(fmt.Errorf("error during lookup, placing DeleteFinalStateUnknown marker without object: key=%q, err=%w", knownKey, err)) + utilruntime.HandleErrorWithLogger(logger, err, "Error during lookup, placing DeleteFinalStateUnknown marker without object", "key", knownKey) } else if !exists { deletedObj = nil - utilruntime.HandleError(fmt.Errorf("key does not exist in known objects store, placing DeleteFinalStateUnknown marker without object: key=%q", knownKey)) + utilruntime.HandleErrorWithLogger(logger, nil, "Key does not exist in known objects store, placing DeleteFinalStateUnknown marker without object", "key", knownKey) } - retErr := f.addToItems_locked(Deleted, false, DeletedFinalStateUnknown{ + retErr := onDelete(DeletedFinalStateUnknown{ Key: knownKey, Obj: deletedObj, }) @@ -425,17 +726,11 @@ func (f *RealFIFO) Replace(newItems []interface{}, resourceVersion string) error // now that we have the deletes we need for items, we can add the newItems to the items queue for _, obj := range newItems { - retErr := f.addToItems_locked(Replaced, false, obj) - if retErr != nil { - return fmt.Errorf("couldn't enqueue object: %w", retErr) + if err := onReplace(obj); err != nil { + return fmt.Errorf("couldn't enqueue object: %w", err) } } - if !f.populated { - f.populated = true - f.initialPopulationCount = len(f.items) - } - return nil } @@ -446,6 +741,10 @@ func (f *RealFIFO) Resync() error { f.lock.Lock() defer f.lock.Unlock() + if f.emitAtomicEvents { + return f.addResyncToItemsLocked() + } + if f.knownObjects == nil { return nil } @@ -471,10 +770,10 @@ func (f *RealFIFO) Resync() error { knownObj, exists, err := f.knownObjects.GetByKey(knownKey) if err != nil { - utilruntime.HandleError(fmt.Errorf("unable to queue object for sync: key=%q, err=%w", knownKey, err)) + utilruntime.HandleErrorWithLogger(f.logger, err, "Unable to queue object for sync", "key", knownKey) continue } else if !exists { - utilruntime.HandleError(fmt.Errorf("key does not exist in known objects store, unable to queue object for sync: key=%q", knownKey)) + utilruntime.HandleErrorWithLogger(f.logger, nil, "Key does not exist in known objects store, unable to queue object for sync", "key", knownKey) continue } @@ -494,6 +793,8 @@ func (f *RealFIFO) Transformer() TransformFunc { // NewRealFIFO returns a Store which can be used to queue up items to // process. +// +// Deprecated: Use NewRealFIFOWithOptions instead. func NewRealFIFO(keyFunc KeyFunc, knownObjects KeyListerGetter, transformer TransformFunc) *RealFIFO { return NewRealFIFOWithOptions(RealFIFOOptions{ KeyFunction: keyFunc, @@ -509,18 +810,50 @@ func NewRealFIFOWithOptions(opts RealFIFOOptions) *RealFIFO { opts.KeyFunction = MetaNamespaceKeyFunc } - if opts.KnownObjects == nil { - panic("coding error: knownObjects must be provided") + if opts.AtomicEvents { + // If we are emitting atomic events, we must not rely on the known objects store + // as it is a requirement to be able to release the lock while processing events. + if opts.KnownObjects != nil { + panic("coding error: knownObjects must not be provided when AtomicEvents is true") + } + } else { + if opts.UnlockWhileProcessing { + panic("coding error: UnlockWhileProcessing must be false when AtomicEvents is false") + } + if opts.KnownObjects == nil { + panic("coding error: knownObjects must be provided when AtomicEvents is false") + } + // If we are not emitting atomic events, we must not emit bookmark deltas. + if opts.EmitDeltaTypeBookmark { + panic("coding error: EmitDeltaTypeBookmark must be false when AtomicEvents is false") + } } f := &RealFIFO{ - items: make([]Delta, 0, 10), - keyFunc: opts.KeyFunction, - knownObjects: opts.KnownObjects, - transformer: opts.Transformer, - batchSize: defaultBatchSize, + logger: klog.Background(), + name: "RealFIFO", + items: make([]Delta, 0, 10), + synced: make(chan struct{}), + keyFunc: opts.KeyFunction, + knownObjects: opts.KnownObjects, + transformer: opts.Transformer, + batchSize: defaultBatchSize, + emitAtomicEvents: opts.AtomicEvents, + emitDeltaTypeBookmark: opts.EmitDeltaTypeBookmark, + unlockWhileProcessing: opts.UnlockWhileProcessing, + identifier: opts.Identifier, + metrics: newFIFOMetrics(opts.Identifier, opts.MetricsProvider), } - + if opts.Logger != nil { + f.logger = *opts.Logger + } + if name := opts.Name; name != "" { + f.name = name + } + if name := opts.Identifier.Name(); name != "" { + f.name = name + } + f.logger = klog.LoggerWithName(f.logger, f.name) f.cond.L = &f.lock return f } diff --git a/vendor/k8s.io/client-go/tools/cache/thread_safe_store.go b/vendor/k8s.io/client-go/tools/cache/thread_safe_store.go index ef3a599a9b..74ac8f1ab2 100644 --- a/vendor/k8s.io/client-go/tools/cache/thread_safe_store.go +++ b/vendor/k8s.io/client-go/tools/cache/thread_safe_store.go @@ -18,10 +18,13 @@ package cache import ( "fmt" + "strconv" "sync" "time" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/util/sets" + clientgofeaturegate "k8s.io/client-go/features" utiltrace "k8s.io/utils/trace" ) @@ -43,13 +46,19 @@ import ( type ThreadSafeStore interface { Add(key string, obj interface{}) Update(key string, obj interface{}) + // Delete is equivalent to calling DeleteWithObject(key, nil) however it is + // not recommended to use this function as it will not update the resource + // version of the store, possibly causing it to be out of date. Delete(key string) + DeleteWithObject(key string, obj interface{}) Get(key string) (item interface{}, exists bool) List() []interface{} ListKeys() []string Replace(map[string]interface{}, string) Index(indexName string, obj interface{}) ([]interface{}, error) IndexKeys(indexName, indexedValue string) ([]string, error) + Bookmark(rv string) + LastStoreSyncResourceVersion() string ListIndexFuncValues(name string) []string ByIndex(indexName, indexedValue string) ([]interface{}, error) GetIndexers() Indexers @@ -73,6 +82,14 @@ type ThreadSafeStoreTransaction struct { Key string } +type ThreadSafeStoreOption = func(*threadSafeMap) + +func WithThreadSafeStoreMetrics(identifier InformerNameAndResource, metricsProvider InformerMetricsProvider) ThreadSafeStoreOption { + return func(c *threadSafeMap) { + c.metrics = newStoreMetrics(identifier, metricsProvider) + } +} + // storeIndex implements the indexing functionality for Store interface type storeIndex struct { // indexers maps a name to an IndexFunc @@ -242,9 +259,20 @@ type threadSafeMap struct { // index implements the indexing functionality index *storeIndex + rv string + + // metrics is used to expose metrics about the store + // and must be non-nil. If not provided, a noop implementation will be used. + metrics *storeMetrics } func (c *threadSafeMap) Transaction(txns ...ThreadSafeStoreTransaction) { + if len(txns) == 0 { + return + } + finalObj := txns[len(txns)-1].Object + rv, rvErr := rvFromObject(finalObj) + rvInt, parseErr := parseRVForMetricsWithTruncation(rv) c.lock.Lock() defer c.lock.Unlock() trace := utiltrace.New("ThreadSafeMap Transaction Process", @@ -262,6 +290,12 @@ func (c *threadSafeMap) Transaction(txns ...ThreadSafeStoreTransaction) { c.deleteLocked(txn.Key) } } + if rvErr == nil { + c.rv = rv + if parseErr == nil { + c.metrics.storeResourceVersion.Set(float64(rvInt)) + } + } } func (c *threadSafeMap) Add(key string, obj interface{}) { @@ -273,9 +307,17 @@ func (c *threadSafeMap) addLocked(key string, obj interface{}) { } func (c *threadSafeMap) Update(key string, obj interface{}) { + rv, rvErr := rvFromObject(obj) + rvInt, parseErr := parseRVForMetricsWithTruncation(rv) c.lock.Lock() defer c.lock.Unlock() c.updateLocked(key, obj) + if rvErr == nil { + c.rv = rv + if parseErr == nil { + c.metrics.storeResourceVersion.Set(float64(rvInt)) + } + } } func (c *threadSafeMap) updateLocked(key string, obj interface{}) { @@ -285,9 +327,26 @@ func (c *threadSafeMap) updateLocked(key string, obj interface{}) { } func (c *threadSafeMap) Delete(key string) { + c.DeleteWithObject(key, nil) +} + +func (c *threadSafeMap) DeleteWithObject(key string, obj interface{}) { + var rv string + var rvInt int64 + var rvErr, parseErr error + if obj != nil { + rv, rvErr = rvFromObject(obj) + rvInt, parseErr = parseRVForMetricsWithTruncation(rv) + } c.lock.Lock() defer c.lock.Unlock() c.deleteLocked(key) + if obj != nil && rvErr == nil { + c.rv = rv + if parseErr == nil { + c.metrics.storeResourceVersion.Set(float64(rvInt)) + } + } } func (c *threadSafeMap) deleteLocked(key string) { @@ -327,10 +386,18 @@ func (c *threadSafeMap) ListKeys() []string { } func (c *threadSafeMap) Replace(items map[string]interface{}, resourceVersion string) { + var rvInt int64 + var parseErr error + if resourceVersion != "" { + rvInt, parseErr = parseRVForMetricsWithTruncation(resourceVersion) + } c.lock.Lock() defer c.lock.Unlock() c.items = items - + c.rv = resourceVersion + if parseErr == nil { + c.metrics.storeResourceVersion.Set(float64(rvInt)) + } // rebuild any index c.index.reset() for key, item := range c.items { @@ -338,6 +405,15 @@ func (c *threadSafeMap) Replace(items map[string]interface{}, resourceVersion st } } +func rvFromObject(obj interface{}) (rv string, err error) { + meta, err := meta.Accessor(obj) + if err != nil { + return "", err + } + rv = meta.GetResourceVersion() + return rv, nil +} + // Index returns a list of items that match the given object on the index function. // Index is thread-safe so long as you treat all items as immutable. func (c *threadSafeMap) Index(indexName string, obj interface{}) ([]interface{}, error) { @@ -356,6 +432,32 @@ func (c *threadSafeMap) Index(indexName string, obj interface{}) ([]interface{}, return list, nil } +// LastStoreSyncResourceVersion returns the latest resource version that the store has seen. +func (c *threadSafeMap) LastStoreSyncResourceVersion() string { + // We cannot return the resource version if the AtomicFIFO feature gate is not enabled. + if !clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.AtomicFIFO) { + return "" + } + c.lock.RLock() + defer c.lock.RUnlock() + return c.rv +} + +// Bookmark sets the latest resource version that the store has seen. +func (c *threadSafeMap) Bookmark(rv string) { + var rvInt int64 + var parseErr error + if rv != "" { + rvInt, parseErr = parseRVForMetricsWithTruncation(rv) + } + c.lock.Lock() + defer c.lock.Unlock() + c.rv = rv + if parseErr == nil { + c.metrics.storeResourceVersion.Set(float64(rvInt)) + } +} + // ByIndex returns a list of the items whose indexed values in the given index include the given indexed value func (c *threadSafeMap) ByIndex(indexName, indexedValue string) ([]interface{}, error) { c.lock.RLock() @@ -420,13 +522,31 @@ func (c *threadSafeMap) Resync() error { return nil } -// NewThreadSafeStore creates a new instance of ThreadSafeStore. -func NewThreadSafeStore(indexers Indexers, indices Indices) ThreadSafeStore { - return &threadSafeMap{ +func NewThreadSafeStore(indexers Indexers, indices Indices, opts ...ThreadSafeStoreOption) ThreadSafeStore { + store := &threadSafeMap{ items: map[string]interface{}{}, index: &storeIndex{ indexers: indexers, indices: indices, }, } + for _, opt := range opts { + opt(store) + } + if store.metrics == nil { + store.metrics = newStoreMetrics(InformerNameAndResource{}, noopInformerMetricsProvider{}) + } + return store +} + +func parseRVForMetricsWithTruncation(rv string) (int64, error) { + if rv == "" { + return 0, nil + } + // Truncate to last 15 digits to ensure metrics are always less than 2^53-1 + // and avoid imprecise float64 representation. + if len(rv) > 15 { + rv = rv[len(rv)-15:] + } + return strconv.ParseInt(rv, 10, 64) } diff --git a/vendor/k8s.io/client-go/tools/clientcmd/api/types.go b/vendor/k8s.io/client-go/tools/clientcmd/api/types.go index cb21c040a3..66d0e9230b 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/api/types.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/api/types.go @@ -298,12 +298,12 @@ type ExecConfig struct { // the logical AND of all checks corresponding to the specified fields within // the entry. type AllowlistEntry struct { - // Name matching is performed by first resolving the absolute path of both + // Command matching is performed by first resolving the absolute path of both // the plugin and the name in the allowlist entry using `exec.LookPath`. It // will be called on both, and the resulting strings must be equal. If - // either call to `exec.LookPath` results in an error, the `Name` check + // either call to `exec.LookPath` results in an error, the `Command` check // will be considered a failure. - Name string `json:"-"` + Command string `json:"-"` } // PluginPolicy describes the policy type and allowlist (if any) for client-go diff --git a/vendor/k8s.io/client-go/tools/clientcmd/client_config.go b/vendor/k8s.io/client-go/tools/clientcmd/client_config.go index ed35891e5a..efac2830bb 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/client_config.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/client_config.go @@ -679,11 +679,13 @@ func (config *inClusterClientConfig) Possible() bool { // to the default config. func BuildConfigFromFlags(masterUrl, kubeconfigPath string) (*restclient.Config, error) { if kubeconfigPath == "" && masterUrl == "" { + //nolint:logcheck // A helper function like this should not log. But this is probably part of the the established client-go API and not worth changing. klog.Warning("Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.") kubeconfig, err := restclient.InClusterConfig() if err == nil { return kubeconfig, nil } + //nolint:logcheck // A helper function like this should not log. But this is probably part of the the established client-go API and not worth changing. klog.Warning("error creating inClusterConfig, falling back to default config: ", err) } return NewNonInteractiveDeferredLoadingClientConfig( diff --git a/vendor/k8s.io/client-go/tools/clientcmd/config.go b/vendor/k8s.io/client-go/tools/clientcmd/config.go index 2cd213ccb3..828ac974dc 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/config.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/config.go @@ -492,6 +492,7 @@ func getConfigFromFile(filename string) (*clientcmdapi.Config, error) { func GetConfigFromFileOrDie(filename string) *clientcmdapi.Config { config, err := getConfigFromFile(filename) if err != nil { + //nolint:logcheck // A helper function like this should not log. But this is probably part of the the established client-go API and not worth changing. klog.FatalDepth(1, err) } diff --git a/vendor/k8s.io/client-go/tools/clientcmd/loader.go b/vendor/k8s.io/client-go/tools/clientcmd/loader.go index b127e2e08f..d1d0a82954 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/loader.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/loader.go @@ -137,6 +137,7 @@ type WarningHandler func(error) func (handler WarningHandler) Warn(err error) { if handler == nil { + //nolint:logcheck // This is the fallback when logging is not initialized. With nothing provided, using the global logger is the only option. klog.V(1).Info(err) } else { handler(err) @@ -402,6 +403,7 @@ func LoadFromFile(filename string) (*clientcmdapi.Config, error) { if err != nil { return nil, err } + //nolint:logcheck // A helper function like this should not log. But this is probably part of the the established client-go API and not worth changing. klog.V(6).Infoln("Config loaded from file: ", filename) // set LocationOfOrigin on every Cluster, User, and Context diff --git a/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder.go b/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder.go index 0fc2fd0a0c..db7bf0a82e 100644 --- a/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder.go +++ b/vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder.go @@ -118,6 +118,7 @@ func (config *DeferredLoadingClientConfig) ClientConfig() (*restclient.Config, e // check for in-cluster configuration and use it if config.icc.Possible() { + //nolint:logcheck // A helper function like this should not log. But this is probably part of the the established client-go API and not worth changing. klog.V(4).Infof("Using in-cluster configuration") return config.icc.ClientConfig() } @@ -160,6 +161,7 @@ func (config *DeferredLoadingClientConfig) Namespace() (string, bool, error) { } } + //nolint:logcheck // A helper function like this should not log. But this is probably part of the the established client-go API and not worth changing. klog.V(4).Infof("Using in-cluster namespace") // allow the namespace from the service account token directory to be used. diff --git a/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go b/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go index 29d34c4e90..00798d82ac 100644 --- a/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go +++ b/vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go @@ -199,8 +199,8 @@ type LeaderElector struct { // clock is wrapper around time to allow for less flaky testing clock clock.Clock - // used to lock the observedRecord - observedRecordLock sync.Mutex + // used to lock the observedRecord and the observedTime + observedRecordLock sync.RWMutex metrics leaderMetricsAdapter } @@ -256,7 +256,7 @@ func (le *LeaderElector) acquire(ctx context.Context) bool { desc := le.config.Lock.Describe() logger := klog.FromContext(ctx) logger.Info("Attempting to acquire leader lease...", "lock", desc) - wait.JitterUntil(func() { + wait.JitterUntilWithContext(ctx, func(ctx context.Context) { if !le.config.Coordinated { succeeded = le.tryAcquireOrRenew(ctx) } else { @@ -271,7 +271,7 @@ func (le *LeaderElector) acquire(ctx context.Context) bool { le.metrics.leaderOn(le.config.Name) logger.Info("Successfully acquired lease", "lock", desc) cancel() - }, le.config.RetryPeriod, JitterFactor, true, ctx.Done()) + }, le.config.RetryPeriod, JitterFactor, true) return succeeded } @@ -281,8 +281,13 @@ func (le *LeaderElector) renew(ctx context.Context) { ctx, cancel := context.WithCancel(ctx) defer cancel() logger := klog.FromContext(ctx) - wait.Until(func() { + wait.UntilWithContext(ctx, func(ctx context.Context) { err := wait.PollUntilContextTimeout(ctx, le.config.RetryPeriod, le.config.RenewDeadline, true, func(ctx context.Context) (done bool, err error) { + // PollUntilContextTimeout invokes condition even when the context is canceled when immediate=true. + // Short-circuit this to prevent unnecessary processing and error log messages. + if err := ctx.Err(); err != nil { + return false, err + } if !le.config.Coordinated { return le.tryAcquireOrRenew(ctx), nil } else { @@ -298,7 +303,7 @@ func (le *LeaderElector) renew(ctx context.Context) { le.metrics.leaderOff(le.config.Name) logger.Info("Failed to renew lease", "lock", desc, "err", err) cancel() - }, le.config.RetryPeriod, ctx.Done()) + }, le.config.RetryPeriod) // if we hold the lease, give it up if le.config.ReleaseOnCancel { @@ -372,7 +377,11 @@ func (le *LeaderElector) tryCoordinatedRenew(ctx context.Context) bool { le.observedRawRecord = oldLeaderElectionRawRecord } - hasExpired := le.observedTime.Add(time.Second * time.Duration(oldLeaderElectionRecord.LeaseDurationSeconds)).Before(now.Time) + le.observedRecordLock.RLock() + obsTime := le.observedTime + le.observedRecordLock.RUnlock() + + hasExpired := obsTime.Add(time.Second * time.Duration(oldLeaderElectionRecord.LeaseDurationSeconds)).Before(now.Time) if hasExpired { logger.Info("Lease has expired", "lock", le.config.Lock.Describe()) return false @@ -442,7 +451,7 @@ func (le *LeaderElector) tryAcquireOrRenew(ctx context.Context) bool { le.setObservedRecord(&leaderElectionRecord) return true } - logger.Error(err, "Failed to update lease optimistically, falling back to slow path", "lock", le.config.Lock.Describe()) + logger.V(2).Info("Failed to update lease optimistically, falling back to slow path", "lock", le.config.Lock.Describe(), "err", err) } // 2. obtain or create the ElectionRecord @@ -512,7 +521,12 @@ func (le *LeaderElector) Check(maxTolerableExpiredLease time.Duration) error { // If we are more than timeout seconds after the lease duration that is past the timeout // on the lease renew. Time to start reporting ourselves as unhealthy. We should have // died but conditions like deadlock can prevent this. (See #70819) - if le.clock.Since(le.observedTime) > le.config.LeaseDuration+maxTolerableExpiredLease { + le.observedRecordLock.RLock() + lastObservation := le.observedTime + leaseDuration := le.config.LeaseDuration + le.observedRecordLock.RUnlock() + + if le.clock.Since(lastObservation) > leaseDuration+maxTolerableExpiredLease { return fmt.Errorf("failed election to renew leadership on lease %s", le.config.Name) } @@ -520,7 +534,11 @@ func (le *LeaderElector) Check(maxTolerableExpiredLease time.Duration) error { } func (le *LeaderElector) isLeaseValid(now time.Time) bool { - return le.observedTime.Add(time.Second * time.Duration(le.getObservedRecord().LeaseDurationSeconds)).After(now) + // Lock to safely read both the time and the record + le.observedRecordLock.RLock() + defer le.observedRecordLock.RUnlock() + + return le.observedTime.Add(time.Second * time.Duration(le.observedRecord.LeaseDurationSeconds)).After(now) } // setObservedRecord will set a new observedRecord and update observedTime to the current time. @@ -536,8 +554,8 @@ func (le *LeaderElector) setObservedRecord(observedRecord *rl.LeaderElectionReco // getObservedRecord returns observersRecord. // Protect critical sections with lock. func (le *LeaderElector) getObservedRecord() rl.LeaderElectionRecord { - le.observedRecordLock.Lock() - defer le.observedRecordLock.Unlock() + le.observedRecordLock.RLock() + defer le.observedRecordLock.RUnlock() return le.observedRecord } diff --git a/vendor/k8s.io/client-go/tools/leaderelection/leasecandidate.go b/vendor/k8s.io/client-go/tools/leaderelection/leasecandidate.go index b2fa14a5f3..e2d0ef437a 100644 --- a/vendor/k8s.io/client-go/tools/leaderelection/leasecandidate.go +++ b/vendor/k8s.io/client-go/tools/leaderelection/leasecandidate.go @@ -19,6 +19,7 @@ package leaderelection import ( "context" "reflect" + "sync" "time" v1 "k8s.io/api/coordination/v1" @@ -34,6 +35,8 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog/v2" "k8s.io/utils/clock" + + coordinationv1beta1listers "k8s.io/client-go/listers/coordination/v1beta1" ) const requeueInterval = 5 * time.Minute @@ -45,6 +48,7 @@ type CacheSyncWaiter interface { type LeaseCandidate struct { leaseClient coordinationv1beta1client.LeaseCandidateInterface leaseCandidateInformer cache.SharedIndexInformer + leaseCandidateLister coordinationv1beta1listers.LeaseCandidateLister informerFactory informers.SharedInformerFactory hasSynced cache.InformerSynced @@ -80,15 +84,18 @@ func NewCandidate(clientset kubernetes.Interface, // are started for leader elected components informerFactory := informers.NewSharedInformerFactoryWithOptions( clientset, 5*time.Minute, + informers.WithNamespace(candidateNamespace), informers.WithTweakListOptions(func(options *metav1.ListOptions) { options.FieldSelector = fieldSelector }), ) leaseCandidateInformer := informerFactory.Coordination().V1beta1().LeaseCandidates().Informer() + leaseCandidateLister := informerFactory.Coordination().V1beta1().LeaseCandidates().Lister() lc := &LeaseCandidate{ leaseClient: clientset.CoordinationV1beta1().LeaseCandidates(candidateNamespace), leaseCandidateInformer: leaseCandidateInformer, + leaseCandidateLister: leaseCandidateLister, informerFactory: informerFactory, name: candidateName, namespace: candidateNamespace, @@ -118,19 +125,25 @@ func NewCandidate(clientset kubernetes.Interface, } func (c *LeaseCandidate) Run(ctx context.Context) { - defer c.queue.ShutDown() - logger := klog.FromContext(ctx) logger = klog.LoggerWithName(logger, "leasecandidate") ctx = klog.NewContext(ctx, logger) + var wg sync.WaitGroup + defer func() { + c.queue.ShutDown() + wg.Wait() + }() + c.informerFactory.Start(ctx.Done()) if !cache.WaitForNamedCacheSyncWithContext(ctx, c.hasSynced) { return } c.enqueueLease() - go c.runWorker(ctx) + wg.Go(func() { + c.runWorker(ctx) + }) <-ctx.Done() } @@ -166,7 +179,7 @@ func (c *LeaseCandidate) enqueueLease() { // a bool (true if this call created the lease), or any error that occurs. func (c *LeaseCandidate) ensureLease(ctx context.Context) error { logger := klog.FromContext(ctx) - lease, err := c.leaseClient.Get(ctx, c.name, metav1.GetOptions{}) + lease, err := c.leaseCandidateLister.LeaseCandidates(c.namespace).Get(c.name) if apierrors.IsNotFound(err) { logger.V(2).Info("Creating lease candidate") // lease does not exist, create it. diff --git a/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go b/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go index 79a748b74d..b03e3c1284 100644 --- a/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go +++ b/vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go @@ -105,7 +105,7 @@ func (ll *LeaseLock) RecordEvent(s string) { // Populate the type meta, so we don't have to get it from the schema subject.Kind = "Lease" subject.APIVersion = coordinationv1.SchemeGroupVersion.String() - ll.LockConfig.EventRecorder.Eventf(subject, corev1.EventTypeNormal, "LeaderElection", events) + ll.LockConfig.EventRecorder.Eventf(subject, corev1.EventTypeNormal, "LeaderElection", "%s", events) } // Describe is used to convert details on current resource lock diff --git a/vendor/k8s.io/client-go/tools/metrics/metrics.go b/vendor/k8s.io/client-go/tools/metrics/metrics.go index e364b7e1cf..2f626475b2 100644 --- a/vendor/k8s.io/client-go/tools/metrics/metrics.go +++ b/vendor/k8s.io/client-go/tools/metrics/metrics.go @@ -80,11 +80,29 @@ type TransportCacheMetric interface { } // TransportCreateCallsMetric counts the number of times a transport is created -// partitioned by the result of the cache: hit, miss, uncacheable +// partitioned by the result of the cache: hit, miss, miss-gc, uncacheable type TransportCreateCallsMetric interface { Increment(result string) } +// TransportCAReloadsMetric counts the number of times a CA reload is attempted, +// partitioned by the result and reason. +type TransportCAReloadsMetric interface { + Increment(result, reason string) +} + +// TransportCertRotationGCCallsMetric counts the number of times a cert rotation +// goroutine cancel func is called via GC cleanup. +type TransportCertRotationGCCallsMetric interface { + Increment() +} + +// TransportCacheGCCallsMetric counts the number of times a GC cleanup +// attempts to delete a cache entry, partitioned by the result: deleted, skipped. +type TransportCacheGCCallsMetric interface { + Increment(result string) +} + var ( // ClientCertExpiry is the expiry time of a client certificate ClientCertExpiry ExpiryMetric = noopExpiry{} @@ -117,23 +135,34 @@ var ( // TransportCreateCalls is the metric that counts the number of times a new transport // is created TransportCreateCalls TransportCreateCallsMetric = noopTransportCreateCalls{} + // TransportCAReloads is the metric that counts the number of times a CA reload is attempted + TransportCAReloads TransportCAReloadsMetric = noopTransportCAReloads{} + // TransportCertRotationGCCalls counts the number of times a cert rotation goroutine + // cancel func is called via GC cleanup + TransportCertRotationGCCalls TransportCertRotationGCCallsMetric = noopTransportCertRotationGCCalls{} + // TransportCacheGCCalls counts the number of times a GC cleanup attempts + // to delete a transport cache entry, partitioned by result: deleted, skipped. + TransportCacheGCCalls TransportCacheGCCallsMetric = noopTransportCacheGCCalls{} ) // RegisterOpts contains all the metrics to register. Metrics may be nil. type RegisterOpts struct { - ClientCertExpiry ExpiryMetric - ClientCertRotationAge DurationMetric - RequestLatency LatencyMetric - ResolverLatency ResolverLatencyMetric - RequestSize SizeMetric - ResponseSize SizeMetric - RateLimiterLatency LatencyMetric - RequestResult ResultMetric - ExecPluginCalls CallsMetric - ExecPluginPolicyCalls PolicyCallsMetric - RequestRetry RetryMetric - TransportCacheEntries TransportCacheMetric - TransportCreateCalls TransportCreateCallsMetric + ClientCertExpiry ExpiryMetric + ClientCertRotationAge DurationMetric + RequestLatency LatencyMetric + ResolverLatency ResolverLatencyMetric + RequestSize SizeMetric + ResponseSize SizeMetric + RateLimiterLatency LatencyMetric + RequestResult ResultMetric + ExecPluginCalls CallsMetric + ExecPluginPolicyCalls PolicyCallsMetric + RequestRetry RetryMetric + TransportCacheEntries TransportCacheMetric + TransportCreateCalls TransportCreateCallsMetric + TransportCAReloads TransportCAReloadsMetric + TransportCertRotationGCCalls TransportCertRotationGCCallsMetric + TransportCacheGCCalls TransportCacheGCCallsMetric } // Register registers metrics for the rest client to use. This can @@ -179,6 +208,15 @@ func Register(opts RegisterOpts) { if opts.TransportCreateCalls != nil { TransportCreateCalls = opts.TransportCreateCalls } + if opts.TransportCAReloads != nil { + TransportCAReloads = opts.TransportCAReloads + } + if opts.TransportCertRotationGCCalls != nil { + TransportCertRotationGCCalls = opts.TransportCertRotationGCCalls + } + if opts.TransportCacheGCCalls != nil { + TransportCacheGCCalls = opts.TransportCacheGCCalls + } }) } @@ -226,3 +264,15 @@ func (noopTransportCache) Observe(int) {} type noopTransportCreateCalls struct{} func (noopTransportCreateCalls) Increment(string) {} + +type noopTransportCAReloads struct{} + +func (noopTransportCAReloads) Increment(result, reason string) {} + +type noopTransportCertRotationGCCalls struct{} + +func (noopTransportCertRotationGCCalls) Increment() {} + +type noopTransportCacheGCCalls struct{} + +func (noopTransportCacheGCCalls) Increment(string) {} diff --git a/vendor/k8s.io/client-go/tools/portforward/fallback_dialer.go b/vendor/k8s.io/client-go/tools/portforward/fallback_dialer.go index 7fcc2492bf..91f8fad4dd 100644 --- a/vendor/k8s.io/client-go/tools/portforward/fallback_dialer.go +++ b/vendor/k8s.io/client-go/tools/portforward/fallback_dialer.go @@ -19,9 +19,11 @@ package portforward import ( "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/klog/v2" + streamhttp "k8s.io/streaming/pkg/httpstream" ) var _ httpstream.Dialer = &FallbackDialer{} +var _ streamhttp.Dialer = &StreamingFallbackDialer{} // FallbackDialer encapsulates a primary and secondary dialer, including // the boolean function to determine if the primary dialer failed. Implements @@ -42,6 +44,24 @@ func NewFallbackDialer(primary, secondary httpstream.Dialer, shouldFallback func } } +// StreamingFallbackDialer encapsulates a primary and secondary streaming dialer +// with fallback behavior. +type StreamingFallbackDialer struct { + primary streamhttp.Dialer + secondary streamhttp.Dialer + shouldFallback func(error) bool +} + +// NewFallbackDialerForStreaming creates a fallback dialer for in-tree callers +// that use k8s.io/streaming/pkg/httpstream types. +func NewFallbackDialerForStreaming(primary, secondary streamhttp.Dialer, shouldFallback func(error) bool) streamhttp.Dialer { + return &StreamingFallbackDialer{ + primary: primary, + secondary: secondary, + shouldFallback: shouldFallback, + } +} + // Dial is the single function necessary to implement the "httpstream.Dialer" interface. // It takes the protocol version strings to request, returning an the upgraded // httstream.Connection and the negotiated protocol version accepted. If the initial @@ -55,3 +75,14 @@ func (f *FallbackDialer) Dial(protocols ...string) (httpstream.Connection, strin } return conn, version, err } + +// Dial is the single function necessary to implement the +// "k8s.io/streaming/pkg/httpstream.Dialer" interface. +func (f *StreamingFallbackDialer) Dial(protocols ...string) (streamhttp.Connection, string, error) { + conn, version, err := f.primary.Dial(protocols...) + if err != nil && f.shouldFallback(err) { + klog.V(4).Infof("fallback to secondary dialer from primary dialer err: %v", err) + return f.secondary.Dial(protocols...) + } + return conn, version, err +} diff --git a/vendor/k8s.io/client-go/tools/portforward/portforward.go b/vendor/k8s.io/client-go/tools/portforward/portforward.go index 126c14e8fa..11e0df6307 100644 --- a/vendor/k8s.io/client-go/tools/portforward/portforward.go +++ b/vendor/k8s.io/client-go/tools/portforward/portforward.go @@ -26,10 +26,13 @@ import ( "strconv" "strings" "sync" + "time" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/klog/v2" + streamhttp "k8s.io/streaming/pkg/httpstream" netutils "k8s.io/utils/net" ) @@ -164,6 +167,12 @@ func New(dialer httpstream.Dialer, ports []string, stopChan <-chan struct{}, rea return NewOnAddresses(dialer, []string{"localhost"}, ports, stopChan, readyChan, out, errOut) } +// NewForStreaming creates a new PortForwarder with localhost listen addresses +// for in-tree callers that use k8s.io/streaming/pkg/httpstream types. +func NewForStreaming(dialer streamhttp.Dialer, ports []string, stopChan <-chan struct{}, readyChan chan struct{}, out, errOut io.Writer) (*PortForwarder, error) { + return NewOnAddressesForStreaming(dialer, []string{"localhost"}, ports, stopChan, readyChan, out, errOut) +} + // NewOnAddresses creates a new PortForwarder with custom listen addresses. func NewOnAddresses(dialer httpstream.Dialer, addresses []string, ports []string, stopChan <-chan struct{}, readyChan chan struct{}, out, errOut io.Writer) (*PortForwarder, error) { if len(addresses) == 0 { @@ -191,6 +200,95 @@ func NewOnAddresses(dialer httpstream.Dialer, addresses []string, ports []string }, nil } +// NewOnAddressesForStreaming creates a new PortForwarder with custom listen +// addresses for in-tree callers that use k8s.io/streaming/pkg/httpstream types. +func NewOnAddressesForStreaming(dialer streamhttp.Dialer, addresses []string, ports []string, stopChan <-chan struct{}, readyChan chan struct{}, out, errOut io.Writer) (*PortForwarder, error) { + return NewOnAddresses(&compatDialerAdapter{delegate: dialer}, addresses, ports, stopChan, readyChan, out, errOut) +} + +type compatDialerAdapter struct { + delegate streamhttp.Dialer +} + +func (d *compatDialerAdapter) Dial(protocols ...string) (httpstream.Connection, string, error) { + conn, protocol, err := d.delegate.Dial(protocols...) + if err != nil { + return nil, "", err + } + return &compatConnectionAdapter{delegate: conn}, protocol, nil +} + +type compatConnectionAdapter struct { + delegate streamhttp.Connection +} + +func (c *compatConnectionAdapter) CreateStream(headers http.Header) (httpstream.Stream, error) { + stream, err := c.delegate.CreateStream(headers) + if err != nil { + return nil, err + } + return &compatStreamAdapter{delegate: stream}, nil +} + +func (c *compatConnectionAdapter) Close() error { + return c.delegate.Close() +} + +func (c *compatConnectionAdapter) CloseChan() <-chan bool { + return c.delegate.CloseChan() +} + +func (c *compatConnectionAdapter) SetIdleTimeout(timeout time.Duration) { + c.delegate.SetIdleTimeout(timeout) +} + +func (c *compatConnectionAdapter) RemoveStreams(streams ...httpstream.Stream) { + streamingStreams := make([]streamhttp.Stream, 0, len(streams)) + for _, stream := range streams { + if stream == nil { + continue + } + if s, ok := stream.(*compatStreamAdapter); ok { + streamingStreams = append(streamingStreams, s.delegate) + continue + } + if s, ok := stream.(streamhttp.Stream); ok { + streamingStreams = append(streamingStreams, s) + continue + } + klog.V(5).Infof("dropping unadaptable stream %T in portforward RemoveStreams", stream) + } + c.delegate.RemoveStreams(streamingStreams...) +} + +type compatStreamAdapter struct { + delegate streamhttp.Stream +} + +func (s *compatStreamAdapter) Read(p []byte) (int, error) { + return s.delegate.Read(p) +} + +func (s *compatStreamAdapter) Write(p []byte) (int, error) { + return s.delegate.Write(p) +} + +func (s *compatStreamAdapter) Close() error { + return s.delegate.Close() +} + +func (s *compatStreamAdapter) Reset() error { + return s.delegate.Reset() +} + +func (s *compatStreamAdapter) Headers() http.Header { + return s.delegate.Headers() +} + +func (s *compatStreamAdapter) Identifier() uint32 { + return s.delegate.Identifier() +} + // ForwardPorts formats and executes a port forwarding request. The connection will remain // open until stopChan is closed. func (pf *PortForwarder) ForwardPorts() error { diff --git a/vendor/k8s.io/client-go/tools/portforward/tunneling_dialer.go b/vendor/k8s.io/client-go/tools/portforward/tunneling_dialer.go index 2bef5ecd72..cc9352bfea 100644 --- a/vendor/k8s.io/client-go/tools/portforward/tunneling_dialer.go +++ b/vendor/k8s.io/client-go/tools/portforward/tunneling_dialer.go @@ -24,11 +24,13 @@ import ( "time" "k8s.io/apimachinery/pkg/util/httpstream" - "k8s.io/apimachinery/pkg/util/httpstream/spdy" + httpstreamspdy "k8s.io/apimachinery/pkg/util/httpstream/spdy" constants "k8s.io/apimachinery/pkg/util/portforward" restclient "k8s.io/client-go/rest" "k8s.io/client-go/transport/websocket" "k8s.io/klog/v2" + streamhttp "k8s.io/streaming/pkg/httpstream" + streamspdy "k8s.io/streaming/pkg/httpstream/spdy" ) const PingPeriod = 10 * time.Second @@ -40,6 +42,14 @@ type tunnelingDialer struct { holder websocket.ConnectionHolder } +// streamingTunnelingDialer implements "k8s.io/streaming/pkg/httpstream.Dialer" +// for in-tree callers. +type streamingTunnelingDialer struct { + url *url.URL + transport http.RoundTripper + holder websocket.ConnectionHolder +} + // NewTunnelingDialer creates and returns the tunnelingDialer structure which implemements the "httpstream.Dialer" // interface. The dialer can upgrade a websocket request, creating a websocket connection. This function // returns an error if one occurs. @@ -55,25 +65,36 @@ func NewSPDYOverWebsocketDialer(url *url.URL, config *restclient.Config) (httpst }, nil } -// Dial upgrades to a tunneling streaming connection, returning a SPDY connection -// containing a WebSockets connection (which implements "net.Conn"). Also -// returns the protocol negotiated, or an error. -func (d *tunnelingDialer) Dial(protocols ...string) (httpstream.Connection, string, error) { +// NewSPDYOverWebsocketDialerForStreaming creates a SPDY-over-websocket dialer +// for in-tree callers that use k8s.io/streaming/pkg/httpstream types. +func NewSPDYOverWebsocketDialerForStreaming(url *url.URL, config *restclient.Config) (streamhttp.Dialer, error) { + transport, holder, err := websocket.RoundTripperFor(config) + if err != nil { + return nil, err + } + return &streamingTunnelingDialer{ + url: url, + transport: transport, + holder: holder, + }, nil +} + +func negotiateSPDYOverWebsocket(url *url.URL, transport http.RoundTripper, holder websocket.ConnectionHolder, protocols ...string) (*TunnelingConnection, string, error) { // There is no passed context, so skip the context when creating request for now. // Websockets requires "GET" method: RFC 6455 Sec. 4.1 (page 17). - req, err := http.NewRequest("GET", d.url.String(), nil) + req, err := http.NewRequest("GET", url.String(), nil) if err != nil { return nil, "", err } // Add the spdy tunneling prefix to the requested protocols. The tunneling // handler will know how to negotiate these protocols. - tunnelingProtocols := []string{} + tunnelingProtocols := make([]string, 0, len(protocols)) for _, protocol := range protocols { tunnelingProtocol := constants.WebsocketsSPDYTunnelingPrefix + protocol tunnelingProtocols = append(tunnelingProtocols, tunnelingProtocol) } klog.V(4).Infoln("Before WebSocket Upgrade Connection...") - conn, err := websocket.Negotiate(d.transport, d.holder, req, tunnelingProtocols...) + conn, err := websocket.Negotiate(transport, holder, req, tunnelingProtocols...) if err != nil { return nil, "", err } @@ -84,10 +105,32 @@ func (d *tunnelingDialer) Dial(protocols ...string) (httpstream.Connection, stri protocol = strings.TrimPrefix(protocol, constants.WebsocketsSPDYTunnelingPrefix) klog.V(4).Infof("negotiated protocol: %s", protocol) - // Wrap the websocket connection which implements "net.Conn". - tConn := NewTunnelingConnection("client", conn) + return NewTunnelingConnection("client", conn), protocol, nil +} + +// Dial upgrades to a tunneling streaming connection, returning a SPDY connection +// containing a WebSockets connection (which implements "net.Conn"). Also +// returns the protocol negotiated, or an error. +func (d *tunnelingDialer) Dial(protocols ...string) (httpstream.Connection, string, error) { + tConn, protocol, err := negotiateSPDYOverWebsocket(d.url, d.transport, d.holder, protocols...) + if err != nil { + return nil, "", err + } + // Create SPDY connection injecting the previously created tunneling connection. + spdyConn, err := httpstreamspdy.NewClientConnectionWithPings(tConn, PingPeriod) + + return spdyConn, protocol, err +} + +// Dial upgrades to a tunneling streaming connection for callers using +// k8s.io/streaming/pkg/httpstream types. +func (d *streamingTunnelingDialer) Dial(protocols ...string) (streamhttp.Connection, string, error) { + tConn, protocol, err := negotiateSPDYOverWebsocket(d.url, d.transport, d.holder, protocols...) + if err != nil { + return nil, "", err + } // Create SPDY connection injecting the previously created tunneling connection. - spdyConn, err := spdy.NewClientConnectionWithPings(tConn, PingPeriod) + spdyConn, err := streamspdy.NewClientConnectionWithPings(tConn, PingPeriod) return spdyConn, protocol, err } diff --git a/vendor/k8s.io/client-go/tools/record/event.go b/vendor/k8s.io/client-go/tools/record/event.go index 58322d44d2..305a924388 100644 --- a/vendor/k8s.io/client-go/tools/record/event.go +++ b/vendor/k8s.io/client-go/tools/record/event.go @@ -408,7 +408,10 @@ func (e *eventBroadcasterImpl) StartEventWatcher(eventHandler func(*v1.Event)) w case <-e.cancelationCtx.Done(): watcher.Stop() return - case watchEvent := <-watcher.ResultChan(): + case watchEvent, ok := <-watcher.ResultChan(): + if !ok { + return + } event, ok := watchEvent.Object.(*v1.Event) if !ok { // This is all local, so there's no reason this should diff --git a/vendor/k8s.io/client-go/tools/remotecommand/errorstream.go b/vendor/k8s.io/client-go/tools/remotecommand/errorstream.go index 90bb39b4a4..23dd50778d 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/errorstream.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/errorstream.go @@ -21,6 +21,7 @@ import ( "io" "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/klog/v2" ) // errorStreamDecoder interprets the data on the error channel and creates a go error object from it. @@ -32,11 +33,11 @@ type errorStreamDecoder interface { // decodes it with the given errorStreamDecoder, sends the decoded error (or nil if the remote // command exited successfully) to the returned error channel, and closes it. // This function returns immediately. -func watchErrorStream(errorStream io.Reader, d errorStreamDecoder) chan error { +func watchErrorStream(logger klog.Logger, errorStream io.Reader, d errorStreamDecoder) chan error { errorChan := make(chan error) go func() { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithLogger(logger) message, err := io.ReadAll(errorStream) switch { diff --git a/vendor/k8s.io/client-go/tools/remotecommand/fallback.go b/vendor/k8s.io/client-go/tools/remotecommand/fallback.go index 503323080d..bcd5fd3138 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/fallback.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/fallback.go @@ -53,7 +53,7 @@ func (f *FallbackExecutor) Stream(options StreamOptions) error { func (f *FallbackExecutor) StreamWithContext(ctx context.Context, options StreamOptions) error { err := f.primary.StreamWithContext(ctx, options) if err != nil && f.shouldFallback(err) { - klog.V(4).Infof("RemoteCommand fallback: %v", err) + klog.FromContext(ctx).V(4).Info("RemoteCommand fallback", "err", err) return f.secondary.StreamWithContext(ctx, options) } return err diff --git a/vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go b/vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go index 4cff05cd81..ca892f9b74 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/remotecommand.go @@ -21,7 +21,8 @@ import ( "io" "net/http" - "k8s.io/apimachinery/pkg/util/httpstream" + "k8s.io/klog/v2" + "k8s.io/streaming/pkg/httpstream" ) // StreamOptions holds information pertaining to the current streaming session: @@ -54,5 +55,5 @@ type streamCreator interface { } type streamProtocolHandler interface { - stream(conn streamCreator, ready chan<- struct{}) error + stream(logger klog.Logger, conn streamCreator, ready chan<- struct{}) error } diff --git a/vendor/k8s.io/client-go/tools/remotecommand/spdy.go b/vendor/k8s.io/client-go/tools/remotecommand/spdy.go index 34825771a0..ebf3c53c3a 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/spdy.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/spdy.go @@ -22,11 +22,11 @@ import ( "net/http" "net/url" - "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/remotecommand" restclient "k8s.io/client-go/rest" "k8s.io/client-go/transport/spdy" "k8s.io/klog/v2" + "k8s.io/streaming/pkg/httpstream" ) // spdyStreamExecutor handles transporting standard shell streams over an httpstream connection. @@ -109,7 +109,7 @@ func (e *spdyStreamExecutor) newConnectionAndStream(ctx context.Context, options return fmt.Errorf("redirect not allowed") } } - conn, protocol, err := spdy.Negotiate( + conn, protocol, err := spdy.NegotiateStreaming( e.upgrader, &client, req, @@ -121,6 +121,7 @@ func (e *spdyStreamExecutor) newConnectionAndStream(ctx context.Context, options var streamer streamProtocolHandler + logger := klog.FromContext(ctx) switch protocol { case remotecommand.StreamProtocolV5Name: streamer = newStreamProtocolV5(options) @@ -131,7 +132,7 @@ func (e *spdyStreamExecutor) newConnectionAndStream(ctx context.Context, options case remotecommand.StreamProtocolV2Name: streamer = newStreamProtocolV2(options) case "": - klog.V(4).Infof("The server did not negotiate a streaming protocol version. Falling back to %s", remotecommand.StreamProtocolV1Name) + logger.V(4).Info("The server did not negotiate a streaming protocol version, falling back", "protocol", remotecommand.StreamProtocolV1Name) fallthrough case remotecommand.StreamProtocolV1Name: streamer = newStreamProtocolV1(options) @@ -161,7 +162,7 @@ func (e *spdyStreamExecutor) StreamWithContext(ctx context.Context, options Stre // The SPDY executor does not need to synchronize stream creation, so we pass a nil // ready channel. The underlying spdystream library handles stream multiplexing // without a race condition. - errorChan <- streamer.stream(conn, nil) + errorChan <- streamer.stream(klog.FromContext(ctx), conn, nil) }() select { diff --git a/vendor/k8s.io/client-go/tools/remotecommand/v1.go b/vendor/k8s.io/client-go/tools/remotecommand/v1.go index 293d809dde..5d903b67a2 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/v1.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/v1.go @@ -21,9 +21,9 @@ import ( "io" "net/http" - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/util/httpstream" + v1 "k8s.io/api/core/v1" "k8s.io/klog/v2" + "k8s.io/streaming/pkg/httpstream" ) // streamProtocolV1 implements the first version of the streaming exec & attach @@ -47,15 +47,15 @@ func newStreamProtocolV1(options StreamOptions) streamProtocolHandler { } } -func (p *streamProtocolV1) stream(conn streamCreator, ready chan<- struct{}) error { +func (p *streamProtocolV1) stream(logger klog.Logger, conn streamCreator, ready chan<- struct{}) error { doneChan := make(chan struct{}, 2) errorChan := make(chan error) cp := func(s string, dst io.Writer, src io.Reader) { - klog.V(6).Infof("Copying %s", s) - defer klog.V(6).Infof("Done copying %s", s) + logger.V(6).Info("Copying", "data", s) + defer logger.V(6).Info("Done copying", "data", s) if _, err := io.Copy(dst, src); err != nil && err != io.EOF { - klog.Errorf("Error copying %s: %v", s, err) + logger.Error(err, "Error copying", "data", s) } if s == v1.StreamTypeStdout || s == v1.StreamTypeStderr { doneChan <- struct{}{} diff --git a/vendor/k8s.io/client-go/tools/remotecommand/v2.go b/vendor/k8s.io/client-go/tools/remotecommand/v2.go index a81538a092..75286a12fd 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/v2.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/v2.go @@ -22,8 +22,9 @@ import ( "net/http" "sync" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/klog/v2" ) // streamProtocolV2 implements version 2 of the streaming protocol for attach @@ -87,13 +88,13 @@ func (p *streamProtocolV2) createStreams(conn streamCreator) error { return nil } -func (p *streamProtocolV2) copyStdin() { +func (p *streamProtocolV2) copyStdin(logger klog.Logger) { if p.Stdin != nil { var once sync.Once // copy from client's stdin to container's stdin go func() { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithLogger(logger) // if p.stdin is noninteractive, p.g. `echo abc | kubectl exec -i -- cat`, make sure // we close remoteStdin as soon as the copy from p.stdin to remoteStdin finishes. Otherwise @@ -101,7 +102,7 @@ func (p *streamProtocolV2) copyStdin() { defer once.Do(func() { p.remoteStdin.Close() }) if _, err := io.Copy(p.remoteStdin, readerWrapper{p.Stdin}); err != nil { - runtime.HandleError(err) + runtime.HandleErrorWithLogger(logger, err, "Copying stdin failed") } }() @@ -120,26 +121,26 @@ func (p *streamProtocolV2) copyStdin() { // When that happens, we must Close() on our side of remoteStdin, to // allow the copy in hijack to complete, and hijack to return. go func() { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithLogger(logger) defer once.Do(func() { p.remoteStdin.Close() }) // this "copy" doesn't actually read anything - it's just here to wait for // the server to close remoteStdin. if _, err := io.Copy(io.Discard, p.remoteStdin); err != nil { - runtime.HandleError(err) + runtime.HandleErrorWithLogger(logger, err, "Waiting for server to close stdin failed") } }() } } -func (p *streamProtocolV2) copyStdout(wg *sync.WaitGroup) { +func (p *streamProtocolV2) copyStdout(logger klog.Logger, wg *sync.WaitGroup) { if p.Stdout == nil { return } wg.Add(1) go func() { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithLogger(logger) defer wg.Done() // make sure, packet in queue can be consumed. // block in queue may lead to deadlock in conn.server @@ -147,29 +148,29 @@ func (p *streamProtocolV2) copyStdout(wg *sync.WaitGroup) { defer io.Copy(io.Discard, p.remoteStdout) if _, err := io.Copy(p.Stdout, p.remoteStdout); err != nil { - runtime.HandleError(err) + runtime.HandleErrorWithLogger(logger, err, "Copying stdout failed") } }() } -func (p *streamProtocolV2) copyStderr(wg *sync.WaitGroup) { +func (p *streamProtocolV2) copyStderr(logger klog.Logger, wg *sync.WaitGroup) { if p.Stderr == nil || p.Tty { return } wg.Add(1) go func() { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithLogger(logger) defer wg.Done() defer io.Copy(io.Discard, p.remoteStderr) if _, err := io.Copy(p.Stderr, p.remoteStderr); err != nil { - runtime.HandleError(err) + runtime.HandleErrorWithLogger(logger, err, "Copying stderr failed") } }() } -func (p *streamProtocolV2) stream(conn streamCreator, ready chan<- struct{}) error { +func (p *streamProtocolV2) stream(logger klog.Logger, conn streamCreator, ready chan<- struct{}) error { if err := p.createStreams(conn); err != nil { return err } @@ -181,13 +182,13 @@ func (p *streamProtocolV2) stream(conn streamCreator, ready chan<- struct{}) err // now that all the streams have been created, proceed with reading & copying - errorChan := watchErrorStream(p.errorStream, &errorDecoderV2{}) + errorChan := watchErrorStream(logger, p.errorStream, &errorDecoderV2{}) - p.copyStdin() + p.copyStdin(logger) var wg sync.WaitGroup - p.copyStdout(&wg) - p.copyStderr(&wg) + p.copyStdout(logger, &wg) + p.copyStderr(logger, &wg) // we're waiting for stdout/stderr to finish copying wg.Wait() diff --git a/vendor/k8s.io/client-go/tools/remotecommand/v3.go b/vendor/k8s.io/client-go/tools/remotecommand/v3.go index ece4cfafeb..b1e533a8a0 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/v3.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/v3.go @@ -22,8 +22,9 @@ import ( "net/http" "sync" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/klog/v2" ) // streamProtocolV3 implements version 3 of the streaming protocol for attach @@ -62,12 +63,12 @@ func (p *streamProtocolV3) createStreams(conn streamCreator) error { return nil } -func (p *streamProtocolV3) handleResizes() { +func (p *streamProtocolV3) handleResizes(logger klog.Logger) { if p.resizeStream == nil || p.TerminalSizeQueue == nil { return } go func() { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithLogger(logger) encoder := json.NewEncoder(p.resizeStream) for { @@ -76,13 +77,13 @@ func (p *streamProtocolV3) handleResizes() { return } if err := encoder.Encode(&size); err != nil { - runtime.HandleError(err) + runtime.HandleErrorWithLogger(logger, err, "Encoding terminal size failed") } } }() } -func (p *streamProtocolV3) stream(conn streamCreator, ready chan<- struct{}) error { +func (p *streamProtocolV3) stream(logger klog.Logger, conn streamCreator, ready chan<- struct{}) error { if err := p.createStreams(conn); err != nil { return err } @@ -94,15 +95,15 @@ func (p *streamProtocolV3) stream(conn streamCreator, ready chan<- struct{}) err // now that all the streams have been created, proceed with reading & copying - errorChan := watchErrorStream(p.errorStream, &errorDecoderV3{}) + errorChan := watchErrorStream(logger, p.errorStream, &errorDecoderV3{}) - p.handleResizes() + p.handleResizes(logger) - p.copyStdin() + p.copyStdin(logger) var wg sync.WaitGroup - p.copyStdout(&wg) - p.copyStderr(&wg) + p.copyStdout(logger, &wg) + p.copyStderr(logger, &wg) // we're waiting for stdout/stderr to finish copying wg.Wait() diff --git a/vendor/k8s.io/client-go/tools/remotecommand/v4.go b/vendor/k8s.io/client-go/tools/remotecommand/v4.go index ecedad071e..47018ba5fe 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/v4.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/v4.go @@ -26,6 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/remotecommand" "k8s.io/client-go/util/exec" + "k8s.io/klog/v2" ) // streamProtocolV4 implements version 4 of the streaming protocol for attach @@ -47,11 +48,11 @@ func (p *streamProtocolV4) createStreams(conn streamCreator) error { return p.streamProtocolV3.createStreams(conn) } -func (p *streamProtocolV4) handleResizes() { - p.streamProtocolV3.handleResizes() +func (p *streamProtocolV4) handleResizes(logger klog.Logger) { + p.streamProtocolV3.handleResizes(logger) } -func (p *streamProtocolV4) stream(conn streamCreator, ready chan<- struct{}) error { +func (p *streamProtocolV4) stream(logger klog.Logger, conn streamCreator, ready chan<- struct{}) error { if err := p.createStreams(conn); err != nil { return err } @@ -63,15 +64,15 @@ func (p *streamProtocolV4) stream(conn streamCreator, ready chan<- struct{}) err // now that all the streams have been created, proceed with reading & copying - errorChan := watchErrorStream(p.errorStream, &errorDecoderV4{}) + errorChan := watchErrorStream(logger, p.errorStream, &errorDecoderV4{}) - p.handleResizes() + p.handleResizes(logger) - p.copyStdin() + p.copyStdin(logger) var wg sync.WaitGroup - p.copyStdout(&wg) - p.copyStderr(&wg) + p.copyStdout(logger, &wg) + p.copyStderr(logger, &wg) // we're waiting for stdout/stderr to finish copying wg.Wait() diff --git a/vendor/k8s.io/client-go/tools/remotecommand/v5.go b/vendor/k8s.io/client-go/tools/remotecommand/v5.go index edfd3ccb26..ca79a88287 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/v5.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/v5.go @@ -16,6 +16,8 @@ limitations under the License. package remotecommand +import "k8s.io/klog/v2" + // streamProtocolV5 add support for V5 of the remote command subprotocol. // For the streamProtocolHandler, this version is the same as V4. type streamProtocolV5 struct { @@ -30,6 +32,6 @@ func newStreamProtocolV5(options StreamOptions) streamProtocolHandler { } } -func (p *streamProtocolV5) stream(conn streamCreator, ready chan<- struct{}) error { - return p.streamProtocolV4.stream(conn, ready) +func (p *streamProtocolV5) stream(logger klog.Logger, conn streamCreator, ready chan<- struct{}) error { + return p.streamProtocolV4.stream(logger, conn, ready) } diff --git a/vendor/k8s.io/client-go/tools/remotecommand/websocket.go b/vendor/k8s.io/client-go/tools/remotecommand/websocket.go index e0433198fa..f531e7ccff 100644 --- a/vendor/k8s.io/client-go/tools/remotecommand/websocket.go +++ b/vendor/k8s.io/client-go/tools/remotecommand/websocket.go @@ -29,11 +29,11 @@ import ( gwebsocket "github.com/gorilla/websocket" v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/apimachinery/pkg/util/remotecommand" restclient "k8s.io/client-go/rest" "k8s.io/client-go/transport/websocket" "k8s.io/klog/v2" + "k8s.io/streaming/pkg/httpstream" ) // writeDeadline defines the time that a client-side write to the websocket @@ -130,7 +130,8 @@ func (e *wsStreamExecutor) StreamWithContext(ctx context.Context, options Stream } defer conn.Close() e.negotiated = conn.Subprotocol() - klog.V(4).Infof("The subprotocol is %s", e.negotiated) + logger := klog.FromContext(ctx) + logger.V(4).Info("Subprotocol negotiated", "protocol", e.negotiated) var streamer streamProtocolHandler switch e.negotiated { @@ -143,7 +144,7 @@ func (e *wsStreamExecutor) StreamWithContext(ctx context.Context, options Stream case remotecommand.StreamProtocolV2Name: streamer = newStreamProtocolV2(options) case "": - klog.V(4).Infof("The server did not negotiate a streaming protocol version. Falling back to %s", remotecommand.StreamProtocolV1Name) + logger.V(4).Info("The server did not negotiate a streaming protocol version, falling back", "protocol", remotecommand.StreamProtocolV1Name) fallthrough case remotecommand.StreamProtocolV1Name: streamer = newStreamProtocolV1(options) @@ -159,7 +160,7 @@ func (e *wsStreamExecutor) StreamWithContext(ctx context.Context, options Stream }() readyChan := make(chan struct{}) - creator := newWSStreamCreator(conn) + creator := newWSStreamCreator(logger, conn) go func() { select { // Wait until all streams have been created before starting the readDemuxLoop. @@ -177,7 +178,7 @@ func (e *wsStreamExecutor) StreamWithContext(ctx context.Context, options Stream e.heartbeatDeadline, ) }() - errorChan <- streamer.stream(creator, readyChan) + errorChan <- streamer.stream(logger, creator, readyChan) }() select { @@ -191,7 +192,8 @@ func (e *wsStreamExecutor) StreamWithContext(ctx context.Context, options Stream } type wsStreamCreator struct { - conn *gwebsocket.Conn + logger klog.Logger + conn *gwebsocket.Conn // Protects writing to websocket connection; reading is lock-free connWriteLock sync.Mutex // map of stream id to stream; multiple streams read/write the connection @@ -202,8 +204,9 @@ type wsStreamCreator struct { setStreamErr error } -func newWSStreamCreator(conn *gwebsocket.Conn) *wsStreamCreator { +func newWSStreamCreator(logger klog.Logger, conn *gwebsocket.Conn) *wsStreamCreator { return &wsStreamCreator{ + logger: logger, conn: conn, streams: map[byte]*stream{}, } @@ -238,6 +241,7 @@ func (c *wsStreamCreator) CreateStream(headers http.Header) (httpstream.Stream, } reader, writer := io.Pipe() s := &stream{ + logger: klog.LoggerWithValues(c.logger, "id", id), headers: headers, readPipe: reader, writePipe: writer, @@ -260,11 +264,11 @@ func (c *wsStreamCreator) CreateStream(headers http.Header) (httpstream.Stream, // connection reader at a time (a read mutex would provide no benefit). func (c *wsStreamCreator) readDemuxLoop(bufferSize int, period time.Duration, deadline time.Duration) { // Initialize and start the ping/pong heartbeat. - h := newHeartbeat(c.conn, period, deadline) + h := newHeartbeat(c.logger, c.conn, period, deadline) // Set initial timeout for websocket connection reading. - klog.V(5).Infof("Websocket initial read deadline: %s", deadline) + c.logger.V(5).Info("Websocket read starts", "deadline", deadline) if err := c.conn.SetReadDeadline(time.Now().Add(deadline)); err != nil { - klog.Errorf("Websocket initial setting read deadline failed %v", err) + c.logger.Error(err, "Websocket initial setting read deadline failed") return } go h.start() @@ -308,7 +312,7 @@ func (c *wsStreamCreator) readDemuxLoop(bufferSize int, period time.Duration, de streamID := readBuffer[0] s := c.getStream(streamID) if s == nil { - klog.Errorf("Unknown stream id %d, discarding message", streamID) + c.logger.Error(nil, "Unknown stream, discarding message", "id", streamID) continue } for { @@ -351,6 +355,7 @@ func (c *wsStreamCreator) closeAllStreamReaders(err error) { } type stream struct { + logger klog.Logger headers http.Header readPipe *io.PipeReader writePipe *io.PipeWriter @@ -369,8 +374,8 @@ func (s *stream) Read(p []byte) (n int, err error) { // Write writes directly to the underlying WebSocket connection. func (s *stream) Write(p []byte) (n int, err error) { - klog.V(8).Infof("Write() on stream %d", s.id) - defer klog.V(8).Infof("Write() done on stream %d", s.id) + s.logger.V(8).Info("Write() on stream") + defer s.logger.V(8).Info("Write() done on stream") s.connWriteLock.Lock() defer s.connWriteLock.Unlock() if s.conn == nil { @@ -378,7 +383,7 @@ func (s *stream) Write(p []byte) (n int, err error) { } err = s.conn.SetWriteDeadline(time.Now().Add(writeDeadline)) if err != nil { - klog.V(4).Infof("Websocket setting write deadline failed %v", err) + s.logger.V(4).Info("Websocket setting write deadline failed", "err", err) return 0, err } // Message writer buffers the message data, so we don't need to do that ourselves. @@ -407,8 +412,8 @@ func (s *stream) Write(p []byte) (n int, err error) { // Close half-closes the stream, indicating this side is finished with the stream. func (s *stream) Close() error { - klog.V(6).Infof("Close() on stream %d", s.id) - defer klog.V(6).Infof("Close() done on stream %d", s.id) + s.logger.V(6).Info("Close() on stream") + defer s.logger.V(6).Info("Close() done on stream") s.connWriteLock.Lock() defer s.connWriteLock.Unlock() if s.conn == nil { @@ -421,8 +426,8 @@ func (s *stream) Close() error { } func (s *stream) Reset() error { - klog.V(4).Infof("Reset() on stream %d", s.id) - defer klog.V(4).Infof("Reset() done on stream %d", s.id) + s.logger.V(4).Info("Reset() on stream") + defer s.logger.V(4).Info("Reset() done on stream") s.Close() return s.writePipe.Close() } @@ -442,7 +447,8 @@ func (s *stream) Identifier() uint32 { // inside the "readDemuxLoop" will return an i/o error prompting a connection close // and cleanup. type heartbeat struct { - conn *gwebsocket.Conn + logger klog.Logger + conn *gwebsocket.Conn // period defines how often a "ping" heartbeat message is sent to the other endpoint period time.Duration // closing the "closer" channel will clean up the heartbeat timers @@ -456,8 +462,9 @@ type heartbeat struct { // newHeartbeat creates heartbeat structure encapsulating fields necessary to // run the websocket connection ping/pong mechanism and sets up handlers on // the websocket connection. -func newHeartbeat(conn *gwebsocket.Conn, period time.Duration, deadline time.Duration) *heartbeat { +func newHeartbeat(logger klog.Logger, conn *gwebsocket.Conn, period time.Duration, deadline time.Duration) *heartbeat { h := &heartbeat{ + logger: logger, conn: conn, period: period, closer: make(chan struct{}), @@ -467,10 +474,10 @@ func newHeartbeat(conn *gwebsocket.Conn, period time.Duration, deadline time.Dur // be empty. h.conn.SetPongHandler(func(msg string) error { // Push the read deadline into the future. - klog.V(6).Infof("Pong message received (%s)--resetting read deadline", msg) + logger.V(6).Info("Pong message received -- resetting read deadline", "message", msg) err := h.conn.SetReadDeadline(time.Now().Add(deadline)) if err != nil { - klog.Errorf("Websocket setting read deadline failed %v", err) + logger.Error(err, "Websocket setting read deadline failed") return err } if len(msg) > 0 { @@ -502,16 +509,16 @@ func (h *heartbeat) start() { for { select { case <-h.closer: - klog.V(5).Infof("closed channel--returning") + h.logger.V(5).Info("Closed channel -- returning") return case <-t.C: // "WriteControl" does not need to be protected by a mutex. According to // gorilla/websockets library docs: "The Close and WriteControl methods can // be called concurrently with all other methods." if err := h.conn.WriteControl(gwebsocket.PingMessage, h.message, time.Now().Add(pingReadDeadline)); err == nil { - klog.V(6).Infof("Websocket Ping succeeeded") + h.logger.V(6).Info("Websocket Ping succeeeded") } else { - klog.Errorf("Websocket Ping failed: %v", err) + h.logger.Error(err, "Websocket Ping failed") if errors.Is(err, gwebsocket.ErrCloseSent) { // we continue because c.conn.CloseChan will manage closing the connection already continue diff --git a/vendor/k8s.io/client-go/tools/watch/retrywatcher.go b/vendor/k8s.io/client-go/tools/watch/retrywatcher.go index 45249d8e47..7d702907f9 100644 --- a/vendor/k8s.io/client-go/tools/watch/retrywatcher.go +++ b/vendor/k8s.io/client-go/tools/watch/retrywatcher.go @@ -26,12 +26,12 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/dump" "k8s.io/apimachinery/pkg/util/net" "k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" + "k8s.io/utils/dump" ) // resourceVersionGetter is an interface used to get resource version from events. diff --git a/vendor/k8s.io/client-go/transport/ca_rotation.go b/vendor/k8s.io/client-go/transport/ca_rotation.go new file mode 100644 index 0000000000..b802eedf48 --- /dev/null +++ b/vendor/k8s.io/client-go/transport/ca_rotation.go @@ -0,0 +1,154 @@ +/* +Copyright 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. +*/ + +package transport + +import ( + "bytes" + "context" + "net/http" + "os" + "sync" + "time" + + utilnet "k8s.io/apimachinery/pkg/util/net" + "k8s.io/client-go/tools/metrics" + "k8s.io/klog/v2" + "k8s.io/utils/clock" +) + +var _ utilnet.RoundTripperWrapper = &atomicTransportHolder{} + +// atomicTransportHolder holds a transport that can be atomically updated +// when CA files change, enabling graceful CA rotation without cache complexity +type atomicTransportHolder struct { + caFile string + currentCAData []byte // Track the actual CA data currently in use + // clock and caRefreshDuration are used to allow for testing time-based logic. + clock clock.Clock + caRefreshDuration time.Duration + // mu covers transport and transportLastChecked + mu sync.RWMutex + transport *http.Transport + transportLastChecked time.Time +} + +func (h *atomicTransportHolder) RoundTrip(req *http.Request) (*http.Response, error) { + return h.getTransport(req.Context()).RoundTrip(req) +} + +func (h *atomicTransportHolder) WrappedRoundTripper() http.RoundTripper { + h.mu.RLock() + defer h.mu.RUnlock() + + return h.transport +} + +func (h *atomicTransportHolder) getTransport(ctx context.Context) *http.Transport { + if rt := h.getTransportIfFresh(); rt != nil { + return rt + } + + h.mu.Lock() + defer h.mu.Unlock() + + h.tryRefreshTransportLocked(ctx) + return h.transport +} + +func (h *atomicTransportHolder) getTransportIfFresh() *http.Transport { + h.mu.RLock() + defer h.mu.RUnlock() + + if h.clock.Since(h.transportLastChecked) < h.caRefreshDuration { + return h.transport + } + return nil +} + +func (h *atomicTransportHolder) tryRefreshTransportLocked(ctx context.Context) { + // If some other goroutine already checked/updated the CA + if h.clock.Since(h.transportLastChecked) < h.caRefreshDuration { + return + } + + // only attempt CA reload once per caRefreshDuration, even if the reload fails + h.transportLastChecked = h.clock.Now() + + logger := klog.FromContext(ctx).WithValues("caFile", h.caFile) + + logger.V(4).Info("Checking CA file content") + + // Load new CA data from file + newCAData, err := os.ReadFile(h.caFile) + // Return old transport on read error + if err != nil { + logger.Error(err, "Failed to read CA data from file") + metrics.TransportCAReloads.Increment("failure", "read_error") + return + } + + if len(newCAData) == 0 { + logger.Info("CA file empty, skipping transport rotation") + metrics.TransportCAReloads.Increment("failure", "empty") + return + } + + if bytes.Equal(h.currentCAData, newCAData) { + logger.V(4).Info("CA file unchanged, skipping transport rotation") + metrics.TransportCAReloads.Increment("success", "unchanged") + return + } + + logger.V(4).Info("CA content changed, updating transport") + + // Load new CA pool + newCAs, err := rootCertPool(newCAData) + // Return old transport on parse error + if err != nil { + logger.Error(err, "Failed to parse CA data from file") + metrics.TransportCAReloads.Increment("failure", "ca_parse_error") + return + } + newTransport := h.transport.Clone() + newTransport.TLSClientConfig.RootCAs = newCAs + oldTransport := h.transport + h.transport = newTransport + // Update our tracking of current CA data + h.currentCAData = newCAData + + // Close idle connections on the old transport to encourage migration + oldTransport.CloseIdleConnections() + + logger.V(4).Info("Transport updated for CA rotation") + metrics.TransportCAReloads.Increment("success", "updated") +} + +// newAtomicTransportHolder creates a new holder for CA file reloading scenarios. +// The caFile must be specified. +// caData may be empty but should correspond to the contents of caFile. +// transport must have a TLS config and its root CAs should match caData. +func newAtomicTransportHolder(caFile string, caData []byte, transport *http.Transport) *atomicTransportHolder { + c := clock.RealClock{} + return &atomicTransportHolder{ + caFile: caFile, + currentCAData: caData, + clock: c, + caRefreshDuration: 5 * time.Minute, + transport: transport, + transportLastChecked: c.Now(), + } +} diff --git a/vendor/k8s.io/client-go/transport/cache.go b/vendor/k8s.io/client-go/transport/cache.go index b8dd866119..16b62ec9fe 100644 --- a/vendor/k8s.io/client-go/transport/cache.go +++ b/vendor/k8s.io/client-go/transport/cache.go @@ -21,12 +21,14 @@ import ( "fmt" "net" "net/http" + "runtime" "strings" "sync" "time" + "weak" utilnet "k8s.io/apimachinery/pkg/util/net" - "k8s.io/apimachinery/pkg/util/wait" + clientgofeaturegate "k8s.io/client-go/features" "k8s.io/client-go/tools/metrics" "k8s.io/klog/v2" ) @@ -35,22 +37,26 @@ import ( // same RoundTripper will be returned for configs with identical TLS options If // the config has no custom TLS options, http.DefaultTransport is returned. type tlsTransportCache struct { - mu sync.Mutex - transports map[tlsCacheKey]*http.Transport + mu sync.Mutex + transports map[tlsCacheKey]weak.Pointer[trackedTransport] // GC-enabled + strongTransports map[tlsCacheKey]http.RoundTripper // GC-disabled } -// DialerStopCh is stop channel that is passed down to dynamic cert dialer. -// It's exposed as variable for testing purposes to avoid testing for goroutine -// leakages. -var DialerStopCh = wait.NeverStop - const idleConnsPerHost = 25 -var tlsCache = &tlsTransportCache{transports: make(map[tlsCacheKey]*http.Transport)} +var tlsCache = newTLSCache() + +func newTLSCache() *tlsTransportCache { + return &tlsTransportCache{ + transports: make(map[tlsCacheKey]weak.Pointer[trackedTransport]), + strongTransports: make(map[tlsCacheKey]http.RoundTripper), + } +} type tlsCacheKey struct { insecure bool caData string + caFile string certData string keyData string `datapolicy:"security-key"` certFile string @@ -68,8 +74,8 @@ func (t tlsCacheKey) String() string { if len(t.keyData) > 0 { keyText = "" } - return fmt.Sprintf("insecure:%v, caData:%#v, certData:%#v, keyData:%s, serverName:%s, disableCompression:%t, getCert:%p, dial:%p", - t.insecure, t.caData, t.certData, keyText, t.serverName, t.disableCompression, t.getCert, t.dial) + return fmt.Sprintf("insecure:%v, caData:%#v, caFile:%s, certData:%#v, keyData:%s, serverName:%s, disableCompression:%t, getCert:%p, dial:%p", + t.insecure, t.caData, t.caFile, t.certData, keyText, t.serverName, t.disableCompression, t.getCert, t.dial) } func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { @@ -82,14 +88,18 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { // Ensure we only create a single transport for the given TLS options c.mu.Lock() defer c.mu.Unlock() - defer metrics.TransportCacheEntries.Observe(len(c.transports)) + defer func() { metrics.TransportCacheEntries.Observe(c.lenLocked()) }() // See if we already have a custom transport for this config - if t, ok := c.transports[key]; ok { - metrics.TransportCreateCalls.Increment("hit") - return t, nil + if t, ok := c.getLocked(key); ok { + if t != nil { + metrics.TransportCreateCalls.Increment("hit") + return t, nil + } + metrics.TransportCreateCalls.Increment("miss-gc") + } else { + metrics.TransportCreateCalls.Increment("miss") } - metrics.TransportCreateCalls.Increment("miss") } else { metrics.TransportCreateCalls.Increment("uncacheable") } @@ -116,6 +126,7 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { // If we use are reloading files, we need to handle certificate rotation properly // TODO(jackkleeman): We can also add rotation here when config.HasCertCallback() is true + var cancel context.CancelFunc if config.TLS.ReloadTLSFiles && tlsConfig != nil && tlsConfig.GetClientCertificate != nil { // The TLS cache is a singleton, so sharing the same name for all of its // background activity seems okay. @@ -123,7 +134,9 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { dynamicCertDialer := certRotatingDialer(logger, tlsConfig.GetClientCertificate, dial) tlsConfig.GetClientCertificate = dynamicCertDialer.GetClientCertificate dial = dynamicCertDialer.connDialer.DialContext - go dynamicCertDialer.run(DialerStopCh) + var ctx context.Context + ctx, cancel = context.WithCancel(context.Background()) + go dynamicCertDialer.run(ctx.Done()) } proxy := http.ProxyFromEnvironment @@ -131,7 +144,7 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { proxy = config.Proxy } - transport := utilnet.SetTransportDefaults(&http.Transport{ + httpTransport := utilnet.SetTransportDefaults(&http.Transport{ Proxy: proxy, TLSHandshakeTimeout: 10 * time.Second, TLSClientConfig: tlsConfig, @@ -139,13 +152,101 @@ func (c *tlsTransportCache) get(config *Config) (http.RoundTripper, error) { DialContext: dial, DisableCompression: config.DisableCompression, }) + var transport http.RoundTripper = httpTransport + + if config.TLS.ReloadCAFiles && tlsConfig != nil && tlsConfig.RootCAs != nil && len(config.TLS.CAFile) > 0 { + transport = newAtomicTransportHolder(config.TLS.CAFile, config.TLS.CAData, httpTransport) + } + + if !canCache && cancel == nil { + return transport, nil // uncacheable config with no cert rotation - nothing to GC + } + + if !clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.ClientsAllowTLSCacheGC) { + if canCache { + c.strongTransports[key] = transport + } + return transport, nil // cancel is intentionally discarded and the cert rotation go routine leaks + } + + transportWithGC := &trackedTransport{rt: transport} + + if cancel != nil { + // capture metric as local var so that cleanups do not influence other tests via globals + transportCertRotationGCCalls := metrics.TransportCertRotationGCCalls + runtime.AddCleanup(transportWithGC, func(_ struct{}) { + cancel() + transportCertRotationGCCalls.Increment() + }, struct{}{}) + } if canCache { - // Cache a single transport for these options - c.transports[key] = transport + wp := weak.Make(transportWithGC) + c.transports[key] = wp + // capture metrics as local vars so that cleanups do not influence other tests via globals + transportCacheGCCalls := metrics.TransportCacheGCCalls + transportCacheEntries := metrics.TransportCacheEntries + runtime.AddCleanup(transportWithGC, func(key tlsCacheKey) { + c.mu.Lock() + defer c.mu.Unlock() + + // make sure we only delete the weak pointer created by this specific setLocked call + if c.transports[key] != wp { + transportCacheGCCalls.Increment("skipped") + return + } + delete(c.transports, key) + transportCacheGCCalls.Increment("deleted") + transportCacheEntries.Observe(c.lenLocked()) + }, key) } - return transport, nil + return transportWithGC, nil +} + +func (c *tlsTransportCache) getLocked(key tlsCacheKey) (http.RoundTripper, bool) { + if !clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.ClientsAllowTLSCacheGC) { + v, ok := c.strongTransports[key] + return v, ok + } + + wp, ok := c.transports[key] + if !ok { + return nil, false + } + + v := wp.Value() + + if v == nil { // avoid typed nil + return nil, true // key exists but value has been garbage collected + } + + return v, true +} + +func (c *tlsTransportCache) lenLocked() int { + if !clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.ClientsAllowTLSCacheGC) { + return len(c.strongTransports) + } + return len(c.transports) +} + +// trackedTransport wraps an http.RoundTripper to serve as the weak.Pointer +// target in the TLS transport cache. Dropping all references to this object +// triggers GC cleanup of the cache entry and any cert rotation goroutine. +type trackedTransport struct { + rt http.RoundTripper +} + +var _ http.RoundTripper = &trackedTransport{} +var _ utilnet.RoundTripperWrapper = &trackedTransport{} + +func (v *trackedTransport) RoundTrip(req *http.Request) (*http.Response, error) { + return v.rt.RoundTrip(req) +} + +func (v *trackedTransport) WrappedRoundTripper() http.RoundTripper { + return v.rt } // tlsConfigKey returns a unique key for tls.Config objects returned from TLSConfigFor @@ -162,7 +263,6 @@ func tlsConfigKey(c *Config) (tlsCacheKey, bool, error) { k := tlsCacheKey{ insecure: c.TLS.Insecure, - caData: string(c.TLS.CAData), serverName: c.TLS.ServerName, nextProtos: strings.Join(c.TLS.NextProtos, ","), disableCompression: c.DisableCompression, @@ -178,5 +278,14 @@ func tlsConfigKey(c *Config) (tlsCacheKey, bool, error) { k.keyData = string(c.TLS.KeyData) } + if c.TLS.ReloadCAFiles { + // When reloading CA files, include CA file path in cache key instead of CA data + // This allows the CA to be reloaded from disk on each transport creation + k.caFile = c.TLS.CAFile + } else { + // When not reloading, cache the CA data directly + k.caData = string(c.TLS.CAData) + } + return k, true, nil } diff --git a/vendor/k8s.io/client-go/transport/config.go b/vendor/k8s.io/client-go/transport/config.go index d8a3d64b30..f3ddcca33c 100644 --- a/vendor/k8s.io/client-go/transport/config.go +++ b/vendor/k8s.io/client-go/transport/config.go @@ -134,7 +134,8 @@ type TLSConfig struct { CAFile string // Path of the PEM-encoded server trusted root certificates. CertFile string // Path of the PEM-encoded client certificate. KeyFile string // Path of the PEM-encoded client key. - ReloadTLSFiles bool // Set to indicate that the original config provided files, and that they should be reloaded + ReloadTLSFiles bool // Set to indicate that the original config provided files, and that they should be reloaded. + ReloadCAFiles bool // Set to indicate that CA files should be reloaded from disk. Insecure bool // Server should be accessed without verifying the certificate. For testing only. ServerName string // Override for the server name passed to the server for SNI and used to verify certificates. diff --git a/vendor/k8s.io/client-go/transport/round_trippers.go b/vendor/k8s.io/client-go/transport/round_trippers.go index 39fcebd941..a50977671a 100644 --- a/vendor/k8s.io/client-go/transport/round_trippers.go +++ b/vendor/k8s.io/client-go/transport/round_trippers.go @@ -319,7 +319,7 @@ func (rt *bearerAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, token = refreshedToken.AccessToken } } - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) + req.Header.Set("Authorization", "Bearer "+token) return rt.rt.RoundTrip(req) } diff --git a/vendor/k8s.io/client-go/transport/spdy/spdy.go b/vendor/k8s.io/client-go/transport/spdy/spdy.go index 9fddc6c5f2..3bb04b77f3 100644 --- a/vendor/k8s.io/client-go/transport/spdy/spdy.go +++ b/vendor/k8s.io/client-go/transport/spdy/spdy.go @@ -23,8 +23,10 @@ import ( "time" "k8s.io/apimachinery/pkg/util/httpstream" - "k8s.io/apimachinery/pkg/util/httpstream/spdy" + httpstreamspdy "k8s.io/apimachinery/pkg/util/httpstream/spdy" restclient "k8s.io/client-go/rest" + "k8s.io/klog/v2" + streamhttp "k8s.io/streaming/pkg/httpstream" ) // Upgrader validates a response from the server after a SPDY upgrade. @@ -43,7 +45,7 @@ func RoundTripperFor(config *restclient.Config) (http.RoundTripper, Upgrader, er if config.Proxy != nil { proxy = config.Proxy } - upgradeRoundTripper, err := spdy.NewRoundTripperWithConfig(spdy.RoundTripperConfig{ + upgradeRoundTripper, err := httpstreamspdy.NewRoundTripperWithConfig(httpstreamspdy.RoundTripperConfig{ TLS: tlsConfig, Proxier: proxy, PingPeriod: time.Second * 5, @@ -79,6 +81,18 @@ func NewDialer(upgrader Upgrader, client *http.Client, method string, url *url.U } } +// NewDialerForStreaming creates a SPDY dialer for in-tree callers that use +// k8s.io/streaming/pkg/httpstream types. +func NewDialerForStreaming(upgrader Upgrader, client *http.Client, method string, url *url.URL) streamhttp.Dialer { + return &streamingDialerAdapter{delegate: NewDialer(upgrader, client, method, url)} +} + +// NewUpgraderForStreaming adapts a streaming upgrader for callers that need +// the compatibility Upgrader interface. +func NewUpgraderForStreaming(upgrader streamhttp.UpgradeRoundTripper) Upgrader { + return &compatUpgraderAdapter{delegate: upgrader} +} + func (d *dialer) Dial(protocols ...string) (httpstream.Connection, string, error) { req, err := http.NewRequest(d.method, d.url.String(), nil) if err != nil { @@ -105,3 +119,199 @@ func Negotiate(upgrader Upgrader, client *http.Client, req *http.Request, protoc } return conn, resp.Header.Get(httpstream.HeaderProtocolVersion), nil } + +// NegotiateStreaming is for in-tree callers that still operate on +// k8s.io/streaming/pkg/httpstream types. +func NegotiateStreaming(upgrader Upgrader, client *http.Client, req *http.Request, protocols ...string) (streamhttp.Connection, string, error) { + conn, protocol, err := Negotiate(upgrader, client, req, protocols...) + if err != nil { + return nil, "", err + } + return wrapStreamingConnection(conn), protocol, nil +} + +type streamingDialerAdapter struct { + delegate httpstream.Dialer +} + +func (d *streamingDialerAdapter) Dial(protocols ...string) (streamhttp.Connection, string, error) { + conn, protocol, err := d.delegate.Dial(protocols...) + if err != nil { + return nil, "", err + } + return wrapStreamingConnection(conn), protocol, nil +} + +type compatUpgraderAdapter struct { + delegate streamhttp.UpgradeRoundTripper +} + +func (u *compatUpgraderAdapter) NewConnection(resp *http.Response) (httpstream.Connection, error) { + conn, err := u.delegate.NewConnection(resp) + if err != nil { + return nil, err + } + return wrapCompatConnection(conn), nil +} + +type streamingStreamAdapter struct { + delegate httpstream.Stream +} + +func (s *streamingStreamAdapter) Read(p []byte) (int, error) { + return s.delegate.Read(p) +} + +func (s *streamingStreamAdapter) Write(p []byte) (int, error) { + return s.delegate.Write(p) +} + +func (s *streamingStreamAdapter) Close() error { + return s.delegate.Close() +} + +func (s *streamingStreamAdapter) Reset() error { + return s.delegate.Reset() +} + +func (s *streamingStreamAdapter) Headers() http.Header { + return s.delegate.Headers() +} + +func (s *streamingStreamAdapter) Identifier() uint32 { + return s.delegate.Identifier() +} + +type streamingConnectionAdapter struct { + delegate httpstream.Connection +} + +func (c *streamingConnectionAdapter) CreateStream(headers http.Header) (streamhttp.Stream, error) { + stream, err := c.delegate.CreateStream(headers) + if err != nil { + return nil, err + } + return &streamingStreamAdapter{delegate: stream}, nil +} + +func (c *streamingConnectionAdapter) Close() error { + return c.delegate.Close() +} + +func (c *streamingConnectionAdapter) CloseChan() <-chan bool { + return c.delegate.CloseChan() +} + +func (c *streamingConnectionAdapter) SetIdleTimeout(timeout time.Duration) { + c.delegate.SetIdleTimeout(timeout) +} + +func (c *streamingConnectionAdapter) RemoveStreams(streams ...streamhttp.Stream) { + compatStreams := make([]httpstream.Stream, 0, len(streams)) + for _, stream := range streams { + if stream == nil { + continue + } + if s, ok := stream.(*streamingStreamAdapter); ok { + compatStreams = append(compatStreams, s.delegate) + continue + } + if s, ok := stream.(httpstream.Stream); ok { + compatStreams = append(compatStreams, s) + continue + } + klog.V(5).Infof("dropping unadaptable streaming stream %T in RemoveStreams", stream) + } + c.delegate.RemoveStreams(compatStreams...) +} + +func wrapStreamingConnection(conn httpstream.Connection) streamhttp.Connection { + if conn == nil { + return nil + } + if wrapped, ok := conn.(*compatConnectionAdapter); ok { + return wrapped.delegate + } + return &streamingConnectionAdapter{delegate: conn} +} + +type compatStreamAdapter struct { + delegate streamhttp.Stream +} + +func (s *compatStreamAdapter) Read(p []byte) (int, error) { + return s.delegate.Read(p) +} + +func (s *compatStreamAdapter) Write(p []byte) (int, error) { + return s.delegate.Write(p) +} + +func (s *compatStreamAdapter) Close() error { + return s.delegate.Close() +} + +func (s *compatStreamAdapter) Reset() error { + return s.delegate.Reset() +} + +func (s *compatStreamAdapter) Headers() http.Header { + return s.delegate.Headers() +} + +func (s *compatStreamAdapter) Identifier() uint32 { + return s.delegate.Identifier() +} + +type compatConnectionAdapter struct { + delegate streamhttp.Connection +} + +func (c *compatConnectionAdapter) CreateStream(headers http.Header) (httpstream.Stream, error) { + stream, err := c.delegate.CreateStream(headers) + if err != nil { + return nil, err + } + return &compatStreamAdapter{delegate: stream}, nil +} + +func (c *compatConnectionAdapter) Close() error { + return c.delegate.Close() +} + +func (c *compatConnectionAdapter) CloseChan() <-chan bool { + return c.delegate.CloseChan() +} + +func (c *compatConnectionAdapter) SetIdleTimeout(timeout time.Duration) { + c.delegate.SetIdleTimeout(timeout) +} + +func (c *compatConnectionAdapter) RemoveStreams(streams ...httpstream.Stream) { + streamingStreams := make([]streamhttp.Stream, 0, len(streams)) + for _, stream := range streams { + if stream == nil { + continue + } + if s, ok := stream.(*compatStreamAdapter); ok { + streamingStreams = append(streamingStreams, s.delegate) + continue + } + if s, ok := stream.(streamhttp.Stream); ok { + streamingStreams = append(streamingStreams, s) + continue + } + klog.V(5).Infof("dropping unadaptable compat stream %T in RemoveStreams", stream) + } + c.delegate.RemoveStreams(streamingStreams...) +} + +func wrapCompatConnection(conn streamhttp.Connection) httpstream.Connection { + if conn == nil { + return nil + } + if wrapped, ok := conn.(*streamingConnectionAdapter); ok { + return wrapped.delegate + } + return &compatConnectionAdapter{delegate: conn} +} diff --git a/vendor/k8s.io/client-go/transport/transport.go b/vendor/k8s.io/client-go/transport/transport.go index 8fdcc5700b..be97b76210 100644 --- a/vendor/k8s.io/client-go/transport/transport.go +++ b/vendor/k8s.io/client-go/transport/transport.go @@ -28,6 +28,7 @@ import ( "time" utilnet "k8s.io/apimachinery/pkg/util/net" + clientgofeaturegate "k8s.io/client-go/features" "k8s.io/klog/v2" ) @@ -211,17 +212,26 @@ func TLSConfigFor(c *Config) (*tls.Config, error) { // KeyData, and CAFile fields, or returns an error. If no error is returned, all three fields are // either populated or were empty to start. func loadTLSFiles(c *Config) error { - var err error - c.TLS.CAData, err = dataFromSliceOrFile(c.TLS.CAData, c.TLS.CAFile) - if err != nil { - return err + // Check that we are purely loading CA from file + if clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.ClientsAllowCARotation) { + if len(c.TLS.CAFile) > 0 && len(c.TLS.CAData) == 0 { + c.TLS.ReloadCAFiles = true + } + } else if c.TLS.ReloadCAFiles { + return fmt.Errorf("ReloadCAFiles=true requires ClientsAllowCARotation to be enabled") } - // Check that we are purely loading from files + // Check that we are purely loading certs and keys from files if len(c.TLS.CertFile) > 0 && len(c.TLS.CertData) == 0 && len(c.TLS.KeyFile) > 0 && len(c.TLS.KeyData) == 0 { c.TLS.ReloadTLSFiles = true } + var err error + c.TLS.CAData, err = dataFromSliceOrFile(c.TLS.CAData, c.TLS.CAFile) + if err != nil { + return err + } + c.TLS.CertData, err = dataFromSliceOrFile(c.TLS.CertData, c.TLS.CertFile) if err != nil { return err @@ -254,6 +264,11 @@ func rootCertPool(caData []byte) (*x509.CertPool, error) { // code for a look at the platform specific insanity), so we'll use the fact that RootCAs == nil gives us the system values // It doesn't allow trusting either/or, but hopefully that won't be an issue if len(caData) == 0 { + // When the ClientsAllowCARotation feature gate is enabled, it returns an empty but non-nil pool. + // This ensures we don't fall back to system roots when a user explicitly points CAFile to a zero-byte file. + if clientgofeaturegate.FeatureGates().Enabled(clientgofeaturegate.ClientsAllowCARotation) { + return x509.NewCertPool(), nil + } return nil, nil } diff --git a/vendor/k8s.io/client-go/transport/websocket/roundtripper.go b/vendor/k8s.io/client-go/transport/websocket/roundtripper.go index 924518e8bb..5285d6b144 100644 --- a/vendor/k8s.io/client-go/transport/websocket/roundtripper.go +++ b/vendor/k8s.io/client-go/transport/websocket/roundtripper.go @@ -31,11 +31,11 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" - "k8s.io/apimachinery/pkg/util/httpstream" - "k8s.io/apimachinery/pkg/util/httpstream/wsstream" utilnet "k8s.io/apimachinery/pkg/util/net" restclient "k8s.io/client-go/rest" "k8s.io/client-go/transport" + "k8s.io/streaming/pkg/httpstream" + "k8s.io/streaming/pkg/httpstream/wsstream" ) var ( diff --git a/vendor/k8s.io/client-go/util/watchlist/watch_list.go b/vendor/k8s.io/client-go/util/watchlist/watch_list.go index 1551a49f79..3641f3baee 100644 --- a/vendor/k8s.io/client-go/util/watchlist/watch_list.go +++ b/vendor/k8s.io/client-go/util/watchlist/watch_list.go @@ -90,6 +90,9 @@ type unSupportedWatchListSemantics interface { // // A client does NOT support WatchList only if // it implements `IsWatchListSemanticsUnSupported` and that returns true. +// +// For an explanation of how WatchList works, see: +// https://kubernetes.io/docs/reference/using-api/api-concepts/#streaming-lists func DoesClientNotSupportWatchListSemantics(client any) bool { lw, ok := client.(unSupportedWatchListSemantics) if !ok { diff --git a/vendor/k8s.io/cloud-provider/OWNERS b/vendor/k8s.io/cloud-provider/OWNERS index 1ac1c0f0e6..3f7357c0b6 100644 --- a/vendor/k8s.io/cloud-provider/OWNERS +++ b/vendor/k8s.io/cloud-provider/OWNERS @@ -1,11 +1,9 @@ # See the OWNERS docs at https://go.k8s.io/owners approvers: - - mikedanese - - dims - - wlan0 - - andrewsykim - cheftako + - elmiko + - joelspeed reviewers: - aojea - wojtek-t @@ -25,6 +23,10 @@ reviewers: - wlan0 - cheftako - andrewsykim +emeritus_approvers: + - mikedanese + - dims + - andrewsykim labels: - sig/cloud-provider - area/cloudprovider diff --git a/vendor/k8s.io/cloud-provider/app/controllermanager.go b/vendor/k8s.io/cloud-provider/app/controllermanager.go index bac66988fe..340308a066 100644 --- a/vendor/k8s.io/cloud-provider/app/controllermanager.go +++ b/vendor/k8s.io/cloud-provider/app/controllermanager.go @@ -41,6 +41,7 @@ import ( "k8s.io/client-go/tools/leaderelection/resourcelock" cloudprovider "k8s.io/cloud-provider" cloudcontrollerconfig "k8s.io/cloud-provider/app/config" + configv1alpha "k8s.io/cloud-provider/config/v1alpha1" "k8s.io/cloud-provider/names" "k8s.io/cloud-provider/options" cliflag "k8s.io/component-base/cli/flag" @@ -88,12 +89,14 @@ func NewCloudControllerManagerCommand(s *options.CloudControllerManagerOptions, the cloud specific control loops shipped with Kubernetes.`, RunE: func(cmd *cobra.Command, args []string) error { verflag.PrintAndExitIfRequested() - cliflag.PrintFlags(cmd.Flags()) + // Activate logging as soon as possible, after that + // show flags with the final logging configuration. if err := logsapi.ValidateAndApply(logOptions, utilfeature.DefaultFeatureGate); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) return err } + cliflag.PrintFlags(cmd.Flags()) c, err := s.Config(ControllerNames(controllerInitFuncConstructors), ControllersDisabledByDefault.List(), controllerAliases, AllWebhooks, DisabledByDefaultWebhooks) if err != nil { @@ -164,11 +167,17 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface c.EventBroadcaster.StartRecordingToSink(&v1core.EventSinkImpl{Interface: c.Client.CoreV1().Events("")}) defer c.EventBroadcaster.Shutdown() + externalConfig := &configv1alpha.CloudControllerManagerConfiguration{} + if err := configv1alpha.Convert_config_CloudControllerManagerConfiguration_To_v1alpha1_CloudControllerManagerConfiguration(&c.ComponentConfig, externalConfig, nil); err != nil { + return fmt.Errorf("unable to convert configz: %w", err) + } + externalConfig.SetGroupVersionKind(configv1alpha.SchemeGroupVersion.WithKind("CloudControllerManagerConfiguration")) + // setup /configz endpoint - if cz, err := configz.New(ConfigzName); err == nil { - cz.Set(c.ComponentConfig) - } else { - klog.Errorf("unable to register configz: %v", err) + if cz, err := configz.New(ConfigzName); err != nil { + return fmt.Errorf("unable to register configz: %w", err) + } else if err := cz.Set(externalConfig); err != nil { + return fmt.Errorf("unable to set configz: %w", err) } // Setup any health checks we will want to use. diff --git a/vendor/k8s.io/cloud-provider/app/core.go b/vendor/k8s.io/cloud-provider/app/core.go index f1a324e3ff..3acbb4e8c1 100644 --- a/vendor/k8s.io/cloud-provider/app/core.go +++ b/vendor/k8s.io/cloud-provider/app/core.go @@ -48,6 +48,7 @@ func startCloudNodeController(ctx context.Context, initContext ControllerInitCon cloud, completedConfig.ComponentConfig.NodeStatusUpdateFrequency.Duration, completedConfig.ComponentConfig.NodeController.ConcurrentNodeSyncs, + completedConfig.ComponentConfig.NodeController.ConcurrentNodeStatusUpdates, ) if err != nil { klog.Warningf("failed to start cloud node controller: %s", err) diff --git a/vendor/k8s.io/cloud-provider/controllers/node/config/types.go b/vendor/k8s.io/cloud-provider/controllers/node/config/types.go index af7c788035..1879de834d 100644 --- a/vendor/k8s.io/cloud-provider/controllers/node/config/types.go +++ b/vendor/k8s.io/cloud-provider/controllers/node/config/types.go @@ -21,4 +21,8 @@ type NodeControllerConfiguration struct { // ConcurrentNodeSyncs is the number of workers // concurrently synchronizing nodes ConcurrentNodeSyncs int32 + // ConcurrentNodeStatusUpdates is the number of workers + // concurrently updating node statuses. + // If unspecified or 0, ConcurrentNodeSyncs is used instead + ConcurrentNodeStatusUpdates int32 } diff --git a/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/types.go b/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/types.go index ca85a557cb..0c9234fbc0 100644 --- a/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/types.go +++ b/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/types.go @@ -21,4 +21,8 @@ type NodeControllerConfiguration struct { // ConcurrentNodeSyncs is the number of workers // concurrently synchronizing nodes ConcurrentNodeSyncs int32 + // ConcurrentNodeStatusUpdates is the number of workers + // concurrently updating node statuses. + // If unspecified or 0, ConcurrentNodeSyncs is used instead + ConcurrentNodeStatusUpdates int32 } diff --git a/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.conversion.go b/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.conversion.go index cf3852db29..89ccc8833a 100644 --- a/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.conversion.go +++ b/vendor/k8s.io/cloud-provider/controllers/node/config/v1alpha1/zz_generated.conversion.go @@ -49,10 +49,12 @@ func RegisterConversions(s *runtime.Scheme) error { func autoConvert_v1alpha1_NodeControllerConfiguration_To_config_NodeControllerConfiguration(in *NodeControllerConfiguration, out *config.NodeControllerConfiguration, s conversion.Scope) error { out.ConcurrentNodeSyncs = in.ConcurrentNodeSyncs + out.ConcurrentNodeStatusUpdates = in.ConcurrentNodeStatusUpdates return nil } func autoConvert_config_NodeControllerConfiguration_To_v1alpha1_NodeControllerConfiguration(in *config.NodeControllerConfiguration, out *NodeControllerConfiguration, s conversion.Scope) error { out.ConcurrentNodeSyncs = in.ConcurrentNodeSyncs + out.ConcurrentNodeStatusUpdates = in.ConcurrentNodeStatusUpdates return nil } diff --git a/vendor/k8s.io/cloud-provider/controllers/node/node_controller.go b/vendor/k8s.io/cloud-provider/controllers/node/node_controller.go index a1fa02b7d8..66f7ed17a0 100644 --- a/vendor/k8s.io/cloud-provider/controllers/node/node_controller.go +++ b/vendor/k8s.io/cloud-provider/controllers/node/node_controller.go @@ -106,6 +106,7 @@ type CloudNodeController struct { nodeStatusUpdateFrequency time.Duration workerCount int32 + statusUpdateWorkerCount int32 nodesLister corelisters.NodeLister nodesSynced cache.InformerSynced @@ -118,7 +119,8 @@ func NewCloudNodeController( kubeClient clientset.Interface, cloud cloudprovider.Interface, nodeStatusUpdateFrequency time.Duration, - workerCount int32) (*CloudNodeController, error) { + workerCount, + statusUpdateWorkerCount int32) (*CloudNodeController, error) { _, instancesSupported := cloud.Instances() _, instancesV2Supported := cloud.InstancesV2() @@ -132,6 +134,7 @@ func NewCloudNodeController( cloud: cloud, nodeStatusUpdateFrequency: nodeStatusUpdateFrequency, workerCount: workerCount, + statusUpdateWorkerCount: statusUpdateWorkerCount, nodesLister: nodeInformer.Lister(), nodesSynced: nodeInformer.Informer().HasSynced, workqueue: workqueue.NewTypedRateLimitingQueueWithConfig( @@ -289,7 +292,7 @@ func (cnc *CloudNodeController) UpdateNodeStatus(ctx context.Context) error { cnc.updateNodeAddress(ctx, node, instanceMetadata) } - workqueue.ParallelizeUntil(ctx, int(cnc.workerCount), len(nodes), updateNodeFunc) + workqueue.ParallelizeUntil(ctx, int(cnc.statusUpdateWorkerCount), len(nodes), updateNodeFunc) return nil } diff --git a/vendor/k8s.io/cloud-provider/controllers/route/metrics.go b/vendor/k8s.io/cloud-provider/controllers/route/metrics.go new file mode 100644 index 0000000000..27a375e087 --- /dev/null +++ b/vendor/k8s.io/cloud-provider/controllers/route/metrics.go @@ -0,0 +1,46 @@ +/* +Copyright 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. +*/ + +package route + +import ( + "sync" + + "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" +) + +const ( + // subsystem is the name of this subsystem used for prometheus metrics. + subsystem = "route_controller" +) + +var registration sync.Once + +var ( + routeSyncCount = metrics.NewCounter(&metrics.CounterOpts{ + Name: "route_sync_total", + Subsystem: subsystem, + Help: "A metric counting the amount of times routes have been synced with the cloud provider.", + StabilityLevel: metrics.ALPHA, + }) +) + +func registerMetrics() { + registration.Do(func() { + legacyregistry.MustRegister(routeSyncCount) + }) +} diff --git a/vendor/k8s.io/cloud-provider/controllers/route/route_controller.go b/vendor/k8s.io/cloud-provider/controllers/route/route_controller.go index c7e6c57e7d..12cc3cb7fb 100644 --- a/vendor/k8s.io/cloud-provider/controllers/route/route_controller.go +++ b/vendor/k8s.io/cloud-provider/controllers/route/route_controller.go @@ -25,6 +25,7 @@ import ( "time" "golang.org/x/time/rate" + "k8s.io/klog/v2" netutils "k8s.io/utils/net" @@ -87,6 +88,8 @@ func New( clusterName string, clusterCIDRs []*net.IPNet, ) (*RouteController, error) { + registerMetrics() + if len(clusterCIDRs) == 0 { klog.Fatal("RouteController: Must specify clusterCIDR.") } @@ -247,6 +250,8 @@ func (rc *RouteController) processNextWorkItem(ctx context.Context) bool { } func (rc *RouteController) reconcileNodeRoutes(ctx context.Context) error { + routeSyncCount.Inc() + routeList, err := rc.routes.ListRoutes(ctx, rc.clusterName) if err != nil { return fmt.Errorf("error listing routes: %v", err) @@ -436,7 +441,7 @@ func (rc *RouteController) reconcile(ctx context.Context, nodes []*v1.Node, rout Name: string(nodeName), UID: node.UID, Namespace: "", - }, v1.EventTypeWarning, "FailedToCreateRoute", msg) + }, v1.EventTypeWarning, "FailedToCreateRoute", "%s", msg) klog.V(4).Info(msg) return err } @@ -497,12 +502,12 @@ func (rc *RouteController) reconcile(ctx context.Context, nodes []*v1.Node, rout func (rc *RouteController) updateNetworkingCondition(node *v1.Node, routesCreated bool) error { _, condition := nodeutil.GetNodeCondition(&(node.Status), v1.NodeNetworkUnavailable) - if routesCreated && condition != nil && condition.Status == v1.ConditionFalse { + if routesCreated && condition != nil && condition.Status == v1.ConditionFalse && condition.Reason == "RouteCreated" { klog.V(2).Infof("set node %v with NodeNetworkUnavailable=false was canceled because it is already set", node.Name) return nil } - if !routesCreated && condition != nil && condition.Status == v1.ConditionTrue { + if !routesCreated && condition != nil && condition.Status == v1.ConditionTrue && condition.Reason == "NoRouteCreated" { klog.V(2).Infof("set node %v with NodeNetworkUnavailable=true was canceled because it is already set", node.Name) return nil } diff --git a/vendor/k8s.io/cloud-provider/options/nodecontroller.go b/vendor/k8s.io/cloud-provider/options/nodecontroller.go index 4823c437b1..9573276db0 100644 --- a/vendor/k8s.io/cloud-provider/options/nodecontroller.go +++ b/vendor/k8s.io/cloud-provider/options/nodecontroller.go @@ -36,6 +36,8 @@ func (o *NodeControllerOptions) AddFlags(fs *pflag.FlagSet) { } fs.Int32Var(&o.ConcurrentNodeSyncs, "concurrent-node-syncs", o.ConcurrentNodeSyncs, "Number of workers concurrently synchronizing nodes.") + // If concurrent-node-status-updates is not specified it will be derived from concurrent-node-syncs for backwards compatibility + fs.Int32Var(&o.ConcurrentNodeStatusUpdates, "concurrent-node-status-updates", 0, "Number of workers concurrently updating node statuses. If unspecified or 0, --concurrent-node-syncs is used instead") } // ApplyTo fills up ServiceController config with options. @@ -45,6 +47,13 @@ func (o *NodeControllerOptions) ApplyTo(cfg *nodeconfig.NodeControllerConfigurat } cfg.ConcurrentNodeSyncs = o.ConcurrentNodeSyncs + // Concurrent node status updates used to be derived from the concurrent-node-syncs flag, + // so for backwards compatibility it will default to concurrent-node-syncs if concurrent-node-status-updates is not specified + if o.ConcurrentNodeStatusUpdates > 0 { + cfg.ConcurrentNodeStatusUpdates = o.ConcurrentNodeStatusUpdates + } else { + cfg.ConcurrentNodeStatusUpdates = o.ConcurrentNodeSyncs + } return nil } @@ -58,5 +67,8 @@ func (o *NodeControllerOptions) Validate() []error { if o.ConcurrentNodeSyncs <= 0 { errors = append(errors, fmt.Errorf("concurrent-node-syncs must be a positive number")) } + if o.ConcurrentNodeStatusUpdates < 0 { + errors = append(errors, fmt.Errorf("concurrent-node-status-updates cannot be a negative number")) + } return errors } diff --git a/vendor/k8s.io/cloud-provider/options/options.go b/vendor/k8s.io/cloud-provider/options/options.go index 0534f9f614..2f24aab31d 100644 --- a/vendor/k8s.io/cloud-provider/options/options.go +++ b/vendor/k8s.io/cloud-provider/options/options.go @@ -242,7 +242,9 @@ func (o *CloudControllerManagerOptions) ApplyTo(c *config.Config, allControllers // sync back to component config // TODO: find more elegant way than syncing back the values. c.ComponentConfig.NodeStatusUpdateFrequency = o.NodeStatusUpdateFrequency - c.ComponentConfig.NodeController.ConcurrentNodeSyncs = o.NodeController.ConcurrentNodeSyncs + if err = o.NodeController.ApplyTo(&c.ComponentConfig.NodeController); err != nil { + return err + } return nil } diff --git a/vendor/k8s.io/cloud-provider/options/webhook.go b/vendor/k8s.io/cloud-provider/options/webhook.go index 5174ae80f1..8dfc011c54 100644 --- a/vendor/k8s.io/cloud-provider/options/webhook.go +++ b/vendor/k8s.io/cloud-provider/options/webhook.go @@ -29,6 +29,7 @@ import ( "k8s.io/apiserver/pkg/server/dynamiccertificates" apiserveroptions "k8s.io/apiserver/pkg/server/options" "k8s.io/cloud-provider/config" + cliflag "k8s.io/component-base/cli/flag" netutils "k8s.io/utils/net" ) @@ -124,18 +125,54 @@ func (o *WebhookServingOptions) AddFlags(fs *pflag.FlagSet) { fs.IntVar(&o.BindPort, "webhook-secure-port", o.BindPort, "Secure port to serve cloud provider webhooks. If 0, don't serve webhooks at all.") + fs.BoolVar(&o.DisableHTTP2Serving, "webhook-disable-http2-serving", o.DisableHTTP2Serving, + "If true, HTTP2 serving will be disabled for the webhook server [default=false]") + fs.StringVar(&o.ServerCert.CertDirectory, "webhook-cert-dir", o.ServerCert.CertDirectory, ""+ "The directory where the TLS certs are located. "+ - "If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.") + "If --webhook-tls-cert-file and --webhook-tls-private-key-file are provided, this flag will be ignored.") fs.StringVar(&o.ServerCert.CertKey.CertFile, "webhook-tls-cert-file", o.ServerCert.CertKey.CertFile, ""+ "File containing the default x509 Certificate for HTTPS. (CA cert, if any, concatenated "+ - "after server cert). If HTTPS serving is enabled, and --tls-cert-file and "+ - "--tls-private-key-file are not provided, a self-signed certificate and key "+ - "are generated for the public address and saved to the directory specified by --cert-dir.") + "after server cert). If HTTPS serving is enabled, and --webhook-tls-cert-file and "+ + "--webhook-tls-private-key-file are not provided, a self-signed certificate and key "+ + "are generated for the public address and saved to the directory specified by --webhook-cert-dir.") fs.StringVar(&o.ServerCert.CertKey.KeyFile, "webhook-tls-private-key-file", o.ServerCert.CertKey.KeyFile, - "File containing the default x509 private key matching --tls-cert-file.") + "File containing the default x509 private key matching --webhook-tls-cert-file.") + + tlsCipherPreferredValues := cliflag.PreferredTLSCipherNames() + tlsCipherInsecureValues := cliflag.InsecureTLSCipherNames() + fs.StringSliceVar(&o.CipherSuites, "webhook-tls-cipher-suites", o.CipherSuites, + "Comma-separated list of cipher suites for the webhook server. "+ + "If omitted, the default Go cipher suites will be used. \n"+ + "Preferred values: "+strings.Join(tlsCipherPreferredValues, ", ")+". \n"+ + "Insecure values: "+strings.Join(tlsCipherInsecureValues, ", ")+".") + + fs.Int32SliceVar(&o.CurvePreferences, "webhook-tls-curve-preferences", o.CurvePreferences, + "Comma-separated list of numeric Go crypto/tls CurveID values, "+ + "as the allowed key exchange mechanisms for the webhook server. "+ + "The supported values depend on the Go version used. "+ + "See https://pkg.go.dev/crypto/tls#CurveID for values supported for each Go version. "+ + "The order of the list is ignored, and key exchange mechanisms are chosen "+ + "by Go from this list using an internal preference order. "+ + "If omitted, the default Go curves will be used.") + + tlsPossibleVersions := cliflag.TLSPossibleVersions() + fs.StringVar(&o.MinTLSVersion, "webhook-tls-min-version", o.MinTLSVersion, + "Minimum TLS version supported for the webhook server. "+ + "Possible values: "+strings.Join(tlsPossibleVersions, ", ")) + + fs.Var(cliflag.NewNamedCertKeyArray(&o.SNICertKeys), "webhook-tls-sni-cert-key", ""+ + "A pair of x509 certificate and private key file paths, optionally suffixed with a list of "+ + "domain patterns which are fully qualified domain names, possibly with prefixed wildcard "+ + "segments. The domain patterns also allow IP addresses, but IPs should only be used if "+ + "the webhook server has visibility to the IP address requested by a client. "+ + "If no domain patterns are provided, the names of the certificate are "+ + "extracted. Non-wildcard matches trump over wildcard matches, explicit domain patterns "+ + "trump over extracted names. For multiple key/certificate pairs, use the "+ + "--webhook-tls-sni-cert-key multiple times. "+ + "Examples: \"example.crt,example.key\" or \"foo.crt,foo.key:*.foo.com,foo.com\".") } func (o *WebhookServingOptions) Validate() []error { @@ -176,19 +213,53 @@ func (o *WebhookServingOptions) ApplyTo(cfg **server.SecureServingInfo, webhookC } *cfg = &server.SecureServingInfo{ - Listener: listener, + Listener: listener, + DisableHTTP2: o.DisableHTTP2Serving, } + c := *cfg serverCertFile, serverKeyFile := o.ServerCert.CertKey.CertFile, o.ServerCert.CertKey.KeyFile if len(serverCertFile) != 0 || len(serverKeyFile) != 0 { var err error - (*cfg).Cert, err = dynamiccertificates.NewDynamicServingContentFromFiles("serving-cert", serverCertFile, serverKeyFile) + c.Cert, err = dynamiccertificates.NewDynamicServingContentFromFiles("serving-cert", serverCertFile, serverKeyFile) if err != nil { - return err + return fmt.Errorf("failed to load serving cert: %w", err) } } else if o.ServerCert.GeneratedCert != nil { - (*cfg).Cert = o.ServerCert.GeneratedCert + c.Cert = o.ServerCert.GeneratedCert + } + + if len(o.CipherSuites) != 0 { + cipherSuites, err := cliflag.TLSCipherSuites(o.CipherSuites) + if err != nil { + return fmt.Errorf("failed to parse cipher suites: %w", err) + } + c.CipherSuites = cipherSuites + } + + if len(o.CurvePreferences) != 0 { + curvePreferences, err := cliflag.TLSCurvePreferences(o.CurvePreferences) + if err != nil { + return fmt.Errorf("failed to parse curve preferences: %w", err) + } + c.CurvePreferences = curvePreferences + } + + c.MinTLSVersion, err = cliflag.TLSVersion(o.MinTLSVersion) + if err != nil { + return fmt.Errorf("failed to parse TLS version: %w", err) + } + + // load SNI certs + namedTLSCerts := make([]dynamiccertificates.SNICertKeyContentProvider, 0, len(o.SNICertKeys)) + for _, nck := range o.SNICertKeys { + tlsCert, err := dynamiccertificates.NewDynamicSNIContentFromFiles("sni-serving-cert", nck.CertFile, nck.KeyFile, nck.Names...) + if err != nil { + return fmt.Errorf("failed to load SNI cert and key: %w", err) + } + namedTLSCerts = append(namedTLSCerts, tlsCert) } + c.SNICerts = namedTLSCerts return nil } diff --git a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go index c5df71d666..bf49841944 100644 --- a/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go +++ b/vendor/k8s.io/code-generator/cmd/client-gen/generators/fake/generator_fake_for_clientset.go @@ -124,6 +124,10 @@ var managedFieldsClientset = ` // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, // without applying any validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. +// +// Compared to NewSimpleClientset, the Clientset returned here supports field tracking and thus +// server-side apply. Beware though that support in that for CRDs is missing +// (https://github.com/kubernetes/kubernetes/issues/126850). func NewClientset(objects ...runtime.Object) *Clientset { o := testing.NewFieldManagedObjectTracker( scheme, @@ -162,10 +166,6 @@ var common = ` // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, // without applying any field management, validations and/or defaults. It shouldn't be considered a replacement // for a real clientset and is mostly useful in simple unit tests. -// -// Deprecated: NewClientset replaces this with support for field management, which significantly improves -// server side apply testing. NewClientset is only available when apply configurations are generated (e.g. -// via --with-applyconfig). func NewSimpleClientset(objects ...runtime.Object) *Clientset { o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) for _, obj := range objects { @@ -211,7 +211,7 @@ func (c *Clientset) Tracker() testing.ObjectTracker { return c.tracker } -// IsWatchListSemanticsSupported informs the reflector that this client +// IsWatchListSemanticsUnSupported informs the reflector that this client // doesn't support WatchList semantics. // // This is a synthetic method whose sole purpose is to satisfy the optional diff --git a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go index f5207a980e..a437189b58 100644 --- a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go +++ b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/args/args.go @@ -24,7 +24,6 @@ import ( type Args struct { OutputFile string - BoundingDirs []string // Only deal with types rooted under these dirs. GoHeaderFile string } @@ -37,8 +36,6 @@ func New() *Args { func (args *Args) AddFlags(fs *pflag.FlagSet) { fs.StringVar(&args.OutputFile, "output-file", "generated.deepcopy.go", "the name of the file to be generated") - fs.StringSliceVar(&args.BoundingDirs, "bounding-dirs", args.BoundingDirs, - "Comma-separated list of import paths which bound the types for which deep-copies will be generated.") fs.StringVar(&args.GoHeaderFile, "go-header-file", "", "the path to a file containing boilerplate header text; the string \"YEAR\" will be replaced with the current 4-digit year") } diff --git a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go index 0d86cd39cb..ace09baa23 100644 --- a/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go +++ b/vendor/k8s.io/code-generator/cmd/deepcopy-gen/generators/deepcopy.go @@ -128,16 +128,6 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target klog.Fatalf("Failed loading boilerplate: %v", err) } - boundingDirs := []string{} - if args.BoundingDirs == nil { - args.BoundingDirs = context.Inputs - } - for i := range args.BoundingDirs { - // Strip any trailing slashes - they are not exactly "correct" but - // this is friendlier. - boundingDirs = append(boundingDirs, strings.TrimRight(args.BoundingDirs[i], "/")) - } - targets := []generator.Target{} for _, i := range context.Inputs { @@ -197,7 +187,7 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target }, GeneratorsFunc: func(c *generator.Context) (generators []generator.Generator) { return []generator.Generator{ - NewGenDeepCopy(args.OutputFile, pkg.Path, boundingDirs, (ptagValue == tagValuePackage), ptagRegister), + NewGenDeepCopy(args.OutputFile, pkg.Path, (ptagValue == tagValuePackage), ptagRegister), } }, }) @@ -210,20 +200,18 @@ func GetTargets(context *generator.Context, args *args.Args) []generator.Target type genDeepCopy struct { generator.GoGenerator targetPackage string - boundingDirs []string allTypes bool registerTypes bool imports namer.ImportTracker typesForInit []*types.Type } -func NewGenDeepCopy(outputFilename, targetPackage string, boundingDirs []string, allTypes, registerTypes bool) generator.Generator { +func NewGenDeepCopy(outputFilename, targetPackage string, allTypes, registerTypes bool) generator.Generator { return &genDeepCopy{ GoGenerator: generator.GoGenerator{ OutputFilename: outputFilename, }, targetPackage: targetPackage, - boundingDirs: boundingDirs, allTypes: allTypes, registerTypes: registerTypes, imports: generator.NewImportTrackerForPackage(targetPackage), diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go index a005f5e5e8..237de9342f 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factory.go @@ -74,8 +74,15 @@ func (g *factoryGenerator) GenerateType(c *generator.Context, t *types.Type, w i gvNewFuncs[groupPkgName] = c.Universe.Function(types.Name{Package: path.Join(g.outputPackage, groupPkgName), Name: "New"}) } m := map[string]interface{}{ + "cacheDoneChecker": c.Universe.Type(cacheDoneChecker), + "cacheInformerName": c.Universe.Type(cacheInformerName), "cacheSharedIndexInformer": c.Universe.Type(cacheSharedIndexInformer), + "cacheSyncResult": c.Universe.Type(cacheSyncResult), "cacheTransformFunc": c.Universe.Type(cacheTransformFunc), + "cacheWaitFor": c.Universe.Function(cacheWaitForFunc), + "contextContext": c.Universe.Type(contextContext), + "contextCause": c.Universe.Function(contextCauseFunc), + "fmtErrorf": c.Universe.Function(fmtErrorfFunc), "groupVersions": g.groupVersions, "gvInterfaces": gvInterfaces, "gvNewFuncs": gvNewFuncs, @@ -87,10 +94,12 @@ func (g *factoryGenerator) GenerateType(c *generator.Context, t *types.Type, w i "reflectType": c.Universe.Type(reflectType), "runtimeObject": c.Universe.Type(runtimeObject), "schemaGroupVersionResource": c.Universe.Type(schemaGroupVersionResource), + "stringsBuilder": c.Universe.Type(stringsBuilder), "syncMutex": c.Universe.Type(syncMutex), "timeDuration": c.Universe.Type(timeDuration), "namespaceAll": c.Universe.Type(metav1NamespaceAll), "object": c.Universe.Type(metav1Object), + "waitContextForChannel": c.Universe.Function(waitContextForChannelFunc), } sw.Do(sharedInformerFactoryStruct, m) @@ -111,6 +120,7 @@ type sharedInformerFactory struct { defaultResync {{.timeDuration|raw}} customResync map[{{.reflectType|raw}}]{{.timeDuration|raw}} transform {{.cacheTransformFunc|raw}} + informerName *{{.cacheInformerName|raw}} informers map[{{.reflectType|raw}}]{{.cacheSharedIndexInformer|raw}} // startedInformers is used for tracking which informers have been started. @@ -157,6 +167,21 @@ func WithTransform(transform {{.cacheTransformFunc|raw}}) SharedInformerOption { } } +// WithInformerName sets the InformerName for informer identity used in metrics. +// The InformerName must be created via cache.NewInformerName() at startup, +// which validates global uniqueness. Each informer type will register its +// GVR under this name. +func WithInformerName(informerName *{{.cacheInformerName|raw}}) SharedInformerOption { + return func(factory *sharedInformerFactory) *sharedInformerFactory { + factory.informerName = informerName + return factory + } +} + +func (f *sharedInformerFactory) InformerName() *{{.cacheInformerName|raw}} { + return f.informerName +} + // NewSharedInformerFactory constructs a new instance of sharedInformerFactory for all namespaces. func NewSharedInformerFactory(client {{.clientSetInterface|raw}}, defaultResync {{.timeDuration|raw}}) SharedInformerFactory { return NewSharedInformerFactoryWithOptions(client, defaultResync) @@ -191,6 +216,10 @@ func NewSharedInformerFactoryWithOptions(client {{.clientSetInterface|raw}}, def } func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { + f.StartWithContext({{.waitContextForChannel|raw}}(stopCh)) +} + +func (f *sharedInformerFactory) StartWithContext(ctx {{.contextContext|raw}}) { f.lock.Lock() defer f.lock.Unlock() @@ -200,15 +229,9 @@ func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) { for informerType, informer := range f.informers { if !f.startedInformers[informerType] { - f.wg.Add(1) - // We need a new variable in each loop iteration, - // otherwise the goroutine would use the loop variable - // and that keeps changing. - informer := informer - go func() { - defer f.wg.Done() - informer.Run(stopCh) - }() + f.wg.Go(func() { + informer.RunWithContext(ctx) + }) f.startedInformers[informerType] = true } } @@ -222,27 +245,54 @@ func (f *sharedInformerFactory) Shutdown() { // Will return immediately if there is nothing to wait for. f.wg.Wait() + f.informerName.Release() } func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool { - informers := func()map[reflect.Type]cache.SharedIndexInformer{ - f.lock.Lock() - defer f.lock.Unlock() - - informers := map[reflect.Type]cache.SharedIndexInformer{} - for informerType, informer := range f.informers { - if f.startedInformers[informerType] { - informers[informerType] = informer - } - } - return informers - }() - - res := map[reflect.Type]bool{} - for informType, informer := range informers { - res[informType] = cache.WaitForCacheSync(stopCh, informer.HasSynced) - } - return res + result := f.WaitForCacheSyncWithContext(wait.ContextForChannel(stopCh)) + return result.Synced +} + +func (f *sharedInformerFactory) WaitForCacheSyncWithContext(ctx context.Context) {{.cacheSyncResult|raw}} { + informers := func() map[{{.reflectType|raw}}]{{.cacheSharedIndexInformer|raw}} { + f.lock.Lock() + defer f.lock.Unlock() + + informers := map[{{.reflectType|raw}}]{{.cacheSharedIndexInformer|raw}}{} + for informerType, informer := range f.informers { + if f.startedInformers[informerType] { + informers[informerType] = informer + } + } + return informers + }() + + // Wait for informers to sync, without polling. + cacheSyncs := make([]{{.cacheDoneChecker|raw}}, 0, len(informers)) + for _, informer := range informers { + cacheSyncs = append(cacheSyncs, informer.HasSyncedChecker()) + } + {{.cacheWaitFor|raw}}(ctx, "" /* no logging */, cacheSyncs...) + + res := {{.cacheSyncResult|raw}} { + Synced: make(map[{{.reflectType|raw}}]bool, len(informers)), + } + failed := false + for informType, informer := range informers { + hasSynced := informer.HasSynced() + if !hasSynced { + failed = true + } + res.Synced[informType] = hasSynced + } + if failed { + // context.Cause is more informative than ctx.Err(). + // This must be non-nil, otherwise WaitFor wouldn't have stopped + // prematurely. + res.Err = {{.contextCause|raw}}(ctx) + } + + return res } // InformerFor returns the SharedIndexInformer for obj using an internal @@ -263,7 +313,9 @@ func (f *sharedInformerFactory) InformerFor(obj {{.runtimeObject|raw}}, newFunc } informer = newFunc(f.client, resyncPeriod) - informer.SetTransform(f.transform) + if f.transform != nil { + informer.SetTransform(f.transform) + } f.informers[informerType] = informer return informer @@ -276,33 +328,52 @@ var sharedInformerFactoryInterface = ` // // It is typically used like this: // -// ctx, cancel := context.WithCancel(context.Background()) -// defer cancel() -// factory := NewSharedInformerFactory(client, resyncPeriod) -// defer factory.WaitForStop() // Returns immediately if nothing was started. -// genericInformer := factory.ForResource(resource) -// typedInformer := factory.SomeAPIGroup().V1().SomeType() -// factory.Start(ctx.Done()) // Start processing these informers. -// synced := factory.WaitForCacheSync(ctx.Done()) -// for v, ok := range synced { -// if !ok { -// fmt.Fprintf(os.Stderr, "caches failed to sync: %v", v) -// return -// } -// } +// ctx, cancel := context.WithCancel(context.Background()) +// defer cancel() +// factory := NewSharedInformerFactory(client, resyncPeriod) +// defer factory.WaitForStop() // Returns immediately if nothing was started. +// genericInformer := factory.ForResource(resource) +// typedInformer := factory.SomeAPIGroup().V1().SomeType() +// handle, err := typeInformer.Informer().AddEventHandler(...) +// if err != nil { +// return fmt.Errorf("register event handler: %v", err) +// } +// defer typeInformer.Informer().RemoveEventHandler(handle) // Avoids leaking goroutines. +// factory.StartWithContext(ctx) // Start processing these informers. +// synced := factory.WaitForCacheSyncWithContext(ctx) +// if err := synced.AsError(); err != nil { +// return err +// } +// for v := range synced { +// // Only if desired log some information similar to this. +// fmt.Fprintf(os.Stdout, "cache synced: %s", v) +// } +// +// // Also make sure that all of the initial cache events have been delivered. +// if !WaitFor(ctx, "event handler sync", handle.HasSyncedChecker()) { +// // Must have failed because of context. +// return fmt.Errorf("sync event handler: %w", context.Cause(ctx)) +// } // -// // Creating informers can also be created after Start, but then -// // Start must be called again: -// anotherGenericInformer := factory.ForResource(resource) -// factory.Start(ctx.Done()) +// // Creating informers can also be created after Start, but then +// // Start must be called again: +// anotherGenericInformer := factory.ForResource(resource) +// factory.StartWithContext(ctx) type SharedInformerFactory interface { {{.informerFactoryInterface|raw}} // Start initializes all requested informers. They are handled in goroutines // which run until the stop channel gets closed. // Warning: Start does not block. When run in a go-routine, it will race with a later WaitForCacheSync. + // + // Contextual logging: StartWithContext should be used instead of Start in code which supports contextual logging. Start(stopCh <-chan struct{}) + // StartWithContext initializes all requested informers. They are handled in goroutines + // which run until the context gets canceled. + // Warning: StartWithContext does not block. When run in a go-routine, it will race with a later WaitForCacheSync. + StartWithContext(ctx context.Context) + // Shutdown marks a factory as shutting down. At that point no new // informers can be started anymore and Start will return without // doing anything. @@ -317,7 +388,13 @@ type SharedInformerFactory interface { // WaitForCacheSync blocks until all started informers' caches were synced // or the stop channel gets closed. - WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + // + // Contextual logging: WaitForCacheSync should be used instead of WaitForCacheSync in code which supports contextual logging. It also returns a more useful result. + WaitForCacheSync(stopCh <-chan struct{}) map[{{.reflectType|raw}}]bool + + // WaitForCacheSyncWithContext blocks until all started informers' caches were synced + // or the context gets canceled. + WaitForCacheSyncWithContext(ctx {{.contextContext|raw}}) {{.cacheSyncResult|raw}} // ForResource gives generic access to a shared informer of the matching type. ForResource(resource {{.schemaGroupVersionResource|raw}}) (GenericInformer, error) diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go index 278f8ed915..e59b8bcc5f 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/factoryinterface.go @@ -63,6 +63,8 @@ func (g *factoryInterfaceGenerator) GenerateType(c *generator.Context, t *types. klog.V(5).Infof("processing type %v", t) m := map[string]interface{}{ + "cacheIndexers": c.Universe.Type(cacheIndexers), + "cacheInformerName": c.Universe.Type(cacheInformerName), "cacheSharedIndexInformer": c.Universe.Type(cacheSharedIndexInformer), "clientSetPackage": c.Universe.Type(types.Name{Package: g.clientSetPackage, Name: "Interface"}), "runtimeObject": c.Universe.Type(runtimeObject), @@ -83,8 +85,27 @@ type NewInformerFunc func({{.clientSetPackage|raw}}, {{.timeDuration|raw}}) cach type SharedInformerFactory interface { Start(stopCh <-chan struct{}) InformerFor(obj {{.runtimeObject|raw}}, newFunc NewInformerFunc) {{.cacheSharedIndexInformer|raw}} + InformerName() *{{.cacheInformerName|raw}} } // TweakListOptionsFunc is a function that transforms a {{.v1ListOptions|raw}}. type TweakListOptionsFunc func(*{{.v1ListOptions|raw}}) + +// InformerOptions holds the options for creating an informer. +type InformerOptions struct { + // ResyncPeriod is the resync period for this informer. + // If not set, defaults to 0 (no resync). + ResyncPeriod {{.timeDuration|raw}} + + // Indexers are the indexers for this informer. + Indexers {{.cacheIndexers|raw}} + + // InformerName is used to uniquely identify this informer for metrics. + // If not set, metrics will not be published for this informer. + // Use cache.NewInformerName() to create an InformerName at startup. + InformerName *{{.cacheInformerName|raw}} + + // TweakListOptions is an optional function to modify the list options. + TweakListOptions TweakListOptionsFunc +} ` diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go index 7d74c13a6b..ced706a64b 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/informer.go @@ -84,13 +84,18 @@ func (g *informerGenerator) GenerateType(c *generator.Context, t *types.Type, w "cacheMetaNamespaceIndexFunc": c.Universe.Function(cacheMetaNamespaceIndexFunc), "cacheNamespaceIndex": c.Universe.Variable(cacheNamespaceIndex), "cacheNewSharedIndexInformer": c.Universe.Function(cacheNewSharedIndexInformer), + "cacheNewSharedIndexInformerWithOptions": c.Universe.Function(cacheNewSharedIndexInformerWithOptions), "cacheSharedIndexInformer": c.Universe.Type(cacheSharedIndexInformer), + "cacheSharedIndexInformerOptions": c.Universe.Type(cacheSharedIndexInformerOptions), "cacheToListWatcherWithWatchListSemantics": c.Universe.Function(cacheToListWatcherWithWatchListSemanticsFunc), + "cacheInformerName": c.Universe.Type(cacheInformerName), "clientSetInterface": clientSetInterface, "contextContext": c.Universe.Type(contextContext), "contextBackground": c.Universe.Function(contextBackgroundFunc), "group": namer.IC(g.groupGoName), + "groupName": g.groupVersion.Group.String(), "informerFor": informerFor, + "interfacesInformerOptions": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "InformerOptions"}), "interfacesTweakListOptionsFunc": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "TweakListOptionsFunc"}), "interfacesSharedInformerFactory": c.Universe.Type(types.Name{Package: g.internalInterfacesPackage, Name: "SharedInformerFactory"}), "listOptions": c.Universe.Type(listOptions), @@ -98,11 +103,14 @@ func (g *informerGenerator) GenerateType(c *generator.Context, t *types.Type, w "namespaceAll": c.Universe.Type(metav1NamespaceAll), "namespaced": !tags.NonNamespaced, "newLister": c.Universe.Function(types.Name{Package: listerPackage, Name: "New" + t.Name.Name + "Lister"}), + "resourceName": strings.ToLower(t.Name.Name) + "s", "runtimeObject": c.Universe.Type(runtimeObject), + "schemaGroupVersionResource": c.Universe.Type(schemaGroupVersionResource), "timeDuration": c.Universe.Type(timeDuration), "type": t, "v1ListOptions": c.Universe.Type(v1ListOptions), "version": namer.IC(g.groupVersion.Version.String()), + "versionName": g.groupVersion.Version.String(), "watchInterface": c.Universe.Type(watchInterface), } @@ -110,6 +118,7 @@ func (g *informerGenerator) GenerateType(c *generator.Context, t *types.Type, w sw.Do(typeInformerStruct, m) sw.Do(typeInformerPublicConstructor, m) sw.Do(typeFilteredInformerPublicConstructor, m) + sw.Do(typeInformerPublicConstructorWithOptions, m) sw.Do(typeInformerConstructor, m) sw.Do(typeInformerInformer, m) sw.Do(typeInformerLister, m) @@ -139,7 +148,7 @@ var typeInformerPublicConstructor = ` // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func New$.type|public$Informer(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, resyncPeriod $.timeDuration|raw$, indexers $.cacheIndexers|raw$) $.cacheSharedIndexInformer|raw$ { - return NewFiltered$.type|public$Informer(client$if .namespaced$, namespace$end$, resyncPeriod, indexers, nil) + return New$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: indexers}) } ` @@ -148,43 +157,58 @@ var typeFilteredInformerPublicConstructor = ` // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. func NewFiltered$.type|public$Informer(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, resyncPeriod $.timeDuration|raw$, indexers $.cacheIndexers|raw$, tweakListOptions $.interfacesTweakListOptionsFunc|raw$) $.cacheSharedIndexInformer|raw$ { - return $.cacheNewSharedIndexInformer|raw$( + return New$.type|public$InformerWithOptions(client$if .namespaced$, namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions}) +} +` + +var typeInformerPublicConstructorWithOptions = ` +// New$.type|public$InformerWithOptions constructs a new informer for $.type|public$ type with additional options. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func New$.type|public$InformerWithOptions(client $.clientSetInterface|raw$$if .namespaced$, namespace string$end$, options $.interfacesInformerOptions|raw$) $.cacheSharedIndexInformer|raw$ { + gvr := $.schemaGroupVersionResource|raw${Group: "$.groupName$", Version: "$.versionName$", Resource: "$.resourceName$"} + identifier := options.InformerName.WithResource(gvr) + tweakListOptions := options.TweakListOptions + return $.cacheNewSharedIndexInformerWithOptions|raw$( $.cacheToListWatcherWithWatchListSemantics|raw$(&$.cacheListWatch|raw${ - ListFunc: func(options $.v1ListOptions|raw$) ($.runtimeObject|raw$, error) { + ListFunc: func(opts $.v1ListOptions|raw$) ($.runtimeObject|raw$, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).List($.contextBackground|raw$(), options) + return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).List($.contextBackground|raw$(), opts) }, - WatchFunc: func(options $.v1ListOptions|raw$) ($.watchInterface|raw$, error) { + WatchFunc: func(opts $.v1ListOptions|raw$) ($.watchInterface|raw$, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).Watch($.contextBackground|raw$(), options) + return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).Watch($.contextBackground|raw$(), opts) }, - ListWithContextFunc: func(ctx $.contextContext|raw$, options $.v1ListOptions|raw$) ($.runtimeObject|raw$, error) { + ListWithContextFunc: func(ctx $.contextContext|raw$, opts $.v1ListOptions|raw$) ($.runtimeObject|raw$, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).List(ctx, options) + return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).List(ctx, opts) }, - WatchFuncWithContext: func(ctx $.contextContext|raw$, options $.v1ListOptions|raw$) ($.watchInterface|raw$, error) { + WatchFuncWithContext: func(ctx $.contextContext|raw$, opts $.v1ListOptions|raw$) ($.watchInterface|raw$, error) { if tweakListOptions != nil { - tweakListOptions(&options) + tweakListOptions(&opts) } - return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).Watch(ctx, options) + return client.$.group$$.version$().$.type|publicPlural$($if .namespaced$namespace$end$).Watch(ctx, opts) }, }, client), &$.type|raw${}, - resyncPeriod, - indexers, + $.cacheSharedIndexInformerOptions|raw${ + ResyncPeriod: options.ResyncPeriod, + Indexers: options.Indexers, + Identifier: identifier, + }, ) } ` var typeInformerConstructor = ` func (f *$.type|private$Informer) defaultInformer(client $.clientSetInterface|raw$, resyncPeriod $.timeDuration|raw$) $.cacheSharedIndexInformer|raw$ { - return NewFiltered$.type|public$Informer(client$if .namespaced$, f.namespace$end$, resyncPeriod, $.cacheIndexers|raw${$.cacheNamespaceIndex|raw$: $.cacheMetaNamespaceIndexFunc|raw$}, f.tweakListOptions) + return New$.type|public$InformerWithOptions(client$if .namespaced$, f.namespace$end$, $.interfacesInformerOptions|raw${ResyncPeriod: resyncPeriod, Indexers: $.cacheIndexers|raw${$.cacheNamespaceIndex|raw$: $.cacheMetaNamespaceIndexFunc|raw$}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions}) } ` diff --git a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go index 2e1edbd624..445b4604fc 100644 --- a/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go +++ b/vendor/k8s.io/code-generator/cmd/informer-gen/generators/types.go @@ -20,17 +20,24 @@ import "k8s.io/gengo/v2/types" var ( apiScheme = types.Name{Package: "k8s.io/kubernetes/pkg/api/legacyscheme", Name: "Scheme"} + cacheDoneChecker = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "DoneChecker"} cacheGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "GenericLister"} cacheIndexers = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "Indexers"} + cacheInformerName = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "InformerName"} cacheListWatch = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "ListWatch"} cacheMetaNamespaceIndexFunc = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "MetaNamespaceIndexFunc"} cacheNamespaceIndex = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NamespaceIndex"} cacheNewGenericLister = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewGenericLister"} cacheNewSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewSharedIndexInformer"} + cacheNewSharedIndexInformerWithOptions = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "NewSharedIndexInformerWithOptions"} cacheSharedIndexInformer = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedIndexInformer"} + cacheSharedIndexInformerOptions = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SharedIndexInformerOptions"} + cacheSyncResult = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "SyncResult"} cacheTransformFunc = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "TransformFunc"} cacheToListWatcherWithWatchListSemanticsFunc = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "ToListWatcherWithWatchListSemantics"} + cacheWaitForFunc = types.Name{Package: "k8s.io/client-go/tools/cache", Name: "WaitFor"} contextBackgroundFunc = types.Name{Package: "context", Name: "Background"} + contextCauseFunc = types.Name{Package: "context", Name: "Cause"} contextContext = types.Name{Package: "context", Name: "Context"} fmtErrorfFunc = types.Name{Package: "fmt", Name: "Errorf"} listOptions = types.Name{Package: "k8s.io/kubernetes/pkg/apis/core", Name: "ListOptions"} @@ -38,10 +45,12 @@ var ( runtimeObject = types.Name{Package: "k8s.io/apimachinery/pkg/runtime", Name: "Object"} schemaGroupResource = types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupResource"} schemaGroupVersionResource = types.Name{Package: "k8s.io/apimachinery/pkg/runtime/schema", Name: "GroupVersionResource"} + stringsBuilder = types.Name{Package: "strings", Name: "Builder"} syncMutex = types.Name{Package: "sync", Name: "Mutex"} timeDuration = types.Name{Package: "time", Name: "Duration"} v1ListOptions = types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "ListOptions"} metav1NamespaceAll = types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "NamespaceAll"} metav1Object = types.Name{Package: "k8s.io/apimachinery/pkg/apis/meta/v1", Name: "Object"} + waitContextForChannelFunc = types.Name{Package: "k8s.io/apimachinery/pkg/util/wait", Name: "ContextForChannel"} watchInterface = types.Name{Package: "k8s.io/apimachinery/pkg/watch", Name: "Interface"} ) diff --git a/vendor/k8s.io/component-base/cli/flag/curves_flag.go b/vendor/k8s.io/component-base/cli/flag/curves_flag.go new file mode 100644 index 0000000000..2ae9f47345 --- /dev/null +++ b/vendor/k8s.io/component-base/cli/flag/curves_flag.go @@ -0,0 +1,50 @@ +/* +Copyright 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. +*/ + +package flag + +import ( + "crypto/tls" + "fmt" + "math" + "strings" +) + +// TLSCurvePreferences returns a list of Go's crypto/tls CurveID values from the ids passed. +// The supported values depend on the Go version used. +// See https://pkg.go.dev/crypto/tls#CurveID for values supported for each Go version. +func TLSCurvePreferences(curveIDs []int32) ([]tls.CurveID, error) { + if len(curveIDs) == 0 { + return nil, nil + } + seen := make(map[int32]bool, len(curveIDs)) + result := make([]tls.CurveID, 0, len(curveIDs)) + for _, id := range curveIDs { + if id <= 0 || id > math.MaxUint16 { + return nil, fmt.Errorf("curve preference %d is out of range (must be 1-%d)", id, math.MaxUint16) + } + if seen[id] { + return nil, fmt.Errorf("duplicate curve preference %d", id) + } + seen[id] = true + curve := tls.CurveID(id) + if strings.HasPrefix(curve.String(), "CurveID(") { + return nil, fmt.Errorf("curve preference %d is not supported by the current Go version", id) + } + result = append(result, curve) + } + return result, nil +} diff --git a/vendor/k8s.io/component-base/configz/OWNERS b/vendor/k8s.io/component-base/configz/OWNERS index 3c2009a85b..6b7e9de520 100644 --- a/vendor/k8s.io/component-base/configz/OWNERS +++ b/vendor/k8s.io/component-base/configz/OWNERS @@ -1,9 +1,5 @@ # See the OWNERS docs at https://go.k8s.io/owners -# For lack of a better idea, assigned configz to api-approvers because -# configz is an API that has been around for a long time, even if we don't -# guarantee its stability. - # Disable inheritance as this is an api owners file options: no_parent_owners: true diff --git a/vendor/k8s.io/component-base/configz/configz.go b/vendor/k8s.io/component-base/configz/configz.go index 53e809d34c..20067701f6 100644 --- a/vendor/k8s.io/component-base/configz/configz.go +++ b/vendor/k8s.io/component-base/configz/configz.go @@ -20,23 +20,34 @@ limitations under the License. // object, and the program should call InstallHandler once. e.g., // // func main() { +// if err := setupConfigz(); err != nil { +// klog.Fatalf("Failed to setup configz: %v", err) +// } +// http.ListenAndServe(":8080", http.DefaultServeMux) +// } +// +// func setupConfigz() error { // boatConfig := getBoatConfig() // planeConfig := getPlaneConfig() // // bcz, err := configz.New("boat") // if err != nil { -// panic(err) +// return fmt.Errorf("unable to register boat config: %w", err) +// } +// if err := bcz.Set(boatConfig); err != nil { +// return fmt.Errorf("unable to set boat config: %w", err) // } -// bcz.Set(boatConfig) // // pcz, err := configz.New("plane") // if err != nil { -// panic(err) +// return fmt.Errorf("unable to register plane config: %w", err) +// } +// if err := pcz.Set(planeConfig); err != nil { +// return fmt.Errorf("unable to set plane config: %w", err) // } -// pcz.Set(planeConfig) // // configz.InstallHandler(http.DefaultServeMux) -// http.ListenAndServe(":8080", http.DefaultServeMux) +// return nil // } package configz @@ -45,6 +56,8 @@ import ( "fmt" "net/http" "sync" + + "k8s.io/apimachinery/pkg/runtime" ) const DefaultConfigzPath = "/configz" @@ -57,7 +70,7 @@ var ( // Config is a handle to a ComponentConfig object. Don't create these directly; // use New() instead. type Config struct { - val interface{} + val runtime.Object } // InstallHandler adds an HTTP handler on the given mux for the "/configz" @@ -92,10 +105,24 @@ func Delete(name string) { } // Set sets the ComponentConfig for this Config. -func (v *Config) Set(val interface{}) { +func (v *Config) Set(val runtime.Object) error { configsGuard.Lock() defer configsGuard.Unlock() + if val == nil { + return fmt.Errorf("val may not be nil") + } + gvk := val.GetObjectKind().GroupVersionKind() + if len(gvk.Kind) == 0 { + return fmt.Errorf("val must specify a kind") + } + if gvk.GroupVersion().Empty() { + return fmt.Errorf("val must specify a group/version") + } + if gvk.Version == runtime.APIVersionInternal { + return fmt.Errorf("val must specify an external version") + } v.val = val + return nil } // MarshalJSON marshals the ComponentConfig as JSON data. diff --git a/vendor/k8s.io/component-base/featuregate/feature_gate.go b/vendor/k8s.io/component-base/featuregate/feature_gate.go index 7c18ef4aa3..faffa9f0a7 100644 --- a/vendor/k8s.io/component-base/featuregate/feature_gate.go +++ b/vendor/k8s.io/component-base/featuregate/feature_gate.go @@ -189,6 +189,14 @@ type MutableFeatureGate interface { OverrideDefault(name Feature, override bool) error } +// MutableFeatureGateWithLogger provides alternatives to some methods in [MutableFeatureGate] +// which use a logger provided by the caller instead of the global klog logger. +type MutableFeatureGateWithLogger interface { + SetWithLogger(logger klog.Logger, value string) error + SetFromMapWithLogger(logger klog.Logger, m map[string]bool) error + OverrideDefaultWithLogger(logger klog.Logger, name Feature, override bool) error +} + // MutableVersionedFeatureGate parses and stores flag gates for known features from // a string like feature1=true,feature2=false,... // MutableVersionedFeatureGate sets options based on the emulated version of the featured gate. @@ -241,6 +249,14 @@ type MutableVersionedFeatureGate interface { DeepCopyAndReset() MutableVersionedFeatureGate } +// MutableVersionedFeatureGateWithLogger provides alternatives to some methods in [MutableVersionedFeatureGate] +// which use a logger provided by the caller instead of the global klog logger. +type MutableVersionedFeatureGateWithLogger interface { + SetEmulationVersionWithLogger(logger klog.Logger, emulationVersion *version.Version) error + SetEmulationVersionAndMinCompatibilityVersionWithLogger(logger klog.Logger, emulationVersion *version.Version, minCompatibilityVersion *version.Version) error + OverrideDefaultAtVersionWithLogger(logger klog.Logger, name Feature, override bool, ver *version.Version) error +} + // featureGate implements FeatureGate as well as pflag.Value for flag parsing. type featureGate struct { featureGateName string @@ -267,6 +283,9 @@ type featureGate struct { minCompatibilityVersion atomic.Pointer[version.Version] } +var _ MutableVersionedFeatureGateWithLogger = &featureGate{} +var _ MutableFeatureGateWithLogger = &featureGate{} + func setUnsetAlphaGates(known map[Feature]VersionedSpecs, enabled map[Feature]bool, val bool, emuVer, minCompatVer *version.Version) { for k, v := range known { if k == "AllAlpha" || k == "AllBeta" { @@ -337,7 +356,18 @@ func NewFeatureGate() *featureGate { // Set parses a string of the form "key1=value1,key2=value2,..." into a // map[string]bool of known keys or returns an error. +// +//logcheck:context // SetWithLogger must be used instead. func (f *featureGate) Set(value string) error { + return f.SetWithLogger(klog.Background(), value) +} + +// Set parses a string of the form "key1=value1,key2=value2,..." into a +// map[string]bool of known keys or returns an error. +func (f *featureGate) SetWithLogger(logger klog.Logger, value string) error { + helper, logger := logger.WithCallStackHelper() + helper() + m := make(map[string]bool) for _, s := range strings.Split(value, ",") { if len(s) == 0 { @@ -355,7 +385,7 @@ func (f *featureGate) Set(value string) error { } m[k] = boolValue } - return f.SetFromMap(m) + return f.SetFromMapWithLogger(logger, m) } // Validate checks if the flag gates are valid at the emulated version. @@ -367,11 +397,15 @@ func (f *featureGate) Validate() []error { return []error{fmt.Errorf("cannot cast enabledRaw to map[string]bool")} } enabled := map[Feature]bool{} - return f.unsafeSetFromMap(enabled, m, f.EmulationVersion(), f.MinCompatibilityVersion()) + // Disable logging here. They would be misleading because we don't actually set anything. + return f.unsafeSetFromMap(klog.Logger{}, enabled, m, f.EmulationVersion(), f.MinCompatibilityVersion()) } // unsafeSetFromMap stores flag gates for known features from a map[string]bool into an enabled map. -func (f *featureGate) unsafeSetFromMap(enabled map[Feature]bool, m map[string]bool, emulationVersion, minCompatibilityVersion *version.Version) []error { +func (f *featureGate) unsafeSetFromMap(logger klog.Logger, enabled map[Feature]bool, m map[string]bool, emulationVersion, minCompatibilityVersion *version.Version) []error { + helper, logger := logger.WithCallStackHelper() + helper() + var errs []error // Copy existing state known := map[Feature]VersionedSpecs{} @@ -405,9 +439,9 @@ func (f *featureGate) unsafeSetFromMap(enabled map[Feature]bool, m map[string]bo enabled[key] = v if featureSpec.PreRelease == Deprecated { - klog.Warningf("Setting deprecated feature gate %s=%t. It will be removed in a future release.", k, v) + logger.Info("Warning: setting deprecated feature gate. It will be removed in a future release.", "featureGate", k, "value", v) } else if featureSpec.PreRelease == GA { - klog.Warningf("Setting GA feature gate %s=%t. It will be removed in a future release.", k, v) + logger.Info("Warning: setting GA feature gate. It will be removed in a future release.", "featureGate", k, "value", v) } } @@ -437,7 +471,17 @@ func (f *featureGate) unsafeSetFromMap(enabled map[Feature]bool, m map[string]bo } // SetFromMap stores flag gates for known features from a map[string]bool or returns an error +// +//logcheck:context // SetFromMapWithLogger must be used instead. func (f *featureGate) SetFromMap(m map[string]bool) error { + return f.SetFromMapWithLogger(klog.Background(), m) +} + +// SetFromMapWithLogger stores flag gates for known features from a map[string]bool or returns an error +func (f *featureGate) SetFromMapWithLogger(logger klog.Logger, m map[string]bool) error { + helper, logger := logger.WithCallStackHelper() + helper() + f.lock.Lock() defer f.lock.Unlock() @@ -459,11 +503,11 @@ func (f *featureGate) SetFromMap(m map[string]bool) error { } f.enabledRaw.Store(enabledRaw) - errs := f.unsafeSetFromMap(enabled, enabledRaw, f.EmulationVersion(), f.MinCompatibilityVersion()) + errs := f.unsafeSetFromMap(logger, enabled, enabledRaw, f.EmulationVersion(), f.MinCompatibilityVersion()) if len(errs) == 0 { // Persist changes f.enabled.Store(enabled) - klog.V(1).Infof("feature gates: %v", f.enabled) + logger.V(1).Info("Updated", "featureGates", enabled) } return utilerrors.NewAggregate(errs) } @@ -712,15 +756,32 @@ func (f *featureGate) Dependencies() map[Feature][]Feature { return maps.Clone(*f.dependencies.Load()) } +//logcheck:context // OverridedDefaultWithLogger must be used instead. func (f *featureGate) OverrideDefault(name Feature, override bool) error { - return f.overrideDefaultAtEmulationAndMinCompatVersion(name, override, f.EmulationVersion(), f.MinCompatibilityVersion()) + return f.OverrideDefaultWithLogger(klog.Background(), name, override) +} + +func (f *featureGate) OverrideDefaultWithLogger(logger klog.Logger, name Feature, override bool) error { + helper, logger := logger.WithCallStackHelper() + helper() + return f.overrideDefaultAtEmulationAndMinCompatVersion(logger, name, override, f.EmulationVersion(), f.MinCompatibilityVersion()) } +//logcheck:context // OverrideDefaultAtWithLogger must be used instead. func (f *featureGate) OverrideDefaultAtVersion(name Feature, override bool, ver *version.Version) error { - return f.overrideDefaultAtEmulationAndMinCompatVersion(name, override, ver, nil) + return f.OverrideDefaultAtVersionWithLogger(klog.Background(), name, override, ver) +} + +func (f *featureGate) OverrideDefaultAtVersionWithLogger(logger klog.Logger, name Feature, override bool, ver *version.Version) error { + helper, logger := logger.WithCallStackHelper() + helper() + return f.overrideDefaultAtEmulationAndMinCompatVersion(logger, name, override, ver, nil) } -func (f *featureGate) overrideDefaultAtEmulationAndMinCompatVersion(name Feature, override bool, emuVer, minCompatVer *version.Version) error { +func (f *featureGate) overrideDefaultAtEmulationAndMinCompatVersion(logger klog.Logger, name Feature, override bool, emuVer, minCompatVer *version.Version) error { + helper, logger := logger.WithCallStackHelper() + helper() + f.lock.Lock() defer f.lock.Unlock() @@ -742,9 +803,9 @@ func (f *featureGate) overrideDefaultAtEmulationAndMinCompatVersion(name Feature case spec.PreRelease == PreAlpha: return fmt.Errorf("cannot override default: feature %q is not available before version %s", name, emuVer) case spec.PreRelease == Deprecated: - klog.Warningf("Overriding default of deprecated feature gate %s=%t. It will be removed in a future release.", name, override) + logger.Info("Warning: overriding default of deprecated feature gate. It will be removed in a future release.", "featureGate", name, "value", override) case spec.PreRelease == GA: - klog.Warningf("Overriding default of GA feature gate %s=%t. It will be removed in a future release.", name, override) + logger.Info("Warning: overriding default of GA feature gate. It will be removed in a future release.", "featureGate", name, "value", override) } spec.Default = override @@ -784,17 +845,32 @@ func (f *featureGate) GetAllVersioned() map[Feature]VersionedSpecs { return retval } +//logcheck:context // SetEmulationVersionWithLogger must be used instead. func (f *featureGate) SetEmulationVersion(emulationVersion *version.Version) error { - return f.SetEmulationVersionAndMinCompatibilityVersion(emulationVersion, emulationVersion.SubtractMinor(1)) + return f.SetEmulationVersionWithLogger(klog.Background(), emulationVersion) +} + +func (f *featureGate) SetEmulationVersionWithLogger(logger klog.Logger, emulationVersion *version.Version) error { + helper, logger := logger.WithCallStackHelper() + helper() + return f.SetEmulationVersionAndMinCompatibilityVersionWithLogger(logger, emulationVersion, emulationVersion.SubtractMinor(1)) } +//logcheck:context // SetEmulationVersionAndMinCompatibilityWithLogger must be used instead. func (f *featureGate) SetEmulationVersionAndMinCompatibilityVersion(emulationVersion *version.Version, minCompatibilityVersion *version.Version) error { + return f.SetEmulationVersionAndMinCompatibilityVersionWithLogger(klog.Background(), emulationVersion, minCompatibilityVersion) +} + +func (f *featureGate) SetEmulationVersionAndMinCompatibilityVersionWithLogger(logger klog.Logger, emulationVersion *version.Version, minCompatibilityVersion *version.Version) error { + helper, logger := logger.WithCallStackHelper() + helper() + if emulationVersion.EqualTo(f.EmulationVersion()) && minCompatibilityVersion.EqualTo(f.MinCompatibilityVersion()) { return nil } f.lock.Lock() defer f.lock.Unlock() - klog.V(1).Infof("set feature gate emulationVersion to %s, minCompatibilityVersion to %s", emulationVersion, minCompatibilityVersion) + logger.V(1).Info("Set feature gate emulation", "emulationVersion", emulationVersion, "minCompatibilityVersion", minCompatibilityVersion) // Copy existing state enabledRaw := map[string]bool{} @@ -803,7 +879,7 @@ func (f *featureGate) SetEmulationVersionAndMinCompatibilityVersion(emulationVer } // enabled map should be reset whenever emulationVersion is changed. enabled := map[Feature]bool{} - errs := f.unsafeSetFromMap(enabled, enabledRaw, emulationVersion, minCompatibilityVersion) + errs := f.unsafeSetFromMap(logger, enabled, enabledRaw, emulationVersion, minCompatibilityVersion) queriedFeatures := f.queriedFeatures.Load().(sets.Set[Feature]) known := f.known.Load().(map[Feature]VersionedSpecs) @@ -811,7 +887,7 @@ func (f *featureGate) SetEmulationVersionAndMinCompatibilityVersion(emulationVer newVal := featureEnabled(feature, enabled, known, emulationVersion, minCompatibilityVersion) oldVal := featureEnabled(feature, f.enabled.Load().(map[Feature]bool), known, f.EmulationVersion(), f.MinCompatibilityVersion()) if newVal != oldVal { - klog.Warningf("SetEmulationVersionAndMinCompatibilityVersion will change already queried feature:%s from %v to %v", feature, oldVal, newVal) + logger.Info("Warning: SetEmulationVersionAndMinCompatibilityVersion will change already queried feature", "featureGate", feature, "oldValue", oldVal, "newValue", newVal) } } diff --git a/vendor/k8s.io/component-base/logs/api/v1/options_no_slog.go b/vendor/k8s.io/component-base/logs/api/v1/options_no_slog.go index 816948e0a6..ef4d5603d0 100644 --- a/vendor/k8s.io/component-base/logs/api/v1/options_no_slog.go +++ b/vendor/k8s.io/component-base/logs/api/v1/options_no_slog.go @@ -1,5 +1,4 @@ //go:build !go1.21 -// +build !go1.21 /* Copyright 2023 The Kubernetes Authors. diff --git a/vendor/k8s.io/component-base/logs/api/v1/options_slog.go b/vendor/k8s.io/component-base/logs/api/v1/options_slog.go index 31765e644d..6e8f1b4423 100644 --- a/vendor/k8s.io/component-base/logs/api/v1/options_slog.go +++ b/vendor/k8s.io/component-base/logs/api/v1/options_slog.go @@ -1,5 +1,4 @@ //go:build go1.21 -// +build go1.21 /* Copyright 2023 The Kubernetes Authors. diff --git a/vendor/k8s.io/component-base/metrics/OWNERS b/vendor/k8s.io/component-base/metrics/OWNERS index be371a4a09..b70cf0be7c 100644 --- a/vendor/k8s.io/component-base/metrics/OWNERS +++ b/vendor/k8s.io/component-base/metrics/OWNERS @@ -2,8 +2,9 @@ approvers: - sig-instrumentation-approvers - - logicalhan - RainbowMango +emeritus_approvers: + - logicalhan reviewers: - sig-instrumentation-reviewers - YoyinZyc diff --git a/vendor/k8s.io/component-base/metrics/api/v1/config.go b/vendor/k8s.io/component-base/metrics/api/v1/config.go new file mode 100644 index 0000000000..9825713687 --- /dev/null +++ b/vendor/k8s.io/component-base/metrics/api/v1/config.go @@ -0,0 +1,127 @@ +/* +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. +*/ + +package v1 + +import ( + "fmt" + "os" + "path/filepath" + "regexp" + + "github.com/blang/semver/v4" + "go.yaml.in/yaml/v2" + "k8s.io/apimachinery/pkg/util/validation/field" +) + +var ( + labelExpr = `[a-zA-Z_][a-zA-Z0-9_]*` + metricNameExpr = `[a-zA-Z_:][a-zA-Z0-9_:]*` + allowListMappingKeyRegex = regexp.MustCompile(`^` + metricNameExpr + `,` + labelExpr + `$`) + metricNameRegex = regexp.MustCompile(`^` + metricNameExpr + `$`) +) + +// Validate validates a MetricsConfiguration. +func Validate(c *MetricsConfiguration, currentVersion semver.Version, fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} + if c == nil { + return errs + } + errs = append(errs, validateShowHiddenMetricsVersion(currentVersion, c.ShowHiddenMetricsForVersion, fldPath.Child("showHiddenMetricsForVersion"))...) + errs = append(errs, validateDisabledMetrics(c.DisabledMetrics, fldPath.Child("disabledMetrics"))...) + errs = append(errs, validateAllowListMapping(c.AllowListMapping, fldPath.Child("allowListMapping"))...) + errs = append(errs, validateAllowListMappingManifest(c.AllowListMappingManifest, fldPath.Child("allowListMappingManifest"))...) + if c.AllowListMapping != nil && c.AllowListMappingManifest != "" { + errs = append(errs, field.Invalid(fldPath, c, "cannot specify both allowListMapping and allowListMappingManifest")) + } + + return errs +} + +func validateAllowListMapping(allowListMapping map[string]string, fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} + for k := range allowListMapping { + if !allowListMappingKeyRegex.MatchString(k) { + return append(errs, field.Invalid(fldPath, allowListMapping, fmt.Sprintf("must have keys with format `metricName,labelName` where metricName matches %q and labelName matches %q", metricNameExpr, labelExpr))) + } + } + + return errs +} + +// validateAllowListMappingManifest validates the allow list mapping manifest file. +// This function is used to validate the manifest file provided via the flag --allow-metric-labels-manifest, or the configuration file. +// In the former case, the path resolution is relative to the current working directory. +// In the latter case, the path resolution is relative to the configuration file's location, and components are required to pass in the resolved absolute path. +// NOTE: If its the latter case, components are expected to pass in the *absolute* path to the manifest file. +func validateAllowListMappingManifest(allowListMappingManifestPath string, fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} + if allowListMappingManifestPath == "" { + return errs + } + data, err := os.ReadFile(filepath.Clean(allowListMappingManifestPath)) + if err != nil { + return append(errs, field.Invalid(fldPath, allowListMappingManifestPath, fmt.Errorf("failed to read allow list manifest: %w", err).Error())) + } + allowListMapping := make(map[string]string) + err = yaml.Unmarshal(data, &allowListMapping) + if err != nil { + return append(errs, field.Invalid(fldPath, allowListMappingManifestPath, fmt.Errorf("failed to parse allow list manifest: %w", err).Error())) + } + allowListMappingErrs := validateAllowListMapping(allowListMapping, fldPath) + if len(allowListMappingErrs) > 0 { + return append(errs, field.Invalid(fldPath, allowListMappingManifestPath, fmt.Sprintf("invalid allow list mapping in manifest: %v", allowListMappingErrs))) + } + + return errs +} + +func validateDisabledMetrics(names []string, fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} + for _, name := range names { + if !metricNameRegex.MatchString(name) { + return append(errs, field.Invalid(fldPath, names, fmt.Sprintf("must be fully qualified metric names matching %q, got %q", metricNameRegex.String(), name))) + } + } + + return errs +} + +func validateShowHiddenMetricsVersion(currentVersion semver.Version, targetVersionStr string, fldPath *field.Path) field.ErrorList { + errs := field.ErrorList{} + if targetVersionStr == "" { + return errs + } + + validVersionStr := fmt.Sprintf("%d.%d", currentVersion.Major, currentVersion.Minor-1) + if targetVersionStr != validVersionStr { + return append(errs, field.Invalid(fldPath, targetVersionStr, fmt.Sprintf("must be omitted or have the value '%v'; only the previous minor version is allowed", validVersionStr))) + } + + return errs +} + +// ValidateShowHiddenMetricsVersionForKubeletBackwardCompatOnly validates the ShowHiddenMetricsForVersion field. +// TODO: This is kept here for backward compatibility in Kubelet (as metrics configuration fields were exposed on an individual basis earlier). +// TODO: Revisit this after Kubelet supports the new metrics configuration API: https://github.com/kubernetes/kubernetes/pull/123426 +func ValidateShowHiddenMetricsVersionForKubeletBackwardCompatOnly(currentVersion semver.Version, targetVersionStr string) error { + errs := validateShowHiddenMetricsVersion(currentVersion, targetVersionStr, field.NewPath("showHiddenMetricsForVersion")) + if len(errs) > 0 { + return fmt.Errorf("invalid showHiddenMetricsForVersion: %v", errs.ToAggregate().Error()) + } + + return nil +} diff --git a/vendor/k8s.io/component-base/metrics/api/v1/doc.go b/vendor/k8s.io/component-base/metrics/api/v1/doc.go new file mode 100644 index 0000000000..8c457bd0da --- /dev/null +++ b/vendor/k8s.io/component-base/metrics/api/v1/doc.go @@ -0,0 +1,34 @@ +/* +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. +*/ + +// +k8s:deepcopy-gen=package + +// Package v1 contains the configuration API for metrics. +// +// The intention is to only have a single version of this API, potentially with +// new fields added over time in a backwards-compatible manner. Fields for +// alpha or beta features are allowed as long as they are defined so that not +// changing the defaults leaves those features disabled. +// +// The "v1" package name is just a reminder that API compatibility rules apply, +// not an indication of the stability of all features covered by it. +// +// NOTE: Component owners are advised to rely on `k8s.io/component-base/metrics` to operate upon +// `k8s.io/component-base/metrics/api/v1.MetricsConfiguration` as the former contains functions to apply and validate +// the configuration, which in turn rely on members of the same package, which cannot be moved, +// or imported (cyclic dependency) here. + +package v1 // import "k8s.io/component-base/metrics/api/v1" diff --git a/vendor/k8s.io/component-base/metrics/api/v1/types.go b/vendor/k8s.io/component-base/metrics/api/v1/types.go new file mode 100644 index 0000000000..b95aa37235 --- /dev/null +++ b/vendor/k8s.io/component-base/metrics/api/v1/types.go @@ -0,0 +1,39 @@ +/* +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. +*/ + +package v1 + +// MetricsConfiguration contains all metrics options. +type MetricsConfiguration struct { + // ShowHiddenMetricsForVersion is the previous version for which you want to show hidden metrics. + // Only the previous minor version is meaningful, other values will not be allowed. + // The format is ., e.g.: '1.16'. + // The purpose of this format is make sure you have the opportunity to notice if the next release hides additional metrics, + // rather than being surprised when they are permanently removed in the release after that. + ShowHiddenMetricsForVersion string `json:"showHiddenMetricsForVersion,omitempty"` + // DisabledMetrics is a list of fully qualified metric names that should be disabled. + // Disabling metrics is higher in precedence than showing hidden metrics. + DisabledMetrics []string `json:"disabledMetrics,omitempty"` + // AllowListMapping is the map from metric-label to value allow-list of this label. + // The key's format is ,, while its value is a list of allowed values for that label of that metric, i.e., ,,... + // For e.g., metric1,label1='v1,v2,v3', metric1,label2='v1,v2,v3' metric2,label1='v1,v2,v3'." + AllowListMapping map[string]string `json:"allowListMapping,omitempty"` + // The path to the manifest file that contains the allow-list mapping. Provided for convenience over AllowListMapping. + // The file contents must represent a map of string keys and values, i.e., + // "metric1,label1": "value11,value12" + // "metric2,label2": "" + AllowListMappingManifest string `json:"allowListMappingManifest,omitempty"` +} diff --git a/vendor/k8s.io/component-base/metrics/api/v1/zz_generated.deepcopy.go b/vendor/k8s.io/component-base/metrics/api/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..6c96349a91 --- /dev/null +++ b/vendor/k8s.io/component-base/metrics/api/v1/zz_generated.deepcopy.go @@ -0,0 +1,50 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 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. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricsConfiguration) DeepCopyInto(out *MetricsConfiguration) { + *out = *in + if in.DisabledMetrics != nil { + in, out := &in.DisabledMetrics, &out.DisabledMetrics + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.AllowListMapping != nil { + in, out := &in.AllowListMapping, &out.AllowListMapping + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricsConfiguration. +func (in *MetricsConfiguration) DeepCopy() *MetricsConfiguration { + if in == nil { + return nil + } + out := new(MetricsConfiguration) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/k8s.io/component-base/metrics/desc.go b/vendor/k8s.io/component-base/metrics/desc.go index f921be6156..a40c488a50 100644 --- a/vendor/k8s.io/component-base/metrics/desc.go +++ b/vendor/k8s.io/component-base/metrics/desc.go @@ -115,7 +115,7 @@ func (d *Desc) determineDeprecationStatus(currentVersion semver.Version) { d.markDeprecationOnce.Do(func() { d.isDeprecated = isDeprecated(currentVersion, *deprecatedVersion) if shouldHide(d.stabilityLevel, ¤tVersion, deprecatedVersion) { - if shouldShowHidden() { + if ShouldShowHidden() { klog.Warningf("Hidden metrics(%s) have been manually overridden, showing this very deprecated metric.", d.fqName) return } diff --git a/vendor/k8s.io/component-base/metrics/features/kube_features.go b/vendor/k8s.io/component-base/metrics/features/kube_features.go index b2f8c65275..79ed690acf 100644 --- a/vendor/k8s.io/component-base/metrics/features/kube_features.go +++ b/vendor/k8s.io/component-base/metrics/features/kube_features.go @@ -17,14 +17,38 @@ limitations under the License. package features import ( + "k8s.io/apimachinery/pkg/util/version" "k8s.io/component-base/featuregate" + internalmetrics "k8s.io/component-base/metrics/internal" +) + +const ( + // owner: @richabanker + // kep: https://kep.k8s.io/5808 + // alpha: v1.36 + // + // Enables native histogram support for Kubernetes metrics. + // When enabled, histogram metrics will be exposed in both classic + // and native histogram formats. + NativeHistograms featuregate.Feature = "NativeHistograms" ) func featureGates() map[featuregate.Feature]featuregate.VersionedSpecs { - return map[featuregate.Feature]featuregate.VersionedSpecs{} + return map[featuregate.Feature]featuregate.VersionedSpecs{ + NativeHistograms: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + } } // AddFeatureGates adds all feature gates used by this package. func AddFeatureGates(mutableFeatureGate featuregate.MutableVersionedFeatureGate) error { return mutableFeatureGate.AddVersioned(featureGates()) } + +// ApplyFeatureGates propagates the current feature gate state to the metrics +// subsystem. It must be called after feature gates are finalised and before +// any histogram metrics are registered. +func ApplyFeatureGates(featureGate featuregate.FeatureGate) { + internalmetrics.SetNativeHistogramsEnabled(featureGate.Enabled(NativeHistograms)) +} diff --git a/vendor/k8s.io/component-base/metrics/histogram.go b/vendor/k8s.io/component-base/metrics/histogram.go index 73b56d1b80..f1e51036f7 100644 --- a/vendor/k8s.io/component-base/metrics/histogram.go +++ b/vendor/k8s.io/component-base/metrics/histogram.go @@ -19,6 +19,7 @@ package metrics import ( "context" "sync" + "time" "github.com/blang/semver/v4" "github.com/prometheus/client_golang/prometheus" @@ -91,7 +92,7 @@ func (h *Histogram) DeprecatedVersion() *semver.Version { // and stores a reference to it func (h *Histogram) initializeMetric() { h.HistogramOpts.annotateStabilityLevel() - // this actually creates the underlying prometheus gauge. + // this actually creates the underlying prometheus histogram. h.setPrometheusHistogram(prometheus.NewHistogram(h.HistogramOpts.toPromHistogramOpts())) } @@ -214,6 +215,21 @@ func (v *HistogramVec) With(labels map[string]string) ObserverMetric { return v.HistogramVec.With(labels) } +// ObserveSince returns a function that observes the duration since the given start time. +// This is intended to be used with defer to measure the time elapsed since a given point: +// +// start := time.Now() +// defer metricVec.ObserveSince(start, "label1", "label2")() +// +// The returned function must be called (typically via defer) to record the observation. +// This pattern avoids the common pitfall where arguments to deferred functions are evaluated +// immediately, which would result in incorrect timing measurements. +func (v *HistogramVec) ObserveSince(start time.Time, lvs ...string) func() { + return func() { + v.WithLabelValues(lvs...).Observe(time.Since(start).Seconds()) + } +} + // Delete deletes the metric where the variable labels are the same as those // passed in as labels. It returns true if a metric was deleted. // @@ -292,3 +308,8 @@ func (vc *HistogramVecWithContext) With(labels map[string]string) *exemplarHisto observer: vc.HistogramVec.With(labels), } } + +// ObserveSince is the wrapper of HistogramVec.ObserveSince. +func (vc *HistogramVecWithContext) ObserveSince(start time.Time, lvs ...string) func() { + return vc.HistogramVec.ObserveSince(start, lvs...) +} diff --git a/vendor/k8s.io/component-base/metrics/internal/nativehistograms.go b/vendor/k8s.io/component-base/metrics/internal/nativehistograms.go new file mode 100644 index 0000000000..c7d1769f24 --- /dev/null +++ b/vendor/k8s.io/component-base/metrics/internal/nativehistograms.go @@ -0,0 +1,57 @@ +/* +Copyright 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. +*/ + +// Package internal holds shared state for the metrics package that must not be +// directly accessible by external callers. +package internal + +import "sync/atomic" + +var nativeHistogramsEnabled atomic.Bool + +// NativeHistogramOptions holds the bucket configuration options for native histograms. +type NativeHistogramOptions struct { + BucketFactor float64 + MaxBucketNumber uint32 +} + +// defaultNativeHistogramOptions are the defaults applied to all histogram metrics +// when native histograms are enabled. +var defaultNativeHistogramOptions = NativeHistogramOptions{ + // BucketFactor is the growth factor for native histogram buckets. + // A value of 1.1 means each bucket is at most 10% wider than the previous one. + BucketFactor: 1.1, + // MaxBucketNumber is the maximum number of buckets per native histogram. + // Based on the OTel SDK recommendation for base2 exponential bucket histogram aggregation. + MaxBucketNumber: 160, +} + +// SetNativeHistogramsEnabled records whether native histograms are enabled. +// This should be called exactly once during component initialisation, driven +// by the NativeHistograms feature gate. +func SetNativeHistogramsEnabled(enabled bool) { + nativeHistogramsEnabled.Store(enabled) +} + +// NativeHistogramsEnabled reports whether native histograms are currently enabled. +func NativeHistogramsEnabled() bool { + return nativeHistogramsEnabled.Load() +} + +// NativeHistogramConfig returns the default bucket configuration for native histograms. +func NativeHistogramConfig() NativeHistogramOptions { + return defaultNativeHistogramOptions +} diff --git a/vendor/k8s.io/component-base/metrics/metric.go b/vendor/k8s.io/component-base/metrics/metric.go index cb40a856c6..1d05044b58 100644 --- a/vendor/k8s.io/component-base/metrics/metric.go +++ b/vendor/k8s.io/component-base/metrics/metric.go @@ -116,7 +116,7 @@ func (r *lazyMetric) preprocessMetric(currentVersion semver.Version) { r.isDeprecated.Store(isDeprecated(currentVersion, *deprecatedVersion)) if shouldHide(r.stabilityLevel, ¤tVersion, deprecatedVersion) { - if shouldShowHidden() { + if ShouldShowHidden() { klog.Warningf("Hidden metrics (%s) have been manually overridden, showing this very deprecated metric.", r.fqName) return } @@ -189,7 +189,7 @@ func (r *lazyMetric) FQName() string { /* This code is directly lifted from the prometheus codebase. It's a convenience struct which -allows you satisfy the Collector interface automatically if you already satisfy the Metric interface. +allows you to satisfy the Collector interface automatically if you already satisfy the Metric interface. For reference: https://github.com/prometheus/client_golang/blob/v0.9.2/prometheus/collector.go#L98-L120 */ diff --git a/vendor/k8s.io/component-base/metrics/options.go b/vendor/k8s.io/component-base/metrics/options.go index 17f44ef2a3..4e842d6c08 100644 --- a/vendor/k8s.io/component-base/metrics/options.go +++ b/vendor/k8s.io/component-base/metrics/options.go @@ -17,21 +17,59 @@ limitations under the License. package metrics import ( - "fmt" - "regexp" + "os" + "path/filepath" + "strings" + "sync" + "sync/atomic" - "github.com/blang/semver/v4" "github.com/spf13/pflag" - + "k8s.io/apimachinery/pkg/util/sets" + "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/component-base/version" + "k8s.io/klog/v2" + + "go.yaml.in/yaml/v2" + v1 "k8s.io/component-base/metrics/api/v1" +) + +var ( + disabledMetricsLock sync.RWMutex + disabledMetrics = map[string]struct{}{} + showHiddenOnce sync.Once + showHidden atomic.Bool +) + +var ( + disabledMetricsTotal = NewCounter( + &CounterOpts{ + Name: "disabled_metrics_total", + Help: "The count of disabled metrics.", + StabilityLevel: BETA, + }, + ) + + hiddenMetricsTotal = NewCounter( + &CounterOpts{ + Name: "hidden_metrics_total", + Help: "The count of hidden metrics.", + StabilityLevel: BETA, + }, + ) + + cardinalityEnforcementUnexpectedCategorizationsTotal = NewCounter( + &CounterOpts{ + Name: "cardinality_enforcement_unexpected_categorizations_total", + Help: "The count of unexpected categorizations during cardinality enforcement.", + StabilityLevel: ALPHA, + }, + ) ) // Options has all parameters needed for exposing metrics from components type Options struct { - ShowHiddenMetricsForVersion string - DisabledMetrics []string - AllowListMapping map[string]string - AllowListMappingManifest string + // Configuration serialization is omitted here since the parent is never expected to be embedded. + v1.MetricsConfiguration `json:"-"` } // NewOptions returns default metrics options @@ -39,29 +77,8 @@ func NewOptions() *Options { return &Options{} } -// Validate validates metrics flags options. -func (o *Options) Validate() []error { - if o == nil { - return nil - } - - var errs []error - err := validateShowHiddenMetricsVersion(parseVersion(version.Get()), o.ShowHiddenMetricsForVersion) - if err != nil { - errs = append(errs, err) - } - - if err := validateAllowMetricLabel(o.AllowListMapping); err != nil { - errs = append(errs, err) - } - - if len(errs) == 0 { - return nil - } - return errs -} - // AddFlags adds flags for exposing component metrics. +// This won't be called in embedded instances within component configurations. func (o *Options) AddFlags(fs *pflag.FlagSet) { if o == nil { return @@ -84,53 +101,175 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) { "e.g. metric1,label1='v1,v2,v3', metric1,label2='v1,v2,v3' metric2,label1='v1,v2,v3'.") fs.StringVar(&o.AllowListMappingManifest, "allow-metric-labels-manifest", o.AllowListMappingManifest, "The path to the manifest file that contains the allow-list mapping. "+ - "The format of the file is the same as the flag --allow-metric-labels. "+ + "The format of the file is the same as the flag --allow-metric-labels, i.e., \n"+ + "allowListMapping:\n \"metric1,label1\": \"value11,value12\"\n \"metric2,label2\": \"\"\n"+ "Note that the flag --allow-metric-labels will override the manifest file.") } -// Apply applies parameters into global configuration of metrics. -func (o *Options) Apply() { - if o == nil { +// SetShowHidden will enable showing hidden metrics. This will no-opt +// after the initial call +func SetShowHidden() { + showHiddenOnce.Do(func() { + showHidden.Store(true) + + // re-register collectors that has been hidden in phase of last registry. + for _, r := range registries { + r.enableHiddenCollectors() + r.enableHiddenStableCollectors() + } + }) +} + +// ShouldShowHidden returns whether showing hidden deprecated metrics is enabled. +// While the primary use case for this is internal (to determine registration behavior) this can also be used to introspect. +func ShouldShowHidden() bool { + return showHidden.Load() +} + +// SetDisabledMetric will disable a metric by name. +// This will also increment the disabled metrics counter. +// Note that this is a no-op if the metric is already disabled. +func SetDisabledMetrics(names []string) { + for _, name := range names { + func(name string) { + // An empty metric name is not a valid Prometheus metric. + if name == "" { + klog.Warningf("Attempted to disable an empty metric name, ignoring.") + return + } + disabledMetricsLock.Lock() + defer disabledMetricsLock.Unlock() + if _, ok := disabledMetrics[name]; !ok { + disabledMetrics[name] = struct{}{} + disabledMetricsTotal.Inc() + } + }(name) + } +} + +type MetricLabelAllowList struct { + labelToAllowList map[string]sets.Set[string] +} + +func (allowList *MetricLabelAllowList) ConstrainToAllowedList(labelNameList, labelValueList []string) { + for index, value := range labelValueList { + name := labelNameList[index] + if allowValues, ok := allowList.labelToAllowList[name]; ok { + if !allowValues.Has(value) { + labelValueList[index] = "unexpected" + cardinalityEnforcementUnexpectedCategorizationsTotal.Inc() + } + } + } +} + +func (allowList *MetricLabelAllowList) ConstrainLabelMap(labels map[string]string) { + for name, value := range labels { + if allowValues, ok := allowList.labelToAllowList[name]; ok { + if !allowValues.Has(value) { + labels[name] = "unexpected" + cardinalityEnforcementUnexpectedCategorizationsTotal.Inc() + } + } + } +} + +func SetLabelAllowList(allowListMapping map[string]string) { + if len(allowListMapping) == 0 { + klog.Errorf("empty allow-list mapping supplied, ignoring.") return } - if len(o.ShowHiddenMetricsForVersion) > 0 { - SetShowHidden() + + allowListLock.Lock() + defer allowListLock.Unlock() + for metricLabelName, labelValues := range allowListMapping { + metricName := strings.Split(metricLabelName, ",")[0] + labelName := strings.Split(metricLabelName, ",")[1] + valueSet := sets.New[string](strings.Split(labelValues, ",")...) + + allowList, ok := labelValueAllowLists[metricName] + if ok { + allowList.labelToAllowList[labelName] = valueSet + } else { + labelToAllowList := make(map[string]sets.Set[string]) + labelToAllowList[labelName] = valueSet + labelValueAllowLists[metricName] = &MetricLabelAllowList{ + labelToAllowList, + } + } } - // set disabled metrics - for _, metricName := range o.DisabledMetrics { - SetDisabledMetric(metricName) +} + +func SetLabelAllowListFromManifest(manifest string) { + if manifest == "" { + klog.Errorf("The manifest file is empty, ignoring.") + return } - if o.AllowListMapping != nil { - SetLabelAllowListFromCLI(o.AllowListMapping) - } else if len(o.AllowListMappingManifest) > 0 { - SetLabelAllowListFromManifest(o.AllowListMappingManifest) + + data, err := os.ReadFile(filepath.Clean(manifest)) + if err != nil { + klog.Errorf("Failed to read allow list manifest: %v", err) + return + } + allowListMapping := make(map[string]string) + err = yaml.Unmarshal(data, &allowListMapping) + if err != nil { + klog.Errorf("Failed to parse allow list manifest: %v", err) + return } + SetLabelAllowList(allowListMapping) } -func validateShowHiddenMetricsVersion(currentVersion semver.Version, targetVersionStr string) error { - if targetVersionStr == "" { - return nil +// Apply applies a MetricsConfiguration into global configuration of metrics. +func Apply(c *v1.MetricsConfiguration) { + if c == nil { + return } - validVersionStr := fmt.Sprintf("%d.%d", currentVersion.Major, currentVersion.Minor-1) - if targetVersionStr != validVersionStr { - return fmt.Errorf("--show-hidden-metrics-for-version must be omitted or have the value '%v'. Only the previous minor version is allowed", validVersionStr) + if len(c.ShowHiddenMetricsForVersion) > 0 { + SetShowHidden() + } + SetDisabledMetrics(c.DisabledMetrics) + if c.AllowListMapping != nil { + SetLabelAllowList(c.AllowListMapping) + } else { + SetLabelAllowListFromManifest(c.AllowListMappingManifest) + } +} + +// Apply applies parameters into global configuration of metrics. +func (o *Options) Apply() { + if o == nil { + return + } + + Apply(&o.MetricsConfiguration) +} + +// ValidateShowHiddenMetricsVersion checks invalid version for which show hidden metrics. +// TODO: This is kept here for backward compatibility in Kubelet (as metrics configuration fields were exposed on an individual basis earlier). +// TODO: Revisit this after Kubelet supports the new metrics configuration API. +func ValidateShowHiddenMetricsVersion(v string) []error { + err := v1.ValidateShowHiddenMetricsVersionForKubeletBackwardCompatOnly(parseVersion(version.Get()), v) + if err != nil { + return []error{err} } return nil } -func validateAllowMetricLabel(allowListMapping map[string]string) error { - if allowListMapping == nil { +// Validate validates metrics flags options. +func (o *Options) Validate() []error { + if o == nil { return nil } - metricNameRegex := `[a-zA-Z_:][a-zA-Z0-9_:]*` - labelRegex := `[a-zA-Z_][a-zA-Z0-9_]*` - for k := range allowListMapping { - reg := regexp.MustCompile(metricNameRegex + `,` + labelRegex) - if reg.FindString(k) != k { - return fmt.Errorf("--allow-metric-labels must have a list of kv pair with format `metricName,labelName=labelValue, labelValue,...`") - } + currentVersion := parseVersion(version.Get()) + fldPath := field.NewPath("metrics") + fldErrs := v1.Validate(&o.MetricsConfiguration, currentVersion, fldPath) + + if len(fldErrs) == 0 { + return nil } - return nil + + return fldErrs.ToAggregate().Errors() } diff --git a/vendor/k8s.io/component-base/metrics/opts.go b/vendor/k8s.io/component-base/metrics/opts.go index 247b9fd1c1..59beb23685 100644 --- a/vendor/k8s.io/component-base/metrics/opts.go +++ b/vendor/k8s.io/component-base/metrics/opts.go @@ -18,18 +18,13 @@ package metrics import ( "fmt" - "os" - "path/filepath" - "strings" "sync" "time" "github.com/prometheus/client_golang/prometheus" - yaml "go.yaml.in/yaml/v2" - "k8s.io/apimachinery/pkg/util/sets" + internalmetrics "k8s.io/component-base/metrics/internal" promext "k8s.io/component-base/metrics/prometheusextension" - "k8s.io/klog/v2" ) var ( @@ -201,7 +196,7 @@ func (o *HistogramOpts) annotateStabilityLevel() { // convenience function to allow easy transformation to the prometheus // counterpart. This will do more once we have a proper label abstraction func (o *HistogramOpts) toPromHistogramOpts() prometheus.HistogramOpts { - return prometheus.HistogramOpts{ + opts := prometheus.HistogramOpts{ Namespace: o.Namespace, Subsystem: o.Subsystem, Name: o.Name, @@ -209,6 +204,16 @@ func (o *HistogramOpts) toPromHistogramOpts() prometheus.HistogramOpts { ConstLabels: o.ConstLabels, Buckets: o.Buckets, } + + // When native histograms are enabled, configure exponential bucket options + // to expose metrics in both classic and native histogram formats. + if internalmetrics.NativeHistogramsEnabled() { + nativeOpts := internalmetrics.NativeHistogramConfig() + opts.NativeHistogramBucketFactor = nativeOpts.BucketFactor + opts.NativeHistogramMaxBucketNumber = nativeOpts.MaxBucketNumber + } + + return opts } // TimingHistogramOpts bundles the options for creating a TimingHistogram metric. It is @@ -325,66 +330,3 @@ func (o *SummaryOpts) toPromSummaryOpts() prometheus.SummaryOpts { BufCap: o.BufCap, } } - -type MetricLabelAllowList struct { - labelToAllowList map[string]sets.Set[string] -} - -func (allowList *MetricLabelAllowList) ConstrainToAllowedList(labelNameList, labelValueList []string) { - for index, value := range labelValueList { - name := labelNameList[index] - if allowValues, ok := allowList.labelToAllowList[name]; ok { - if !allowValues.Has(value) { - labelValueList[index] = "unexpected" - cardinalityEnforcementUnexpectedCategorizationsTotal.Inc() - } - } - } -} - -func (allowList *MetricLabelAllowList) ConstrainLabelMap(labels map[string]string) { - for name, value := range labels { - if allowValues, ok := allowList.labelToAllowList[name]; ok { - if !allowValues.Has(value) { - labels[name] = "unexpected" - cardinalityEnforcementUnexpectedCategorizationsTotal.Inc() - } - } - } -} - -func SetLabelAllowListFromCLI(allowListMapping map[string]string) { - allowListLock.Lock() - defer allowListLock.Unlock() - for metricLabelName, labelValues := range allowListMapping { - metricName := strings.Split(metricLabelName, ",")[0] - labelName := strings.Split(metricLabelName, ",")[1] - valueSet := sets.New[string](strings.Split(labelValues, ",")...) - - allowList, ok := labelValueAllowLists[metricName] - if ok { - allowList.labelToAllowList[labelName] = valueSet - } else { - labelToAllowList := make(map[string]sets.Set[string]) - labelToAllowList[labelName] = valueSet - labelValueAllowLists[metricName] = &MetricLabelAllowList{ - labelToAllowList, - } - } - } -} - -func SetLabelAllowListFromManifest(manifest string) { - allowListMapping := make(map[string]string) - data, err := os.ReadFile(filepath.Clean(manifest)) - if err != nil { - klog.Errorf("Failed to read allow list manifest: %v", err) - return - } - err = yaml.Unmarshal(data, &allowListMapping) - if err != nil { - klog.Errorf("Failed to parse allow list manifest: %v", err) - return - } - SetLabelAllowListFromCLI(allowListMapping) -} diff --git a/vendor/k8s.io/component-base/metrics/processstarttime_others.go b/vendor/k8s.io/component-base/metrics/processstarttime_others.go index 611a12906b..5e9c867587 100644 --- a/vendor/k8s.io/component-base/metrics/processstarttime_others.go +++ b/vendor/k8s.io/component-base/metrics/processstarttime_others.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows /* Copyright 2019 The Kubernetes Authors. diff --git a/vendor/k8s.io/component-base/metrics/processstarttime_windows.go b/vendor/k8s.io/component-base/metrics/processstarttime_windows.go index afee6f9b13..9a38abd33c 100644 --- a/vendor/k8s.io/component-base/metrics/processstarttime_windows.go +++ b/vendor/k8s.io/component-base/metrics/processstarttime_windows.go @@ -1,5 +1,4 @@ //go:build windows -// +build windows /* Copyright 2019 The Kubernetes Authors. diff --git a/vendor/k8s.io/component-base/metrics/prometheus/clientgo/fifo/metrics.go b/vendor/k8s.io/component-base/metrics/prometheus/clientgo/fifo/metrics.go new file mode 100644 index 0000000000..edc835437d --- /dev/null +++ b/vendor/k8s.io/component-base/metrics/prometheus/clientgo/fifo/metrics.go @@ -0,0 +1,139 @@ +/* +Copyright 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. +*/ + +package fifo + +import ( + "sync" + + "k8s.io/client-go/tools/cache" + k8smetrics "k8s.io/component-base/metrics" + "k8s.io/component-base/metrics/legacyregistry" +) + +var ( + subsystem = "informer" + + fifoQueuedItems = k8smetrics.NewGaugeVec( + &k8smetrics.GaugeOpts{ + Subsystem: subsystem, + Name: "queued_items", + Help: "Number of items currently queued in the FIFO.", + StabilityLevel: k8smetrics.ALPHA, + }, + []string{"name", "group", "version", "resource"}, + ) + fifoProcessingLatency = k8smetrics.NewHistogramVec( + &k8smetrics.HistogramOpts{ + Subsystem: subsystem, + Name: "processing_latency_seconds", + Help: "Time taken to process events after popping from the queue.", + Buckets: []float64{0.001, 0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10}, + StabilityLevel: k8smetrics.ALPHA, + }, + []string{"name", "group", "version", "resource"}, + ) + storeResourceVersion = k8smetrics.NewGaugeVec( + &k8smetrics.GaugeOpts{ + Subsystem: "informer", + Name: "store_resource_version", + Help: "The 15 least significant digits of the resource version of the store.", + StabilityLevel: k8smetrics.ALPHA, + }, + []string{"name", "group", "version", "resource"}, + ) + registerOnce sync.Once +) + +func init() { + Register() +} + +// Register registers FIFO metrics and sets the metrics provider. +func Register() { + registerOnce.Do(func() { + legacyregistry.MustRegister(fifoQueuedItems) + legacyregistry.MustRegister(fifoProcessingLatency) + legacyregistry.MustRegister(storeResourceVersion) + }) + cache.SetInformerMetricsProvider(informerMetricsProvider{}) +} + +type informerMetricsProvider struct{} + +func (informerMetricsProvider) NewQueuedItemMetric(id cache.InformerNameAndResource) cache.GaugeMetric { + return &reservedGaugeMetric{ + id: id, + gauge: fifoQueuedItems.WithLabelValues( + id.Name(), + id.GroupVersionResource().Group, + id.GroupVersionResource().Version, + id.GroupVersionResource().Resource, + ), + } +} + +func (informerMetricsProvider) NewProcessingLatencyMetric(id cache.InformerNameAndResource) cache.HistogramMetric { + return &reservedHistogramMetric{ + id: id, + histogram: fifoProcessingLatency.WithLabelValues( + id.Name(), + id.GroupVersionResource().Group, + id.GroupVersionResource().Version, + id.GroupVersionResource().Resource, + ), + } +} + +func (informerMetricsProvider) NewStoreResourceVersionMetric(id cache.InformerNameAndResource) cache.GaugeMetric { + return &reservedGaugeMetric{ + id: id, + gauge: storeResourceVersion.WithLabelValues( + id.Name(), + id.GroupVersionResource().Group, + id.GroupVersionResource().Version, + id.GroupVersionResource().Resource, + ), + } +} + +// reservedGaugeMetric wraps a gauge and only updates it if the identifier +// is still reserved. This supports dynamic informers (e.g., GC, ResourceQuota) +// that may shut down while the process is still running. +type reservedGaugeMetric struct { + id cache.InformerNameAndResource + gauge cache.GaugeMetric +} + +func (r *reservedGaugeMetric) Set(value float64) { + if r.id.Reserved() { + r.gauge.Set(value) + } +} + +// reservedHistogramMetric wraps a histogram and only updates it if the identifier +// is still reserved. This supports dynamic informers (e.g., GC, ResourceQuota) +// that may shut down while the process is still running. +type reservedHistogramMetric struct { + id cache.InformerNameAndResource + histogram cache.HistogramMetric +} + +func (r *reservedHistogramMetric) Observe(value float64) { + if r.id.Reserved() { + r.histogram.Observe(value) + } +} diff --git a/vendor/k8s.io/component-base/metrics/prometheus/clientgo/metrics.go b/vendor/k8s.io/component-base/metrics/prometheus/clientgo/metrics.go index 43574ca9a3..a307a1ab3e 100644 --- a/vendor/k8s.io/component-base/metrics/prometheus/clientgo/metrics.go +++ b/vendor/k8s.io/component-base/metrics/prometheus/clientgo/metrics.go @@ -17,6 +17,7 @@ limitations under the License. package clientgo import ( + _ "k8s.io/component-base/metrics/prometheus/clientgo/fifo" // load fifo metrics _ "k8s.io/component-base/metrics/prometheus/clientgo/leaderelection" // load leaderelection metrics _ "k8s.io/component-base/metrics/prometheus/restclient" // load restclient metrics _ "k8s.io/component-base/metrics/prometheus/workqueue" // load the workqueue metrics diff --git a/vendor/k8s.io/component-base/metrics/prometheus/controllers/metrics.go b/vendor/k8s.io/component-base/metrics/prometheus/controllers/metrics.go index d8122705d8..3f4bdac75c 100644 --- a/vendor/k8s.io/component-base/metrics/prometheus/controllers/metrics.go +++ b/vendor/k8s.io/component-base/metrics/prometheus/controllers/metrics.go @@ -29,7 +29,7 @@ var ( &k8smetrics.GaugeOpts{ Name: "running_managed_controllers", Help: "Indicates where instances of a controller are currently running", - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, }, []string{"name", "manager"}, ) diff --git a/vendor/k8s.io/component-base/metrics/prometheus/restclient/metrics.go b/vendor/k8s.io/component-base/metrics/prometheus/restclient/metrics.go index fd2c5f754c..0eb0cdbf99 100644 --- a/vendor/k8s.io/component-base/metrics/prometheus/restclient/metrics.go +++ b/vendor/k8s.io/component-base/metrics/prometheus/restclient/metrics.go @@ -189,7 +189,33 @@ var ( Name: "rest_client_transport_create_calls_total", StabilityLevel: k8smetrics.ALPHA, Help: "Number of calls to get a new transport, partitioned by the result of the operation " + - "hit: obtained from the cache, miss: created and added to the cache, uncacheable: created and not cached", + "hit: obtained from the cache, miss: created and added to the cache, miss-gc: recreated and added back to the cache after being garbage collected, uncacheable: created and not cached", + }, + []string{"result"}, + ) + + transportCAReloads = k8smetrics.NewCounterVec( + &k8smetrics.CounterOpts{ + Name: "rest_client_transport_ca_reload_total", + StabilityLevel: k8smetrics.ALPHA, + Help: "Number of times a CA reload is attempted, partitioned by the result and reason for the reload attempt", + }, + []string{"result", "reason"}, + ) + + transportCertRotationGCCalls = k8smetrics.NewCounter( + &k8smetrics.CounterOpts{ + Name: "rest_client_transport_cert_rotation_gc_calls_total", + StabilityLevel: k8smetrics.ALPHA, + Help: "Number of times a cert rotation goroutine cancel func is called via GC cleanup of the associated transport", + }, + ) + + transportCacheGCCalls = k8smetrics.NewCounterVec( + &k8smetrics.CounterOpts{ + Name: "rest_client_transport_cache_gc_calls_total", + StabilityLevel: k8smetrics.ALPHA, + Help: "Number of times a GC cleanup attempts to delete a transport cache entry, partitioned by the result: deleted, skipped", }, []string{"result"}, ) @@ -208,20 +234,26 @@ func init() { legacyregistry.MustRegister(execPluginCalls) legacyregistry.MustRegister(transportCacheEntries) legacyregistry.MustRegister(transportCacheCalls) + legacyregistry.MustRegister(transportCAReloads) + legacyregistry.MustRegister(transportCertRotationGCCalls) + legacyregistry.MustRegister(transportCacheGCCalls) metrics.Register(metrics.RegisterOpts{ - ClientCertExpiry: execPluginCertTTLAdapter, - ClientCertRotationAge: &rotationAdapter{m: execPluginCertRotation}, - RequestLatency: &latencyAdapter{m: requestLatency}, - ResolverLatency: &resolverLatencyAdapter{m: resolverLatency}, - RequestSize: &sizeAdapter{m: requestSize}, - ResponseSize: &sizeAdapter{m: responseSize}, - RateLimiterLatency: &latencyAdapter{m: rateLimiterLatency}, - RequestResult: &resultAdapter{requestResult}, - RequestRetry: &retryAdapter{requestRetry}, - ExecPluginCalls: &callsAdapter{m: execPluginCalls}, - ExecPluginPolicyCalls: &policyAdapter{m: execPluginPolicyCalls}, - TransportCacheEntries: &transportCacheAdapter{m: transportCacheEntries}, - TransportCreateCalls: &transportCacheCallsAdapter{m: transportCacheCalls}, + ClientCertExpiry: execPluginCertTTLAdapter, + ClientCertRotationAge: &rotationAdapter{m: execPluginCertRotation}, + RequestLatency: &latencyAdapter{m: requestLatency}, + ResolverLatency: &resolverLatencyAdapter{m: resolverLatency}, + RequestSize: &sizeAdapter{m: requestSize}, + ResponseSize: &sizeAdapter{m: responseSize}, + RateLimiterLatency: &latencyAdapter{m: rateLimiterLatency}, + RequestResult: &resultAdapter{requestResult}, + RequestRetry: &retryAdapter{requestRetry}, + ExecPluginCalls: &callsAdapter{m: execPluginCalls}, + ExecPluginPolicyCalls: &policyAdapter{m: execPluginPolicyCalls}, + TransportCacheEntries: &transportCacheAdapter{m: transportCacheEntries}, + TransportCreateCalls: &transportCacheCallsAdapter{m: transportCacheCalls}, + TransportCAReloads: &transportCAReloadsAdapter{m: transportCAReloads}, + TransportCertRotationGCCalls: &transportCertRotationGCCallsAdapter{m: transportCertRotationGCCalls}, + TransportCacheGCCalls: &transportCacheGCCallsAdapter{m: transportCacheGCCalls}, }) } @@ -312,3 +344,27 @@ type transportCacheCallsAdapter struct { func (t *transportCacheCallsAdapter) Increment(result string) { t.m.WithLabelValues(result).Inc() } + +type transportCAReloadsAdapter struct { + m *k8smetrics.CounterVec +} + +func (t *transportCAReloadsAdapter) Increment(result, reason string) { + t.m.WithLabelValues(result, reason).Inc() +} + +type transportCertRotationGCCallsAdapter struct { + m *k8smetrics.Counter +} + +func (t *transportCertRotationGCCallsAdapter) Increment() { + t.m.Inc() +} + +type transportCacheGCCallsAdapter struct { + m *k8smetrics.CounterVec +} + +func (t *transportCacheGCCallsAdapter) Increment(result string) { + t.m.WithLabelValues(result).Inc() +} diff --git a/vendor/k8s.io/component-base/metrics/prometheus/version/metrics.go b/vendor/k8s.io/component-base/metrics/prometheus/version/metrics.go index c74f31f958..a1c49089b8 100644 --- a/vendor/k8s.io/component-base/metrics/prometheus/version/metrics.go +++ b/vendor/k8s.io/component-base/metrics/prometheus/version/metrics.go @@ -27,7 +27,7 @@ var ( &metrics.GaugeOpts{ Name: "kubernetes_build_info", Help: "A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.", - StabilityLevel: metrics.ALPHA, + StabilityLevel: metrics.BETA, }, []string{"major", "minor", "git_version", "git_commit", "git_tree_state", "build_date", "go_version", "compiler", "platform"}, ) diff --git a/vendor/k8s.io/component-base/metrics/prometheus/workqueue/metrics.go b/vendor/k8s.io/component-base/metrics/prometheus/workqueue/metrics.go index 59fd1cf6df..52e04f6ee8 100644 --- a/vendor/k8s.io/component-base/metrics/prometheus/workqueue/metrics.go +++ b/vendor/k8s.io/component-base/metrics/prometheus/workqueue/metrics.go @@ -41,21 +41,21 @@ var ( depth = k8smetrics.NewGaugeVec(&k8smetrics.GaugeOpts{ Subsystem: WorkQueueSubsystem, Name: DepthKey, - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, Help: "Current depth of workqueue", }, []string{"name"}) adds = k8smetrics.NewCounterVec(&k8smetrics.CounterOpts{ Subsystem: WorkQueueSubsystem, Name: AddsKey, - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, Help: "Total number of adds handled by workqueue", }, []string{"name"}) latency = k8smetrics.NewHistogramVec(&k8smetrics.HistogramOpts{ Subsystem: WorkQueueSubsystem, Name: QueueLatencyKey, - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, Help: "How long in seconds an item stays in workqueue before being requested.", Buckets: k8smetrics.ExponentialBuckets(10e-9, 10, 10), }, []string{"name"}) @@ -63,7 +63,7 @@ var ( workDuration = k8smetrics.NewHistogramVec(&k8smetrics.HistogramOpts{ Subsystem: WorkQueueSubsystem, Name: WorkDurationKey, - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, Help: "How long in seconds processing an item from workqueue takes.", Buckets: k8smetrics.ExponentialBuckets(10e-9, 10, 10), }, []string{"name"}) @@ -71,7 +71,7 @@ var ( unfinished = k8smetrics.NewGaugeVec(&k8smetrics.GaugeOpts{ Subsystem: WorkQueueSubsystem, Name: UnfinishedWorkKey, - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, Help: "How many seconds of work has done that " + "is in progress and hasn't been observed by work_duration. Large " + "values indicate stuck threads. One can deduce the number of stuck " + @@ -81,7 +81,7 @@ var ( longestRunningProcessor = k8smetrics.NewGaugeVec(&k8smetrics.GaugeOpts{ Subsystem: WorkQueueSubsystem, Name: LongestRunningProcessorKey, - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, Help: "How many seconds has the longest running " + "processor for workqueue been running.", }, []string{"name"}) @@ -89,7 +89,7 @@ var ( retries = k8smetrics.NewCounterVec(&k8smetrics.CounterOpts{ Subsystem: WorkQueueSubsystem, Name: RetriesKey, - StabilityLevel: k8smetrics.ALPHA, + StabilityLevel: k8smetrics.BETA, Help: "Total number of retries handled by workqueue", }, []string{"name"}) diff --git a/vendor/k8s.io/component-base/metrics/registry.go b/vendor/k8s.io/component-base/metrics/registry.go index aa12f2e2c8..bccfd90f64 100644 --- a/vendor/k8s.io/component-base/metrics/registry.go +++ b/vendor/k8s.io/component-base/metrics/registry.go @@ -19,7 +19,6 @@ package metrics import ( "strings" "sync" - "sync/atomic" "github.com/blang/semver/v4" "github.com/prometheus/client_golang/prometheus" @@ -30,12 +29,8 @@ import ( ) var ( - showHiddenOnce sync.Once - disabledMetricsLock sync.RWMutex - showHidden atomic.Bool - registries []*kubeRegistry // stores all registries created by NewKubeRegistry() - registriesLock sync.RWMutex - disabledMetrics = map[string]struct{}{} + registries []*kubeRegistry // stores all registries created by NewKubeRegistry() + registriesLock sync.RWMutex registeredMetricsTotal = NewCounterVec( &CounterOpts{ @@ -45,30 +40,6 @@ var ( }, []string{"stability_level", "deprecated_version"}, ) - - disabledMetricsTotal = NewCounter( - &CounterOpts{ - Name: "disabled_metrics_total", - Help: "The count of disabled metrics.", - StabilityLevel: BETA, - }, - ) - - hiddenMetricsTotal = NewCounter( - &CounterOpts{ - Name: "hidden_metrics_total", - Help: "The count of hidden metrics.", - StabilityLevel: BETA, - }, - ) - - cardinalityEnforcementUnexpectedCategorizationsTotal = NewCounter( - &CounterOpts{ - Name: "cardinality_enforcement_unexpected_categorizations_total", - Help: "The count of unexpected categorizations during cardinality enforcement.", - StabilityLevel: ALPHA, - }, - ) ) // shouldHide is used to check if a specific metric with deprecated version should be hidden @@ -125,44 +96,6 @@ func isDeprecated(currentVersion, deprecatedVersion semver.Version) bool { return currentVersion.Minor >= deprecatedVersion.Minor } -// ValidateShowHiddenMetricsVersion checks invalid version for which show hidden metrics. -func ValidateShowHiddenMetricsVersion(v string) []error { - err := validateShowHiddenMetricsVersion(parseVersion(version.Get()), v) - if err != nil { - return []error{err} - } - - return nil -} - -func SetDisabledMetric(name string) { - disabledMetricsLock.Lock() - defer disabledMetricsLock.Unlock() - disabledMetrics[name] = struct{}{} - disabledMetricsTotal.Inc() -} - -// SetShowHidden will enable showing hidden metrics. This will no-opt -// after the initial call -func SetShowHidden() { - showHiddenOnce.Do(func() { - showHidden.Store(true) - - // re-register collectors that has been hidden in phase of last registry. - for _, r := range registries { - r.enableHiddenCollectors() - r.enableHiddenStableCollectors() - } - }) -} - -// shouldShowHidden returns whether showing hidden deprecated metrics -// is enabled. While the primary usecase for this is internal (to determine -// registration behavior) this can also be used to introspect -func shouldShowHidden() bool { - return showHidden.Load() -} - // Registerable is an interface for a collector metric which we // will register with KubeRegistry. type Registerable interface { @@ -350,7 +283,7 @@ func (kr *kubeRegistry) trackStableCollectors(cs ...StableCollector) { kr.stableCollectors = append(kr.stableCollectors, cs...) } -// enableHiddenCollectors will re-register all of the hidden collectors. +// enableHiddenCollectors will re-register all the hidden collectors. func (kr *kubeRegistry) enableHiddenCollectors() { if len(kr.hiddenCollectors) == 0 { return diff --git a/vendor/k8s.io/component-base/metrics/testutil/metrics.go b/vendor/k8s.io/component-base/metrics/testutil/metrics.go index a8d710aff5..f1f8b28b4e 100644 --- a/vendor/k8s.io/component-base/metrics/testutil/metrics.go +++ b/vendor/k8s.io/component-base/metrics/testutil/metrics.go @@ -45,6 +45,7 @@ var ( type Metrics map[string]Samples type Samples = model.Samples type Sample = model.Sample +type Time = model.Time type Metric = model.Metric type LabelValue = model.LabelValue type LabelName = model.LabelName @@ -113,6 +114,10 @@ func TextToMetricFamilies(in io.Reader) (map[string]*dto.MetricFamily, error) { return textParser.TextToMetricFamilies(in) } +func MetricFamilyToText(out io.Writer, in *dto.MetricFamily) (written int, err error) { + return expfmt.MetricFamilyToText(out, in) +} + // PrintSample returns formatted representation of metric Sample func PrintSample(sample *model.Sample) string { buf := make([]string, 0) diff --git a/vendor/k8s.io/component-base/metrics/testutil/testutil.go b/vendor/k8s.io/component-base/metrics/testutil/testutil.go index d023a0dea8..4d9ba5b3e7 100644 --- a/vendor/k8s.io/component-base/metrics/testutil/testutil.go +++ b/vendor/k8s.io/component-base/metrics/testutil/testutil.go @@ -17,12 +17,15 @@ limitations under the License. package testutil import ( + "errors" "fmt" "io" + "net/http" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/testutil" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/expfmt" apimachineryversion "k8s.io/apimachinery/pkg/version" "k8s.io/component-base/metrics" @@ -167,3 +170,73 @@ func AssertHistogramTotalCount(t TB, name string, labelFilter map[string]string, } } } + +// AssertHasNativeHistogram verifies that a native histogram metric with the given labels exists and has valid data. +func AssertHasNativeHistogram(t TB, mf *dto.MetricFamily, labelFilter map[string]string) { + if mf.GetType() != dto.MetricType_HISTOGRAM { + t.Errorf("metric %q is not a histogram", mf.GetName()) + return + } + + for _, m := range mf.GetMetric() { + if !LabelsMatch(m, labelFilter) { + continue + } + h := m.GetHistogram() + if h == nil { + continue + } + + if h.Schema == nil { + t.Errorf("expected native histogram data to be present for metric %q with labels %v", mf.GetName(), labelFilter) + } + + // If there are observations, PositiveSpan should have data for positive durations + if h.GetSampleCount() > 0 && len(h.GetPositiveSpan()) == 0 { + t.Errorf("expected PositiveSpan data for histogram with observations") + } + + return + } + t.Errorf("metric %q with labels %v not found", mf.GetName(), labelFilter) +} + +// ScrapeMetricsProto scrapes metrics from a URL using protobuf format. +// This is necessary for native histograms as they are only fully exposed in protobuf format. +// Returns a map of metric families keyed by metric name. +func ScrapeMetricsProto(url string, client *http.Client) (map[string]*dto.MetricFamily, error) { + if client == nil { + return nil, fmt.Errorf("http client is required") + } + req, err := http.NewRequest(http.MethodGet, url, nil) + if err != nil { + return nil, fmt.Errorf("failed to create request: %w", err) + } + // Request protobuf format to get native histogram data + req.Header.Set("Accept", string(expfmt.NewFormat(expfmt.TypeProtoDelim))) + + resp, err := client.Do(req) + if err != nil { + return nil, fmt.Errorf("request failed: %w", err) + } + defer func() { _ = resp.Body.Close() }() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode) + } + + // Parse protobuf format + decoder := expfmt.NewDecoder(resp.Body, expfmt.ResponseFormat(resp.Header)) + result := make(map[string]*dto.MetricFamily) + for { + var mf dto.MetricFamily + if err := decoder.Decode(&mf); err != nil { + if errors.Is(err, io.EOF) { + break + } + return nil, fmt.Errorf("failed to decode metric: %w", err) + } + result[mf.GetName()] = &mf + } + return result, nil +} diff --git a/vendor/k8s.io/component-base/metrics/version.go b/vendor/k8s.io/component-base/metrics/version.go index f963e205eb..eba29ce9be 100644 --- a/vendor/k8s.io/component-base/metrics/version.go +++ b/vendor/k8s.io/component-base/metrics/version.go @@ -23,7 +23,7 @@ var ( &GaugeOpts{ Name: "kubernetes_build_info", Help: "A metric with a constant '1' value labeled by major, minor, git version, git commit, git tree state, build date, Go version, and compiler from which Kubernetes was built, and platform on which it is running.", - StabilityLevel: ALPHA, + StabilityLevel: BETA, }, []string{"major", "minor", "git_version", "git_commit", "git_tree_state", "build_date", "go_version", "compiler", "platform"}, ) diff --git a/vendor/k8s.io/component-base/version/base.go b/vendor/k8s.io/component-base/version/base.go index 94da79c081..453b63d82f 100644 --- a/vendor/k8s.io/component-base/version/base.go +++ b/vendor/k8s.io/component-base/version/base.go @@ -60,5 +60,5 @@ const ( // DefaultKubeBinaryVersion is the hard coded k8 binary version based on the latest K8s release. // It is supposed to be consistent with gitMajor and gitMinor, except for local tests, where gitMajor and gitMinor are "". // Should update for each minor release! - DefaultKubeBinaryVersion = "1.35" + DefaultKubeBinaryVersion = "1.36" ) diff --git a/vendor/k8s.io/component-base/zpages/features/kube_features.go b/vendor/k8s.io/component-base/zpages/features/kube_features.go index ed5e41e011..91b45dfeed 100644 --- a/vendor/k8s.io/component-base/zpages/features/kube_features.go +++ b/vendor/k8s.io/component-base/zpages/features/kube_features.go @@ -29,6 +29,7 @@ const ( // owner: @richabanker // kep: https://kep.k8s.io/4827 // alpha: v1.32 + // beta: v1.36 // // Enables /statusz endpoint for a component making it accessible to // users with the system:monitoring cluster role. @@ -39,9 +40,11 @@ func featureGates() map[featuregate.Feature]featuregate.VersionedSpecs { return map[featuregate.Feature]featuregate.VersionedSpecs{ ComponentFlagz: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, ComponentStatusz: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, } } diff --git a/vendor/k8s.io/component-helpers/resource/helpers.go b/vendor/k8s.io/component-helpers/resource/helpers.go index c8b3c7ece6..23f57a7fca 100644 --- a/vendor/k8s.io/component-helpers/resource/helpers.go +++ b/vendor/k8s.io/component-helpers/resource/helpers.go @@ -60,6 +60,8 @@ type PodResourcesOptions struct { SkipPodLevelResources bool // SkipContainerLevelResources SkipContainerLevelResources bool + // Use node allocatable resource claim information from pod status to compute the effective pod resource request. + UseDRANodeAllocatableResourceClaimStatus bool } var supportedPodLevelResources = sets.New(v1.ResourceCPU, v1.ResourceMemory) @@ -275,6 +277,16 @@ func AggregateContainerRequests(pod *v1.Pod, opts PodResourcesOptions) v1.Resour } maxResourceList(reqs, initContainerReqs) + + // Add resources from node allocatable ResourceClaims + if opts.UseDRANodeAllocatableResourceClaimStatus && len(pod.Status.NodeAllocatableResourceClaimStatuses) > 0 { + for _, claimStatus := range pod.Status.NodeAllocatableResourceClaimStatuses { + for resName, resQty := range claimStatus.Resources { + addResourceList(reqs, v1.ResourceList{resName: resQty}) + } + } + } + return reqs } diff --git a/vendor/k8s.io/controller-manager/pkg/features/kube_features.go b/vendor/k8s.io/controller-manager/pkg/features/kube_features.go index da82429bc5..0b00126fd8 100644 --- a/vendor/k8s.io/controller-manager/pkg/features/kube_features.go +++ b/vendor/k8s.io/controller-manager/pkg/features/kube_features.go @@ -40,6 +40,11 @@ const ( // kep: http://kep.k8s.io/2699 // Enable webhook in cloud controller manager CloudControllerManagerWebhook featuregate.Feature = "CloudControllerManagerWebhook" + + // owner: @jefftree, @tchap + // + // Make kube-controller-manager release leader election lock on exit. + ControllerManagerReleaseLeaderElectionLockOnExit featuregate.Feature = "ControllerManagerReleaseLeaderElectionLockOnExit" ) func SetupCurrentKubernetesSpecificFeatureGates(featuregates featuregate.MutableVersionedFeatureGate) error { @@ -55,4 +60,7 @@ var versionedCloudPublicFeatureGates = map[featuregate.Feature]featuregate.Versi CloudControllerManagerWebhook: { {Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha}, }, + ControllerManagerReleaseLeaderElectionLockOnExit: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, } diff --git a/vendor/k8s.io/klog/v2/ktesting/options.go b/vendor/k8s.io/klog/v2/ktesting/options.go new file mode 100644 index 0000000000..2119a22266 --- /dev/null +++ b/vendor/k8s.io/klog/v2/ktesting/options.go @@ -0,0 +1,132 @@ +/* +Copyright 2021 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. +*/ + +package ktesting + +import ( + "flag" + "strconv" + + "k8s.io/klog/v2/internal/serialize" + "k8s.io/klog/v2/internal/verbosity" +) + +// Config influences logging in a test logger. To make this configurable via +// command line flags, instantiate this once per program and use AddFlags to +// bind command line flags to the instance before passing it to NewTestContext. +// +// Must be constructed with NewConfig. +type Config struct { + vstate *verbosity.VState + co configOptions +} + +// Verbosity returns a value instance that can be used to query (via String) or +// modify (via Set) the verbosity threshold. This is thread-safe and can be +// done at runtime. +func (c *Config) Verbosity() flag.Value { + return c.vstate.V() +} + +// VModule returns a value instance that can be used to query (via String) or +// modify (via Set) the vmodule settings. This is thread-safe and can be done +// at runtime. +func (c *Config) VModule() flag.Value { + return c.vstate.VModule() +} + +// ConfigOption implements functional parameters for NewConfig. +type ConfigOption func(co *configOptions) + +type configOptions struct { + anyToString serialize.AnyToStringFunc + verbosityFlagName string + vmoduleFlagName string + verbosityDefault int + bufferLogs bool +} + +// AnyToString overrides the default formatter for values that are not +// supported directly by klog. The default is `fmt.Sprintf("%+v")`. +// The formatter must not panic. +func AnyToString(anyToString func(value interface{}) string) ConfigOption { + return func(co *configOptions) { + co.anyToString = anyToString + } +} + +// VerbosityFlagName overrides the default -testing.v for the verbosity level. +func VerbosityFlagName(name string) ConfigOption { + return func(co *configOptions) { + co.verbosityFlagName = name + } +} + +// VModulFlagName overrides the default -testing.vmodule for the per-module +// verbosity levels. +func VModuleFlagName(name string) ConfigOption { + return func(co *configOptions) { + co.vmoduleFlagName = name + } +} + +// Verbosity overrides the default verbosity level of 5. That default is higher +// than in klog itself because it enables logging entries for "the steps +// leading up to errors and warnings" and "troubleshooting" (see +// https://github.com/kubernetes/community/blob/9406b4352fe2d5810cb21cc3cb059ce5886de157/contributors/devel/sig-instrumentation/logging.md#logging-conventions), +// which is useful when debugging a failed test. `go test` only shows the log +// output for failed tests. To see all output, use `go test -v`. +func Verbosity(level int) ConfigOption { + return func(co *configOptions) { + co.verbosityDefault = level + } +} + +// BufferLogs controls whether log entries are captured in memory in addition +// to being printed. Off by default. Unit tests that want to verify that +// log entries are emitted as expected can turn this on and then retrieve +// the captured log through the Underlier LogSink interface. +func BufferLogs(enabled bool) ConfigOption { + return func(co *configOptions) { + co.bufferLogs = enabled + } +} + +// NewConfig returns a configuration with recommended defaults and optional +// modifications. Command line flags are not bound to any FlagSet yet. +func NewConfig(opts ...ConfigOption) *Config { + c := &Config{ + co: configOptions{ + verbosityFlagName: "testing.v", + vmoduleFlagName: "testing.vmodule", + verbosityDefault: 5, + }, + } + for _, opt := range opts { + opt(&c.co) + } + + c.vstate = verbosity.New() + // Cannot fail for this input. + _ = c.vstate.V().Set(strconv.FormatInt(int64(c.co.verbosityDefault), 10)) + return c +} + +// AddFlags registers the command line flags that control the configuration. +func (c *Config) AddFlags(fs *flag.FlagSet) { + fs.Var(c.vstate.V(), c.co.verbosityFlagName, "number for the log level verbosity of the testing logger") + fs.Var(c.vstate.VModule(), c.co.vmoduleFlagName, "comma-separated list of pattern=N log level settings for files matching the patterns") +} diff --git a/vendor/k8s.io/klog/v2/ktesting/setup.go b/vendor/k8s.io/klog/v2/ktesting/setup.go new file mode 100644 index 0000000000..bf1d03447f --- /dev/null +++ b/vendor/k8s.io/klog/v2/ktesting/setup.go @@ -0,0 +1,38 @@ +/* +Copyright 2021 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. +*/ + +package ktesting + +import ( + "context" + + "github.com/go-logr/logr" +) + +// DefaultConfig is the global default logging configuration for a unit +// test. It is used by NewTestContext and k8s.io/klogr/testing/init. +var DefaultConfig = NewConfig() + +// NewTestContext returns a logger and context for use in a unit test case or +// benchmark. The tl parameter can be a testing.T or testing.B pointer that +// will receive all log output. Importing k8s.io/klogr/testing/init will add +// command line flags that modify the configuration of that log output. +func NewTestContext(tl TL) (logr.Logger, context.Context) { + logger := NewLogger(tl, DefaultConfig) + ctx := logr.NewContext(context.Background(), logger) + return logger, ctx + +} diff --git a/vendor/k8s.io/klog/v2/ktesting/testinglogger.go b/vendor/k8s.io/klog/v2/ktesting/testinglogger.go new file mode 100644 index 0000000000..e8ffd4115d --- /dev/null +++ b/vendor/k8s.io/klog/v2/ktesting/testinglogger.go @@ -0,0 +1,407 @@ +/* +Copyright 2019 The Kubernetes Authors. +Copyright 2020 Intel Corporation. + +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. +*/ + +// Package testinglogger contains an implementation of the logr interface +// which is logging through a function like testing.TB.Log function. +// Therefore it can be used in standard Go tests and Gingko test suites +// to ensure that output is associated with the currently running test. +// +// In addition, the log data is captured in a buffer and can be used by the +// test to verify that the code under test is logging as expected. To get +// access to that data, cast the LogSink into the Underlier type and retrieve +// it: +// +// logger := ktesting.NewLogger(...) +// if testingLogger, ok := logger.GetSink().(ktesting.Underlier); ok { +// t := testingLogger.GetUnderlying() +// buffer := testingLogger.GetBuffer() +// text := buffer.String() +// log := buffer.Data() +// +// Serialization of the structured log parameters is done in the same way +// as for klog.InfoS. +package ktesting + +import ( + "fmt" + "strings" + "sync" + "time" + + "github.com/go-logr/logr" + + "k8s.io/klog/v2" + "k8s.io/klog/v2/internal/buffer" + "k8s.io/klog/v2/internal/dbg" + "k8s.io/klog/v2/internal/serialize" + "k8s.io/klog/v2/internal/severity" + "k8s.io/klog/v2/internal/verbosity" +) + +// TL is the relevant subset of testing.TB. +type TL interface { + Helper() + Log(args ...interface{}) +} + +// NopTL implements TL with empty stubs. It can be used when only capturing +// output in memory is relevant. +type NopTL struct{} + +func (n NopTL) Helper() {} +func (n NopTL) Log(...interface{}) {} + +var _ TL = NopTL{} + +// BufferTL implements TL with an in-memory buffer. +type BufferTL struct { + strings.Builder +} + +func (n *BufferTL) Helper() {} +func (n *BufferTL) Log(args ...interface{}) { + n.Builder.WriteString(fmt.Sprintln(args...)) +} + +var _ TL = &BufferTL{} + +// NewLogger constructs a new logger for the given test interface. +// +// Beware that testing.T does not support logging after the test that +// it was created for has completed. If a test leaks goroutines +// and those goroutines log something after test completion, +// that output will be printed via the global klog logger with +// ` leaked goroutine` as prefix. +// +// Verbosity can be modified at any time through the Config.V and +// Config.VModule API. +func NewLogger(t TL, c *Config) logr.Logger { + l := tlogger{ + shared: &tloggerShared{ + t: t, + config: c, + }, + } + if c.co.anyToString != nil { + l.shared.formatter.AnyToStringHook = c.co.anyToString + } + + type testCleanup interface { + Cleanup(func()) + Name() string + } + + // Stopping the logging is optional and only done (and required) + // for testing.T/B/F. + if tb, ok := t.(testCleanup); ok { + tb.Cleanup(l.shared.stop) + l.shared.testName = tb.Name() + } + return logr.New(l) +} + +// Buffer stores log entries as formatted text and structured data. +// It is safe to use this concurrently. +type Buffer interface { + // String returns the log entries in a format that is similar to the + // klog text output. + String() string + + // Data returns the log entries as structs. + Data() Log +} + +// Log contains log entries in the order in which they were generated. +type Log []LogEntry + +// DeepCopy returns a copy of the log. The error instance and key/value +// pairs remain shared. +func (l Log) DeepCopy() Log { + log := make(Log, 0, len(l)) + log = append(log, l...) + return log +} + +// LogEntry represents all information captured for a log entry. +type LogEntry struct { + // Timestamp stores the time when the log entry was created. + Timestamp time.Time + + // Type is either LogInfo or LogError. + Type LogType + + // Prefix contains the WithName strings concatenated with a slash. + Prefix string + + // Message is the fixed log message string. + Message string + + // Verbosity is always 0 for LogError. + Verbosity int + + // Err is always nil for LogInfo. It may or may not be + // nil for LogError. + Err error + + // WithKVList are the concatenated key/value pairs from WithValues + // calls. It's guaranteed to have an even number of entries because + // the logger ensures that when WithValues is called. + WithKVList []interface{} + + // ParameterKVList are the key/value pairs passed into the call, + // without any validation. + ParameterKVList []interface{} +} + +// LogType determines whether a log entry was created with an Error or Info +// call. +type LogType string + +const ( + // LogError is the special value used for Error log entries. + LogError = LogType("ERROR") + + // LogInfo is the special value used for Info log entries. + LogInfo = LogType("INFO") +) + +// Underlier is implemented by the LogSink of this logger. It provides access +// to additional APIs that are normally hidden behind the Logger API. +type Underlier interface { + // GetUnderlying returns the testing instance that logging goes to. + // It returns nil when the test has completed already. + GetUnderlying() TL + + // GetBuffer grants access to the in-memory copy of the log entries. + GetBuffer() Buffer +} + +type logBuffer struct { + mutex sync.Mutex + text strings.Builder + log Log +} + +func (b *logBuffer) String() string { + b.mutex.Lock() + defer b.mutex.Unlock() + return b.text.String() +} + +func (b *logBuffer) Data() Log { + b.mutex.Lock() + defer b.mutex.Unlock() + return b.log.DeepCopy() +} + +// tloggerShared holds values that are the same for all LogSink instances. It +// gets referenced by pointer in the tlogger struct. +type tloggerShared struct { + // mutex protects access to t. + mutex sync.Mutex + + // t gets cleared when the test is completed. + t TL + + // The time when the test completed. + stopTime time.Time + + // We warn once when a leaked goroutine logs after test completion. + // + // Not terminating immediately is fairly normal: many controllers + // log "terminating" messages while they shut down, which often is + // right after test completion, if that is when the test cancels the + // context and then doesn't wait for goroutines (which is often + // not possible). + // + // Therefore there is the [stopGracePeriod] during which messages get + // logged to the global logger without the warning. + goroutineWarningDone bool + + formatter serialize.Formatter + testName string + config *Config + buffer logBuffer + callDepth int +} + +// Log output of a leaked goroutine during this period after test completion +// does not trigger the warning. +const stopGracePeriod = 10 * time.Second + +func (ls *tloggerShared) stop() { + ls.mutex.Lock() + defer ls.mutex.Unlock() + ls.t = nil + ls.stopTime = time.Now() +} + +// tlogger is the actual LogSink implementation. +type tlogger struct { + shared *tloggerShared + prefix string + values []interface{} +} + +// fallbackLogger is called while l.shared.mutex is locked and after it has +// been determined that the original testing.TB is no longer usable. +func (l tlogger) fallbackLogger() logr.Logger { + logger := klog.Background().WithValues(l.values...).WithName(l.shared.testName + " leaked goroutine") + if l.prefix != "" { + logger = logger.WithName(l.prefix) + } + // Skip direct caller (= Error or Info) plus the logr wrapper. + logger = logger.WithCallDepth(l.shared.callDepth + 1) + + if !l.shared.goroutineWarningDone { + duration := time.Since(l.shared.stopTime) + if duration > stopGracePeriod { + + logger.WithCallDepth(1).Info("WARNING: test kept at least one goroutine running after test completion", "timeSinceCompletion", duration.Round(time.Second), "callstack", string(dbg.Stacks(false))) + l.shared.goroutineWarningDone = true + } + } + return logger +} + +func (l tlogger) Init(info logr.RuntimeInfo) { + l.shared.callDepth = info.CallDepth +} + +func (l tlogger) GetCallStackHelper() func() { + l.shared.mutex.Lock() + defer l.shared.mutex.Unlock() + if l.shared.t == nil { + return func() {} + } + + return l.shared.t.Helper +} + +func (l tlogger) Info(level int, msg string, kvList ...interface{}) { + l.shared.mutex.Lock() + defer l.shared.mutex.Unlock() + if l.shared.t == nil { + l.fallbackLogger().V(level).Info(msg, kvList...) + return + } + + l.shared.t.Helper() + buf := buffer.GetBuffer() + l.shared.formatter.FormatKVs(&buf.Buffer, l.values, kvList) + l.log(LogInfo, msg, level, buf, nil, kvList) +} + +func (l tlogger) Enabled(level int) bool { + return l.shared.config.vstate.Enabled(verbosity.Level(level), l.shared.callDepth+1) +} + +func (l tlogger) Error(err error, msg string, kvList ...interface{}) { + l.shared.mutex.Lock() + defer l.shared.mutex.Unlock() + if l.shared.t == nil { + l.fallbackLogger().Error(err, msg, kvList...) + return + } + + l.shared.t.Helper() + buf := buffer.GetBuffer() + var errKV []interface{} + if err != nil { + errKV = []interface{}{"err", err} + } + l.shared.formatter.FormatKVs(&buf.Buffer, errKV, l.values, kvList) + l.log(LogError, msg, 0, buf, err, kvList) +} + +func (l tlogger) log(what LogType, msg string, level int, buf *buffer.Buffer, err error, kvList []interface{}) { + l.shared.t.Helper() + s := severity.InfoLog + if what == LogError { + s = severity.ErrorLog + } + args := []interface{}{buf.SprintHeader(s, time.Now())} + if l.prefix != "" { + args = append(args, l.prefix+":") + } + args = append(args, msg) + if buf.Len() > 0 { + // Skip leading space inserted by serialize.KVListFormat. + args = append(args, string(buf.Bytes()[1:])) + } + l.shared.t.Log(args...) + + if !l.shared.config.co.bufferLogs { + return + } + + l.shared.buffer.mutex.Lock() + defer l.shared.buffer.mutex.Unlock() + + // Store as text. + l.shared.buffer.text.WriteString(string(what)) + for i := 1; i < len(args); i++ { + l.shared.buffer.text.WriteByte(' ') + l.shared.buffer.text.WriteString(args[i].(string)) + } + lastArg := args[len(args)-1].(string) + if lastArg[len(lastArg)-1] != '\n' { + l.shared.buffer.text.WriteByte('\n') + } + + // Store as raw data. + l.shared.buffer.log = append(l.shared.buffer.log, + LogEntry{ + Timestamp: time.Now(), + Type: what, + Prefix: l.prefix, + Message: msg, + Verbosity: level, + Err: err, + WithKVList: l.values, + ParameterKVList: kvList, + }, + ) +} + +// WithName returns a new logr.Logger with the specified name appended. klogr +// uses '/' characters to separate name elements. Callers should not pass '/' +// in the provided name string, but this library does not actually enforce that. +func (l tlogger) WithName(name string) logr.LogSink { + if len(l.prefix) > 0 { + l.prefix = l.prefix + "/" + } + l.prefix += name + return l +} + +func (l tlogger) WithValues(kvList ...interface{}) logr.LogSink { + l.values = serialize.WithValues(l.values, kvList) + return l +} + +func (l tlogger) GetUnderlying() TL { + return l.shared.t +} + +func (l tlogger) GetBuffer() Buffer { + return &l.shared.buffer +} + +var _ logr.LogSink = &tlogger{} +var _ logr.CallStackHelperLogSink = &tlogger{} +var _ Underlier = &tlogger{} diff --git a/vendor/k8s.io/kube-controller-manager/config/v1alpha1/types.go b/vendor/k8s.io/kube-controller-manager/config/v1alpha1/types.go index 3de443940b..6012073ed1 100644 --- a/vendor/k8s.io/kube-controller-manager/config/v1alpha1/types.go +++ b/vendor/k8s.io/kube-controller-manager/config/v1alpha1/types.go @@ -170,6 +170,8 @@ type KubeControllerManagerConfiguration struct { ValidatingAdmissionPolicyStatusController ValidatingAdmissionPolicyStatusControllerConfiguration // DeviceTaintEvictionControllerConfiguration contains elements configuring the device taint eviction controller. DeviceTaintEvictionController DeviceTaintEvictionControllerConfiguration + // ResourceClaimControllerConfiguration contains elements configuring the resource claim controller. + ResourceClaimController ResourceClaimControllerConfiguration } // AttachDetachControllerConfiguration contains elements describing AttachDetachController. @@ -499,3 +501,12 @@ type DeviceTaintEvictionControllerConfiguration struct { // The default is 10. ConcurrentSyncs int32 } + +// ResourceClaimControllerConfiguration contains elements configuring the resource claim controller. +type ResourceClaimControllerConfiguration struct { + // ConcurrentSyncs is the number of operations (deleting a pod, updating a ResourcClaim status, etc.) + // that will be done concurrently. Larger number = processing, but more CPU (and network) load. + // + // The default is 50. + ConcurrentSyncs int32 +} diff --git a/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.deepcopy.go b/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.deepcopy.go index 9715eca85b..8c9e2b18c9 100644 --- a/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.deepcopy.go @@ -338,6 +338,7 @@ func (in *KubeControllerManagerConfiguration) DeepCopyInto(out *KubeControllerMa out.TTLAfterFinishedController = in.TTLAfterFinishedController out.ValidatingAdmissionPolicyStatusController = in.ValidatingAdmissionPolicyStatusController out.DeviceTaintEvictionController = in.DeviceTaintEvictionController + out.ResourceClaimController = in.ResourceClaimController return } @@ -510,6 +511,22 @@ func (in *ReplicationControllerConfiguration) DeepCopy() *ReplicationControllerC return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceClaimControllerConfiguration) DeepCopyInto(out *ResourceClaimControllerConfiguration) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceClaimControllerConfiguration. +func (in *ResourceClaimControllerConfiguration) DeepCopy() *ResourceClaimControllerConfiguration { + if in == nil { + return nil + } + out := new(ResourceClaimControllerConfiguration) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceQuotaControllerConfiguration) DeepCopyInto(out *ResourceQuotaControllerConfiguration) { *out = *in diff --git a/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.model_name.go b/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.model_name.go index 9a5598f39d..ae2bc80301 100644 --- a/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.model_name.go +++ b/vendor/k8s.io/kube-controller-manager/config/v1alpha1/zz_generated.model_name.go @@ -151,6 +151,11 @@ func (in ReplicationControllerConfiguration) OpenAPIModelName() string { return "io.k8s.kube-controller-manager.config.v1alpha1.ReplicationControllerConfiguration" } +// OpenAPIModelName returns the OpenAPI model name for this type. +func (in ResourceClaimControllerConfiguration) OpenAPIModelName() string { + return "io.k8s.kube-controller-manager.config.v1alpha1.ResourceClaimControllerConfiguration" +} + // OpenAPIModelName returns the OpenAPI model name for this type. func (in ResourceQuotaControllerConfiguration) OpenAPIModelName() string { return "io.k8s.kube-controller-manager.config.v1alpha1.ResourceQuotaControllerConfiguration" diff --git a/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go b/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go index 775b3b0c36..29cec61930 100644 --- a/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go +++ b/vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go @@ -16,10 +16,6 @@ package spec import ( "encoding/json" - "net/http" - "os" - "path/filepath" - "github.com/go-openapi/jsonreference" "k8s.io/kube-openapi/pkg/internal" @@ -56,52 +52,6 @@ func (r *Ref) RemoteURI() string { return u.String() } -// IsValidURI returns true when the url the ref points to can be found -func (r *Ref) IsValidURI(basepaths ...string) bool { - if r.String() == "" { - return true - } - - v := r.RemoteURI() - if v == "" { - return true - } - - if r.HasFullURL { - rr, err := http.Get(v) - if err != nil { - return false - } - - return rr.StatusCode/100 == 2 - } - - if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) { - return false - } - - // check for local file - pth := v - if r.HasURLPathOnly { - base := "." - if len(basepaths) > 0 { - base = filepath.Dir(filepath.Join(basepaths...)) - } - p, e := filepath.Abs(filepath.ToSlash(filepath.Join(base, pth))) - if e != nil { - return false - } - pth = p - } - - fi, err := os.Stat(filepath.ToSlash(pth)) - if err != nil { - return false - } - - return !fi.IsDir() -} - // Inherits creates a new reference from a parent and a child // If the child cannot inherit from the parent, an error is returned func (r *Ref) Inherits(child Ref) (*Ref, error) { diff --git a/vendor/k8s.io/kubectl/pkg/scale/scale.go b/vendor/k8s.io/kubectl/pkg/scale/scale.go index d2dc51fc69..fd55935362 100644 --- a/vendor/k8s.io/kubectl/pkg/scale/scale.go +++ b/vendor/k8s.io/kubectl/pkg/scale/scale.go @@ -39,10 +39,10 @@ type Scaler interface { // retries in the event of resource version mismatch (if retry is not nil), // and optionally waits until the status of the resource matches newSize (if wait is not nil) // TODO: Make the implementation of this watch-based (#56075) once #31345 is fixed. - Scale(namespace, name string, newSize uint, preconditions *ScalePrecondition, retry, wait *RetryParams, gvr schema.GroupVersionResource, dryRun bool) error + Scale(namespace, name string, newSize uint, actualSize *int32, preconditions *ScalePrecondition, retry, wait *RetryParams, gvr schema.GroupVersionResource, dryRun bool) error // ScaleSimple does a simple one-shot attempt at scaling - not useful on its own, but // a necessary building block for Scale - ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint, gvr schema.GroupVersionResource, dryRun bool) (updatedResourceVersion string, err error) + ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint, gvr schema.GroupVersionResource, dryRun bool) (updatedResourceVersion string, actualSize int32, err error) } // NewScaler get a scaler for a given resource @@ -81,12 +81,15 @@ func NewRetryParams(interval, timeout time.Duration) *RetryParams { } // ScaleCondition is a closure around Scale that facilitates retries via util.wait -func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name string, count uint, updatedResourceVersion *string, gvr schema.GroupVersionResource, dryRun bool) wait.ConditionWithContextFunc { +func ScaleCondition(r Scaler, precondition *ScalePrecondition, namespace, name string, count uint, updatedResourceVersion *string, actualSize *int32, gvr schema.GroupVersionResource, dryRun bool) wait.ConditionWithContextFunc { return func(context.Context) (bool, error) { - rv, err := r.ScaleSimple(namespace, name, precondition, count, gvr, dryRun) + rv, size, err := r.ScaleSimple(namespace, name, precondition, count, gvr, dryRun) if updatedResourceVersion != nil { *updatedResourceVersion = rv } + if actualSize != nil { + *actualSize = size + } // Retry only on update conflicts. if apierrors.IsConflict(err) { return false, nil @@ -117,14 +120,14 @@ type genericScaler struct { var _ Scaler = &genericScaler{} // ScaleSimple updates a scale of a given resource. It returns the resourceVersion of the scale if the update was successful. -func (s *genericScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint, gvr schema.GroupVersionResource, dryRun bool) (updatedResourceVersion string, err error) { +func (s *genericScaler) ScaleSimple(namespace, name string, preconditions *ScalePrecondition, newSize uint, gvr schema.GroupVersionResource, dryRun bool) (updatedResourceVersion string, actualSize int32, err error) { if preconditions != nil { scale, err := s.scaleNamespacer.Scales(namespace).Get(context.TODO(), gvr.GroupResource(), name, metav1.GetOptions{}) if err != nil { - return "", err + return "", 0, err } if err = preconditions.validate(scale); err != nil { - return "", err + return "", 0, err } scale.Spec.Replicas = int32(newSize) updateOptions := metav1.UpdateOptions{} @@ -133,9 +136,9 @@ func (s *genericScaler) ScaleSimple(namespace, name string, preconditions *Scale } updatedScale, err := s.scaleNamespacer.Scales(namespace).Update(context.TODO(), gvr.GroupResource(), scale, updateOptions) if err != nil { - return "", err + return "", 0, err } - return updatedScale.ResourceVersion, nil + return updatedScale.ResourceVersion, updatedScale.Spec.Replicas, nil } // objectForReplicas is used for encoding scale patch @@ -151,7 +154,7 @@ func (s *genericScaler) ScaleSimple(namespace, name string, preconditions *Scale } patch, err := json.Marshal(&spec) if err != nil { - return "", err + return "", 0, err } patchOptions := metav1.PatchOptions{} if dryRun { @@ -159,19 +162,19 @@ func (s *genericScaler) ScaleSimple(namespace, name string, preconditions *Scale } updatedScale, err := s.scaleNamespacer.Scales(namespace).Patch(context.TODO(), gvr, name, types.MergePatchType, patch, patchOptions) if err != nil { - return "", err + return "", 0, err } - return updatedScale.ResourceVersion, nil + return updatedScale.ResourceVersion, updatedScale.Spec.Replicas, nil } // Scale updates a scale of a given resource to a new size, with optional precondition check (if preconditions is not nil), // optional retries (if retry is not nil), and then optionally waits for the status to reach desired count. -func (s *genericScaler) Scale(namespace, resourceName string, newSize uint, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams, gvr schema.GroupVersionResource, dryRun bool) error { +func (s *genericScaler) Scale(namespace, resourceName string, newSize uint, actualSize *int32, preconditions *ScalePrecondition, retry, waitForReplicas *RetryParams, gvr schema.GroupVersionResource, dryRun bool) error { if retry == nil { // make it try only once, immediately retry = &RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond} } - cond := ScaleCondition(s, preconditions, namespace, resourceName, newSize, nil, gvr, dryRun) + cond := ScaleCondition(s, preconditions, namespace, resourceName, newSize, nil, actualSize, gvr, dryRun) if err := wait.PollUntilContextTimeout(context.Background(), retry.Interval, retry.Timeout, true, cond); err != nil { return err } diff --git a/vendor/k8s.io/kubernetes/cmd/kube-controller-manager/names/controller_names.go b/vendor/k8s.io/kubernetes/cmd/kube-controller-manager/names/controller_names.go index baaa97c076..a7e26aa844 100644 --- a/vendor/k8s.io/kubernetes/cmd/kube-controller-manager/names/controller_names.go +++ b/vendor/k8s.io/kubernetes/cmd/kube-controller-manager/names/controller_names.go @@ -76,12 +76,14 @@ const ( ClusterRoleAggregationController = "clusterrole-aggregation-controller" PersistentVolumeClaimProtectionController = "persistentvolumeclaim-protection-controller" PersistentVolumeProtectionController = "persistentvolume-protection-controller" + PodGroupProtectionController = "podgroup-protection-controller" TTLAfterFinishedController = "ttl-after-finished-controller" RootCACertificatePublisherController = "root-ca-certificate-publisher-controller" KubeAPIServerClusterTrustBundlePublisherController = "kube-apiserver-serving-clustertrustbundle-publisher-controller" EphemeralVolumeController = "ephemeral-volume-controller" StorageVersionGarbageCollectorController = "storageversion-garbage-collector-controller" ResourceClaimController = "resourceclaim-controller" + ResourcePoolStatusRequestController = "resourcepoolstatusrequest-controller" LegacyServiceAccountTokenCleanerController = "legacy-serviceaccount-token-cleaner-controller" ValidatingAdmissionPolicyStatusController = "validatingadmissionpolicy-status-controller" VolumeAttributesClassProtectionController = "volumeattributesclass-protection-controller" diff --git a/vendor/k8s.io/kubernetes/pkg/api/service/warnings.go b/vendor/k8s.io/kubernetes/pkg/api/service/warnings.go index a9f0cdad25..58903e2dba 100644 --- a/vendor/k8s.io/kubernetes/pkg/api/service/warnings.go +++ b/vendor/k8s.io/kubernetes/pkg/api/service/warnings.go @@ -57,6 +57,11 @@ func GetWarningsForService(service, oldService *api.Service) []string { warnings = append(warnings, utilvalidation.GetWarningsForIP(field.NewPath("spec").Child("externalIPs").Index(i), externalIP)...) } + // Warn about using externalIPs + if len(service.Spec.ExternalIPs) > 0 && !isHeadlessService(service) && service.Spec.Type != api.ServiceTypeExternalName { //nolint:staticcheck // SA1019 testing deprecated field + warnings = append(warnings, "spec.externalIPs is deprecated and may no longer be implemented in some clusters") + } + if len(service.Spec.LoadBalancerIP) > 0 { warnings = append(warnings, utilvalidation.GetWarningsForIP(field.NewPath("spec").Child("loadBalancerIP"), service.Spec.LoadBalancerIP)...) } diff --git a/vendor/k8s.io/kubernetes/pkg/api/v1/resource/helpers.go b/vendor/k8s.io/kubernetes/pkg/api/v1/resource/helpers.go new file mode 100644 index 0000000000..bf02b53a22 --- /dev/null +++ b/vendor/k8s.io/kubernetes/pkg/api/v1/resource/helpers.go @@ -0,0 +1,209 @@ +/* +Copyright 2014 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. +*/ + +package resource + +import ( + "fmt" + "math" + "strconv" + "strings" + + v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + utilfeature "k8s.io/apiserver/pkg/util/feature" + resourcehelper "k8s.io/component-helpers/resource" + "k8s.io/kubernetes/pkg/features" +) + +// GetResourceRequestQuantity finds and returns the request quantity for a specific resource. +func GetResourceRequestQuantity(pod *v1.Pod, resourceName v1.ResourceName) resource.Quantity { + requestQuantity := resource.Quantity{} + + switch resourceName { + case v1.ResourceCPU: + requestQuantity = resource.Quantity{Format: resource.DecimalSI} + case v1.ResourceMemory, v1.ResourceStorage, v1.ResourceEphemeralStorage: + requestQuantity = resource.Quantity{Format: resource.BinarySI} + default: + requestQuantity = resource.Quantity{Format: resource.DecimalSI} + } + + // Supported pod level resources will be used instead of container level ones when available + hasPodLevelResources := utilfeature.DefaultFeatureGate.Enabled(features.PodLevelResources) && resourcehelper.IsPodLevelResourcesSet(pod) + + if rQuantity, ok := resourcehelper.PodRequests(pod, resourcehelper.PodResourcesOptions{SkipContainerLevelResources: hasPodLevelResources, ExcludeOverhead: true})[resourceName]; ok { + requestQuantity.Add(rQuantity) + } + + // Add overhead for running a pod + // to the total requests if the resource total is non-zero + if pod.Spec.Overhead != nil { + if podOverhead, ok := pod.Spec.Overhead[resourceName]; ok && !requestQuantity.IsZero() { + requestQuantity.Add(podOverhead) + } + } + + return requestQuantity +} + +// GetResourceRequest finds and returns the request value for a specific resource. +func GetResourceRequest(pod *v1.Pod, resource v1.ResourceName) int64 { + if resource == v1.ResourcePods { + return 1 + } + + requestQuantity := GetResourceRequestQuantity(pod, resource) + + if resource == v1.ResourceCPU { + return requestQuantity.MilliValue() + } + + return requestQuantity.Value() +} + +// ExtractResourceValueByContainerName extracts the value of a resource +// by providing container name +func ExtractResourceValueByContainerName(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string) (string, error) { + container, err := findContainerInPod(pod, containerName) + if err != nil { + return "", err + } + return ExtractContainerResourceValue(fs, container) +} + +// ExtractResourceValueByContainerNameAndNodeAllocatable extracts the value of a resource +// by providing container name and node allocatable +func ExtractResourceValueByContainerNameAndNodeAllocatable(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string, nodeAllocatable v1.ResourceList) (string, error) { + realContainer, err := findContainerInPod(pod, containerName) + if err != nil { + return "", err + } + + container := realContainer.DeepCopy() + + MergeContainerResourceLimits(container, nodeAllocatable) + + return ExtractContainerResourceValue(fs, container) +} + +// ExtractContainerResourceValue extracts the value of a resource +// in an already known container +func ExtractContainerResourceValue(fs *v1.ResourceFieldSelector, container *v1.Container) (string, error) { + divisor := resource.Quantity{} + if divisor.Cmp(fs.Divisor) == 0 { + divisor = resource.MustParse("1") + } else { + divisor = fs.Divisor + } + + switch fs.Resource { + case "limits.cpu": + return convertResourceCPUToString(container.Resources.Limits.Cpu(), divisor) + case "limits.memory": + return convertResourceMemoryToString(container.Resources.Limits.Memory(), divisor) + case "limits.ephemeral-storage": + return convertResourceEphemeralStorageToString(container.Resources.Limits.StorageEphemeral(), divisor) + case "requests.cpu": + return convertResourceCPUToString(container.Resources.Requests.Cpu(), divisor) + case "requests.memory": + return convertResourceMemoryToString(container.Resources.Requests.Memory(), divisor) + case "requests.ephemeral-storage": + return convertResourceEphemeralStorageToString(container.Resources.Requests.StorageEphemeral(), divisor) + } + // handle extended standard resources with dynamic names + // example: requests.hugepages- or limits.hugepages- + if strings.HasPrefix(fs.Resource, "requests.") { + resourceName := v1.ResourceName(strings.TrimPrefix(fs.Resource, "requests.")) + if IsHugePageResourceName(resourceName) { + return convertResourceHugePagesToString(container.Resources.Requests.Name(resourceName, resource.BinarySI), divisor) + } + } + if strings.HasPrefix(fs.Resource, "limits.") { + resourceName := v1.ResourceName(strings.TrimPrefix(fs.Resource, "limits.")) + if IsHugePageResourceName(resourceName) { + return convertResourceHugePagesToString(container.Resources.Limits.Name(resourceName, resource.BinarySI), divisor) + } + } + return "", fmt.Errorf("unsupported container resource : %v", fs.Resource) +} + +// convertResourceCPUToString converts cpu value to the format of divisor and returns +// ceiling of the value. +func convertResourceCPUToString(cpu *resource.Quantity, divisor resource.Quantity) (string, error) { + c := int64(math.Ceil(float64(cpu.MilliValue()) / float64(divisor.MilliValue()))) + return strconv.FormatInt(c, 10), nil +} + +// convertResourceMemoryToString converts memory value to the format of divisor and returns +// ceiling of the value. +func convertResourceMemoryToString(memory *resource.Quantity, divisor resource.Quantity) (string, error) { + m := int64(math.Ceil(float64(memory.Value()) / float64(divisor.Value()))) + return strconv.FormatInt(m, 10), nil +} + +// convertResourceHugePagesToString converts hugepages value to the format of divisor and returns +// ceiling of the value. +func convertResourceHugePagesToString(hugePages *resource.Quantity, divisor resource.Quantity) (string, error) { + m := int64(math.Ceil(float64(hugePages.Value()) / float64(divisor.Value()))) + return strconv.FormatInt(m, 10), nil +} + +// convertResourceEphemeralStorageToString converts ephemeral storage value to the format of divisor and returns +// ceiling of the value. +func convertResourceEphemeralStorageToString(ephemeralStorage *resource.Quantity, divisor resource.Quantity) (string, error) { + m := int64(math.Ceil(float64(ephemeralStorage.Value()) / float64(divisor.Value()))) + return strconv.FormatInt(m, 10), nil +} + +// findContainerInPod finds a container by its name in the provided pod +func findContainerInPod(pod *v1.Pod, containerName string) (*v1.Container, error) { + for _, container := range pod.Spec.Containers { + if container.Name == containerName { + return &container, nil + } + } + for _, container := range pod.Spec.InitContainers { + if container.Name == containerName { + return &container, nil + } + } + return nil, fmt.Errorf("container %s not found", containerName) +} + +// MergeContainerResourceLimits checks if a limit is applied for +// the container, and if not, it sets the limit to the passed resource list. +func MergeContainerResourceLimits(container *v1.Container, + allocatable v1.ResourceList) { + if container.Resources.Limits == nil { + container.Resources.Limits = make(v1.ResourceList) + } + // NOTE: we exclude hugepages-* resources because hugepages are never overcommitted. + // This means that the container always has a limit specified. + for _, resource := range []v1.ResourceName{v1.ResourceCPU, v1.ResourceMemory, v1.ResourceEphemeralStorage} { + if quantity, exists := container.Resources.Limits[resource]; !exists || quantity.IsZero() { + if cap, exists := allocatable[resource]; exists { + container.Resources.Limits[resource] = cap.DeepCopy() + } + } + } +} + +// IsHugePageResourceName returns true if the resource name has the huge page +// resource prefix. +func IsHugePageResourceName(name v1.ResourceName) bool { + return strings.HasPrefix(string(name), v1.ResourceHugePagesPrefix) +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/annotations.go b/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/annotations.go index d793cd4aa3..0df01c1438 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/annotations.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/annotations.go @@ -17,19 +17,19 @@ limitations under the License. package autoscaling // MetricSpecsAnnotation is the annotation which holds non-CPU-utilization HPA metric -// specs when converting the `Metrics` field from autoscaling/v2beta1 +// specs when converting the `Metrics` field from autoscaling/v2 const MetricSpecsAnnotation = "autoscaling.alpha.kubernetes.io/metrics" // MetricStatusesAnnotation is the annotation which holds non-CPU-utilization HPA metric -// statuses when converting the `CurrentMetrics` field from autoscaling/v2beta1 +// statuses when converting the `CurrentMetrics` field from autoscaling/v2 const MetricStatusesAnnotation = "autoscaling.alpha.kubernetes.io/current-metrics" // HorizontalPodAutoscalerConditionsAnnotation is the annotation which holds the conditions -// of an HPA when converting the `Conditions` field from autoscaling/v2beta1 +// of an HPA when converting the `Conditions` field from autoscaling/v2 const HorizontalPodAutoscalerConditionsAnnotation = "autoscaling.alpha.kubernetes.io/conditions" // DefaultCPUUtilization is the default value for CPU utilization, provided no other -// metrics are present. This is here because it's used by both the v2beta1 defaulting +// metrics are present. This is here because it's used by both the v2 defaulting // logic, and the pseudo-defaulting done in v1 conversion. const DefaultCPUUtilization = 80 diff --git a/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/types.go b/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/types.go index b8802a992b..dfbc0474d9 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/types.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/autoscaling/types.go @@ -433,6 +433,8 @@ const ( // ScalingLimited indicates that the calculated scale based on metrics would be above or // below the range for the HPA, and has thus been capped. ScalingLimited HorizontalPodAutoscalerConditionType = "ScalingLimited" + // ScaledToZero indicates that the HPA controller scaled the workload to zero. + ScaledToZero HorizontalPodAutoscalerConditionType = "ScaledToZero" ) // HorizontalPodAutoscalerCondition describes the state of diff --git a/vendor/k8s.io/kubernetes/pkg/apis/certificates/types.go b/vendor/k8s.io/kubernetes/pkg/apis/certificates/types.go index 1f7e345406..78429bbdf0 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/certificates/types.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/certificates/types.go @@ -340,8 +340,7 @@ type PodCertificateRequestSpec struct { // seconds (1 hour). This constraint is enforced by kube-apiserver. MaxExpirationSeconds *int32 - // pkixPublicKey is the PKIX-serialized public key the signer will issue the - // certificate to. + // The PKIX-serialized public key the signer will issue the certificate to. // // The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, // or ED25519. Note that this list may be expanded in the future. @@ -352,13 +351,20 @@ type PodCertificateRequestSpec struct { // setting a status.conditions entry with a type of "Denied" and a reason of // "UnsupportedKeyType". It may also suggest a key type that it does support // in the message field. + // + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. Signer + // implementations should extract the public key from the StubPKCS10Request + // field. + // + // +optional PKIXPublicKey []byte - // proofOfPossession proves that the requesting kubelet holds the private - // key corresponding to pkixPublicKey. + // A proof that the requesting kubelet holds the private key corresponding + // to pkixPublicKey. // // It is contructed by signing the ASCII bytes of the pod's UID using - // `PKIXPublicKey`. + // `pkixPublicKey`. // // kube-apiserver validates the proof of possession during creation of the // PodCertificateRequest. @@ -374,8 +380,33 @@ type PodCertificateRequestSpec struct { // If the key is an ED25519 key, the the signature is as described by the // [ED25519 Specification](https://ed25519.cr.yp.to/) (as implemented by the // golang library crypto/ed25519.Sign). + // + // Deprecated: This field is replaced by StubPKCS10Request. If + // StubPKCS10Request is set, this field must be empty. + // + // +optional ProofOfPossession []byte + // A PKCS#10 certificate signing request (DER-serialized) generated by + // Kubelet using the subject private key. + // + // Most signer implementations will ignore the contents of the CSR except to + // extract the subject public key. The API server automatically verifies the + // CSR signature during admission, so the signer does not need to repeat the + // verification. CSRs generated by kubelet are completely empty. + // + // The subject public key must be one of RSA3072, RSA4096, ECDSAP256, + // ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in + // the future. + // + // Signer implementations do not need to support all key types supported by + // kube-apiserver and kubelet. If a signer does not support the key type + // used for a given PodCertificateRequest, it must deny the request by + // setting a status.conditions entry with a type of "Denied" and a reason of + // "UnsupportedKeyType". It may also suggest a key type that it does support + // in the message field. + StubPKCS10Request []byte + // unverifiedUserAnnotations allow pod authors to pass additional information to // the signer implementation. Kubernetes does not restrict or validate this // metadata in any way. @@ -485,6 +516,9 @@ const ( // MaxProofOfPossessionSize is the maximum size permitted for the // ProofOfPossession field. MaxProofOfPossessionSize = 10 * 1024 + // MaxStubPKCS10RequestSize is the maximum size permitted for the + // UnverifiedPKCS10Request field. + MaxStubPKCS10RequestSize = 10 * 1024 // MaxCertificateChainSize is the maximum size permitted for the // CertificateChain field. // diff --git a/vendor/k8s.io/kubernetes/pkg/apis/certificates/zz_generated.deepcopy.go b/vendor/k8s.io/kubernetes/pkg/apis/certificates/zz_generated.deepcopy.go index 9a526c246c..73c5601e4a 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/certificates/zz_generated.deepcopy.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/certificates/zz_generated.deepcopy.go @@ -359,6 +359,11 @@ func (in *PodCertificateRequestSpec) DeepCopyInto(out *PodCertificateRequestSpec *out = make([]byte, len(*in)) copy(*out, *in) } + if in.StubPKCS10Request != nil { + in, out := &in.StubPKCS10Request, &out.StubPKCS10Request + *out = make([]byte, len(*in)) + copy(*out, *in) + } if in.UnverifiedUserAnnotations != nil { in, out := &in.UnverifiedUserAnnotations, &out.UnverifiedUserAnnotations *out = make(map[string]string, len(*in)) diff --git a/vendor/k8s.io/kubernetes/pkg/apis/core/helper/helpers.go b/vendor/k8s.io/kubernetes/pkg/apis/core/helper/helpers.go index 43d482f52d..00592c1e4b 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/core/helper/helpers.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/core/helper/helpers.go @@ -105,6 +105,9 @@ var Semantic = conversion.EqualitiesOrDie( func(a, b metav1.Time) bool { return a.UTC() == b.UTC() }, + func(a, b metav1.FieldsV1) bool { + return a.Equal(b) + }, func(a, b labels.Selector) bool { return a.String() == b.String() }, diff --git a/vendor/k8s.io/kubernetes/pkg/apis/core/types.go b/vendor/k8s.io/kubernetes/pkg/apis/core/types.go index 1de0cf4495..ed0bb0ea87 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/core/types.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/core/types.go @@ -166,8 +166,7 @@ type VolumeSource struct { Projected *ProjectedVolumeSource // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. // +optional PortworxVolume *PortworxVolumeSource // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. @@ -219,10 +218,9 @@ type VolumeSource struct { // A failure to resolve or pull the image during pod startup will block containers from starting and may add significant latency. Failures will be retried using normal volume backoff and will be reported on the pod reason and message. // The types of objects that may be mounted by this volume are defined by the container runtime implementation on a host machine and at minimum must include all valid types supported by the container image field. // The OCI object gets mounted in a single directory (spec.containers[*].volumeMounts.mountPath) by merging the manifest layers in the same way as for container images. - // The volume will be mounted read-only (ro) and non-executable files (noexec). + // The volume will be mounted read-only (ro). // Sub path mounts for containers are not supported (spec.containers[*].volumeMounts.subpath) before 1.33. // The field spec.securityContext.fsGroupChangePolicy has no effect on this volume type. - // +featureGate=ImageVolume // +optional Image *ImageVolumeSource } @@ -309,8 +307,7 @@ type PersistentVolumeSource struct { PhotonPersistentDisk *PhotonPersistentDiskVolumeSource // portworxVolume represents a portworx volume attached and mounted on kubelets host machine. // Deprecated: PortworxVolume is deprecated. All operations for the in-tree portworxVolume type - // are redirected to the pxd.portworx.com CSI driver when the CSIMigrationPortworx feature-gate - // is on. + // are redirected to the pxd.portworx.com CSI driver. // +optional PortworxVolume *PortworxVolumeSource // scaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes. @@ -619,6 +616,17 @@ const ( PersistentVolumeClaimVolumeModifyVolumeError PersistentVolumeClaimConditionType = "ModifyVolumeError" // Volume is being modified PersistentVolumeClaimVolumeModifyingVolume PersistentVolumeClaimConditionType = "ModifyingVolume" + + // PersistentVolumeClaimUnused indicates whether the PVC is currently not in use by any Pod. + // When status is True, the PVC is not referenced by any non-terminal Pod. + // The lastTransitionTime indicates when the PVC last transitioned to being unused. + // + // Both in-use time and unused time duration indicated by this condition may be shorter or + // slightly longer than actual in-use time or unused time because of processing delays or + // when this feature was enabled in the cluster. + // + // Requires PersistentVolumeClaimUnusedSinceTime alpha featuregate + PersistentVolumeClaimUnused PersistentVolumeClaimConditionType = "Unused" ) // +enum @@ -2352,7 +2360,8 @@ type SecretKeySelector struct { // EnvFromSource represents the source of a set of ConfigMaps or Secrets type EnvFromSource struct { - // Optional text to prepend to the name of each environment variable. Must be a C_IDENTIFIER. + // Optional text to prepend to the name of each environment variable. + // May consist of any printable ASCII characters except '='. // +optional Prefix string // The ConfigMap to select from. @@ -2642,7 +2651,8 @@ type Container struct { // +optional Ports []ContainerPort // List of sources to populate environment variables in the container. - // The keys defined within a source must be a C_IDENTIFIER. All invalid keys + // The keys defined within a source may consist of any printable ASCII characters except '='. + // All invalid keys // will be reported as an event when the container is starting. When a key exists in multiple // sources, the value associated with the last source will take precedence. // Values defined by an Env with a duplicate key will take precedence. @@ -2996,7 +3006,6 @@ type ContainerStatus struct { // AllocatedResources represents the compute resources allocated for this container by the // node. Kubelet sets this value to Container.Resources.Requests upon successful pod admission // and after successfully admitting desired pod resize. - // +featureGate=InPlacePodVerticalScalingAllocatedStatus // +optional AllocatedResources ResourceList // Resources represents the compute resource requests and limits that have been successfully @@ -3078,6 +3087,9 @@ type ResourceHealth struct { // // In future we may want to introduce the PermanentlyUnhealthy Status. Health ResourceHealthStatus + // Message provides human-readable context for Health (e.g. "ECC error count exceeded threshold"). + // This field is populated by the kubelet when ResourceHealthStatusMessage is enabled. + Message *string } // ContainerUser represents user identity information @@ -3161,7 +3173,6 @@ const ( // PodCondition represents pod's condition type PodCondition struct { Type PodConditionType - // +featureGate=PodObservedGenerationTracking // +optional ObservedGeneration int64 Status ConditionStatus @@ -3201,6 +3212,28 @@ type VolumeMountStatus struct { // depending on the mount result. // +optional RecursiveReadOnly *RecursiveReadOnlyMode + // volumeStatus represents volume-type-specific status about the mounted + // volume. + // +optional + VolumeStatus *VolumeStatus +} + +// VolumeStatus represents the status of a mounted volume. +// At most one of its members must be specified. +type VolumeStatus struct { + // image represents an OCI object (a container image or artifact) pulled and mounted on the kubelet's host machine. + // +featureGate=ImageVolumeWithDigest + // +optional + Image *ImageVolumeStatus +} + +type ImageVolumeStatus struct { + // ImageRef is the digest of the image used for this volume. + // It should have a value that's similar to the pod's status.containerStatuses[i].imageID. + // The ImageRef length should not exceed 256 characters. + // +kubebuilder:validation:MaxLength=256 + // +required + ImageRef string } // RestartPolicy describes how the container should be restarted. @@ -3899,22 +3932,35 @@ type PodSpec struct { // +featureGate=HostnameOverride // +optional HostnameOverride *string - // WorkloadRef provides a reference to the Workload object that this Pod belongs to. - // This field is used by the scheduler to identify the PodGroup and apply the - // correct group scheduling policies. The Workload object referenced - // by this field may not exist at the time the Pod is created. - // This field is immutable, but a Workload object with the same name - // may be recreated with different policies. Doing this during pod scheduling + // SchedulingGroup provides a reference to the immediate scheduling runtime + // grouping object that this Pod belongs to. + // This field is used by the scheduler to identify the group and apply the + // correct group scheduling policies. The association with a group also + // impacts other lifecycle aspects of a Pod that are relevant in a wider context + // of scheduling like preemption, resource attachment, etc. If not specified, + // the Pod is treated as a single unit in all of these aspects. + // The group object referenced by this field may not exist at the time the + // Pod is created. + // This field is immutable, but a group object with the same name may be + // recreated with different policies. Doing this during pod scheduling // may result in the placement not conforming to the expected policies. // // +featureGate=GenericWorkload // +optional - WorkloadRef *WorkloadReference + SchedulingGroup *PodSchedulingGroup } // PodResourceClaim references exactly one ResourceClaim through a ClaimSource. // It adds a name to it that uniquely identifies the ResourceClaim inside the Pod. // Containers that need access to the ResourceClaim reference it with this name. +// +// When the DRAWorkloadResourceClaims feature gate is enabled and this Pod +// belongs to a PodGroup, a PodResourceClaim is matched to a +// PodGroupResourceClaim if all of their fields are equal (Name, +// ResourceClaimName, and ResourceClaimTemplateName). A matched claim references +// a single ResourceClaim shared across all Pods in the PodGroup, reserved for +// the PodGroup in ResourceClaimStatus.ReservedFor rather than for individual +// Pods. type PodResourceClaim struct { // Name uniquely identifies this resource claim inside the pod. // This must be a DNS_LABEL. @@ -3936,6 +3982,16 @@ type PodResourceClaim struct { // generated component, will be used to form a unique name for the // ResourceClaim, which will be recorded in pod.status.resourceClaimStatuses. // + // When the DRAWorkloadResourceClaims feature gate is enabled and the pod + // belongs to a PodGroup that defines a PodGroupResourceClaim with the same + // Name and ResourceClaimTemplateName, this PodResourceClaim resolves to the + // ResourceClaim generated for the PodGroup. All pods in the group that + // define an equivalent PodResourceClaim matching the + // PodGroupResourceClaim's Name and ResourceClaimTemplateName share the same + // generated ResourceClaim. ResourceClaims generated for a PodGroup are + // owned by the PodGroup and their lifecycles are tied to the PodGroup + // instead of any individual pod. + // // This field is immutable and no changes will be made to the // corresponding ResourceClaim by the control plane after creating the // ResourceClaim. @@ -3955,9 +4011,16 @@ type PodResourceClaimStatus struct { Name string // ResourceClaimName is the name of the ResourceClaim that was - // generated for the Pod in the namespace of the Pod. If this is - // unset, then generating a ResourceClaim was not necessary. The - // pod.spec.resourceClaims entry can be ignored in this case. + // generated for the Pod in the namespace of the Pod. + // + // When the DRAWorkloadResourceClaims feature is enabled and the + // corresponding PodResourceClaim matches a PodGroupResourceClaim + // made by the Pod's PodGroup, then this is the name of the + // ResourceClaim generated and reserved for the PodGroup. + // + // If this is unset, then generating a ResourceClaim was not + // necessary. The pod.spec.resourceClaims entry can be ignored in + // this case. ResourceClaimName *string } @@ -4008,34 +4071,18 @@ type PodSchedulingGate struct { Name string } -// WorkloadReference identifies the Workload object and PodGroup membership -// that a Pod belongs to. The scheduler uses this information to apply -// workload-aware scheduling semantics. -type WorkloadReference struct { - // Name defines the name of the Workload object this Pod belongs to. - // Workload must be in the same namespace as the Pod. - // If it doesn't match any existing Workload, the Pod will remain unschedulable - // until a Workload object is created and observed by the kube-scheduler. - // It must be a DNS subdomain. - // - // +required - Name string - - // PodGroup is the name of the PodGroup within the Workload that this Pod - // belongs to. If it doesn't match any existing PodGroup within the Workload, - // the Pod will remain unschedulable until the Workload object is recreated - // and observed by the kube-scheduler. It must be a DNS label. - // - // +required - PodGroup string - - // PodGroupReplicaKey specifies the replica key of the PodGroup to which this - // Pod belongs. It is used to distinguish pods belonging to different replicas - // of the same pod group. The pod group policy is applied separately to each replica. - // When set, it must be a DNS label. +// PodSchedulingGroup identifies the runtime scheduling group instance that a Pod belongs to. +// The scheduler uses this information to apply workload-aware scheduling semantics. +// Exactly one field must be specified. +// +union +type PodSchedulingGroup struct { + // PodGroupName specifies the name of the standalone PodGroup object + // that represents the runtime instance of this group. + // Must be a DNS subdomain. // // +optional - PodGroupReplicaKey string + // +oneOf=GroupSelection + PodGroupName *string } // HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the @@ -4409,7 +4456,8 @@ type EphemeralContainerCommon struct { // +optional Ports []ContainerPort // List of sources to populate environment variables in the container. - // The keys defined within a source must be a C_IDENTIFIER. All invalid keys + // The keys defined within a source may consist of any printable ASCII characters except '='. + // All invalid keys // will be reported as an event when the container is starting. When a key exists in multiple // sources, the value associated with the last source will take precedence. // Values defined by an Env with a duplicate key will take precedence. @@ -4517,8 +4565,6 @@ type EphemeralContainer struct { // state of a system. type PodStatus struct { // If set, this represents the .metadata.generation that the pod status was set based upon. - // The PodObservedGenerationTracking feature gate must be enabled to use this field. - // +featureGate=PodObservedGenerationTracking // +optional ObservedGeneration int64 // +optional @@ -4631,6 +4677,16 @@ type PodStatus struct { // +featureGate=InPlacePodLevelResourcesVerticalScaling // +optional Resources *ResourceRequirements + + // NodeAllocatableResourceClaimStatuses contains the status of node-allocatable resources + // that were allocated for this pod through DRA claims. This includes resources currently + // reported in v1.Node `status.allocatable` that are not extended resources + // (see https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#extended-resources). + // Examples include "cpu", "memory", "ephemeral-storage", and hugepages. + // +featureGate=DRANodeAllocatableResources + // +optional + // +listType=atomic + NodeAllocatableResourceClaimStatuses []NodeAllocatableResourceClaimStatus } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object @@ -5110,6 +5166,8 @@ type ServiceSpec struct { // ExternalIPs are used by external load balancers, or can be set by // users to handle external traffic that arrives at a node. + // + // Deprecated: ExternalIPs is deprecated and may be removed in a future version. // +optional ExternalIPs []string @@ -5509,7 +5567,6 @@ type NodeRuntimeHandlerFeatures struct { // +optional RecursiveReadOnlyMounts *bool // UserNamespaces is set to true if the runtime handler supports UserNamespaces, including for volumes. - // +featureGate=UserNamespacesSupport // +optional UserNamespaces *bool } @@ -5654,7 +5711,6 @@ type NodeStatus struct { // +optional Config *NodeConfigStatus // The available runtime handlers. - // +featureGate=UserNamespacesSupport // +optional RuntimeHandlers []NodeRuntimeHandler // Features describes the set of features implemented by the CRI implementation. @@ -7169,3 +7225,17 @@ type ImageVolumeSource struct { // +optional PullPolicy PullPolicy } + +// NodeAllocatableResourceClaimStatus describes the status of node allocatable resources allocated via DRA. +type NodeAllocatableResourceClaimStatus struct { + // ResourceClaimName is the resource claim referenced by the pod that resulted in this node allocatable resource allocation. + // +required + ResourceClaimName string + // Containers lists the names of all containers in this pod that reference the claim. + // +optional + // +listType=set + Containers []string + // Resources is a map of the node-allocatable resource name to the aggregate quantity allocated to the claim. + // +required + Resources map[ResourceName]resource.Quantity +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.conversion.go b/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.conversion.go index 3770ea1916..459408c526 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.conversion.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.conversion.go @@ -842,6 +842,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*corev1.ImageVolumeStatus)(nil), (*core.ImageVolumeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_ImageVolumeStatus_To_core_ImageVolumeStatus(a.(*corev1.ImageVolumeStatus), b.(*core.ImageVolumeStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.ImageVolumeStatus)(nil), (*corev1.ImageVolumeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_ImageVolumeStatus_To_v1_ImageVolumeStatus(a.(*core.ImageVolumeStatus), b.(*corev1.ImageVolumeStatus), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*corev1.KeyToPath)(nil), (*core.KeyToPath)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_KeyToPath_To_core_KeyToPath(a.(*corev1.KeyToPath), b.(*core.KeyToPath), scope) }); err != nil { @@ -1072,6 +1082,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*corev1.NodeAllocatableResourceClaimStatus)(nil), (*core.NodeAllocatableResourceClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_NodeAllocatableResourceClaimStatus_To_core_NodeAllocatableResourceClaimStatus(a.(*corev1.NodeAllocatableResourceClaimStatus), b.(*core.NodeAllocatableResourceClaimStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.NodeAllocatableResourceClaimStatus)(nil), (*corev1.NodeAllocatableResourceClaimStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_NodeAllocatableResourceClaimStatus_To_v1_NodeAllocatableResourceClaimStatus(a.(*core.NodeAllocatableResourceClaimStatus), b.(*corev1.NodeAllocatableResourceClaimStatus), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*corev1.NodeCondition)(nil), (*core.NodeCondition)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_NodeCondition_To_core_NodeCondition(a.(*corev1.NodeCondition), b.(*core.NodeCondition), scope) }); err != nil { @@ -1562,6 +1582,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*corev1.PodSchedulingGroup)(nil), (*core.PodSchedulingGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_PodSchedulingGroup_To_core_PodSchedulingGroup(a.(*corev1.PodSchedulingGroup), b.(*core.PodSchedulingGroup), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.PodSchedulingGroup)(nil), (*corev1.PodSchedulingGroup)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_PodSchedulingGroup_To_v1_PodSchedulingGroup(a.(*core.PodSchedulingGroup), b.(*corev1.PodSchedulingGroup), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*corev1.PodSecurityContext)(nil), (*core.PodSecurityContext)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_PodSecurityContext_To_core_PodSecurityContext(a.(*corev1.PodSecurityContext), b.(*core.PodSecurityContext), scope) }); err != nil { @@ -2307,6 +2337,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*corev1.VolumeStatus)(nil), (*core.VolumeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1_VolumeStatus_To_core_VolumeStatus(a.(*corev1.VolumeStatus), b.(*core.VolumeStatus), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*core.VolumeStatus)(nil), (*corev1.VolumeStatus)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_core_VolumeStatus_To_v1_VolumeStatus(a.(*core.VolumeStatus), b.(*corev1.VolumeStatus), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*corev1.VsphereVirtualDiskVolumeSource)(nil), (*core.VsphereVirtualDiskVolumeSource)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1_VsphereVirtualDiskVolumeSource_To_core_VsphereVirtualDiskVolumeSource(a.(*corev1.VsphereVirtualDiskVolumeSource), b.(*core.VsphereVirtualDiskVolumeSource), scope) }); err != nil { @@ -2337,16 +2377,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*corev1.WorkloadReference)(nil), (*core.WorkloadReference)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1_WorkloadReference_To_core_WorkloadReference(a.(*corev1.WorkloadReference), b.(*core.WorkloadReference), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*core.WorkloadReference)(nil), (*corev1.WorkloadReference)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_core_WorkloadReference_To_v1_WorkloadReference(a.(*core.WorkloadReference), b.(*corev1.WorkloadReference), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*url.Values)(nil), (*corev1.NodeProxyOptions)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_url_Values_To_v1_NodeProxyOptions(a.(*url.Values), b.(*corev1.NodeProxyOptions), scope) }); err != nil { @@ -4648,6 +4678,26 @@ func Convert_core_ImageVolumeSource_To_v1_ImageVolumeSource(in *core.ImageVolume return autoConvert_core_ImageVolumeSource_To_v1_ImageVolumeSource(in, out, s) } +func autoConvert_v1_ImageVolumeStatus_To_core_ImageVolumeStatus(in *corev1.ImageVolumeStatus, out *core.ImageVolumeStatus, s conversion.Scope) error { + out.ImageRef = in.ImageRef + return nil +} + +// Convert_v1_ImageVolumeStatus_To_core_ImageVolumeStatus is an autogenerated conversion function. +func Convert_v1_ImageVolumeStatus_To_core_ImageVolumeStatus(in *corev1.ImageVolumeStatus, out *core.ImageVolumeStatus, s conversion.Scope) error { + return autoConvert_v1_ImageVolumeStatus_To_core_ImageVolumeStatus(in, out, s) +} + +func autoConvert_core_ImageVolumeStatus_To_v1_ImageVolumeStatus(in *core.ImageVolumeStatus, out *corev1.ImageVolumeStatus, s conversion.Scope) error { + out.ImageRef = in.ImageRef + return nil +} + +// Convert_core_ImageVolumeStatus_To_v1_ImageVolumeStatus is an autogenerated conversion function. +func Convert_core_ImageVolumeStatus_To_v1_ImageVolumeStatus(in *core.ImageVolumeStatus, out *corev1.ImageVolumeStatus, s conversion.Scope) error { + return autoConvert_core_ImageVolumeStatus_To_v1_ImageVolumeStatus(in, out, s) +} + func autoConvert_v1_KeyToPath_To_core_KeyToPath(in *corev1.KeyToPath, out *core.KeyToPath, s conversion.Scope) error { out.Key = in.Key out.Path = in.Path @@ -5220,6 +5270,30 @@ func Convert_core_NodeAffinity_To_v1_NodeAffinity(in *core.NodeAffinity, out *co return autoConvert_core_NodeAffinity_To_v1_NodeAffinity(in, out, s) } +func autoConvert_v1_NodeAllocatableResourceClaimStatus_To_core_NodeAllocatableResourceClaimStatus(in *corev1.NodeAllocatableResourceClaimStatus, out *core.NodeAllocatableResourceClaimStatus, s conversion.Scope) error { + out.ResourceClaimName = in.ResourceClaimName + out.Containers = *(*[]string)(unsafe.Pointer(&in.Containers)) + out.Resources = *(*map[core.ResourceName]resource.Quantity)(unsafe.Pointer(&in.Resources)) + return nil +} + +// Convert_v1_NodeAllocatableResourceClaimStatus_To_core_NodeAllocatableResourceClaimStatus is an autogenerated conversion function. +func Convert_v1_NodeAllocatableResourceClaimStatus_To_core_NodeAllocatableResourceClaimStatus(in *corev1.NodeAllocatableResourceClaimStatus, out *core.NodeAllocatableResourceClaimStatus, s conversion.Scope) error { + return autoConvert_v1_NodeAllocatableResourceClaimStatus_To_core_NodeAllocatableResourceClaimStatus(in, out, s) +} + +func autoConvert_core_NodeAllocatableResourceClaimStatus_To_v1_NodeAllocatableResourceClaimStatus(in *core.NodeAllocatableResourceClaimStatus, out *corev1.NodeAllocatableResourceClaimStatus, s conversion.Scope) error { + out.ResourceClaimName = in.ResourceClaimName + out.Containers = *(*[]string)(unsafe.Pointer(&in.Containers)) + out.Resources = *(*map[corev1.ResourceName]resource.Quantity)(unsafe.Pointer(&in.Resources)) + return nil +} + +// Convert_core_NodeAllocatableResourceClaimStatus_To_v1_NodeAllocatableResourceClaimStatus is an autogenerated conversion function. +func Convert_core_NodeAllocatableResourceClaimStatus_To_v1_NodeAllocatableResourceClaimStatus(in *core.NodeAllocatableResourceClaimStatus, out *corev1.NodeAllocatableResourceClaimStatus, s conversion.Scope) error { + return autoConvert_core_NodeAllocatableResourceClaimStatus_To_v1_NodeAllocatableResourceClaimStatus(in, out, s) +} + func autoConvert_v1_NodeCondition_To_core_NodeCondition(in *corev1.NodeCondition, out *core.NodeCondition, s conversion.Scope) error { out.Type = core.NodeConditionType(in.Type) out.Status = core.ConditionStatus(in.Status) @@ -6887,6 +6961,26 @@ func Convert_core_PodSchedulingGate_To_v1_PodSchedulingGate(in *core.PodScheduli return autoConvert_core_PodSchedulingGate_To_v1_PodSchedulingGate(in, out, s) } +func autoConvert_v1_PodSchedulingGroup_To_core_PodSchedulingGroup(in *corev1.PodSchedulingGroup, out *core.PodSchedulingGroup, s conversion.Scope) error { + out.PodGroupName = (*string)(unsafe.Pointer(in.PodGroupName)) + return nil +} + +// Convert_v1_PodSchedulingGroup_To_core_PodSchedulingGroup is an autogenerated conversion function. +func Convert_v1_PodSchedulingGroup_To_core_PodSchedulingGroup(in *corev1.PodSchedulingGroup, out *core.PodSchedulingGroup, s conversion.Scope) error { + return autoConvert_v1_PodSchedulingGroup_To_core_PodSchedulingGroup(in, out, s) +} + +func autoConvert_core_PodSchedulingGroup_To_v1_PodSchedulingGroup(in *core.PodSchedulingGroup, out *corev1.PodSchedulingGroup, s conversion.Scope) error { + out.PodGroupName = (*string)(unsafe.Pointer(in.PodGroupName)) + return nil +} + +// Convert_core_PodSchedulingGroup_To_v1_PodSchedulingGroup is an autogenerated conversion function. +func Convert_core_PodSchedulingGroup_To_v1_PodSchedulingGroup(in *core.PodSchedulingGroup, out *corev1.PodSchedulingGroup, s conversion.Scope) error { + return autoConvert_core_PodSchedulingGroup_To_v1_PodSchedulingGroup(in, out, s) +} + func autoConvert_v1_PodSecurityContext_To_core_PodSecurityContext(in *corev1.PodSecurityContext, out *core.PodSecurityContext, s conversion.Scope) error { out.SELinuxOptions = (*core.SELinuxOptions)(unsafe.Pointer(in.SELinuxOptions)) out.WindowsOptions = (*core.WindowsSecurityContextOptions)(unsafe.Pointer(in.WindowsOptions)) @@ -7016,7 +7110,7 @@ func autoConvert_v1_PodSpec_To_core_PodSpec(in *corev1.PodSpec, out *core.PodSpe out.ResourceClaims = *(*[]core.PodResourceClaim)(unsafe.Pointer(&in.ResourceClaims)) out.Resources = (*core.ResourceRequirements)(unsafe.Pointer(in.Resources)) out.HostnameOverride = (*string)(unsafe.Pointer(in.HostnameOverride)) - out.WorkloadRef = (*core.WorkloadReference)(unsafe.Pointer(in.WorkloadRef)) + out.SchedulingGroup = (*core.PodSchedulingGroup)(unsafe.Pointer(in.SchedulingGroup)) return nil } @@ -7074,7 +7168,7 @@ func autoConvert_core_PodSpec_To_v1_PodSpec(in *core.PodSpec, out *corev1.PodSpe out.ResourceClaims = *(*[]corev1.PodResourceClaim)(unsafe.Pointer(&in.ResourceClaims)) out.Resources = (*corev1.ResourceRequirements)(unsafe.Pointer(in.Resources)) out.HostnameOverride = (*string)(unsafe.Pointer(in.HostnameOverride)) - out.WorkloadRef = (*corev1.WorkloadReference)(unsafe.Pointer(in.WorkloadRef)) + out.SchedulingGroup = (*corev1.PodSchedulingGroup)(unsafe.Pointer(in.SchedulingGroup)) return nil } @@ -7099,6 +7193,7 @@ func autoConvert_v1_PodStatus_To_core_PodStatus(in *corev1.PodStatus, out *core. out.ExtendedResourceClaimStatus = (*core.PodExtendedResourceClaimStatus)(unsafe.Pointer(in.ExtendedResourceClaimStatus)) out.AllocatedResources = *(*core.ResourceList)(unsafe.Pointer(&in.AllocatedResources)) out.Resources = (*core.ResourceRequirements)(unsafe.Pointer(in.Resources)) + out.NodeAllocatableResourceClaimStatuses = *(*[]core.NodeAllocatableResourceClaimStatus)(unsafe.Pointer(&in.NodeAllocatableResourceClaimStatuses)) return nil } @@ -7122,6 +7217,7 @@ func autoConvert_core_PodStatus_To_v1_PodStatus(in *core.PodStatus, out *corev1. out.ExtendedResourceClaimStatus = (*corev1.PodExtendedResourceClaimStatus)(unsafe.Pointer(in.ExtendedResourceClaimStatus)) out.AllocatedResources = *(*corev1.ResourceList)(unsafe.Pointer(&in.AllocatedResources)) out.Resources = (*corev1.ResourceRequirements)(unsafe.Pointer(in.Resources)) + out.NodeAllocatableResourceClaimStatuses = *(*[]corev1.NodeAllocatableResourceClaimStatus)(unsafe.Pointer(&in.NodeAllocatableResourceClaimStatuses)) return nil } @@ -7798,6 +7894,7 @@ func Convert_core_ResourceFieldSelector_To_v1_ResourceFieldSelector(in *core.Res func autoConvert_v1_ResourceHealth_To_core_ResourceHealth(in *corev1.ResourceHealth, out *core.ResourceHealth, s conversion.Scope) error { out.ResourceID = core.ResourceID(in.ResourceID) out.Health = core.ResourceHealthStatus(in.Health) + out.Message = (*string)(unsafe.Pointer(in.Message)) return nil } @@ -7809,6 +7906,7 @@ func Convert_v1_ResourceHealth_To_core_ResourceHealth(in *corev1.ResourceHealth, func autoConvert_core_ResourceHealth_To_v1_ResourceHealth(in *core.ResourceHealth, out *corev1.ResourceHealth, s conversion.Scope) error { out.ResourceID = corev1.ResourceID(in.ResourceID) out.Health = corev1.ResourceHealthStatus(in.Health) + out.Message = (*string)(unsafe.Pointer(in.Message)) return nil } @@ -9098,6 +9196,7 @@ func autoConvert_v1_VolumeMountStatus_To_core_VolumeMountStatus(in *corev1.Volum out.MountPath = in.MountPath out.ReadOnly = in.ReadOnly out.RecursiveReadOnly = (*core.RecursiveReadOnlyMode)(unsafe.Pointer(in.RecursiveReadOnly)) + out.VolumeStatus = (*core.VolumeStatus)(unsafe.Pointer(in.VolumeStatus)) return nil } @@ -9111,6 +9210,7 @@ func autoConvert_core_VolumeMountStatus_To_v1_VolumeMountStatus(in *core.VolumeM out.MountPath = in.MountPath out.ReadOnly = in.ReadOnly out.RecursiveReadOnly = (*corev1.RecursiveReadOnlyMode)(unsafe.Pointer(in.RecursiveReadOnly)) + out.VolumeStatus = (*corev1.VolumeStatus)(unsafe.Pointer(in.VolumeStatus)) return nil } @@ -9301,6 +9401,26 @@ func Convert_core_VolumeSource_To_v1_VolumeSource(in *core.VolumeSource, out *co return autoConvert_core_VolumeSource_To_v1_VolumeSource(in, out, s) } +func autoConvert_v1_VolumeStatus_To_core_VolumeStatus(in *corev1.VolumeStatus, out *core.VolumeStatus, s conversion.Scope) error { + out.Image = (*core.ImageVolumeStatus)(unsafe.Pointer(in.Image)) + return nil +} + +// Convert_v1_VolumeStatus_To_core_VolumeStatus is an autogenerated conversion function. +func Convert_v1_VolumeStatus_To_core_VolumeStatus(in *corev1.VolumeStatus, out *core.VolumeStatus, s conversion.Scope) error { + return autoConvert_v1_VolumeStatus_To_core_VolumeStatus(in, out, s) +} + +func autoConvert_core_VolumeStatus_To_v1_VolumeStatus(in *core.VolumeStatus, out *corev1.VolumeStatus, s conversion.Scope) error { + out.Image = (*corev1.ImageVolumeStatus)(unsafe.Pointer(in.Image)) + return nil +} + +// Convert_core_VolumeStatus_To_v1_VolumeStatus is an autogenerated conversion function. +func Convert_core_VolumeStatus_To_v1_VolumeStatus(in *core.VolumeStatus, out *corev1.VolumeStatus, s conversion.Scope) error { + return autoConvert_core_VolumeStatus_To_v1_VolumeStatus(in, out, s) +} + func autoConvert_v1_VsphereVirtualDiskVolumeSource_To_core_VsphereVirtualDiskVolumeSource(in *corev1.VsphereVirtualDiskVolumeSource, out *core.VsphereVirtualDiskVolumeSource, s conversion.Scope) error { out.VolumePath = in.VolumePath out.FSType = in.FSType @@ -9378,27 +9498,3 @@ func autoConvert_core_WindowsSecurityContextOptions_To_v1_WindowsSecurityContext func Convert_core_WindowsSecurityContextOptions_To_v1_WindowsSecurityContextOptions(in *core.WindowsSecurityContextOptions, out *corev1.WindowsSecurityContextOptions, s conversion.Scope) error { return autoConvert_core_WindowsSecurityContextOptions_To_v1_WindowsSecurityContextOptions(in, out, s) } - -func autoConvert_v1_WorkloadReference_To_core_WorkloadReference(in *corev1.WorkloadReference, out *core.WorkloadReference, s conversion.Scope) error { - out.Name = in.Name - out.PodGroup = in.PodGroup - out.PodGroupReplicaKey = in.PodGroupReplicaKey - return nil -} - -// Convert_v1_WorkloadReference_To_core_WorkloadReference is an autogenerated conversion function. -func Convert_v1_WorkloadReference_To_core_WorkloadReference(in *corev1.WorkloadReference, out *core.WorkloadReference, s conversion.Scope) error { - return autoConvert_v1_WorkloadReference_To_core_WorkloadReference(in, out, s) -} - -func autoConvert_core_WorkloadReference_To_v1_WorkloadReference(in *core.WorkloadReference, out *corev1.WorkloadReference, s conversion.Scope) error { - out.Name = in.Name - out.PodGroup = in.PodGroup - out.PodGroupReplicaKey = in.PodGroupReplicaKey - return nil -} - -// Convert_core_WorkloadReference_To_v1_WorkloadReference is an autogenerated conversion function. -func Convert_core_WorkloadReference_To_v1_WorkloadReference(in *core.WorkloadReference, out *corev1.WorkloadReference, s conversion.Scope) error { - return autoConvert_core_WorkloadReference_To_v1_WorkloadReference(in, out, s) -} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.validations.go b/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.validations.go index 7e39374b6b..a8f5fba015 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.validations.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/core/v1/zz_generated.validations.go @@ -48,14 +48,6 @@ func RegisterValidations(scheme *runtime.Scheme) error { } return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} }) - // type ReplicationControllerList - scheme.AddValidationFunc((*corev1.ReplicationControllerList)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList { - switch op.Request.SubresourcePath() { - case "/": - return Validate_ReplicationControllerList(ctx, op, nil /* fldPath */, obj.(*corev1.ReplicationControllerList), safe.Cast[*corev1.ReplicationControllerList](oldObj)) - } - return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))} - }) return nil } @@ -74,13 +66,13 @@ func Validate_ReplicationController(ctx context.Context, op operation.Operation, // call field-attached validations func() { // cohort name earlyReturn := false - if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "name", func(o *metav1.ObjectMeta) *string { return &o.Name }, validate.DirectEqualPtr, validate.OptionalValue); len(e) != 0 { + if e := validate.Subfield(ctx, op, fldPath, obj, oldObj, "name", func(o *metav1.ObjectMeta) *string { return &o.Name }, validate.DirectEqualPtr, validate.OptionalValue).MarkAlpha(); len(e) != 0 { earlyReturn = true } if earlyReturn { return // do not proceed } - errs = append(errs, validate.Subfield(ctx, op, fldPath, obj, oldObj, "name", func(o *metav1.ObjectMeta) *string { return &o.Name }, validate.DirectEqualPtr, validate.LongName)...) + errs = append(errs, validate.Subfield(ctx, op, fldPath, obj, oldObj, "name", func(o *metav1.ObjectMeta) *string { return &o.Name }, validate.DirectEqualPtr, validate.LongName).MarkAlpha()...) }() return }(fldPath.Child("metadata"), &obj.ObjectMeta, safe.Field(oldObj, func(oldObj *corev1.ReplicationController) *metav1.ObjectMeta { return &oldObj.ObjectMeta }), oldObj != nil)...) @@ -101,27 +93,6 @@ func Validate_ReplicationController(ctx context.Context, op operation.Operation, return errs } -// Validate_ReplicationControllerList validates an instance of ReplicationControllerList according -// to declarative validation rules in the API schema. -func Validate_ReplicationControllerList(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *corev1.ReplicationControllerList) (errs field.ErrorList) { - // field corev1.ReplicationControllerList.TypeMeta has no validation - // field corev1.ReplicationControllerList.ListMeta has no validation - - // field corev1.ReplicationControllerList.Items - errs = append(errs, - func(fldPath *field.Path, obj, oldObj []corev1.ReplicationController, oldValueCorrelated bool) (errs field.ErrorList) { - // don't revalidate unchanged data - if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) { - return nil - } - // iterate the list and call the type's validation function - errs = append(errs, validate.EachSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_ReplicationController)...) - return - }(fldPath.Child("items"), obj.Items, safe.Field(oldObj, func(oldObj *corev1.ReplicationControllerList) []corev1.ReplicationController { return oldObj.Items }), oldObj != nil)...) - - return errs -} - // Validate_ReplicationControllerSpec validates an instance of ReplicationControllerSpec according // to declarative validation rules in the API schema. func Validate_ReplicationControllerSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *corev1.ReplicationControllerSpec) (errs field.ErrorList) { @@ -135,27 +106,26 @@ func Validate_ReplicationControllerSpec(ctx context.Context, op operation.Operat // call field-attached validations earlyReturn := false // optional fields with default values are effectively required - if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj); len(e) != 0 { + if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkAlpha(); len(e) != 0 { errs = append(errs, e...) earlyReturn = true } if earlyReturn { return // do not proceed } - errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0)...) + errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0).MarkAlpha()...) return }(fldPath.Child("replicas"), obj.Replicas, safe.Field(oldObj, func(oldObj *corev1.ReplicationControllerSpec) *int32 { return oldObj.Replicas }), oldObj != nil)...) // field corev1.ReplicationControllerSpec.MinReadySeconds errs = append(errs, func(fldPath *field.Path, obj, oldObj *int32, oldValueCorrelated bool) (errs field.ErrorList) { - // optional value-type fields with zero-value defaults are purely documentation // don't revalidate unchanged data if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) { return nil } // call field-attached validations - errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0)...) + errs = append(errs, validate.Minimum(ctx, op, fldPath, obj, oldObj, 0).MarkAlpha()...) return }(fldPath.Child("minReadySeconds"), &obj.MinReadySeconds, safe.Field(oldObj, func(oldObj *corev1.ReplicationControllerSpec) *int32 { return &oldObj.MinReadySeconds }), oldObj != nil)...) diff --git a/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go b/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go index 213f4d7b7d..116f8675dc 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/core/validation/validation.go @@ -65,6 +65,7 @@ import ( "k8s.io/kubernetes/pkg/apis/core/helper/qos" podshelper "k8s.io/kubernetes/pkg/apis/core/pods" corev1 "k8s.io/kubernetes/pkg/apis/core/v1" + v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper" "k8s.io/kubernetes/pkg/capabilities" "k8s.io/kubernetes/pkg/features" "k8s.io/kubernetes/pkg/fieldpath" @@ -342,17 +343,9 @@ var ValidateResourceClaimName = apimachineryvalidation.NameIsDNSSubdomain // name for a ResourceClaimTemplate is valid. var ValidateResourceClaimTemplateName = apimachineryvalidation.NameIsDNSSubdomain -// ValidateWorkloadName can be used to check whether the given -// name for a Workload is valid. -var ValidateWorkloadName = apimachineryvalidation.NameIsDNSSubdomain - // ValidatePodGroupName can be used to check whether the given // name for a PodGroup is valid. -var ValidatePodGroupName = apimachineryvalidation.NameIsDNSLabel - -// ValidatePodGroupReplicaKey can be used to check whether the given -// PodGroupReplicaKey is valid. -var ValidatePodGroupReplicaKey = apimachineryvalidation.NameIsDNSLabel +var ValidatePodGroupName = apimachineryvalidation.NameIsDNSSubdomain // ValidateRuntimeClassName can be used to check whether the given RuntimeClass name is valid. // Prefix indicates this name will be used as part of generation, in which case @@ -1829,7 +1822,7 @@ func ValidateCSIDriverName(driverName string, fldPath *field.Path, opts ...Valid if len(driverName) > 63 { err := field.TooLong(fldPath, "" /*unused*/, 63) if slices.Contains(opts, SizeCovered) { - err = err.MarkCoveredByDeclarative() + err = err.WithOrigin("maxLength").MarkCoveredByDeclarative() } allErrs = append(allErrs, err) } @@ -3653,9 +3646,10 @@ func validateResizePolicy(policyList []core.ContainerResizePolicy, fldPath *fiel } if *podRestartPolicy == core.RestartPolicyNever && p.RestartPolicy != core.NotRequired { - allErrors = append(allErrors, field.Invalid(fldPath, p.RestartPolicy, "must be 'NotRequired' when `restartPolicy` is 'Never'")) + allErrors = append(allErrors, field.Invalid(fldPath, p.RestartPolicy, "must be 'NotRequired' when pod `restartPolicy` is 'Never'")) } } + return allErrors } @@ -3694,7 +3688,7 @@ func validateContainerRestartPolicy(policy *core.ContainerRestartPolicy, rules [ } if len(rules) > 20 { - allErrs = append(allErrs, field.TooLong(fldPath.Child("restartPolicyRules"), rules, 20)) + allErrs = append(allErrs, field.TooMany(fldPath.Child("restartPolicyRules"), len(rules), 20)) } for i, rule := range rules { policyRulesFld := fldPath.Child("restartPolicyRules").Index(i) @@ -3703,7 +3697,7 @@ func validateContainerRestartPolicy(policy *core.ContainerRestartPolicy, rules [ allowedActions = supportedContainerRestartRuleActionsWithRestartAllContainers } if !allowedActions.Has(rule.Action) { - allErrs = append(allErrs, field.NotSupported(policyRulesFld.Child("action"), rule.Action, sets.List(supportedContainerRestartRuleActions))) + allErrs = append(allErrs, field.NotSupported(policyRulesFld.Child("action"), rule.Action, sets.List(allowedActions))) } if rule.ExitCodes != nil { @@ -3713,7 +3707,7 @@ func validateContainerRestartPolicy(policy *core.ContainerRestartPolicy, rules [ } if len(rule.ExitCodes.Values) > 255 { - allErrs = append(allErrs, field.TooLong(exitCodesFld.Child("values"), rule.ExitCodes.Values, 255)) + allErrs = append(allErrs, field.TooMany(exitCodesFld.Child("values"), len(rule.ExitCodes.Values), 255)) } } else { allErrs = append(allErrs, field.Required(policyRulesFld.Child("exitCodes"), "must be specified")) @@ -3866,6 +3860,14 @@ func validateInitContainers(containers []core.Container, os *core.PodOS, regular if !opts.AllowSidecarResizePolicy && len(ctr.ResizePolicy) > 0 { allErrs = append(allErrs, field.Invalid(idxPath.Child("resizePolicy"), ctr.ResizePolicy, "must not be set for init containers")) } + + if !restartAlways && !opts.AllowExistingRestartContainerForNonSidecarInitContainer { + for j, p := range ctr.ResizePolicy { + if p.RestartPolicy == core.RestartContainer { + allErrs = append(allErrs, field.Invalid(fldPath.Index(i).Child("resizePolicy").Index(j).Child("restartPolicy"), p.RestartPolicy, "must not be set to 'RestartContainer' for non-sidecar initContainers")) + } + } + } } return allErrs @@ -4485,6 +4487,8 @@ type PodValidationOptions struct { AllowEnvFilesValidation bool // Allows containers have restart policy and restart policy rules. AllowContainerRestartPolicyRules bool + // Allow existing RestartContainer resize policy for non-sidecar init containers for backward compatibility + AllowExistingRestartContainerForNonSidecarInitContainer bool // Allow user namespaces with volume devices, even though they will not function properly (should only be tolerated in updates of objects which already have this invalid configuration). AllowUserNamespacesWithVolumeDevices bool // Allow taint toleration comparison operators (Lt, Gt) @@ -4493,6 +4497,8 @@ type PodValidationOptions struct { AllowUserNamespacesHostNetworkSupport bool // Allow containers to have restart policy rule with RestartAllContainers action, applicable for init, sidecar, and regular containers. AllowRestartAllContainers bool + // Allows container statuses to contain image volume digest + AllowImageVolumeWithDigest bool } // validatePodMetadataAndSpec tests if required fields in the pod.metadata and pod.spec are set, @@ -4725,8 +4731,8 @@ func ValidatePodSpec(spec *core.PodSpec, podMeta *metav1.ObjectMeta, fldPath *fi } } - if spec.WorkloadRef != nil { - allErrs = append(allErrs, validateWorkloadReference(spec.WorkloadRef, fldPath.Child("workloadRef"))...) + if spec.SchedulingGroup != nil { + allErrs = append(allErrs, validateSchedulingGroup(spec.SchedulingGroup, fldPath.Child("schedulingGroup"))...) } allErrs = append(allErrs, validateFileKeyRefVolumes(spec, fldPath)...) @@ -6045,6 +6051,7 @@ func ValidatePodStatusUpdate(newPod, oldPod *core.Pod, opts PodValidationOptions allErrs = append(allErrs, ValidateEphemeralContainerStateTransition(newPod.Status.EphemeralContainerStatuses, oldPod.Status.EphemeralContainerStatuses, fldPath.Child("ephemeralContainerStatuses"))...) allErrs = append(allErrs, validatePodResourceClaimStatuses(newPod.Status.ResourceClaimStatuses, newPod.Spec.ResourceClaims, fldPath.Child("resourceClaimStatuses"))...) allErrs = append(allErrs, validatePodExtendedResourceClaimStatus(newPod.Status.ExtendedResourceClaimStatus, &newPod.Spec, fldPath.Child("extendedResourceClaimStatus"))...) + allErrs = append(allErrs, validateNodeAllocatableResourceClaimStatus(newPod.Status, &newPod.Spec, fldPath.Child("nodeAllocatableResourceClaimStatuses"))...) if newIPErrs := validatePodIPs(newPod, oldPod); len(newIPErrs) > 0 { allErrs = append(allErrs, newIPErrs...) @@ -6063,6 +6070,27 @@ func ValidatePodStatusUpdate(newPod, oldPod *core.Pod, opts PodValidationOptions // ephemeral containers are not allowed to have resources allocated allErrs = append(allErrs, validateContainerStatusNoAllocatedResourcesStatus(newPod.Status.EphemeralContainerStatuses, fldPath.Child("ephemeralContainerStatuses"))...) + if opts.AllowImageVolumeWithDigest { + for i, containerStatus := range newPod.Status.ContainerStatuses { + for j, volumeMountStatus := range containerStatus.VolumeMounts { + validatedField := fldPath.Child("containerStatuses").Index(i).Child("volumeMounts").Index(j).Child("volumeStatus") + allErrs = append(allErrs, validateVolumeStatus(volumeMountStatus.VolumeStatus, validatedField)...) + } + } + for i, containerStatus := range newPod.Status.InitContainerStatuses { + for j, volumeMountStatus := range containerStatus.VolumeMounts { + validatedField := fldPath.Child("initContainerStatuses").Index(i).Child("volumeMounts").Index(j).Child("volumeStatus") + allErrs = append(allErrs, validateVolumeStatus(volumeMountStatus.VolumeStatus, validatedField)...) + } + } + for i, containerStatus := range newPod.Status.EphemeralContainerStatuses { + for j, volumeMountStatus := range containerStatus.VolumeMounts { + validatedField := fldPath.Child("ephemeralContainerStatuses").Index(i).Child("volumeMounts").Index(j).Child("volumeStatus") + allErrs = append(allErrs, validateVolumeStatus(volumeMountStatus.VolumeStatus, validatedField)...) + } + } + } + return allErrs } @@ -6105,7 +6133,68 @@ func validatePodResourceClaimStatuses(statuses []core.PodResourceClaimStatus, po } if status.ResourceClaimName != nil { for _, detail := range ValidateResourceClaimName(*status.ResourceClaimName, false) { - allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), status.ResourceClaimName, detail)) + allErrs = append(allErrs, field.Invalid(idxPath.Child("resourceClaimName"), status.ResourceClaimName, detail)) + } + } + } + + return allErrs +} + +// validateNodeAllocatableResourceClaimStatus validates NodeAllocatableResourceClaimStatuses in a pod status +func validateNodeAllocatableResourceClaimStatus(podStatus core.PodStatus, podSpec *core.PodSpec, fldPath *field.Path) field.ErrorList { + allErrs := field.ErrorList{} + + if len(podStatus.NodeAllocatableResourceClaimStatuses) == 0 { + return allErrs + } + + for i, nodeAllocatableStatus := range podStatus.NodeAllocatableResourceClaimStatuses { + statusFldPath := fldPath.Index(i) + if nodeAllocatableStatus.ResourceClaimName == "" { + allErrs = append(allErrs, field.Required(statusFldPath.Child("resourceClaimName"), "must not be empty")) + } + + // First check the podSpec to see if the ResourceClaim is directly referenced. + // If not, check the podStatus to see if the ResourceClaim was generated from a template. + found := false + for _, claimRef := range podSpec.ResourceClaims { + if (claimRef.ResourceClaimName != nil) && (*claimRef.ResourceClaimName == nodeAllocatableStatus.ResourceClaimName) { + found = true + break + } + } + if !found { + for _, claimRef := range podStatus.ResourceClaimStatuses { + if (claimRef.ResourceClaimName != nil) && (*claimRef.ResourceClaimName == nodeAllocatableStatus.ResourceClaimName) { + found = true + break + } + } + } + + if !found { + allErrs = append(allErrs, field.Invalid(statusFldPath.Child("resourceClaimName"), nodeAllocatableStatus.ResourceClaimName, "no mapping found in pod reference")) + } + + // TODO(KEP-5517): Evaluate if its ok to have no containers referencing a node allocatable resource claim. + // This is pending on defining kubelet cgroup enforcement. + if len(nodeAllocatableStatus.Containers) == 0 { + allErrs = append(allErrs, field.Required(statusFldPath.Child("containers"), "must not be empty")) + } + + resourcesFldPath := statusFldPath.Child("resources") + if len(nodeAllocatableStatus.Resources) == 0 { + allErrs = append(allErrs, field.Required(resourcesFldPath, "must not be empty")) + } + + for resourceName, quantity := range nodeAllocatableStatus.Resources { + keyPath := resourcesFldPath.Key(string(resourceName)) + if !v1helper.IsNativeResource(v1.ResourceName(resourceName)) { + allErrs = append(allErrs, field.Invalid(keyPath, resourceName, "must be a node allocatable resource name")) + } + if quantity.Cmp(resource.Quantity{}) < 0 { + allErrs = append(allErrs, field.Invalid(keyPath, quantity.String(), "must be non-negative")) } } } @@ -6263,7 +6352,15 @@ func ValidatePodResize(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel allErrs = append(allErrs, validatePodLevelResourcesResize(newPod, oldPod, &newPodSpecCopy, specPath, opts)...) } - // Part 3: Validate that the changes between oldPod.Spec.Containers[].Resources and + // Part 3: Disable InPlaceResize if a pod is using DRA resource claims for node-allocatable resources. + // TODO(KEP-5517) - Handle in place resize with node-allocatable resource claims. + // Currently, the presence of any node-allocatable resource claim blocks resizing for all resources, irrespective of whether + // ResourceClaim is used for the same resource. + if len(oldPod.Status.NodeAllocatableResourceClaimStatuses) > 0 { + allErrs = append(allErrs, field.Forbidden(specPath, "pods with node allocatable resource claims cannot be resized")) + } + + // Part 4: Validate that the changes between oldPod.Spec.Containers[].Resources and // newPod.Spec.Containers[].Resources are allowed. Also validate that the changes between oldPod.Spec.InitContainers[].Resources and // newPod.Spec.InitContainers[].Resources are allowed. @@ -6276,17 +6373,15 @@ func ValidatePodResize(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel } // Do not allow removing resource requests/limits on resize. - if utilfeature.DefaultFeatureGate.Enabled(features.SidecarContainers) { - for ix, ctr := range oldPod.Spec.InitContainers { - if !isRestartableInitContainer(&ctr) { - continue - } - allErrs = append(allErrs, validateContainerResize( - &newPod.Spec.InitContainers[ix].Resources, - &oldPod.Spec.InitContainers[ix].Resources, - newPod.Spec.InitContainers[ix].ResizePolicy, - specPath.Child("initContainers").Index(ix).Child("resources"))...) + for ix, ctr := range oldPod.Spec.InitContainers { + if !utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScalingInitContainers) && !isRestartableInitContainer(&ctr) { + continue } + allErrs = append(allErrs, validateContainerResize( + &newPod.Spec.InitContainers[ix].Resources, + &oldPod.Spec.InitContainers[ix].Resources, + newPod.Spec.InitContainers[ix].ResizePolicy, + specPath.Child("initContainers").Index(ix).Child("resources"))...) } for ix := range oldPod.Spec.Containers { allErrs = append(allErrs, validateContainerResize( @@ -6310,18 +6405,32 @@ func ValidatePodResize(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel newPodSpecCopy.Containers = newContainers // Ensure that only CPU and memory resources are mutable for restartable init containers. - // Also ensure that resources are immutable for non-restartable init containers. var newInitContainers []core.Container if utilfeature.DefaultFeatureGate.Enabled(features.SidecarContainers) { for ix, container := range newPodSpecCopy.InitContainers { - if isRestartableInitContainer(&container) { // restartable init container + isRestartable := isRestartableInitContainer(&container) + canResize := isRestartable || utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScalingInitContainers) + modifiedContainer := !apiequality.Semantic.DeepEqual(container, oldPod.Spec.InitContainers[ix]) + + if canResize { dropCPUMemoryResourcesFromContainer(&container, &oldPod.Spec.InitContainers[ix]) if !apiequality.Semantic.DeepEqual(container, oldPod.Spec.InitContainers[ix]) { // This likely means that the user has made changes to resources other than CPU and memory for sidecar container. - errs := field.Forbidden(specPath, "only cpu and memory resources for sidecar containers are mutable") + errs := field.Forbidden(specPath.Child("initContainers").Index(ix), "only cpu and memory resources for init or sidecar containers are mutable") allErrs = append(allErrs, errs) } - } else if !apiequality.Semantic.DeepEqual(container, oldPod.Spec.InitContainers[ix]) { // non-restartable init container + if modifiedContainer && !isRestartable { + for _, resizePolicy := range container.ResizePolicy { + if resizePolicy.RestartPolicy == core.RestartContainer { + // TODO: This validation check can eventually be removed in 1.40, + // as https://github.com/kubernetes/kubernetes/pull/137458 prohibits + // the ability to set RestartContainer resize policy for non-sidecar init containers. + errs := field.Forbidden(specPath.Child("initContainers").Index(ix), "non-sidecar init containers with a resize policy of RestartContainer cannot be resized") + allErrs = append(allErrs, errs) + } + } + } + } else if modifiedContainer { // modified non-resizable init container // This likely means that the user has modified resources of non-sidecar init container. errs := field.Forbidden(specPath, "resources for non-sidecar init containers are immutable") allErrs = append(allErrs, errs) @@ -9501,6 +9610,14 @@ func validateContainerStatusAllocatedResourcesStatus(containerStatuses []core.Co allErrors = append(allErrors, field.NotSupported(fldPath.Index(i).Child("allocatedResourcesStatus").Index(j).Child("resources").Index(k).Child("health"), r.Health, sets.List(supportedResourceHealthValues))) } + if r.Message != nil { + if len(*r.Message) == 0 { + allErrors = append(allErrors, field.Required(fldPath.Index(i).Child("allocatedResourcesStatus").Index(j).Child("resources").Index(k).Child("message"), "must be non-empty if specified")) + } else if len(*r.Message) > v1.ResourceHealthMessageMaxLength { + allErrors = append(allErrors, field.TooLong(fldPath.Index(i).Child("allocatedResourcesStatus").Index(j).Child("resources").Index(k).Child("message"), *r.Message, v1.ResourceHealthMessageMaxLength)) + } + } + if uniqueResources.Has(r.ResourceID) { allErrors = append(allErrors, field.Duplicate(fldPath.Index(i).Child("allocatedResourcesStatus").Index(j).Child("resources").Index(k).Child("resourceID"), r.ResourceID)) } else { @@ -9583,18 +9700,57 @@ func validateNodeSwapStatus(nodeSwapStatus *core.NodeSwapStatus, fldPath *field. return allErrors } -func validateWorkloadReference(workloadRef *core.WorkloadReference, fldPath *field.Path) field.ErrorList { +func validateSchedulingGroup(schedulingGroup *core.PodSchedulingGroup, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList - for _, detail := range ValidateWorkloadName(workloadRef.Name, false) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), workloadRef.Name, detail)) - } - for _, detail := range ValidatePodGroupName(workloadRef.PodGroup, false) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("podGroup"), workloadRef.PodGroup, detail)) - } - if workloadRef.PodGroupReplicaKey != "" { - for _, detail := range ValidatePodGroupReplicaKey(workloadRef.PodGroupReplicaKey, false) { - allErrs = append(allErrs, field.Invalid(fldPath.Child("podGroupReplicaKey"), workloadRef.PodGroupReplicaKey, detail)) + if schedulingGroup.PodGroupName == nil { + // This is a one-of set, but there's only one possible option present right now. + allErrs = append(allErrs, field.Invalid(fldPath.Child("podGroupName"), schedulingGroup.PodGroupName, "must specify one of: `podGroupName`")) + } else { + name := *schedulingGroup.PodGroupName + for _, detail := range ValidatePodGroupName(name, false) { + allErrs = append(allErrs, field.Invalid(fldPath.Child("podGroupName"), name, detail)) } } return allErrs } + +func validateImageVolumeStatus(imageVolumeStatus *core.ImageVolumeStatus, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} + + if imageVolumeStatus == nil { + return allErrors + } + + if imageVolumeStatus.ImageRef == "" { + allErrors = append(allErrors, field.Required(fldPath.Child("imageRef"), "imageRef must not be empty")) + } + + const maxImageRefLen = 256 + if len(imageVolumeStatus.ImageRef) > maxImageRefLen { + allErrors = append(allErrors, field.TooLong(fldPath.Child("imageRef"), imageVolumeStatus.ImageRef, maxImageRefLen)) + } + + return allErrors +} + +// validateVolumeStatus returns an error if the given struct has more than 1 populated field. +func validateVolumeStatus(volumeStatus *core.VolumeStatus, fldPath *field.Path) field.ErrorList { + allErrors := field.ErrorList{} + + if volumeStatus == nil { + return allErrors + } + + numStatuses := 0 + + if volumeStatus.Image != nil { + numStatuses++ + allErrors = append(allErrors, validateImageVolumeStatus(volumeStatus.Image, fldPath.Child("imageVolumeStatus"))...) + } + + if numStatuses > 1 { + allErrors = append(allErrors, field.Forbidden(fldPath, "may not specify more than 1 volume type")) + } + + return allErrors +} diff --git a/vendor/k8s.io/kubernetes/pkg/apis/core/zz_generated.deepcopy.go b/vendor/k8s.io/kubernetes/pkg/apis/core/zz_generated.deepcopy.go index 017ac70cd4..e2d01dcdd3 100644 --- a/vendor/k8s.io/kubernetes/pkg/apis/core/zz_generated.deepcopy.go +++ b/vendor/k8s.io/kubernetes/pkg/apis/core/zz_generated.deepcopy.go @@ -22,6 +22,7 @@ limitations under the License. package core import ( + resource "k8s.io/apimachinery/pkg/api/resource" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" types "k8s.io/apimachinery/pkg/types" @@ -2170,6 +2171,22 @@ func (in *ImageVolumeSource) DeepCopy() *ImageVolumeSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ImageVolumeStatus) DeepCopyInto(out *ImageVolumeStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageVolumeStatus. +func (in *ImageVolumeStatus) DeepCopy() *ImageVolumeStatus { + if in == nil { + return nil + } + out := new(ImageVolumeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *KeyToPath) DeepCopyInto(out *KeyToPath) { *out = *in @@ -2762,6 +2779,34 @@ func (in *NodeAffinity) DeepCopy() *NodeAffinity { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodeAllocatableResourceClaimStatus) DeepCopyInto(out *NodeAllocatableResourceClaimStatus) { + *out = *in + if in.Containers != nil { + in, out := &in.Containers, &out.Containers + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Resources != nil { + in, out := &in.Resources, &out.Resources + *out = make(map[ResourceName]resource.Quantity, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeAllocatableResourceClaimStatus. +func (in *NodeAllocatableResourceClaimStatus) DeepCopy() *NodeAllocatableResourceClaimStatus { + if in == nil { + return nil + } + out := new(NodeAllocatableResourceClaimStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeCondition) DeepCopyInto(out *NodeCondition) { *out = *in @@ -4301,6 +4346,27 @@ func (in *PodSchedulingGate) DeepCopy() *PodSchedulingGate { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodSchedulingGroup) DeepCopyInto(out *PodSchedulingGroup) { + *out = *in + if in.PodGroupName != nil { + in, out := &in.PodGroupName, &out.PodGroupName + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSchedulingGroup. +func (in *PodSchedulingGroup) DeepCopy() *PodSchedulingGroup { + if in == nil { + return nil + } + out := new(PodSchedulingGroup) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodSecurityContext) DeepCopyInto(out *PodSecurityContext) { *out = *in @@ -4571,10 +4637,10 @@ func (in *PodSpec) DeepCopyInto(out *PodSpec) { *out = new(string) **out = **in } - if in.WorkloadRef != nil { - in, out := &in.WorkloadRef, &out.WorkloadRef - *out = new(WorkloadReference) - **out = **in + if in.SchedulingGroup != nil { + in, out := &in.SchedulingGroup, &out.SchedulingGroup + *out = new(PodSchedulingGroup) + (*in).DeepCopyInto(*out) } return } @@ -4658,6 +4724,13 @@ func (in *PodStatus) DeepCopyInto(out *PodStatus) { *out = new(ResourceRequirements) (*in).DeepCopyInto(*out) } + if in.NodeAllocatableResourceClaimStatuses != nil { + in, out := &in.NodeAllocatableResourceClaimStatuses, &out.NodeAllocatableResourceClaimStatuses + *out = make([]NodeAllocatableResourceClaimStatus, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } return } @@ -5224,6 +5297,11 @@ func (in *ResourceFieldSelector) DeepCopy() *ResourceFieldSelector { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ResourceHealth) DeepCopyInto(out *ResourceHealth) { *out = *in + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } return } @@ -5424,7 +5502,9 @@ func (in *ResourceStatus) DeepCopyInto(out *ResourceStatus) { if in.Resources != nil { in, out := &in.Resources, &out.Resources *out = make([]ResourceHealth, len(*in)) - copy(*out, *in) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } } return } @@ -6519,6 +6599,11 @@ func (in *VolumeMountStatus) DeepCopyInto(out *VolumeMountStatus) { *out = new(RecursiveReadOnlyMode) **out = **in } + if in.VolumeStatus != nil { + in, out := &in.VolumeStatus, &out.VolumeStatus + *out = new(VolumeStatus) + (*in).DeepCopyInto(*out) + } return } @@ -6795,6 +6880,27 @@ func (in *VolumeSource) DeepCopy() *VolumeSource { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeStatus) DeepCopyInto(out *VolumeStatus) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(ImageVolumeStatus) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeStatus. +func (in *VolumeStatus) DeepCopy() *VolumeStatus { + if in == nil { + return nil + } + out := new(VolumeStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *VsphereVirtualDiskVolumeSource) DeepCopyInto(out *VsphereVirtualDiskVolumeSource) { *out = *in @@ -6863,19 +6969,3 @@ func (in *WindowsSecurityContextOptions) DeepCopy() *WindowsSecurityContextOptio in.DeepCopyInto(out) return out } - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkloadReference) DeepCopyInto(out *WorkloadReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadReference. -func (in *WorkloadReference) DeepCopy() *WorkloadReference { - if in == nil { - return nil - } - out := new(WorkloadReference) - in.DeepCopyInto(out) - return out -} diff --git a/vendor/k8s.io/kubernetes/pkg/controller/controller_utils.go b/vendor/k8s.io/kubernetes/pkg/controller/controller_utils.go index c6c3b31f0d..dd5268ae5a 100644 --- a/vendor/k8s.io/kubernetes/pkg/controller/controller_utils.go +++ b/vendor/k8s.io/kubernetes/pkg/controller/controller_utils.go @@ -482,6 +482,7 @@ type PodControlInterface interface { type RealPodControl struct { KubeClient clientset.Interface Recorder record.EventRecorder + OnWrite func(*v1.Pod, *metav1.OwnerReference) } var _ PodControlInterface = &RealPodControl{} @@ -551,11 +552,15 @@ func (r RealPodControl) CreatePodsWithGenerateName(ctx context.Context, namespac if len(generateName) > 0 { pod.ObjectMeta.GenerateName = generateName } - return r.createPods(ctx, namespace, pod, controllerObject) + return r.createPods(ctx, namespace, pod, controllerObject, controllerRef) } func (r RealPodControl) PatchPod(ctx context.Context, namespace, name string, data []byte) error { - _, err := r.KubeClient.CoreV1().Pods(namespace).Patch(ctx, name, types.StrategicMergePatchType, data, metav1.PatchOptions{}) + pod, err := r.KubeClient.CoreV1().Pods(namespace).Patch(ctx, name, types.StrategicMergePatchType, data, metav1.PatchOptions{}) + if err == nil && r.OnWrite != nil { + ownerRef := metav1.GetControllerOfNoCopy(pod) + r.OnWrite(pod, ownerRef) + } return err } @@ -584,7 +589,7 @@ func GetPodFromTemplate(template *v1.PodTemplateSpec, parentObject runtime.Objec return pod, nil } -func (r RealPodControl) createPods(ctx context.Context, namespace string, pod *v1.Pod, object runtime.Object) error { +func (r RealPodControl) createPods(ctx context.Context, namespace string, pod *v1.Pod, object runtime.Object, controllerRef *metav1.OwnerReference) error { if len(labels.Set(pod.Labels)) == 0 { return fmt.Errorf("unable to create pods, no labels") } @@ -597,6 +602,9 @@ func (r RealPodControl) createPods(ctx context.Context, namespace string, pod *v return err } logger := klog.FromContext(ctx) + if r.OnWrite != nil { + r.OnWrite(newPod, controllerRef) + } accessor, err := meta.Accessor(object) if err != nil { logger.Error(err, "parentObject does not have ObjectMeta") diff --git a/vendor/k8s.io/kubernetes/pkg/features/kube_features.go b/vendor/k8s.io/kubernetes/pkg/features/kube_features.go index a7703d3ca3..7260b06f51 100644 --- a/vendor/k8s.io/kubernetes/pkg/features/kube_features.go +++ b/vendor/k8s.io/kubernetes/pkg/features/kube_features.go @@ -56,6 +56,14 @@ const ( // Allow spec.terminationGracePeriodSeconds to be overridden by MaxPodGracePeriodSeconds in soft evictions. AllowOverwriteTerminationGracePeriodSeconds featuregate.Feature = "AllowOverwriteTerminationGracePeriodSeconds" + // owner: @adrianmoisey + // kep: https://kep.k8s.io/5707 + // + // When enabled, kube-proxy will program iptables/nftables/ipvs rules for Service.spec.externalIPs. + // When disabled, kube-proxy will not program rules for externalIPs, effectively disabling this + // deprecated feature. + AllowServiceExternalIPs featuregate.Feature = "AllowServiceExternalIPs" + // owner: @bswartz // // Enables usage of any object for volume data source in PVCs @@ -110,11 +118,11 @@ const ( // Allow the usage of options to fine-tune the cpumanager policies. CPUManagerPolicyOptions featuregate.Feature = "CPUManagerPolicyOptions" - // owner: @trierra - // kep: http://kep.k8s.io/2589 + // owner: @bitoku + // kep: https://kep.k8s.io/5825 // - // Enables the Portworx in-tree driver to Portworx migration feature. - CSIMigrationPortworx featuregate.Feature = "CSIMigrationPortworx" + // Enables using streaming RPCs for CRI list operations. + CRIListStreaming featuregate.Feature = "CRIListStreaming" // owner: @aramase // kep: http://kep.k8s.io/5538 @@ -131,7 +139,7 @@ const ( // owner: @HirazawaUi // // Enabling this feature gate will cause the pod's status to change due to a kubelet restart. - ChangeContainerStatusOnKubeletRestart = "ChangeContainerStatusOnKubeletRestart" + ChangeContainerStatusOnKubeletRestart featuregate.Feature = "ChangeContainerStatusOnKubeletRestart" // owner: @sanposhiho @wojtek-t // kep: https://kep.k8s.io/5278 @@ -188,6 +196,7 @@ const ( // depending on the DRA driver, may enable additional permissions // when a container uses the allocated device. DRAAdminAccess featuregate.Feature = "DRAAdminAccess" + // owner: @sunya-ch // kep: https://kep.k8s.io/5075 // @@ -224,6 +233,20 @@ const ( // Enables support for providing extended resource requests backed by DRA. DRAExtendedResource featuregate.Feature = "DRAExtendedResource" + // owner: @everpeace + // kep: http://kep.k8s.io/5491 + // + // Enable list type attributes for DRA devices in ResourceSlice + // and extends ResourceClaim's matchAttribute/distinctAttribute + // semantics so that they can work with list type attributes. + DRAListTypeAttributes featuregate.Feature = "DRAListTypeAttributes" + + // owner: @pravk03 + // kep: https://kep.k8s.io/5517 + // + // Enables support for node allocatable resources backed by DRA. + DRANodeAllocatableResources featuregate.Feature = "DRANodeAllocatableResources" + // owner: @mortent, @cici37 // kep: http://kep.k8s.io/4815 // @@ -247,6 +270,23 @@ const ( // status from DRA drivers. DRAResourceClaimDeviceStatus featuregate.Feature = "DRAResourceClaimDeviceStatus" + // owner: @aojea + // kep: http://kep.k8s.io/4817 + // + // Enables fine-grained authorization checks for ResourceClaim status updates. + // Requires separate permission on resourceclaims/binding to update + // status.allocation and status.reservedFor, and per-driver permission on + // resourceclaims/driver using associated-node / arbitrary-node verb prefixes + // to update status.devices. + DRAResourceClaimGranularStatusAuthorization featuregate.Feature = "DRAResourceClaimGranularStatusAuthorization" + + // owner: @nmn3m + // kep: http://kep.k8s.io/5677 + // + // Enables ResourcePoolStatusRequest API for querying DRA resource pool + // availability status. + DRAResourcePoolStatus featuregate.Feature = "DRAResourcePoolStatus" + // owner: @pohly // kep: http://kep.k8s.io/4381 // @@ -255,6 +295,12 @@ const ( // scheduler plugin configuration). DRASchedulerFilterTimeout featuregate.Feature = "DRASchedulerFilterTimeout" + // owner: @nojnhuh + // kep: https://kep.k8s.io/5729 + // + // Enables support for reserving and replicating templated ResourceClaims for an entire PodGroup. + DRAWorkloadResourceClaims featuregate.Feature = "DRAWorkloadResourceClaims" + // owner: @atiratree // kep: http://kep.k8s.io/3973 // @@ -321,6 +367,13 @@ const ( // Locked to default, will remove in v1.38. Progress is reflected in KEP #1972 update ExecProbeTimeout featuregate.Feature = "ExecProbeTimeout" + // owner: @seans3 + // kep: http://kep.k8s.io/4006 + // + // Enables the API server to proxy websockets to the kubelet for exec/attach + // if the kubelet has advertised that it supports them. + ExtendWebSocketsToKubelet featuregate.Feature = "ExtendWebSocketsToKubelet" + // owner: @HarshalNeelkamal // // Enables external service account JWT signing and key management. @@ -358,18 +411,12 @@ const ( // Enables support of configurable HPA scale-up and scale-down tolerances. HPAConfigurableTolerance featuregate.Feature = "HPAConfigurableTolerance" - // owner: @dxist + // owner: @johanneswuerbach + // kep: https://kep.k8s.io/2021 // // Enables support of HPA scaling to zero pods when an object or custom metric is configured. HPAScaleToZero featuregate.Feature = "HPAScaleToZero" - // owner: @deepakkinni @xing-yang - // kep: https://kep.k8s.io/2644 - // - // Honor Persistent Volume Reclaim Policy when it is "Delete" irrespective of PV-PVC - // deletion ordering. - HonorPVReclaimPolicy featuregate.Feature = "HonorPVReclaimPolicy" - // owner: @HirazawaUi // kep: https://kep.k8s.io/4762 // @@ -388,6 +435,12 @@ const ( // Enables the image volume source. ImageVolume featuregate.Feature = "ImageVolume" + // owner: @iholder101 + // kep: https://kep.k8s.io/4639 + // + // Enables adding the ImageVolume's digest to the pod's status. + ImageVolumeWithDigest featuregate.Feature = "ImageVolumeWithDigest" + // owner: @ndixita // kep: https://kep.k8s.io/5419 // @@ -400,14 +453,6 @@ const ( // Enables In-Place Pod Vertical Scaling InPlacePodVerticalScaling featuregate.Feature = "InPlacePodVerticalScaling" - // owner: @tallclair - // kep: http://kep.k8s.io/1287 - // - // Deprecated: This feature gate is no longer used. - // Was: Enables the AllocatedResources field in container status. This feature requires - // InPlacePodVerticalScaling also be enabled. - InPlacePodVerticalScalingAllocatedStatus featuregate.Feature = "InPlacePodVerticalScalingAllocatedStatus" - // owner: @tallclair @esotsal // // Allow resource resize for containers in Guaranteed pods with integer CPU requests ( default false ). @@ -421,10 +466,10 @@ const ( // Applies only in nodes with InPlacePodVerticalScaling and Memory Manager features enabled. InPlacePodVerticalScalingExclusiveMemory featuregate.Feature = "InPlacePodVerticalScalingExclusiveMemory" - // owner: @trierra + // owner: @natasha41575 // - // Disables the Portworx in-tree driver. - InTreePluginPortworxUnregister featuregate.Feature = "InTreePluginPortworxUnregister" + // Allow in-place pod resize of running non-sidecar init containers. + InPlacePodVerticalScalingInitContainers featuregate.Feature = "InPlacePodVerticalScalingInitContainers" // owner: @mimowo // kep: https://kep.k8s.io/3850 @@ -588,11 +633,6 @@ const ( // Enables maxUnavailable for StatefulSet MaxUnavailableStatefulSet featuregate.Feature = "MaxUnavailableStatefulSet" - // owner: @cynepco3hahue(alukiano) @cezaryzukowski @k-wiatrzyk, @Tal-or (only for GA graduation) - // - // Allows setting memory affinity for a container based on NUMA topology - MemoryManager featuregate.Feature = "MemoryManager" - // owner: @xiaoxubeii // kep: https://kep.k8s.io/2570 // @@ -685,6 +725,17 @@ const ( // Enables ordered namespace deletion. OrderedNamespaceDeletion featuregate.Feature = "OrderedNamespaceDeletion" + // owner: @tallclair + // + // Enables relisting individual pods on-demand. + PLEGOnDemandRelist featuregate.Feature = "PLEGOnDemandRelist" + + // owner: @ArvindParekh + // kep: https://kep.k8s.io/5541 + // + // Adds an Unused condition to PersistentVolumeClaim status that indicates when the PVC was last used by a pod. + PersistentVolumeClaimUnusedSinceTime featuregate.Feature = "PersistentVolumeClaimUnusedSinceTime" + // owner: @haircommander // kep: https://kep.k8s.io/2364 // @@ -703,6 +754,13 @@ const ( // Enables controlling pod ranking on replicaset scale-down. PodDeletionCost featuregate.Feature = "PodDeletionCost" + // owner: @KevinTMtz + // kep: https://kep.k8s.io/5526 + // + // PodLevelResourceManagers enables pod-level resource management in the Topology, CPU, and Memory managers. + // This feature depends on the PodLevelResources feature. + PodLevelResourceManagers featuregate.Feature = "PodLevelResourceManagers" + // owner: @ndixita // key: https://kep.k8s.io/2837 // @@ -760,6 +818,12 @@ const ( // similar to how `metadata.annotations` behaves. PodTopologyLabelsAdmission featuregate.Feature = "PodTopologyLabelsAdmission" + // owner: @briansonnenberg + // kep: https://kep.k8s.io/4188 + // + // Enables the PodsAPI feature to expose pod information via a gRPC API on the kubelet. + PodsAPI featuregate.Feature = "PodsAPI" + // owner: @seans3 // kep: http://kep.k8s.io/4006 // @@ -825,6 +889,11 @@ const ( // Relaxed DNS search string validation. RelaxedServiceNameValidation featuregate.Feature = "RelaxedServiceNameValidation" + // owner: @harshaln + // + // Enables running kubelet in a configuration that monitors and loads ClientCA from file paths + ReloadKubeletClientCAFile = "ReloadKubeletClientCAFile" + // owner: @zhangweikop // // Enable kubelet tls server to update certificate if the specified certificate files are changed. @@ -838,6 +907,12 @@ const ( // Adds the AllocatedResourcesStatus to the container status. ResourceHealthStatus featuregate.Feature = "ResourceHealthStatus" + // owner: @SergeyKanzhelev + // kep: https://kep.k8s.io/4680 + // + // Adds a message to the AllocatedResourcesStatus entries. + ResourceHealthStatusMessage featuregate.Feature = "ResourceHealthStatusMessage" + // owner: @yuanwang04 // kep: https://kep.k8s.io/5532 // @@ -944,11 +1019,10 @@ const ( // service account tokens bound to Pod objects. ServiceAccountTokenPodNodeInfo featuregate.Feature = "ServiceAccountTokenPodNodeInfo" - // owner: @gauravkghildiyal @robscott - // kep: https://kep.k8s.io/4444 + // owner: @jpbetz // - // Enables trafficDistribution field on Services. - ServiceTrafficDistribution featuregate.Feature = "ServiceTrafficDistribution" + // When enabled, the apiserver ignores changes to status fields in writes to the ServiceCIDR root resource. + ServiceCIDRStatusFieldWiping featuregate.Feature = "ServiceCIDRStatusFieldWiping" // owner: @gjkim42 @SergeyKanzhelev @matthyx @tzneal // kep: http://kep.k8s.io/753 @@ -958,11 +1032,39 @@ const ( // pod's lifecycle and will not block pod termination. SidecarContainers featuregate.Feature = "SidecarContainers" + // owner: @michaelasp + // kep: http://kep.k8s.io/5647 + // + // Introduces the ability for the DaemonSet controller to be able to read its writes + // prior to running a reconcile on the same object. + StaleControllerConsistencyDaemonSet featuregate.Feature = "StaleControllerConsistencyDaemonSet" + + // owner: @michaelasp + // kep: http://kep.k8s.io/5647 + // + // Introduces the ability for the Job controller to be able to read its writes + // prior to running a reconcile on the same object. + StaleControllerConsistencyJob featuregate.Feature = "StaleControllerConsistencyJob" + + // owner: @michaelasp + // kep: http://kep.k8s.io/5647 + // + // Introduces the ability for the ReplicaSet controller to be able to read its writes + // prior to running a reconcile on the same object. + StaleControllerConsistencyReplicaSet featuregate.Feature = "StaleControllerConsistencyReplicaSet" + + // owner: @michaelasp + // kep: http://kep.k8s.io/5647 + // + // Introduces the ability for the StatefulSet controller to be able to read its writes + // prior to running a reconcile on the same object. + StaleControllerConsistencyStatefulSet featuregate.Feature = "StaleControllerConsistencyStatefulSet" + // owner: @liggitt // // Mitigates spurious statefulset rollouts due to controller revision comparison mismatches // which are not semantically significant (e.g. serialization differences or missing defaulted fields). - StatefulSetSemanticRevisionComparison = "StatefulSetSemanticRevisionComparison" + StatefulSetSemanticRevisionComparison featuregate.Feature = "StatefulSetSemanticRevisionComparison" // owner: @cupnes // kep: https://kep.k8s.io/4049 @@ -1018,11 +1120,12 @@ const ( // Enables numeric comparison operators (Lt, Gt) for tolerations to match taints with threshold-based values. TaintTolerationComparisonOperators featuregate.Feature = "TaintTolerationComparisonOperators" - // owner: @robscott - // kep: https://kep.k8s.io/2433 + // owner: @44past4 + // kep: https://kep.k8s.io/5732 // - // Enables topology aware hints for EndpointSlices - TopologyAwareHints featuregate.Feature = "TopologyAwareHints" + // Enables topology-aware workload scheduling feature in kube-scheduler and related PodGroup API fields. + // When enabled, scheduler will try various placements for a pod group and pick the best one. + TopologyAwareWorkloadScheduling featuregate.Feature = "TopologyAwareWorkloadScheduling" // owner: @PiotrProkop // kep: https://kep.k8s.io/3545 @@ -1108,6 +1211,20 @@ const ( // // Enables support for joining Windows containers to a hosts' network namespace. WindowsHostNetwork featuregate.Feature = "WindowsHostNetwork" + + // owner: @wojtek-t + // kep: https://kep.k8s.io/5710 + // + // Enables support for workload-aware preemption in pod group scheduling cycle + // and related PodGroup and Workload API fields. + WorkloadAwarePreemption featuregate.Feature = "WorkloadAwarePreemption" + + // owner: @helayoty @mm4tt @wojtek-t + // kep: https://kep.k8s.io/5547 + // + // Enables the Job controller to automatically create Workload and PodGroup + // objects for Jobs that qualify for gang scheduling. + WorkloadWithJob featuregate.Feature = "WorkloadWithJob" ) // defaultVersionedKubernetesFeatureGates consists of all known Kubernetes-specific feature keys with VersionedSpecs. @@ -1137,6 +1254,10 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Deprecated, LockToDefault: true}, // remove in 1.38 }, + AllowServiceExternalIPs: { + {Version: version.MustParse("1.0"), Default: true, PreRelease: featuregate.GA}, + }, + AnyVolumeDataSource: { {Version: version.MustParse("1.18"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.24"), Default: true, PreRelease: featuregate.Beta}, @@ -1155,6 +1276,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate CPUCFSQuotaPeriod: { {Version: version.MustParse("1.12"), Default: false, PreRelease: featuregate.Alpha}, + // see https://github.com/kubernetes/kubernetes/pull/136339 for full context + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA}, // LockToDefault in 1.37, remove in 1.40 }, CPUManagerPolicyAlphaOptions: { @@ -1171,15 +1294,13 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.36 }, - CSIMigrationPortworx: { - {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.25"), Default: false, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, // On by default (requires Portworx CSI driver) - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.36 + CRIListStreaming: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, }, CSIServiceAccountTokenSecrets: { {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.36; remove in 1.39 }, CSIVolumeHealth: { @@ -1227,35 +1348,51 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate DRAAdminAccess: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA in 1.36; remove in 1.39 }, DRAConsumableCapacity: { {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, DRADeviceBindingConditions: { {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, DRADeviceTaintRules: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Beta}, // Depends on an off-by-default beta API. }, DRADeviceTaints: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, DRAExtendedResource: { {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + DRAListTypeAttributes: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + + DRANodeAllocatableResources: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, }, DRAPartitionableDevices: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, DRAPrioritizedList: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA}, }, DRAResourceClaimDeviceStatus: { @@ -1263,10 +1400,22 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, }, + DRAResourceClaimGranularStatusAuthorization: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + DRAResourcePoolStatus: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + DRASchedulerFilterTimeout: { {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, + DRAWorkloadResourceClaims: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + DeploymentReplicaSetTerminatingReplicas: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, @@ -1281,12 +1430,14 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate DisableCPUQuotaWithExclusiveCPUs: { {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Deprecated}, // LockToDefault(true) in 1.37, remove in 1.38 }, DisableNodeKubeProxyVersion: { {Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Deprecated}, - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Deprecated}, // lock to default in 1.34 and remove in v1.37 + {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Deprecated}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Deprecated, LockToDefault: true}, // lock to default in 1.36 and remove in v1.39 }, DynamicResourceAllocation: { @@ -1296,6 +1447,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // TODO (https://github.com/kubernetes/kubernetes/issues/134459): remove completely in 1.38 }, + EnvFiles: { {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, @@ -1309,9 +1461,14 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in v1.38 }, + ExtendWebSocketsToKubelet: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + ExternalServiceAccountTokenSigner: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, }, GangScheduling: { @@ -1325,6 +1482,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate GitRepoVolumeDriver: { {Version: version.MustParse("1.0"), Default: true, PreRelease: featuregate.GA}, {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated}, + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Deprecated, LockToDefault: true}, }, GracefulNodeShutdown: { @@ -1346,12 +1504,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.16"), Default: false, PreRelease: featuregate.Alpha}, }, - HonorPVReclaimPolicy: { - {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.36 - }, - HostnameOverride: { {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, @@ -1367,10 +1519,16 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA and LockToDefault in 1.36, remove in 1.39 + }, + + ImageVolumeWithDigest: { + {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, }, InPlacePodLevelResourcesVerticalScaling: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, InPlacePodVerticalScaling: { @@ -1379,11 +1537,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.38 }, - InPlacePodVerticalScalingAllocatedStatus: { - {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated}, // remove in 1.36 - }, - InPlacePodVerticalScalingExclusiveCPUs: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, }, @@ -1392,8 +1545,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, }, - InTreePluginPortworxUnregister: { - {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, // remove it along with CSIMigrationPortworx in 1.36 + InPlacePodVerticalScalingInitContainers: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, JobBackoffLimitPerIndex: { @@ -1439,6 +1592,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate KubeletFineGrainedAuthz: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, }, KubeletInUserNamespace: { @@ -1448,16 +1602,19 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate KubeletPSI: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, }, KubeletPodResourcesDynamicResources: { {Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.37 }, KubeletPodResourcesGet: { {Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.37 }, KubeletPodResourcesListUseActivePods: { @@ -1514,13 +1671,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate MaxUnavailableStatefulSet: { {Version: version.MustParse("1.24"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, - }, - - MemoryManager: { - {Version: version.MustParse("1.21"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.22"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, + {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Beta}, }, MemoryQoS: { @@ -1538,6 +1689,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.38 }, MutablePVNodeAffinity: { @@ -1546,10 +1698,12 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate MutablePodResourcesForSuspendedJobs: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, MutableSchedulingDirectivesForSuspendedJobs: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, NFTablesProxyMode: { @@ -1560,6 +1714,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate NodeDeclaredFeatures: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, NodeInclusionPolicyInPodTopologySpread: { @@ -1571,6 +1726,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate NodeLogQuery: { {Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.39, locked to default in 1.36 }, NodeSwap: { @@ -1595,6 +1751,14 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.37 }, + PLEGOnDemandRelist: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + PersistentVolumeClaimUnusedSinceTime: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + PodAndContainerStatsFromCRI: { {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Alpha}, }, @@ -1609,6 +1773,10 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.22"), Default: true, PreRelease: featuregate.Beta}, }, + PodLevelResourceManagers: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + PodLevelResources: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, @@ -1652,6 +1820,10 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, }, + PodsAPI: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + PortForwardWebsockets: { {Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, @@ -1671,6 +1843,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.12"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.39 }, QOSReserved: { @@ -1707,6 +1880,11 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate RelaxedServiceNameValidation: { {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + ReloadKubeletClientCAFile: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, ReloadKubeletServerCertificateFile: { @@ -1715,10 +1893,16 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate ResourceHealthStatus: { {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + ResourceHealthStatusMessage: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, RestartAllContainersOnContainerExits: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, RotateKubeletServerCertificate: { @@ -1733,6 +1917,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate SELinuxChangePolicy: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.39, locked to default in 1.36 }, SELinuxMount: { @@ -1744,6 +1929,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.25"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.39, locked to default in 1.36 }, SchedulerAsyncAPICalls: { @@ -1799,10 +1985,9 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, }, - ServiceTrafficDistribution: { - {Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.31"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA and LockToDefault in 1.33, remove in 1.36 + ServiceCIDRStatusFieldWiping: { + {Version: version.MustParse("1.0"), Default: false, PreRelease: featuregate.GA}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Deprecated}, }, SidecarContainers: { @@ -1811,6 +1996,22 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: true, LockToDefault: true, PreRelease: featuregate.GA}, // GA in 1.33 remove in 1.36 }, + StaleControllerConsistencyDaemonSet: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + StaleControllerConsistencyJob: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + StaleControllerConsistencyReplicaSet: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + + StaleControllerConsistencyStatefulSet: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, + }, + StatefulSetSemanticRevisionComparison: { // This is a mitigation for a 1.34 regression due to serialization differences that cannot be feature-gated, // so this mitigation should not auto-disable even if emulating versions prior to 1.34 with --emulation-version. @@ -1843,6 +2044,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate StrictIPCIDRValidation: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, SupplementalGroupsPolicy: { @@ -1860,11 +2062,8 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, }, - TopologyAwareHints: { - {Version: version.MustParse("1.21"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.23"), Default: false, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.24"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, + TopologyAwareWorkloadScheduling: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, }, TopologyManagerPolicyAlphaOptions: { @@ -1879,7 +2078,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate TopologyManagerPolicyOptions: { {Version: version.MustParse("1.26"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA}, + {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.37 }, TranslateStreamCloseWebsocketRequests: { @@ -1895,12 +2094,14 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.25"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.30"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.39. }, VolumeAttributesClass: { {Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.GA}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, }, VolumeLimitScaling: { @@ -1933,8 +2134,17 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated}, }, + WorkloadAwarePreemption: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + + WorkloadWithJob: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + apiextensionsfeatures.CRDObservedGenerationTracking: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, apiextensionsfeatures.CRDValidationRatcheting: { @@ -2016,6 +2226,7 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate genericfeatures.ConstrainedImpersonation: { {Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, genericfeatures.CoordinatedLeaderElection: { @@ -2025,10 +2236,16 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate genericfeatures.DeclarativeValidation: { {Version: version.MustParse("1.33"), Default: true, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // GA and LockToDefault in 1.36, remove in 1.39 + }, + + genericfeatures.DeclarativeValidationBeta: { + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, genericfeatures.DeclarativeValidationTakeover: { {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Deprecated}, }, genericfeatures.DetectCacheInconsistency: { @@ -2046,9 +2263,14 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, + genericfeatures.ManifestBasedAdmissionControlConfig: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, + }, + genericfeatures.MutatingAdmissionPolicy: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, {Version: version.MustParse("1.34"), Default: false, PreRelease: featuregate.Beta}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.GA}, }, genericfeatures.OpenAPIEnums: { @@ -2075,6 +2297,11 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate genericfeatures.SeparateCacheWatchRPC: { {Version: version.MustParse("1.28"), Default: true, PreRelease: featuregate.Beta}, {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated}, + {Version: version.MustParse("1.36"), Default: false, LockToDefault: true, PreRelease: featuregate.Deprecated}, + }, + + genericfeatures.ShardedListAndWatch: { + {Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Alpha}, }, genericfeatures.SizeBasedListCostEstimate: { @@ -2104,12 +2331,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate {Version: version.MustParse("1.35"), Default: true, PreRelease: featuregate.Beta}, }, - genericfeatures.StructuredAuthorizationConfiguration: { - {Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Alpha}, - {Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.GA, LockToDefault: true}, - }, - genericfeatures.TokenRequestServiceAccountUIDValidation: { {Version: version.MustParse("1.34"), Default: true, PreRelease: featuregate.Beta}, }, @@ -2121,15 +2342,12 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate genericfeatures.UnknownVersionInteroperabilityProxy: { {Version: version.MustParse("1.28"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, genericfeatures.WatchCacheInitializationPostStartHook: { {Version: version.MustParse("1.31"), Default: false, PreRelease: featuregate.Beta}, - }, - - genericfeatures.WatchFromStorageWithoutResourceVersion: { - {Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Beta}, - {Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Deprecated, LockToDefault: true}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, genericfeatures.WatchList: { @@ -2150,10 +2368,12 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate zpagesfeatures.ComponentFlagz: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, zpagesfeatures.ComponentStatusz: { {Version: version.MustParse("1.32"), Default: false, PreRelease: featuregate.Alpha}, + {Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta}, }, } @@ -2170,6 +2390,8 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature AllowOverwriteTerminationGracePeriodSeconds: {}, + AllowServiceExternalIPs: {}, + AnyVolumeDataSource: {}, AuthorizeNodeWithSelectors: {genericfeatures.AuthorizeWithSelectors}, @@ -2184,7 +2406,7 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature CPUManagerPolicyOptions: {}, - CSIMigrationPortworx: {}, + CRIListStreaming: {}, CSIServiceAccountTokenSecrets: {}, @@ -2220,14 +2442,24 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature DRAExtendedResource: {DynamicResourceAllocation}, + DRAListTypeAttributes: {DynamicResourceAllocation}, + + DRANodeAllocatableResources: {DynamicResourceAllocation}, + DRAPartitionableDevices: {DynamicResourceAllocation}, DRAPrioritizedList: {DynamicResourceAllocation}, DRAResourceClaimDeviceStatus: {}, // Soft dependency on DynamicResourceAllocation due to on/off-by-default conflict. + DRAResourceClaimGranularStatusAuthorization: {DynamicResourceAllocation, DRAResourceClaimDeviceStatus}, + + DRAResourcePoolStatus: {DynamicResourceAllocation}, + DRASchedulerFilterTimeout: {DynamicResourceAllocation}, + DRAWorkloadResourceClaims: {DynamicResourceAllocation, GenericWorkload}, + DeploymentReplicaSetTerminatingReplicas: {}, DisableAllocatorDualWrite: {MultiCIDRServiceAllocator}, @@ -2244,6 +2476,8 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature ExecProbeTimeout: {}, + ExtendWebSocketsToKubelet: {NodeDeclaredFeatures}, + ExternalServiceAccountTokenSigner: {}, GangScheduling: {GenericWorkload}, @@ -2260,25 +2494,23 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature HPAScaleToZero: {}, - HonorPVReclaimPolicy: {}, - HostnameOverride: {}, ImageMaximumGCAge: {}, ImageVolume: {}, + ImageVolumeWithDigest: {ImageVolume}, + InPlacePodLevelResourcesVerticalScaling: {InPlacePodVerticalScaling, PodLevelResources, NodeDeclaredFeatures}, InPlacePodVerticalScaling: {}, - InPlacePodVerticalScalingAllocatedStatus: {InPlacePodVerticalScaling}, - InPlacePodVerticalScalingExclusiveCPUs: {InPlacePodVerticalScaling}, - InPlacePodVerticalScalingExclusiveMemory: {InPlacePodVerticalScaling, MemoryManager}, + InPlacePodVerticalScalingExclusiveMemory: {InPlacePodVerticalScaling}, - InTreePluginPortworxUnregister: {}, + InPlacePodVerticalScalingInitContainers: {InPlacePodVerticalScaling, NodeDeclaredFeatures}, JobBackoffLimitPerIndex: {}, @@ -2326,8 +2558,6 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature MaxUnavailableStatefulSet: {}, - MemoryManager: {}, - MemoryQoS: {}, MultiCIDRServiceAllocator: {}, @@ -2356,12 +2586,18 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature OrderedNamespaceDeletion: {}, + PLEGOnDemandRelist: {}, + + PersistentVolumeClaimUnusedSinceTime: {}, + PodAndContainerStatsFromCRI: {}, PodCertificateRequest: {AuthorizeNodeWithSelectors}, PodDeletionCost: {}, + PodLevelResourceManagers: {PodLevelResources}, + PodLevelResources: {}, PodLifecycleSleepAction: {}, @@ -2378,6 +2614,8 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature PodTopologyLabelsAdmission: {}, + PodsAPI: {}, + PortForwardWebsockets: {}, PreferSameTrafficDistribution: {}, @@ -2400,10 +2638,14 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature RelaxedServiceNameValidation: {}, + ReloadKubeletClientCAFile: {}, + ReloadKubeletServerCertificateFile: {}, ResourceHealthStatus: {DynamicResourceAllocation}, + ResourceHealthStatusMessage: {ResourceHealthStatus}, + // RestartAllContainersOnContainerExits introduces a new container restart rule action. // All restart rules will be dropped by API if ContainerRestartRules feature is not enabled. RestartAllContainersOnContainerExits: {ContainerRestartRules, NodeDeclaredFeatures}, @@ -2438,10 +2680,18 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature ServiceAccountTokenPodNodeInfo: {}, - ServiceTrafficDistribution: {}, + ServiceCIDRStatusFieldWiping: {}, SidecarContainers: {}, + StaleControllerConsistencyDaemonSet: {featuregate.Feature(clientfeatures.AtomicFIFO)}, + + StaleControllerConsistencyJob: {featuregate.Feature(clientfeatures.AtomicFIFO)}, + + StaleControllerConsistencyReplicaSet: {featuregate.Feature(clientfeatures.AtomicFIFO)}, + + StaleControllerConsistencyStatefulSet: {featuregate.Feature(clientfeatures.AtomicFIFO)}, + StatefulSetSemanticRevisionComparison: {}, StorageCapacityScoring: {}, @@ -2462,7 +2712,7 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature TaintTolerationComparisonOperators: {}, - TopologyAwareHints: {}, + TopologyAwareWorkloadScheduling: {GenericWorkload}, TopologyManagerPolicyAlphaOptions: {}, @@ -2472,7 +2722,7 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature TranslateStreamCloseWebsocketRequests: {}, - UserNamespacesHostNetworkSupport: {UserNamespacesSupport}, + UserNamespacesHostNetworkSupport: {UserNamespacesSupport, NodeDeclaredFeatures}, UserNamespacesSupport: {}, @@ -2484,12 +2734,16 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature WinOverlay: {}, - WindowsCPUAndMemoryAffinity: {MemoryManager}, + WindowsCPUAndMemoryAffinity: {}, WindowsGracefulNodeShutdown: {GracefulNodeShutdown}, WindowsHostNetwork: {}, + WorkloadAwarePreemption: {GangScheduling}, + + WorkloadWithJob: {GenericWorkload}, + apiextensionsfeatures.CRDObservedGenerationTracking: {}, apiextensionsfeatures.CRDValidationRatcheting: {}, @@ -2526,6 +2780,7 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature genericfeatures.DeclarativeValidation: {}, + genericfeatures.DeclarativeValidationBeta: {genericfeatures.DeclarativeValidation}, genericfeatures.DeclarativeValidationTakeover: {genericfeatures.DeclarativeValidation}, genericfeatures.DetectCacheInconsistency: {}, @@ -2534,6 +2789,8 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature genericfeatures.ListFromCacheSnapshot: {}, + genericfeatures.ManifestBasedAdmissionControlConfig: {}, + genericfeatures.MutatingAdmissionPolicy: {}, genericfeatures.OpenAPIEnums: {}, @@ -2546,6 +2803,8 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature genericfeatures.SeparateCacheWatchRPC: {}, + genericfeatures.ShardedListAndWatch: {}, + genericfeatures.SizeBasedListCostEstimate: {}, genericfeatures.StorageVersionAPI: {genericfeatures.APIServerIdentity}, @@ -2558,8 +2817,6 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature genericfeatures.StructuredAuthenticationConfigurationJWKSMetrics: {genericfeatures.StructuredAuthenticationConfiguration}, - genericfeatures.StructuredAuthorizationConfiguration: {}, - genericfeatures.TokenRequestServiceAccountUIDValidation: {}, genericfeatures.UnauthenticatedHTTP2DOSMitigation: {}, @@ -2568,8 +2825,6 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature genericfeatures.WatchCacheInitializationPostStartHook: {}, - genericfeatures.WatchFromStorageWithoutResourceVersion: {}, - genericfeatures.WatchList: {}, kcmfeatures.CloudControllerManagerWatchBasedRoutesReconciliation: {}, @@ -2582,10 +2837,6 @@ var defaultKubernetesFeatureGateDependencies = map[featuregate.Feature][]feature } func init() { - runtime.Must(utilfeature.DefaultMutableFeatureGate.AddVersioned(defaultVersionedKubernetesFeatureGates)) - runtime.Must(utilfeature.DefaultMutableFeatureGate.AddDependencies(defaultKubernetesFeatureGateDependencies)) - runtime.Must(zpagesfeatures.AddFeatureGates(utilfeature.DefaultMutableFeatureGate)) - // Register all client-go features with kube's feature gate instance and make all client-go // feature checks use kube's instance. The effect is that for kube binaries, client-go // features are wired to the existing --feature-gates flag just as all other features @@ -2594,4 +2845,8 @@ func init() { ca := &clientAdapter{utilfeature.DefaultMutableFeatureGate} runtime.Must(clientfeatures.AddVersionedFeaturesToExistingFeatureGates(ca)) clientfeatures.ReplaceFeatureGates(ca) + + runtime.Must(utilfeature.DefaultMutableFeatureGate.AddVersioned(defaultVersionedKubernetesFeatureGates)) + runtime.Must(utilfeature.DefaultMutableFeatureGate.AddDependencies(defaultKubernetesFeatureGateDependencies)) + runtime.Must(zpagesfeatures.AddFeatureGates(utilfeature.DefaultMutableFeatureGate)) } diff --git a/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/types.go b/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/types.go index b0c94a18ee..9c86ce2647 100644 --- a/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/types.go +++ b/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/types.go @@ -176,6 +176,12 @@ type Plugins struct { // MultiPoint is a simplified config field for enabling plugins for all valid extension points MultiPoint PluginSet + + // PlacementGenerate is a list of plugins that should be invoked during pod group scheduling cycle when determining placements for a pod group. + PlacementGenerate PluginSet + + // PlacementScore is a list of plugins that should be invoked during workload scheduling cycle when ranking pod group assignments. + PlacementScore PluginSet } // PluginSet specifies enabled and disabled plugins for an extension point. @@ -189,11 +195,11 @@ type PluginSet struct { Disabled []Plugin } -// Plugin specifies a plugin name and its weight when applicable. Weight is used only for Score plugins. +// Plugin specifies a plugin name and its weight when applicable. Weight is used only for Score and PlacementScore plugins. type Plugin struct { // Name defines the name of plugin Name string - // Weight defines the weight of plugin, only used for Score plugins. + // Weight defines the weight of plugin, only used for Score and PlacementScore plugins. Weight int32 } @@ -244,6 +250,8 @@ func (p *Plugins) Names() []string { p.PostBind, p.Permit, p.QueueSort, + p.PlacementGenerate, + p.PlacementScore, } n := sets.New[string]() for _, e := range extensions { diff --git a/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/zz_generated.deepcopy.go b/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/zz_generated.deepcopy.go index 2d78d58e58..ad5699db2e 100644 --- a/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/zz_generated.deepcopy.go +++ b/vendor/k8s.io/kubernetes/pkg/scheduler/apis/config/zz_generated.deepcopy.go @@ -443,6 +443,8 @@ func (in *Plugins) DeepCopyInto(out *Plugins) { in.Bind.DeepCopyInto(&out.Bind) in.PostBind.DeepCopyInto(&out.PostBind) in.MultiPoint.DeepCopyInto(&out.MultiPoint) + in.PlacementGenerate.DeepCopyInto(&out.PlacementGenerate) + in.PlacementScore.DeepCopyInto(&out.PlacementScore) return } diff --git a/vendor/k8s.io/kubernetes/pkg/util/hash/hash.go b/vendor/k8s.io/kubernetes/pkg/util/hash/hash.go index 0962e5cfb5..0971a8bb09 100644 --- a/vendor/k8s.io/kubernetes/pkg/util/hash/hash.go +++ b/vendor/k8s.io/kubernetes/pkg/util/hash/hash.go @@ -20,7 +20,7 @@ import ( "fmt" "hash" - "k8s.io/apimachinery/pkg/util/dump" + "k8s.io/utils/dump" ) // DeepHashObject writes specified object to hash using the spew library diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/framework.go b/vendor/k8s.io/kubernetes/test/e2e/framework/framework.go index 74df75a634..33c786277d 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/framework.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/framework.go @@ -31,12 +31,12 @@ import ( "strings" "time" - "k8s.io/apimachinery/pkg/runtime" - v1 "k8s.io/api/core/v1" + apiextensions "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/wait" v1svc "k8s.io/client-go/applyconfigurations/core/v1" @@ -48,8 +48,10 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/restmapper" scaleclient "k8s.io/client-go/scale" + "k8s.io/kubernetes/test/utils/ktesting" admissionapi "k8s.io/pod-security-admission/api" + "github.com/go-logr/logr" "github.com/onsi/ginkgo/v2" ) @@ -95,7 +97,17 @@ var ( // The default pod security profile is "restricted". // Each of the labels can be overridden by using more specific NamespacePodSecurity* attributes of this // struct. +// +// A framework instance implements ktesting.TB and thus can be passed as +// first parameter to [github.com/stretchr/testify/assert]. +// There are just two caveats: +// - Error and Errorf abort the currently running test. +// - This only works while a test runs, not while defining tests. +// Incorrect tests may panic. The same applies to using ginkgo.Fail +// outside of tests. type Framework struct { + ktesting.TB + BaseName string // Set together with creating the ClientSet and the namespace. @@ -104,6 +116,7 @@ type Framework struct { UniqueName string clientConfig *rest.Config + restMapper *restmapper.DeferredDiscoveryRESTMapper ClientSet clientset.Interface KubemarkExternalClusterClientSet clientset.Interface @@ -139,6 +152,94 @@ type Framework struct { DumpAllNamespaceInfo DumpAllNamespaceInfoAction } +// CleanupCtx implements [ktesting.ContextTB.CleanupCtx]. It's identical to +// ginkgo.DeferCleanup. +func (f *Framework) CleanupCtx(cb func(context.Context)) { + ginkgo.GinkgoHelper() + ginkgo.DeferCleanup(cb) +} + +// Log implements TB.Log. It overrides the implementation from Ginkgo to ensure consistent output. +func (f *Framework) Log(args ...any) { + log(1, strings.TrimSuffix(fmt.Sprintln(args...), "\n")) +} + +// Logf implements TB.Logf. It overrides the implementation from Ginkgo to ensure consistent output. +func (f *Framework) Logf(format string, args ...any) { + log(1, fmt.Sprintf(format, args...)) +} + +var _ ktesting.ContextTB = &Framework{} + +// TContext combines the framework and the context in a [ktesting.TContext]. +// +// Legacy code which accepts separate [context.Context] and [clientset.Interface] +// parameters can call [ContextTODO] with those two parameters to +// create a [ktesting.TContext] which also has all clients, but this is +// an interim solution. It's cleaner to rewrite that code to accept +// a [ktesting.TContext]. +func (f *Framework) TContext(ctx context.Context) ktesting.TContext { + if f.TB == nil { + // Test setup typically has no context, so this is unlikely to be reached. + // A sufficiently determined developer might pass in context.Background(), + // so let's be explicit anyway. + panic("TContext may only be used while a test runs.") + } + tCtx := ktesting.InitCtx(ctx, f /* intentionally using f here and not f.TB because f overrides some methods */) + tCtx = tCtx.WithClients(f.clientConfig, f.restMapper, f.ClientSet, f.DynamicClient, apiextensions.NewForConfigOrDie(f.clientConfig)) + if f.Namespace != nil { + tCtx = tCtx.WithNamespace(f.Namespace.Name) + } + tCtx = ensureLogger(tCtx) + return tCtx +} + +// ContextTODO can be used as interim solution in functions which currently +// accept a [context.Context] and [clientset.Interface] to create +// a [ktesting.TContext] for other code which already uses that instead +// of different parameters. If the client is [Framework.ClientSet], +// the result is identical to the one from [Framework.TContext]. +// In particular, dynamic client and rest config are available. +// +// Long-term code relying on ContextTODO should get rewritten. +func ContextTODO(ctx context.Context, client clientset.Interface) ktesting.TContext { + // If the client was taken from a framework instance, then + // we can cast it here to prepare a complete context. + if fc, ok := client.(fClient); ok { + return fc.f.TContext(ctx) + } + f := NewDefaultFramework("tcontext") + tCtx := ktesting.InitCtx(ctx, f) + tCtx = tCtx.WithClients(nil, nil, client, nil, nil) + tCtx = ensureLogger(tCtx) + return tCtx +} + +// ensureLogger installs the Ginkgo logger in the context if there isn't one +// already. +// +// This isn't needed for code which uses klog.FromContext because that uses the +// klog logger as default, which is the Gingko logger. But there might also be +// code which uses go-logr directly: then providing the logger through the +// context is useful. +func ensureLogger(tCtx ktesting.TContext) ktesting.TContext { + _, ok := logr.FromContext(tCtx) + if ok == nil { + return tCtx + } + + return tCtx.WithLogger(ginkgoLogger) +} + +// fClient is stored in framework.ClientSet and used by ContextTODO. +// +// TODO: remove this and ContextTODO once it is no longer needed, i.e. +// when all code accepts a TContext. +type fClient struct { + clientset.Interface + f *Framework +} + // DumpAllNamespaceInfoAction is called after each failed test for namespaces // created for the test. type DumpAllNamespaceInfoAction func(ctx context.Context, f *Framework, namespace string) @@ -188,6 +289,7 @@ func NewDefaultFramework(baseName string) *Framework { // NewFramework creates a test framework. func NewFramework(baseName string, options Options, client clientset.Interface) *Framework { f := &Framework{ + // TB initially not set yet. It may only be used while tests run. BaseName: baseName, Options: options, ClientSet: client, @@ -207,6 +309,8 @@ func NewFramework(baseName string, options Options, client clientset.Interface) // BeforeEach gets a client and makes a namespace. func (f *Framework) BeforeEach(ctx context.Context) { + f.TB = ginkgo.GinkgoT() + // DeferCleanup, in contrast to AfterEach, triggers execution in // first-in-last-out order. This ensures that the framework instance // remains valid as long as possible. @@ -230,8 +334,12 @@ func (f *Framework) BeforeEach(ctx context.Context) { config.ContentType = TestContext.KubeAPIContentType } f.clientConfig = rest.CopyConfig(config) - f.ClientSet, err = clientset.NewForConfig(config) + clientSet, err := clientset.NewForConfig(config) ExpectNoError(err) + f.ClientSet = fClient{ + Interface: clientSet, + f: f, + } f.DynamicClient, err = dynamic.NewForConfig(config) ExpectNoError(err) @@ -250,6 +358,7 @@ func (f *Framework) BeforeEach(ctx context.Context) { cachedDiscoClient := cacheddiscovery.NewMemCacheClient(discoClient) restMapper := restmapper.NewDeferredDiscoveryRESTMapper(cachedDiscoClient) restMapper.Reset() + f.restMapper = restMapper resolver := scaleclient.NewDiscoveryScaleKindResolver(cachedDiscoClient) f.ScalesGetter = scaleclient.New(restClient, restMapper, dynamic.LegacyAPIPathResolverFunc, resolver) @@ -386,6 +495,7 @@ func (f *Framework) AfterEach(ctx context.Context) { f.clientConfig = nil f.ClientSet = nil f.namespacesToDelete = nil + f.TB = nil // if we had errors deleting, report them now. if len(nsDeletionErrors) != 0 { diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgologger.go b/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgologger.go index 6e2c956997..d25c3d61b7 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgologger.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgologger.go @@ -110,7 +110,7 @@ func log(offset int, msg string) { } _, month, day := now.Date() hour, minute, second := now.Clock() - header := fmt.Sprintf("I%02d%02d %02d:%02d:%02d.%06d %d %s:%d]", + header := fmt.Sprintf("I%02d%02d %02d:%02d:%02d.%06d %7d %s:%d]", month, day, hour, minute, second, now.Nanosecond()/1000, Pid, file, line) fmt.Fprintln(ginkgo.GinkgoWriter, header, msg) diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgowrapper.go b/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgowrapper.go index 9d82e4e488..944be9b707 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgowrapper.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/ginkgowrapper.go @@ -128,10 +128,12 @@ func AnnotatedLocationWithOffset(annotation string, offset int) types.CodeLocati // the SIG name as annotation. The parameter should be lowercase with // no spaces and no sig- or SIG- prefix. func SIGDescribe(sig string) func(...interface{}) bool { + ginkgo.GinkgoHelper() if !sigRE.MatchString(sig) || strings.HasPrefix(sig, "sig-") { - RecordBug(NewBug(fmt.Sprintf("SIG label must be lowercase, no spaces and no sig- prefix, got instead: %q", sig), 1)) + RecordBug(NewBug(fmt.Sprintf("SIG label must be lowercase, no spaces and no sig- prefix, got instead: %q", sig), 0)) } return func(args ...interface{}) bool { + ginkgo.GinkgoHelper() args = append([]interface{}{WithLabel("sig-" + sig)}, args...) return registerInSuite(ginkgo.Describe, args) } @@ -145,58 +147,127 @@ func ConformanceIt(args ...interface{}) bool { return It(args...) } -// It is a wrapper around [ginkgo.It] which supports framework With* labels as -// optional arguments in addition to those already supported by ginkgo itself, -// like [ginkgo.Label] and [ginkgo.Offset]. -// +// It is a wrapper around [ginkgo.It] which removes the requirement +// to start parameters with a text string. // Text and arguments may be mixed. The final text is a concatenation // of the text arguments and special tags from the With functions. func It(args ...interface{}) bool { + ginkgo.GinkgoHelper() return registerInSuite(ginkgo.It, args) } // It is a shorthand for the corresponding package function. func (f *Framework) It(args ...interface{}) bool { + ginkgo.GinkgoHelper() return registerInSuite(ginkgo.It, args) } -// Describe is a wrapper around [ginkgo.Describe] which supports framework -// With* labels as optional arguments in addition to those already supported by -// ginkgo itself, like [ginkgo.Label] and [ginkgo.Offset]. -// +// Describe is a wrapper around [ginkgo.Describe] which removes the requirement +// to start parameters with a text string. // Text and arguments may be mixed. The final text is a concatenation // of the text arguments and special tags from the With functions. func Describe(args ...interface{}) bool { + ginkgo.GinkgoHelper() return registerInSuite(ginkgo.Describe, args) } // Describe is a shorthand for the corresponding package function. func (f *Framework) Describe(args ...interface{}) bool { + ginkgo.GinkgoHelper() return registerInSuite(ginkgo.Describe, args) } -// Context is a wrapper around [ginkgo.Context] which supports framework With* -// labels as optional arguments in addition to those already supported by -// ginkgo itself, like [ginkgo.Label] and [ginkgo.Offset]. -// +// Context is a wrapper around [ginkgo.Context] which removes the requirement +// to start parameters with a text string. // Text and arguments may be mixed. The final text is a concatenation // of the text arguments and special tags from the With functions. func Context(args ...interface{}) bool { + ginkgo.GinkgoHelper() return registerInSuite(ginkgo.Context, args) } // Context is a shorthand for the corresponding package function. func (f *Framework) Context(args ...interface{}) bool { + ginkgo.GinkgoHelper() return registerInSuite(ginkgo.Context, args) } // registerInSuite is the common implementation of all wrapper functions. It // expects to be called through one intermediate wrapper. func registerInSuite(ginkgoCall func(string, ...interface{}) bool, args []interface{}) bool { - var ginkgoArgs []interface{} var offset ginkgo.Offset + for arg := range allArgs(args) { + if o, ok := arg.(ginkgo.Offset); ok { + offset = o + } + } + offset += 2 // This function and the top-level wrapper. + return ginkgoCall("", args, offset) +} + +// allArgs produces an iterator which handles nesting without flattening the slices. +func allArgs(args []any) func(yield func(arg any) bool) { + return func(yield func(arg any) bool) { + iterArgs(args, yield) + } +} + +// iterArgs descends recursively into []any and calls yield for all other arguments. +func iterArgs(args []any, yield func(arg any) bool) bool { + for _, arg := range args { + switch arg := arg.(type) { + case []any: + if !iterArgs(arg, yield) { + return false + } + default: + if !yield(arg) { + return false + } + } + } + return true +} + +// If the framework is used, the user might also use our special test +// arguments. To ensure that test registration works we inject our code into +// the test tree construction. Therefore it doesn't matter anymore whether +// ginkgo.It or framework.It is used. +// +// Code flow is as follows: +// - init registers transformGinkgoNodeArgs. +// From now on, all ginkgo.Describe/Context/It invocations invoke +// transformGinkgoNodeArgs. transformGinkgoNodeArgs replaces +// our special arguments with something that Ginkgo can handle. +// - Top-level Describe calls register callbacks with more test definitions. +// Callbacks are not invoked yet. +// - Argument parsing. +// - Ginkgo invokes the callbacks recursively to get a complete tree of tests. +// - Ginkgo runs those tests. +// +// This init is guaranteed to happen before our special argument functions +// can be called because this is the init code of their package. +// Code which does not use the framework might call ginkgo.Describe before +// transformGinkgoNodeArgs is registered. This is not a problem because none of the parameters can be special. +func init() { + ginkgo.AddTreeConstructionNodeArgsTransformer(transformGinkgoNodeArgs) +} + +func transformGinkgoNodeArgs(nodeType types.NodeType, offset ginkgo.Offset, text string, args []any) (string, []any, []error) { + text, args = expandGinkgoArgs(offset+1, text, args) + return text, args, nil +} + +// expandGinkgoArgs concatenates all strings and translates our custom +// arguments into something that Ginkgo can handle. +func expandGinkgoArgs(offset ginkgo.Offset, text string, args []any) (string, []any) { + var ginkgoArgs []interface{} var texts []string + if text != "" { + texts = append(texts, text) + } + addLabel := func(label string) { texts = append(texts, fmt.Sprintf("[%s]", label)) ginkgoArgs = append(ginkgoArgs, ginkgo.Label(label)) @@ -221,6 +292,9 @@ func registerInSuite(ginkgoCall func(string, ...interface{}) bool, args []interf ginkgoArgs = append(ginkgoArgs, ginkgo.Label("BetaOffByDefault")) } } + if arg.parts[0] == "KubeletMinVersion" { + ginkgoArgs = append(ginkgoArgs, ginkgo.ComponentSemVerConstraint("kubelet", ">="+arg.parts[1])) + } switch fullLabel { case "Serial": ginkgoArgs = append(ginkgoArgs, ginkgo.Serial) @@ -230,8 +304,6 @@ func registerInSuite(ginkgoCall func(string, ...interface{}) bool, args []interf // run and then make the run longer overall. ginkgoArgs = append(ginkgoArgs, ginkgo.SpecPriority(1)) } - case ginkgo.Offset: - offset = arg case string: if arg == "" { haveEmptyStrings = true @@ -241,9 +313,7 @@ func registerInSuite(ginkgoCall func(string, ...interface{}) bool, args []interf ginkgoArgs = append(ginkgoArgs, arg) } } - offset += 2 // This function and its direct caller. - // Now that we have the final offset, we can record bugs. if haveEmptyStrings { RecordBug(NewBug("empty strings as separators are unnecessary and need to be removed", int(offset))) } @@ -256,9 +326,8 @@ func registerInSuite(ginkgoCall func(string, ...interface{}) bool, args []interf } } - ginkgoArgs = append(ginkgoArgs, offset) - text := strings.Join(texts, " ") - return ginkgoCall(text, ginkgoArgs...) + text = strings.Join(texts, " ") + return text, ginkgoArgs } var ( @@ -381,8 +450,8 @@ func recordTextBug(location types.CodeLocation, message string) { } // WithFeature specifies that a certain test or group of tests only works -// with a feature available. The return value must be passed as additional -// argument to [framework.It], [framework.Describe], [framework.Context]. +// with a feature available. The return value may be passed as additional +// argument to the framework wrappers and the Ginkgo functions directly. // // The feature must be listed in ValidFeatures. func WithFeature(name Feature) interface{} { @@ -403,8 +472,8 @@ func withFeature(name Feature) interface{} { // WithFeatureGate specifies that a certain test or group of tests depends on a // feature gate and the corresponding API group (if there is one) -// being enabled. The return value must be passed as additional -// argument to [framework.It], [framework.Describe], [framework.Context]. +// being enabled. The return value may be passed as additional +// argument to the framework wrappers and the Ginkgo functions directly. // // The feature gate must be listed in // [k8s.io/apiserver/pkg/util/feature.DefaultMutableFeatureGate]. Once a @@ -461,8 +530,8 @@ func withFeatureGate(featureGate featuregate.Feature) interface{} { } // WithEnvironment specifies that a certain test or group of tests only works -// in a certain environment. The return value must be passed as additional -// argument to [framework.It], [framework.Describe], [framework.Context]. +// in a certain environment. The return value may be passed as additional +// argument to the framework wrappers and the Ginkgo functions directly. // // The environment must be listed in ValidEnvironments. func WithEnvironment(name Environment) interface{} { @@ -482,9 +551,8 @@ func withEnvironment(name Environment) interface{} { } // WithConformance specifies that a certain test or group of tests must pass in -// all conformant Kubernetes clusters. The return value must be passed as -// additional argument to [framework.It], [framework.Describe], -// [framework.Context]. +// all conformant Kubernetes clusters. The return value may be passed as additional +// argument to the framework wrappers and the Ginkgo functions directly. func WithConformance() interface{} { return withConformance() } @@ -500,8 +568,8 @@ func withConformance() interface{} { // WithNodeConformance specifies that a certain test or group of tests for node // functionality that does not depend on runtime or Kubernetes distro specific -// behavior. The return value must be passed as additional argument to -// [framework.It], [framework.Describe], [framework.Context]. +// behavior. The return value may be passed as additional +// argument to the framework wrappers and the Ginkgo functions directly. func WithNodeConformance() interface{} { return withNodeConformance() } @@ -533,8 +601,8 @@ func withDisruptive() interface{} { } // WithSerial specifies that a certain test or group of tests must not run in -// parallel with other tests. The return value must be passed as additional -// argument to [framework.It], [framework.Describe], [framework.Context]. +// parallel with other tests. The return value may be passed as additional +// argument to the framework wrappers and the Ginkgo functions directly. // // Starting with ginkgo v2, serial and parallel tests can be executed in the // same invocation. Ginkgo itself will ensure that the serial tests run @@ -554,8 +622,8 @@ func withSerial() interface{} { // WithSlow specifies that a certain test, or each test within a group of // tests, is slow (is expected to take longer than 5 minutes to run in CI). -// The return value must be passed as additional argument to [framework.It], -// [framework.Describe], [framework.Context]. +// The return value may be passed as additional +// argument to the framework wrappers and the Ginkgo functions directly. func WithSlow() interface{} { return withSlow() } @@ -600,6 +668,32 @@ func withFlaky() interface{} { return newLabel("Flaky") } +// WithKubeletMinVersion specifies that a certain test or group tests needs +// a kubelet version >= the given version string. Specifying the minimum +// version as `.` is sufficient. The patch version may be +// added, but is not required. +// +// This adds +// - a `[KubeletMinVersion:]` tag in the text, +// - a `KubeletMinVersion:` label, +// - and a Ginkgo semver constraint for the "kubelet" component. +// +// The easiest way to filter tests is via `ginkgo +// --sem-ver-filter="kubelet=1.35"` which filters out tests that need a newer +// kubelet. +func WithKubeletMinVersion(version string) interface{} { + return withKubeletMinVersion(version) +} + +// WithKubeletMinVersion is a shorthand for the corresponding package function. +func (f *Framework) WithKubeletMinVersion(version string) interface{} { + return withKubeletMinVersion(version) +} + +func withKubeletMinVersion(version string) interface{} { + return newLabel("KubeletMinVersion", version) +} + type label struct { // parts get concatenated with ":" to build the full label. parts []string diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/kubectl/kubectl_utils.go b/vendor/k8s.io/kubernetes/test/e2e/framework/kubectl/kubectl_utils.go index b3fe86b8bb..2b67d5d68d 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/kubectl/kubectl_utils.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/kubectl/kubectl_utils.go @@ -161,7 +161,7 @@ func (tk *TestKubeconfig) ReadFileViaContainer(podName, containerName string, pa } func (tk *TestKubeconfig) kubectlExecWithRetry(namespace string, podName, containerName string, args ...string) ([]byte, []byte, error) { - for numRetries := 0; numRetries < maxKubectlExecRetries; numRetries++ { + for numRetries := range maxKubectlExecRetries { if numRetries > 0 { framework.Logf("Retrying kubectl exec (retry count=%v/%v)", numRetries+1, maxKubectlExecRetries) } diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/network/utils.go b/vendor/k8s.io/kubernetes/test/e2e/framework/network/utils.go index 30da5df948..d1fb2abb00 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/network/utils.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/network/utils.go @@ -47,7 +47,6 @@ import ( e2epodoutput "k8s.io/kubernetes/test/e2e/framework/pod/output" e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" imageutils "k8s.io/kubernetes/test/utils/image" - netutils "k8s.io/utils/net" ) const ( @@ -332,7 +331,7 @@ func (config *NetworkingTestConfig) DialFromContainer(ctx context.Context, proto responses := sets.NewString() - for i := 0; i < maxTries; i++ { + for i := range maxTries { resp, err := config.GetResponseFromContainer(ctx, protocol, dialCommand, containerIP, targetIP, containerHTTPPort, targetPort) if err != nil { // A failure to kubectl exec counts as a try, not a hard fail. @@ -388,7 +387,7 @@ func (config *NetworkingTestConfig) GetEndpointsFromContainer(ctx context.Contex eps := sets.NewString() - for i := 0; i < tries; i++ { + for i := range tries { stdout, stderr, err := e2epod.ExecShellInPodWithFullOutput(ctx, config.f, config.TestContainerPod.Name, cmd) if err != nil { // A failure to kubectl exec counts as a try, not a hard fail. @@ -494,7 +493,7 @@ func (config *NetworkingTestConfig) DialFromNode(ctx context.Context, protocol, filterCmd := fmt.Sprintf("%s | grep -v '^\\s*$'", cmd) framework.Logf("Going to poll %v on port %v at least %v times, with a maximum of %v tries before failing", targetIP, targetPort, minTries, maxTries) - for i := 0; i < maxTries; i++ { + for i := range maxTries { stdout, stderr, err := e2epod.ExecShellInPodWithFullOutput(ctx, config.f, config.HostTestContainerPod.Name, filterCmd) if err != nil || len(stderr) > 0 { // A failure to exec command counts as a try, not a hard fail. @@ -838,14 +837,10 @@ func (config *NetworkingTestConfig) setup(ctx context.Context, selector map[stri config.SecondaryClusterIP = config.NodePortService.Spec.ClusterIPs[1] } - // Obtain the primary IP family of the Cluster based on the first ClusterIP - // TODO: Eventually we should just be getting these from Spec.IPFamilies - // but for now that would only if the feature gate is enabled. - family := v1.IPv4Protocol - secondaryFamily := v1.IPv6Protocol - if netutils.IsIPv6String(config.ClusterIP) { - family = v1.IPv6Protocol - secondaryFamily = v1.IPv4Protocol + var family, secondaryFamily v1.IPFamily + family = config.NodePortService.Spec.IPFamilies[0] + if len(config.NodePortService.Spec.IPFamilies) == 2 { + secondaryFamily = config.NodePortService.Spec.IPFamilies[1] } if config.PreferExternalAddresses { // Get Node IPs from the cluster, ExternalIPs take precedence diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/node/node_killer.go b/vendor/k8s.io/kubernetes/test/e2e/framework/node/node_killer.go deleted file mode 100644 index fafb6b6a64..0000000000 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/node/node_killer.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright 2014 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. -*/ - -package node - -import ( - "context" - "sync" - "time" - - "github.com/onsi/ginkgo/v2" - - v1 "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/util/wait" - clientset "k8s.io/client-go/kubernetes" - - "k8s.io/kubernetes/test/e2e/framework" - e2essh "k8s.io/kubernetes/test/e2e/framework/ssh" -) - -// NodeKiller is a utility to simulate node failures. -type NodeKiller struct { - config framework.NodeKillerConfig - client clientset.Interface - provider string -} - -// NewNodeKiller creates new NodeKiller. -func NewNodeKiller(config framework.NodeKillerConfig, client clientset.Interface, provider string) *NodeKiller { - config.NodeKillerStopCtx, config.NodeKillerStop = context.WithCancel(context.Background()) - return &NodeKiller{config, client, provider} -} - -// Run starts NodeKiller until stopCh is closed. -func (k *NodeKiller) Run(ctx context.Context) { - // wait.JitterUntil starts work immediately, so wait first. - time.Sleep(wait.Jitter(k.config.Interval, k.config.JitterFactor)) - wait.JitterUntilWithContext(ctx, func(ctx context.Context) { - nodes := k.pickNodes(ctx) - k.kill(ctx, nodes) - }, k.config.Interval, k.config.JitterFactor, true) -} - -func (k *NodeKiller) pickNodes(ctx context.Context) []v1.Node { - nodes, err := GetReadySchedulableNodes(ctx, k.client) - framework.ExpectNoError(err) - numNodes := int(k.config.FailureRatio * float64(len(nodes.Items))) - - nodes, err = GetBoundedReadySchedulableNodes(ctx, k.client, numNodes) - framework.ExpectNoError(err) - return nodes.Items -} - -func (k *NodeKiller) kill(ctx context.Context, nodes []v1.Node) { - wg := sync.WaitGroup{} - wg.Add(len(nodes)) - for _, node := range nodes { - node := node - go func() { - defer ginkgo.GinkgoRecover() - defer wg.Done() - - framework.Logf("Stopping docker and kubelet on %q to simulate failure", node.Name) - err := e2essh.IssueSSHCommand(ctx, "sudo systemctl stop docker kubelet", k.provider, &node) - if err != nil { - framework.Logf("ERROR while stopping node %q: %v", node.Name, err) - return - } - - time.Sleep(k.config.SimulatedDowntime) - - framework.Logf("Rebooting %q to repair the node", node.Name) - err = e2essh.IssueSSHCommand(ctx, "sudo reboot", k.provider, &node) - if err != nil { - framework.Logf("ERROR while rebooting node %q: %v", node.Name, err) - return - } - }() - } - wg.Wait() -} diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/node/resource.go b/vendor/k8s.io/kubernetes/test/e2e/framework/node/resource.go index 5c154d6899..d6359a2d80 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/node/resource.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/node/resource.go @@ -41,6 +41,7 @@ import ( "k8s.io/apimachinery/pkg/util/wait" clientset "k8s.io/client-go/kubernetes" clientretry "k8s.io/client-go/util/retry" + resourceapi "k8s.io/kubernetes/pkg/api/v1/resource" "k8s.io/kubernetes/test/e2e/framework" netutil "k8s.io/utils/net" ) @@ -88,18 +89,6 @@ type PodNode struct { Node string } -// FirstAddress returns the first address of the given type of each node. -func FirstAddress(nodelist *v1.NodeList, addrType v1.NodeAddressType) string { - for _, n := range nodelist.Items { - for _, addr := range n.Status.Addresses { - if addr.Type == addrType && addr.Address != "" { - return addr.Address - } - } - } - return "" -} - func isNodeConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue, silent bool) bool { // Check the node readiness condition (logging all). for _, cond := range node.Status.Conditions { @@ -293,19 +282,6 @@ func CollectAddresses(nodes *v1.NodeList, addressType v1.NodeAddressType) []stri return ips } -// PickIP picks one public node IP -func PickIP(ctx context.Context, c clientset.Interface) (string, error) { - publicIps, err := GetPublicIps(ctx, c) - if err != nil { - return "", fmt.Errorf("get node public IPs error: %w", err) - } - if len(publicIps) == 0 { - return "", fmt.Errorf("got unexpected number (%d) of public IPs", len(publicIps)) - } - ip := publicIps[0] - return ip, nil -} - // GetPublicIps returns a public IP list of nodes. func GetPublicIps(ctx context.Context, c clientset.Interface) ([]string, error) { nodes, err := GetReadySchedulableNodes(ctx, c) @@ -500,6 +476,49 @@ func hasNonblockingTaint(node *v1.Node, nonblockingTaints string) bool { return false } +// GetNodeAllocatableAndAvailableQuantities with resourceName set to v1.ResourceCPU ( or set to v1.ResourceMemory ) returns +// - the first return value, upon success is the allocatable portion of a node's total "CPU" ( or "Memory" ) capacity that's available for pods to use, +// calculated by subtracting "CPU" ( or "Memory") resources reserved for node's operating system, Kubelet and other +// system daemons from the node's total "CPU" ( or "Memory" ) resource, upon failure is empty. +// - the second return value, upon success is the available portion of a node's allocatable "CPU" capacity, calculated by subtracting "CPU" +// ( or "Memory" ) resource reserved for node's pods from the node's allocatable "CPU" ( or "Memory" ) resource, upon failure is empty. +// - the third return value, upon success is nil, upon failure is the coresponding error. +func GetNodeAllocatableAndAvailableQuantities(ctx context.Context, c clientset.Interface, n *v1.Node, resourceName v1.ResourceName) (resource.Quantity, resource.Quantity, error) { + var nodeAllocatable, podAllocated, nodeAvailable resource.Quantity + switch resourceName { + case v1.ResourceCPU: + nodeAllocatable = n.Status.Allocatable.Cpu().DeepCopy() + case v1.ResourceMemory: + nodeAllocatable = n.Status.Allocatable.Memory().DeepCopy() + default: + return resource.Quantity{}, resource.Quantity{}, fmt.Errorf("unexpected resource type %q; expected either 'CPU' or 'Memory'", resourceName) + } + + if n.Status.Allocatable == nil { + return resource.Quantity{}, resource.Quantity{}, fmt.Errorf("unexpected empty value of allocatable, while attempting to get node's allocatable %s", resourceName.String()) + } + + // Exclude pods that are in the Succeeded or Failed states + selector := fmt.Sprintf("spec.nodeName=%s,status.phase!=%v,status.phase!=%v", n.Name, v1.PodSucceeded, v1.PodFailed) + listOptions := metav1.ListOptions{FieldSelector: selector} + podList, err := c.CoreV1().Pods(metav1.NamespaceAll).List(ctx, listOptions) + if err != nil { + return resource.Quantity{}, resource.Quantity{}, fmt.Errorf("error getting list of pods: %w, while attempting to get node's allocatable %s", err, resourceName.String()) + } + + for _, pod := range podList.Items { + podRequest := resourceapi.GetResourceRequestQuantity(&pod, resourceName) + podAllocated.Add(podRequest) + } + nodeAvailable = nodeAllocatable.DeepCopy() + nodeAvailable.Sub(podAllocated) + if nodeAvailable.Sign() < 0 { + return resource.Quantity{}, resource.Quantity{}, fmt.Errorf("unexpected negative value of nodeAvailable %s, while attempting to get node's allocatable and available %s", nodeAvailable.String(), resourceName.String()) + } + + return nodeAllocatable, nodeAvailable, nil +} + // GetNodeHeartbeatTime returns the timestamp of the last status update of the node. func GetNodeHeartbeatTime(node *v1.Node) metav1.Time { for _, condition := range node.Status.Conditions { @@ -533,7 +552,7 @@ func PodNodePairs(ctx context.Context, c clientset.Interface, ns string) ([]PodN func GetClusterZones(ctx context.Context, c clientset.Interface) (sets.String, error) { nodes, err := c.CoreV1().Nodes().List(ctx, metav1.ListOptions{}) if err != nil { - return nil, fmt.Errorf("Error getting nodes while attempting to list cluster zones: %w", err) + return nil, fmt.Errorf("error getting nodes while attempting to list cluster zones: %w", err) } // collect values of zone label from all nodes diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/node/util_sampledevice.go b/vendor/k8s.io/kubernetes/test/e2e/framework/node/util_sampledevice.go new file mode 100644 index 0000000000..7d3ac25c6c --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/node/util_sampledevice.go @@ -0,0 +1,57 @@ +/* +Copyright 2023 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. +*/ + +package node + +import ( + v1 "k8s.io/api/core/v1" +) + +const ( + // SampleDevicePluginDSYAML is the path of the daemonset template of the sample device plugin. // TODO: Parametrize it by making it a feature in TestFramework. + SampleDevicePluginDSYAML = "test/e2e/testing-manifests/sample-device-plugin/sample-device-plugin.yaml" + SampleDevicePluginControlRegistrationDSYAML = "test/e2e/testing-manifests/sample-device-plugin/sample-device-plugin-control-registration.yaml" + + // SampleDevicePluginName is the name of the device plugin pod + SampleDevicePluginName = "sample-device-plugin" + + // SampleDeviceResourceName is the name of the resource provided by the sample device plugin + SampleDeviceResourceName = "example.com/resource" + + SampleDeviceEnvVarNamePluginSockDir = "PLUGIN_SOCK_DIR" + + // SampleDevsAmount is an amount of devices provided by the sample device plugin: + // https://github.com/kubernetes/kubernetes/blob/111a2a0d2dfe13639724506f674bc4f342ccfbab/test/images/sample-device-plugin/sampledeviceplugin.go#L100-L101 + SampleDevsAmount int64 = 2 +) + +// CountSampleDeviceCapacity returns the number of devices of SampleDeviceResourceName advertised by a node capacity +func CountSampleDeviceCapacity(node *v1.Node) int64 { + val, ok := node.Status.Capacity[v1.ResourceName(SampleDeviceResourceName)] + if !ok { + return 0 + } + return val.Value() +} + +// CountSampleDeviceAllocatable returns the number of devices of SampleDeviceResourceName advertised by a node allocatable +func CountSampleDeviceAllocatable(node *v1.Node) int64 { + val, ok := node.Status.Allocatable[v1.ResourceName(SampleDeviceResourceName)] + if !ok { + return 0 + } + return val.Value() +} diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/dial.go b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/dial.go index 7846426d6e..37aeef0a3a 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/dial.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/dial.go @@ -29,7 +29,6 @@ import ( v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime/schema" - "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" @@ -37,6 +36,7 @@ import ( "k8s.io/client-go/transport/spdy" "k8s.io/klog/v2" "k8s.io/kubernetes/test/e2e/framework" + "k8s.io/streaming/pkg/httpstream" ) // NewTransport creates a transport which uses the port forward dialer. @@ -90,14 +90,14 @@ func (d *Dialer) DialContainerPort(ctx context.Context, addr Addr) (conn net.Con if err != nil { return nil, fmt.Errorf("create round tripper: %w", err) } - dialer := spdy.NewDialer(upgrader, &http.Client{Transport: transport}, "POST", req.URL()) + dialer := spdy.NewDialerForStreaming(upgrader, &http.Client{Transport: transport}, "POST", req.URL()) - tunnelingDialer, err := portforward.NewSPDYOverWebsocketDialer(req.URL(), restConfig) + tunnelingDialer, err := portforward.NewSPDYOverWebsocketDialerForStreaming(req.URL(), restConfig) if err != nil { return nil, err } // First attempt tunneling (websocket) dialer, then fallback to spdy dialer. - dialer = portforward.NewFallbackDialer(tunnelingDialer, dialer, func(err error) bool { + dialer = portforward.NewFallbackDialerForStreaming(tunnelingDialer, dialer, func(err error) bool { if httpstream.IsUpgradeFailure(err) || httpstream.IsHTTPSProxyError(err) { framework.Logf("fallback to secondary dialer from primary dialer err: %v", err) return true diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/exec_util.go b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/exec_util.go index d2d09c464b..e4a34fe1d4 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/exec_util.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/exec_util.go @@ -27,12 +27,12 @@ import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/client-go/kubernetes/scheme" - restclient "k8s.io/client-go/rest" "k8s.io/client-go/tools/remotecommand" clientexec "k8s.io/client-go/util/exec" "k8s.io/kubernetes/test/e2e/framework" + "k8s.io/kubernetes/test/utils/ktesting" + "k8s.io/streaming/pkg/httpstream" "github.com/onsi/gomega" ) @@ -59,14 +59,18 @@ func ExecWithOptions(f *framework.Framework, options ExecOptions) (string, strin } func ExecWithOptionsContext(ctx context.Context, f *framework.Framework, options ExecOptions) (string, string, error) { + return ExecWithOptionsTCtx(f.TContext(ctx), options) +} + +func ExecWithOptionsTCtx(tCtx ktesting.TContext, options ExecOptions) (string, string, error) { if !options.Quiet { - framework.Logf("ExecWithOptions %+v", options) + tCtx.Logf("ExecWithOptions %+v", options) } const tty = false - framework.Logf("ExecWithOptions: Clientset creation") - req := f.ClientSet.CoreV1().RESTClient().Post(). + tCtx.Logf("ExecWithOptions: Clientset creation") + req := tCtx.Client().CoreV1().RESTClient().Post(). Resource("pods"). Name(options.PodName). Namespace(options.Namespace). @@ -81,8 +85,8 @@ func ExecWithOptionsContext(ctx context.Context, f *framework.Framework, options }, scheme.ParameterCodec) var stdout, stderr bytes.Buffer - framework.Logf("ExecWithOptions: execute(%s)", req.URL()) - err := execute(ctx, req.URL(), f.ClientConfig(), options.Stdin, &stdout, &stderr, tty) + tCtx.Logf("ExecWithOptions: execute(%s)", req.URL()) + err := execute(tCtx, req.URL(), options.Stdin, &stdout, &stderr, tty) if options.PreserveWhitespace { return stdout.String(), stderr.String(), err @@ -182,7 +186,8 @@ func VerifyExecInPodFail(ctx context.Context, f *framework.Framework, pod *v1.Po return fmt.Errorf("%q should fail with exit code %d, but exit without error", shExec, exitCode) } -func execute(ctx context.Context, url *url.URL, config *restclient.Config, stdin io.Reader, stdout, stderr io.Writer, tty bool) error { +func execute(tCtx ktesting.TContext, url *url.URL, stdin io.Reader, stdout, stderr io.Writer, tty bool) error { + config := tCtx.RESTConfig() // WebSocketExecutor executor is default // WebSocketExecutor must be "GET" method as described in RFC 6455 Sec. 4.1 (page 17). websocketExec, err := remotecommand.NewWebSocketExecutor(config, "GET", url.String()) @@ -205,7 +210,7 @@ func execute(ctx context.Context, url *url.URL, config *restclient.Config, stdin return err } - return exec.StreamWithContext(ctx, remotecommand.StreamOptions{ + return exec.StreamWithContext(tCtx, remotecommand.StreamOptions{ Stdin: stdin, Stdout: stdout, Stderr: stderr, diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/output/output.go b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/output/output.go index fac0076444..b66e037456 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/output/output.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/output/output.go @@ -273,7 +273,6 @@ func TestContainerOutputsMatcher(ctx context.Context, f *framework.Framework, expectedNameOutputs := make(map[string][]string, len(expectedOutputs)) for containerIndex, expectedOutput := range expectedOutputs { - expectedOutput := expectedOutput if containerIndex < 0 || containerIndex >= len(pod.Spec.Containers) { framework.Failf("Invalid container index: %d", containerIndex) } diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/pod_client.go b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/pod_client.go index 104f9dec80..b7e4200019 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/pod/pod_client.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/pod/pod_client.go @@ -21,6 +21,7 @@ import ( "encoding/json" "fmt" "regexp" + "slices" "strings" "sync" "time" @@ -371,29 +372,10 @@ func (c *PodClient) PodIsReady(ctx context.Context, name string) bool { return podutils.IsPodReady(pod) } -// RemoveString returns a newly created []string that contains all items from slice -// that are not equal to s. -// This code is taken from k/k/pkg/util/slice/slice.go to remove -// e2e/framework/pod -> k/k/pkg/util/slice dependency. -func removeString(slice []string, s string) []string { - newSlice := make([]string, 0) - for _, item := range slice { - if item != s { - newSlice = append(newSlice, item) - } - } - if len(newSlice) == 0 { - // Sanitize for unit tests so we don't need to distinguish empty array - // and nil. - return nil - } - return newSlice -} - // RemoveFinalizer removes the pod's finalizer func (c *PodClient) RemoveFinalizer(ctx context.Context, podName string, finalizerName string) { framework.Logf("Removing pod's %q finalizer: %q", podName, finalizerName) c.Update(ctx, podName, func(pod *v1.Pod) { - pod.ObjectMeta.Finalizers = removeString(pod.ObjectMeta.Finalizers, finalizerName) + pod.ObjectMeta.Finalizers = slices.DeleteFunc(pod.ObjectMeta.Finalizers, func(actual string) bool { return actual == finalizerName }) }) } diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/service/jig.go b/vendor/k8s.io/kubernetes/test/e2e/framework/service/jig.go index 78cd28d1a0..c76e14011b 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/service/jig.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/service/jig.go @@ -361,26 +361,6 @@ func (j *TestJig) CreateLoadBalancerService(ctx context.Context, timeout time.Du return j.WaitForLoadBalancer(ctx, timeout) } -// GetEndpointNodes returns a map of nodenames:external-ip on which the -// endpoints of the Service are running. -func (j *TestJig) GetEndpointNodes(ctx context.Context) (map[string][]string, error) { - return j.GetEndpointNodesWithIP(ctx, v1.NodeExternalIP) -} - -// GetEndpointNodesWithIP returns a map of nodenames: on which the -// endpoints of the Service are running. -func (j *TestJig) GetEndpointNodesWithIP(ctx context.Context, addressType v1.NodeAddressType) (map[string][]string, error) { - nodes, err := j.ListNodesWithEndpoint(ctx) - if err != nil { - return nil, err - } - nodeMap := map[string][]string{} - for _, node := range nodes { - nodeMap[node.Name] = e2enode.GetAddresses(&node, addressType) - } - return nodeMap, nil -} - // ListNodesWithEndpoint returns a list of nodes on which the // endpoints of the given Service are running. func (j *TestJig) ListNodesWithEndpoint(ctx context.Context) ([]v1.Node, error) { @@ -548,7 +528,7 @@ func needsNodePorts(svc *v1.Service) bool { // then attempts to send the updated service. It tries up to 3 times in the // face of timeouts and conflicts. func (j *TestJig) UpdateService(ctx context.Context, update func(*v1.Service)) (*v1.Service, error) { - for i := 0; i < 3; i++ { + for range 3 { service, err := j.Client.CoreV1().Services(j.Namespace).Get(ctx, j.Name, metav1.GetOptions{}) if err != nil { return nil, fmt.Errorf("failed to get Service %q: %w", j.Name, err) diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/service/resource.go b/vendor/k8s.io/kubernetes/test/e2e/framework/service/resource.go index 663fe8c11d..e612e18f43 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/service/resource.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/service/resource.go @@ -18,19 +18,15 @@ package service import ( "context" - "fmt" "time" v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/apimachinery/pkg/util/intstr" clientset "k8s.io/client-go/kubernetes" restclient "k8s.io/client-go/rest" "k8s.io/kubernetes/test/e2e/framework" e2enode "k8s.io/kubernetes/test/e2e/framework/node" - testutils "k8s.io/kubernetes/test/utils" ) // GetServicesProxyRequest returns a request for a service proxy. @@ -68,7 +64,7 @@ func CreateServiceSpec(serviceName, externalName string, isHeadless bool, select func UpdateService(ctx context.Context, c clientset.Interface, namespace, serviceName string, update func(*v1.Service)) (*v1.Service, error) { var service *v1.Service var err error - for i := 0; i < 3; i++ { + for range 3 { service, err = c.CoreV1().Services(namespace).Get(ctx, serviceName, metav1.GetOptions{}) if err != nil { return service, err @@ -118,52 +114,3 @@ func GetServiceLoadBalancerPropagationTimeout(ctx context.Context, cs clientset. } return loadBalancerPropagationTimeoutDefault } - -// CreateServiceForSimpleAppWithPods is a convenience wrapper to create a service and its matching pods all at once. -func CreateServiceForSimpleAppWithPods(ctx context.Context, c clientset.Interface, contPort int, svcPort int, namespace, appName string, podSpec func(n v1.Node) v1.PodSpec, count int, block bool) (*v1.Service, error) { - var err error - theService := CreateServiceForSimpleApp(ctx, c, contPort, svcPort, namespace, appName) - e2enode.CreatePodsPerNodeForSimpleApp(ctx, c, namespace, appName, podSpec, count) - if block { - err = testutils.WaitForPodsWithLabelRunning(c, namespace, labels.SelectorFromSet(labels.Set(theService.Spec.Selector))) - } - return theService, err -} - -// CreateServiceForSimpleApp returns a service that selects/exposes pods (send -1 ports if no exposure needed) with an app label. -func CreateServiceForSimpleApp(ctx context.Context, c clientset.Interface, contPort, svcPort int, namespace, appName string) *v1.Service { - if appName == "" { - panic(fmt.Sprintf("no app name provided")) - } - - serviceSelector := map[string]string{ - "app": appName + "-pod", - } - - // For convenience, user sending ports are optional. - portsFunc := func() []v1.ServicePort { - if contPort < 1 || svcPort < 1 { - return nil - } - return []v1.ServicePort{{ - Protocol: v1.ProtocolTCP, - Port: int32(svcPort), - TargetPort: intstr.FromInt32(int32(contPort)), - }} - } - framework.Logf("Creating a service-for-%v for selecting app=%v-pod", appName, appName) - service, err := c.CoreV1().Services(namespace).Create(ctx, &v1.Service{ - ObjectMeta: metav1.ObjectMeta{ - Name: "service-for-" + appName, - Labels: map[string]string{ - "app": appName + "-service", - }, - }, - Spec: v1.ServiceSpec{ - Ports: portsFunc(), - Selector: serviceSelector, - }, - }, metav1.CreateOptions{}) - framework.ExpectNoError(err) - return service -} diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/ssh/ssh.go b/vendor/k8s.io/kubernetes/test/e2e/framework/ssh/ssh.go index e193175458..c9a136d8d7 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/ssh/ssh.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/ssh/ssh.go @@ -125,8 +125,7 @@ func makePrivateKeySignerFromFile(key string) (ssh.Signer, error) { // NodeSSHHosts returns SSH-able host names for all schedulable nodes. // If it can't find any external IPs, it falls back to // looking for internal IPs. If it can't find an internal IP for every node it -// returns an error, though it still returns all hosts that it found in that -// case. +// returns an error. func NodeSSHHosts(ctx context.Context, c clientset.Interface) ([]string, error) { nodelist := waitListSchedulableNodesOrDie(ctx, c) @@ -136,10 +135,9 @@ func NodeSSHHosts(ctx context.Context, c clientset.Interface) ([]string, error) framework.Logf("No external IP address on nodes, falling back to internal IPs") hosts = nodeAddresses(nodelist, v1.NodeInternalIP) } - - // Error if neither External nor Internal IPs weren't available for all nodes. if len(hosts) != len(nodelist.Items) { - return hosts, fmt.Errorf( + // Something is wrong; all schedulable nodes should have at least one IP. + return nil, fmt.Errorf( "only found %d IPs on nodes, but found %d nodes. Nodelist: %v", len(hosts), len(nodelist.Items), nodelist) } @@ -247,16 +245,12 @@ func runSSHCommand(ctx context.Context, cmd, user, host string, signer ssh.Signe Auth: []ssh.AuthMethod{ssh.PublicKeys(signer)}, HostKeyCallback: ssh.InsecureIgnoreHostKey(), } - client, err := ssh.Dial("tcp", host, config) - if err != nil { - err = wait.PollUntilContextTimeout(ctx, 5*time.Second, 20*time.Second, false, func(ctx context.Context) (bool, error) { - fmt.Printf("error dialing %s@%s: '%v', retrying\n", user, host, err) - if client, err = ssh.Dial("tcp", host, config); err != nil { - return false, nil // retrying, error will be logged above - } - return true, nil - }) - } + var client *ssh.Client + err := framework.Gomega().Eventually(ctx, func() error { + c, err := ssh.Dial("tcp", host, config) + client = c + return err + }).WithPolling(5 * time.Second).WithTimeout(20 * time.Second).Should(gomega.Succeed()) if err != nil { return "", "", 0, fmt.Errorf("error getting SSH client to %s@%s: %w", user, host, err) } diff --git a/vendor/k8s.io/kubernetes/test/e2e/framework/test_context.go b/vendor/k8s.io/kubernetes/test/e2e/framework/test_context.go index abe4bfda13..3d35c04b97 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/framework/test_context.go +++ b/vendor/k8s.io/kubernetes/test/e2e/framework/test_context.go @@ -17,7 +17,6 @@ limitations under the License. package framework import ( - "context" "crypto/rand" "encoding/base64" "errors" @@ -30,7 +29,6 @@ import ( "path/filepath" "sort" "strings" - "time" "github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2/reporters" @@ -187,9 +185,6 @@ type TestContextType struct { // The DNS Domain of the cluster. ClusterDNSDomain string - // The configuration of NodeKiller. - NodeKiller NodeKillerConfig - // The Default IP Family of the cluster ("ipv4" or "ipv6") IPFamily string @@ -229,30 +224,6 @@ type TestContextType struct { EnabledVolumeDrivers []string } -// NodeKillerConfig describes configuration of NodeKiller -- a utility to -// simulate node failures. -// -// TODO: move this and the corresponding command line flags into -// test/e2e/framework/node. -type NodeKillerConfig struct { - // Enabled determines whether NodeKill should do anything at all. - // All other options below are ignored if Enabled = false. - Enabled bool - // FailureRatio is a percentage of all nodes that could fail simultinously. - FailureRatio float64 - // Interval is time between node failures. - Interval time.Duration - // JitterFactor is factor used to jitter node failures. - // Node will be killed between [Interval, Interval + (1.0 + JitterFactor)]. - JitterFactor float64 - // SimulatedDowntime is a duration between node is killed and recreated. - SimulatedDowntime time.Duration - // NodeKillerStopCtx is a context that is used to notify NodeKiller to stop killing nodes. - NodeKillerStopCtx context.Context - // NodeKillerStop is the cancel function for NodeKillerStopCtx. - NodeKillerStop func() -} - // NodeTestContextType is part of TestContextType, it is shared by all node e2e test. type NodeTestContextType struct { // NodeE2E indicates whether it is running node e2e. @@ -443,7 +414,7 @@ func RegisterClusterFlags(flags *flag.FlagSet) { flags.StringVar(&cloudConfig.Cluster, "gke-cluster", "", "GKE name of cluster being used, if applicable") flags.StringVar(&cloudConfig.NodeInstanceGroup, "node-instance-group", "", "Name of the managed instance group for nodes. Valid only for gce, gke or aws. If there is more than one group: comma separated list of groups.") flags.StringVar(&cloudConfig.Network, "network", "e2e", "The cloud provider network for this e2e cluster.") - flags.IntVar(&cloudConfig.NumNodes, "num-nodes", DefaultNumNodes, fmt.Sprintf("Number of nodes in the cluster. If the default value of '%q' is used the number of schedulable nodes is auto-detected.", DefaultNumNodes)) + flags.IntVar(&cloudConfig.NumNodes, "num-nodes", DefaultNumNodes, fmt.Sprintf("Number of nodes in the cluster. If the default value of '%d' is used the number of schedulable nodes is auto-detected.", DefaultNumNodes)) flags.StringVar(&cloudConfig.ClusterIPRange, "cluster-ip-range", "10.64.0.0/14", "A CIDR notation IP range from which to assign IPs in the cluster.") flags.StringVar(&cloudConfig.NodeTag, "node-tag", "", "Network tags used on node instances. Valid only for gce, gke") flags.StringVar(&cloudConfig.MasterTag, "master-tag", "", "Network tags used on master instances. Valid only for gce, gke") @@ -458,13 +429,6 @@ func RegisterClusterFlags(flags *flag.FlagSet) { flags.StringVar(&TestContext.EtcdUpgradeVersion, "etcd-upgrade-version", "", "The etcd binary version to upgrade to (e.g., '3.0.14', '2.3.7') if doing an etcd upgrade test.") flags.StringVar(&TestContext.GCEUpgradeScript, "gce-upgrade-script", "", "Script to use to upgrade a GCE cluster.") flags.BoolVar(&TestContext.CleanStart, "clean-start", false, "If true, purge all namespaces except default and system before running tests. This serves to Cleanup test namespaces from failed/interrupted e2e runs in a long-lived cluster.") - - nodeKiller := &TestContext.NodeKiller - flags.BoolVar(&nodeKiller.Enabled, "node-killer", false, "Whether NodeKiller should kill any nodes.") - flags.Float64Var(&nodeKiller.FailureRatio, "node-killer-failure-ratio", 0.01, "Percentage of nodes to be killed") - flags.DurationVar(&nodeKiller.Interval, "node-killer-interval", 1*time.Minute, "Time between node failures.") - flags.Float64Var(&nodeKiller.JitterFactor, "node-killer-jitter-factor", 60, "Factor used to jitter node failures.") - flags.DurationVar(&nodeKiller.SimulatedDowntime, "node-killer-simulated-downtime", 10*time.Minute, "A delay between node death and recreation") } // generateSecureToken returns a string of length tokenLen, consisting diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/OWNERS b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/OWNERS index 03cc9aff5b..8a274491d4 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/OWNERS +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/OWNERS @@ -1,6 +1,7 @@ # See the OWNERS docs at https://go.k8s.io/owners approvers: + - sig-node-approvers - klueska - pohly reviewers: diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/dra-test-driver-proxy.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/dra-test-driver-proxy.yaml index 6c7da12638..f01aca4a9f 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/dra-test-driver-proxy.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/dra/dra-test-driver-proxy.yaml @@ -47,7 +47,7 @@ spec: containers: - name: pause - image: registry.k8s.io/sig-storage/hostpathplugin:v1.16.1 + image: registry.k8s.io/sig-storage/hostpathplugin:to-be-replaced # Version and actual registry get patched in during deployment. command: - /bin/sh - -c diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/kubectl/agnhost-primary-pod.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/kubectl/agnhost-primary-pod.yaml index cd2916ea67..2adb015a99 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/kubectl/agnhost-primary-pod.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/kubectl/agnhost-primary-pod.yaml @@ -8,7 +8,7 @@ metadata: spec: containers: - name: primary - image: registry.k8s.io/e2e-test-images/agnhost:2.54 + image: registry.k8s.io/e2e-test-images/agnhost:2.63.0 env: - name: PRIMARY value: "true" @@ -21,7 +21,7 @@ spec: - mountPath: /agnhost-primary-data name: data - name: sentinel - image: registry.k8s.io/e2e-test-images/agnhost:2.54 + image: registry.k8s.io/e2e-test-images/agnhost:2.63.0 env: - name: SENTINEL value: "true" diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/statefulset/etcd/statefulset.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/statefulset/etcd/statefulset.yaml index ccaa4bab6e..7aa24c7062 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/statefulset/etcd/statefulset.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/statefulset/etcd/statefulset.yaml @@ -18,7 +18,7 @@ spec: spec: containers: - name: etcd - image: registry.k8s.io/etcd:3.2.24 + image: registry.k8s.io/etcd:3.6.8-0 imagePullPolicy: Always ports: - containerPort: 2380 diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/backup-client-rbac.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/backup-client-rbac.yaml new file mode 100644 index 0000000000..cab762efa6 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/backup-client-rbac.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: backup-app-service-account +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: external-snapshot-metadata-client-runner +rules: +- apiGroups: + - snapshot.storage.k8s.io + resources: + - volumesnapshots + - volumesnapshotcontents + verbs: + - get + - list + - watch +# Access to discover SnapshotMetadataService resources +- apiGroups: + - cbt.storage.k8s.io + resources: + - snapshotmetadataservices + verbs: + - get + - list +## Access to create sa tokens with tokenrequests API if client needs to generate SA token +- apiGroups: + - "" + resources: + - serviceaccounts/token + verbs: + - create + - get +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: backup-app-cluster-role-binding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: external-snapshot-metadata-client-runner +subjects: +- kind: ServiceAccount + name: backup-app-service-account diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/cbt.storage.k8s.io_snapshotmetadataservices.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/cbt.storage.k8s.io_snapshotmetadataservices.yaml new file mode 100644 index 0000000000..de75d40132 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/cbt.storage.k8s.io_snapshotmetadataservices.yaml @@ -0,0 +1,76 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.15.0 + api-approved.kubernetes.io: "https://github.com/kubernetes-csi/external-snapshot-metadata/pull/2" + name: snapshotmetadataservices.cbt.storage.k8s.io +spec: + group: cbt.storage.k8s.io + names: + kind: SnapshotMetadataService + listKind: SnapshotMetadataServiceList + plural: snapshotmetadataservices + shortNames: + - sms + singular: snapshotmetadataservice + scope: Cluster + versions: + - name: v1beta1 + schema: + openAPIV3Schema: + description: |- + SnapshotMetadataService is the Schema for the snapshotmetadataservices API + The presence of a SnapshotMetadataService CR advertises the existence of a CSI + driver's Kubernetes SnapshotMetadata gRPC service. + An audience scoped Kubernetes authentication bearer token must be passed in the + "security_token" field of each gRPC call made by a Kubernetes backup client. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: Required. + properties: + address: + description: |- + The TCP endpoint address of the gRPC service. + Required. + type: string + audience: + description: |- + The audience string value expected in a client's authentication token passed + in the "security_token" field of each gRPC call. + Required. + type: string + caCert: + description: |- + Certificate authority bundle needed by the client to validate the service. + Required. + format: byte + type: string + required: + - address + - audience + - caCert + type: object + required: + - spec + type: object + served: true + storage: true diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/rbac.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/rbac.yaml new file mode 100644 index 0000000000..9fba26d23b --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/rbac.yaml @@ -0,0 +1,42 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/instance: hostpath.csi.k8s.io + app.kubernetes.io/part-of: csi-driver-host-path + name: external-snapshot-metadata-runner +rules: +- apiGroups: + - cbt.storage.k8s.io + resources: + - snapshotmetadataservices + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create + - get +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create + - get +- apiGroups: + - snapshot.storage.k8s.io + resources: + - volumesnapshots + - volumesnapshotcontents + verbs: + - get + - list diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/run_snapshot_metadata_e2e.sh b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/run_snapshot_metadata_e2e.sh new file mode 100644 index 0000000000..e7abb0a889 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/run_snapshot_metadata_e2e.sh @@ -0,0 +1,325 @@ +#!/bin/sh +# Copyright 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. + +# hack script for running a kind e2e +# must be run with a kubernetes checkout in $PWD (IE from the checkout) +# Usage: SKIP="ginkgo skip regex" FOCUS="ginkgo focus regex" kind-e2e.sh + +set -o errexit -o nounset -o xtrace + +# Settings: +# SKIP: ginkgo skip regex +# FOCUS: ginkgo focus regex (defaults to [Conformance] if unset; set to "" to run all tests) +# LABEL_FILTER: ginkgo label query for selecting tests (see "Spec Labels" in https://onsi.github.io/ginkgo/#filtering-specs) +# +# The default is to focus on conformance tests when FOCUS is unset. To run all +# tests (no focus filter), explicitly set FOCUS="". Serial tests get skipped when +# parallel testing is enabled. Using LABEL_FILTER instead of combining SKIP and +# FOCUS is recommended (more expressive, easier to read than regexp). +# +# FEATURE_GATES: +# JSON or YAML encoding of a string/bool map: {"FeatureGateA": true, "FeatureGateB": false} +# Enables or disables feature gates in the entire cluster. +# RUNTIME_CONFIG: +# JSON or YAML encoding of a string/string (!) map: {"apia.example.com/v1alpha1": "true", "apib.example.com/v1beta1": "false"} +# Enables API groups in the apiserver via --runtime-config. + +# cleanup logic for cleanup on exit +CLEANED_UP=false +cleanup() { + if [ "$CLEANED_UP" = "true" ]; then + return + fi + # KIND_CREATE_ATTEMPTED is true once we: kind create + if [ "${KIND_CREATE_ATTEMPTED:-}" = true ]; then + kind "export" logs "${ARTIFACTS}" || true + kind delete cluster || true + fi + rm -f _output/bin/e2e.test || true + # remove our tempdir, this needs to be last, or it will prevent kind delete + if [ -n "${TMP_DIR:-}" ]; then + rm -rf "${TMP_DIR:?}" + fi + CLEANED_UP=true +} + +# setup signal handlers +# shellcheck disable=SC2317 # this is not unreachable code +signal_handler() { + if [ -n "${GINKGO_PID:-}" ]; then + kill -TERM "$GINKGO_PID" || true + fi + cleanup +} +trap signal_handler INT TERM + +# build kubernetes / node image, e2e binaries +build() { + # build the node image w/ kubernetes + kind build node-image -v 1 + # Ginkgo v1 is used by Kubernetes 1.24 and earlier, fallback if v2 is not available. + GINKGO_SRC_DIR="vendor/github.com/onsi/ginkgo/v2/ginkgo" + if [ ! -d "$GINKGO_SRC_DIR" ]; then + GINKGO_SRC_DIR="vendor/github.com/onsi/ginkgo/ginkgo" + fi + # make sure we have e2e requirements + make all WHAT="cmd/kubectl test/e2e/e2e.test ${GINKGO_SRC_DIR}" + + # Ensure the built kubectl is used instead of system + export PATH="${PWD}/_output/bin:$PATH" +} + +# up a cluster with kind +create_cluster() { + # Default Log level for all components in test clusters + KIND_CLUSTER_LOG_LEVEL=${KIND_CLUSTER_LOG_LEVEL:-4} + + # JSON or YAML map injected into featureGates config + feature_gates="${FEATURE_GATES:-{\}}" + # --runtime-config argument value passed to the API server, again as a map + runtime_config="${RUNTIME_CONFIG:-{\}}" + + # create the config file + cat < "${ARTIFACTS}/kind-config.yaml" +# config for 1 control plane node and 2 workers (necessary for conformance) +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +networking: + ipFamily: ${IP_FAMILY:-ipv4} + kubeProxyMode: ${KUBE_PROXY_MODE:-iptables} + # don't pass through host search paths + # TODO: possibly a reasonable default in the future for kind ... + dnsSearch: [] +nodes: +- role: control-plane +- role: worker +- role: worker +featureGates: ${feature_gates} +runtimeConfig: ${runtime_config} +kubeadmConfigPatches: +# v1beta4 for the future (v1.35.0+ ?) +# https://github.com/kubernetes-sigs/kind/issues/3847 +# TODO: drop v1beta3 when we no longer need versions that use it +- | + kind: ClusterConfiguration + apiVersion: kubeadm.k8s.io/v1beta4 + apiServer: + extraArgs: + - name: "v" + value: "${KIND_CLUSTER_LOG_LEVEL}" + controllerManager: + extraArgs: + - name: "v" + value: "${KIND_CLUSTER_LOG_LEVEL}" + scheduler: + extraArgs: + - name: "v" + value: "${KIND_CLUSTER_LOG_LEVEL}" + --- + kind: InitConfiguration + apiVersion: kubeadm.k8s.io/v1beta4 + nodeRegistration: + kubeletExtraArgs: + - name: "v" + value: "${KIND_CLUSTER_LOG_LEVEL}" + - name: "container-log-max-files" + value: "10" + - name: "container-log-max-size" + value: "100Mi" + --- + kind: JoinConfiguration + apiVersion: kubeadm.k8s.io/v1beta4 + nodeRegistration: + kubeletExtraArgs: + - name: "v" + value: "${KIND_CLUSTER_LOG_LEVEL}" + # Warning: these flags appear to be load bearing / impact performance + # See: https://github.com/kubernetes-sigs/kind/pull/4046 + # Be careful when updating these. + # Most CI jobs should not need them, but some CI jobs might. + - name: "container-log-max-files" + value: "10" + - name: "container-log-max-size" + value: "100Mi" +# v1beta3 for v1.23.0 ... ? +- | + kind: ClusterConfiguration + apiVersion: kubeadm.k8s.io/v1beta3 + apiServer: + extraArgs: + "v": "${KIND_CLUSTER_LOG_LEVEL}" + controllerManager: + extraArgs: + "v": "${KIND_CLUSTER_LOG_LEVEL}" + scheduler: + extraArgs: + "v": "${KIND_CLUSTER_LOG_LEVEL}" + --- + kind: InitConfiguration + apiVersion: kubeadm.k8s.io/v1beta3 + nodeRegistration: + kubeletExtraArgs: + "v": "${KIND_CLUSTER_LOG_LEVEL}" + "container-log-max-files": "10" + "container-log-max-size": "100Mi" + --- + kind: JoinConfiguration + apiVersion: kubeadm.k8s.io/v1beta3 + nodeRegistration: + kubeletExtraArgs: + "v": "${KIND_CLUSTER_LOG_LEVEL}" + # Warning: these flags appear to be load bearing / impact performance + # See: https://github.com/kubernetes-sigs/kind/pull/4046 + # Be careful when updating these. + # Most CI jobs should not need them, but some CI jobs might. + "container-log-max-files": "10" + "container-log-max-size": "100Mi" +EOF + # NOTE: must match the number of workers above + NUM_NODES=2 + # actually create the cluster + # TODO(BenTheElder): settle on verbosity for this script + KIND_CREATE_ATTEMPTED=true + kind create cluster \ + --image=kindest/node:latest \ + --retain \ + --wait=1m \ + -v=3 \ + "--config=${ARTIFACTS}/kind-config.yaml" + + # debug cluster version + kubectl version + + # Patch kube-proxy to set the verbosity level + kubectl patch -n kube-system daemonset/kube-proxy \ + --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/command/-", "value": "--v='"${KIND_CLUSTER_LOG_LEVEL}"'" }]' +} + +# run e2es with ginkgo-e2e.sh +run_tests() { + # IPv6 clusters need some CoreDNS changes in order to work in k8s CI: + # 1. k8s CI doesn´t offer IPv6 connectivity, so CoreDNS should be configured + # to work in an offline environment: + # https://github.com/coredns/coredns/issues/2494#issuecomment-457215452 + # 2. k8s CI adds following domains to resolv.conf search field: + # c.k8s-prow-builds.internal google.internal. + # CoreDNS should handle those domains and answer with NXDOMAIN instead of SERVFAIL + # otherwise pods stops trying to resolve the domain. + if [ "${IP_FAMILY:-ipv4}" = "ipv6" ]; then + # Get the current config + original_coredns=$(kubectl get -oyaml -n=kube-system configmap/coredns) + echo "Original CoreDNS config:" + echo "${original_coredns}" + # Patch it + fixed_coredns=$( + printf '%s' "${original_coredns}" | sed \ + -e 's/^.*kubernetes cluster\.local/& internal/' \ + -e '/^.*upstream$/d' \ + -e '/^.*fallthrough.*$/d' \ + -e '/^.*forward . \/etc\/resolv.conf$/d' \ + -e '/^.*loop$/d' \ + ) + echo "Patched CoreDNS config:" + echo "${fixed_coredns}" + printf '%s' "${fixed_coredns}" | kubectl apply -f - + fi + + # ginkgo regexes and label filter + SKIP="${SKIP:-}" + LABEL_FILTER="${LABEL_FILTER:-}" + # Only default to Conformance if FOCUS was not explicitly set. + # This allows FOCUS="" to run all tests (no focus filter). + if [ "${FOCUS+set}" != "set" ]; then + if [ -z "${LABEL_FILTER}" ]; then + FOCUS="\\[Conformance\\]" + else + FOCUS="" + fi + fi + # if we set PARALLEL=true, skip serial tests set --ginkgo-parallel + if [ "${PARALLEL:-false}" = "true" ]; then + export GINKGO_PARALLEL=y + if [ -z "${SKIP}" ]; then + SKIP="\\[Serial\\]" + else + SKIP="\\[Serial\\]|${SKIP}" + fi + fi + + # setting this env prevents ginkgo e2e from trying to run provider setup + export KUBERNETES_CONFORMANCE_TEST='y' + # setting these is required to make RuntimeClass tests work ... :/ + export KUBE_CONTAINER_RUNTIME=remote + export KUBE_CONTAINER_RUNTIME_ENDPOINT=unix:///run/containerd/containerd.sock + export KUBE_CONTAINER_RUNTIME_NAME=containerd + export SNAPSHOTTER_VERSION="${SNAPSHOTTER_VERSION:-v8.4.0}" + echo "SNAPSHOTTER_VERSION is $SNAPSHOTTER_VERSION" + + # Enable SnapshotMetadata tests in csi-driver-hostpath + export CSI_PROW_ENABLE_SNAPSHOT_METADATA=true + + # Install snapshot CRDs + kubectl apply -f ./cluster/addons/volumesnapshots/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml || exit 1 + kubectl apply -f ./cluster/addons/volumesnapshots/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml || exit 1 + kubectl apply -f ./cluster/addons/volumesnapshots/crd/snapshot.storage.k8s.io_volumesnapshots.yaml || exit 1 + + # Install SnapshotMetadataService CRD + kubectl apply -f test/e2e/testing-manifests/storage-csi/external-snapshot-metadata/cbt.storage.k8s.io_snapshotmetadataservices.yaml || exit 1 + + # Deploy snapshot controller + kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/refs/tags/"${SNAPSHOTTER_VERSION}"/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml || exit 1 + kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/refs/tags/"${SNAPSHOTTER_VERSION}"/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml || exit 1 + + ./hack/ginkgo-e2e.sh \ + '--provider=skeleton' "--num-nodes=${NUM_NODES}" \ + "--ginkgo.focus=${FOCUS}" "--ginkgo.skip=${SKIP}" "--ginkgo.label-filter=${LABEL_FILTER}" \ + "--report-dir=${ARTIFACTS}" '--disable-log-dump=true' & + GINKGO_PID=$! + wait "$GINKGO_PID" +} + +main() { + # create temp dir and setup cleanup + TMP_DIR=$(mktemp -d) + + # ensure artifacts (results) directory exists when not in CI + export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}" + mkdir -p "${ARTIFACTS}" + + # export the KUBECONFIG to a unique path for testing + KUBECONFIG="${HOME}/.kube/kind-test-config" + export KUBECONFIG + echo "exported KUBECONFIG=${KUBECONFIG}" + + # debug kind version + kind version + + # build kubernetes + build + # in CI attempt to release some memory after building + if [ -n "${KUBETEST_IN_DOCKER:-}" ]; then + sync || true + echo 1 > /proc/sys/vm/drop_caches || true + fi + + # create the cluster and run tests + res=0 + create_cluster || res=$? + run_tests || res=$? + cleanup || res=$? + exit $res +} + +main diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshotter/volume-group-snapshots/csi-hostpath-plugin.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshotter/volume-group-snapshots/csi-hostpath-plugin.yaml index 9f79eb4da3..4a50349cd4 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshotter/volume-group-snapshots/csi-hostpath-plugin.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/external-snapshotter/volume-group-snapshots/csi-hostpath-plugin.yaml @@ -219,7 +219,7 @@ spec: serviceAccountName: csi-hostpathplugin-sa containers: - name: hostpath - image: registry.k8s.io/sig-storage/hostpathplugin:v1.16.1 + image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.1 args: - "--drivername=hostpath.csi.k8s.io" - "--v=5" @@ -262,7 +262,7 @@ spec: name: dev-dir - name: csi-external-health-monitor-controller - image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.12.1 + image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.17.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -276,7 +276,7 @@ spec: mountPath: /csi - name: node-driver-registrar - image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.15.0 + image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.16.0 args: - --v=5 - --csi-address=/csi/csi.sock @@ -304,13 +304,13 @@ spec: volumeMounts: - mountPath: /csi name: socket-dir - image: registry.k8s.io/sig-storage/livenessprobe:v2.17.0 + image: registry.k8s.io/sig-storage/livenessprobe:v2.18.0 args: - --csi-address=/csi/csi.sock - --health-port=9898 - name: csi-attacher - image: registry.k8s.io/sig-storage/csi-attacher:v4.10.0 + image: registry.k8s.io/sig-storage/csi-attacher:v4.11.0 args: - --v=5 - --csi-address=/csi/csi.sock @@ -324,7 +324,7 @@ spec: name: socket-dir - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v5.3.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v6.1.1 args: - -v=5 - --csi-address=/csi/csi.sock @@ -340,7 +340,7 @@ spec: name: socket-dir - name: csi-resizer - image: registry.k8s.io/sig-storage/csi-resizer:v1.14.0 + image: registry.k8s.io/sig-storage/csi-resizer:v2.1.0 args: - -v=5 - -csi-address=/csi/csi.sock @@ -354,7 +354,7 @@ spec: name: socket-dir - name: csi-snapshotter - image: registry.k8s.io/sig-storage/csi-snapshotter:v8.4.0 + image: registry.k8s.io/sig-storage/csi-snapshotter:v8.5.0 args: - -v=5 - --csi-address=/csi/csi.sock diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml index ed77430bf0..9f7809b08b 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/controller_ss.yaml @@ -21,7 +21,7 @@ spec: serviceAccountName: csi-gce-pd-controller-sa containers: - name: csi-snapshotter - image: registry.k8s.io/sig-storage/csi-snapshotter:v8.3.0 + image: registry.k8s.io/sig-storage/csi-snapshotter:v8.5.0 args: - "--v=5" - "--csi-address=/csi/csi.sock" @@ -39,7 +39,7 @@ spec: - name: socket-dir mountPath: /csi - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v5.1.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v5.2.0 args: - "--v=5" - "--csi-address=/csi/csi.sock" @@ -73,7 +73,7 @@ spec: - name: socket-dir mountPath: /csi - name: csi-attacher - image: registry.k8s.io/sig-storage/csi-attacher:v4.8.0 + image: registry.k8s.io/sig-storage/csi-attacher:v4.8.1 args: - "--v=5" - "--csi-address=/csi/csi.sock" diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/node_ds.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/node_ds.yaml index 30a82723ab..99d9f9ce2a 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/node_ds.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/gce-pd/node_ds.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: csi-driver-registrar - image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.13.0 + image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.16.0 args: - "--v=5" - "--csi-address=/csi/csi.sock" diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml index 080fe5cb01..2fe67ffb71 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-plugin.yaml @@ -237,7 +237,7 @@ spec: serviceAccountName: csi-hostpathplugin-sa containers: - name: hostpath - image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.0 + image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.1 args: - "--drivername=hostpath.csi.k8s.io" - "--v=5" @@ -281,7 +281,7 @@ spec: name: dev-dir - name: csi-external-health-monitor-controller - image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.16.0 + image: registry.k8s.io/sig-storage/csi-external-health-monitor-controller:v0.17.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" @@ -295,7 +295,7 @@ spec: mountPath: /csi - name: node-driver-registrar - image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.15.0 + image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.16.0 args: - --v=5 - --csi-address=/csi/csi.sock @@ -323,13 +323,13 @@ spec: volumeMounts: - mountPath: /csi name: socket-dir - image: registry.k8s.io/sig-storage/livenessprobe:v2.17.0 + image: registry.k8s.io/sig-storage/livenessprobe:v2.18.0 args: - --csi-address=/csi/csi.sock - --health-port=9898 - name: csi-attacher - image: registry.k8s.io/sig-storage/csi-attacher:v4.10.0 + image: registry.k8s.io/sig-storage/csi-attacher:v4.11.0 args: - --v=5 - --csi-address=/csi/csi.sock @@ -343,7 +343,7 @@ spec: name: socket-dir - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v6.0.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v6.1.1 args: - -v=5 - --csi-address=/csi/csi.sock @@ -359,7 +359,7 @@ spec: name: socket-dir - name: csi-resizer - image: registry.k8s.io/sig-storage/csi-resizer:v2.0.0 + image: registry.k8s.io/sig-storage/csi-resizer:v2.1.0 args: - -v=5 - -csi-address=/csi/csi.sock @@ -373,7 +373,7 @@ spec: name: socket-dir - name: csi-snapshotter - image: registry.k8s.io/sig-storage/csi-snapshotter:v8.4.0 + image: registry.k8s.io/sig-storage/csi-snapshotter:v8.5.0 args: - -v=5 - --csi-address=/csi/csi.sock @@ -386,6 +386,23 @@ spec: - mountPath: /csi name: socket-dir + - name: csi-snapshot-metadata + image: registry.k8s.io/sig-storage/csi-snapshot-metadata:v0.2.0 + imagePullPolicy: IfNotPresent + args: + - --csi-address=/csi/csi.sock + - --tls-cert=/tmp/certificates/tls.crt + - --tls-key=/tmp/certificates/tls.key + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /csi + name: socket-dir + - mountPath: /tmp/certificates + name: csi-snapshot-metadata-server-certs + readOnly: true + # end csi containers volumes: @@ -415,4 +432,8 @@ spec: path: /dev type: Directory name: dev-dir + - name: csi-snapshot-metadata-server-certs + secret: + defaultMode: 420 + secretName: csi-snapshot-metadata-server-certs # end csi volumes diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-testing.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-testing.yaml index 19c9888eec..1a9d12c7ad 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-testing.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/hostpath/hostpath/csi-hostpath-testing.yaml @@ -66,7 +66,7 @@ spec: topologyKey: kubernetes.io/hostname containers: - name: socat - image: registry.k8s.io/sig-storage/hostpathplugin:v1.15.0 + image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.1 command: - socat args: diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-attacher.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-attacher.yaml index f2f7850f08..40a2a58587 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-attacher.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-attacher.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: csi-mock containers: - name: csi-attacher - image: registry.k8s.io/sig-storage/csi-attacher:v4.10.0 + image: registry.k8s.io/sig-storage/csi-attacher:v4.11.0 args: - --v=5 - --csi-address=$(ADDRESS) diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-resizer.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-resizer.yaml index 0133796e72..7415c5eade 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-resizer.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-resizer.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: csi-mock containers: - name: csi-resizer - image: registry.k8s.io/sig-storage/csi-resizer:v2.0.0 + image: registry.k8s.io/sig-storage/csi-resizer:v2.1.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-snapshotter.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-snapshotter.yaml index 15c4bb5230..130721db8d 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-snapshotter.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver-snapshotter.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: csi-mock containers: - name: csi-snapshotter - image: registry.k8s.io/sig-storage/csi-snapshotter:v8.4.0 + image: registry.k8s.io/sig-storage/csi-snapshotter:v8.5.0 args: - "--v=5" - "--csi-address=$(ADDRESS)" diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml index fbac7b5fb3..5f85ae7422 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-driver.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: csi-mock containers: - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v6.0.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v6.1.1 args: - "--csi-address=$(ADDRESS)" # Topology support is needed for the pod rescheduling test @@ -34,7 +34,7 @@ spec: - mountPath: /csi name: socket-dir - name: driver-registrar - image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.15.0 + image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.16.0 args: - --v=5 - --csi-address=/csi/csi.sock @@ -53,7 +53,7 @@ spec: - mountPath: /registration name: registration-dir - name: mock - image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.0 + image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.1 args: - "--drivername=mock.storage.k8s.io" - "--nodeid=$(KUBE_NODE_NAME)" diff --git a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml index 0530c9a472..956adbf70a 100644 --- a/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml +++ b/vendor/k8s.io/kubernetes/test/e2e/testing-manifests/storage-csi/mock/csi-mock-proxy.yaml @@ -15,7 +15,7 @@ spec: serviceAccountName: csi-mock containers: - name: csi-provisioner - image: registry.k8s.io/sig-storage/csi-provisioner:v6.0.0 + image: registry.k8s.io/sig-storage/csi-provisioner:v6.1.1 args: - "--csi-address=$(ADDRESS)" # Topology support is needed for the pod rescheduling test @@ -35,7 +35,7 @@ spec: - mountPath: /csi name: socket-dir - name: driver-registrar - image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.15.0 + image: registry.k8s.io/sig-storage/csi-node-driver-registrar:v2.16.0 args: - --v=5 - --csi-address=/csi/csi.sock @@ -53,7 +53,7 @@ spec: - mountPath: /registration name: registration-dir - name: mock - image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.0 + image: registry.k8s.io/sig-storage/hostpathplugin:v1.17.1 args: - -v=5 - -nodeid=$(KUBE_NODE_NAME) diff --git a/vendor/k8s.io/kubernetes/test/utils/audit.go b/vendor/k8s.io/kubernetes/test/utils/audit.go index cc5bf1338a..11264b3706 100644 --- a/vendor/k8s.io/kubernetes/test/utils/audit.go +++ b/vendor/k8s.io/kubernetes/test/utils/audit.go @@ -34,20 +34,23 @@ import ( // AuditEvent is a simplified representation of an audit event for testing purposes type AuditEvent struct { - ID types.UID - Level auditinternal.Level - Stage auditinternal.Stage - RequestURI string - Verb string - Code int32 - User string - ImpersonatedUser string - ImpersonatedGroups string - Resource string - Namespace string - RequestObject bool - ResponseObject bool - AuthorizeDecision string + ID types.UID + Level auditinternal.Level + Stage auditinternal.Stage + RequestURI string + Verb string + Code int32 + StatusMessage string + User string + ImpersonatedUser string + ImpersonatedUID string + ImpersonatedGroups string + ImpersonationConstraint *string + Resource string + Namespace string + RequestObject bool + ResponseObject bool + AuthorizeDecision string // The Check functions in this package takes ownerships of these maps. You should // not reference these maps after calling the Check functions. @@ -147,6 +150,7 @@ func testEventFromInternalFiltered(e *auditinternal.Event, customAnnotationsFilt } if e.ResponseStatus != nil { event.Code = e.ResponseStatus.Code + event.StatusMessage = e.ResponseStatus.Message } if e.ResponseObject != nil { event.ResponseObject = true @@ -156,9 +160,13 @@ func testEventFromInternalFiltered(e *auditinternal.Event, customAnnotationsFilt } if e.ImpersonatedUser != nil { event.ImpersonatedUser = e.ImpersonatedUser.Username + event.ImpersonatedUID = e.ImpersonatedUser.UID sort.Strings(e.ImpersonatedUser.Groups) event.ImpersonatedGroups = strings.Join(e.ImpersonatedUser.Groups, ",") } + if e.AuthenticationMetadata != nil { + event.ImpersonationConstraint = &e.AuthenticationMetadata.ImpersonationConstraint + } event.AuthorizeDecision = e.Annotations["authorization.k8s.io/decision"] for k, v := range e.Annotations { if strings.HasPrefix(k, mutating.PatchAuditAnnotationPrefix) { diff --git a/vendor/k8s.io/kubernetes/test/utils/density_utils.go b/vendor/k8s.io/kubernetes/test/utils/density_utils.go index e0747c4894..f0ed2149c9 100644 --- a/vendor/k8s.io/kubernetes/test/utils/density_utils.go +++ b/vendor/k8s.io/kubernetes/test/utils/density_utils.go @@ -43,7 +43,7 @@ func AddLabelsToNode(c clientset.Interface, nodeName string, labels map[string]s labelString := "{" + strings.Join(tokens, ",") + "}" patch := fmt.Sprintf(`{"metadata":{"labels":%v}}`, labelString) var err error - for attempt := 0; attempt < retries; attempt++ { + for range retries { _, err = c.CoreV1().Nodes().Patch(context.TODO(), nodeName, types.MergePatchType, []byte(patch), metav1.PatchOptions{}) if err != nil { if !apierrors.IsConflict(err) { @@ -62,7 +62,7 @@ func AddLabelsToNode(c clientset.Interface, nodeName string, labels map[string]s func RemoveLabelOffNode(c clientset.Interface, nodeName string, labelKeys []string) error { var node *v1.Node var err error - for attempt := 0; attempt < retries; attempt++ { + for range retries { node, err = c.CoreV1().Nodes().Get(context.TODO(), nodeName, metav1.GetOptions{}) if err != nil { return err diff --git a/vendor/k8s.io/kubernetes/test/utils/deployment.go b/vendor/k8s.io/kubernetes/test/utils/deployment.go index eaa618a6ce..04e787d5de 100644 --- a/vendor/k8s.io/kubernetes/test/utils/deployment.go +++ b/vendor/k8s.io/kubernetes/test/utils/deployment.go @@ -25,12 +25,12 @@ import ( apps "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/dump" "k8s.io/apimachinery/pkg/util/wait" clientset "k8s.io/client-go/kubernetes" podutil "k8s.io/kubernetes/pkg/api/v1/pod" deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util" labelsutil "k8s.io/kubernetes/pkg/util/labels" + "k8s.io/utils/dump" ) type LogfFn func(format string, args ...interface{}) diff --git a/vendor/k8s.io/kubernetes/test/utils/image/manifest.go b/vendor/k8s.io/kubernetes/test/utils/image/manifest.go index f2c4e5e181..9fc4056b5a 100644 --- a/vendor/k8s.io/kubernetes/test/utils/image/manifest.go +++ b/vendor/k8s.io/kubernetes/test/utils/image/manifest.go @@ -169,8 +169,8 @@ const ( InvalidRegistryImage // IpcUtils image IpcUtils - // JessieDnsutils image - JessieDnsutils + // GlibcDnsTesting image (formerly JessieDnsutils) + GlibcDnsTesting // Kitten image Kitten // Nautilus image @@ -185,8 +185,8 @@ const ( NodePerfNpbEp // NodePerfNpbIs image NodePerfNpbIs - // NodePerfTfWideDeep image - NodePerfTfWideDeep + // NodePerfPytorchWideDeep image + NodePerfPytorchWideDeep // Nonewprivs image Nonewprivs // NonRoot runs with a default user of 1234 @@ -209,33 +209,33 @@ const ( func initImageConfigs(list RegistryList) (map[ImageID]Config, map[ImageID]Config) { configs := map[ImageID]Config{} configs[AgnhostPrev] = Config{list.PromoterE2eRegistry, "agnhost", "2.55"} - configs[Agnhost] = Config{list.PromoterE2eRegistry, "agnhost", "2.59"} + configs[Agnhost] = Config{list.PromoterE2eRegistry, "agnhost", "2.63.0"} configs[AgnhostPrivate] = Config{list.PrivateRegistry, "agnhost", "2.6"} configs[APIServer] = Config{list.PromoterE2eRegistry, "sample-apiserver", "1.29.2"} configs[AppArmorLoader] = Config{list.PromoterE2eRegistry, "apparmor-loader", "1.4"} configs[BusyBox] = Config{list.PromoterE2eRegistry, "busybox", "1.37.0-1"} - configs[DistrolessIptables] = Config{list.BuildImageRegistry, "distroless-iptables", "v0.8.7"} - configs[Etcd] = Config{list.GcEtcdRegistry, "etcd", "3.6.6-0"} + configs[DistrolessIptables] = Config{list.BuildImageRegistry, "distroless-iptables", "v0.9.1"} + configs[Etcd] = Config{list.GcEtcdRegistry, "etcd", "3.6.8-0"} configs[InvalidRegistryImage] = Config{list.InvalidRegistry, "alpine", "3.1"} - configs[IpcUtils] = Config{list.PromoterE2eRegistry, "ipc-utils", "1.3"} - configs[JessieDnsutils] = Config{list.PromoterE2eRegistry, "jessie-dnsutils", "1.7"} - configs[Kitten] = Config{list.PromoterE2eRegistry, "kitten", "1.7"} - configs[Nautilus] = Config{list.PromoterE2eRegistry, "nautilus", "1.7"} + configs[IpcUtils] = Config{list.PromoterE2eRegistry, "ipc-utils", "1.4"} + configs[GlibcDnsTesting] = Config{list.PromoterE2eRegistry, "glibc-dns-testing", "2.0.0"} + configs[Kitten] = Config{list.PromoterE2eRegistry, "kitten", "1.8"} + configs[Nautilus] = Config{list.PromoterE2eRegistry, "nautilus", "1.8"} configs[NFSProvisioner] = Config{list.SigStorageRegistry, "nfs-provisioner", "v4.0.8"} - configs[Nginx] = Config{list.PromoterE2eRegistry, "nginx", "1.14-4"} - configs[NginxNew] = Config{list.PromoterE2eRegistry, "nginx", "1.15-4"} - configs[NodePerfNpbEp] = Config{list.PromoterE2eRegistry, "node-perf/npb-ep", "1.2"} - configs[NodePerfNpbIs] = Config{list.PromoterE2eRegistry, "node-perf/npb-is", "1.2"} - configs[NodePerfTfWideDeep] = Config{list.PromoterE2eRegistry, "node-perf/tf-wide-deep", "1.3"} - configs[Nonewprivs] = Config{list.PromoterE2eRegistry, "nonewprivs", "1.3"} - configs[NonRoot] = Config{list.PromoterE2eRegistry, "nonroot", "1.4"} + configs[Nginx] = Config{list.PromoterE2eRegistry, "nginx", "1.15-4"} + configs[NginxNew] = Config{list.PromoterE2eRegistry, "nginx", "1.27-0"} + configs[NodePerfNpbEp] = Config{list.PromoterE2eRegistry, "node-perf/npb-ep", "1.6.0"} + configs[NodePerfNpbIs] = Config{list.PromoterE2eRegistry, "node-perf/npb-is", "1.7.0"} + configs[NodePerfPytorchWideDeep] = Config{list.PromoterE2eRegistry, "node-perf/pytorch-wide-deep", "1.0.0"} + configs[Nonewprivs] = Config{list.PromoterE2eRegistry, "nonewprivs", "1.4"} + configs[NonRoot] = Config{list.PromoterE2eRegistry, "nonroot", "1.5"} // Pause - when these values are updated, also update cmd/kubelet/app/options/container_runtime.go - configs[Pause] = Config{list.GcRegistry, "pause", "3.10.1"} + configs[Pause] = Config{list.GcRegistry, "pause", "3.10.2"} configs[Perl] = Config{list.PromoterE2eRegistry, "perl", "5.26"} configs[RegressionIssue74839] = Config{list.PromoterE2eRegistry, "regression-issue-74839", "1.4"} - configs[ResourceConsumer] = Config{list.PromoterE2eRegistry, "resource-consumer", "1.13"} - configs[VolumeNFSServer] = Config{list.PromoterE2eRegistry, "volume/nfs", "1.4"} - configs[VolumeISCSIServer] = Config{list.PromoterE2eRegistry, "volume/iscsi", "2.6"} + configs[ResourceConsumer] = Config{list.PromoterE2eRegistry, "resource-consumer", "1.14"} + configs[VolumeNFSServer] = Config{list.PromoterE2eRegistry, "volume/nfs", "1.6.0"} + configs[VolumeISCSIServer] = Config{list.PromoterE2eRegistry, "volume/iscsi", "2.7"} // This adds more config entries. Those have no pre-defined ImageID number, // but will be used via ReplaceRegistryInImageURL when deploying diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/assert.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/assert.go new file mode 100644 index 0000000000..02b35aa455 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/assert.go @@ -0,0 +1,349 @@ +/* +Copyright 2024 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. +*/ + +package ktesting + +import ( + "context" + "errors" + "fmt" + "reflect" + + "github.com/onsi/gomega" + "github.com/onsi/gomega/format" + gtypes "github.com/onsi/gomega/types" +) + +// FailureError is an error where the error string is meant to be passed to +// [TContext.Fatal] directly, i.e. adding some prefix like "unexpected error" is not +// necessary. It is also not necessary to dump the error struct. +type FailureError struct { + Msg string + FullStackTrace string +} + +func (f FailureError) Error() string { + return f.Msg +} + +func (f FailureError) Backtrace() string { + return f.FullStackTrace +} + +func (f FailureError) Is(target error) bool { + return target == ErrFailure +} + +// ErrFailure is an empty error that can be wrapped to indicate that an error +// is a FailureError. It can also be used to test for a FailureError:. +// +// return fmt.Errorf("some problem%w", ErrFailure) +// ... +// err := someOperation() +// if errors.Is(err, ErrFailure) { +// ... +// } +var ErrFailure error = FailureError{} + +func gomegaAssertion(tCtx TContext, fatal bool, actual interface{}, extra ...interface{}) gomega.Assertion { + testingT := gtypes.GomegaTestingT(tCtx) + if !fatal { + testingT = assertTestingT{tCtx} + } + return gomega.NewWithT(testingT).Expect(actual, extra...) +} + +// assertTestingT implements Fatalf (the only function used by Gomega for +// reporting failures) using TContext.Errorf, i.e. testing continues after a +// failed assertion. The Helper method gets passed through. +type assertTestingT struct { + TContext +} + +var _ gtypes.GomegaTestingT = assertTestingT{} + +func (a assertTestingT) Fatalf(format string, args ...any) { + a.Helper() + a.Errorf(format, args...) +} + +// ExpectNoError asserts that no error has occurred and fails the test if it does. +// +// As in [gomega], the optional explanation can be: +// - a [fmt.Sprintf] format string plus its arguments +// - a function returning a string, which will be called +// lazily to construct the explanation if needed +// +// If an explanation is provided, then it replaces the default "Unexpected +// error" in the failure message. It's combined with additional details by +// adding a colon at the end, as when wrapping an error. Therefore it should +// not end with a punctuation mark or line break. +// +// Using ExpectNoError instead of the corresponding Gomega or testify +// assertions has the advantage that the failure message is short (good for +// aggregation in https://go.k8s.io/triage) with more details captured in the +// test log output (good when investigating one particular failure). +// +// Helper packages should return errors that are derived from [FailureError]. +// The test code then is forced to check for that error by the normal +// linter and should provide additional context for the failure, just +// as it would when printing or wrapping an error: +// +// tCtx.ExpectNoError(somehelper.CreateSomething(tCtx, ...), "creating the first foobar") +// tCtx.ExpectNoError(somehelper.CreateSomething(tCtx, ...), "creating the second foobar") +func (tCtx TContext) ExpectNoError(err error, explain ...interface{}) { + tCtx.Helper() + tCtx.noError(tCtx.Fatalf, err, explain...) +} + +// AssertNoError is a variant of ExpectNoError which reports an unexpected +// error without aborting the test. It returns true if there was no error. +func (tCtx TContext) AssertNoError(err error, explain ...interface{}) bool { + tCtx.Helper() + return tCtx.noError(tCtx.Errorf, err, explain...) +} + +func (tCtx TContext) noError(failf func(format string, args ...any), err error, explain ...interface{}) bool { + if err == nil { + return true + } + + tCtx.Helper() + description := buildDescription(explain...) + + if errors.Is(err, ErrFailure) { + var failure FailureError + if tCtx.capture == nil && errors.As(err, &failure) { + if backtrace := failure.Backtrace(); backtrace != "" { + if description != "" { + tCtx.Log(description) + } + tCtx.Logf("Failed at:\n%s", backtrace) + } + } + if description != "" { + failf("%s: %s", description, err.Error()) + return false + } + failf("%s", err.Error()) + return false + } + + if description == "" { + description = "Unexpected error" + } + if tCtx.capture == nil { + tCtx.Logf("%s:\n%s", description, format.Object(err, 0)) + } + failf("%s: %v", description, err.Error()) + return false +} + +func buildDescription(explain ...interface{}) string { + switch len(explain) { + case 0: + return "" + case 1: + if describe, ok := explain[0].(func() string); ok { + return describe() + } + } + return fmt.Sprintf(explain[0].(string), explain[1:]...) +} + +// Eventually wraps [gomega.Eventually]. Supported argument types are: +// - A function with a `tCtx ktesting.TContext` or `ctx context.Context` +// parameter plus additional parameters and arbitrary return values. +// - A value which changes over time, usually a channel. +// +// For functions, the context is provided by Eventually. Additional parameters +// must be passed via WithParameters. The first return value is passed to the Gomega +// matcher, all others (in particular an additional error) must be null. +// As a special case, a function with `tCtx ktesting.TContext` and no return +// values can be combined with gomega.Succeed as matcher. +// +// In contrast to direct usage of [gomega.Eventually], making additional +// assertions inside the callback function is okay in all cases as long as they +// use the TContext that is passed in. An assertion failure is considered +// temporary, so Eventually will continue to poll. This can be used to check a +// value with multiple assertions instead of writing a custom matcher: +// +// cb := func(tCtx ktesting.TContext) { +// value, err := doSomething(...) +// tCtx.ExpectNoError(err, "something failed") +// tCtx.Assert(value.a).To(gomega.Equal(42), "the answer") +// tCtx.Assert(value.b).To(gomega.Equal("the fish"), "thanks") +// } +// tCtx.Eventually(cb).Should(gomega.Succeed()) +// +// The test stops in case of a failure. To continue, use AssertEventually. +// +// The default Gomega poll interval and timeout are used. Setting a specific +// timeout may be useful: +// +// tCtx.Eventually(cb).Timeout(5 * time.Second).Should(gomega.Succeed(), "foobar should succeed") +// +// Canceling the context in the callback only affects code in the callback. The +// context passed to Eventually is not getting canceled. To abort polling +// immediately because the expected condition is known to not be reached +// anymore, use [gomega.StopTrying]: +// +// cb := func(func(tCtx ktesting.TContext) int { +// value, err := doSomething(...) +// if errors.Is(err, SomeFinalErr) { +// // This message completely replaces the normal +// // failure message and thus should include all +// // relevant information. +// // +// // github.com/onsi/gomega/format is a good way +// // to format arbitrary data. It uses indention +// // and falls back to YAML for Kubernetes API +// // structs for readability. +// gomega.StopTrying("permanent failure, last value:\n%s", format.Object(value, 1 /* indent one level */)). +// Wrap(err).Now() +// } +// tCtx.ExpectNoError(err, "something failed") +// return value +// } +// tCtx.Eventually(cb).Should(gomega.Equal(42), "should be the answer to everything") +// +// To poll again after some specific timeout, use [gomega.TryAgainAfter]. This is +// particularly useful in [Consistently] to ignore some intermittent error. +// +// cb := func(func(tCtx ktesting.TContext) int { +// value, err := doSomething(...) +// var intermittentErr SomeIntermittentError +// if errors.As(err, &intermittentErr) { +// gomega.TryAgainAfter(intermittentErr.RetryPeriod).Wrap(err).Now() +// } +// tCtx.ExpectNoError(err, "something failed") +// return value +// } +// tCtx.Eventually(cb).Should(gomega.Equal(42), "should be the answer to everything") +func (tCtx TContext) Eventually(arg any) gomega.AsyncAssertion { + tCtx.Helper() + return tCtx.newAsyncAssertion(gomega.NewWithT(tCtx).Eventually, arg) +} + +// AssertEventually is a variant of Eventually which merely records a failure +// without stopping the test. +func (tCtx TContext) AssertEventually(arg any) gomega.AsyncAssertion { + tCtx.Helper() + return tCtx.newAsyncAssertion(gomega.NewWithT(assertTestingT{tCtx}).Eventually, arg) +} + +// Consistently wraps [gomega.Consistently] the same way as [Eventually] wraps +// [gomega.Eventually]. +func (tCtx TContext) Consistently(arg any) gomega.AsyncAssertion { + tCtx.Helper() + return tCtx.newAsyncAssertion(gomega.NewWithT(tCtx).Consistently, arg) +} + +// AssertConsistently is a variant of Consistently which merely records a failure +// without stopping the test. +func (tCtx TContext) AssertConsistently(arg any) gomega.AsyncAssertion { + tCtx.Helper() + return tCtx.newAsyncAssertion(gomega.NewWithT(assertTestingT{tCtx}).Consistently, arg) +} + +func (tCtx TContext) newAsyncAssertion(eventuallyOrConsistently func(actualOrCtx any, args ...any) gomega.AsyncAssertion, arg any) gomega.AsyncAssertion { + tCtx.Helper() + // switch arg := arg.(type) { + // case func(tCtx TContext): + // // Tricky to handle via reflect, so let's cover this directly... + // return eventuallyOrConsistently(tCtx, func(g gomega.Gomega, ctx context.Context) (err error) { + // tCtx := WithContext(tCtx, ctx) + // tCtx, finalize := WithError(tCtx, &err) + // defer finalize() + // arg(tCtx) + // }) + // default: + v := reflect.ValueOf(arg) + if v.Kind() != reflect.Func { + // Gomega must deal with it. + return eventuallyOrConsistently(tCtx, arg) + } + t := v.Type() + if t.NumIn() == 0 || t.In(0) != tContextType { + // Not a function we can wrap. + return eventuallyOrConsistently(tCtx, arg) + } + // Build a wrapper function with context instead of TContext as first parameter. + // The wrapper then builds that TContext when called and invokes the actual function. + in := make([]reflect.Type, t.NumIn()) + in[0] = contextType + for i := 1; i < t.NumIn(); i++ { + in[i] = t.In(i) + } + out := make([]reflect.Type, t.NumOut()) + for i := range t.NumOut() { + out[i] = t.Out(i) + } + // The last result must always be an error because we need the ability to return assertion + // failures, so we may have to add an error result value if the function doesn't + // already have it. + addErrResult := t.NumOut() == 0 || t.Out(t.NumOut()-1) != errorType + if addErrResult { + out = append(out, errorType) + } + wrapperType := reflect.FuncOf(in, out, t.IsVariadic()) + wrapper := reflect.MakeFunc(wrapperType, func(args []reflect.Value) (results []reflect.Value) { + var err error + tCtx, finalize := tCtx.WithContext(args[0].Interface().(context.Context)). + WithCancel(). + WithError(&err) + args[0] = reflect.ValueOf(tCtx) + defer func() { + // This runs *after* finalize. + // If we are returning normally, then we must inject back the err + // value that was set by finalize. + if r := recover(); r != nil { + // Nope, no results needed. + panic(r) + } + errValue := reflect.ValueOf(err) + if err == nil { + // reflect doesn't like this ("returned zero Value"). + // We need a value of the right type. + errValue = reflect.New(errorType).Elem() + } + // If the call panicked and the panic was recoved + // by finalize(), then results is still nil. + // We need to fill in null values. + if len(results) == 0 && t.NumOut() > 0 { + for i := range t.NumOut() { + results = append(results, reflect.New(t.Out(i)).Elem()) + } + } + if addErrResult { + results = append(results, errValue) + return + } + if results[len(results)-1].IsNil() && err != nil { + results[len(results)-1] = errValue + } + }() + defer finalize() // Must be called directly, otherwise it cannot recover a panic. + return v.Call(args) + }) + return eventuallyOrConsistently(tCtx, wrapper.Interface()) +} + +var ( + contextType = reflect.TypeFor[context.Context]() + errorType = reflect.TypeFor[error]() + tContextType = reflect.TypeFor[TContext]() +) diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/clientcontext.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/clientcontext.go new file mode 100644 index 0000000000..713821cb32 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/clientcontext.go @@ -0,0 +1,53 @@ +/* +Copyright 2023 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. +*/ + +package ktesting + +import ( + "fmt" + + apiextensions "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + "k8s.io/client-go/discovery/cached/memory" + "k8s.io/client-go/dynamic" + clientset "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/client-go/restmapper" +) + +// WithRESTConfig initializes all client-go clients with new clients +// created for the config. The current test name gets included in the UserAgent. +func (tCtx TContext) WithRESTConfig(cfg *rest.Config) TContext { + cfg = rest.CopyConfig(cfg) + cfg.UserAgent = fmt.Sprintf("%s -- %s", rest.DefaultKubernetesUserAgent(), tCtx.Name()) + + tCtx.restConfig = cfg + tCtx.client = clientset.NewForConfigOrDie(cfg) + tCtx.dynamic = dynamic.NewForConfigOrDie(cfg) + tCtx.apiextensions = apiextensions.NewForConfigOrDie(cfg) + cachedDiscovery := memory.NewMemCacheClient(tCtx.client.Discovery()) + tCtx.restMapper = restmapper.NewDeferredDiscoveryRESTMapper(cachedDiscovery) + return tCtx +} + +// WithClients uses an existing config and clients. +func (tCtx TContext) WithClients(cfg *rest.Config, mapper *restmapper.DeferredDiscoveryRESTMapper, client clientset.Interface, dynamic dynamic.Interface, apiextensions apiextensions.Interface) TContext { + tCtx.restConfig = cfg + tCtx.restMapper = mapper + tCtx.client = client + tCtx.dynamic = dynamic + tCtx.apiextensions = apiextensions + return tCtx +} diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/contexthelper.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/contexthelper.go new file mode 100644 index 0000000000..b6f6263a4a --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/contexthelper.go @@ -0,0 +1,105 @@ +/* +Copyright 2023 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. +*/ + +package ktesting + +import ( + "context" + "fmt" + "time" +) + +// cleanupErr creates a cause when canceling a context because the test has completed. +// It is a context.Canceled error. +func cleanupErr(testName string) error { + return canceledError(fmt.Sprintf("test %s is cleaning up", testName)) +} + +type canceledError string + +func (c canceledError) Error() string { return string(c) } + +func (c canceledError) Is(target error) bool { + return target == context.Canceled +} + +// withTimeout corresponds to [context.WithTimeout]. In contrast to +// [context.WithTimeout], it automatically cancels during test cleanup, provides +// the given cause when the deadline is reached, and its cancel function +// requires a cause. +func withTimeout(ctx context.Context, tb TB, timeout time.Duration, timeoutCause string) (context.Context, func(cause string)) { + tb.Helper() + + now := time.Now() + + cancelCtx, cancel := context.WithCancelCause(ctx) + after := time.NewTimer(timeout) + stopCtx, stop := context.WithCancel(ctx) // Only used internally, doesn't need a cause. + done := make(chan struct{}) + tb.Cleanup(func() { + cancel(cleanupErr(tb.Name())) + stop() + // Wait for goroutine termination. This is important because + // otherwise the goroutine might log through tb *after* the + // test has already finished, which causes a panic. + <-done + }) + go func() { + defer close(done) + select { + case <-stopCtx.Done(): + after.Stop() + // No need to set a cause here. The cause or error of + // the parent context will be used. + case <-after.C: + // Code using this tCtx may or may not log the + // information above when it runs into the + // cancellation. It's better if we do it, just to be on + // the safe side. + // + // Would be nice to log this with the source code location + // of our caller, but testing.Logf does not support that. + tb.Log(fmt.Sprintf("\nINFO: canceling context: %s\n", timeoutCause)) + cancel(canceledError(timeoutCause)) + } + }() + + // Determine which deadline is sooner: ours or that of our parent. + deadline := now.Add(timeout) + if parentDeadline, ok := ctx.Deadline(); ok { + if deadline.After(parentDeadline) { + deadline = parentDeadline + } + } + + // We always have a deadline. + return deadlineContext{Context: cancelCtx, deadline: deadline}, func(cause string) { + var cancelCause error + if cause != "" { + cancelCause = canceledError(cause) + } + cancel(cancelCause) + } +} + +type deadlineContext struct { + context.Context + deadline time.Time +} + +func (d deadlineContext) Deadline() (time.Time, bool) { + return d.deadline, true +} diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/doc.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/doc.go new file mode 100644 index 0000000000..3207f311bc --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/doc.go @@ -0,0 +1,32 @@ +/* +Copyright 2023 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. +*/ + +// Package ktesting is a wrapper around k8s.io/klog/v2/ktesting. In contrast +// to the klog package, this one is opinionated and tailored towards testing +// Kubernetes. +// +// Importing it +// - adds the -v command line flag +// - enables better dumping of complex datatypes +// - sets the default verbosity to 5 (can be changed with [SetDefaultVerbosity]) +// +// It also adds additional APIs and types for unit and integration tests +// which are too experimental for klog and/or are unrelated to logging. +// The ktesting package itself takes care of managing a test context +// with deadlines, timeouts, cancellation, and some common attributes +// as first-class members of the API. Sub-packages have additional APIs +// for propagating values via the context, implemented via [WithValue]. +package ktesting diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/errorcontext.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/errorcontext.go new file mode 100644 index 0000000000..0316b54809 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/errorcontext.go @@ -0,0 +1,245 @@ +/* +Copyright 2024 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. +*/ + +package ktesting + +import ( + "errors" + "fmt" + "strings" +) + +// WithError creates a context where test failures are collected and stored in +// the provided error instance when the caller is done. Use it like this: +// +// func doSomething(tCtx ktesting.TContext) (finalErr error) { +// tCtx, finalize := WithError(tCtx, &finalErr) +// defer finalize() +// ... +// tCtx.Fatal("some failure") +// +// Any error already stored in the variable will get overwritten by finalize if +// there were test failures, otherwise the variable is left unchanged. +// If there were multiple test errors, then the error will wrap all of +// them with errors.Join. +// +// Test failures are not propagated to the parent context. +// WithRESTConfig initializes all client-go clients with new clients +// created for the config. The current test name gets included in the UserAgent. +func (tCtx TContext) WithError(err *error) (TContext, func()) { + tCtx.capture = &capture{} + + return tCtx, func() { + // Recover has to be called in the deferred function. When called inside + // a function called by a deferred function (like finalize below), it + // returns nil. + if e := recover(); e != nil { + if _, ok := e.(fatalWithError); !ok { + // Not our own panic, pass it on instead of setting the error. + panic(e) + } + } + + tCtx.finalize(err) + } +} + +func (tCtx TContext) finalize(err *error) { + tCtx.capture.mutex.Lock() + defer tCtx.capture.mutex.Unlock() + + errs := tCtx.capture.errors + if tCtx.capture.failed && len(errs) == 0 { + errs = []error{errFailedWithNoExplanation} + } + if len(errs) == 0 { + return + } + *err = failures{errors.Join(errs...)} +} + +type failures struct { + error +} + +func (e failures) GomegaString() string { + // We don't need to repeat the string. Errors already get formatted once by Gomega itself, + // then it calls GomegaString for a summary that isn't necessary anymore. + return "" +} + +// buildHeader handles: +// - "ERROR:" -> use both prefix and suffix when we have a header, otherwise just the suffix +// - "" -> use suffix only if we have a header +func (tCtx TContext) buildHeader(prefix, suffix string) string { + if tCtx.perTestHeader != nil { + return prefix + tCtx.perTestHeader() + suffix + } + if prefix != "" { + return suffix + } + return "" +} + +// indent either indents all follow-up lines or all lines including the first one. +func indent(msg string, all bool) string { + header := "" + if all { + header = "\t" + } + return header + strings.ReplaceAll(msg, "\n", "\n\t") +} + +func (tCtx TContext) Skip(args ...any) { + tCtx.Helper() + // Enable `go vet printf` by directly calling fmt.Sprintln. + msg := strings.TrimSpace(fmt.Sprintln(args...)) + tCtx.TB().Skip("SKIP:", tCtx.buildHeader(" ", " ")+tCtx.steps+indent(msg, false)) +} + +func (tCtx TContext) Skipf(format string, args ...any) { + tCtx.Helper() + // Enable `go vet printf` by directly calling fmt.Sprintf. + msg := strings.TrimSpace(fmt.Sprintf(format, args...)) + tCtx.TB().Skip("SKIP:", tCtx.buildHeader(" ", " ")+tCtx.steps+indent(msg, false)) +} + +func (tCtx TContext) Log(args ...any) { + tCtx.Helper() + // Enable `go vet printf` by directly calling fmt.Sprintln. + msg := strings.TrimSpace(fmt.Sprintln(args...)) + tCtx.TB().Log(tCtx.buildHeader("", " ") + tCtx.steps + indent(msg, false)) +} + +func (tCtx TContext) Logf(format string, args ...any) { + tCtx.Helper() + // Enable `go vet printf` by directly calling fmt.Sprintf. + msg := strings.TrimSpace(fmt.Sprintf(format, args...)) + tCtx.TB().Log(tCtx.buildHeader("", " ") + tCtx.steps + indent(msg, false)) +} + +func (tCtx TContext) Error(args ...any) { + if tCtx.capture == nil { + tCtx.Helper() + msg := strings.TrimSpace(fmt.Sprintln(args...)) + // ERROR *before* header to make it stand out as failure. + tCtx.TB().Error("ERROR:" + tCtx.buildHeader(" ", "\n") + indent(tCtx.steps+msg, true)) + return + } + + tCtx.capture.mutex.Lock() + defer tCtx.capture.mutex.Unlock() + + // Gomega adds a leading newline in https://github.com/onsi/gomega/blob/f804ac6ada8d36164ecae0513295de8affce1245/internal/gomega.go#L37 + // Let's strip that at start and end because ktesting will make errors + // stand out more with the "ERROR" prefix, so there's no need for additional + // line breaks. Besides, Sprintln (required for `go vet printf`) also + // adds a trailing newline that we don't want. + msg := strings.TrimSpace(fmt.Sprintln(args...)) + tCtx.capture.errors = append(tCtx.capture.errors, errors.New(tCtx.steps+msg)) + tCtx.capture.failed = true +} + +func (tCtx TContext) Errorf(format string, args ...any) { + if tCtx.capture == nil { + tCtx.Helper() + // Enable `go vet printf` by directly calling fmt.Sprintln. + msg := strings.TrimSpace(fmt.Sprintf(format, args...)) + // ERROR *before* header to make it stand out as failure. + tCtx.TB().Error("ERROR:" + tCtx.buildHeader(" ", "\n") + indent(tCtx.steps+msg, true)) + return + } + + tCtx.capture.mutex.Lock() + defer tCtx.capture.mutex.Unlock() + + msg := strings.TrimSpace(fmt.Sprintf(format, args...)) + tCtx.capture.errors = append(tCtx.capture.errors, errors.New(tCtx.steps+msg)) + tCtx.capture.failed = true +} + +func (tCtx TContext) Fail() { + if tCtx.capture == nil { + tCtx.TB().Fail() + return + } + + tCtx.capture.mutex.Lock() + defer tCtx.capture.mutex.Unlock() + + tCtx.capture.failed = true +} + +func (tCtx TContext) FailNow() { + if tCtx.capture == nil { + tCtx.TB().FailNow() + return + } + + tCtx.capture.mutex.Lock() + defer tCtx.capture.mutex.Unlock() + + tCtx.capture.failed = true + panic(failed) +} + +func (tCtx TContext) Failed() bool { + if tCtx.capture == nil { + return tCtx.TB().Failed() + } + + tCtx.capture.mutex.Lock() + defer tCtx.capture.mutex.Unlock() + + return tCtx.capture.failed +} + +func (tCtx TContext) Fatal(args ...any) { + if tCtx.capture == nil { + tCtx.Helper() + // Enable `go vet printf` by directly calling fmt.Sprintln. + msg := strings.TrimSpace(fmt.Sprintln(args...)) + // FATAL ERROR *before* header to make it stand out as failure. + tCtx.TB().Fatal("FATAL ERROR:" + tCtx.buildHeader(" ", "\n") + indent(tCtx.steps+msg, true)) + } + + tCtx.Error(args...) + tCtx.FailNow() +} + +func (tCtx TContext) Fatalf(format string, args ...any) { + if tCtx.capture == nil { + tCtx.Helper() + // Enable `go vet printf` by directly calling fmt.Sprintf. + msg := strings.TrimSpace(fmt.Sprintf(format, args...)) + // FATAL ERROR *before* header to make it stand out as failure. + tCtx.TB().Fatal("FATAL ERROR:" + tCtx.buildHeader(" ", "\n") + indent(tCtx.steps+msg, true)) + return + } + + tCtx.Errorf(format, args...) + tCtx.FailNow() +} + +// fatalWithError is the internal type that should never get propagated up. The +// only case where that can happen is when the developer forgot to call +// finalize via defer. The string explains that, in case that developers get to +// see it. +type fatalWithError string + +const failed = fatalWithError("WithError TContext encountered a fatal error, but the finalize function was not called via defer as it should have been.") + +var errFailedWithNoExplanation = errors.New("WithError context was marked as failed without recording an error") diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/initoption/initoption.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/initoption/initoption.go new file mode 100644 index 0000000000..d65aa515e5 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/initoption/initoption.go @@ -0,0 +1,40 @@ +/* +Copyright 2024 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. +*/ + +package initoption + +import "k8s.io/kubernetes/test/utils/ktesting/internal" + +// InitOption is a functional option for Init and InitCtx. +type InitOption func(c *internal.InitConfig) + +// PerTestOutput controls whether a per-test logger gets +// set up by Init. Has no effect in InitCtx. +func PerTestOutput(enabled bool) InitOption { + return func(c *internal.InitConfig) { + c.PerTestOutput = enabled + } +} + +// BufferLogs controls whether log entries are captured in memory in addition +// to being printed. Off by default. Unit tests that want to verify that +// log entries are emitted as expected can turn this on and then retrieve +// the captured log through the Underlier LogSink interface. +func BufferLogs(enabled bool) InitOption { + return func(c *internal.InitConfig) { + c.BufferLogs = enabled + } +} diff --git a/vendor/k8s.io/apimachinery/pkg/util/proxy/doc.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/internal/config.go similarity index 81% rename from vendor/k8s.io/apimachinery/pkg/util/proxy/doc.go rename to vendor/k8s.io/kubernetes/test/utils/ktesting/internal/config.go index ea710f6b15..88403a00e8 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/proxy/doc.go +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/internal/config.go @@ -1,5 +1,5 @@ /* -Copyright 2014 The Kubernetes Authors. +Copyright 2024 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. @@ -14,5 +14,9 @@ See the License for the specific language governing permissions and limitations under the License. */ -// Package proxy provides transport and upgrade support for proxies. -package proxy +package internal + +type InitConfig struct { + PerTestOutput bool + BufferLogs bool +} diff --git a/vendor/k8s.io/apimachinery/pkg/util/diff/cmp.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/klogcontext.go similarity index 59% rename from vendor/k8s.io/apimachinery/pkg/util/diff/cmp.go rename to vendor/k8s.io/kubernetes/test/utils/ktesting/klogcontext.go index 0a8100d063..f9a42e2ba6 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/diff/cmp.go +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/klogcontext.go @@ -1,8 +1,5 @@ -//go:build usegocmp -// +build usegocmp - /* -Copyright 2025 The Kubernetes Authors. +Copyright 2024 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. @@ -17,15 +14,19 @@ See the License for the specific language governing permissions and limitations under the License. */ -package diff +package ktesting import ( - "github.com/google/go-cmp/cmp" //nolint:depguard + "fmt" + "time" ) -// Diff returns a string representation of the difference between two objects. -// When built with the usegocmp tag, it uses go-cmp/cmp to generate a diff -// between the objects. -func Diff(a, b any) string { - return cmp.Diff(a, b) +var timeNow = time.Now // Can be stubbed out for testing. + +func klogHeader() string { + now := timeNow() + _, month, day := now.Date() + hour, minute, second := now.Clock() + return fmt.Sprintf("I%02d%02d %02d:%02d:%02d.%06d]", + month, day, hour, minute, second, now.Nanosecond()/1000) } diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/ktesting.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/ktesting.go new file mode 100644 index 0000000000..3099ca0753 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/ktesting.go @@ -0,0 +1,55 @@ +/* +Copyright 2023 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. +*/ + +package ktesting + +import ( + "context" + "flag" + "fmt" + "testing" + + "k8s.io/klog/v2" + + // Initialize command line parameters. + _ "k8s.io/component-base/logs/testinit" +) + +// SetDefaultVerbosity can be called during init to modify the default +// log verbosity of the program. +// +// Note that this immediately reconfigures the klog verbosity, already before +// flag parsing. If the verbosity is non-zero and SetDefaultVerbosity is called +// during init, then other init functions might start logging where normally +// they wouldn't log anything. Should this occur, then the right fix is to +// remove those log calls because logging during init is discouraged. It leads +// to unpredictable output (init order is not specified) and/or is useless +// (logging not initialized during init and thus conditional log output gets +// omitted). +func SetDefaultVerbosity(v int) { + f := flag.CommandLine.Lookup("v") + _ = f.Value.Set(fmt.Sprintf("%d", v)) +} + +// NewTestContext is a drop-in replacement for ktesting.NewTestContext. +// +// The result can be cast to a TContext and has the same functionality +// (for example, it gets cancelled at the end of the test). +// It's returned as a context.Context to avoid breaking code which expects that type. +func NewTestContext(tb testing.TB) (klog.Logger, context.Context) { + tCtx := Init(tb) + return tCtx.Logger(), tCtx +} diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/signals.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/signals.go new file mode 100644 index 0000000000..4edef18bd9 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/signals.go @@ -0,0 +1,236 @@ +/* +Copyright 2023 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. +*/ + +package ktesting + +import ( + "context" + "errors" + "fmt" + "io" + "os" + "os/signal" + "strings" + "sync" + "testing" +) + +var ( + // defaultProgressReporter is inactive until init is called. + defaultProgressReporter = &progressReporter{} + + // interruptCtx tracks whether the process got interrupted via SIGINT. + // In that case, interrupted gets called to cancel interruptCtx with + // a suitable message. + // + // This gets set up once per process and never gets reset. + interruptCtx, interrupted = context.WithCancelCause(context.Background()) +) + +const ginkgoSpecContextKey = "GINKGO_SPEC_CONTEXT" + +type ginkgoReporter interface { + AttachProgressReporter(reporter func() string) func() +} + +type progressReporter struct { + // initMutex protects initialization and finalization of the reporter. + initMutex sync.Mutex + + usageCount int64 + wg sync.WaitGroup + testCtx context.Context + signalChannel chan os.Signal + progressChannel chan os.Signal + + // reportMutex protects report creation and settings. + reportMutex sync.Mutex + reporterCounter int64 + reporters map[int64]func() string + out io.Writer + closeOut func() error +} + +var _ ginkgoReporter = &progressReporter{} + +// init is invoked by Init. It returns the context to be used for the +// new TContext. +// +// By default, that is just context.Background. In a Go unit test, it +// is a context connected to os.Interrupt. +// +// Once activated like that in a Go unit test, the progressReporter implements +// support for triggering a progress report in a running test when sending it a +// USR1 signal, similar to the corresponding Ginkgo feature. +// +// This support is active until the last test terminates. +func (p *progressReporter) init(tb TB) context.Context { + if _, ok := tb.(testing.TB); !ok { + // Not in a Go unit test. + return context.Background() + } + + tb.Helper() + + // If already interrupted, then don't start the new test. + // This is necessary because normally CTRL-C would exit + // the entire process immediately. Now we keep running + // to clean up. + if interruptCtx.Err() != nil { + tb.Fatalf("testing has been interrupted: %v", context.Cause(interruptCtx)) + } + + p.initMutex.Lock() + defer p.initMutex.Unlock() + + p.usageCount++ + tb.Cleanup(p.finalize) + if p.usageCount > 1 { + // Was already initialized. + return p.testCtx + } + + // Might have been set for testing purposes. + if p.out == nil { + // os.Stderr gets redirected by "go test". "go test -v" has to be + // used to see that output while a test runs. + // + // Opening /dev/tty during init avoids the redirection. + // May fail, depending on the OS, in which case + // os.Stderr is used. + if console, err := os.OpenFile("/dev/tty", os.O_RDWR|os.O_APPEND, 0); err == nil { + p.out = console + p.closeOut = console.Close + + } else { + p.out = os.Stdout + p.closeOut = nil + } + } + + p.signalChannel = make(chan os.Signal) + signal.Notify(p.signalChannel, os.Interrupt) + p.wg.Go(func() { + _, ok := <-p.signalChannel + if ok { + _, _ = fmt.Fprint(p.out, "\n\nINFO: canceling test context: received interrupt signal\n\n") + interrupted(errors.New("received interrupt signal")) + } + }) + + // This reimplements the contract between Ginkgo and Gomega for progress reporting. + // When using Ginkgo contexts, Ginkgo will implement it. This here is for "go test". + // + // nolint:staticcheck // It complains about using a plain string. This can only be fixed + // by Ginkgo and Gomega formalizing this interface and define a type (somewhere... + // probably cannot be in either Ginkgo or Gomega). + p.testCtx = context.WithValue(interruptCtx, ginkgoSpecContextKey, defaultProgressReporter) + + p.progressChannel = make(chan os.Signal, 1) + // progressSignals will be empty on Windows. + if len(progressSignals) > 0 { + signal.Notify(p.progressChannel, progressSignals...) + } + + p.wg.Go(p.run) + + return p.testCtx +} + +func (p *progressReporter) finalize() { + p.initMutex.Lock() + defer p.initMutex.Unlock() + + p.usageCount-- + if p.usageCount > 0 { + // Still in use. + return + } + + signal.Stop(p.signalChannel) + close(p.signalChannel) + signal.Stop(p.progressChannel) + close(p.progressChannel) + p.wg.Wait() + + // Now that all goroutines are stopped, we can clean up some more. + if p.closeOut != nil { + _ = p.closeOut() + p.out = nil + } +} + +// AttachProgressReporter implements Gomega's contextWithAttachProgressReporter. +func (p *progressReporter) AttachProgressReporter(reporter func() string) func() { + p.reportMutex.Lock() + defer p.reportMutex.Unlock() + + // TODO (?): identify the caller and record that for dumpProgress. + p.reporterCounter++ + id := p.reporterCounter + if p.reporters == nil { + p.reporters = make(map[int64]func() string) + } + p.reporters[id] = reporter + return func() { + p.detachProgressReporter(id) + } +} + +func (p *progressReporter) detachProgressReporter(id int64) { + p.reportMutex.Lock() + defer p.reportMutex.Unlock() + + delete(p.reporters, id) +} + +func (p *progressReporter) run() { + for { + _, ok := <-p.progressChannel + if !ok { + // Shut down. + return + } + p.dumpProgress() + } +} + +// dumpProgress is less useful than the Ginkgo progress report. We can't fix +// that we don't know which tests are currently running and instead have to +// rely on "go test -v" for that. +// +// But perhaps dumping goroutines and their callstacks is useful anyway? TODO: +// look at how Ginkgo does it and replicate some of it. +func (p *progressReporter) dumpProgress() { + p.reportMutex.Lock() + defer p.reportMutex.Unlock() + + var buffer strings.Builder + buffer.WriteString("You requested a progress report.\n") + if len(p.reporters) == 0 { + buffer.WriteString("Currently there is no information about test progress available.\n") + } + for _, reporter := range p.reporters { + report := reporter() + buffer.WriteRune('\n') + buffer.WriteString(report) + if !strings.HasSuffix(report, "\n") { + buffer.WriteRune('\n') + } + } + + _, _ = p.out.Write([]byte(buffer.String())) +} diff --git a/vendor/k8s.io/utils/exec/fixup_go118.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/signals_non_win.go similarity index 66% rename from vendor/k8s.io/utils/exec/fixup_go118.go rename to vendor/k8s.io/kubernetes/test/utils/ktesting/signals_non_win.go index acf45f1cd5..cb11d7c0dc 100644 --- a/vendor/k8s.io/utils/exec/fixup_go118.go +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/signals_non_win.go @@ -1,8 +1,7 @@ -//go:build !go1.19 -// +build !go1.19 +//go:build !windows /* -Copyright 2022 The Kubernetes Authors. +Copyright 2023 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. @@ -17,16 +16,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -package exec +package ktesting import ( - osexec "os/exec" + "os" + "syscall" ) -func maskErrDotCmd(cmd *osexec.Cmd) *osexec.Cmd { - return cmd -} - -func maskErrDot(err error) error { - return err -} +var ( + // If there ever is a non-Windows build platform that doesn't + // have SIGUSR1, then we need to add another exception for it. + progressSignals = []os.Signal{syscall.SIGUSR1} +) diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/signals_win.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/signals_win.go new file mode 100644 index 0000000000..6ff7e49d4f --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/signals_win.go @@ -0,0 +1,27 @@ +//go:build windows + +/* +Copyright 2023 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. +*/ + +package ktesting + +import ( + "os" +) + +var ( + progressSignals = []os.Signal{} +) diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/stepcontext.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/stepcontext.go new file mode 100644 index 0000000000..13db3c79a7 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/stepcontext.go @@ -0,0 +1,77 @@ +/* +Copyright 2024 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. +*/ + +package ktesting + +// WithStep creates a context where a prefix is added to all errors and log +// messages, similar to how errors are wrapped. This can be nested, leaving a +// trail of "bread crumbs" that help figure out where in a test some problem +// occurred or why some log output gets written: +// +// ERROR: bake cake: set heat for baking: oven not found +// +// The string should describe the operation that is about to happen ("starting +// the controller", "list items") or what is being operated on ("HTTP server"). +// Multiple different prefixes get concatenated with a colon. +func (tCtx TContext) WithStep(step string) TContext { + tCtx.steps += step + ": " + return tCtx +} + +// Step is useful when the context with the step information is +// used more than once: +// +// ktesting.Step(tCtx, "step 1", func(tCtx ktesting.TContext) { +// tCtx.Log(...) +// if (... ) { +// tCtx.Failf(...) +// } +// )} +// +// Inside the callback, the tCtx variable is the one where the step +// has been added. This avoids the need to introduce multiple different +// context variables and risk of using the wrong one. +func (tCtx TContext) Step(step string, cb func(tCtx TContext)) { + tCtx.Helper() + cb(tCtx.WithStep(step)) +} + +// Value intercepts a search for the special "GINKGO_SPEC_CONTEXT" and +// wraps the underlying reporter so that the steps are visible in the report. +func (tCtx TContext) Value(key any) any { + if tCtx.steps != "" { + if s, ok := key.(string); ok && s == ginkgoSpecContextKey { + if reporter, ok := tCtx.Context.Value(key).(ginkgoReporter); ok { + return ginkgoReporter(&stepReporter{reporter: reporter, steps: tCtx.steps}) + } + } + } + return tCtx.Context.Value(key) +} + +type stepReporter struct { + reporter ginkgoReporter + steps string +} + +var _ ginkgoReporter = &stepReporter{} + +func (s *stepReporter) AttachProgressReporter(reporter func() string) func() { + return s.reporter.AttachProgressReporter(func() string { + report := reporter() + return s.steps + report + }) +} diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/tcontext.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/tcontext.go new file mode 100644 index 0000000000..c900252719 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/tcontext.go @@ -0,0 +1,595 @@ +/* +Copyright 2023 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. +*/ + +package ktesting + +import ( + "context" + "flag" + "fmt" + "strings" + "sync" + "testing" + "testing/synctest" + "time" + + "github.com/go-logr/logr" + "github.com/onsi/gomega" + + apiextensions "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" + "k8s.io/client-go/dynamic" + clientset "k8s.io/client-go/kubernetes" + "k8s.io/client-go/rest" + "k8s.io/client-go/restmapper" + "k8s.io/klog/v2" + "k8s.io/klog/v2/ktesting" + "k8s.io/kubernetes/test/utils/format" + "k8s.io/kubernetes/test/utils/ktesting/initoption" + "k8s.io/kubernetes/test/utils/ktesting/internal" +) + +// Underlier is the additional interface implemented by the per-test LogSink +// behind [TContext.Logger]. Together with [initoption.BufferLogs] it can be +// used to capture log output in memory to check it in tests. +type Underlier = ktesting.Underlier + +// CleanupGracePeriod is the time that a [TContext] gets canceled before the +// deadline of its underlying test suite (usually determined via "go test +// -timeout"). This gives the running test(s) time to fail with an informative +// timeout error. After that, all cleanup callbacks then have the remaining +// time to complete before the test binary is killed. +// +// For this to work, each blocking calls in a test must respect the +// cancellation of the [TContext]. +// +// When using Ginkgo to manage the test suite and running tests, the +// CleanupGracePeriod is ignored because Ginkgo itself manages timeouts. +const CleanupGracePeriod = 5 * time.Second + +// TB is the interface common to [testing.T], [testing.B], [testing.F] and +// [github.com/onsi/ginkgo/v2] which ktesting relies upon itself or +// passes through (like Chdir, TempDir). +// +// In contrast to [testing.TB], it can be implemented also outside of the +// testing package. +// +// Fatal/Error/Skip are used by ktesting instead of Log + FailNow/Failed/SkipNow +// because when implemented by Ginkgo it is better to pass the reason for +// a failure or skip directly to Ginkgo in the method intended for that purpose. +type TB interface { + Attr(key, value string) + Chdir(dir string) + Cleanup(func()) + Error(args ...any) + Errorf(format string, args ...any) + Fail() + FailNow() + Failed() bool + Fatal(args ...any) + Fatalf(format string, args ...any) + Helper() + Log(args ...any) + Logf(format string, args ...any) + Name() string + Setenv(key, value string) + Skip(args ...any) + Skipf(format string, args ...any) + SkipNow() + Skipped() bool + TempDir() string +} + +// ContextTB adds support for cleanup callbacks with explicit context +// parameter. This is used when integrating with Ginkgo: then CleanupCtx +// gets implemented via ginkgo.DeferCleanup. +type ContextTB interface { + TB + CleanupCtx(func(ctx context.Context)) +} + +// Init can be called in a unit or integration test to create +// a test context which: +// - has a per-test logger with verbosity derived from the -v command line flag +// - gets canceled when the test finishes (via [TB.Cleanup]) +// +// Note that the test context supports the interfaces of [TB] and +// [context.Context] and thus can be used like one of those where needed. +// It also has additional methods for retrieving the logger and canceling +// the context early, which can be useful in tests which want to wait +// for goroutines to terminate after cancellation. +// +// If the [TB] implementation also implements [ContextTB], then +// [TContext.CleanupCtx] uses [ContextTB.CleanupCtx] and uses +// the context passed into that callback. This can be used to let +// Ginkgo create a fresh context for cleanup code. +// +// Can be called more than once per test to get different contexts with +// independent cancellation. The default behavior describe above can be +// modified via optional functional options defined in [initoption]. +func Init(tb TB, opts ...InitOption) TContext { + tb.Helper() + + c := internal.InitConfig{ + PerTestOutput: true, + } + for _, opt := range opts { + opt(&c) + } + + // We don't need a Deadline implementation, testing.B doesn't have it. + // But if we have one, we'll use it to set a timeout shortly before + // the deadline. This needs to come before we wrap tb. + deadlineTB, deadlineOK := tb.(interface { + Deadline() (time.Time, bool) + }) + + ctx := defaultProgressReporter.init(tb) + var header func() string + if c.PerTestOutput { + logger := newLogger(tb, c.BufferLogs) + ctx = klog.NewContext(ctx, logger) + header = klogHeader + } + + var cancelTimeout func(cause string) + if deadlineOK { + if deadline, ok := deadlineTB.Deadline(); ok { + timeLeft := time.Until(deadline) + timeLeft -= CleanupGracePeriod + ctx, cancelTimeout = withTimeout(ctx, tb, timeLeft, fmt.Sprintf("test suite deadline (%s) is close, need to clean up before the %s cleanup grace period", deadline.Truncate(time.Second), CleanupGracePeriod)) + } + } + + // Construct new TContext with context and settings as determined above. + tCtx := InitCtx(ctx, tb) + if cancelTimeout != nil { + tCtx.cancel = cancelTimeout + } else { + tCtx = tCtx.WithCancel() + tCtx.Cleanup(func() { + tCtx.Cancel(cleanupErr(tCtx.Name()).Error()) + }) + } + tCtx.perTestHeader = header + + return tCtx +} + +func newLogger(tb TB, bufferLogs bool) klog.Logger { + config := ktesting.NewConfig( + ktesting.AnyToString(func(v interface{}) string { + // For basic types where the string + // representation is "obvious" we use + // fmt.Sprintf because format.Object always + // adds a <"type"> prefix, which is too long + // for simple values. + switch v := v.(type) { + case int, int32, int64, uint, uint32, uint64, float32, float64, bool: + return fmt.Sprintf("%v", v) + case string: + return v + default: + return strings.TrimSpace(format.Object(v, 1)) + } + }), + ktesting.VerbosityFlagName("v"), + ktesting.VModuleFlagName("vmodule"), + ktesting.BufferLogs(bufferLogs), + ) + + // Copy klog settings instead of making the ktesting logger + // configurable directly. + var fs flag.FlagSet + config.AddFlags(&fs) + for _, name := range []string{"v", "vmodule"} { + from := flag.CommandLine.Lookup(name) + to := fs.Lookup(name) + if err := to.Value.Set(from.Value.String()); err != nil { + panic(err) + } + } + + // Ensure consistent logging: this klog.Logger writes to tb, adding the + // date/time header, and our own wrapper emulates that behavior for + // Log/Logf/... + logger := ktesting.NewLogger(tb, config) + return logger +} + +type InitOption = initoption.InitOption + +// InitCtx is a variant of [Init] which uses an already existing context and +// whatever logger and timeouts are stored there. +// Functional options are part of the API, but currently +// there are none which have an effect. +func InitCtx(ctx context.Context, tb TB, _ ...InitOption) TContext { + return TContext{ + Context: ctx, + testingTB: testingTB{TB: tb}, + } +} + +// withTB constructs a new TContext with a different TB instance. +// +// This is used internally to set up some of the context, in particular +// clients, in the root test and then run sub-tests: +// +// func TestSomething(t *testing.T) { +// tCtx := ktesting.Init(t) +// ... +// tCtx = ktesting.WithRESTConfig(tCtx, config) +// +// t.Run("sub", func (t *testing.T) { +// tCtx := ktesting.WithTB(tCtx, t) +// ... +// }) +// +// withTB sets up cancellation for the sub-test and uses per-test output. +func (tCtx TContext) withTB(tb TB) TContext { + tCtx.testingTB.TB = tb + if tCtx.perTestHeader != nil { + logger := newLogger(tb, false /* don't buffer logs in sub-test */) + tCtx.Context = klog.NewContext(tCtx.Context, logger) + } + return tCtx.WithCancel() +} + +// run implements the different Run and SyncTest methods. It's not an exported +// method because tCtx.Run is more discoverable (same usage as +// with normal Go). +func run(tCtx TContext, name string, syncTest bool, cb func(tCtx TContext)) bool { + tCtx.Helper() + switch tb := tCtx.TB().(type) { + case *testing.T: + if syncTest { + f := func(t *testing.T) { + // We must not propagate the parent's + // cancellation channel into the bubble, + // it causes "panic: receive on synctest channel from outside bubble". + // + // Sync tests shouldn't need the overall suite timeout, + // so this seems okay. + tCtx.isSyncTest = true + tCtx = tCtx.WithoutCancel().withTB(t) + cb(tCtx) + } + if name != "" { + return tb.Run(name, func(t *testing.T) { synctest.Test(t, f) }) + } + synctest.Test(tb, f) + return true + } + return tb.Run(name, func(t *testing.T) { + cb(tCtx.withTB(t)) + }) + case *testing.B: + if !syncTest { + return tb.Run(name, func(b *testing.B) { + cb(tCtx.withTB(b)) + }) + } + } + + what := "Run" + if syncTest { + what = "SyncTest" + } + tCtx.Fatalf("%s not implemented, underlying %T does not support it", what, tCtx.TB()) + + return false +} + +// WithContext constructs a new TContext with a different Context instance. +// This can be used in callbacks which receive a Context, for example +// from Gomega: +// +// gomega.Eventually(tCtx, func(ctx context.Context) { +// tCtx := ktesting.WithContext(tCtx, ctx) +// ... +// +// This is important because the Context in the callback could have +// a different deadline than in the parent TContext. +func (tCtx TContext) WithContext(ctx context.Context) TContext { + logger := tCtx.Logger() + tCtx.Context = ctx + if _, err := logr.FromContext(ctx); err != nil { + // Keep using the logger from the parent context. + tCtx = tCtx.WithLogger(logger) + } + return tCtx +} + +// WithValue wraps [context.WithValue] such that the result is again a TContext. +func (tCtx TContext) WithValue(key, val any) TContext { + ctx := context.WithValue(tCtx, key, val) + return tCtx.WithContext(ctx) +} + +// TContext implements [context.Context], [testing.TB] and some additional +// methods. [TContext] is the public pointer type for referencing a TC. +// Variables are usually called tCtx. To ensure that test code does not +// use `t` directly unintentionally, it is recommended to use two functions: +// +// func TestSomething(t *testing.T) { testSomething(ktesting.Init(t)) } +// func testSomething(tCtx ktesting.TContext) { ... } +// +// Log output is associated with the current test and includes a header similar +// to klog, which enables post-processing to distinguish between log output +// (starts with header) and failure messages (header comes later). Errors +// ([Error], [Errorf]) are recorded with "ERROR" as prefix, fatal errors +// ([Fatal], [Fatalf]) with "FATAL ERROR". Indention is used to ensure that +// follow-up lines belonging to the same log entry can be handled properly +// by post-processing and to make the header stand out more. +// +// tCtx provides features offered by Ginkgo also when using normal Go [testing]: +// - The context contains a deadline that expires soon enough before +// the overall timeout that cleanup code can still run. +// - Cleanup callbacks can get their own, separate contexts when +// registered via [CleanupCtx]. +// - CTRL-C aborts, prints a progress report, and then cleans up +// before terminating. +// - SIGUSR1 prints a progress report without aborting. +// +// Progress reporting is more informative when doing polling with +// [gomega.Eventually] and [gomega.Consistently]. Without that, it +// can only report which tests are active. +type TContext struct { + // Context makes the methods of the underlying context + // available. It must not be modified. + context.Context + + // testingTB makes the methods of the underlying test implementation + // available. Its embedded TB must not be modified. + testingTB + + // perTestHeader is an optional function which produces a klog-like perTestHeader when + // not using some global logger. + perTestHeader func() string + + // for Cancel + cancel func(cause string) + + // steps is a concatenation ("step1: step2: step3: ") of steps passed to WithStep. + // It's empty if there are no steps. + steps string + + // for SyncTest + isSyncTest bool + + // for WithClient + restConfig *rest.Config + restMapper *restmapper.DeferredDiscoveryRESTMapper + client clientset.Interface + dynamic dynamic.Interface + apiextensions apiextensions.Interface + + // for WithNamespace + namespace string + + // capture, if non-nil, changes Error/Errorf/Fatal/Fatalf/Fail/FailNow so + // that they intercept the problem and convert to errors. Log messages + // are passed through. + // + // Used by WithError. + capture *capture +} + +type capture struct { + mutex sync.Mutex + errors []error + failed bool +} + +// testingTB is needed to avoid a name conflict +// between field and method in tContext. +type testingTB struct { + // TB makes the methods of the underlying test implementation available. + // In particular Helper must be called directly, not via a wrapper. + // It must not be modified. + TB +} + +// Parallel signals that this test is to be run in parallel with (and +// only with) other parallel tests. In other words, it needs to be +// called in each test which is meant to run in parallel. +// +// Only supported in Go unit tests, calling it elsewhere causes a test failure. +// +// When a unit test is run multiple times due to use of -test.count or -test.cpu, +// multiple instances of a single test never run in parallel with each other. +func (tCtx TContext) Parallel() { + if tb, ok := tCtx.TB().(interface{ Parallel() }); ok { + tb.Parallel() + } else { + tCtx.Fatalf("Parallel not implemented, underlying %T does not support it", tCtx.TB()) + } +} + +// Cancel can be invoked to cancel the context before the test is completed. +// Tests which use the context to control goroutines and then wait for +// termination of those goroutines must call Cancel to avoid a deadlock. +// +// The cause, if non-empty, is turned into an error which is equivalent +// to context.Canceled. context.Cause will return that error for the +// context. +func (tCtx TContext) Cancel(cause string) { + if tCtx.cancel != nil { + tCtx.cancel(cause) + } +} + +// CleanupCtx registers a callback that will get invoked when the test +// has finished. Callbacks get invoked in last-in-first-out order (LIFO). +// +// Using CleanupCtx is preferred because of the automatic context cancellation. +// The following broken (!) cleanup code will use a canceled context, +// which is not desirable: +// +// // tCtx gets canceled when the test ends and before the callback runs. +// tCtx.Cleanup(func() { /* do something with the test's tCtx */ }) +// +// A safer way to run cleanup code is: +// +// tCtx.CleanupCtx(func (tCtx ktesting.TContext) { /* do something with the cleanup's tCtx */ }) +// +// The logger and clients are the same as in the TContext that CleanupCtx +// is invoked on. +func (tCtx TContext) CleanupCtx(cb func(TContext)) { + tCtx.Helper() + + if tb, ok := tCtx.TB().(ContextTB); ok { + // Use context from base TB (most likely Ginkgo). + tb.CleanupCtx(func(ctx context.Context) { + tCtx := tCtx.WithContext(ctx) + cb(tCtx) + }) + return + } + + tCtx.Cleanup(func() { + // Use new context. This is the code path for "go test". The + // context then has *no* deadline. In the code path above for + // Ginkgo, Ginkgo is more sophisticated and also applies + // timeouts to cleanup calls which accept a context. + childCtx := tCtx.WithContext(context.WithoutCancel(tCtx)) + cb(childCtx) + }) +} + +// Run runs cb as a subtest called name. It blocks until cb returns or +// calls t.Parallel to become a parallel test. +// +// Only supported in Go unit tests or benchmarks. It fails the current +// test when called elsewhere. +func (tCtx TContext) Run(name string, cb func(tCtx TContext)) bool { + return run(tCtx, name, false, cb) +} + +// SyncTest uses [synctest.Test] to execute the callback inside a bubble. +// Creates a new subtest if the name is non-empty, otherwise it creates +// the bubble directly in the current test context. +// +// Only works in Go unit tests. +func (tCtx TContext) SyncTest(name string, cb func(tCtx TContext)) bool { + return run(tCtx, name, true, cb) +} + +// IsSyncTest returns true if the context was created by SyncTest. +// +// Inside such a context, Wait is usable. This can be used in +// code which runs inside synctest bubbles and outside: +// - Inside a bubble, Wait can be used to block until +// background activity has settled down (= "durably blocked"). +// Eventually and Consistently both call Wait and then check +// the condition. +// - Outside, polling or some synchronization mechanism has to be used. +func (tCtx TContext) IsSyncTest() bool { + return tCtx.isSyncTest +} + +// Wait calls [synctest.Wait] and thus ensures that all background +// activity has settled down (= "durably blocked"). +// +// Only works inside a bubble started by SyncTest (can be checked with +// IsSyncTest), panics elsewhere. +func (tCtx TContext) Wait() { + synctest.Wait() +} + +// TB returns the underlying TB. This can be used to "break the glass" +// and cast back into a testing.T or TB. Calling TB is necessary +// because TContext wraps the underlying TB. +// +// For example, in benchmarks it is necessary to cast back to +// a testing.B because not all benchmark-only methods are provided. +// This examples uses separate functions again to ensure that +// b isn't used unintentionally: +// +// func BenchmarkSomething(b *testing.B) { benchmarkSomething(ktesting.Init(b) } +// func benchmarkSomething(tCtx ktesting.TContext) { +// ... set up with tCtx ... +// for tCtx.TB().(*testing.B).Loop() { +// ... +// } +// } +func (tCtx TContext) TB() TB { return tCtx.testingTB.TB } + +// Logger returns a logger for the current test. This is a shortcut +// for calling klog.FromContext. +// +// Output emitted via this logger and the TB interface (like Logf) +// is formatted consistently. The TB interface generates a single +// message string, while Logger enables structured logging and can +// be passed down into code which expects a logger. +// +// To skip intermediate helper functions during stack unwinding, +// TB.Helper can be called in those functions. +func (tCtx TContext) Logger() klog.Logger { + return klog.FromContext(tCtx.Context) +} + +// RESTConfig returns a copy of the config for a rest client with the UserAgent +// set to include the current test name or nil if not available. Several typed +// clients using this config are available through [Client], [Dynamic], +// [APIExtensions]. +func (tCtx TContext) RESTConfig() *rest.Config { + return rest.CopyConfig(tCtx.restConfig) +} + +func (tCtx TContext) RESTMapper() *restmapper.DeferredDiscoveryRESTMapper { return tCtx.restMapper } +func (tCtx TContext) Client() clientset.Interface { return tCtx.client } +func (tCtx TContext) Dynamic() dynamic.Interface { return tCtx.dynamic } +func (tCtx TContext) APIExtensions() apiextensions.Interface { return tCtx.apiextensions } + +// Expect wraps [gomega.Expect] such that a failure will be reported via +// [TContext.Fatal]. As with [gomega.Expect], additional values +// may get passed. Those values then all must be nil for the assertion +// to pass. This can be used with functions which return a value +// plus error. The error gets checked automatically. +// +// myAmazingThing := func(int, error) { ...} +// tCtx.Expect(myAmazingThing()).Should(gomega.Equal(1)) +func (tCtx TContext) Expect(actual interface{}, extra ...interface{}) gomega.Assertion { + return gomegaAssertion(tCtx, true, actual, extra...) +} + +// Require is an alias for Expect. +func (tCtx TContext) Require(actual interface{}, extra ...interface{}) gomega.Assertion { + return gomegaAssertion(tCtx, true, actual, extra...) +} + +// Assert also wraps [gomega.Expect], but in contrast to Expect = Require, +// it reports a failure through [TContext.Error]. This makes it possible +// to test several different assertions. +func (tCtx TContext) Assert(actual interface{}, extra ...interface{}) gomega.Assertion { + return gomegaAssertion(tCtx, false, actual, extra...) +} + +// WithNamespace creates a new context with a Kubernetes namespace name for retrieval through [Namespace]. +func (tCtx TContext) WithNamespace(namespace string) TContext { + tCtx.namespace = namespace + return tCtx +} + +// Namespace returns the Kubernetes namespace name that was set previously +// through WithNamespace and the empty string if none is available. +// +// This namespace is the one to be used by tests which need to create namespace-scoped +// objects. The name is guaranteed to be unique for the test context, so tests running +// in parallel need to be set up so that each test has its own namespace. +func (tCtx TContext) Namespace() string { + return tCtx.namespace +} diff --git a/vendor/k8s.io/kubernetes/test/utils/ktesting/withcontext.go b/vendor/k8s.io/kubernetes/test/utils/ktesting/withcontext.go new file mode 100644 index 0000000000..adfb7a13a8 --- /dev/null +++ b/vendor/k8s.io/kubernetes/test/utils/ktesting/withcontext.go @@ -0,0 +1,73 @@ +/* +Copyright 2023 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. +*/ + +package ktesting + +import ( + "context" + "time" + + "k8s.io/klog/v2" +) + +// WithCancel sets up cancellation in a [TContext.Cleanup] callback and +// constructs a new TContext where [TContext.Cancel] cancels only the new +// context. +func (tCtx TContext) WithCancel() TContext { + ctx, cancel := context.WithCancelCause(tCtx) + + tCtx.Context = ctx + tCtx.cancel = func(cause string) { + var cancelCause error + if cause != "" { + cancelCause = canceledError(cause) + } + cancel(cancelCause) + } + return tCtx +} + +// WithoutCancel causes the returned context to ignore cancellation of its parent. +// Calling Cancel will only cancel the new context. +// This matches [context.WithoutCancel]. +func (tCtx TContext) WithoutCancel() TContext { + ctx := context.WithoutCancel(tCtx) + + tCtx.Context = ctx + tCtx = tCtx.WithCancel() // Re-create a cancelable TContext. + return tCtx +} + +// WithTimeout sets up new context with a timeout. Canceling the timeout gets +// registered in a cleanup callback. [TContext.Cancel] cancels only +// the new context. The cause is used as reason why the context is canceled +// once the timeout is reached. It may be empty, in which case the usual +// "context canceled" error is used. +func (tCtx TContext) WithTimeout(timeout time.Duration, timeoutCause string) TContext { + ctx, cancel := withTimeout(tCtx, tCtx.TB(), timeout, timeoutCause) + + tCtx.Context = ctx + tCtx.cancel = cancel + return tCtx +} + +// WithLogger constructs a new context with a different logger. +func (tCtx TContext) WithLogger(logger klog.Logger) TContext { + ctx := klog.NewContext(tCtx, logger) + + tCtx.Context = ctx + return tCtx +} diff --git a/vendor/k8s.io/kubernetes/test/utils/runners.go b/vendor/k8s.io/kubernetes/test/utils/runners.go index 62c769f040..51c2c6587d 100644 --- a/vendor/k8s.io/kubernetes/test/utils/runners.go +++ b/vendor/k8s.io/kubernetes/test/utils/runners.go @@ -734,7 +734,7 @@ func StartPods(c clientset.Interface, replicas int, namespace string, podNamePre panic("StartPods: number of replicas must be non-zero") } startPodsID := string(uuid.NewUUID()) // So that we can label and find them - for i := 0; i < replicas; i++ { + for i := range replicas { podName := fmt.Sprintf("%v-%v", podNamePrefix, i) pod.ObjectMeta.Name = podName pod.ObjectMeta.Labels["name"] = podName @@ -1048,7 +1048,7 @@ func DoPrepareNode(ctx context.Context, client clientset.Interface, node *v1.Nod if len(patch) == 0 { return nil } - for attempt := 0; attempt < retries; attempt++ { + for range retries { if _, err = client.CoreV1().Nodes().Patch(ctx, node.Name, types.MergePatchType, []byte(patch), metav1.PatchOptions{}); err == nil { break } @@ -1061,7 +1061,7 @@ func DoPrepareNode(ctx context.Context, client clientset.Interface, node *v1.Nod return fmt.Errorf("too many conflicts when applying patch %v to Node %v: %s", string(patch), node.Name, err) } - for attempt := 0; attempt < retries; attempt++ { + for range retries { if err = strategy.PrepareDependentObjects(ctx, node, client); err == nil { break } diff --git a/vendor/k8s.io/kubernetes/test/utils/update_resources.go b/vendor/k8s.io/kubernetes/test/utils/update_resources.go index af5a59fc2f..1cccaa07c7 100644 --- a/vendor/k8s.io/kubernetes/test/utils/update_resources.go +++ b/vendor/k8s.io/kubernetes/test/utils/update_resources.go @@ -50,7 +50,7 @@ func ScaleResourceWithRetries(scalesGetter scaleclient.ScalesGetter, namespace, ResourceVersion: "", } waitForReplicas := scale.NewRetryParams(waitRetryInterval, waitRetryTimeout) - cond := RetryErrorCondition(scale.ScaleCondition(scaler, preconditions, namespace, name, size, nil, gvr, false)) + cond := RetryErrorCondition(scale.ScaleCondition(scaler, preconditions, namespace, name, size, nil, nil, gvr, false)) err := wait.PollUntilContextTimeout(context.Background(), updateRetryInterval, updateRetryTimeout, true, cond) if err == nil { err = scale.WaitForScaleHasDesiredReplicas(scalesGetter, gvr.GroupResource(), name, namespace, size, waitForReplicas) diff --git a/vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.protomessage.pb.go b/vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.protomessage.pb.go deleted file mode 100644 index aa2f5972dc..0000000000 --- a/vendor/k8s.io/metrics/pkg/apis/metrics/v1alpha1/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1alpha1 - -func (*ContainerMetrics) ProtoMessage() {} - -func (*NodeMetrics) ProtoMessage() {} - -func (*NodeMetricsList) ProtoMessage() {} - -func (*PodMetrics) ProtoMessage() {} - -func (*PodMetricsList) ProtoMessage() {} diff --git a/vendor/k8s.io/metrics/pkg/apis/metrics/v1beta1/generated.protomessage.pb.go b/vendor/k8s.io/metrics/pkg/apis/metrics/v1beta1/generated.protomessage.pb.go deleted file mode 100644 index 5f2fc5ee4d..0000000000 --- a/vendor/k8s.io/metrics/pkg/apis/metrics/v1beta1/generated.protomessage.pb.go +++ /dev/null @@ -1,32 +0,0 @@ -//go:build kubernetes_protomessage_one_more_release -// +build kubernetes_protomessage_one_more_release - -/* -Copyright 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. -*/ - -// Code generated by go-to-protobuf. DO NOT EDIT. - -package v1beta1 - -func (*ContainerMetrics) ProtoMessage() {} - -func (*NodeMetrics) ProtoMessage() {} - -func (*NodeMetricsList) ProtoMessage() {} - -func (*PodMetrics) ProtoMessage() {} - -func (*PodMetricsList) ProtoMessage() {} diff --git a/vendor/k8s.io/pod-security-admission/policy/registry.go b/vendor/k8s.io/pod-security-admission/policy/registry.go index 1648ff020c..aa9ea5b2b0 100644 --- a/vendor/k8s.io/pod-security-admission/policy/registry.go +++ b/vendor/k8s.io/pod-security-admission/policy/registry.go @@ -18,7 +18,7 @@ package policy import ( "fmt" - "sort" + "slices" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -163,8 +163,8 @@ func populate(r *checkRegistry, validChecks []Check) { } // Sort the IDs to maintain consistent error messages. - sort.Slice(restrictedIDs, func(i, j int) bool { return restrictedIDs[i] < restrictedIDs[j] }) - sort.Slice(baselineIDs, func(i, j int) bool { return baselineIDs[i] < baselineIDs[j] }) + slices.Sort(restrictedIDs) + slices.Sort(baselineIDs) orderedIDs := append(baselineIDs, restrictedIDs...) // Baseline checks first, then restricted. for v := api.MajorMinorVersion(1, 0); v.Older(nextMinor(r.maxVersion)); v = nextMinor(v) { diff --git a/vendor/github.com/google/btree/LICENSE b/vendor/k8s.io/streaming/LICENSE similarity index 100% rename from vendor/github.com/google/btree/LICENSE rename to vendor/k8s.io/streaming/LICENSE diff --git a/vendor/k8s.io/streaming/pkg/httpstream/doc.go b/vendor/k8s.io/streaming/pkg/httpstream/doc.go new file mode 100644 index 0000000000..1da83f14b1 --- /dev/null +++ b/vendor/k8s.io/streaming/pkg/httpstream/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2015 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. +*/ + +// Package httpstream adds multiplexed streaming support to HTTP requests and +// responses via connection upgrades. +package httpstream diff --git a/vendor/k8s.io/streaming/pkg/httpstream/httpstream.go b/vendor/k8s.io/streaming/pkg/httpstream/httpstream.go new file mode 100644 index 0000000000..a7c8d897dc --- /dev/null +++ b/vendor/k8s.io/streaming/pkg/httpstream/httpstream.go @@ -0,0 +1,201 @@ +/* +Copyright 2015 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. +*/ + +package httpstream + +import ( + "errors" + "fmt" + "io" + "net/http" + "strings" + "time" +) + +const ( + HeaderConnection = "Connection" + HeaderUpgrade = "Upgrade" + HeaderProtocolVersion = "X-Stream-Protocol-Version" + HeaderAcceptedProtocolVersions = "X-Accepted-Stream-Protocol-Versions" +) + +// NewStreamHandler defines a function that is called when a new Stream is +// received. If no error is returned, the Stream is accepted; otherwise, +// the stream is rejected. After the reply frame has been sent, replySent is closed. +type NewStreamHandler func(stream Stream, replySent <-chan struct{}) error + +// NoOpNewStreamHandler is a stream handler that accepts a new stream and +// performs no other logic. +func NoOpNewStreamHandler(stream Stream, replySent <-chan struct{}) error { return nil } + +// Dialer knows how to open a streaming connection to a server. +type Dialer interface { + + // Dial opens a streaming connection to a server using one of the protocols + // specified (in order of most preferred to least preferred). + Dial(protocols ...string) (Connection, string, error) +} + +// UpgradeRoundTripper is a type of http.RoundTripper that is able to upgrade +// HTTP requests to support multiplexed bidirectional streams. After RoundTrip() +// is invoked, if the upgrade is successful, clients may retrieve the upgraded +// connection by calling UpgradeRoundTripper.Connection(). +type UpgradeRoundTripper interface { + http.RoundTripper + // NewConnection validates the response and creates a new Connection. + NewConnection(resp *http.Response) (Connection, error) +} + +// ResponseUpgrader knows how to upgrade HTTP requests and responses to +// add streaming support to them. +type ResponseUpgrader interface { + // UpgradeResponse upgrades an HTTP response to one that supports multiplexed + // streams. newStreamHandler will be called asynchronously whenever the + // other end of the upgraded connection creates a new stream. + UpgradeResponse(w http.ResponseWriter, req *http.Request, newStreamHandler NewStreamHandler) Connection +} + +// Connection represents an upgraded HTTP connection. +type Connection interface { + // CreateStream creates a new Stream with the supplied headers. + CreateStream(headers http.Header) (Stream, error) + // Close resets all streams and closes the connection. + Close() error + // CloseChan returns a channel that is closed when the underlying connection is closed. + CloseChan() <-chan bool + // SetIdleTimeout sets the amount of time the connection may remain idle before + // it is automatically closed. + SetIdleTimeout(timeout time.Duration) + // RemoveStreams can be used to remove a set of streams from the Connection. + RemoveStreams(streams ...Stream) +} + +// Stream represents a bidirectional communications channel that is part of an +// upgraded connection. +type Stream interface { + io.ReadWriteCloser + // Reset closes both directions of the stream, indicating that neither client + // or server can use it any more. + Reset() error + // Headers returns the headers used to create the stream. + Headers() http.Header + // Identifier returns the stream's ID. + Identifier() uint32 +} + +// UpgradeFailureError encapsulates the cause for why the streaming +// upgrade request failed. Implements error interface. +type UpgradeFailureError struct { + Cause error +} + +func (u *UpgradeFailureError) Error() string { + return fmt.Sprintf("unable to upgrade streaming request: %s", u.Cause) +} + +// IsUpgradeFailure returns true if the passed error is (or wrapped error contains) +// the UpgradeFailureError. +func IsUpgradeFailure(err error) bool { + if err == nil { + return false + } + var upgradeErr *UpgradeFailureError + return errors.As(err, &upgradeErr) +} + +// isHTTPSProxyError returns true if error is Gorilla/Websockets HTTPS Proxy dial error; +// false otherwise (see https://github.com/kubernetes/kubernetes/issues/126134). +func IsHTTPSProxyError(err error) bool { + if err == nil { + return false + } + return strings.Contains(err.Error(), "proxy: unknown scheme: https") +} + +// IsUpgradeRequest returns true if the given request is a connection upgrade request +func IsUpgradeRequest(req *http.Request) bool { + for _, h := range req.Header[http.CanonicalHeaderKey(HeaderConnection)] { + if strings.Contains(strings.ToLower(h), strings.ToLower(HeaderUpgrade)) { + return true + } + } + return false +} + +func negotiateProtocol(clientProtocols, serverProtocols []string) string { + for i := range clientProtocols { + for j := range serverProtocols { + if clientProtocols[i] == serverProtocols[j] { + return clientProtocols[i] + } + } + } + return "" +} + +func commaSeparatedHeaderValues(header []string) []string { + var parsedClientProtocols []string + for i := range header { + for _, clientProtocol := range strings.Split(header[i], ",") { + if proto := strings.Trim(clientProtocol, " "); len(proto) > 0 { + parsedClientProtocols = append(parsedClientProtocols, proto) + } + } + } + return parsedClientProtocols +} + +// Handshake performs a subprotocol negotiation. If the client did request a +// subprotocol, Handshake will select the first common value found in +// serverProtocols, otherwise it will return an error and write an HTTP BadRequest to the response. +// If a match is found, Handshake adds a response header indicating the chosen subprotocol. +// If no match is found, HTTP forbidden is returned, along with a response header containing +// the list of protocols the server can accept. +func Handshake(req *http.Request, w http.ResponseWriter, serverProtocols []string) (string, error) { + if len(serverProtocols) == 0 { + panic(fmt.Errorf("unable to upgrade: serverProtocols is required")) + } + values, ok := req.Header[http.CanonicalHeaderKey(HeaderProtocolVersion)] + if !ok { + err := fmt.Errorf("unable to upgrade: header %s does not exist in request with %d headers", HeaderProtocolVersion, len(req.Header)) + http.Error(w, err.Error(), http.StatusBadRequest) + return "", err + } + if len(values) == 0 { + err := fmt.Errorf("unable to upgrade: header %s is empty", HeaderProtocolVersion) + http.Error(w, err.Error(), http.StatusBadRequest) + return "", err + } + clientProtocols := commaSeparatedHeaderValues(values) + if len(clientProtocols) == 0 { + err := fmt.Errorf("unable to upgrade: header %s contains %s, but no valid protocols", HeaderProtocolVersion, values) + http.Error(w, err.Error(), http.StatusBadRequest) + return "", err + } + + negotiatedProtocol := negotiateProtocol(clientProtocols, serverProtocols) + if len(negotiatedProtocol) == 0 { + for i := range serverProtocols { + w.Header().Add(HeaderAcceptedProtocolVersions, serverProtocols[i]) + } + err := fmt.Errorf("unable to upgrade: unable to negotiate protocol: client supports %v, server accepts %v", clientProtocols, serverProtocols) + http.Error(w, err.Error(), http.StatusForbidden) + return "", err + } + + w.Header().Add(HeaderProtocolVersion, negotiatedProtocol) + return negotiatedProtocol, nil +} diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/connection.go b/vendor/k8s.io/streaming/pkg/httpstream/spdy/connection.go similarity index 97% rename from vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/connection.go rename to vendor/k8s.io/streaming/pkg/httpstream/spdy/connection.go index d4ceab84f0..4a4003b62b 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/connection.go +++ b/vendor/k8s.io/streaming/pkg/httpstream/spdy/connection.go @@ -23,8 +23,8 @@ import ( "time" "github.com/moby/spdystream" - "k8s.io/apimachinery/pkg/util/httpstream" "k8s.io/klog/v2" + "k8s.io/streaming/pkg/httpstream" ) // connection maintains state about a spdystream.Connection and its associated @@ -169,6 +169,7 @@ func (c *connection) newSpdyStream(stream *spdystream.Stream) { err := c.newStreamHandler(stream, replySent) rejectStream := (err != nil) if rejectStream { + //nolint:logcheck // Hopefully this never gets triggered. klog.Warningf("Stream rejected: %v", err) stream.Reset() return @@ -195,6 +196,7 @@ func (c *connection) sendPings(period time.Duration) { case <-t.C: } if _, err := c.ping(); err != nil { + //nolint:logcheck // Hopefully this never gets triggered. klog.V(3).Infof("SPDY Ping failed: %v", err) // Continue, in case this is a transient failure. // c.conn.CloseChan above will tell us when the connection is diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go b/vendor/k8s.io/streaming/pkg/httpstream/spdy/roundtripper.go similarity index 65% rename from vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go rename to vendor/k8s.io/streaming/pkg/httpstream/spdy/roundtripper.go index ed131d112f..41cd65f64f 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/roundtripper.go +++ b/vendor/k8s.io/streaming/pkg/httpstream/spdy/roundtripper.go @@ -21,6 +21,7 @@ import ( "context" "crypto/tls" "encoding/base64" + "encoding/json" "errors" "fmt" "io" @@ -28,18 +29,13 @@ import ( "net/http" "net/http/httputil" "net/url" + "os" "strings" "time" "golang.org/x/net/proxy" - apierrors "k8s.io/apimachinery/pkg/api/errors" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer" - "k8s.io/apimachinery/pkg/util/httpstream" - utilnet "k8s.io/apimachinery/pkg/util/net" - apiproxy "k8s.io/apimachinery/pkg/util/proxy" - "k8s.io/apimachinery/third_party/forked/golang/netutil" + "k8s.io/streaming/pkg/httpstream" + utilnet "k8s.io/utils/net" ) // SpdyRoundTripper knows how to upgrade an HTTP request to one that supports @@ -62,7 +58,8 @@ type SpdyRoundTripper struct { // Dialer is the dialer used to connect. Used if non-nil. Dialer *net.Dialer - // proxier knows which proxy to use given a request, defaults to http.ProxyFromEnvironment + // proxier knows which proxy to use given a request, defaults to a proxier that + // preserves NO_PROXY CIDR behavior while delegating to http.ProxyFromEnvironment. // Used primarily for mocking the proxy discovery in tests. proxier func(req *http.Request) (*url.URL, error) @@ -75,9 +72,19 @@ type SpdyRoundTripper struct { upgradeTransport http.RoundTripper } -var _ utilnet.TLSClientConfigHolder = &SpdyRoundTripper{} +type tlsClientConfigHolder interface { + TLSClientConfig() *tls.Config +} + +type roundTripperWrapper interface { + http.RoundTripper + WrappedRoundTripper() http.RoundTripper +} + +type dialFunc func(ctx context.Context, network, addr string) (net.Conn, error) + +var _ tlsClientConfigHolder = &SpdyRoundTripper{} var _ httpstream.UpgradeRoundTripper = &SpdyRoundTripper{} -var _ utilnet.Dialer = &SpdyRoundTripper{} // NewRoundTripper creates a new SpdyRoundTripper that will use the specified // tlsConfig. @@ -106,14 +113,14 @@ func NewRoundTripperWithConfig(cfg RoundTripperConfig) (*SpdyRoundTripper, error if cfg.TLS != nil || cfg.Proxier != nil { return nil, fmt.Errorf("SpdyRoundTripper: UpgradeTransport is mutually exclusive to TLSConfig or Proxier") } - tlsConfig, err := utilnet.TLSClientConfig(cfg.UpgradeTransport) + tlsConfig, err := tlsConfigForTransport(cfg.UpgradeTransport) if err != nil { - return nil, fmt.Errorf("SpdyRoundTripper: Unable to retrieve TLSConfig from UpgradeTransport: %v", err) + return nil, fmt.Errorf("SpdyRoundTripper: unable to retrieve TLS config from UpgradeTransport: %w", err) } cfg.TLS = tlsConfig } if cfg.Proxier == nil { - cfg.Proxier = utilnet.NewProxierWithNoProxyCIDR(http.ProxyFromEnvironment) + cfg.Proxier = newProxierWithNoProxyCIDR(http.ProxyFromEnvironment) } return &SpdyRoundTripper{ tlsConfig: cfg.TLS, @@ -123,6 +130,47 @@ func NewRoundTripperWithConfig(cfg RoundTripperConfig) (*SpdyRoundTripper, error }, nil } +// newProxierWithNoProxyCIDR preserves CIDR matching in NO_PROXY/no_proxy while +// delegating all other behavior to the supplied proxy function. +func newProxierWithNoProxyCIDR(delegate func(req *http.Request) (*url.URL, error)) func(req *http.Request) (*url.URL, error) { + noProxyEnv := os.Getenv("NO_PROXY") + if noProxyEnv == "" { + noProxyEnv = os.Getenv("no_proxy") + } + noProxyRules := strings.Split(noProxyEnv, ",") + + cidrs := make([]*net.IPNet, 0, len(noProxyRules)) + for _, noProxyRule := range noProxyRules { + noProxyRule = strings.TrimSpace(noProxyRule) + if noProxyRule == "" { + continue + } + _, cidr, err := utilnet.ParseCIDRSloppy(noProxyRule) + if err == nil { + cidrs = append(cidrs, cidr) + } + } + + if len(cidrs) == 0 { + return delegate + } + + return func(req *http.Request) (*url.URL, error) { + ip := utilnet.ParseIPSloppy(req.URL.Hostname()) + if ip == nil { + return delegate(req) + } + + for _, cidr := range cidrs { + if cidr.Contains(ip) { + return nil, nil + } + } + + return delegate(req) + } +} + // RoundTripperConfig is a set of options for an SpdyRoundTripper. type RoundTripperConfig struct { // TLS configuration used by the round tripper if UpgradeTransport not present. @@ -144,12 +192,12 @@ func (s *SpdyRoundTripper) TLSClientConfig() *tls.Config { return s.tlsConfig } -// Dial implements k8s.io/apimachinery/pkg/util/net.Dialer. +// Dial opens a network connection for an upgrade request. func (s *SpdyRoundTripper) Dial(req *http.Request) (net.Conn, error) { var conn net.Conn var err error if s.upgradeTransport != nil { - conn, err = apiproxy.DialURL(req.Context(), req.URL, s.upgradeTransport) + conn, err = dialURLWithTransport(req.Context(), req.URL, s.upgradeTransport) } else { conn, err = s.dial(req) } @@ -190,7 +238,7 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) { // dialWithHttpProxy dials the host specified by url through an http or an https proxy. func (s *SpdyRoundTripper) dialWithHttpProxy(req *http.Request, proxyURL *url.URL) (net.Conn, error) { // ensure we use a canonical host with proxyReq - targetHost := netutil.CanonicalAddr(req.URL) + targetHost := canonicalAddr(req.URL) // proxying logic adapted from http://blog.h6t.eu/post/74098062923/golang-websocket-with-http-proxy-support proxyReq := http.Request{ @@ -234,8 +282,8 @@ func (s *SpdyRoundTripper) dialWithHttpProxy(req *http.Request, proxyURL *url.UR // dialWithSocks5Proxy dials the host specified by url through a socks5 proxy. func (s *SpdyRoundTripper) dialWithSocks5Proxy(req *http.Request, proxyURL *url.URL) (net.Conn, error) { // ensure we use a canonical host with proxyReq - targetHost := netutil.CanonicalAddr(req.URL) - proxyDialAddr := netutil.CanonicalAddr(proxyURL) + targetHost := canonicalAddr(req.URL) + proxyDialAddr := canonicalAddr(proxyURL) var auth *proxy.Auth if proxyURL.User != nil { @@ -304,7 +352,7 @@ func (s *SpdyRoundTripper) tlsConn(ctx context.Context, rwc net.Conn, targetHost // dialWithoutProxy dials the host specified by url, using TLS if appropriate. func (s *SpdyRoundTripper) dialWithoutProxy(ctx context.Context, url *url.URL) (net.Conn, error) { - dialAddr := netutil.CanonicalAddr(url) + dialAddr := canonicalAddr(url) dialer := s.Dialer if dialer == nil { dialer = &net.Dialer{} @@ -336,7 +384,8 @@ func (s *SpdyRoundTripper) proxyAuth(proxyURL *url.URL) string { // clients may call SpdyRoundTripper.Connection() to retrieve the upgraded // connection. func (s *SpdyRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - req = utilnet.CloneRequest(req) + req = req.Clone(req.Context()) + req.Header = req.Header.Clone() req.Header.Add(httpstream.HeaderConnection, httpstream.HeaderUpgrade) req.Header.Add(httpstream.HeaderUpgrade, HeaderSpdy31) @@ -365,35 +414,159 @@ func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connec upgradeHeader := strings.ToLower(resp.Header.Get(httpstream.HeaderUpgrade)) if (resp.StatusCode != http.StatusSwitchingProtocols) || !strings.Contains(connectionHeader, strings.ToLower(httpstream.HeaderUpgrade)) || !strings.Contains(upgradeHeader, strings.ToLower(HeaderSpdy31)) { defer resp.Body.Close() - responseError := "" responseErrorBytes, err := io.ReadAll(resp.Body) if err != nil { - responseError = "unable to read error from server response" - } else { - // TODO: I don't belong here, I should be abstracted from this class - if obj, _, err := statusCodecs.UniversalDecoder().Decode(responseErrorBytes, nil, &metav1.Status{}); err == nil { - if status, ok := obj.(*metav1.Status); ok { - return nil, &apierrors.StatusError{ErrStatus: *status} + return nil, fmt.Errorf("unable to upgrade connection: unable to read error from server response") + } + return nil, fmt.Errorf("unable to upgrade connection: %s", upgradeErrorMessage(responseErrorBytes)) + } + + return NewClientConnectionWithPings(s.conn, s.pingPeriod) +} + +func tlsConfigForTransport(transport http.RoundTripper) (*tls.Config, error) { + if transport == nil { + return nil, nil + } + switch transport := transport.(type) { + case *http.Transport: + return transport.TLSClientConfig, nil + case tlsClientConfigHolder: + return transport.TLSClientConfig(), nil + case roundTripperWrapper: + return tlsConfigForTransport(transport.WrappedRoundTripper()) + default: + return nil, fmt.Errorf("transport %T does not expose TLS client config", transport) + } +} + +func canonicalAddr(url *url.URL) string { + host := url.Hostname() + port := url.Port() + if len(port) == 0 { + switch strings.ToLower(url.Scheme) { + case "http", "ws": + port = "80" + case "https", "wss": + port = "443" + } + } + return net.JoinHostPort(host, port) +} + +func upgradeErrorMessage(responseErrorBytes []byte) string { + type statusLike struct { + Message string `json:"message"` + Error string `json:"error"` + } + + var status statusLike + if err := json.Unmarshal(responseErrorBytes, &status); err == nil { + if msg := strings.TrimSpace(status.Message); msg != "" { + return msg + } + if msg := strings.TrimSpace(status.Error); msg != "" { + return msg + } + } + + msg := strings.TrimSpace(string(responseErrorBytes)) + if msg == "" { + return "empty server response" + } + return msg +} + +func dialURLWithTransport(ctx context.Context, url *url.URL, transport http.RoundTripper) (net.Conn, error) { + dialAddr := canonicalAddr(url) + + dialer, err := dialerFor(transport) + if err != nil { + dialer = nil + } + + switch url.Scheme { + case "http": + if dialer != nil { + return dialer(ctx, "tcp", dialAddr) + } + var d net.Dialer + return d.DialContext(ctx, "tcp", dialAddr) + case "https": + tlsConfig, err := tlsConfigForTransport(transport) + if err != nil { + tlsConfig = nil + } + + if dialer != nil { + netConn, err := dialer(ctx, "tcp", dialAddr) + if err != nil { + return nil, err + } + + if tlsConfig == nil { + tlsConfig = &tls.Config{InsecureSkipVerify: true} + } else if len(tlsConfig.ServerName) == 0 && !tlsConfig.InsecureSkipVerify { + inferredHost := dialAddr + if host, _, err := net.SplitHostPort(dialAddr); err == nil { + inferredHost = host } + tlsConfigCopy := tlsConfig.Clone() + tlsConfigCopy.ServerName = inferredHost + tlsConfig = tlsConfigCopy + } + + if supportsHTTP11(tlsConfig.NextProtos) { + tlsConfig = tlsConfig.Clone() + tlsConfig.NextProtos = []string{"http/1.1"} } - responseError = string(responseErrorBytes) - responseError = strings.TrimSpace(responseError) + + tlsConn := tls.Client(netConn, tlsConfig) + if err := tlsConn.HandshakeContext(ctx); err != nil { + netConn.Close() + return nil, err + } + return tlsConn, nil } - return nil, fmt.Errorf("unable to upgrade connection: %s", responseError) + tlsDialer := tls.Dialer{Config: tlsConfig} + return tlsDialer.DialContext(ctx, "tcp", dialAddr) + default: + return nil, fmt.Errorf("unknown scheme: %s", url.Scheme) } - - return NewClientConnectionWithPings(s.conn, s.pingPeriod) } -// statusScheme is private scheme for the decoding here until someone fixes the TODO in NewConnection -var statusScheme = runtime.NewScheme() +func dialerFor(transport http.RoundTripper) (dialFunc, error) { + if transport == nil { + return nil, nil + } -// ParameterCodec knows about query parameters used with the meta v1 API spec. -var statusCodecs = serializer.NewCodecFactory(statusScheme) + switch transport := transport.(type) { + case *http.Transport: + if transport.DialContext != nil { + return transport.DialContext, nil + } + if transport.Dial != nil { + return func(ctx context.Context, network, addr string) (net.Conn, error) { + return transport.Dial(network, addr) + }, nil + } + return nil, nil + case roundTripperWrapper: + return dialerFor(transport.WrappedRoundTripper()) + default: + return nil, fmt.Errorf("unknown transport type: %T", transport) + } +} -func init() { - statusScheme.AddUnversionedTypes(metav1.SchemeGroupVersion, - &metav1.Status{}, - ) +func supportsHTTP11(nextProtos []string) bool { + if len(nextProtos) == 0 { + return true + } + for _, proto := range nextProtos { + if proto == "http/1.1" { + return true + } + } + return false } diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/upgrade.go b/vendor/k8s.io/streaming/pkg/httpstream/spdy/upgrade.go similarity index 93% rename from vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/upgrade.go rename to vendor/k8s.io/streaming/pkg/httpstream/spdy/upgrade.go index d30ae2fa3d..df47029f4a 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/spdy/upgrade.go +++ b/vendor/k8s.io/streaming/pkg/httpstream/spdy/upgrade.go @@ -26,8 +26,8 @@ import ( "sync/atomic" "time" - "k8s.io/apimachinery/pkg/util/httpstream" - "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/streaming/pkg/httpstream" + "k8s.io/streaming/pkg/runtime" ) const HeaderSpdy31 = "SPDY/3.1" @@ -105,14 +105,14 @@ func (u responseUpgrader) UpgradeResponse(w http.ResponseWriter, req *http.Reque conn, bufrw, err := hijacker.Hijack() if err != nil { - runtime.HandleError(fmt.Errorf("unable to upgrade: error hijacking response: %v", err)) + runtime.HandleErrorWithContext(req.Context(), err, "Unable to upgrade: error hijacking response") return nil } connWithBuf := &connWrapper{Conn: conn, bufReader: bufrw.Reader} spdyConn, err := NewServerConnectionWithPings(connWithBuf, newStreamHandler, u.pingPeriod) if err != nil { - runtime.HandleError(fmt.Errorf("unable to upgrade: error creating SPDY server connection: %v", err)) + runtime.HandleErrorWithContext(req.Context(), err, "Unable to upgrade: error creating SPDY server connection") return nil } diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/conn.go b/vendor/k8s.io/streaming/pkg/httpstream/wsstream/conn.go similarity index 88% rename from vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/conn.go rename to vendor/k8s.io/streaming/pkg/httpstream/wsstream/conn.go index 2e477fee2a..eae80ab4d3 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/conn.go +++ b/vendor/k8s.io/streaming/pkg/httpstream/wsstream/conn.go @@ -26,11 +26,9 @@ import ( "golang.org/x/net/websocket" - "k8s.io/apimachinery/pkg/util/httpstream" - "k8s.io/apimachinery/pkg/util/portforward" - "k8s.io/apimachinery/pkg/util/remotecommand" - "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/klog/v2" + "k8s.io/streaming/pkg/httpstream" + "k8s.io/streaming/pkg/runtime" ) const WebSocketProtocolHeader = "Sec-Websocket-Protocol" @@ -65,6 +63,8 @@ const ChannelWebSocketProtocol = "channel.k8s.io" // CLOSE const Base64ChannelWebSocketProtocol = "base64.channel.k8s.io" +const streamCloseSignal = 255 + type codecType int const ( @@ -126,8 +126,16 @@ func IsWebSocketRequestWithTunnelingProtocol(req *http.Request) bool { // IgnoreReceives reads from a WebSocket until it is closed, then returns. If timeout is set, the // read and write deadlines are pushed every time a new message is received. +// +// Contextual logging: IgnoreReceivesWithLogger should be used instead of IgnoreReceives in code which uses contextual logging. func IgnoreReceives(ws *websocket.Conn, timeout time.Duration) { - defer runtime.HandleCrash() + IgnoreReceivesWithLogger(klog.Background(), ws, timeout) +} + +// IgnoreReceivesWithLogger reads from a WebSocket until it is closed, then returns. If timeout is set, the +// read and write deadlines are pushed every time a new message is received. +func IgnoreReceivesWithLogger(logger klog.Logger, ws *websocket.Conn, timeout time.Duration) { + defer runtime.HandleCrashWithLogger(logger) var data []byte for { resetTimeout(ws, timeout) @@ -236,7 +244,7 @@ func (conn *Conn) Open(w http.ResponseWriter, req *http.Request) (string, []io.R // "conn.ready" and then blocks until serving is complete. select { case <-conn.ready: - klog.V(8).Infof("websocket server initialized--serving") + klog.FromContext(req.Context()).V(8).Info("websocket server initialized--serving") case <-serveHTTPComplete: // websocket server returned before completing initialization; cleanup and return error. conn.closeNonThreadSafe() //nolint:errcheck @@ -316,13 +324,13 @@ func (conn *Conn) Close() error { // supports the stream close signal (currently only V5 remotecommand); // false otherwise. func protocolSupportsStreamClose(protocol string) bool { - return protocol == remotecommand.StreamProtocolV5Name + return protocol == "v5.channel.k8s.io" } // protocolSupportsWebsocketTunneling returns true if the passed protocol // is a tunneled Kubernetes spdy protocol; false otherwise. func protocolSupportsWebsocketTunneling(protocol string) bool { - return strings.HasPrefix(protocol, portforward.WebsocketsSPDYTunnelingPrefix) && strings.HasSuffix(protocol, portforward.KubernetesSuffix) + return strings.HasPrefix(protocol, "SPDY/3.1+") && strings.HasSuffix(protocol, ".k8s.io") } // handle implements a websocket handler. @@ -330,30 +338,36 @@ func (conn *Conn) handle(ws *websocket.Conn) { conn.initialize(ws) defer conn.Close() supportsStreamClose := protocolSupportsStreamClose(conn.selectedProtocol) + // conn.handle is typically used on the server-side and thus we have a request, + // but don't assume that and use klog.Background as fallback. + logger := klog.Background() + if req := ws.Request(); req != nil { + logger = klog.FromContext(req.Context()) + } for { conn.resetTimeout() var data []byte if err := websocket.Message.Receive(ws, &data); err != nil { if err != io.EOF { - klog.Errorf("Error on socket receive: %v", err) + logger.Error(err, "Error on socket receive") } break } if len(data) == 0 { continue } - if supportsStreamClose && data[0] == remotecommand.StreamClose { + if supportsStreamClose && data[0] == streamCloseSignal { if len(data) != 2 { - klog.Errorf("Single channel byte should follow stream close signal. Got %d bytes", len(data)-1) + logger.Error(nil, "Single channel byte should follow stream close signal", "receivedLength", len(data)-1) break } else { channel := data[1] if int(channel) >= len(conn.channels) { - klog.Errorf("Close is targeted for a channel %d that is not valid, possible protocol error", channel) + logger.Error(nil, "Close is targeted for a channel that is not valid, possible protocol error", "channel", channel) break } - klog.V(4).Infof("Received half-close signal from client; close %d stream", channel) + logger.V(4).Info("Received half-close signal from client, close stream", "channel", channel) conn.channels[channel].Close() // After first Close, other closes are noop. } continue @@ -364,11 +378,11 @@ func (conn *Conn) handle(ws *websocket.Conn) { } data = data[1:] if int(channel) >= len(conn.channels) { - klog.V(6).Infof("Frame is targeted for a reader %d that is not valid, possible protocol error", channel) + logger.V(6).Info("Frame is targeted for a reader that is not valid, possible protocol error", "channel", channel) continue } if _, err := conn.channels[channel].DataFromSocket(data); err != nil { - klog.Errorf("Unable to write frame (%d bytes) to %d: %v", len(data), channel, err) + logger.Error(err, "Unable to write frame", "sendLength", len(data), "channel", channel, "err", err) continue } } diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/doc.go b/vendor/k8s.io/streaming/pkg/httpstream/wsstream/doc.go similarity index 100% rename from vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/doc.go rename to vendor/k8s.io/streaming/pkg/httpstream/wsstream/doc.go diff --git a/vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream.go b/vendor/k8s.io/streaming/pkg/httpstream/wsstream/stream.go similarity index 81% rename from vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream.go rename to vendor/k8s.io/streaming/pkg/httpstream/wsstream/stream.go index ba7e6a519a..38cc41a23d 100644 --- a/vendor/k8s.io/apimachinery/pkg/util/httpstream/wsstream/stream.go +++ b/vendor/k8s.io/streaming/pkg/httpstream/wsstream/stream.go @@ -17,6 +17,7 @@ limitations under the License. package wsstream import ( + "context" "encoding/base64" "io" "net/http" @@ -25,7 +26,8 @@ import ( "golang.org/x/net/websocket" - "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/klog/v2" + "k8s.io/streaming/pkg/runtime" ) // The WebSocket subprotocol "binary.k8s.io" will only send messages to the @@ -56,6 +58,7 @@ func NewDefaultReaderProtocols() map[string]ReaderProtocolConfig { // Reader supports returning an arbitrary byte stream over a websocket channel. type Reader struct { + logger klog.Logger err chan error r io.Reader ping bool @@ -63,7 +66,7 @@ type Reader struct { protocols map[string]ReaderProtocolConfig selectedProtocol string - handleCrash func(additionalHandlers ...func(interface{})) // overridable for testing + handleCrash func(ctx context.Context, additionalHandlers ...func(context.Context, interface{})) // overridable for testing } // NewReader creates a WebSocket pipe that will copy the contents of r to a provided @@ -72,13 +75,26 @@ type Reader struct { // // The protocols parameter maps subprotocol names to StreamProtocols. The empty string // subprotocol name is used if websocket.Config.Protocol is empty. +// +//logcheck:context // NewReaderWithLogger should be used instead of NewReader in code which supports contextual logging. func NewReader(r io.Reader, ping bool, protocols map[string]ReaderProtocolConfig) *Reader { + return NewReaderWithLogger(klog.Background(), r, ping, protocols) +} + +// NewReaderWithLogger creates a WebSocket pipe that will copy the contents of r to a provided +// WebSocket connection. If ping is true, a zero length message will be sent to the client +// before the stream begins reading. +// +// The protocols parameter maps subprotocol names to StreamProtocols. The empty string +// subprotocol name is used if websocket.Config.Protocol is empty. +func NewReaderWithLogger(logger klog.Logger, r io.Reader, ping bool, protocols map[string]ReaderProtocolConfig) *Reader { return &Reader{ + logger: logger, r: r, err: make(chan error), ping: ping, protocols: protocols, - handleCrash: runtime.HandleCrash, + handleCrash: runtime.HandleCrashWithContext, } } @@ -100,7 +116,7 @@ func (r *Reader) handshake(config *websocket.Config, req *http.Request) error { // method completes. func (r *Reader) Copy(w http.ResponseWriter, req *http.Request) error { go func() { - defer r.handleCrash() + defer r.handleCrash(req.Context()) websocket.Server{Handshake: r.handshake, Handler: r.handle}.ServeHTTP(w, req) }() return <-r.err @@ -122,10 +138,10 @@ func (r *Reader) handle(ws *websocket.Conn) { defer closeConn() go func() { - defer runtime.HandleCrash() + defer runtime.HandleCrashWithLogger(r.logger) // This blocks until the connection is closed. // Client should not send anything. - IgnoreReceives(ws, r.timeout) + IgnoreReceivesWithLogger(r.logger, ws, r.timeout) // Once the client closes, we should also close closeConn() }() diff --git a/vendor/k8s.io/streaming/pkg/runtime/runtime.go b/vendor/k8s.io/streaming/pkg/runtime/runtime.go new file mode 100644 index 0000000000..25a70b735e --- /dev/null +++ b/vendor/k8s.io/streaming/pkg/runtime/runtime.go @@ -0,0 +1,62 @@ +/* +Copyright 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. +*/ + +package runtime + +import ( + "context" + "fmt" + + "k8s.io/klog/v2" +) + +// HandleError logs an asynchronous error. +func HandleError(err error) { + if err == nil { + return + } + klog.Background().Error(err, "Unhandled Error") +} + +// HandleErrorWithContext logs an asynchronous error with contextual logging when available. +func HandleErrorWithContext(ctx context.Context, err error, msg string, keysAndValues ...interface{}) { + if err == nil { + return + } + klog.FromContext(ctx).Error(err, msg, keysAndValues...) +} + +// HandleCrash recovers from panic and logs it. +func HandleCrash() { + HandleCrashWithLogger(klog.Background()) +} + +// HandleCrashWithContext recovers from panic and logs it with the context logger. +func HandleCrashWithContext(ctx context.Context, additionalHandlers ...func(context.Context, interface{})) { + if r := recover(); r != nil { + for _, fn := range additionalHandlers { + fn(ctx, r) + } + klog.FromContext(ctx).Error(fmt.Errorf("%v", r), "Observed a panic") + } +} + +// HandleCrashWithLogger recovers from panic and logs it using the provided logger. +func HandleCrashWithLogger(logger klog.Logger) { + if r := recover(); r != nil { + logger.Error(fmt.Errorf("%v", r), "Observed a panic") + } +} diff --git a/vendor/k8s.io/utils/buffer/ring_fixed.go b/vendor/k8s.io/utils/buffer/ring_fixed.go new file mode 100644 index 0000000000..a104e12a38 --- /dev/null +++ b/vendor/k8s.io/utils/buffer/ring_fixed.go @@ -0,0 +1,120 @@ +/* +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. +*/ + +package buffer + +import ( + "errors" + "io" +) + +// Compile-time check that *TypedRingFixed[byte] implements io.Writer. +var _ io.Writer = (*TypedRingFixed[byte])(nil) + +// ErrInvalidSize indicates size must be > 0 +var ErrInvalidSize = errors.New("size must be positive") + +// TypedRingFixed is a fixed-size circular buffer for elements of type T. +// Writes overwrite older data, keeping only the last N elements. +// Not thread safe. +type TypedRingFixed[T any] struct { + data []T + size int + writeCursor int + written int64 +} + +// NewTypedRingFixed creates a circular buffer with the given capacity (must be > 0). +func NewTypedRingFixed[T any](size int) (*TypedRingFixed[T], error) { + if size <= 0 { + return nil, ErrInvalidSize + } + return &TypedRingFixed[T]{ + data: make([]T, size), + size: size, + }, nil +} + +// Write writes p to the buffer, overwriting old data if needed. +func (r *TypedRingFixed[T]) Write(p []T) (int, error) { + originalLen := len(p) + r.written += int64(originalLen) + + // If the input is larger than our buffer, only keep the last 'size' elements + if originalLen > r.size { + p = p[originalLen-r.size:] + } + + // Copy data, handling wrap-around + n := len(p) + remain := r.size - r.writeCursor + if n <= remain { + copy(r.data[r.writeCursor:], p) + } else { + copy(r.data[r.writeCursor:], p[:remain]) + copy(r.data, p[remain:]) + } + + r.writeCursor = (r.writeCursor + n) % r.size + return originalLen, nil +} + +// Slice returns buffer contents in write order. Don't modify the returned slice. +func (r *TypedRingFixed[T]) Slice() []T { + if r.written == 0 { + return nil + } + + // Buffer hasn't wrapped yet + if r.written < int64(r.size) { + return r.data[:r.writeCursor] + } + + // Buffer has wrapped - need to return data in correct order + // Data from writeCursor to end is oldest, data from 0 to writeCursor is newest + if r.writeCursor == 0 { + return r.data + } + + out := make([]T, r.size) + copy(out, r.data[r.writeCursor:]) + copy(out[r.size-r.writeCursor:], r.data[:r.writeCursor]) + return out +} + +// Size returns the buffer capacity. +func (r *TypedRingFixed[T]) Size() int { + return r.size +} + +// Len returns how many elements are currently in the buffer. +func (r *TypedRingFixed[T]) Len() int { + if r.written < int64(r.size) { + return int(r.written) + } + return r.size +} + +// TotalWritten returns total elements ever written (including overwritten ones). +func (r *TypedRingFixed[T]) TotalWritten() int64 { + return r.written +} + +// Reset clears the buffer. +func (r *TypedRingFixed[T]) Reset() { + r.writeCursor = 0 + r.written = 0 +} diff --git a/vendor/k8s.io/utils/clock/testing/fake_clock.go b/vendor/k8s.io/utils/clock/testing/fake_clock.go index 9503690be2..7274299ead 100644 --- a/vendor/k8s.io/utils/clock/testing/fake_clock.go +++ b/vendor/k8s.io/utils/clock/testing/fake_clock.go @@ -268,36 +268,36 @@ func (i *IntervalClock) Since(ts time.Time) time.Duration { // After is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) After(d time.Duration) <-chan time.Time { +func (*IntervalClock) After(_ time.Duration) <-chan time.Time { panic("IntervalClock doesn't implement After") } // NewTimer is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) NewTimer(d time.Duration) clock.Timer { +func (*IntervalClock) NewTimer(_ time.Duration) clock.Timer { panic("IntervalClock doesn't implement NewTimer") } // AfterFunc is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) AfterFunc(d time.Duration, f func()) clock.Timer { +func (*IntervalClock) AfterFunc(_ time.Duration, _ func()) clock.Timer { panic("IntervalClock doesn't implement AfterFunc") } // Tick is unimplemented, will panic. // TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) Tick(d time.Duration) <-chan time.Time { +func (*IntervalClock) Tick(_ time.Duration) <-chan time.Time { panic("IntervalClock doesn't implement Tick") } // NewTicker has no implementation yet and is omitted. // TODO: make interval clock use FakeClock so this can be implemented. -func (*IntervalClock) NewTicker(d time.Duration) clock.Ticker { +func (*IntervalClock) NewTicker(_ time.Duration) clock.Ticker { panic("IntervalClock doesn't implement NewTicker") } // Sleep is unimplemented, will panic. -func (*IntervalClock) Sleep(d time.Duration) { +func (*IntervalClock) Sleep(_ time.Duration) { panic("IntervalClock doesn't implement Sleep") } diff --git a/vendor/k8s.io/apimachinery/pkg/util/dump/dump.go b/vendor/k8s.io/utils/dump/dump.go similarity index 100% rename from vendor/k8s.io/apimachinery/pkg/util/dump/dump.go rename to vendor/k8s.io/utils/dump/dump.go diff --git a/vendor/k8s.io/utils/exec/exec.go b/vendor/k8s.io/utils/exec/exec.go index d9c91e3ca3..b7cde7fd83 100644 --- a/vendor/k8s.io/utils/exec/exec.go +++ b/vendor/k8s.io/utils/exec/exec.go @@ -18,6 +18,7 @@ package exec import ( "context" + "errors" "io" "io/fs" osexec "os/exec" @@ -97,6 +98,21 @@ func New() Interface { return &executor{} } +// maskErrDotCmd reverts the behavior of osexec.Cmd to what it was before go1.19 +// specifically set the Err field to nil (LookPath returns a new error when the file +// is resolved to the current directory. +func maskErrDotCmd(cmd *osexec.Cmd) *osexec.Cmd { + cmd.Err = maskErrDot(cmd.Err) + return cmd +} + +func maskErrDot(err error) error { + if err != nil && errors.Is(err, osexec.ErrDot) { + return nil + } + return err +} + // Command is part of the Interface interface. func (executor *executor) Command(cmd string, args ...string) Cmd { return (*cmdWrapper)(maskErrDotCmd(osexec.Command(cmd, args...))) diff --git a/vendor/k8s.io/utils/exec/fixup_go119.go b/vendor/k8s.io/utils/exec/fixup_go119.go deleted file mode 100644 index 55874c9297..0000000000 --- a/vendor/k8s.io/utils/exec/fixup_go119.go +++ /dev/null @@ -1,40 +0,0 @@ -//go:build go1.19 -// +build go1.19 - -/* -Copyright 2022 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. -*/ - -package exec - -import ( - "errors" - osexec "os/exec" -) - -// maskErrDotCmd reverts the behavior of osexec.Cmd to what it was before go1.19 -// specifically set the Err field to nil (LookPath returns a new error when the file -// is resolved to the current directory. -func maskErrDotCmd(cmd *osexec.Cmd) *osexec.Cmd { - cmd.Err = maskErrDot(cmd.Err) - return cmd -} - -func maskErrDot(err error) error { - if err != nil && errors.Is(err, osexec.ErrDot) { - return nil - } - return err -} diff --git a/vendor/k8s.io/utils/strings/slices/slices.go b/vendor/k8s.io/utils/strings/slices/slices.go index 8e21838f24..35657a7fcd 100644 --- a/vendor/k8s.io/utils/strings/slices/slices.go +++ b/vendor/k8s.io/utils/strings/slices/slices.go @@ -20,27 +20,23 @@ limitations under the License. // replace "stringslices" if the "slices" package becomes standard. package slices +import goslices "slices" + // Equal reports whether two slices are equal: the same length and all // elements equal. If the lengths are different, Equal returns false. // Otherwise, the elements are compared in index order, and the // comparison stops at the first unequal pair. -func Equal(s1, s2 []string) bool { - if len(s1) != len(s2) { - return false - } - for i, n := range s1 { - if n != s2[i] { - return false - } - } - return true -} +// +// Deprecated: use stdlib slices.Equal instead. +var Equal = goslices.Equal[[]string] // Filter appends to d each element e of s for which keep(e) returns true. // It returns the modified d. d may be s[:0], in which case the kept // elements will be stored in the same slice. // if the slices overlap in some other way, the results are unspecified. // To create a new slice with the filtered results, pass nil for d. +// +// Deprecated: use stdlib slices.DeleteFunc instead. func Filter(d, s []string, keep func(string) bool) []string { for _, n := range s { if keep(n) { @@ -51,32 +47,17 @@ func Filter(d, s []string, keep func(string) bool) []string { } // Contains reports whether v is present in s. -func Contains(s []string, v string) bool { - return Index(s, v) >= 0 -} +// +// Deprecated: use stdlib slices.Contains instead. +var Contains = goslices.Contains[[]string] // Index returns the index of the first occurrence of v in s, or -1 if // not present. -func Index(s []string, v string) int { - // "Contains" may be replaced with "Index(s, v) >= 0": - // https://github.com/golang/go/issues/45955#issuecomment-873377947 - for i, n := range s { - if n == v { - return i - } - } - return -1 -} - -// Functions below are not in https://github.com/golang/go/issues/45955 +// +// Deprecated: use stdlib slices.Index instead. +var Index = goslices.Index[[]string] // Clone returns a new clone of s. -func Clone(s []string) []string { - // https://github.com/go101/go101/wiki/There-is-not-a-perfect-way-to-clone-slices-in-Go - if s == nil { - return nil - } - c := make([]string, len(s)) - copy(c, s) - return c -} +// +// Deprecated: use stdlib slices.Clone instead. +var Clone = goslices.Clone[[]string] diff --git a/vendor/k8s.io/utils/third_party/forked/golang/LICENSE b/vendor/k8s.io/utils/third_party/forked/golang/LICENSE new file mode 100644 index 0000000000..7448756763 --- /dev/null +++ b/vendor/k8s.io/utils/third_party/forked/golang/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/k8s.io/utils/third_party/forked/golang/PATENTS b/vendor/k8s.io/utils/third_party/forked/golang/PATENTS new file mode 100644 index 0000000000..733099041f --- /dev/null +++ b/vendor/k8s.io/utils/third_party/forked/golang/PATENTS @@ -0,0 +1,22 @@ +Additional IP Rights Grant (Patents) + +"This implementation" means the copyrightable works distributed by +Google as part of the Go project. + +Google hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) +patent license to make, have made, use, offer to sell, sell, import, +transfer and otherwise run, modify and propagate the contents of this +implementation of Go, where such license applies only to those patent +claims, both currently owned or controlled by Google and acquired in +the future, licensable by Google that are necessarily infringed by this +implementation of Go. This grant does not include claims that would be +infringed only as a consequence of further modification of this +implementation. If you or your agent or exclusive licensee institute or +order or agree to the institution of patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging +that this implementation of Go or any code incorporated within this +implementation of Go constitutes direct or contributory patent +infringement, or inducement of patent infringement, then any patent +rights granted to you under this License for this implementation of Go +shall terminate as of the date such litigation is filed. diff --git a/vendor/k8s.io/utils/third_party/forked/golang/btree/LICENSE b/vendor/k8s.io/utils/third_party/forked/golang/btree/LICENSE new file mode 100644 index 0000000000..7a4a3ea242 --- /dev/null +++ b/vendor/k8s.io/utils/third_party/forked/golang/btree/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. \ No newline at end of file diff --git a/vendor/k8s.io/utils/third_party/forked/golang/btree/README.md b/vendor/k8s.io/utils/third_party/forked/golang/btree/README.md new file mode 100644 index 0000000000..643ad5e9db --- /dev/null +++ b/vendor/k8s.io/utils/third_party/forked/golang/btree/README.md @@ -0,0 +1,7 @@ +This package is forked from https://github.com/google/btree. + +The upstream repository is deprecated. Kubernetes maintains this fork to continue supporting existing usage. + +Only the subset of functionality required by Kubernetes is included. The implementation is based on the generic version introduced in Go 1.18. + +The core B-tree algorithm is unchanged from the upstream implementation. \ No newline at end of file diff --git a/vendor/github.com/google/btree/btree.go b/vendor/k8s.io/utils/third_party/forked/golang/btree/btree.go similarity index 66% rename from vendor/github.com/google/btree/btree.go rename to vendor/k8s.io/utils/third_party/forked/golang/btree/btree.go index 6f5184fef7..88c0352b2d 100644 --- a/vendor/github.com/google/btree/btree.go +++ b/vendor/k8s.io/utils/third_party/forked/golang/btree/btree.go @@ -1,4 +1,8 @@ -// Copyright 2014 Google Inc. +// Copyright 2014-2022 Google Inc. +// Copyright 2025 The Kubernetes Authors. +// +// This file is derived from github.com/google/btree and has been +// modified for use in the Kubernetes util package. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,9 +16,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -//go:build !go1.18 -// +build !go1.18 - // Package btree implements in-memory B-Trees of arbitrary degree. // // btree implements an in-memory B-Tree for use as an ordered data structure. @@ -23,7 +24,9 @@ // It has a flatter structure than an equivalent red-black or other binary tree, // which in some cases yields better memory usage and/or performance. // See some discussion on the matter here: -// http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html +// +// http://google-opensource.blogspot.com/2013/01/c-containers-that-save-memory-and-time.html +// // Note, though, that this project is in no way related to the C++ B-Tree // implementation written about there. // @@ -31,13 +34,14 @@ // slice of children. For basic numeric values or raw structs, this can cause // efficiency differences when compared to equivalent C++ template code that // stores values in arrays within the node: -// * Due to the overhead of storing values as interfaces (each +// - Due to the overhead of storing values as interfaces (each // value needs to be stored as the value itself, then 2 words for the // interface pointing to that value and its type), resulting in higher // memory use. -// * Since interfaces can point to values anywhere in memory, values are +// - Since interfaces can point to values anywhere in memory, values are // most likely not stored in contiguous blocks, resulting in a higher // number of cache misses. +// // These issues don't tend to matter, though, when working with strings or other // heap-allocated structures, since C++-equivalent structures also must store // pointers and also distribute their values across the heap. @@ -51,53 +55,35 @@ package btree import ( - "fmt" - "io" + "cmp" "sort" - "strings" "sync" ) -// Item represents a single object in the tree. -type Item interface { - // Less tests whether the current item is less than the given argument. - // - // This must provide a strict weak ordering. - // If !a.Less(b) && !b.Less(a), we treat this to mean a == b (i.e. we can only - // hold one of either a or b in the tree). - Less(than Item) bool -} - -const ( - DefaultFreeListSize = 32 -) - -var ( - nilItems = make(items, 16) - nilChildren = make(children, 16) -) +// DefaultFreeListSize is the default capacity of a BTree node free list. +const DefaultFreeListSize = 32 // FreeList represents a free list of btree nodes. By default each // BTree has its own FreeList, but multiple BTrees can share the same -// FreeList. +// FreeList, in particular when they're created with Clone. // Two Btrees using the same freelist are safe for concurrent write access. -type FreeList struct { +type FreeList[T any] struct { mu sync.Mutex - freelist []*node + freelist []*node[T] } // NewFreeList creates a new free list. // size is the maximum size of the returned free list. -func NewFreeList(size int) *FreeList { - return &FreeList{freelist: make([]*node, 0, size)} +func NewFreeList[T any](size int) *FreeList[T] { + return &FreeList[T]{freelist: make([]*node[T], 0, size)} } -func (f *FreeList) newNode() (n *node) { +func (f *FreeList[T]) newNode() (n *node[T]) { f.mu.Lock() index := len(f.freelist) - 1 if index < 0 { f.mu.Unlock() - return new(node) + return new(node[T]) } n = f.freelist[index] f.freelist[index] = nil @@ -106,9 +92,7 @@ func (f *FreeList) newNode() (n *node) { return } -// freeNode adds the given node to the list, returning true if it was added -// and false if it was discarded. -func (f *FreeList) freeNode(n *node) (out bool) { +func (f *FreeList[T]) freeNode(n *node[T]) (out bool) { f.mu.Lock() if len(f.freelist) < cap(f.freelist) { f.freelist = append(f.freelist, n) @@ -118,37 +102,50 @@ func (f *FreeList) freeNode(n *node) (out bool) { return } -// ItemIterator allows callers of Ascend* to iterate in-order over portions of +// ItemIterator allows callers of {A/De}scend* to iterate in-order over portions of // the tree. When this function returns false, iteration will stop and the // associated Ascend* function will immediately return. -type ItemIterator func(i Item) bool +type ItemIterator[T any] func(item T) bool + +// Less returns a default LessFunc that uses the '<' operator for types that support it. +func Less[T cmp.Ordered]() LessFunc[T] { + return func(a, b T) bool { return a < b } +} + +// NewOrdered creates a new B-Tree for ordered types. +func NewOrdered[T cmp.Ordered](degree int) *BTree[T] { + return New[T](degree, Less[T]()) +} // New creates a new B-Tree with the given degree. // // New(2), for example, will create a 2-3-4 tree (each node contains 1-3 items // and 2-4 children). -func New(degree int) *BTree { - return NewWithFreeList(degree, NewFreeList(DefaultFreeListSize)) +// +// The passed-in LessFunc determines how objects of type T are ordered. +func New[T any](degree int, less LessFunc[T]) *BTree[T] { + return NewWithFreeList(degree, less, NewFreeList[T](DefaultFreeListSize)) } // NewWithFreeList creates a new B-Tree that uses the given node free list. -func NewWithFreeList(degree int, f *FreeList) *BTree { +func NewWithFreeList[T any](degree int, less LessFunc[T], f *FreeList[T]) *BTree[T] { if degree <= 1 { panic("bad degree") } - return &BTree{ + return &BTree[T]{ degree: degree, - cow: ©OnWriteContext{freelist: f}, + cow: ©OnWriteContext[T]{freelist: f, less: less}, } } // items stores items in a node. -type items []Item +type items[T any] []T // insertAt inserts a value into the given index, pushing all subsequent values // forward. -func (s *items) insertAt(index int, item Item) { - *s = append(*s, nil) +func (s *items[T]) insertAt(index int, item T) { + var zero T + *s = append(*s, zero) if index < len(*s) { copy((*s)[index+1:], (*s)[index:]) } @@ -157,100 +154,61 @@ func (s *items) insertAt(index int, item Item) { // removeAt removes a value at a given index, pulling all subsequent values // back. -func (s *items) removeAt(index int) Item { +func (s *items[T]) removeAt(index int) T { item := (*s)[index] copy((*s)[index:], (*s)[index+1:]) - (*s)[len(*s)-1] = nil + var zero T + (*s)[len(*s)-1] = zero *s = (*s)[:len(*s)-1] return item } // pop removes and returns the last element in the list. -func (s *items) pop() (out Item) { +func (s *items[T]) pop() (out T) { index := len(*s) - 1 out = (*s)[index] - (*s)[index] = nil + var zero T + (*s)[index] = zero *s = (*s)[:index] return } // truncate truncates this instance at index so that it contains only the // first index items. index must be less than or equal to length. -func (s *items) truncate(index int) { - var toClear items +func (s *items[T]) truncate(index int) { + var toClear items[T] *s, toClear = (*s)[:index], (*s)[index:] - for len(toClear) > 0 { - toClear = toClear[copy(toClear, nilItems):] + var zero T + for i := 0; i < len(toClear); i++ { + toClear[i] = zero } } // find returns the index where the given item should be inserted into this // list. 'found' is true if the item already exists in the list at the given // index. -func (s items) find(item Item) (index int, found bool) { +func (s items[T]) find(item T, less func(T, T) bool) (index int, found bool) { i := sort.Search(len(s), func(i int) bool { - return item.Less(s[i]) + return less(item, s[i]) }) - if i > 0 && !s[i-1].Less(item) { + if i > 0 && !less(s[i-1], item) { return i - 1, true } return i, false } -// children stores child nodes in a node. -type children []*node - -// insertAt inserts a value into the given index, pushing all subsequent values -// forward. -func (s *children) insertAt(index int, n *node) { - *s = append(*s, nil) - if index < len(*s) { - copy((*s)[index+1:], (*s)[index:]) - } - (*s)[index] = n -} - -// removeAt removes a value at a given index, pulling all subsequent values -// back. -func (s *children) removeAt(index int) *node { - n := (*s)[index] - copy((*s)[index:], (*s)[index+1:]) - (*s)[len(*s)-1] = nil - *s = (*s)[:len(*s)-1] - return n -} - -// pop removes and returns the last element in the list. -func (s *children) pop() (out *node) { - index := len(*s) - 1 - out = (*s)[index] - (*s)[index] = nil - *s = (*s)[:index] - return -} - -// truncate truncates this instance at index so that it contains only the -// first index children. index must be less than or equal to length. -func (s *children) truncate(index int) { - var toClear children - *s, toClear = (*s)[:index], (*s)[index:] - for len(toClear) > 0 { - toClear = toClear[copy(toClear, nilChildren):] - } -} - // node is an internal node in a tree. // // It must at all times maintain the invariant that either -// * len(children) == 0, len(items) unconstrained -// * len(children) == len(items) + 1 -type node struct { - items items - children children - cow *copyOnWriteContext +// - len(children) == 0, len(items) unconstrained +// - len(children) == len(items) + 1 +type node[T any] struct { + items items[T] + children items[*node[T]] + cow *copyOnWriteContext[T] } -func (n *node) mutableFor(cow *copyOnWriteContext) *node { +func (n *node[T]) mutableFor(cow *copyOnWriteContext[T]) *node[T] { if n.cow == cow { return n } @@ -258,20 +216,20 @@ func (n *node) mutableFor(cow *copyOnWriteContext) *node { if cap(out.items) >= len(n.items) { out.items = out.items[:len(n.items)] } else { - out.items = make(items, len(n.items), cap(n.items)) + out.items = make(items[T], len(n.items), cap(n.items)) } copy(out.items, n.items) // Copy children if cap(out.children) >= len(n.children) { out.children = out.children[:len(n.children)] } else { - out.children = make(children, len(n.children), cap(n.children)) + out.children = make(items[*node[T]], len(n.children), cap(n.children)) } copy(out.children, n.children) return out } -func (n *node) mutableChild(i int) *node { +func (n *node[T]) mutableChild(i int) *node[T] { c := n.children[i].mutableFor(n.cow) n.children[i] = c return c @@ -280,7 +238,7 @@ func (n *node) mutableChild(i int) *node { // split splits the given node at the given index. The current node shrinks, // and this function returns the item that existed at that index and a new node // containing all items/children after it. -func (n *node) split(i int) (Item, *node) { +func (n *node[T]) split(i int) (T, *node[T]) { item := n.items[i] next := n.cow.newNode() next.items = append(next.items, n.items[i+1:]...) @@ -294,7 +252,7 @@ func (n *node) split(i int) (Item, *node) { // maybeSplitChild checks if a child should be split, and if so splits it. // Returns whether or not a split occurred. -func (n *node) maybeSplitChild(i, maxItems int) bool { +func (n *node[T]) maybeSplitChild(i, maxItems int) bool { if len(n.children[i].items) < maxItems { return false } @@ -308,70 +266,70 @@ func (n *node) maybeSplitChild(i, maxItems int) bool { // insert inserts an item into the subtree rooted at this node, making sure // no nodes in the subtree exceed maxItems items. Should an equivalent item be // be found/replaced by insert, it will be returned. -func (n *node) insert(item Item, maxItems int) Item { - i, found := n.items.find(item) +func (n *node[T]) insert(item T, maxItems int) (_ T, _ bool) { + i, found := n.items.find(item, n.cow.less) if found { out := n.items[i] n.items[i] = item - return out + return out, true } if len(n.children) == 0 { n.items.insertAt(i, item) - return nil + return } if n.maybeSplitChild(i, maxItems) { inTree := n.items[i] switch { - case item.Less(inTree): + case n.cow.less(item, inTree): // no change, we want first split node - case inTree.Less(item): + case n.cow.less(inTree, item): i++ // we want second split node default: out := n.items[i] n.items[i] = item - return out + return out, true } } return n.mutableChild(i).insert(item, maxItems) } // get finds the given key in the subtree and returns it. -func (n *node) get(key Item) Item { - i, found := n.items.find(key) +func (n *node[T]) get(key T) (_ T, _ bool) { + i, found := n.items.find(key, n.cow.less) if found { - return n.items[i] + return n.items[i], true } else if len(n.children) > 0 { return n.children[i].get(key) } - return nil + return } // min returns the first item in the subtree. -func min(n *node) Item { +func min[T any](n *node[T]) (_ T, found bool) { if n == nil { - return nil + return } for len(n.children) > 0 { n = n.children[0] } if len(n.items) == 0 { - return nil + return } - return n.items[0] + return n.items[0], true } // max returns the last item in the subtree. -func max(n *node) Item { +func max[T any](n *node[T]) (_ T, found bool) { if n == nil { - return nil + return } for len(n.children) > 0 { n = n.children[len(n.children)-1] } if len(n.items) == 0 { - return nil + return } - return n.items[len(n.items)-1] + return n.items[len(n.items)-1], true } // toRemove details what item to remove in a node.remove call. @@ -384,27 +342,27 @@ const ( ) // remove removes an item from the subtree rooted at this node. -func (n *node) remove(item Item, minItems int, typ toRemove) Item { +func (n *node[T]) remove(item T, minItems int, typ toRemove) (_ T, _ bool) { var i int var found bool switch typ { case removeMax: if len(n.children) == 0 { - return n.items.pop() + return n.items.pop(), true } i = len(n.items) case removeMin: if len(n.children) == 0 { - return n.items.removeAt(0) + return n.items.removeAt(0), true } i = 0 case removeItem: - i, found = n.items.find(item) + i, found = n.items.find(item, n.cow.less) if len(n.children) == 0 { if found { - return n.items.removeAt(i) + return n.items.removeAt(i), true } - return nil + return } default: panic("invalid type") @@ -424,8 +382,9 @@ func (n *node) remove(item Item, minItems int, typ toRemove) Item { // We use our special-case 'remove' call with typ=maxItem to pull the // predecessor of item i (the rightmost leaf of our immediate left child) // and set it into where we pulled the item from. - n.items[i] = child.remove(nil, minItems, removeMax) - return out + var zero T + n.items[i], _ = child.remove(zero, minItems, removeMax) + return out, true } // Final recursive call. Once we're here, we know that the item isn't in this // node and that the child is big enough to remove from. @@ -437,21 +396,26 @@ func (n *node) remove(item Item, minItems int, typ toRemove) Item { // remove it. // // Most documentation says we have to do two sets of special casing: -// 1) item is in this node -// 2) item is in child +// 1. item is in this node +// 2. item is in child +// // In both cases, we need to handle the two subcases: -// A) node has enough values that it can spare one -// B) node doesn't have enough values +// +// A) node has enough values that it can spare one +// B) node doesn't have enough values +// // For the latter, we have to check: -// a) left sibling has node to spare -// b) right sibling has node to spare -// c) we must merge +// +// a) left sibling has node to spare +// b) right sibling has node to spare +// c) we must merge +// // To simplify our code here, we handle cases #1 and #2 the same: // If a node doesn't have enough items, we make sure it does (using a,b,c). // We then simply redo our remove call, and the second time (regardless of // whether we're in case 1 or 2), we'll have enough items and can guarantee // that we hit case A. -func (n *node) growChildAndRemove(i int, item Item, minItems int, typ toRemove) Item { +func (n *node[T]) growChildAndRemove(i int, item T, minItems int, typ toRemove) (T, bool) { if i > 0 && len(n.children[i-1].items) > minItems { // Steal from left child child := n.mutableChild(i) @@ -479,7 +443,7 @@ func (n *node) growChildAndRemove(i int, item Item, minItems int, typ toRemove) child := n.mutableChild(i) // merge with right child mergeItem := n.items.removeAt(i) - mergeChild := n.children.removeAt(i + 1).mutableFor(n.cow) + mergeChild := n.children.removeAt(i + 1) child.items = append(child.items, mergeItem) child.items = append(child.items, mergeChild.items...) child.children = append(child.children, mergeChild.children...) @@ -495,6 +459,18 @@ const ( ascend = direction(+1) ) +type optionalItem[T any] struct { + item T + valid bool +} + +func optional[T any](item T) optionalItem[T] { + return optionalItem[T]{item: item, valid: true} +} +func empty[T any]() optionalItem[T] { + return optionalItem[T]{} +} + // iterate provides a simple method for iterating over elements in the tree. // // When ascending, the 'start' should be less than 'stop' and when descending, @@ -502,13 +478,13 @@ const ( // will force the iterator to include the first item when it equals 'start', // thus creating a "greaterOrEqual" or "lessThanEqual" rather than just a // "greaterThan" or "lessThan" queries. -func (n *node) iterate(dir direction, start, stop Item, includeStart bool, hit bool, iter ItemIterator) (bool, bool) { +func (n *node[T]) iterate(dir direction, start, stop optionalItem[T], includeStart bool, hit bool, iter ItemIterator[T]) (bool, bool) { var ok, found bool var index int switch dir { case ascend: - if start != nil { - index, _ = n.items.find(start) + if start.valid { + index, _ = n.items.find(start.item, n.cow.less) } for i := index; i < len(n.items); i++ { if len(n.children) > 0 { @@ -516,12 +492,12 @@ func (n *node) iterate(dir direction, start, stop Item, includeStart bool, hit b return hit, false } } - if !includeStart && !hit && start != nil && !start.Less(n.items[i]) { + if !includeStart && !hit && start.valid && !n.cow.less(start.item, n.items[i]) { hit = true continue } hit = true - if stop != nil && !n.items[i].Less(stop) { + if stop.valid && !n.cow.less(n.items[i], stop.item) { return hit, false } if !iter(n.items[i]) { @@ -534,8 +510,8 @@ func (n *node) iterate(dir direction, start, stop Item, includeStart bool, hit b } } case descend: - if start != nil { - index, found = n.items.find(start) + if start.valid { + index, found = n.items.find(start.item, n.cow.less) if !found { index = index - 1 } @@ -543,8 +519,8 @@ func (n *node) iterate(dir direction, start, stop Item, includeStart bool, hit b index = len(n.items) - 1 } for i := index; i >= 0; i-- { - if start != nil && !n.items[i].Less(start) { - if !includeStart || hit || start.Less(n.items[i]) { + if start.valid && !n.cow.less(n.items[i], start.item) { + if !includeStart || hit || n.cow.less(start.item, n.items[i]) { continue } } @@ -553,7 +529,7 @@ func (n *node) iterate(dir direction, start, stop Item, includeStart bool, hit b return hit, false } } - if stop != nil && !stop.Less(n.items[i]) { + if stop.valid && !n.cow.less(stop.item, n.items[i]) { return hit, false // continue } hit = true @@ -570,28 +546,24 @@ func (n *node) iterate(dir direction, start, stop Item, includeStart bool, hit b return hit, true } -// Used for testing/debugging purposes. -func (n *node) print(w io.Writer, level int) { - fmt.Fprintf(w, "%sNODE:%v\n", strings.Repeat(" ", level), n.items) - for _, c := range n.children { - c.print(w, level+1) - } -} - -// BTree is an implementation of a B-Tree. +// BTree is a generic implementation of a B-Tree. // -// BTree stores Item instances in an ordered structure, allowing easy insertion, +// BTree stores items of type T in an ordered structure, allowing easy insertion, // removal, and iteration. // // Write operations are not safe for concurrent mutation by multiple // goroutines, but Read operations are. -type BTree struct { +type BTree[T any] struct { degree int length int - root *node - cow *copyOnWriteContext + root *node[T] + cow *copyOnWriteContext[T] } +// LessFunc determines how to order a type 'T'. It should implement a strict +// ordering, and should return true if within that ordering, 'a' < 'b'. +type LessFunc[T any] func(a, b T) bool + // copyOnWriteContext pointers determine node ownership... a tree with a write // context equivalent to a node's write context is allowed to modify that node. // A tree whose write context does not match a node's is not allowed to modify @@ -606,8 +578,9 @@ type BTree struct { // tree's context, that node is modifiable in place. Children of that node may // not share context, but before we descend into them, we'll make a mutable // copy. -type copyOnWriteContext struct { - freelist *FreeList +type copyOnWriteContext[T any] struct { + freelist *FreeList[T] + less LessFunc[T] } // Clone clones the btree, lazily. Clone should not be called concurrently, @@ -621,7 +594,7 @@ type copyOnWriteContext struct { // will initially experience minor slow-downs caused by additional allocs and // copies due to the aforementioned copy-on-write logic, but should converge to // the original performance characteristics of the original tree. -func (t *BTree) Clone() (t2 *BTree) { +func (t *BTree[T]) Clone() (t2 *BTree[T]) { // Create two entirely new copy-on-write contexts. // This operation effectively creates three trees: // the original, shared nodes (old b.cow) @@ -635,17 +608,17 @@ func (t *BTree) Clone() (t2 *BTree) { } // maxItems returns the max number of items to allow per node. -func (t *BTree) maxItems() int { +func (t *BTree[T]) maxItems() int { return t.degree*2 - 1 } // minItems returns the min number of items to allow per node (ignored for the // root node). -func (t *BTree) minItems() int { +func (t *BTree[T]) minItems() int { return t.degree - 1 } -func (c *copyOnWriteContext) newNode() (n *node) { +func (c *copyOnWriteContext[T]) newNode() (n *node[T]) { n = c.freelist.newNode() n.cow = c return @@ -662,7 +635,7 @@ const ( // freeNode frees a node within a given COW context, if it's owned by that // context. It returns what happened to the node (see freeType const // documentation). -func (c *copyOnWriteContext) freeNode(n *node) freeType { +func (c *copyOnWriteContext[T]) freeNode(n *node[T]) freeType { if n.cow == c { // clear to allow GC n.items.truncate(0) @@ -670,178 +643,175 @@ func (c *copyOnWriteContext) freeNode(n *node) freeType { n.cow = nil if c.freelist.freeNode(n) { return ftStored - } else { - return ftFreelistFull } - } else { - return ftNotOwned + return ftFreelistFull } + return ftNotOwned } // ReplaceOrInsert adds the given item to the tree. If an item in the tree -// already equals the given one, it is removed from the tree and returned. -// Otherwise, nil is returned. +// already equals the given one, it is removed from the tree and returned, +// and the second return value is true. Otherwise, (zeroValue, false) // // nil cannot be added to the tree (will panic). -func (t *BTree) ReplaceOrInsert(item Item) Item { - if item == nil { - panic("nil item being added to BTree") - } +func (t *BTree[T]) ReplaceOrInsert(item T) (_ T, _ bool) { if t.root == nil { t.root = t.cow.newNode() t.root.items = append(t.root.items, item) t.length++ - return nil - } else { - t.root = t.root.mutableFor(t.cow) - if len(t.root.items) >= t.maxItems() { - item2, second := t.root.split(t.maxItems() / 2) - oldroot := t.root - t.root = t.cow.newNode() - t.root.items = append(t.root.items, item2) - t.root.children = append(t.root.children, oldroot, second) - } + return + } + t.root = t.root.mutableFor(t.cow) + if len(t.root.items) >= t.maxItems() { + item2, second := t.root.split(t.maxItems() / 2) + oldroot := t.root + t.root = t.cow.newNode() + t.root.items = append(t.root.items, item2) + t.root.children = append(t.root.children, oldroot, second) } - out := t.root.insert(item, t.maxItems()) - if out == nil { + out, outb := t.root.insert(item, t.maxItems()) + if !outb { t.length++ } - return out + return out, outb } // Delete removes an item equal to the passed in item from the tree, returning -// it. If no such item exists, returns nil. -func (t *BTree) Delete(item Item) Item { +// it. If no such item exists, returns (zeroValue, false). +func (t *BTree[T]) Delete(item T) (T, bool) { return t.deleteItem(item, removeItem) } // DeleteMin removes the smallest item in the tree and returns it. -// If no such item exists, returns nil. -func (t *BTree) DeleteMin() Item { - return t.deleteItem(nil, removeMin) +// If no such item exists, returns (zeroValue, false). +func (t *BTree[T]) DeleteMin() (T, bool) { + var zero T + return t.deleteItem(zero, removeMin) } // DeleteMax removes the largest item in the tree and returns it. -// If no such item exists, returns nil. -func (t *BTree) DeleteMax() Item { - return t.deleteItem(nil, removeMax) +// If no such item exists, returns (zeroValue, false). +func (t *BTree[T]) DeleteMax() (T, bool) { + var zero T + return t.deleteItem(zero, removeMax) } -func (t *BTree) deleteItem(item Item, typ toRemove) Item { +func (t *BTree[T]) deleteItem(item T, typ toRemove) (_ T, _ bool) { if t.root == nil || len(t.root.items) == 0 { - return nil + return } t.root = t.root.mutableFor(t.cow) - out := t.root.remove(item, t.minItems(), typ) + out, outb := t.root.remove(item, t.minItems(), typ) if len(t.root.items) == 0 && len(t.root.children) > 0 { oldroot := t.root t.root = t.root.children[0] t.cow.freeNode(oldroot) } - if out != nil { + if outb { t.length-- } - return out + return out, outb } // AscendRange calls the iterator for every value in the tree within the range // [greaterOrEqual, lessThan), until iterator returns false. -func (t *BTree) AscendRange(greaterOrEqual, lessThan Item, iterator ItemIterator) { +func (t *BTree[T]) AscendRange(greaterOrEqual, lessThan T, iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(ascend, greaterOrEqual, lessThan, true, false, iterator) + t.root.iterate(ascend, optional[T](greaterOrEqual), optional[T](lessThan), true, false, iterator) } // AscendLessThan calls the iterator for every value in the tree within the range // [first, pivot), until iterator returns false. -func (t *BTree) AscendLessThan(pivot Item, iterator ItemIterator) { +func (t *BTree[T]) AscendLessThan(pivot T, iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(ascend, nil, pivot, false, false, iterator) + t.root.iterate(ascend, empty[T](), optional(pivot), false, false, iterator) } // AscendGreaterOrEqual calls the iterator for every value in the tree within // the range [pivot, last], until iterator returns false. -func (t *BTree) AscendGreaterOrEqual(pivot Item, iterator ItemIterator) { +func (t *BTree[T]) AscendGreaterOrEqual(pivot T, iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(ascend, pivot, nil, true, false, iterator) + t.root.iterate(ascend, optional[T](pivot), empty[T](), true, false, iterator) } // Ascend calls the iterator for every value in the tree within the range // [first, last], until iterator returns false. -func (t *BTree) Ascend(iterator ItemIterator) { +func (t *BTree[T]) Ascend(iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(ascend, nil, nil, false, false, iterator) + t.root.iterate(ascend, empty[T](), empty[T](), false, false, iterator) } // DescendRange calls the iterator for every value in the tree within the range // [lessOrEqual, greaterThan), until iterator returns false. -func (t *BTree) DescendRange(lessOrEqual, greaterThan Item, iterator ItemIterator) { +func (t *BTree[T]) DescendRange(lessOrEqual, greaterThan T, iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(descend, lessOrEqual, greaterThan, true, false, iterator) + t.root.iterate(descend, optional[T](lessOrEqual), optional[T](greaterThan), true, false, iterator) } // DescendLessOrEqual calls the iterator for every value in the tree within the range // [pivot, first], until iterator returns false. -func (t *BTree) DescendLessOrEqual(pivot Item, iterator ItemIterator) { +func (t *BTree[T]) DescendLessOrEqual(pivot T, iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(descend, pivot, nil, true, false, iterator) + t.root.iterate(descend, optional[T](pivot), empty[T](), true, false, iterator) } // DescendGreaterThan calls the iterator for every value in the tree within // the range [last, pivot), until iterator returns false. -func (t *BTree) DescendGreaterThan(pivot Item, iterator ItemIterator) { +func (t *BTree[T]) DescendGreaterThan(pivot T, iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(descend, nil, pivot, false, false, iterator) + t.root.iterate(descend, empty[T](), optional[T](pivot), false, false, iterator) } // Descend calls the iterator for every value in the tree within the range // [last, first], until iterator returns false. -func (t *BTree) Descend(iterator ItemIterator) { +func (t *BTree[T]) Descend(iterator ItemIterator[T]) { if t.root == nil { return } - t.root.iterate(descend, nil, nil, false, false, iterator) + t.root.iterate(descend, empty[T](), empty[T](), false, false, iterator) } -// Get looks for the key item in the tree, returning it. It returns nil if -// unable to find that item. -func (t *BTree) Get(key Item) Item { +// Get looks for the key item in the tree, returning it. It returns +// (zeroValue, false) if unable to find that item. +func (t *BTree[T]) Get(key T) (_ T, _ bool) { if t.root == nil { - return nil + return } return t.root.get(key) } -// Min returns the smallest item in the tree, or nil if the tree is empty. -func (t *BTree) Min() Item { +// Min returns the smallest item in the tree, or (zeroValue, false) if the tree is empty. +func (t *BTree[T]) Min() (_ T, _ bool) { return min(t.root) } -// Max returns the largest item in the tree, or nil if the tree is empty. -func (t *BTree) Max() Item { +// Max returns the largest item in the tree, or (zeroValue, false) if the tree is empty. +func (t *BTree[T]) Max() (_ T, _ bool) { return max(t.root) } // Has returns true if the given key is in the tree. -func (t *BTree) Has(key Item) bool { - return t.Get(key) != nil +func (t *BTree[T]) Has(key T) bool { + _, ok := t.Get(key) + return ok } // Len returns the number of items currently in the tree. -func (t *BTree) Len() int { +func (t *BTree[T]) Len() int { return t.length } @@ -858,14 +828,15 @@ func (t *BTree) Len() int { // one, instead of being lost to the garbage collector. // // This call takes: -// O(1): when addNodesToFreelist is false, this is a single operation. -// O(1): when the freelist is already full, it breaks out immediately -// O(freelist size): when the freelist is empty and the nodes are all owned -// by this tree, nodes are added to the freelist until full. -// O(tree size): when all nodes are owned by another tree, all nodes are -// iterated over looking for nodes to add to the freelist, and due to -// ownership, none are. -func (t *BTree) Clear(addNodesToFreelist bool) { +// +// O(1): when addNodesToFreelist is false, this is a single operation. +// O(1): when the freelist is already full, it breaks out immediately +// O(freelist size): when the freelist is empty and the nodes are all owned +// by this tree, nodes are added to the freelist until full. +// O(tree size): when all nodes are owned by another tree, all nodes are +// iterated over looking for nodes to add to the freelist, and due to +// ownership, none are. +func (t *BTree[T]) Clear(addNodesToFreelist bool) { if t.root != nil && addNodesToFreelist { t.root.reset(t.cow) } @@ -875,7 +846,7 @@ func (t *BTree) Clear(addNodesToFreelist bool) { // reset returns a subtree to the freelist. It breaks out immediately if the // freelist is full, since the only benefit of iterating is to fill that // freelist up. Returns true if parent reset call should continue. -func (n *node) reset(c *copyOnWriteContext) bool { +func (n *node[T]) reset(c *copyOnWriteContext[T]) bool { for _, child := range n.children { if !child.reset(c) { return false @@ -883,11 +854,3 @@ func (n *node) reset(c *copyOnWriteContext) bool { } return c.freeNode(n) != ftFreelistFull } - -// Int implements the Item interface for integers. -type Int int - -// Less returns true if int(a) < int(b). -func (a Int) Less(b Item) bool { - return a < b.(Int) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index c0512c9b1f..dbdb351932 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -75,17 +75,17 @@ github.com/beorn7/perks/quantile # github.com/blang/semver/v4 v4.0.0 ## explicit; go 1.14 github.com/blang/semver/v4 -# github.com/cenkalti/backoff/v4 v4.3.0 -## explicit; go 1.18 -github.com/cenkalti/backoff/v4 +# github.com/cenkalti/backoff/v5 v5.0.3 +## explicit; go 1.23 +github.com/cenkalti/backoff/v5 # github.com/cespare/xxhash/v2 v2.3.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 # github.com/coreos/go-semver v0.3.1 ## explicit; go 1.8 github.com/coreos/go-semver/semver -# github.com/coreos/go-systemd/v22 v22.5.0 -## explicit; go 1.12 +# github.com/coreos/go-systemd/v22 v22.7.0 +## explicit; go 1.23 github.com/coreos/go-systemd/v22/daemon github.com/coreos/go-systemd/v22/journal # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc @@ -94,7 +94,7 @@ github.com/davecgh/go-spew/spew # github.com/distribution/reference v0.6.0 ## explicit; go 1.20 github.com/distribution/reference -# github.com/emicklei/go-restful/v3 v3.12.2 +# github.com/emicklei/go-restful/v3 v3.13.0 ## explicit; go 1.13 github.com/emicklei/go-restful/v3 github.com/emicklei/go-restful/v3/log @@ -148,9 +148,6 @@ github.com/golang/groupcache/lru # github.com/golang/protobuf v1.5.4 ## explicit; go 1.17 github.com/golang/protobuf/proto -# github.com/google/btree v1.1.3 -## explicit; go 1.18 -github.com/google/btree # github.com/google/cel-go v0.26.0 ## explicit; go 1.22.0 github.com/google/cel-go/cel @@ -191,7 +188,7 @@ github.com/google/go-cmp/cmp/internal/diff github.com/google/go-cmp/cmp/internal/flags github.com/google/go-cmp/cmp/internal/function github.com/google/go-cmp/cmp/internal/value -# github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 +# github.com/google/pprof v0.0.0-20260115054156-294ebfa9ad83 ## explicit; go 1.24.0 github.com/google/pprof/profile # github.com/google/s2a-go v0.1.8 @@ -234,11 +231,14 @@ github.com/googleapis/gax-go/v2/internal # github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 ## explicit; go 1.20 github.com/gorilla/websocket -# github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 -## explicit -github.com/grpc-ecosystem/go-grpc-prometheus -# github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1 +# github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.1.0 +## explicit; go 1.21 +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus +# github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.3 ## explicit; go 1.23.0 +github.com/grpc-ecosystem/go-grpc-middleware/v2/interceptors +# github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 +## explicit; go 1.24.0 github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options github.com/grpc-ecosystem/grpc-gateway/v2/runtime @@ -275,7 +275,7 @@ github.com/mattn/go-isatty # github.com/mattn/go-sqlite3 v1.14.37 ## explicit; go 1.19 github.com/mattn/go-sqlite3 -# github.com/moby/spdystream v0.5.0 +# github.com/moby/spdystream v0.5.1 ## explicit; go 1.13 github.com/moby/spdystream github.com/moby/spdystream/spdy @@ -292,14 +292,11 @@ github.com/modern-go/reflect2 # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f -## explicit -github.com/mxk/go-flowrate/flowrate # github.com/natefinch/atomic v1.0.1 ## explicit; go 1.12 github.com/natefinch/atomic -# github.com/onsi/ginkgo/v2 v2.27.2 -## explicit; go 1.23.0 +# github.com/onsi/ginkgo/v2 v2.28.1 +## explicit; go 1.24.0 github.com/onsi/ginkgo/v2 github.com/onsi/ginkgo/v2/config github.com/onsi/ginkgo/v2/formatter @@ -322,8 +319,8 @@ github.com/onsi/ginkgo/v2/internal/reporters github.com/onsi/ginkgo/v2/internal/testingtproxy github.com/onsi/ginkgo/v2/reporters github.com/onsi/ginkgo/v2/types -# github.com/onsi/gomega v1.38.3 -## explicit; go 1.23.0 +# github.com/onsi/gomega v1.39.1 +## explicit; go 1.24.0 github.com/onsi/gomega github.com/onsi/gomega/format github.com/onsi/gomega/gcustom @@ -360,19 +357,19 @@ github.com/prometheus/client_golang/prometheus/testutil/promlint/validations # github.com/prometheus/client_model v0.6.2 ## explicit; go 1.22.0 github.com/prometheus/client_model/go -# github.com/prometheus/common v0.66.1 -## explicit; go 1.23.0 +# github.com/prometheus/common v0.67.5 +## explicit; go 1.24.0 github.com/prometheus/common/expfmt github.com/prometheus/common/model -# github.com/prometheus/procfs v0.16.1 -## explicit; go 1.23.0 +# github.com/prometheus/procfs v0.19.2 +## explicit; go 1.24.0 github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util # github.com/robfig/cron/v3 v3.0.1 ## explicit; go 1.12 github.com/robfig/cron/v3 -# github.com/spf13/cobra v1.10.0 +# github.com/spf13/cobra v1.10.2 ## explicit; go 1.15 github.com/spf13/cobra # github.com/spf13/pflag v1.0.10 @@ -389,8 +386,8 @@ github.com/stretchr/testify/require # github.com/x448/float16 v0.8.4 ## explicit; go 1.11 github.com/x448/float16 -# go.etcd.io/etcd/api/v3 v3.6.5 -## explicit; go 1.24 +# go.etcd.io/etcd/api/v3 v3.6.8 +## explicit; go 1.24.0 go.etcd.io/etcd/api/v3/authpb go.etcd.io/etcd/api/v3/etcdserverpb go.etcd.io/etcd/api/v3/membershippb @@ -398,8 +395,8 @@ go.etcd.io/etcd/api/v3/mvccpb go.etcd.io/etcd/api/v3/v3rpc/rpctypes go.etcd.io/etcd/api/v3/version go.etcd.io/etcd/api/v3/versionpb -# go.etcd.io/etcd/client/pkg/v3 v3.6.5 -## explicit; go 1.24 +# go.etcd.io/etcd/client/pkg/v3 v3.6.8 +## explicit; go 1.24.0 go.etcd.io/etcd/client/pkg/v3/fileutil go.etcd.io/etcd/client/pkg/v3/logutil go.etcd.io/etcd/client/pkg/v3/systemd @@ -407,8 +404,8 @@ go.etcd.io/etcd/client/pkg/v3/tlsutil go.etcd.io/etcd/client/pkg/v3/transport go.etcd.io/etcd/client/pkg/v3/types go.etcd.io/etcd/client/pkg/v3/verify -# go.etcd.io/etcd/client/v3 v3.6.5 -## explicit; go 1.24 +# go.etcd.io/etcd/client/v3 v3.6.8 +## explicit; go 1.24.0 go.etcd.io/etcd/client/v3 go.etcd.io/etcd/client/v3/credentials go.etcd.io/etcd/client/v3/internal/endpoint @@ -436,16 +433,15 @@ go.opencensus.io/trace/tracestate ## explicit; go 1.24.0 go.opentelemetry.io/auto/sdk go.opentelemetry.io/auto/sdk/internal/telemetry -# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.60.0 -## explicit; go 1.22.0 +# go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.65.0 +## explicit; go 1.24.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc/internal -# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 -## explicit; go 1.23.0 +# go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 +## explicit; go 1.24.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/request go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconv -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp/internal/semconvutil # go.opentelemetry.io/otel v1.41.0 ## explicit; go 1.24.0 go.opentelemetry.io/otel @@ -461,22 +457,25 @@ go.opentelemetry.io/otel/propagation go.opentelemetry.io/otel/semconv/internal go.opentelemetry.io/otel/semconv/v1.12.0 go.opentelemetry.io/otel/semconv/v1.17.0 -go.opentelemetry.io/otel/semconv/v1.20.0 -go.opentelemetry.io/otel/semconv/v1.26.0 go.opentelemetry.io/otel/semconv/v1.37.0 go.opentelemetry.io/otel/semconv/v1.39.0 +go.opentelemetry.io/otel/semconv/v1.39.0/httpconv go.opentelemetry.io/otel/semconv/v1.39.0/otelconv -# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 -## explicit; go 1.22.0 +go.opentelemetry.io/otel/semconv/v1.39.0/rpcconv +# go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 +## explicit; go 1.24.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace go.opentelemetry.io/otel/exporters/otlp/otlptrace/internal/tracetransform -# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 -## explicit; go 1.22.0 +# go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.40.0 +## explicit; go 1.24.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/counter go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/envconfig +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/observ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/retry +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc/internal/x # go.opentelemetry.io/otel/metric v1.41.0 ## explicit; go 1.24.0 go.opentelemetry.io/otel/metric @@ -499,7 +498,7 @@ go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded go.opentelemetry.io/otel/trace/internal/telemetry go.opentelemetry.io/otel/trace/noop -# go.opentelemetry.io/proto/otlp v1.7.1 +# go.opentelemetry.io/proto/otlp v1.9.0 ## explicit; go 1.23.0 go.opentelemetry.io/proto/otlp/collector/trace/v1 go.opentelemetry.io/proto/otlp/common/v1 @@ -508,7 +507,7 @@ go.opentelemetry.io/proto/otlp/trace/v1 # go.uber.org/multierr v1.11.0 ## explicit; go 1.19 go.uber.org/multierr -# go.uber.org/zap v1.27.0 +# go.uber.org/zap v1.27.1 ## explicit; go 1.19 go.uber.org/zap go.uber.org/zap/buffer @@ -541,9 +540,8 @@ golang.org/x/crypto/nacl/secretbox golang.org/x/crypto/salsa20/salsa golang.org/x/crypto/ssh golang.org/x/crypto/ssh/internal/bcrypt_pbkdf -# golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f -## explicit; go 1.22.0 -golang.org/x/exp/constraints +# golang.org/x/exp v0.0.0-20251219203646-944ab1f22d93 +## explicit; go 1.24.0 golang.org/x/exp/slices # golang.org/x/mod v0.32.0 ## explicit; go 1.24.0 @@ -552,7 +550,6 @@ golang.org/x/mod/module golang.org/x/mod/semver # golang.org/x/net v0.49.0 ## explicit; go 1.24.0 -golang.org/x/net/context golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/html/charset @@ -623,8 +620,8 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/time v0.10.0 -## explicit; go 1.18 +# golang.org/x/time v0.14.0 +## explicit; go 1.24.0 golang.org/x/time/rate # golang.org/x/tools v0.41.0 ## explicit; go 1.24.0 @@ -673,13 +670,13 @@ google.golang.org/api/option/internaloption google.golang.org/api/tpu/v1 google.golang.org/api/transport/http google.golang.org/api/transport/http/internal/propagation -# google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 +# google.golang.org/genproto/googleapis/api v0.0.0-20260128011058-8636f8732409 ## explicit; go 1.24.0 google.golang.org/genproto/googleapis/api google.golang.org/genproto/googleapis/api/annotations google.golang.org/genproto/googleapis/api/expr/v1alpha1 google.golang.org/genproto/googleapis/api/httpbody -# google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 +# google.golang.org/genproto/googleapis/rpc v0.0.0-20260128011058-8636f8732409 ## explicit; go 1.24.0 google.golang.org/genproto/googleapis/rpc/code google.golang.org/genproto/googleapis/rpc/errdetails @@ -743,6 +740,10 @@ google.golang.org/grpc/keepalive google.golang.org/grpc/mem google.golang.org/grpc/metadata google.golang.org/grpc/peer +google.golang.org/grpc/reflection +google.golang.org/grpc/reflection/grpc_reflection_v1 +google.golang.org/grpc/reflection/grpc_reflection_v1alpha +google.golang.org/grpc/reflection/internal google.golang.org/grpc/resolver google.golang.org/grpc/resolver/dns google.golang.org/grpc/resolver/manual @@ -750,7 +751,7 @@ google.golang.org/grpc/serviceconfig google.golang.org/grpc/stats google.golang.org/grpc/status google.golang.org/grpc/tap -# google.golang.org/protobuf v1.36.10 +# google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af ## explicit; go 1.23 google.golang.org/protobuf/encoding/protodelim google.golang.org/protobuf/encoding/protojson @@ -819,8 +820,8 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# k8s.io/api v0.35.1 => k8s.io/api v0.35.1 -## explicit; go 1.25.0 +# k8s.io/api v0.36.0 => k8s.io/api v0.36.0 +## explicit; go 1.26.0 k8s.io/api/admission/v1 k8s.io/api/admission/v1beta1 k8s.io/api/admissionregistration/v1 @@ -839,8 +840,6 @@ k8s.io/api/authorization/v1 k8s.io/api/authorization/v1beta1 k8s.io/api/autoscaling/v1 k8s.io/api/autoscaling/v2 -k8s.io/api/autoscaling/v2beta1 -k8s.io/api/autoscaling/v2beta2 k8s.io/api/batch/v1 k8s.io/api/batch/v1beta1 k8s.io/api/certificates/v1 @@ -875,20 +874,26 @@ k8s.io/api/resource/v1alpha3 k8s.io/api/resource/v1beta1 k8s.io/api/resource/v1beta2 k8s.io/api/scheduling/v1 -k8s.io/api/scheduling/v1alpha1 +k8s.io/api/scheduling/v1alpha2 k8s.io/api/scheduling/v1beta1 k8s.io/api/storage/v1 k8s.io/api/storage/v1alpha1 k8s.io/api/storage/v1beta1 k8s.io/api/storagemigration/v1beta1 -# k8s.io/apiextensions-apiserver v0.35.1 => k8s.io/apiextensions-apiserver v0.35.1 -## explicit; go 1.25.0 +# k8s.io/apiextensions-apiserver v0.36.0 => k8s.io/apiextensions-apiserver v0.36.0 +## explicit; go 1.26.0 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1 +k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1 +k8s.io/apiextensions-apiserver/pkg/client/applyconfiguration/apiextensions/v1beta1 +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1 +k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1 k8s.io/apiextensions-apiserver/pkg/features -# k8s.io/apimachinery v0.35.1 => k8s.io/apimachinery v0.35.1 -## explicit; go 1.25.0 +# k8s.io/apimachinery v0.36.0 => k8s.io/apimachinery v0.36.0 +## explicit; go 1.26.0 k8s.io/apimachinery/pkg/api/equality k8s.io/apimachinery/pkg/api/errors k8s.io/apimachinery/pkg/api/meta @@ -900,7 +905,6 @@ k8s.io/apimachinery/pkg/api/validate k8s.io/apimachinery/pkg/api/validate/constraints k8s.io/apimachinery/pkg/api/validate/content k8s.io/apimachinery/pkg/api/validation -k8s.io/apimachinery/pkg/api/validation/path k8s.io/apimachinery/pkg/apis/asn1 k8s.io/apimachinery/pkg/apis/meta/internalversion k8s.io/apimachinery/pkg/apis/meta/internalversion/scheme @@ -926,15 +930,14 @@ k8s.io/apimachinery/pkg/runtime/serializer/recognizer k8s.io/apimachinery/pkg/runtime/serializer/streaming k8s.io/apimachinery/pkg/runtime/serializer/versioning k8s.io/apimachinery/pkg/selection +k8s.io/apimachinery/pkg/sharding k8s.io/apimachinery/pkg/types k8s.io/apimachinery/pkg/util/cache k8s.io/apimachinery/pkg/util/diff -k8s.io/apimachinery/pkg/util/dump k8s.io/apimachinery/pkg/util/errors k8s.io/apimachinery/pkg/util/framer k8s.io/apimachinery/pkg/util/httpstream k8s.io/apimachinery/pkg/util/httpstream/spdy -k8s.io/apimachinery/pkg/util/httpstream/wsstream k8s.io/apimachinery/pkg/util/intstr k8s.io/apimachinery/pkg/util/json k8s.io/apimachinery/pkg/util/managedfields @@ -943,7 +946,6 @@ k8s.io/apimachinery/pkg/util/mergepatch k8s.io/apimachinery/pkg/util/naming k8s.io/apimachinery/pkg/util/net k8s.io/apimachinery/pkg/util/portforward -k8s.io/apimachinery/pkg/util/proxy k8s.io/apimachinery/pkg/util/rand k8s.io/apimachinery/pkg/util/remotecommand k8s.io/apimachinery/pkg/util/runtime @@ -960,19 +962,24 @@ k8s.io/apimachinery/pkg/util/yaml k8s.io/apimachinery/pkg/version k8s.io/apimachinery/pkg/watch k8s.io/apimachinery/third_party/forked/golang/json -k8s.io/apimachinery/third_party/forked/golang/netutil k8s.io/apimachinery/third_party/forked/golang/reflect -# k8s.io/apiserver v0.35.1 => k8s.io/apiserver v0.35.1 -## explicit; go 1.25.0 +# k8s.io/apiserver v0.36.0 => k8s.io/apiserver v0.36.0 +## explicit; go 1.26.0 k8s.io/apiserver/pkg/admission k8s.io/apiserver/pkg/admission/configuration k8s.io/apiserver/pkg/admission/initializer k8s.io/apiserver/pkg/admission/metrics k8s.io/apiserver/pkg/admission/plugin/authorizer k8s.io/apiserver/pkg/admission/plugin/cel +k8s.io/apiserver/pkg/admission/plugin/manifest +k8s.io/apiserver/pkg/admission/plugin/manifest/metrics k8s.io/apiserver/pkg/admission/plugin/namespace/lifecycle +k8s.io/apiserver/pkg/admission/plugin/policy/config +k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig +k8s.io/apiserver/pkg/admission/plugin/policy/config/apis/policyconfig/v1 k8s.io/apiserver/pkg/admission/plugin/policy/generic k8s.io/apiserver/pkg/admission/plugin/policy/internal/generic +k8s.io/apiserver/pkg/admission/plugin/policy/manifest/source k8s.io/apiserver/pkg/admission/plugin/policy/matching k8s.io/apiserver/pkg/admission/plugin/policy/mutating k8s.io/apiserver/pkg/admission/plugin/policy/mutating/metrics @@ -983,9 +990,10 @@ k8s.io/apiserver/pkg/admission/plugin/webhook k8s.io/apiserver/pkg/admission/plugin/webhook/config k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1 -k8s.io/apiserver/pkg/admission/plugin/webhook/config/apis/webhookadmission/v1alpha1 k8s.io/apiserver/pkg/admission/plugin/webhook/errors k8s.io/apiserver/pkg/admission/plugin/webhook/generic +k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/loader +k8s.io/apiserver/pkg/admission/plugin/webhook/manifest/source k8s.io/apiserver/pkg/admission/plugin/webhook/matchconditions k8s.io/apiserver/pkg/admission/plugin/webhook/mutating k8s.io/apiserver/pkg/admission/plugin/webhook/predicates/namespace @@ -1043,6 +1051,7 @@ k8s.io/apiserver/pkg/endpoints/discovery/aggregated k8s.io/apiserver/pkg/endpoints/filterlatency k8s.io/apiserver/pkg/endpoints/filters k8s.io/apiserver/pkg/endpoints/filters/impersonation +k8s.io/apiserver/pkg/endpoints/filters/impersonation/metrics k8s.io/apiserver/pkg/endpoints/handlers k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager k8s.io/apiserver/pkg/endpoints/handlers/finisher @@ -1066,6 +1075,7 @@ k8s.io/apiserver/pkg/server/egressselector/metrics k8s.io/apiserver/pkg/server/filters k8s.io/apiserver/pkg/server/flagz k8s.io/apiserver/pkg/server/flagz/api/v1alpha1 +k8s.io/apiserver/pkg/server/flagz/api/v1beta1 k8s.io/apiserver/pkg/server/flagz/negotiate k8s.io/apiserver/pkg/server/healthz k8s.io/apiserver/pkg/server/httplog @@ -1079,13 +1089,16 @@ k8s.io/apiserver/pkg/server/routes k8s.io/apiserver/pkg/server/routine k8s.io/apiserver/pkg/server/statusz k8s.io/apiserver/pkg/server/statusz/api/v1alpha1 +k8s.io/apiserver/pkg/server/statusz/api/v1beta1 k8s.io/apiserver/pkg/server/statusz/negotiate k8s.io/apiserver/pkg/server/storage +k8s.io/apiserver/pkg/sharding k8s.io/apiserver/pkg/storage k8s.io/apiserver/pkg/storage/cacher k8s.io/apiserver/pkg/storage/cacher/delegator k8s.io/apiserver/pkg/storage/cacher/metrics k8s.io/apiserver/pkg/storage/cacher/progress +k8s.io/apiserver/pkg/storage/cacher/store k8s.io/apiserver/pkg/storage/errors k8s.io/apiserver/pkg/storage/etcd3 k8s.io/apiserver/pkg/storage/etcd3/metrics @@ -1107,6 +1120,7 @@ k8s.io/apiserver/pkg/util/compatibility k8s.io/apiserver/pkg/util/configmetrics k8s.io/apiserver/pkg/util/dryrun k8s.io/apiserver/pkg/util/feature +k8s.io/apiserver/pkg/util/filesystem k8s.io/apiserver/pkg/util/flowcontrol k8s.io/apiserver/pkg/util/flowcontrol/debug k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing @@ -1118,6 +1132,7 @@ k8s.io/apiserver/pkg/util/flowcontrol/metrics k8s.io/apiserver/pkg/util/flowcontrol/request k8s.io/apiserver/pkg/util/flushwriter k8s.io/apiserver/pkg/util/peerproxy/metrics +k8s.io/apiserver/pkg/util/proxy/metrics k8s.io/apiserver/pkg/util/shufflesharding k8s.io/apiserver/pkg/util/webhook k8s.io/apiserver/pkg/util/x509metrics @@ -1130,8 +1145,8 @@ k8s.io/apiserver/plugin/pkg/audit/webhook k8s.io/apiserver/plugin/pkg/authenticator/token/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook k8s.io/apiserver/plugin/pkg/authorizer/webhook/metrics -# k8s.io/client-go v0.35.1 => k8s.io/client-go v0.35.1 -## explicit; go 1.25.0 +# k8s.io/client-go v0.36.0 => k8s.io/client-go v0.36.0 +## explicit; go 1.26.0 k8s.io/client-go/applyconfigurations k8s.io/client-go/applyconfigurations/admissionregistration/v1 k8s.io/client-go/applyconfigurations/admissionregistration/v1alpha1 @@ -1142,8 +1157,6 @@ k8s.io/client-go/applyconfigurations/apps/v1beta1 k8s.io/client-go/applyconfigurations/apps/v1beta2 k8s.io/client-go/applyconfigurations/autoscaling/v1 k8s.io/client-go/applyconfigurations/autoscaling/v2 -k8s.io/client-go/applyconfigurations/autoscaling/v2beta1 -k8s.io/client-go/applyconfigurations/autoscaling/v2beta2 k8s.io/client-go/applyconfigurations/batch/v1 k8s.io/client-go/applyconfigurations/batch/v1beta1 k8s.io/client-go/applyconfigurations/certificates/v1 @@ -1180,7 +1193,7 @@ k8s.io/client-go/applyconfigurations/resource/v1alpha3 k8s.io/client-go/applyconfigurations/resource/v1beta1 k8s.io/client-go/applyconfigurations/resource/v1beta2 k8s.io/client-go/applyconfigurations/scheduling/v1 -k8s.io/client-go/applyconfigurations/scheduling/v1alpha1 +k8s.io/client-go/applyconfigurations/scheduling/v1alpha2 k8s.io/client-go/applyconfigurations/scheduling/v1beta1 k8s.io/client-go/applyconfigurations/storage/v1 k8s.io/client-go/applyconfigurations/storage/v1alpha1 @@ -1209,8 +1222,6 @@ k8s.io/client-go/informers/apps/v1beta2 k8s.io/client-go/informers/autoscaling k8s.io/client-go/informers/autoscaling/v1 k8s.io/client-go/informers/autoscaling/v2 -k8s.io/client-go/informers/autoscaling/v2beta1 -k8s.io/client-go/informers/autoscaling/v2beta2 k8s.io/client-go/informers/batch k8s.io/client-go/informers/batch/v1 k8s.io/client-go/informers/batch/v1beta1 @@ -1259,7 +1270,7 @@ k8s.io/client-go/informers/resource/v1beta1 k8s.io/client-go/informers/resource/v1beta2 k8s.io/client-go/informers/scheduling k8s.io/client-go/informers/scheduling/v1 -k8s.io/client-go/informers/scheduling/v1alpha1 +k8s.io/client-go/informers/scheduling/v1alpha2 k8s.io/client-go/informers/scheduling/v1beta1 k8s.io/client-go/informers/storage k8s.io/client-go/informers/storage/v1 @@ -1298,10 +1309,6 @@ k8s.io/client-go/kubernetes/typed/autoscaling/v1 k8s.io/client-go/kubernetes/typed/autoscaling/v1/fake k8s.io/client-go/kubernetes/typed/autoscaling/v2 k8s.io/client-go/kubernetes/typed/autoscaling/v2/fake -k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1 -k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake -k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2 -k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/fake k8s.io/client-go/kubernetes/typed/batch/v1 k8s.io/client-go/kubernetes/typed/batch/v1/fake k8s.io/client-go/kubernetes/typed/batch/v1beta1 @@ -1368,8 +1375,8 @@ k8s.io/client-go/kubernetes/typed/resource/v1beta2 k8s.io/client-go/kubernetes/typed/resource/v1beta2/fake k8s.io/client-go/kubernetes/typed/scheduling/v1 k8s.io/client-go/kubernetes/typed/scheduling/v1/fake -k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1 -k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/fake +k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2 +k8s.io/client-go/kubernetes/typed/scheduling/v1alpha2/fake k8s.io/client-go/kubernetes/typed/scheduling/v1beta1 k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/fake k8s.io/client-go/kubernetes/typed/storage/v1 @@ -1390,8 +1397,6 @@ k8s.io/client-go/listers/apps/v1beta1 k8s.io/client-go/listers/apps/v1beta2 k8s.io/client-go/listers/autoscaling/v1 k8s.io/client-go/listers/autoscaling/v2 -k8s.io/client-go/listers/autoscaling/v2beta1 -k8s.io/client-go/listers/autoscaling/v2beta2 k8s.io/client-go/listers/batch/v1 k8s.io/client-go/listers/batch/v1beta1 k8s.io/client-go/listers/certificates/v1 @@ -1425,7 +1430,7 @@ k8s.io/client-go/listers/resource/v1alpha3 k8s.io/client-go/listers/resource/v1beta1 k8s.io/client-go/listers/resource/v1beta2 k8s.io/client-go/listers/scheduling/v1 -k8s.io/client-go/listers/scheduling/v1alpha1 +k8s.io/client-go/listers/scheduling/v1alpha2 k8s.io/client-go/listers/scheduling/v1beta1 k8s.io/client-go/listers/storage/v1 k8s.io/client-go/listers/storage/v1alpha1 @@ -1488,8 +1493,8 @@ k8s.io/client-go/util/keyutil k8s.io/client-go/util/retry k8s.io/client-go/util/watchlist k8s.io/client-go/util/workqueue -# k8s.io/cloud-provider v0.35.1 => k8s.io/cloud-provider v0.35.1 -## explicit; go 1.25.0 +# k8s.io/cloud-provider v0.36.0 => k8s.io/cloud-provider v0.36.0 +## explicit; go 1.26.0 k8s.io/cloud-provider k8s.io/cloud-provider/api k8s.io/cloud-provider/app @@ -1514,9 +1519,9 @@ k8s.io/cloud-provider/volume k8s.io/cloud-provider/volume/errors k8s.io/cloud-provider/volume/helpers # k8s.io/cloud-provider-gcp/providers v0.0.0-00010101000000-000000000000 => ./providers -## explicit; go 1.25.0 -# k8s.io/code-generator v0.35.1 => k8s.io/code-generator v0.35.1 -## explicit; go 1.25.0 +## explicit; go 1.26.0 +# k8s.io/code-generator v0.36.0 => k8s.io/code-generator v0.36.0 +## explicit; go 1.26.0 k8s.io/code-generator/cmd/client-gen k8s.io/code-generator/cmd/client-gen/args k8s.io/code-generator/cmd/client-gen/generators @@ -1538,8 +1543,8 @@ k8s.io/code-generator/cmd/register-gen/args k8s.io/code-generator/cmd/register-gen/generators k8s.io/code-generator/pkg/namer k8s.io/code-generator/pkg/util -# k8s.io/component-base v0.35.1 => k8s.io/component-base v0.35.1 -## explicit; go 1.25.0 +# k8s.io/component-base v0.36.0 => k8s.io/component-base v0.36.0 +## explicit; go 1.26.0 k8s.io/component-base/cli/flag k8s.io/component-base/cli/globalflag k8s.io/component-base/compatibility @@ -1554,9 +1559,12 @@ k8s.io/component-base/logs/internal/setverbositylevel k8s.io/component-base/logs/klogflags k8s.io/component-base/logs/testinit k8s.io/component-base/metrics +k8s.io/component-base/metrics/api/v1 k8s.io/component-base/metrics/features +k8s.io/component-base/metrics/internal k8s.io/component-base/metrics/legacyregistry k8s.io/component-base/metrics/prometheus/clientgo +k8s.io/component-base/metrics/prometheus/clientgo/fifo k8s.io/component-base/metrics/prometheus/clientgo/leaderelection k8s.io/component-base/metrics/prometheus/compatversion k8s.io/component-base/metrics/prometheus/controllers @@ -1573,16 +1581,16 @@ k8s.io/component-base/tracing/api/v1 k8s.io/component-base/version k8s.io/component-base/version/verflag k8s.io/component-base/zpages/features -# k8s.io/component-helpers v0.35.1 => k8s.io/component-helpers v0.35.1 -## explicit; go 1.25.0 +# k8s.io/component-helpers v0.36.0 => k8s.io/component-helpers v0.36.0 +## explicit; go 1.26.0 k8s.io/component-helpers/node/topology k8s.io/component-helpers/node/util k8s.io/component-helpers/node/util/sysctl k8s.io/component-helpers/resource k8s.io/component-helpers/scheduling/corev1 k8s.io/component-helpers/scheduling/corev1/nodeaffinity -# k8s.io/controller-manager v0.35.1 => k8s.io/controller-manager v0.35.1 -## explicit; go 1.25.0 +# k8s.io/controller-manager v0.36.0 => k8s.io/controller-manager v0.36.0 +## explicit; go 1.26.0 k8s.io/controller-manager/app k8s.io/controller-manager/config k8s.io/controller-manager/config/v1 @@ -1616,17 +1624,18 @@ k8s.io/klog/v2/internal/serialize k8s.io/klog/v2/internal/severity k8s.io/klog/v2/internal/sloghandler k8s.io/klog/v2/internal/verbosity +k8s.io/klog/v2/ktesting k8s.io/klog/v2/textlogger -# k8s.io/kms v0.35.1 -## explicit; go 1.25.0 +# k8s.io/kms v0.36.0 +## explicit; go 1.26.0 k8s.io/kms/apis/v1beta1 k8s.io/kms/apis/v2 k8s.io/kms/pkg/service k8s.io/kms/pkg/util -# k8s.io/kube-controller-manager v0.35.1 => k8s.io/kube-controller-manager v0.35.1 -## explicit; go 1.25.0 +# k8s.io/kube-controller-manager v0.36.0 => k8s.io/kube-controller-manager v0.36.0 +## explicit; go 1.26.0 k8s.io/kube-controller-manager/config/v1alpha1 -# k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 +# k8s.io/kube-openapi v0.0.0-20260317180543-43fb72c5454a ## explicit; go 1.23.0 k8s.io/kube-openapi/pkg/builder k8s.io/kube-openapi/pkg/builder3 @@ -1648,21 +1657,22 @@ k8s.io/kube-openapi/pkg/validation/errors k8s.io/kube-openapi/pkg/validation/spec k8s.io/kube-openapi/pkg/validation/strfmt k8s.io/kube-openapi/pkg/validation/strfmt/bson -# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.35.1 -## explicit; go 1.25.0 +# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.36.0 +## explicit; go 1.26.0 k8s.io/kubectl/pkg/scale k8s.io/kubectl/pkg/util/podutils -# k8s.io/kubelet v0.35.1 => k8s.io/kubelet v0.35.1 -## explicit; go 1.25.0 +# k8s.io/kubelet v0.36.0 => k8s.io/kubelet v0.36.0 +## explicit; go 1.26.0 k8s.io/kubelet/pkg/apis k8s.io/kubelet/pkg/apis/credentialprovider k8s.io/kubelet/pkg/apis/credentialprovider/v1 -# k8s.io/kubernetes v1.35.1 -## explicit; go 1.25.0 +# k8s.io/kubernetes v1.36.0 +## explicit; go 1.26.0 k8s.io/kubernetes/cmd/kube-controller-manager/names k8s.io/kubernetes/pkg/api/legacyscheme k8s.io/kubernetes/pkg/api/service k8s.io/kubernetes/pkg/api/v1/pod +k8s.io/kubernetes/pkg/api/v1/resource k8s.io/kubernetes/pkg/api/v1/service k8s.io/kubernetes/pkg/apis/apps k8s.io/kubernetes/pkg/apis/autoscaling @@ -1707,22 +1717,32 @@ k8s.io/kubernetes/test/e2e/testing-manifests k8s.io/kubernetes/test/utils k8s.io/kubernetes/test/utils/format k8s.io/kubernetes/test/utils/image +k8s.io/kubernetes/test/utils/ktesting +k8s.io/kubernetes/test/utils/ktesting/initoption +k8s.io/kubernetes/test/utils/ktesting/internal k8s.io/kubernetes/test/utils/kubeconfig -# k8s.io/metrics v0.35.1 => k8s.io/metrics v0.35.1 -## explicit; go 1.25.0 +# k8s.io/metrics v0.36.0 => k8s.io/metrics v0.36.0 +## explicit; go 1.26.0 k8s.io/metrics/pkg/apis/metrics k8s.io/metrics/pkg/apis/metrics/v1alpha1 k8s.io/metrics/pkg/apis/metrics/v1beta1 k8s.io/metrics/pkg/client/clientset/versioned/scheme -# k8s.io/pod-security-admission v0.35.1 => k8s.io/pod-security-admission v0.35.1 -## explicit; go 1.25.0 +# k8s.io/pod-security-admission v0.36.0 => k8s.io/pod-security-admission v0.36.0 +## explicit; go 1.26.0 k8s.io/pod-security-admission/api k8s.io/pod-security-admission/policy -# k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 -## explicit; go 1.18 +# k8s.io/streaming v0.36.0 +## explicit; go 1.26.0 +k8s.io/streaming/pkg/httpstream +k8s.io/streaming/pkg/httpstream/spdy +k8s.io/streaming/pkg/httpstream/wsstream +k8s.io/streaming/pkg/runtime +# k8s.io/utils v0.0.0-20260210185600-b8788abfbbc2 +## explicit; go 1.23 k8s.io/utils/buffer k8s.io/utils/clock k8s.io/utils/clock/testing +k8s.io/utils/dump k8s.io/utils/exec k8s.io/utils/integer k8s.io/utils/internal/third_party/forked/golang/golang-lru @@ -1732,8 +1752,9 @@ k8s.io/utils/net k8s.io/utils/path k8s.io/utils/ptr k8s.io/utils/strings/slices +k8s.io/utils/third_party/forked/golang/btree k8s.io/utils/trace -# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 +# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.34.0 ## explicit; go 1.21 sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client/metrics @@ -1766,7 +1787,7 @@ sigs.k8s.io/json/internal/golang/encoding/json ## explicit; go 1.18 sigs.k8s.io/randfill sigs.k8s.io/randfill/bytesource -# sigs.k8s.io/structured-merge-diff/v6 v6.3.0 +# sigs.k8s.io/structured-merge-diff/v6 v6.3.2 ## explicit; go 1.23 sigs.k8s.io/structured-merge-diff/v6/fieldpath sigs.k8s.io/structured-merge-diff/v6/merge @@ -1776,28 +1797,28 @@ sigs.k8s.io/structured-merge-diff/v6/value # sigs.k8s.io/yaml v1.6.0 ## explicit; go 1.22 sigs.k8s.io/yaml -# k8s.io/api => k8s.io/api v0.35.1 -# k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.35.1 -# k8s.io/apimachinery => k8s.io/apimachinery v0.35.1 -# k8s.io/apiserver => k8s.io/apiserver v0.35.1 -# k8s.io/cli-runtime => k8s.io/cli-runtime v0.35.1 -# k8s.io/client-go => k8s.io/client-go v0.35.1 -# k8s.io/cloud-provider => k8s.io/cloud-provider v0.35.1 -# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.35.1 -# k8s.io/code-generator => k8s.io/code-generator v0.35.1 -# k8s.io/component-base => k8s.io/component-base v0.35.1 -# k8s.io/component-helpers => k8s.io/component-helpers v0.35.1 -# k8s.io/controller-manager => k8s.io/controller-manager v0.35.1 -# k8s.io/cri-api => k8s.io/cri-api v0.35.1 -# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.35.1 -# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.35.1 -# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.35.1 -# k8s.io/kube-proxy => k8s.io/kube-proxy v0.35.1 -# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.35.1 -# k8s.io/kubectl => k8s.io/kubectl v0.35.1 -# k8s.io/kubelet => k8s.io/kubelet v0.35.1 -# k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.35.1 -# k8s.io/metrics => k8s.io/metrics v0.35.1 -# k8s.io/mount-utils => k8s.io/mount-utils v0.35.1 -# k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.35.1 -# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.35.1 +# k8s.io/api => k8s.io/api v0.36.0 +# k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.36.0 +# k8s.io/apimachinery => k8s.io/apimachinery v0.36.0 +# k8s.io/apiserver => k8s.io/apiserver v0.36.0 +# k8s.io/cli-runtime => k8s.io/cli-runtime v0.36.0 +# k8s.io/client-go => k8s.io/client-go v0.36.0 +# k8s.io/cloud-provider => k8s.io/cloud-provider v0.36.0 +# k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.36.0 +# k8s.io/code-generator => k8s.io/code-generator v0.36.0 +# k8s.io/component-base => k8s.io/component-base v0.36.0 +# k8s.io/component-helpers => k8s.io/component-helpers v0.36.0 +# k8s.io/controller-manager => k8s.io/controller-manager v0.36.0 +# k8s.io/cri-api => k8s.io/cri-api v0.36.0 +# k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.36.0 +# k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.36.0 +# k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.36.0 +# k8s.io/kube-proxy => k8s.io/kube-proxy v0.36.0 +# k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.36.0 +# k8s.io/kubectl => k8s.io/kubectl v0.36.0 +# k8s.io/kubelet => k8s.io/kubelet v0.36.0 +# k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.36.0 +# k8s.io/metrics => k8s.io/metrics v0.36.0 +# k8s.io/mount-utils => k8s.io/mount-utils v0.36.0 +# k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.36.0 +# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.36.0 diff --git a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go index 0831f3e632..b94c40e439 100644 --- a/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go +++ b/vendor/sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client/client.pb.go @@ -102,7 +102,6 @@ type Packet struct { Type PacketType `protobuf:"varint,1,opt,name=type,proto3,enum=PacketType" json:"type,omitempty"` // Types that are assignable to Payload: - // // *Packet_DialRequest // *Packet_DialResponse // *Packet_Data diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v6/schema/elements.go b/vendor/sigs.k8s.io/structured-merge-diff/v6/schema/elements.go index 5d3707a5b5..c8138a6548 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v6/schema/elements.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v6/schema/elements.go @@ -18,6 +18,7 @@ package schema import ( "sync" + "sync/atomic" ) // Schema is a list of named types. @@ -28,7 +29,7 @@ type Schema struct { Types []TypeDef `yaml:"types,omitempty"` once sync.Once - m map[string]TypeDef + m atomic.Pointer[map[string]TypeDef] lock sync.Mutex // Cached results of resolving type references to atoms. Only stores @@ -144,26 +145,28 @@ type Map struct { ElementRelationship ElementRelationship `yaml:"elementRelationship,omitempty"` once sync.Once - m map[string]StructField + m atomic.Pointer[map[string]StructField] } // FindField is a convenience function that returns the referenced StructField, // if it exists, or (nil, false) if it doesn't. func (m *Map) FindField(name string) (StructField, bool) { m.once.Do(func() { - m.m = make(map[string]StructField, len(m.Fields)) + mm := make(map[string]StructField, len(m.Fields)) for _, field := range m.Fields { - m.m[field.Name] = field + mm[field.Name] = field } + m.m.Store(&mm) }) - sf, ok := m.m[name] + sf, ok := (*m.m.Load())[name] return sf, ok } -// CopyInto this instance of Map into the other -// If other is nil this method does nothing. -// If other is already initialized, overwrites it with this instance -// Warning: Not thread safe +// CopyInto clones this instance of Map into dst +// +// If dst is nil this method does nothing. +// If dst is already initialized, overwrites it with this instance. +// Warning: Not thread safe. Only use dst after this function returns. func (m *Map) CopyInto(dst *Map) { if dst == nil { return @@ -175,12 +178,13 @@ func (m *Map) CopyInto(dst *Map) { dst.Unions = m.Unions dst.ElementRelationship = m.ElementRelationship - if m.m != nil { + mm := m.m.Load() + if mm != nil { // If cache is non-nil then the once token had been consumed. // Must reset token and use it again to ensure same semantics. dst.once = sync.Once{} dst.once.Do(func() { - dst.m = m.m + dst.m.Store(mm) }) } } @@ -274,12 +278,13 @@ type List struct { // if it exists, or (nil, false) if it doesn't. func (s *Schema) FindNamedType(name string) (TypeDef, bool) { s.once.Do(func() { - s.m = make(map[string]TypeDef, len(s.Types)) + sm := make(map[string]TypeDef, len(s.Types)) for _, t := range s.Types { - s.m[t.Name] = t + sm[t.Name] = t } + s.m.Store(&sm) }) - t, ok := s.m[name] + t, ok := (*s.m.Load())[name] return t, ok } @@ -352,10 +357,11 @@ func (s *Schema) Resolve(tr TypeRef) (Atom, bool) { return result, true } -// Clones this instance of Schema into the other -// If other is nil this method does nothing. -// If other is already initialized, overwrites it with this instance -// Warning: Not thread safe +// CopyInto clones this instance of Schema into dst +// +// If dst is nil this method does nothing. +// If dst is already initialized, overwrites it with this instance. +// Warning: Not thread safe. Only use dst after this function returns. func (s *Schema) CopyInto(dst *Schema) { if dst == nil { return @@ -364,12 +370,13 @@ func (s *Schema) CopyInto(dst *Schema) { // Schema type is considered immutable so sharing references dst.Types = s.Types - if s.m != nil { + sm := s.m.Load() + if sm != nil { // If cache is non-nil then the once token had been consumed. // Must reset token and use it again to ensure same semantics. dst.once = sync.Once{} dst.once.Do(func() { - dst.m = s.m + dst.m.Store(sm) }) } } diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v6/typed/remove.go b/vendor/sigs.k8s.io/structured-merge-diff/v6/typed/remove.go index 86de5105d7..0db1734f94 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v6/typed/remove.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v6/typed/remove.go @@ -58,6 +58,10 @@ func (w *removingWalker) doList(t *schema.List) (errs ValidationErrors) { defer w.allocator.Free(l) // If list is null or empty just return if l == nil || l.Length() == 0 { + // For extraction, we just return the value as is (which is nil or empty). For extraction the difference matters. + if w.shouldExtract { + w.out = w.value.Unstructured() + } return nil } @@ -71,6 +75,7 @@ func (w *removingWalker) doList(t *schema.List) (errs ValidationErrors) { } var newItems []interface{} + hadMatches := false iter := l.RangeUsing(w.allocator) defer w.allocator.Free(iter) for iter.Next() { @@ -80,24 +85,40 @@ func (w *removingWalker) doList(t *schema.List) (errs ValidationErrors) { path, _ := fieldpath.MakePath(pe) // save items on the path when we shouldExtract // but ignore them when we are removing (i.e. !w.shouldExtract) - if w.toRemove.Has(path) { - if w.shouldExtract { - newItems = append(newItems, removeItemsWithSchema(item, w.toRemove, w.schema, t.ElementType, w.shouldExtract).Unstructured()) - } else { - continue + isExactPathMatch := w.toRemove.Has(path) + isPrefixMatch := !w.toRemove.WithPrefix(pe).Empty() + if w.shouldExtract { + if isPrefixMatch { + item = removeItemsWithSchema(item, w.toRemove.WithPrefix(pe), w.schema, t.ElementType, w.shouldExtract) + } + if isExactPathMatch || isPrefixMatch { + newItems = append(newItems, item.Unstructured()) } - } - if subset := w.toRemove.WithPrefix(pe); !subset.Empty() { - item = removeItemsWithSchema(item, subset, w.schema, t.ElementType, w.shouldExtract) } else { - // don't save items not on the path when we shouldExtract. - if w.shouldExtract { + if isExactPathMatch { continue } + if isPrefixMatch { + // Removing nested items within this list item and preserve if it becomes empty + hadMatches = true + wasMap := item.IsMap() + wasList := item.IsList() + item = removeItemsWithSchema(item, w.toRemove.WithPrefix(pe), w.schema, t.ElementType, w.shouldExtract) + // If item returned null but we're removing items within the structure(not the item itself), + // preserve the empty container structure + if item.IsNull() && !w.shouldExtract { + if wasMap { + item = value.NewValueInterface(map[string]interface{}{}) + } else if wasList { + item = value.NewValueInterface([]interface{}{}) + } + } + } + newItems = append(newItems, item.Unstructured()) } - newItems = append(newItems, item.Unstructured()) } - if len(newItems) > 0 { + // Preserve empty lists (non-nil) instead of converting to null when items were matched and removed + if len(newItems) > 0 || (hadMatches && !w.shouldExtract) { w.out = newItems } return nil @@ -113,6 +134,10 @@ func (w *removingWalker) doMap(t *schema.Map) ValidationErrors { } // If map is null or empty just return if m == nil || m.Empty() { + // For extraction, we just return the value as is (which is nil or empty). For extraction the difference matters. + if w.shouldExtract { + w.out = w.value.Unstructured() + } return nil } @@ -131,6 +156,7 @@ func (w *removingWalker) doMap(t *schema.Map) ValidationErrors { } newMap := map[string]interface{}{} + hadMatches := false m.Iterate(func(k string, val value.Value) bool { pe := fieldpath.PathElement{FieldName: &k} path, _ := fieldpath.MakePath(pe) @@ -148,7 +174,19 @@ func (w *removingWalker) doMap(t *schema.Map) ValidationErrors { return true } if subset := w.toRemove.WithPrefix(pe); !subset.Empty() { + hadMatches = true + wasMap := val.IsMap() + wasList := val.IsList() val = removeItemsWithSchema(val, subset, w.schema, fieldType, w.shouldExtract) + // If val returned null but we're removing items within the structure (not the field itself), + // preserve the empty container structure + if val.IsNull() && !w.shouldExtract { + if wasMap { + val = value.NewValueInterface(map[string]interface{}{}) + } else if wasList { + val = value.NewValueInterface([]interface{}{}) + } + } } else { // don't save values not on the path when we shouldExtract. if w.shouldExtract { @@ -158,7 +196,8 @@ func (w *removingWalker) doMap(t *schema.Map) ValidationErrors { newMap[k] = val.Unstructured() return true }) - if len(newMap) > 0 { + // Preserve empty maps (non-nil) instead of converting to null when items were matched and removed + if len(newMap) > 0 || (hadMatches && !w.shouldExtract) { w.out = newMap } return nil diff --git a/vendor/sigs.k8s.io/structured-merge-diff/v6/value/reflectcache.go b/vendor/sigs.k8s.io/structured-merge-diff/v6/value/reflectcache.go index 3b4a402ee1..75b7085c3e 100644 --- a/vendor/sigs.k8s.io/structured-merge-diff/v6/value/reflectcache.go +++ b/vendor/sigs.k8s.io/structured-merge-diff/v6/value/reflectcache.go @@ -84,6 +84,10 @@ func (f *FieldCacheEntry) CanOmit(fieldVal reflect.Value) bool { func (f *FieldCacheEntry) GetFrom(structVal reflect.Value) reflect.Value { // field might be nested within 'inline' structs for _, elem := range f.fieldPath { + if safeIsNil(structVal) { + // if any part of the path is nil, return the zero value for the field type + return reflect.Zero(f.fieldType) + } structVal = dereference(structVal).FieldByIndex(elem) } return structVal From ed66b6e4d81116c8e02ec5b94d17fdd2b19912b6 Mon Sep 17 00:00:00 2001 From: Marcus Alder Date: Mon, 27 Apr 2026 19:10:47 -0700 Subject: [PATCH 27/78] Use io/os instead of deprecated ioutil (#952) Signed-off-by: LogicalShark --- cluster/gce/gci/append_or_replace_prefixed_line_test.go | 2 +- cmd/auth-provider-gcp/app/getcredentials.go | 4 ++-- cmd/gke-gcloud-auth-plugin/cred.go | 4 ++-- cmd/gke-gcloud-auth-plugin/cred_test.go | 5 ++--- pkg/credentialconfig/config.go | 7 +++---- pkg/credentialconfig/config_test.go | 3 +-- pkg/gcpcredential/gcpcredential.go | 4 ++-- providers/gce/gcpcredential/credentialutil.go | 3 +-- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/cluster/gce/gci/append_or_replace_prefixed_line_test.go b/cluster/gce/gci/append_or_replace_prefixed_line_test.go index 100961378f..0433381fa8 100644 --- a/cluster/gce/gci/append_or_replace_prefixed_line_test.go +++ b/cluster/gce/gci/append_or_replace_prefixed_line_test.go @@ -154,7 +154,7 @@ jelloworld } for _, tc := range testCases { t.Run(tc.desc, func(t *testing.T) { - f, err := os.CreateTemp("", "append_or_replace_test") + f, err := os.CreateTemp(t.TempDir(), "append_or_replace_test") if err != nil { t.Fatalf("Failed to create temp file: %v", err) } diff --git a/cmd/auth-provider-gcp/app/getcredentials.go b/cmd/auth-provider-gcp/app/getcredentials.go index 5c366cc4a9..e558769c65 100644 --- a/cmd/auth-provider-gcp/app/getcredentials.go +++ b/cmd/auth-provider-gcp/app/getcredentials.go @@ -19,7 +19,7 @@ package app import ( "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "os" @@ -112,7 +112,7 @@ func getCredentials(authFlow string) error { if err != nil { return err } - unparsedRequest, err := ioutil.ReadAll(os.Stdin) + unparsedRequest, err := io.ReadAll(os.Stdin) if err != nil { return err } diff --git a/cmd/gke-gcloud-auth-plugin/cred.go b/cmd/gke-gcloud-auth-plugin/cred.go index 0255727697..378ceee0df 100644 --- a/cmd/gke-gcloud-auth-plugin/cred.go +++ b/cmd/gke-gcloud-auth-plugin/cred.go @@ -11,7 +11,7 @@ import ( "encoding/json" "flag" "fmt" - "io/ioutil" + "os" "os/exec" "path/filepath" "strings" @@ -369,7 +369,7 @@ func executeCommand(name string, arg ...string) ([]byte, error) { } func readFile(filename string) ([]byte, error) { - return ioutil.ReadFile(filename) + return os.ReadFile(filename) } func timeNow() time.Time { diff --git a/cmd/gke-gcloud-auth-plugin/cred_test.go b/cmd/gke-gcloud-auth-plugin/cred_test.go index f09409f4d8..6ce4b5eef7 100644 --- a/cmd/gke-gcloud-auth-plugin/cred_test.go +++ b/cmd/gke-gcloud-auth-plugin/cred_test.go @@ -3,7 +3,6 @@ package main import ( "context" "fmt" - "os" "path" "testing" "time" @@ -703,14 +702,14 @@ func TestCloudsdkBasedGcloudAccessToken(t *testing.T) { } tokenForEnvVar := "gcloud_token_in_env_var" - os.Setenv(cloudsdkAuthAccessEnvVar, tokenForEnvVar) + t.Setenv(cloudsdkAuthAccessEnvVar, tokenForEnvVar) ec, err := p.execCredential() if err != nil { t.Fatalf("err should be nil") } - os.Setenv(cloudsdkAuthAccessEnvVar, "") + t.Setenv(cloudsdkAuthAccessEnvVar, "") if diff := cmp.Diff(ec.Status.Token, tokenForEnvVar); diff != "" { t.Errorf("unexpected token (-want +got): %s", diff) diff --git a/pkg/credentialconfig/config.go b/pkg/credentialconfig/config.go index 7ad63f5f57..d79f3b52d0 100644 --- a/pkg/credentialconfig/config.go +++ b/pkg/credentialconfig/config.go @@ -22,7 +22,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "os" "path/filepath" @@ -108,7 +107,7 @@ func ReadDockercfgFile(searchPaths []string) (cfg DockerConfig, err error) { continue } klog.V(4).Infof("looking for .dockercfg at %s", absDockerConfigFileLocation) - contents, err := ioutil.ReadFile(absDockerConfigFileLocation) + contents, err := os.ReadFile(absDockerConfigFileLocation) if os.IsNotExist(err) { continue } @@ -160,7 +159,7 @@ func ReadDockerConfigJSONFile(searchPaths []string) (cfg DockerConfig, err error func ReadSpecificDockerConfigJSONFile(filePath string) (cfg DockerConfig, err error) { var contents []byte - if contents, err = ioutil.ReadFile(filePath); err != nil { + if contents, err = os.ReadFile(filePath); err != nil { return nil, err } return readDockerConfigJSONFileFromBytes(contents) @@ -212,7 +211,7 @@ func ReadURL(url string, client *http.Client, header *http.Header) (body []byte, } limitedReader := &io.LimitedReader{R: resp.Body, N: maxReadLength} - contents, err := ioutil.ReadAll(limitedReader) + contents, err := io.ReadAll(limitedReader) if err != nil { return nil, err } diff --git a/pkg/credentialconfig/config_test.go b/pkg/credentialconfig/config_test.go index 8a5aec0a52..e7a8b0978e 100644 --- a/pkg/credentialconfig/config_test.go +++ b/pkg/credentialconfig/config_test.go @@ -19,7 +19,6 @@ package credentialconfig import ( "encoding/base64" "encoding/json" - "io/ioutil" "os" "path/filepath" "reflect" @@ -33,7 +32,7 @@ func TestReadDockerConfigFile(t *testing.T) { //test dockerconfig json inputDockerconfigJSONFile := "{ \"auths\": { \"http://foo.example.com\":{\"auth\":\"Zm9vOmJhcgo=\",\"email\":\"foo@example.com\"}}}" - preferredPath, err := ioutil.TempDir("", "test_foo_bar_dockerconfigjson_") + preferredPath, err := os.MkdirTemp(t.TempDir(), "test_foo_bar_dockerconfigjson_") if err != nil { t.Fatalf("Creating tmp dir fail: %v", err) return diff --git a/pkg/gcpcredential/gcpcredential.go b/pkg/gcpcredential/gcpcredential.go index a92c1aeb5d..c163182092 100644 --- a/pkg/gcpcredential/gcpcredential.go +++ b/pkg/gcpcredential/gcpcredential.go @@ -18,8 +18,8 @@ package gcpcredential import ( "encoding/json" - "io/ioutil" "net/http" + "os" "os/exec" "runtime" "strings" @@ -102,7 +102,7 @@ func onGCEVM() bool { } name = fields[1] } else { - data, err := ioutil.ReadFile(GCEProductNameFile) + data, err := os.ReadFile(GCEProductNameFile) if err != nil { klog.V(2).Infof("Error while reading product_name: %v", err) return false diff --git a/providers/gce/gcpcredential/credentialutil.go b/providers/gce/gcpcredential/credentialutil.go index 55a4988b86..4fd300cf26 100644 --- a/providers/gce/gcpcredential/credentialutil.go +++ b/providers/gce/gcpcredential/credentialutil.go @@ -21,7 +21,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "net/http" "k8s.io/cloud-provider/credentialconfig" @@ -68,7 +67,7 @@ func ReadURL(url string, client *http.Client, header *http.Header) (body []byte, } limitedReader := &io.LimitedReader{R: resp.Body, N: maxReadLength} - contents, err := ioutil.ReadAll(limitedReader) + contents, err := io.ReadAll(limitedReader) if err != nil { return nil, err } From ff733ef827d941c9be557f591c5d5b534ffeaa87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 07:40:54 +0530 Subject: [PATCH 28/78] chore(deps): bump actions/checkout from 4.3.1 to 6.0.2 (#1086) Bumps [actions/checkout](https://github.com/actions/checkout) from 4.3.1 to 6.0.2. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v4.3.1...de0fac2e4500dabe0009e67214ff5f5447ce83dd) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 6.0.2 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c5157d3aaa..b64762abc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 # Important for generating release notes From 17e54086743f4980c94da2cbce9db02534b0e5d4 Mon Sep 17 00:00:00 2001 From: Yuan Gao <272339838+ygao-g@users.noreply.github.com> Date: Mon, 27 Apr 2026 19:42:46 -0700 Subject: [PATCH 29/78] feat: add kops-based periodic test scenario for e2e-latest (#1082) This commit adds a new periodic test script ci-cloud-provider-gcp-e2e-latest-kops.sh to run general E2E tests using kOps, leaving existing tests unchanged. It also parameterizes the kops-e2e-test Makefile target to support custom focus and skip regexes needed for this new test. --- Makefile | 8 +++-- .../ci-cloud-provider-gcp-e2e-latest-kops.sh | 29 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 dev/ci/periodics/ci-cloud-provider-gcp-e2e-latest-kops.sh diff --git a/Makefile b/Makefile index dd225d91fb..0f4087508e 100644 --- a/Makefile +++ b/Makefile @@ -345,6 +345,10 @@ IMAGE_REPO ?= gcr.io/$(GCP_PROJECT) KOPS_STATE_STORE ?= gs://kops-state-$(GCP_PROJECT) IMAGE_TAG ?= $(shell git rev-parse --short HEAD) +# Defaults for kOps E2E tests +KOPS_FOCUS_REGEX ?= "\[Conformance\]" +KOPS_SKIP_REGEX ?= "\[Serial\]" + .PHONY: kops-simple kops-simple: ## Run kOps simple E2E test scenario. ./e2e/scenarios/kops-simple @@ -410,6 +414,6 @@ kops-e2e-test: kops-tool ## Run E2E tests on kOps cluster. -- \ --parallel=30 \ --test-package-version="${K8S_VERSION}" \ - --skip-regex="\[Serial\]" \ - --focus-regex="\[Conformance\]" + --skip-regex="$(KOPS_SKIP_REGEX)" \ + --focus-regex="$(KOPS_FOCUS_REGEX)" diff --git a/dev/ci/periodics/ci-cloud-provider-gcp-e2e-latest-kops.sh b/dev/ci/periodics/ci-cloud-provider-gcp-e2e-latest-kops.sh new file mode 100755 index 0000000000..ae2b3dfedd --- /dev/null +++ b/dev/ci/periodics/ci-cloud-provider-gcp-e2e-latest-kops.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Copyright 2026 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 +set -o xtrace + +cd $GOPATH/src/cloud-provider-gcp +e2e/add-kubernetes-to-workspace.sh + +export KOPS_FOCUS_REGEX="" # Run all non-skipped tests +export KOPS_SKIP_REGEX='\[Slow\]|\[Serial\]|\[Disruptive\]|\[Flaky\]|\[Feature:.+\]' +export CLUSTER_NAME="kops-e2e-latest.k8s.local" + +e2e/scenarios/kops-simple From c4b206089b598c8fd0dd2a664ddda97a884d763e Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Tue, 28 Apr 2026 15:43:23 -0400 Subject: [PATCH 30/78] remove scheduling.k8s.io/v1alpha1 from kube-apiserver runtime-config (#1092) scheduling.k8s.io/v1alpha1 was removed in k8s v1.36 (kubernetes/kubernetes#136976). Passing it via --runtime-config causes kube-apiserver to fail at startup, breaking cluster bring-up in all CI jobs since v1.36.0 was cut on 2026-04-22. Mirrors the equivalent fix already in kubernetes/kubernetes cluster/gce/config-test.sh. Signed-off-by: Davanum Srinivas --- cluster/gce/config-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 36bb207d6a..992fb7d9fe 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -246,7 +246,7 @@ fi if [[ "${MASTER_OS_DISTRIBUTION}" = 'gci' ]] || [[ "${MASTER_OS_DISTRIBUTION}" = 'ubuntu' ]]; then MASTER_KUBELET_TEST_ARGS="${MASTER_KUBELET_TEST_ARGS:-} --kernel-memcg-notification=true" fi -APISERVER_TEST_ARGS="${APISERVER_TEST_ARGS:-} --runtime-config=extensions/v1beta1,scheduling.k8s.io/v1alpha1 ${TEST_CLUSTER_DELETE_COLLECTION_WORKERS} ${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT}" +APISERVER_TEST_ARGS="${APISERVER_TEST_ARGS:-} --runtime-config=extensions/v1beta1 ${TEST_CLUSTER_DELETE_COLLECTION_WORKERS} ${TEST_CLUSTER_MAX_REQUESTS_INFLIGHT}" CONTROLLER_MANAGER_TEST_ARGS="${CONTROLLER_MANAGER_TEST_ARGS:-} ${TEST_CLUSTER_RESYNC_PERIOD} ${TEST_CLUSTER_API_CONTENT_TYPE}" SCHEDULER_TEST_ARGS="${SCHEDULER_TEST_ARGS:-} ${TEST_CLUSTER_API_CONTENT_TYPE}" KUBEPROXY_TEST_ARGS="${KUBEPROXY_TEST_ARGS:-} ${TEST_CLUSTER_API_CONTENT_TYPE}" From 3cac5a4434d7ee564c0dfd13d2991b11c8696f0b Mon Sep 17 00:00:00 2001 From: Walter Fender Date: Tue, 28 Apr 2026 14:13:23 -0700 Subject: [PATCH 31/78] Add a few hints to kops quick start. (#1093) Ensure we record setting up required app default auth. Record setting the necessary kubectl config. --- docs/kops-quickstart.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/kops-quickstart.md b/docs/kops-quickstart.md index 81b0e307da..13aebd1e01 100644 --- a/docs/kops-quickstart.md +++ b/docs/kops-quickstart.md @@ -14,6 +14,8 @@ The `make kops-up` target is an end-to-end workflow that automatically: - Pushes the image to your Artifact Registry. - Deploys the CCM (along with required RBAC) to the cluster. +You'll also need to configure default credentials, using `gcloud auth application-default login`. + Run the following commands to get started: ```sh @@ -33,6 +35,9 @@ gcloud storage buckets create ${KOPS_STATE_STORE} --location=${GCP_LOCATION} || # Run the cluster creation target, may take several minutes make kops-up + +# Ensure you are configured to talk to the correct cluster. +kubectl config use-context $KOPS_CLUSTER_NAME ``` ## Verification From daae909344427423f9122cd6b7e1d69203706145 Mon Sep 17 00:00:00 2001 From: Pierluigi Lenoci Date: Sun, 3 May 2026 10:23:38 +0200 Subject: [PATCH 32/78] fix: honor -stderrthreshold when -logtostderr=true (#1080) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit klog v2 defaults -logtostderr to true, which silently ignores -stderrthreshold — all severities are unconditionally sent to stderr. Opt into the fixed behavior introduced in klog v2.140.0 by setting legacy_stderr_threshold_behavior=false so that -stderrthreshold is respected. The default is set to INFO (preserving current behavior); users can now override it on the command line. Ref: kubernetes/klog#212, kubernetes/klog#432 Signed-off-by: Pierluigi Lenoci Signed-off-by: Pierluigi Lenoci --- cmd/auth-provider-gcp/main.go | 5 +++++ cmd/gke-gcloud-auth-plugin/cred.go | 5 +++++ metis/cmd/main.go | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/cmd/auth-provider-gcp/main.go b/cmd/auth-provider-gcp/main.go index 795daa2708..34ec41ea5c 100644 --- a/cmd/auth-provider-gcp/main.go +++ b/cmd/auth-provider-gcp/main.go @@ -39,6 +39,11 @@ func main() { } rootCmd.AddCommand(credCmd) klog.InitFlags(nil) + // Opt into the new klog behavior so that -stderrthreshold is honored even + // when -logtostderr=true (the default). + // Ref: kubernetes/klog#212, kubernetes/klog#432 + flag.Set("legacy_stderr_threshold_behavior", "false") //nolint:errcheck + flag.Set("stderrthreshold", "INFO") //nolint:errcheck flag.Parse() pflag.CommandLine.AddGoFlagSet(flag.CommandLine) if err := rootCmd.Execute(); err != nil { diff --git a/cmd/gke-gcloud-auth-plugin/cred.go b/cmd/gke-gcloud-auth-plugin/cred.go index 378ceee0df..c35b9aa20e 100644 --- a/cmd/gke-gcloud-auth-plugin/cred.go +++ b/cmd/gke-gcloud-auth-plugin/cred.go @@ -108,6 +108,11 @@ var ( func main() { klog.InitFlags(nil) + // Opt into the new klog behavior so that -stderrthreshold is honored even + // when -logtostderr=true (the default). + // Ref: kubernetes/klog#212, kubernetes/klog#432 + flag.Set("legacy_stderr_threshold_behavior", "false") //nolint:errcheck + flag.Set("stderrthreshold", "INFO") //nolint:errcheck defer klog.Flush() pflag.CommandLine.AddGoFlagSet(flag.CommandLine) // this is required to setup klog flags pflag.Parse() diff --git a/metis/cmd/main.go b/metis/cmd/main.go index c6373a7519..a45929d24f 100644 --- a/metis/cmd/main.go +++ b/metis/cmd/main.go @@ -27,6 +27,11 @@ import ( func main() { defer logs.FlushLogs() klog.InitFlags(nil) + // Opt into the new klog behavior so that -stderrthreshold is honored even + // when -logtostderr=true (the default). + // Ref: kubernetes/klog#212, kubernetes/klog#432 + flag.Set("legacy_stderr_threshold_behavior", "false") //nolint:errcheck + flag.Set("stderrthreshold", "INFO") //nolint:errcheck logs.InitLogs() rootCmd := &cobra.Command{ From c802ab5357d4fcafe9bab9e989941af701584f56 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Mon, 4 May 2026 23:08:23 -0700 Subject: [PATCH 33/78] Support component prefix in auto-tag script (#1103) This is to support tagging other components besides CCM. --- tools/auto-tag.sh | 57 ++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/tools/auto-tag.sh b/tools/auto-tag.sh index dd8e6b8246..f224d70433 100755 --- a/tools/auto-tag.sh +++ b/tools/auto-tag.sh @@ -23,71 +23,76 @@ cd "${KUBE_ROOT}" DRY_RUN=${DRY_RUN:-true} FORCE_BRANCH=${FORCE_BRANCH:-""} +COMPONENT_PREFIX=${COMPONENT_PREFIX:-""} +if [[ -n "${COMPONENT_PREFIX}" && "${COMPONENT_PREFIX}" != */ ]]; then + echo "ERROR: COMPONENT_PREFIX must end with a trailing slash (e.g., auth-provider-gcp/)" + exit 1 +fi # Get branch name BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD) -if [[ -n "$FORCE_BRANCH" ]]; then - echo "Forcing branch name to: $FORCE_BRANCH" - BRANCH_NAME="$FORCE_BRANCH" +if [[ -n "${FORCE_BRANCH}" ]]; then + echo "Forcing branch name to: ${FORCE_BRANCH}" + BRANCH_NAME="${FORCE_BRANCH}" fi -echo "Current branch: $BRANCH_NAME" +echo "Current branch: ${BRANCH_NAME}" # Enforce release branch -if [[ ! "$BRANCH_NAME" =~ ^release-1\.([0-9]+)$ ]]; then +if [[ ! "${BRANCH_NAME}" =~ ^release-1\.([0-9]+)$ ]]; then echo "ERROR: This script must be run only in a release branch (release-1.X)." exit 1 fi # Get version from go.mod VERSION_STRING=$(grep -E 'k8s.io/client-go' go.mod | grep -oE 'v0\.[0-9]+\.[0-9]+' | head -n 1) -echo "Found client-go version string: $VERSION_STRING" +echo "Found client-go version string: ${VERSION_STRING}" -if [[ "$VERSION_STRING" =~ v0\.([0-9]+)\.([0-9]+) ]]; then +if [[ "${VERSION_STRING}" =~ v0\.([0-9]+)\.([0-9]+) ]]; then MINOR="${BASH_REMATCH[1]}" PATCH="${BASH_REMATCH[2]}" - echo "Extracted version parameters: MINOR=$MINOR, PATCH=$PATCH" + echo "Extracted version parameters: MINOR=${MINOR}, PATCH=${PATCH}" else echo "Could not determine client-go version from go.mod" exit 1 fi -TAG_PREFIX="v$MINOR.$PATCH." -echo "Tag prefix: $TAG_PREFIX" +TAG_PREFIX="${COMPONENT_PREFIX}v${MINOR}.${PATCH}." +echo "Tag prefix: ${TAG_PREFIX}" # Fetch tags echo "Fetching tags..." -git fetch --tags +git fetch --tags --force # Find largest tag -TAGS=$(git tag -l "$TAG_PREFIX*") +TAGS=$(git tag -l "${TAG_PREFIX}*") -LARGEST_CCM_PATCH=-1 -for t in $TAGS; do - if [[ "$t" =~ ^v$MINOR\.$PATCH\.([0-9]+)$ ]]; then +LARGEST_COMPONENT_PATCH=-1 +for t in ${TAGS}; do + if [[ "${t}" =~ ^"${COMPONENT_PREFIX}"v${MINOR}\.${PATCH}\.([0-9]+)$ ]]; then p="${BASH_REMATCH[1]}" - if (( p > LARGEST_CCM_PATCH )); then - LARGEST_CCM_PATCH=$p + if (( p > LARGEST_COMPONENT_PATCH )); then + LARGEST_COMPONENT_PATCH=${p} fi fi done -CCM_PATCH=$((LARGEST_CCM_PATCH + 1)) -NEW_TAG="v$MINOR.$PATCH.$CCM_PATCH" +COMPONENT_PATCH=$((LARGEST_COMPONENT_PATCH + 1)) +NEW_TAG="${COMPONENT_PREFIX}v${MINOR}.${PATCH}.${COMPONENT_PATCH}" -echo "Calculated new tag: $NEW_TAG" +echo "Calculated new tag: ${NEW_TAG}" -if [ "$DRY_RUN" = "true" ]; then +if [ "${DRY_RUN}" = "true" ]; then echo "DRY RUN: Skipping tag creation and push." echo "To create the tag, run with DRY_RUN=false" exit 0 fi -echo "Creating tag $NEW_TAG..." -git tag "$NEW_TAG" -m "CCM build for Kubernetes v1.$MINOR.$PATCH" +echo "Creating tag ${NEW_TAG}..." +git tag "${NEW_TAG}" -m "${COMPONENT_PREFIX%/:-CCM} build for Kubernetes v1.${MINOR}.${PATCH}" -echo "Pushing tag $NEW_TAG..." -git push origin "$NEW_TAG" +echo "Pushing tag ${NEW_TAG}..." +git push origin "${NEW_TAG}" -echo "Successfully created and pushed tag $NEW_TAG" +echo "Successfully created and pushed tag ${NEW_TAG}" From d4f479ebe9f33c1706a1d5b1cfafe903c23dc252 Mon Sep 17 00:00:00 2001 From: Zicong Date: Tue, 5 May 2026 10:42:23 -0700 Subject: [PATCH 34/78] feat: Skip managing non-GKE nodes with a special label (#1081) * Override node lifecycle manager to filter nodes by cloud.google.com/gke-unmanaged-node=true label * Fix crash in node lifecycle controller by hardcoding client name * Refactor node filtering logic to ignore unmanaged nodes in Lifecycle and IPAM controllers - Centralized unmanaged node filtering logic into a shared utility in pkg/util/node/node.go. - Updated Node Lifecycle Controller to use the shared filtering utility. - Updated Node IPAM Controller (both Cloud and Range allocators) to ignore nodes with the cloud.google.com/gke-unmanaged-node: true label. - Updated related tests to reflect the changes. * InstanceExists * Fix CloudNodeController to ignore unmanaged nodes - Overrode the default CloudNodeController initializer in cmd/cloud-controller-manager/main.go. - Implemented startCloudNodeControllerWrapper in a new file cmd/cloud-controller-manager/nodecontroller.go. - The new initializer wraps the node informer with GCEFilteringNodeInformer to ensure the node controller filters out nodes with the cloud.google.com/gke-unmanaged-node: true label. * Fix ipam missing node * Remove filter in New func * update the code after rebase * update the log message * rename the label * fmt * add comments * Create dedicated error for not managed nodes * move the filtering informer to top level of ipam controller * update the unit test * unified the node controller and node lifecycle controller * fix a error in err handing * Remove filtering informer * Implement event stream filtering in GCEFilteringNodeInformer and clean up redundant checks in range_allocator * nit: rename some variables --- .../gketenantcontrollermanager.go | 14 ++- cmd/cloud-controller-manager/main.go | 11 ++ .../nodecontroller.go | 60 +++++++++ .../nodeipamcontroller.go | 6 +- .../nodelifecyclecontroller.go | 58 +++++++++ .../nodelifecyclecontroller_test.go | 116 +++++++++++++++++ .../ipam/cloud_cidr_allocator_test.go | 4 +- pkg/util/node/node.go | 119 ++++++++++++++++++ 8 files changed, 383 insertions(+), 5 deletions(-) create mode 100644 cmd/cloud-controller-manager/nodecontroller.go create mode 100644 cmd/cloud-controller-manager/nodelifecyclecontroller.go create mode 100644 cmd/cloud-controller-manager/nodelifecyclecontroller_test.go diff --git a/cmd/cloud-controller-manager/gketenantcontrollermanager.go b/cmd/cloud-controller-manager/gketenantcontrollermanager.go index a4cf4cb699..76b1b0dcbf 100644 --- a/cmd/cloud-controller-manager/gketenantcontrollermanager.go +++ b/cmd/cloud-controller-manager/gketenantcontrollermanager.go @@ -20,6 +20,7 @@ import ( "k8s.io/cloud-provider-gcp/pkg/controller/gketenantcontrollers" "k8s.io/cloud-provider-gcp/pkg/controller/gketenantcontrollers/utils" nodeipamconfig "k8s.io/cloud-provider-gcp/pkg/controller/nodeipam/config" + utilnode "k8s.io/cloud-provider-gcp/pkg/util/node" "k8s.io/cloud-provider/app" cloudcontrollerconfig "k8s.io/cloud-provider/app/config" controllermanagerapp "k8s.io/controller-manager/app" @@ -104,8 +105,10 @@ func startGKETenantControllerManager(mgrCfg gkeTenantControllerManagerConfig) (c controllers := map[string]gketenantcontrollers.ControllerStartFunc{ "node-controller": func(cfg *gketenantcontrollers.ControllerConfig) error { klog.Infof("Creating OSS Cloud Node Controller for %s...", cfg.ProviderConfig.Name) + // Wrap the informer to filter nodes + filteringInformer := &utilnode.GKEFilteringNodeInformer{NodeInformer: cfg.NodeInformer} nodeController, err := node.NewCloudNodeController( - cfg.NodeInformer, + filteringInformer, cfg.KubeClient, cfg.Cloud, mgrCfg.completedConfig.ComponentConfig.NodeStatusUpdateFrequency.Duration, @@ -133,9 +136,12 @@ func startGKETenantControllerManager(mgrCfg gkeTenantControllerManagerConfig) (c tenantNodeIPAMConfig.EnableMultiSubnetCluster = false } + // Wrap the informer to filter nodes + filteringInformer := &utilnode.GKEFilteringNodeInformer{NodeInformer: cfg.NodeInformer} + _, started, err := nodeipam.StartNodeIpamController( cfg.Context, - cfg.NodeInformer, + filteringInformer, cfg.KubeClient, cfg.Cloud, cidrs, @@ -172,8 +178,10 @@ func startGKETenantControllerManager(mgrCfg gkeTenantControllerManagerConfig) (c "node-lifecycle-controller": func(cfg *gketenantcontrollers.ControllerConfig) error { klog.Infof("Creating Node Lifecycle Controller for %s...", cfg.ProviderConfig.Name) nodeMonitorPeriod := mgrCfg.completedConfig.ComponentConfig.KubeCloudShared.NodeMonitorPeriod.Duration + // Wrap the informer to filter nodes + filteringInformer := &utilnode.GKEFilteringNodeInformer{NodeInformer: cfg.NodeInformer} lifecycleController, err := nodelifecycle.NewCloudNodeLifecycleController( - cfg.NodeInformer, + filteringInformer, cfg.KubeClient, cfg.Cloud, nodeMonitorPeriod, diff --git a/cmd/cloud-controller-manager/main.go b/cmd/cloud-controller-manager/main.go index 1bef2f43cc..4d491d051b 100644 --- a/cmd/cloud-controller-manager/main.go +++ b/cmd/cloud-controller-manager/main.go @@ -111,6 +111,17 @@ func main() { Constructor: nodeIpamController.startNodeIpamControllerWrapper, } + controllerInitializers[names.CloudNodeController] = app.ControllerInitFuncConstructor{ + InitContext: app.ControllerInitContext{ + ClientName: "node-controller", + }, + Constructor: startCloudNodeControllerWrapper, + } + + controllerInitializers[names.CloudNodeLifecycleController] = app.ControllerInitFuncConstructor{ + Constructor: startCloudNodeLifecycleControllerWrapper, + } + controllerInitializers["gkenetworkparamset"] = app.ControllerInitFuncConstructor{ Constructor: startGkeNetworkParamSetControllerWrapper, } diff --git a/cmd/cloud-controller-manager/nodecontroller.go b/cmd/cloud-controller-manager/nodecontroller.go new file mode 100644 index 0000000000..e81401733d --- /dev/null +++ b/cmd/cloud-controller-manager/nodecontroller.go @@ -0,0 +1,60 @@ +/* +Copyright 2026 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. +*/ + +package main + +import ( + "context" + + cloudprovider "k8s.io/cloud-provider" + utilnode "k8s.io/cloud-provider-gcp/pkg/util/node" + "k8s.io/cloud-provider/app" + cloudcontrollerconfig "k8s.io/cloud-provider/app/config" + "k8s.io/cloud-provider/controllers/node" + controllermanagerapp "k8s.io/controller-manager/app" + "k8s.io/controller-manager/controller" + "k8s.io/klog/v2" +) + +func startCloudNodeControllerWrapper(initContext app.ControllerInitContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) app.InitFunc { + return func(ctx context.Context, controllerContext controllermanagerapp.ControllerContext) (controller.Interface, bool, error) { + return startCloudNodeController(ctx, initContext, controllerContext, completedConfig, cloud) + } +} + +func startCloudNodeController(ctx context.Context, initContext app.ControllerInitContext, controllerContext controllermanagerapp.ControllerContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) (controller.Interface, bool, error) { + // Wrap the informer to filter nodes + filteringInformer := &utilnode.GKEFilteringNodeInformer{NodeInformer: completedConfig.SharedInformers.Core().V1().Nodes()} + + // Start the CloudNodeController + nodeController, err := node.NewCloudNodeController( + filteringInformer, + // cloud node controller uses existing cluster role from node-controller + completedConfig.ClientBuilder.ClientOrDie(initContext.ClientName), + cloud, + completedConfig.ComponentConfig.NodeStatusUpdateFrequency.Duration, + completedConfig.ComponentConfig.NodeController.ConcurrentNodeSyncs, + completedConfig.ComponentConfig.NodeController.ConcurrentNodeStatusUpdates, + ) + if err != nil { + klog.Warningf("failed to start cloud node controller: %s", err) + return nil, false, nil + } + + go nodeController.Run(ctx.Done(), controllerContext.ControllerManagerMetrics) + + return nil, true, nil +} diff --git a/cmd/cloud-controller-manager/nodeipamcontroller.go b/cmd/cloud-controller-manager/nodeipamcontroller.go index ee6430f4af..f490f8cce5 100644 --- a/cmd/cloud-controller-manager/nodeipamcontroller.go +++ b/cmd/cloud-controller-manager/nodeipamcontroller.go @@ -29,6 +29,7 @@ import ( nodeipamcontroller "k8s.io/cloud-provider-gcp/pkg/controller/nodeipam" nodeipamconfig "k8s.io/cloud-provider-gcp/pkg/controller/nodeipam/config" "k8s.io/cloud-provider-gcp/pkg/controller/nodeipam/ipam" + utilnode "k8s.io/cloud-provider-gcp/pkg/util/node" "k8s.io/cloud-provider/app" cloudcontrollerconfig "k8s.io/cloud-provider/app/config" genericcontrollermanager "k8s.io/controller-manager/app" @@ -70,9 +71,12 @@ func startNodeIpamController(ccmConfig *cloudcontrollerconfig.CompletedConfig, n nwInformer := nwInfFactory.Networking().V1().Networks() gnpInformer := nwInfFactory.Networking().V1().GKENetworkParamSets() + // Wrap the informer to filter nodes + filteringInformer := &utilnode.GKEFilteringNodeInformer{NodeInformer: ccmConfig.SharedInformers.Core().V1().Nodes()} + ctrl, started, err := nodeipamcontroller.StartNodeIpamController( wait.ContextForChannel(ctx.Stop), - ccmConfig.SharedInformers.Core().V1().Nodes(), + filteringInformer, ccmConfig.ClientBuilder.ClientOrDie("node-controller"), cloud, ccmConfig.ComponentConfig.KubeCloudShared.ClusterCIDR, diff --git a/cmd/cloud-controller-manager/nodelifecyclecontroller.go b/cmd/cloud-controller-manager/nodelifecyclecontroller.go new file mode 100644 index 0000000000..26dc2b62ce --- /dev/null +++ b/cmd/cloud-controller-manager/nodelifecyclecontroller.go @@ -0,0 +1,58 @@ +/* +Copyright 2026 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. +*/ + +package main + +import ( + "context" + + cloudprovider "k8s.io/cloud-provider" + utilnode "k8s.io/cloud-provider-gcp/pkg/util/node" + "k8s.io/cloud-provider/app" + cloudcontrollerconfig "k8s.io/cloud-provider/app/config" + "k8s.io/cloud-provider/controllers/nodelifecycle" + controllermanagerapp "k8s.io/controller-manager/app" + "k8s.io/controller-manager/controller" + "k8s.io/klog/v2" +) + +func startCloudNodeLifecycleControllerWrapper(initContext app.ControllerInitContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) app.InitFunc { + return func(ctx context.Context, controllerContext controllermanagerapp.ControllerContext) (controller.Interface, bool, error) { + return startCloudNodeLifecycleController(ctx, initContext, controllerContext, completedConfig, cloud) + } +} + +func startCloudNodeLifecycleController(ctx context.Context, initContext app.ControllerInitContext, controllerContext controllermanagerapp.ControllerContext, completedConfig *cloudcontrollerconfig.CompletedConfig, cloud cloudprovider.Interface) (controller.Interface, bool, error) { + // Wrap the informer to filter nodes + filteringInformer := &utilnode.GKEFilteringNodeInformer{NodeInformer: completedConfig.SharedInformers.Core().V1().Nodes()} + + // Start the cloudNodeLifecycleController + cloudNodeLifecycleController, err := nodelifecycle.NewCloudNodeLifecycleController( + filteringInformer, + // cloud node lifecycle controller uses existing cluster role from node-controller + completedConfig.ClientBuilder.ClientOrDie("cloud-node-lifecycle-controller"), + cloud, + completedConfig.ComponentConfig.KubeCloudShared.NodeMonitorPeriod.Duration, + ) + if err != nil { + klog.Warningf("failed to start cloud node lifecycle controller: %s", err) + return nil, false, nil + } + + go cloudNodeLifecycleController.Run(ctx, controllerContext.ControllerManagerMetrics) + + return nil, true, nil +} diff --git a/cmd/cloud-controller-manager/nodelifecyclecontroller_test.go b/cmd/cloud-controller-manager/nodelifecyclecontroller_test.go new file mode 100644 index 0000000000..70fc1c49c0 --- /dev/null +++ b/cmd/cloud-controller-manager/nodelifecyclecontroller_test.go @@ -0,0 +1,116 @@ +/* +Copyright 2026 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. +*/ + +package main + +import ( + "context" + "testing" + "time" + + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/informers" + "k8s.io/client-go/kubernetes/fake" + cloudprovider "k8s.io/cloud-provider" + "k8s.io/cloud-provider-gcp/pkg/util/node" + "k8s.io/cloud-provider/controllers/nodelifecycle" +) + +type mockInstances struct { + cloudprovider.Instances + existsCalled map[string]bool +} + +func (m *mockInstances) InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error) { + if m.existsCalled == nil { + m.existsCalled = make(map[string]bool) + } + m.existsCalled[providerID] = true + return true, nil +} + +func (m *mockInstances) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) { + return false, nil +} + +type mockCloud struct { + cloudprovider.Interface + instances *mockInstances +} + +func (m *mockCloud) Instances() (cloudprovider.Instances, bool) { + return m.instances, true +} + +func (m *mockCloud) InstancesV2() (cloudprovider.InstancesV2, bool) { + return nil, false +} + +func TestMonitorNodes_FilterLabel(t *testing.T) { + fakeClient := fake.NewSimpleClientset() + informerFactory := informers.NewSharedInformerFactory(fakeClient, 0) + nodeInformer := informerFactory.Core().V1().Nodes() + + managedNode := &v1.Node{ + ObjectMeta: metav1.ObjectMeta{Name: "managed-node"}, + Spec: v1.NodeSpec{ProviderID: "gce://project/zone/managed-node"}, + Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionFalse}}}, + } + unmanagedNode := &v1.Node{ + ObjectMeta: metav1.ObjectMeta{ + Name: "unmanaged-node", + Labels: map[string]string{node.GKEUnmanagedNodeLabelKey: node.GKEUnmanagedNodeLabelValue}, + }, + Spec: v1.NodeSpec{ProviderID: "gce://project/zone/unmanaged-node"}, + Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionFalse}}}, + } + labeledManagedNode := &v1.Node{ + ObjectMeta: metav1.ObjectMeta{ + Name: "labeled-managed-node", + Labels: map[string]string{node.GKEUnmanagedNodeLabelKey: "false"}, + }, + Spec: v1.NodeSpec{ProviderID: "gce://project/zone/labeled-managed-node"}, + Status: v1.NodeStatus{Conditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionFalse}}}, + } + + nodeInformer.Informer().GetStore().Add(managedNode) + nodeInformer.Informer().GetStore().Add(unmanagedNode) + nodeInformer.Informer().GetStore().Add(labeledManagedNode) + + mockInst := &mockInstances{existsCalled: make(map[string]bool)} + mockCl := &mockCloud{instances: mockInst} + + // Wrap the informer to filter nodes + filteringInformer := &node.GKEFilteringNodeInformer{NodeInformer: nodeInformer} + + c, err := nodelifecycle.NewCloudNodeLifecycleController(filteringInformer, fakeClient, mockCl, 5*time.Minute) + if err != nil { + t.Fatalf("failed to create controller: %v", err) + } + + c.MonitorNodes(context.Background()) + + if !mockInst.existsCalled[managedNode.Spec.ProviderID] { + t.Errorf("expected InstanceExistsByProviderID to be called for managed node, but it wasn't") + } + if !mockInst.existsCalled[labeledManagedNode.Spec.ProviderID] { + t.Errorf("expected InstanceExistsByProviderID to be called for labeled managed node (false), but it wasn't") + } + if mockInst.existsCalled[unmanagedNode.Spec.ProviderID] { + t.Errorf("expected InstanceExistsByProviderID NOT to be called for unmanaged node, but it was") + } +} diff --git a/pkg/controller/nodeipam/ipam/cloud_cidr_allocator_test.go b/pkg/controller/nodeipam/ipam/cloud_cidr_allocator_test.go index 56f835d65b..3217db2927 100644 --- a/pkg/controller/nodeipam/ipam/cloud_cidr_allocator_test.go +++ b/pkg/controller/nodeipam/ipam/cloud_cidr_allocator_test.go @@ -510,7 +510,9 @@ func TestUpdateCIDRAllocation(t *testing.T) { }, Clientset: fake.NewSimpleClientset(), }, - nodeChanges: func(node *v1.Node) {}, + nodeChanges: func(node *v1.Node) {}, + expectErr: true, + expectErrMsg: "node \"test\" not found", }, { name: "want error - provider not set", diff --git a/pkg/util/node/node.go b/pkg/util/node/node.go index bea8839386..1df3b6a596 100644 --- a/pkg/util/node/node.go +++ b/pkg/util/node/node.go @@ -25,8 +25,12 @@ import ( networkv1 "github.com/GoogleCloudPlatform/gke-networking-api/apis/network/v1" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + coreinformers "k8s.io/client-go/informers/core/v1" clientset "k8s.io/client-go/kubernetes" + v1lister "k8s.io/client-go/listers/core/v1" + "k8s.io/client-go/tools/cache" "k8s.io/klog/v2" ) @@ -39,8 +43,123 @@ const ( DefaultSubnetLabelPrefix = "cloud.google.com/gke-np-default-subnet" // NodePoolSubnetLabelPrefix is the prefix for the subnet name for this node NodePoolSubnetLabelPrefix = "cloud.google.com/gke-node-pool-subnet" + // GKEUnmanagedNodeLabelKey is the label key used to identify nodes that should be ignored by GKE controllers. + GKEUnmanagedNodeLabelKey = "components.gke.io/gke-unmanaged-node" + // GKEUnmanagedNodeLabelValue is the label value used to identify nodes that should be ignored by GKE controllers. + GKEUnmanagedNodeLabelValue = "true" ) +// GKEFilteringNodeInformer wraps a NodeInformer to filter out unmanaged nodes from the lister. +type GKEFilteringNodeInformer struct { + coreinformers.NodeInformer +} + +// Lister returns a GKEFilteringNodeLister. +func (i *GKEFilteringNodeInformer) Lister() v1lister.NodeLister { + return &GKEFilteringNodeLister{i.NodeInformer.Lister()} +} + +// Informer returns the wrapped Informer. +func (i *GKEFilteringNodeInformer) Informer() cache.SharedIndexInformer { + return &GKEFilteringSharedIndexInformer{i.NodeInformer.Informer()} +} + +// GKEFilteringSharedIndexInformer wraps a SharedIndexInformer to filter out unmanaged nodes from the event stream. +type GKEFilteringSharedIndexInformer struct { + cache.SharedIndexInformer +} + +// AddEventHandler adds an event handler to the shared informer with filtering. +func (f *GKEFilteringSharedIndexInformer) AddEventHandler(handler cache.ResourceEventHandler) (cache.ResourceEventHandlerRegistration, error) { + return f.SharedIndexInformer.AddEventHandler(cache.FilteringResourceEventHandler{ + FilterFunc: func(obj interface{}) bool { + node, ok := obj.(*v1.Node) + return ok && !IsUnmanagedNode(node) + }, + Handler: handler, + }) +} + +// AddEventHandlerWithResyncPeriod adds an event handler to the shared informer with a custom resync period and filtering. +func (f *GKEFilteringSharedIndexInformer) AddEventHandlerWithResyncPeriod(handler cache.ResourceEventHandler, resyncPeriod time.Duration) (cache.ResourceEventHandlerRegistration, error) { + return f.SharedIndexInformer.AddEventHandlerWithResyncPeriod(cache.FilteringResourceEventHandler{ + FilterFunc: func(obj interface{}) bool { + node, ok := obj.(*v1.Node) + return ok && !IsUnmanagedNode(node) + }, + Handler: handler, + }, resyncPeriod) +} + +// IsUnmanagedNode returns true if the node has the unmanaged label. +func IsUnmanagedNode(node *v1.Node) bool { + if node == nil { + return false + } + val, ok := node.Labels[GKEUnmanagedNodeLabelKey] + return ok && val == GKEUnmanagedNodeLabelValue +} + +// GKEFilteringNodeLister wraps a NodeLister to filter out nodes with the unmanaged label. +type GKEFilteringNodeLister struct { + v1lister.NodeLister +} + +// List lists all Nodes in the indexer, filtering out unmanaged nodes. +func (l *GKEFilteringNodeLister) List(selector labels.Selector) (ret []*v1.Node, err error) { + nodes, err := l.NodeLister.List(selector) + if err != nil { + return nil, err + } + var filtered []*v1.Node + for _, n := range nodes { + if IsUnmanagedNode(n) { + continue + } + filtered = append(filtered, n) + } + return filtered, nil +} + +// Get retrieves a Node by name from the indexer, returning a ErrNodeUnmanaged error if the node is unmanaged. +func (l *GKEFilteringNodeLister) Get(name string) (*v1.Node, error) { + node, err := l.NodeLister.Get(name) + if err != nil { + return nil, err + } + if IsUnmanagedNode(node) { + return nil, &ErrNodeUnmanagedByGKE{Name: name} + } + return node, nil +} + +// ErrNodeUnmanagedByGKE is returned when a node is found but marked as unmanaged. +type ErrNodeUnmanagedByGKE struct { + Name string +} + +func (e *ErrNodeUnmanagedByGKE) Error() string { + return fmt.Sprintf("node %q is unmanaged by GKE", e.Name) +} + +// Status allows this error to be recognized by apierrors.IsNotFound() +// so that standard controllers ignore it instead of retrying forever. +func (e *ErrNodeUnmanagedByGKE) Status() metav1.Status { + return metav1.Status{ + Reason: metav1.StatusReasonNotFound, + Message: e.Error(), + } +} + +// IsUnmanagedNodeError checks if an error is an ErrNodeUnmanaged. +func IsUnmanagedNodeError(err error) bool { + if err == nil { + return false + } + _, ok := err.(*ErrNodeUnmanagedByGKE) + return ok +} + type nodeForConditionPatch struct { Status nodeStatusForPatch `json:"status"` } From 0d8c0d231001bab167df2494073f63e97e7b4f01 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Thu, 7 May 2026 12:59:18 -0700 Subject: [PATCH 35/78] Rename kops Makefile targets to standardized generic test-cluster targets (#1105) --- Makefile | 30 +++++++++++++++--------------- docs/RELEASE.md | 4 ++-- docs/kops-quickstart.md | 6 +++--- e2e/scenarios/kops-simple | 8 ++++---- tools/run-e2e-test.sh | 6 +++--- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 0f4087508e..e192761344 100644 --- a/Makefile +++ b/Makefile @@ -335,7 +335,7 @@ print-k8s-version: ## Print the pinned Kubernetes version. @if [ -f ginko-test-package-version.env ]; then cat ginko-test-package-version.env | tr -d '[:space:]'; else curl -sL https://dl.k8s.io/release/stable.txt; fi ## -------------------------------------- -##@ kOps E2E +##@ Test Cluster E2E ## -------------------------------------- KOPS_CLUSTER_NAME ?= kops-e2e.k8s.local @@ -349,12 +349,12 @@ IMAGE_TAG ?= $(shell git rev-parse --short HEAD) KOPS_FOCUS_REGEX ?= "\[Conformance\]" KOPS_SKIP_REGEX ?= "\[Serial\]" -.PHONY: kops-simple -kops-simple: ## Run kOps simple E2E test scenario. +.PHONY: test-cluster-simple +test-cluster-simple: ## Run test cluster simple E2E test scenario. ./e2e/scenarios/kops-simple -.PHONY: install-kops-deps -install-kops-deps: ## Install kubetest2 and other dependencies. +.PHONY: install-test-cluster-deps +install-test-cluster-deps: ## Install kubetest2 and other dependencies. @echo "Installing kubetest2 and plugins..." @mkdir -p $(LOCAL_BIN) @GOBIN=$(LOCAL_BIN) go install sigs.k8s.io/kubetest2@latest @@ -370,19 +370,19 @@ install-kops-deps: ## Install kubetest2 and other dependencies. chmod +x $(LOCAL_BIN)/kops.tmp; \ mv $(LOCAL_BIN)/kops.tmp $(LOCAL_BIN)/kops -.PHONY: kops-tool -kops-tool: $(LOCAL_BIN)/gkops ## Build the kOps lifecycle tool. +.PHONY: test-cluster-tool +test-cluster-tool: $(LOCAL_BIN)/gkops ## Build the test cluster lifecycle tool. $(LOCAL_BIN)/gkops: tools/kops/main.go tools/kops/pkg/kops/*.go @echo "Building kOps lifecycle tool..." mkdir -p $(LOCAL_BIN) go build -o $(LOCAL_BIN)/gkops tools/kops/main.go -.PHONY: kops-setup -kops-setup: install-kops-deps kops-tool push-images ## Setup environment for kOps E2E. +.PHONY: test-cluster-setup +test-cluster-setup: install-test-cluster-deps test-cluster-tool push-images ## Setup environment for test cluster E2E. -.PHONY: kops-up -kops-up: kops-setup ## Provision kOps cluster. +.PHONY: test-cluster-up +test-cluster-up: test-cluster-setup ## Provision test cluster. PATH=$(LOCAL_BIN):$(PATH) KOPS_STATE_STORE=$(KOPS_STATE_STORE) $(LOCAL_BIN)/gkops up \ --cluster-name=$(KOPS_CLUSTER_NAME) \ --gcp-project=$(GCP_PROJECT) \ @@ -392,15 +392,15 @@ kops-up: kops-setup ## Provision kOps cluster. --image-repo=$(IMAGE_REPO) \ --image-tag=$(IMAGE_TAG) -.PHONY: kops-down -kops-down: kops-tool ## Tear down kOps cluster. +.PHONY: test-cluster-down +test-cluster-down: test-cluster-tool ## Tear down test cluster. PATH=$(LOCAL_BIN):$(PATH) KOPS_STATE_STORE=$(KOPS_STATE_STORE) $(LOCAL_BIN)/gkops down \ --cluster-name=$(KOPS_CLUSTER_NAME) \ --gcp-project=$(GCP_PROJECT) \ --state-store=$(KOPS_STATE_STORE) -.PHONY: kops-e2e-test -kops-e2e-test: kops-tool ## Run E2E tests on kOps cluster. +.PHONY: test-cluster-e2e-test +test-cluster-e2e-test: test-cluster-tool ## Run E2E tests on test cluster. @echo "Running E2E tests on cluster $(KOPS_CLUSTER_NAME)..." PATH=$(LOCAL_BIN):$(PATH) KOPS_STATE_STORE=$(KOPS_STATE_STORE) KOPS_CLUSTER_NAME= CLUSTER_NAME= $(LOCAL_BIN)/kubetest2 kops \ -v=2 \ diff --git a/docs/RELEASE.md b/docs/RELEASE.md index 0798291c6c..9475476055 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -68,8 +68,8 @@ Update the `/cluster` directory if needed. A script under `/cluster` is used to ### Testing 1. Run `make verify`. -1. Bring the cluster up with `make kops-up` -1. Run conformance tests locally with `make kops-e2e-test` +1. Bring the cluster up with `make test-cluster-up` +1. Run conformance tests locally with `make test-cluster-e2e-test` ## Create Release Branch This is only necessary for CCM releases corresponding to a Kubernetes minor version release. Create a branch from the latest commit on master with the dependency updates mentioned above. diff --git a/docs/kops-quickstart.md b/docs/kops-quickstart.md index 13aebd1e01..6aaa56830c 100644 --- a/docs/kops-quickstart.md +++ b/docs/kops-quickstart.md @@ -8,7 +8,7 @@ A Google Cloud Platform project with billing enabled. ## Deployment -The `make kops-up` target is an end-to-end workflow that automatically: +The `make test-cluster-up` target is an end-to-end workflow that automatically: - Provisions a Kubernetes cluster using kOps. - Builds the CCM image locally. - Pushes the image to your Artifact Registry. @@ -34,7 +34,7 @@ export KOPS_STATE_STORE=gs://${GCP_PROJECT}-kops-state gcloud storage buckets create ${KOPS_STATE_STORE} --location=${GCP_LOCATION} || true # Run the cluster creation target, may take several minutes -make kops-up +make test-cluster-up # Ensure you are configured to talk to the correct cluster. kubectl config use-context $KOPS_CLUSTER_NAME @@ -70,5 +70,5 @@ kubectl describe nodes | grep "ProviderID:" To tear down the cluster and clean up resources: ```sh -make kops-down +make test-cluster-down ``` diff --git a/e2e/scenarios/kops-simple b/e2e/scenarios/kops-simple index eeca1b9568..e0ff455209 100755 --- a/e2e/scenarios/kops-simple +++ b/e2e/scenarios/kops-simple @@ -37,13 +37,13 @@ export KOPS_STATE_STORE="gs://kops-state-${GCP_PROJECT}" # 2. Cluster Lifecycle Management export KOPS_CLUSTER_NAME="${CLUSTER_NAME:-kops-simple.k8s.local}" -make kops-up +make test-cluster-up # 3. Define cleanup function function cleanup { local exit_status=$? if [[ "${DELETE_CLUSTER:-true}" == "true" ]]; then - make kops-down + make test-cluster-down fi if [[ -n "${BOSKOS_HEARTBEAT_PID:-}" ]]; then source test/boskos.sh @@ -55,10 +55,10 @@ trap cleanup EXIT # 4. Test Execution export K8S_VERSION=$(make --silent print-k8s-version) -make kops-e2e-test KOPS_CLUSTER_NAME="${KOPS_CLUSTER_NAME}" +make test-cluster-e2e-test KOPS_CLUSTER_NAME="${KOPS_CLUSTER_NAME}" # 5. Teardown if [[ "${DELETE_CLUSTER:-true}" == "true" ]]; then - make kops-down + make test-cluster-down DELETE_CLUSTER=false # Prevent redundant deletion in trap fi diff --git a/tools/run-e2e-test.sh b/tools/run-e2e-test.sh index 57abdd61f5..ae9154548f 100755 --- a/tools/run-e2e-test.sh +++ b/tools/run-e2e-test.sh @@ -39,13 +39,13 @@ export KOPS_STATE_STORE="gs://kops-state-${GCP_PROJECT}" # 2. Cluster Lifecycle Management export KOPS_CLUSTER_NAME="${CLUSTER_NAME:-run-e2e-test.k8s.local}" -make kops-up +make test-cluster-up # Define cleanup function function cleanup { local exit_status=$? if [[ "${DELETE_CLUSTER:-true}" == "true" ]]; then - make kops-down || echo "Warning: kops-down failed" + make test-cluster-down || echo "Warning: test-cluster-down failed" fi if [[ "${CLEANUP_BOSKOS:-}" == "true" ]]; then source test/boskos.sh @@ -125,7 +125,7 @@ kubetest2 kops \ # 4. Teardown if [[ "${DELETE_CLUSTER:-true}" == "true" ]]; then - make kops-down + make test-cluster-down DELETE_CLUSTER=false # Don't delete again in trap fi From c2d0caf434575a48e72b6a831a3eee3cef129808 Mon Sep 17 00:00:00 2001 From: yifeizhuang Date: Fri, 8 May 2026 16:50:44 -0700 Subject: [PATCH 36/78] metis: fix bug to scope CIDR allocation checks by logical network (#1094) --- metis/pkg/daemon/daemon_server.go | 2 +- metis/pkg/store/schema.sql | 11 +++-- metis/pkg/store/store.go | 8 ++-- metis/pkg/store/store_test.go | 69 +++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 9 deletions(-) diff --git a/metis/pkg/daemon/daemon_server.go b/metis/pkg/daemon/daemon_server.go index 8669c6c3b0..5e6d758721 100644 --- a/metis/pkg/daemon/daemon_server.go +++ b/metis/pkg/daemon/daemon_server.go @@ -148,7 +148,7 @@ func (s *adaptiveIpamServer) MaybeAddInitialPodCidr(ctx context.Context, network return nil } - exists, err := s.store.GetCIDRBlockByCIDR(ctx, initialPodCidr) + exists, err := s.store.GetCIDRBlockByCIDRAndNetwork(ctx, initialPodCidr, network) if err != nil { s.logger.Error(err, "failed to check if initial cidr block exists", "network", network, "cidr", initialPodCidr) return status.Errorf(codes.Unavailable, "failed to check if initial cidr block %s exists for network %s: %v", initialPodCidr, network, err) diff --git a/metis/pkg/store/schema.sql b/metis/pkg/store/schema.sql index ffc30749aa..5ebdc21581 100644 --- a/metis/pkg/store/schema.sql +++ b/metis/pkg/store/schema.sql @@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS cidr_blocks ( -- The actual IP range allocated from GCE. -- Example: '10.0.1.0/28' - cidr TEXT UNIQUE NOT NULL, + cidr TEXT NOT NULL, -- The logical network this block belongs to, matching the CNI networkName. -- Example: 'gke-pod-network' @@ -36,7 +36,9 @@ CREATE TABLE IF NOT EXISTS cidr_blocks ( created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Timestamp of the last mutation to this block's state or capacity. - updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + + UNIQUE(cidr, network) ); -- ip_addresses tracks the assignment state, ownership, and cooldown periods @@ -47,7 +49,7 @@ CREATE TABLE IF NOT EXISTS ip_addresses ( -- The specific IP address string. -- Example: '10.0.1.2' - address TEXT UNIQUE NOT NULL, + address TEXT NOT NULL, -- The parent CIDR block this IP belongs to. -- Enforces cascading deletes if the parent block is removed by the daemon. @@ -80,7 +82,8 @@ CREATE TABLE IF NOT EXISTS ip_addresses ( -- Timestamp of the last mutation to this IP record. updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - FOREIGN KEY (cidr_block_id) REFERENCES cidr_blocks(id) ON DELETE CASCADE + FOREIGN KEY (cidr_block_id) REFERENCES cidr_blocks(id) ON DELETE CASCADE, + UNIQUE(address, cidr_block_id) ); -- Index to optimize the daemon's search for the next available IP address. diff --git a/metis/pkg/store/store.go b/metis/pkg/store/store.go index 702b81b717..2fb7d05d49 100644 --- a/metis/pkg/store/store.go +++ b/metis/pkg/store/store.go @@ -343,12 +343,12 @@ func (s *Store) AllocateIPv4(ctx context.Context, network, interfaceName, contai return "", "", fmt.Errorf("%w: failed to allocate ipv4 in any cidr block for network %s", ErrNoAvailableIPs, network) } -// GetCIDRBlockByCIDR checks if a CIDR block already exists in the database. -func (s *Store) GetCIDRBlockByCIDR(ctx context.Context, cidr string) (bool, error) { +// GetCIDRBlockByCIDRAndNetwork checks if a CIDR block exists for the specific network. +func (s *Store) GetCIDRBlockByCIDRAndNetwork(ctx context.Context, cidr, network string) (bool, error) { var id int64 err := s.db.QueryRowContext(ctx, ` - SELECT id FROM cidr_blocks WHERE cidr = ? LIMIT 1 - `, cidr).Scan(&id) + SELECT id FROM cidr_blocks WHERE cidr = ? AND network = ? LIMIT 1 + `, cidr, network).Scan(&id) if err == nil { return true, nil diff --git a/metis/pkg/store/store_test.go b/metis/pkg/store/store_test.go index 6008828ac5..2b653af35d 100644 --- a/metis/pkg/store/store_test.go +++ b/metis/pkg/store/store_test.go @@ -414,6 +414,75 @@ func TestStore_AddCIDR_Small(t *testing.T) { } } +func TestStore_GetCIDRBlockByCIDRAndNetwork(t *testing.T) { + logger := logr.Discard() + tempDir := t.TempDir() + + dbPath := filepath.Join(tempDir, "get_cidr_network.sqlite") + s, err := NewStore(context.Background(), logger, dbPath) + if err != nil { + t.Fatalf("NewStore returned unexpected error: %v", err) + } + defer s.Close() + + network1 := "network-1" + network2 := "network-2" + cidr := "10.10.0.0/24" + + // Initially shouldn't exist in either network + exists, err := s.GetCIDRBlockByCIDRAndNetwork(context.Background(), cidr, network1) + if err != nil { + t.Fatalf("GetCIDRBlockByCIDRAndNetwork failed: %v", err) + } + if exists { + t.Error("Expected false for network1, got true") + } + + // Add CIDR to network1 + if err := s.AddCIDR(context.Background(), network1, cidr); err != nil { + t.Fatalf("AddCIDR failed for network1: %v", err) + } + + // Should exist in network1, but not in network2 + exists, err = s.GetCIDRBlockByCIDRAndNetwork(context.Background(), cidr, network1) + if err != nil { + t.Fatalf("GetCIDRBlockByCIDRAndNetwork failed for network1: %v", err) + } + if !exists { + t.Error("Expected true for network1, got false") + } + + exists, err = s.GetCIDRBlockByCIDRAndNetwork(context.Background(), cidr, network2) + if err != nil { + t.Fatalf("GetCIDRBlockByCIDRAndNetwork failed for network2: %v", err) + } + if exists { + t.Error("Expected false for network2, got true") + } + + // Add same CIDR to network2 (allowed since unique on cidr, network) + if err := s.AddCIDR(context.Background(), network2, cidr); err != nil { + t.Fatalf("AddCIDR failed for network2: %v", err) + } + + // Now it should exist in both networks + exists, err = s.GetCIDRBlockByCIDRAndNetwork(context.Background(), cidr, network1) + if err != nil { + t.Fatalf("GetCIDRBlockByCIDRAndNetwork failed for network1: %v", err) + } + if !exists { + t.Error("Expected true for network1, got false") + } + + exists, err = s.GetCIDRBlockByCIDRAndNetwork(context.Background(), cidr, network2) + if err != nil { + t.Fatalf("GetCIDRBlockByCIDRAndNetwork failed for network2: %v", err) + } + if !exists { + t.Error("Expected true for network2, got false") + } +} + func TestStore_AllocateIPv4_SingleCIDR(t *testing.T) { logger := logr.Discard() tempDir := t.TempDir() From f4eae5e085e1f9291dc536d164f9bfa2c9a55e44 Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Sat, 9 May 2026 04:35:17 -0700 Subject: [PATCH 37/78] Add smart path-based component tagging workflows (#1104) --- .github/workflows/tag-auth-provider-gcp.yml | 33 +++++++++++++++++++ .../workflows/{auto-tag.yml => tag-ccm.yml} | 8 +++-- .../workflows/tag-gke-gcloud-auth-plugin.yml | 33 +++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/tag-auth-provider-gcp.yml rename .github/workflows/{auto-tag.yml => tag-ccm.yml} (81%) create mode 100644 .github/workflows/tag-gke-gcloud-auth-plugin.yml diff --git a/.github/workflows/tag-auth-provider-gcp.yml b/.github/workflows/tag-auth-provider-gcp.yml new file mode 100644 index 0000000000..e58f2c2eba --- /dev/null +++ b/.github/workflows/tag-auth-provider-gcp.yml @@ -0,0 +1,33 @@ +name: Tag auth-provider-gcp + +on: + push: + branches: + - 'release-1.*' + paths: + - 'cmd/auth-provider-gcp/**' + - 'go.mod' + - 'go.sum' + +jobs: + tag-auth-provider-gcp: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Configure Git User + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Run auto-tag script + env: + DRY_RUN: "false" + FORCE_BRANCH: ${{ github.ref_name }} + COMPONENT_PREFIX: "auth-provider-gcp/" + run: ./tools/auto-tag.sh diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/tag-ccm.yml similarity index 81% rename from .github/workflows/auto-tag.yml rename to .github/workflows/tag-ccm.yml index e4d2e2fe54..929c31ec3e 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/tag-ccm.yml @@ -1,12 +1,15 @@ -name: Auto Tag release branches +name: Tag CCM on: push: branches: - 'release-1.*' + paths-ignore: + - 'cmd/auth-provider-gcp/**' + - 'cmd/gke-gcloud-auth-plugin/**' jobs: - auto-tag: + tag-ccm: runs-on: ubuntu-latest permissions: contents: write @@ -25,4 +28,5 @@ jobs: env: DRY_RUN: "false" FORCE_BRANCH: ${{ github.ref_name }} + COMPONENT_PREFIX: "" run: ./tools/auto-tag.sh diff --git a/.github/workflows/tag-gke-gcloud-auth-plugin.yml b/.github/workflows/tag-gke-gcloud-auth-plugin.yml new file mode 100644 index 0000000000..658665874d --- /dev/null +++ b/.github/workflows/tag-gke-gcloud-auth-plugin.yml @@ -0,0 +1,33 @@ +name: Tag gke-gcloud-auth-plugin + +on: + push: + branches: + - 'release-1.*' + paths: + - 'cmd/gke-gcloud-auth-plugin/**' + - 'go.mod' + - 'go.sum' + +jobs: + tag-gke-gcloud-auth-plugin: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Configure Git User + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Run auto-tag script + env: + DRY_RUN: "false" + FORCE_BRANCH: ${{ github.ref_name }} + COMPONENT_PREFIX: "gke-gcloud-auth-plugin/" + run: ./tools/auto-tag.sh From 4d88a83fa9dc47b5d27c2015c7a0ca569c7c4caf Mon Sep 17 00:00:00 2001 From: Walter Fender Date: Mon, 11 May 2026 12:47:49 -0700 Subject: [PATCH 38/78] Update GoogleCloudPlatform/k8s-cloud-provider to v1.34.0 (#1115) * Update GoogleCloudPlatform/k8s-cloud-provider to v1.34.0 Update the GoogleCloudPlatform/k8s-cloud-provider library to version v1.34.0. This includes updating go.mod files, syncing the vendor directory, and fixing a test regression caused by the change in the Option type implementation in the library. Issue #1113 Generated by Overseer (powered by the gemini-3-flash-preview model) * fixup! Update GoogleCloudPlatform/k8s-cloud-provider to v1.34.0 --- .github/dependabot.yml | 36 - .github/release.yml | 15 - .github/workflows/dependabot-sync.yml | 37 - .github/workflows/release.yml | 24 - .github/workflows/tag-auth-provider-gcp.yml | 33 - .github/workflows/tag-ccm.yml | 32 - .../workflows/tag-gke-gcloud-auth-plugin.yml | 33 - go.mod | 2 +- go.sum | 4 +- go.work.sum | 6 +- .../adaptiveipam/v1/adaptiveipam_grpc.pb.go | 2 +- providers/gce/gce_instances_test.go | 10 +- providers/go.mod | 2 +- providers/go.sum | 4 +- test/e2e/go.mod | 2 +- test/e2e/go.sum | 4 +- .../k8s-cloud-provider/pkg/cloud/context.go | 2 + .../k8s-cloud-provider/pkg/cloud/gen.go | 15961 ++++++++++------ .../k8s-cloud-provider/pkg/cloud/meta/OWNERS | 4 + .../pkg/cloud/meta/compute_services.go | 74 + .../k8s-cloud-provider/pkg/cloud/meta/key.go | 12 + .../k8s-cloud-provider/pkg/cloud/option.go | 54 +- .../k8s-cloud-provider/pkg/cloud/ratelimit.go | 133 +- vendor/modules.txt | 4 +- 24 files changed, 10565 insertions(+), 5925 deletions(-) delete mode 100644 .github/dependabot.yml delete mode 100644 .github/release.yml delete mode 100644 .github/workflows/dependabot-sync.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/tag-auth-provider-gcp.yml delete mode 100644 .github/workflows/tag-ccm.yml delete mode 100644 .github/workflows/tag-gke-gcloud-auth-plugin.yml create mode 100644 vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index db4a922e91..0000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,36 +0,0 @@ -version: 2 -updates: -- package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" - day: "sunday" - labels: - - "ok-to-test" - - 'area/dependency' - - 'release-note-none' -- package-ecosystem: gomod - directories: - - "/" - - "/providers" - - "/metis" - - "/test/e2e" - schedule: - interval: weekly - labels: - - 'area/dependency' - - 'release-note-none' - - 'ok-to-test' - groups: - k8s-dependencies: - patterns: - - "k8s.io/*" - - "sigs.k8s.io/*" - workspace-deps: - patterns: - - "*" - exclude-patterns: - - "k8s.io/*" - - "sigs.k8s.io/*" - - diff --git a/.github/release.yml b/.github/release.yml deleted file mode 100644 index 9b8e61c654..0000000000 --- a/.github/release.yml +++ /dev/null @@ -1,15 +0,0 @@ -changelog: - exclude: - labels: - - ignore-for-release - authors: - - dependabot[bot] - categories: - - title: Features - labels: - - feature - - enhancement - - title: Bug Fixes - labels: - - bug - - fix diff --git a/.github/workflows/dependabot-sync.yml b/.github/workflows/dependabot-sync.yml deleted file mode 100644 index a8ae841a8a..0000000000 --- a/.github/workflows/dependabot-sync.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Dependabot Go Work Sync - -on: - pull_request: - paths: - - '**/go.mod' - - '**/go.sum' - -permissions: - contents: write - -jobs: - go-work-sync: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - steps: - - name: Checkout repository - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - with: - ref: ${{ github.event.pull_request.head.ref }} - - - name: Setup Go - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c - with: - go-version-file: 'go.work' - - - name: Sync Go Workspace - run: go work sync - - - name: Commit and Push changes - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git add go.work.sum - # Only commit if there are actual changes - git diff --quiet && git diff --staged --quiet || git commit -m "chore: update go.work.sum" - git push \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b64762abc7..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Create GitHub Release - -on: - push: - tags: - - 'v*' - -permissions: - contents: write - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 # Important for generating release notes - - - name: Create Draft Release - uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 - with: - draft: true - generate_release_notes: true diff --git a/.github/workflows/tag-auth-provider-gcp.yml b/.github/workflows/tag-auth-provider-gcp.yml deleted file mode 100644 index e58f2c2eba..0000000000 --- a/.github/workflows/tag-auth-provider-gcp.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Tag auth-provider-gcp - -on: - push: - branches: - - 'release-1.*' - paths: - - 'cmd/auth-provider-gcp/**' - - 'go.mod' - - 'go.sum' - -jobs: - tag-auth-provider-gcp: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - with: - fetch-depth: 0 # Fetch all history and tags - - - name: Configure Git User - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - - name: Run auto-tag script - env: - DRY_RUN: "false" - FORCE_BRANCH: ${{ github.ref_name }} - COMPONENT_PREFIX: "auth-provider-gcp/" - run: ./tools/auto-tag.sh diff --git a/.github/workflows/tag-ccm.yml b/.github/workflows/tag-ccm.yml deleted file mode 100644 index 929c31ec3e..0000000000 --- a/.github/workflows/tag-ccm.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Tag CCM - -on: - push: - branches: - - 'release-1.*' - paths-ignore: - - 'cmd/auth-provider-gcp/**' - - 'cmd/gke-gcloud-auth-plugin/**' - -jobs: - tag-ccm: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - with: - fetch-depth: 0 # Fetch all history and tags - - - name: Configure Git User - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - - name: Run auto-tag script - env: - DRY_RUN: "false" - FORCE_BRANCH: ${{ github.ref_name }} - COMPONENT_PREFIX: "" - run: ./tools/auto-tag.sh diff --git a/.github/workflows/tag-gke-gcloud-auth-plugin.yml b/.github/workflows/tag-gke-gcloud-auth-plugin.yml deleted file mode 100644 index 658665874d..0000000000 --- a/.github/workflows/tag-gke-gcloud-auth-plugin.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Tag gke-gcloud-auth-plugin - -on: - push: - branches: - - 'release-1.*' - paths: - - 'cmd/gke-gcloud-auth-plugin/**' - - 'go.mod' - - 'go.sum' - -jobs: - tag-gke-gcloud-auth-plugin: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout code - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - with: - fetch-depth: 0 # Fetch all history and tags - - - name: Configure Git User - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - - name: Run auto-tag script - env: - DRY_RUN: "false" - FORCE_BRANCH: ${{ github.ref_name }} - COMPONENT_PREFIX: "gke-gcloud-auth-plugin/" - run: ./tools/auto-tag.sh diff --git a/go.mod b/go.mod index 9047acc1de..d1a82b25c5 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect - github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 + github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect diff --git a/go.sum b/go.sum index 20cecf0677..8928392c16 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/GoogleCloudPlatform/gke-enterprise-mt v0.1.0 h1:VbaMM0mWLVKE5z/UrGxdB github.com/GoogleCloudPlatform/gke-enterprise-mt v0.1.0/go.mod h1:4OaeS6mKZtfsPHaDGOgZ3uz15sUO8KXl9tElNunV5Zc= github.com/GoogleCloudPlatform/gke-networking-api v0.2.1-0.20260327205951-1d0cb5d74c02 h1:wU4juqROYf7cVS+9NNJt55ivHVFZrDploNHZWP6TdHA= github.com/GoogleCloudPlatform/gke-networking-api v0.2.1-0.20260327205951-1d0cb5d74c02/go.mod h1:jC8/IazDeY3D4zTcEsZK6WiwbmqSTYjGNTZqXucxVVU= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 h1:QoaPZxsKBqKlIAwQSUJgiXlhz1Nu+Y1DgGqR7GV2uIA= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= diff --git a/go.work.sum b/go.work.sum index 13dcc9ac2b..7d4cb5afab 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,11 +1,9 @@ -cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0= -cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= -github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= -golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= diff --git a/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go b/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go index 35b10e37bf..7619b24ee9 100644 --- a/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go +++ b/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.1 +// - protoc-gen-go-grpc v1.6.2 // - protoc v7.34.1 // source: metis/api/adaptiveipam/v1/adaptiveipam.proto diff --git a/providers/gce/gce_instances_test.go b/providers/gce/gce_instances_test.go index 897b06fd0c..c0b5d56dde 100644 --- a/providers/gce/gce_instances_test.go +++ b/providers/gce/gce_instances_test.go @@ -22,7 +22,6 @@ package gce import ( "context" "fmt" - "reflect" "strings" "testing" @@ -607,14 +606,17 @@ func TestProjectFromNodeProviderID(t *testing.T) { }}, } instanceMap[instanceFromNonDefaultProject.SelfLink] = instanceFromNonDefaultProject - forceNonDefaultProject := cloud.ForceProjectID(nonDefaultProject) // Setup mock response. mockGCE := gce.c.(*cloud.MockGCE) mi := mockGCE.Instances().(*cloud.MockInstances) mi.GetHook = func(ctx context.Context, key *meta.Key, m *cloud.MockInstances, options ...cloud.Option) (bool, *ga.Instance, error) { projectID := defaultValues.ProjectID - if len(options) == 1 && reflect.DeepEqual(options[0], forceNonDefaultProject) { + if len(options) > 0 { + // In v1.34+, cloud.Option is a function closure, so reflect.DeepEqual + // no longer works. Since we only ever pass cloud.ForceProjectID() + // in this test, we assume any option means the project ID should be + // the non-default one. projectID = nonDefaultProject } selfLink := fmt.Sprintf("projects/%v/zones/%v/instances/%v", projectID, key.Zone, key.Name) @@ -655,7 +657,7 @@ func TestProjectFromNodeProviderID(t *testing.T) { t.Fatalf("instanceByProviderID(%v) = %v; want nil", node.Spec.ProviderID, err) } if gotGCEInstance.ID != tc.wantInstance.Id { - t.Errorf("instanceByProviderID(%v) returned instance with ID = %v; want instance with ID = %v", node.Spec.ProviderID, gotGCEInstance.ID, instanceFromDefaultProject.Id) + t.Errorf("instanceByProviderID(%v) returned instance with ID = %v; want instance with ID = %v", node.Spec.ProviderID, gotGCEInstance.ID, tc.wantInstance.Id) } }) diff --git a/providers/go.mod b/providers/go.mod index 33424b7749..c36486af66 100644 --- a/providers/go.mod +++ b/providers/go.mod @@ -3,7 +3,7 @@ module k8s.io/cloud-provider-gcp/providers go 1.26.0 require ( - github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 + github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 github.com/google/go-cmp v0.7.0 github.com/stretchr/testify v1.11.1 golang.org/x/oauth2 v0.34.0 diff --git a/providers/go.sum b/providers/go.sum index 1dc922c05b..c578cd737c 100644 --- a/providers/go.sum +++ b/providers/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLM cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 h1:QoaPZxsKBqKlIAwQSUJgiXlhz1Nu+Y1DgGqR7GV2uIA= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= diff --git a/test/e2e/go.mod b/test/e2e/go.mod index 22743858d7..dc8995f934 100644 --- a/test/e2e/go.mod +++ b/test/e2e/go.mod @@ -3,7 +3,7 @@ module k8s.io/cloud-provider-gcp/test/e2e go 1.26.0 require ( - github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 + github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 github.com/onsi/ginkgo/v2 v2.28.1 github.com/onsi/gomega v1.39.1 google.golang.org/api v0.199.0 diff --git a/test/e2e/go.sum b/test/e2e/go.sum index efdaf02f55..f7e8b169f7 100644 --- a/test/e2e/go.sum +++ b/test/e2e/go.sum @@ -8,8 +8,8 @@ cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLM cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 h1:QoaPZxsKBqKlIAwQSUJgiXlhz1Nu+Y1DgGqR7GV2uIA= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go index b2899a7c97..9bc306c2dd 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go @@ -43,4 +43,6 @@ type CallContextKey struct { Version meta.Version // Service is the service being invoked (e.g. "Firewalls", "BackendServices") Service string + // Resource is the key of the resource being operated on. + Resource *meta.Key } diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go index cef8160c0e..438d1d526e 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go @@ -1,5 +1,5 @@ /* -Copyright 2024 Google LLC +Copyright 2025 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -95,6 +95,9 @@ type Cloud interface { AlphaGlobalNetworkEndpointGroups() AlphaGlobalNetworkEndpointGroups BetaGlobalNetworkEndpointGroups() BetaGlobalNetworkEndpointGroups GlobalNetworkEndpointGroups() GlobalNetworkEndpointGroups + AlphaRegionNetworkEndpointGroups() AlphaRegionNetworkEndpointGroups + BetaRegionNetworkEndpointGroups() BetaRegionNetworkEndpointGroups + RegionNetworkEndpointGroups() RegionNetworkEndpointGroups Projects() Projects Regions() Regions AlphaRouters() AlphaRouters @@ -132,6 +135,9 @@ type Cloud interface { AlphaTargetTcpProxies() AlphaTargetTcpProxies BetaTargetTcpProxies() BetaTargetTcpProxies TargetTcpProxies() TargetTcpProxies + AlphaRegionTargetTcpProxies() AlphaRegionTargetTcpProxies + BetaRegionTargetTcpProxies() BetaRegionTargetTcpProxies + RegionTargetTcpProxies() RegionTargetTcpProxies AlphaUrlMaps() AlphaUrlMaps BetaUrlMaps() BetaUrlMaps UrlMaps() UrlMaps @@ -199,6 +205,9 @@ func NewGCE(s *Service) *GCE { gceAlphaGlobalNetworkEndpointGroups: &GCEAlphaGlobalNetworkEndpointGroups{s}, gceBetaGlobalNetworkEndpointGroups: &GCEBetaGlobalNetworkEndpointGroups{s}, gceGlobalNetworkEndpointGroups: &GCEGlobalNetworkEndpointGroups{s}, + gceAlphaRegionNetworkEndpointGroups: &GCEAlphaRegionNetworkEndpointGroups{s}, + gceBetaRegionNetworkEndpointGroups: &GCEBetaRegionNetworkEndpointGroups{s}, + gceRegionNetworkEndpointGroups: &GCERegionNetworkEndpointGroups{s}, gceProjects: &GCEProjects{s}, gceRegions: &GCERegions{s}, gceAlphaRouters: &GCEAlphaRouters{s}, @@ -236,6 +245,9 @@ func NewGCE(s *Service) *GCE { gceAlphaTargetTcpProxies: &GCEAlphaTargetTcpProxies{s}, gceBetaTargetTcpProxies: &GCEBetaTargetTcpProxies{s}, gceTargetTcpProxies: &GCETargetTcpProxies{s}, + gceAlphaRegionTargetTcpProxies: &GCEAlphaRegionTargetTcpProxies{s}, + gceBetaRegionTargetTcpProxies: &GCEBetaRegionTargetTcpProxies{s}, + gceRegionTargetTcpProxies: &GCERegionTargetTcpProxies{s}, gceAlphaUrlMaps: &GCEAlphaUrlMaps{s}, gceBetaUrlMaps: &GCEBetaUrlMaps{s}, gceUrlMaps: &GCEUrlMaps{s}, @@ -307,6 +319,9 @@ type GCE struct { gceAlphaGlobalNetworkEndpointGroups *GCEAlphaGlobalNetworkEndpointGroups gceBetaGlobalNetworkEndpointGroups *GCEBetaGlobalNetworkEndpointGroups gceGlobalNetworkEndpointGroups *GCEGlobalNetworkEndpointGroups + gceAlphaRegionNetworkEndpointGroups *GCEAlphaRegionNetworkEndpointGroups + gceBetaRegionNetworkEndpointGroups *GCEBetaRegionNetworkEndpointGroups + gceRegionNetworkEndpointGroups *GCERegionNetworkEndpointGroups gceProjects *GCEProjects gceRegions *GCERegions gceAlphaRouters *GCEAlphaRouters @@ -344,6 +359,9 @@ type GCE struct { gceAlphaTargetTcpProxies *GCEAlphaTargetTcpProxies gceBetaTargetTcpProxies *GCEBetaTargetTcpProxies gceTargetTcpProxies *GCETargetTcpProxies + gceAlphaRegionTargetTcpProxies *GCEAlphaRegionTargetTcpProxies + gceBetaRegionTargetTcpProxies *GCEBetaRegionTargetTcpProxies + gceRegionTargetTcpProxies *GCERegionTargetTcpProxies gceAlphaUrlMaps *GCEAlphaUrlMaps gceBetaUrlMaps *GCEBetaUrlMaps gceUrlMaps *GCEUrlMaps @@ -612,6 +630,21 @@ func (gce *GCE) GlobalNetworkEndpointGroups() GlobalNetworkEndpointGroups { return gce.gceGlobalNetworkEndpointGroups } +// AlphaRegionNetworkEndpointGroups returns the interface for the alpha RegionNetworkEndpointGroups. +func (gce *GCE) AlphaRegionNetworkEndpointGroups() AlphaRegionNetworkEndpointGroups { + return gce.gceAlphaRegionNetworkEndpointGroups +} + +// BetaRegionNetworkEndpointGroups returns the interface for the beta RegionNetworkEndpointGroups. +func (gce *GCE) BetaRegionNetworkEndpointGroups() BetaRegionNetworkEndpointGroups { + return gce.gceBetaRegionNetworkEndpointGroups +} + +// RegionNetworkEndpointGroups returns the interface for the ga RegionNetworkEndpointGroups. +func (gce *GCE) RegionNetworkEndpointGroups() RegionNetworkEndpointGroups { + return gce.gceRegionNetworkEndpointGroups +} + // Projects returns the interface for the ga Projects. func (gce *GCE) Projects() Projects { return gce.gceProjects @@ -797,6 +830,21 @@ func (gce *GCE) TargetTcpProxies() TargetTcpProxies { return gce.gceTargetTcpProxies } +// AlphaRegionTargetTcpProxies returns the interface for the alpha RegionTargetTcpProxies. +func (gce *GCE) AlphaRegionTargetTcpProxies() AlphaRegionTargetTcpProxies { + return gce.gceAlphaRegionTargetTcpProxies +} + +// BetaRegionTargetTcpProxies returns the interface for the beta RegionTargetTcpProxies. +func (gce *GCE) BetaRegionTargetTcpProxies() BetaRegionTargetTcpProxies { + return gce.gceBetaRegionTargetTcpProxies +} + +// RegionTargetTcpProxies returns the interface for the ga RegionTargetTcpProxies. +func (gce *GCE) RegionTargetTcpProxies() RegionTargetTcpProxies { + return gce.gceRegionTargetTcpProxies +} + // AlphaUrlMaps returns the interface for the alpha UrlMaps. func (gce *GCE) AlphaUrlMaps() AlphaUrlMaps { return gce.gceAlphaUrlMaps @@ -878,11 +926,13 @@ func NewMockGCE(projectRouter ProjectRouter) *MockGCE { mockRegionBackendServicesObjs := map[meta.Key]*MockRegionBackendServicesObj{} mockRegionDisksObjs := map[meta.Key]*MockRegionDisksObj{} mockRegionHealthChecksObjs := map[meta.Key]*MockRegionHealthChecksObj{} + mockRegionNetworkEndpointGroupsObjs := map[meta.Key]*MockRegionNetworkEndpointGroupsObj{} mockRegionNetworkFirewallPoliciesObjs := map[meta.Key]*MockRegionNetworkFirewallPoliciesObj{} mockRegionSslCertificatesObjs := map[meta.Key]*MockRegionSslCertificatesObj{} mockRegionSslPoliciesObjs := map[meta.Key]*MockRegionSslPoliciesObj{} mockRegionTargetHttpProxiesObjs := map[meta.Key]*MockRegionTargetHttpProxiesObj{} mockRegionTargetHttpsProxiesObjs := map[meta.Key]*MockRegionTargetHttpsProxiesObj{} + mockRegionTargetTcpProxiesObjs := map[meta.Key]*MockRegionTargetTcpProxiesObj{} mockRegionUrlMapsObjs := map[meta.Key]*MockRegionUrlMapsObj{} mockRegionsObjs := map[meta.Key]*MockRegionsObj{} mockRoutersObjs := map[meta.Key]*MockRoutersObj{} @@ -952,6 +1002,9 @@ func NewMockGCE(projectRouter ProjectRouter) *MockGCE { MockAlphaGlobalNetworkEndpointGroups: NewMockAlphaGlobalNetworkEndpointGroups(projectRouter, mockGlobalNetworkEndpointGroupsObjs), MockBetaGlobalNetworkEndpointGroups: NewMockBetaGlobalNetworkEndpointGroups(projectRouter, mockGlobalNetworkEndpointGroupsObjs), MockGlobalNetworkEndpointGroups: NewMockGlobalNetworkEndpointGroups(projectRouter, mockGlobalNetworkEndpointGroupsObjs), + MockAlphaRegionNetworkEndpointGroups: NewMockAlphaRegionNetworkEndpointGroups(projectRouter, mockRegionNetworkEndpointGroupsObjs), + MockBetaRegionNetworkEndpointGroups: NewMockBetaRegionNetworkEndpointGroups(projectRouter, mockRegionNetworkEndpointGroupsObjs), + MockRegionNetworkEndpointGroups: NewMockRegionNetworkEndpointGroups(projectRouter, mockRegionNetworkEndpointGroupsObjs), MockProjects: NewMockProjects(projectRouter, mockProjectsObjs), MockRegions: NewMockRegions(projectRouter, mockRegionsObjs), MockAlphaRouters: NewMockAlphaRouters(projectRouter, mockRoutersObjs), @@ -989,6 +1042,9 @@ func NewMockGCE(projectRouter ProjectRouter) *MockGCE { MockAlphaTargetTcpProxies: NewMockAlphaTargetTcpProxies(projectRouter, mockTargetTcpProxiesObjs), MockBetaTargetTcpProxies: NewMockBetaTargetTcpProxies(projectRouter, mockTargetTcpProxiesObjs), MockTargetTcpProxies: NewMockTargetTcpProxies(projectRouter, mockTargetTcpProxiesObjs), + MockAlphaRegionTargetTcpProxies: NewMockAlphaRegionTargetTcpProxies(projectRouter, mockRegionTargetTcpProxiesObjs), + MockBetaRegionTargetTcpProxies: NewMockBetaRegionTargetTcpProxies(projectRouter, mockRegionTargetTcpProxiesObjs), + MockRegionTargetTcpProxies: NewMockRegionTargetTcpProxies(projectRouter, mockRegionTargetTcpProxiesObjs), MockAlphaUrlMaps: NewMockAlphaUrlMaps(projectRouter, mockUrlMapsObjs), MockBetaUrlMaps: NewMockBetaUrlMaps(projectRouter, mockUrlMapsObjs), MockUrlMaps: NewMockUrlMaps(projectRouter, mockUrlMapsObjs), @@ -1060,6 +1116,9 @@ type MockGCE struct { MockAlphaGlobalNetworkEndpointGroups *MockAlphaGlobalNetworkEndpointGroups MockBetaGlobalNetworkEndpointGroups *MockBetaGlobalNetworkEndpointGroups MockGlobalNetworkEndpointGroups *MockGlobalNetworkEndpointGroups + MockAlphaRegionNetworkEndpointGroups *MockAlphaRegionNetworkEndpointGroups + MockBetaRegionNetworkEndpointGroups *MockBetaRegionNetworkEndpointGroups + MockRegionNetworkEndpointGroups *MockRegionNetworkEndpointGroups MockProjects *MockProjects MockRegions *MockRegions MockAlphaRouters *MockAlphaRouters @@ -1097,6 +1156,9 @@ type MockGCE struct { MockAlphaTargetTcpProxies *MockAlphaTargetTcpProxies MockBetaTargetTcpProxies *MockBetaTargetTcpProxies MockTargetTcpProxies *MockTargetTcpProxies + MockAlphaRegionTargetTcpProxies *MockAlphaRegionTargetTcpProxies + MockBetaRegionTargetTcpProxies *MockBetaRegionTargetTcpProxies + MockRegionTargetTcpProxies *MockRegionTargetTcpProxies MockAlphaUrlMaps *MockAlphaUrlMaps MockBetaUrlMaps *MockBetaUrlMaps MockUrlMaps *MockUrlMaps @@ -1365,6 +1427,21 @@ func (mock *MockGCE) GlobalNetworkEndpointGroups() GlobalNetworkEndpointGroups { return mock.MockGlobalNetworkEndpointGroups } +// AlphaRegionNetworkEndpointGroups returns the interface for the alpha RegionNetworkEndpointGroups. +func (mock *MockGCE) AlphaRegionNetworkEndpointGroups() AlphaRegionNetworkEndpointGroups { + return mock.MockAlphaRegionNetworkEndpointGroups +} + +// BetaRegionNetworkEndpointGroups returns the interface for the beta RegionNetworkEndpointGroups. +func (mock *MockGCE) BetaRegionNetworkEndpointGroups() BetaRegionNetworkEndpointGroups { + return mock.MockBetaRegionNetworkEndpointGroups +} + +// RegionNetworkEndpointGroups returns the interface for the ga RegionNetworkEndpointGroups. +func (mock *MockGCE) RegionNetworkEndpointGroups() RegionNetworkEndpointGroups { + return mock.MockRegionNetworkEndpointGroups +} + // Projects returns the interface for the ga Projects. func (mock *MockGCE) Projects() Projects { return mock.MockProjects @@ -1550,6 +1627,21 @@ func (mock *MockGCE) TargetTcpProxies() TargetTcpProxies { return mock.MockTargetTcpProxies } +// AlphaRegionTargetTcpProxies returns the interface for the alpha RegionTargetTcpProxies. +func (mock *MockGCE) AlphaRegionTargetTcpProxies() AlphaRegionTargetTcpProxies { + return mock.MockAlphaRegionTargetTcpProxies +} + +// BetaRegionTargetTcpProxies returns the interface for the beta RegionTargetTcpProxies. +func (mock *MockGCE) BetaRegionTargetTcpProxies() BetaRegionTargetTcpProxies { + return mock.MockBetaRegionTargetTcpProxies +} + +// RegionTargetTcpProxies returns the interface for the ga RegionTargetTcpProxies. +func (mock *MockGCE) RegionTargetTcpProxies() RegionTargetTcpProxies { + return mock.MockRegionTargetTcpProxies +} + // AlphaUrlMaps returns the interface for the alpha UrlMaps. func (mock *MockGCE) AlphaUrlMaps() AlphaUrlMaps { return mock.MockAlphaUrlMaps @@ -2462,6 +2554,52 @@ func (m *MockRegionHealthChecksObj) ToGA() *computega.HealthCheck { return ret } +// MockRegionNetworkEndpointGroupsObj is used to store the various object versions in the shared +// map of mocked objects. This allows for multiple API versions to co-exist and +// share the same "view" of the objects in the backend. +type MockRegionNetworkEndpointGroupsObj struct { + Obj interface{} +} + +// ToAlpha retrieves the given version of the object. +func (m *MockRegionNetworkEndpointGroupsObj) ToAlpha() *computealpha.NetworkEndpointGroup { + if ret, ok := m.Obj.(*computealpha.NetworkEndpointGroup); ok { + return ret + } + // Convert the object via JSON copying to the type that was requested. + ret := &computealpha.NetworkEndpointGroup{} + if err := copyViaJSON(ret, m.Obj); err != nil { + klog.Errorf("Could not convert %T to *computealpha.NetworkEndpointGroup via JSON: %v", m.Obj, err) + } + return ret +} + +// ToBeta retrieves the given version of the object. +func (m *MockRegionNetworkEndpointGroupsObj) ToBeta() *computebeta.NetworkEndpointGroup { + if ret, ok := m.Obj.(*computebeta.NetworkEndpointGroup); ok { + return ret + } + // Convert the object via JSON copying to the type that was requested. + ret := &computebeta.NetworkEndpointGroup{} + if err := copyViaJSON(ret, m.Obj); err != nil { + klog.Errorf("Could not convert %T to *computebeta.NetworkEndpointGroup via JSON: %v", m.Obj, err) + } + return ret +} + +// ToGA retrieves the given version of the object. +func (m *MockRegionNetworkEndpointGroupsObj) ToGA() *computega.NetworkEndpointGroup { + if ret, ok := m.Obj.(*computega.NetworkEndpointGroup); ok { + return ret + } + // Convert the object via JSON copying to the type that was requested. + ret := &computega.NetworkEndpointGroup{} + if err := copyViaJSON(ret, m.Obj); err != nil { + klog.Errorf("Could not convert %T to *computega.NetworkEndpointGroup via JSON: %v", m.Obj, err) + } + return ret +} + // MockRegionNetworkFirewallPoliciesObj is used to store the various object versions in the shared // map of mocked objects. This allows for multiple API versions to co-exist and // share the same "view" of the objects in the backend. @@ -2640,6 +2778,52 @@ func (m *MockRegionTargetHttpsProxiesObj) ToGA() *computega.TargetHttpsProxy { return ret } +// MockRegionTargetTcpProxiesObj is used to store the various object versions in the shared +// map of mocked objects. This allows for multiple API versions to co-exist and +// share the same "view" of the objects in the backend. +type MockRegionTargetTcpProxiesObj struct { + Obj interface{} +} + +// ToAlpha retrieves the given version of the object. +func (m *MockRegionTargetTcpProxiesObj) ToAlpha() *computealpha.TargetTcpProxy { + if ret, ok := m.Obj.(*computealpha.TargetTcpProxy); ok { + return ret + } + // Convert the object via JSON copying to the type that was requested. + ret := &computealpha.TargetTcpProxy{} + if err := copyViaJSON(ret, m.Obj); err != nil { + klog.Errorf("Could not convert %T to *computealpha.TargetTcpProxy via JSON: %v", m.Obj, err) + } + return ret +} + +// ToBeta retrieves the given version of the object. +func (m *MockRegionTargetTcpProxiesObj) ToBeta() *computebeta.TargetTcpProxy { + if ret, ok := m.Obj.(*computebeta.TargetTcpProxy); ok { + return ret + } + // Convert the object via JSON copying to the type that was requested. + ret := &computebeta.TargetTcpProxy{} + if err := copyViaJSON(ret, m.Obj); err != nil { + klog.Errorf("Could not convert %T to *computebeta.TargetTcpProxy via JSON: %v", m.Obj, err) + } + return ret +} + +// ToGA retrieves the given version of the object. +func (m *MockRegionTargetTcpProxiesObj) ToGA() *computega.TargetTcpProxy { + if ret, ok := m.Obj.(*computega.TargetTcpProxy); ok { + return ret + } + // Convert the object via JSON copying to the type that was requested. + ret := &computega.TargetTcpProxy{} + if err := copyViaJSON(ret, m.Obj); err != nil { + klog.Errorf("Could not convert %T to *computega.TargetTcpProxy via JSON: %v", m.Obj, err) + } + return ret +} + // MockRegionUrlMapsObj is used to store the various object versions in the shared // map of mocked objects. This allows for multiple API versions to co-exist and // share the same "view" of the objects in the backend. @@ -3460,6 +3644,7 @@ func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("ga"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -3469,6 +3654,7 @@ func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key, options ...Option return nil, err } call := g.s.GA.Addresses.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -3483,6 +3669,7 @@ func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key, options ...Option func (g *GCEAddresses) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAddresses.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Addresses") ck := &CallContextKey{ @@ -3490,6 +3677,7 @@ func (g *GCEAddresses) List(ctx context.Context, region string, fl *filter.F, op Operation: "List", Version: meta.Version("ga"), Service: "Addresses", + Resource: key, } callObserverStart(ctx, ck) @@ -3548,6 +3736,7 @@ func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *computega Operation: "Insert", Version: meta.Version("ga"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -3559,13 +3748,14 @@ func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *computega call := g.s.GA.Addresses.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -3589,6 +3779,7 @@ func (g *GCEAddresses) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("ga"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -3600,13 +3791,14 @@ func (g *GCEAddresses) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -3626,6 +3818,7 @@ func (g *GCEAddresses) AggregatedList(ctx context.Context, fl *filter.F, options Operation: "AggregatedList", Version: meta.Version("ga"), Service: "Addresses", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEAddresses.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -3640,6 +3833,7 @@ func (g *GCEAddresses) AggregatedList(ctx context.Context, fl *filter.F, options if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computega.Address{} f := func(l *computega.AddressAggregatedList) error { @@ -3924,6 +4118,7 @@ func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("alpha"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEAlphaAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -3933,6 +4128,7 @@ func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.Alpha.Addresses.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -3947,6 +4143,7 @@ func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEAlphaAddresses) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaAddresses.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Addresses") ck := &CallContextKey{ @@ -3954,6 +4151,7 @@ func (g *GCEAlphaAddresses) List(ctx context.Context, region string, fl *filter. Operation: "List", Version: meta.Version("alpha"), Service: "Addresses", + Resource: key, } callObserverStart(ctx, ck) @@ -4012,6 +4210,7 @@ func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("alpha"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEAlphaAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4023,13 +4222,14 @@ func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.Alpha.Addresses.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -4053,6 +4253,7 @@ func (g *GCEAlphaAddresses) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("alpha"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEAlphaAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4064,13 +4265,14 @@ func (g *GCEAlphaAddresses) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -4090,6 +4292,7 @@ func (g *GCEAlphaAddresses) AggregatedList(ctx context.Context, fl *filter.F, op Operation: "AggregatedList", Version: meta.Version("alpha"), Service: "Addresses", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEAlphaAddresses.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -4104,6 +4307,7 @@ func (g *GCEAlphaAddresses) AggregatedList(ctx context.Context, fl *filter.F, op if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computealpha.Address{} f := func(l *computealpha.AddressAggregatedList) error { @@ -4388,6 +4592,7 @@ func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("beta"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEBetaAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -4397,6 +4602,7 @@ func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Beta.Addresses.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -4411,6 +4617,7 @@ func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEBetaAddresses) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaAddresses.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Addresses") ck := &CallContextKey{ @@ -4418,6 +4625,7 @@ func (g *GCEBetaAddresses) List(ctx context.Context, region string, fl *filter.F Operation: "List", Version: meta.Version("beta"), Service: "Addresses", + Resource: key, } callObserverStart(ctx, ck) @@ -4476,6 +4684,7 @@ func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("beta"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEBetaAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4487,13 +4696,14 @@ func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Beta.Addresses.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -4517,6 +4727,7 @@ func (g *GCEBetaAddresses) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("beta"), Service: "Addresses", + Resource: key, } klog.V(5).Infof("GCEBetaAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4528,13 +4739,14 @@ func (g *GCEBetaAddresses) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -4554,6 +4766,7 @@ func (g *GCEBetaAddresses) AggregatedList(ctx context.Context, fl *filter.F, opt Operation: "AggregatedList", Version: meta.Version("beta"), Service: "Addresses", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEBetaAddresses.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -4568,6 +4781,7 @@ func (g *GCEBetaAddresses) AggregatedList(ctx context.Context, fl *filter.F, opt if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computebeta.Address{} f := func(l *computebeta.AddressAggregatedList) error { @@ -4811,6 +5025,7 @@ func (g *GCEAlphaGlobalAddresses) Get(ctx context.Context, key *meta.Key, option Operation: "Get", Version: meta.Version("alpha"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -4820,6 +5035,7 @@ func (g *GCEAlphaGlobalAddresses) Get(ctx context.Context, key *meta.Key, option return nil, err } call := g.s.Alpha.GlobalAddresses.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaGlobalAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -4834,6 +5050,7 @@ func (g *GCEAlphaGlobalAddresses) Get(ctx context.Context, key *meta.Key, option func (g *GCEAlphaGlobalAddresses) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaGlobalAddresses.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalAddresses") ck := &CallContextKey{ @@ -4841,6 +5058,7 @@ func (g *GCEAlphaGlobalAddresses) List(ctx context.Context, fl *filter.F, option Operation: "List", Version: meta.Version("alpha"), Service: "GlobalAddresses", + Resource: key, } callObserverStart(ctx, ck) @@ -4899,6 +5117,7 @@ func (g *GCEAlphaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("alpha"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4910,13 +5129,14 @@ func (g *GCEAlphaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Alpha.GlobalAddresses.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -4940,6 +5160,7 @@ func (g *GCEAlphaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opt Operation: "Delete", Version: meta.Version("alpha"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4951,13 +5172,14 @@ func (g *GCEAlphaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opt call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -5178,6 +5400,7 @@ func (g *GCEBetaGlobalAddresses) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("beta"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -5187,6 +5410,7 @@ func (g *GCEBetaGlobalAddresses) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Beta.GlobalAddresses.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaGlobalAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -5201,6 +5425,7 @@ func (g *GCEBetaGlobalAddresses) Get(ctx context.Context, key *meta.Key, options func (g *GCEBetaGlobalAddresses) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaGlobalAddresses.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalAddresses") ck := &CallContextKey{ @@ -5208,6 +5433,7 @@ func (g *GCEBetaGlobalAddresses) List(ctx context.Context, fl *filter.F, options Operation: "List", Version: meta.Version("beta"), Service: "GlobalAddresses", + Resource: key, } callObserverStart(ctx, ck) @@ -5266,6 +5492,7 @@ func (g *GCEBetaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("beta"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5277,13 +5504,14 @@ func (g *GCEBetaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Beta.GlobalAddresses.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -5307,6 +5535,7 @@ func (g *GCEBetaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opti Operation: "Delete", Version: meta.Version("beta"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5318,13 +5547,14 @@ func (g *GCEBetaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opti call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -5545,6 +5775,7 @@ func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key, options ... Operation: "Get", Version: meta.Version("ga"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEGlobalAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -5554,6 +5785,7 @@ func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key, options ... return nil, err } call := g.s.GA.GlobalAddresses.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEGlobalAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -5568,6 +5800,7 @@ func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key, options ... func (g *GCEGlobalAddresses) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEGlobalAddresses.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalAddresses") ck := &CallContextKey{ @@ -5575,6 +5808,7 @@ func (g *GCEGlobalAddresses) List(ctx context.Context, fl *filter.F, options ... Operation: "List", Version: meta.Version("ga"), Service: "GlobalAddresses", + Resource: key, } callObserverStart(ctx, ck) @@ -5633,6 +5867,7 @@ func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *com Operation: "Insert", Version: meta.Version("ga"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEGlobalAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5644,13 +5879,14 @@ func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *com call := g.s.GA.GlobalAddresses.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -5674,6 +5910,7 @@ func (g *GCEGlobalAddresses) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "GlobalAddresses", + Resource: key, } klog.V(5).Infof("GCEGlobalAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5685,13 +5922,14 @@ func (g *GCEGlobalAddresses) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -6010,6 +6248,7 @@ func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key, options ... Operation: "Get", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -6019,6 +6258,7 @@ func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key, options ... return nil, err } call := g.s.GA.BackendServices.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -6033,6 +6273,7 @@ func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key, options ... func (g *GCEBackendServices) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBackendServices.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "BackendServices") ck := &CallContextKey{ @@ -6040,6 +6281,7 @@ func (g *GCEBackendServices) List(ctx context.Context, fl *filter.F, options ... Operation: "List", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } callObserverStart(ctx, ck) @@ -6098,6 +6340,7 @@ func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *com Operation: "Insert", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6109,13 +6352,14 @@ func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *com call := g.s.GA.BackendServices.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6139,6 +6383,7 @@ func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6150,13 +6395,14 @@ func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -6176,6 +6422,7 @@ func (g *GCEBackendServices) AggregatedList(ctx context.Context, fl *filter.F, o Operation: "AggregatedList", Version: meta.Version("ga"), Service: "BackendServices", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEBackendServices.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -6190,6 +6437,7 @@ func (g *GCEBackendServices) AggregatedList(ctx context.Context, fl *filter.F, o if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computega.BackendService{} f := func(l *computega.BackendServiceAggregatedList) error { @@ -6236,6 +6484,7 @@ func (g *GCEBackendServices) AddSignedUrlKey(ctx context.Context, key *meta.Key, Operation: "AddSignedUrlKey", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.AddSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6245,13 +6494,14 @@ func (g *GCEBackendServices) AddSignedUrlKey(ctx context.Context, key *meta.Key, } call := g.s.GA.BackendServices.AddSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6278,6 +6528,7 @@ func (g *GCEBackendServices) DeleteSignedUrlKey(ctx context.Context, key *meta.K Operation: "DeleteSignedUrlKey", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.DeleteSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6287,13 +6538,14 @@ func (g *GCEBackendServices) DeleteSignedUrlKey(ctx context.Context, key *meta.K } call := g.s.GA.BackendServices.DeleteSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6320,6 +6572,7 @@ func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 Operation: "GetHealth", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6329,6 +6582,7 @@ func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.BackendServices.GetHealth(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -6353,6 +6607,7 @@ func (g *GCEBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 *com Operation: "Patch", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6362,13 +6617,14 @@ func (g *GCEBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 *com } call := g.s.GA.BackendServices.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6395,6 +6651,7 @@ func (g *GCEBackendServices) SetSecurityPolicy(ctx context.Context, key *meta.Ke Operation: "SetSecurityPolicy", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6404,13 +6661,14 @@ func (g *GCEBackendServices) SetSecurityPolicy(ctx context.Context, key *meta.Ke } call := g.s.GA.BackendServices.SetSecurityPolicy(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6437,6 +6695,7 @@ func (g *GCEBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *co Operation: "Update", Version: meta.Version("ga"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6446,13 +6705,14 @@ func (g *GCEBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *co } call := g.s.GA.BackendServices.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6764,6 +7024,7 @@ func (g *GCEBetaBackendServices) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -6773,6 +7034,7 @@ func (g *GCEBetaBackendServices) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Beta.BackendServices.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -6787,6 +7049,7 @@ func (g *GCEBetaBackendServices) Get(ctx context.Context, key *meta.Key, options func (g *GCEBetaBackendServices) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaBackendServices.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "BackendServices") ck := &CallContextKey{ @@ -6794,6 +7057,7 @@ func (g *GCEBetaBackendServices) List(ctx context.Context, fl *filter.F, options Operation: "List", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } callObserverStart(ctx, ck) @@ -6852,6 +7116,7 @@ func (g *GCEBetaBackendServices) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6863,13 +7128,14 @@ func (g *GCEBetaBackendServices) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Beta.BackendServices.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6893,6 +7159,7 @@ func (g *GCEBetaBackendServices) Delete(ctx context.Context, key *meta.Key, opti Operation: "Delete", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6904,13 +7171,14 @@ func (g *GCEBetaBackendServices) Delete(ctx context.Context, key *meta.Key, opti call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -6930,6 +7198,7 @@ func (g *GCEBetaBackendServices) AggregatedList(ctx context.Context, fl *filter. Operation: "AggregatedList", Version: meta.Version("beta"), Service: "BackendServices", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEBetaBackendServices.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -6944,6 +7213,7 @@ func (g *GCEBetaBackendServices) AggregatedList(ctx context.Context, fl *filter. if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computebeta.BackendService{} f := func(l *computebeta.BackendServiceAggregatedList) error { @@ -6990,6 +7260,7 @@ func (g *GCEBetaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta. Operation: "AddSignedUrlKey", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.AddSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6999,13 +7270,14 @@ func (g *GCEBetaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta. } call := g.s.Beta.BackendServices.AddSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7032,6 +7304,7 @@ func (g *GCEBetaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *me Operation: "DeleteSignedUrlKey", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.DeleteSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7041,13 +7314,14 @@ func (g *GCEBetaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *me } call := g.s.Beta.BackendServices.DeleteSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7074,6 +7348,7 @@ func (g *GCEBetaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 Operation: "Patch", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7083,13 +7358,14 @@ func (g *GCEBetaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 } call := g.s.Beta.BackendServices.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7116,6 +7392,7 @@ func (g *GCEBetaBackendServices) SetSecurityPolicy(ctx context.Context, key *met Operation: "SetSecurityPolicy", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7125,13 +7402,14 @@ func (g *GCEBetaBackendServices) SetSecurityPolicy(ctx context.Context, key *met } call := g.s.Beta.BackendServices.SetSecurityPolicy(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7158,6 +7436,7 @@ func (g *GCEBetaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 Operation: "Update", Version: meta.Version("beta"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7167,13 +7446,14 @@ func (g *GCEBetaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 } call := g.s.Beta.BackendServices.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7485,6 +7765,7 @@ func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key, option Operation: "Get", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -7494,6 +7775,7 @@ func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key, option return nil, err } call := g.s.Alpha.BackendServices.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -7508,6 +7790,7 @@ func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key, option func (g *GCEAlphaBackendServices) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaBackendServices.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "BackendServices") ck := &CallContextKey{ @@ -7515,6 +7798,7 @@ func (g *GCEAlphaBackendServices) List(ctx context.Context, fl *filter.F, option Operation: "List", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } callObserverStart(ctx, ck) @@ -7573,6 +7857,7 @@ func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7584,13 +7869,14 @@ func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Alpha.BackendServices.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7614,6 +7900,7 @@ func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key, opt Operation: "Delete", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7625,13 +7912,14 @@ func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key, opt call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -7651,6 +7939,7 @@ func (g *GCEAlphaBackendServices) AggregatedList(ctx context.Context, fl *filter Operation: "AggregatedList", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEAlphaBackendServices.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -7665,6 +7954,7 @@ func (g *GCEAlphaBackendServices) AggregatedList(ctx context.Context, fl *filter if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computealpha.BackendService{} f := func(l *computealpha.BackendServiceAggregatedList) error { @@ -7711,6 +8001,7 @@ func (g *GCEAlphaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta Operation: "AddSignedUrlKey", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.AddSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7720,13 +8011,14 @@ func (g *GCEAlphaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta } call := g.s.Alpha.BackendServices.AddSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7753,6 +8045,7 @@ func (g *GCEAlphaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *m Operation: "DeleteSignedUrlKey", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.DeleteSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7762,13 +8055,14 @@ func (g *GCEAlphaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *m } call := g.s.Alpha.BackendServices.DeleteSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7795,6 +8089,7 @@ func (g *GCEAlphaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 Operation: "Patch", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7804,13 +8099,14 @@ func (g *GCEAlphaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.BackendServices.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7837,6 +8133,7 @@ func (g *GCEAlphaBackendServices) SetSecurityPolicy(ctx context.Context, key *me Operation: "SetSecurityPolicy", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7846,13 +8143,14 @@ func (g *GCEAlphaBackendServices) SetSecurityPolicy(ctx context.Context, key *me } call := g.s.Alpha.BackendServices.SetSecurityPolicy(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7879,6 +8177,7 @@ func (g *GCEAlphaBackendServices) Update(ctx context.Context, key *meta.Key, arg Operation: "Update", Version: meta.Version("alpha"), Service: "BackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7888,13 +8187,14 @@ func (g *GCEAlphaBackendServices) Update(ctx context.Context, key *meta.Key, arg } call := g.s.Alpha.BackendServices.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8161,6 +8461,7 @@ func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -8170,6 +8471,7 @@ func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.RegionBackendServices.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -8184,6 +8486,7 @@ func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key, optio func (g *GCERegionBackendServices) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionBackendServices.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionBackendServices") ck := &CallContextKey{ @@ -8191,6 +8494,7 @@ func (g *GCERegionBackendServices) List(ctx context.Context, region string, fl * Operation: "List", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } callObserverStart(ctx, ck) @@ -8249,6 +8553,7 @@ func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8260,13 +8565,14 @@ func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.RegionBackendServices.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8290,6 +8596,7 @@ func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8301,13 +8608,14 @@ func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -8331,6 +8639,7 @@ func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, Operation: "GetHealth", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCERegionBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8340,6 +8649,7 @@ func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, } call := g.s.GA.RegionBackendServices.GetHealth(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -8364,6 +8674,7 @@ func (g *GCERegionBackendServices) Patch(ctx context.Context, key *meta.Key, arg Operation: "Patch", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8373,13 +8684,14 @@ func (g *GCERegionBackendServices) Patch(ctx context.Context, key *meta.Key, arg } call := g.s.GA.RegionBackendServices.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8406,6 +8718,7 @@ func (g *GCERegionBackendServices) SetSecurityPolicy(ctx context.Context, key *m Operation: "SetSecurityPolicy", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCERegionBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8415,13 +8728,14 @@ func (g *GCERegionBackendServices) SetSecurityPolicy(ctx context.Context, key *m } call := g.s.GA.RegionBackendServices.SetSecurityPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8448,6 +8762,7 @@ func (g *GCERegionBackendServices) Update(ctx context.Context, key *meta.Key, ar Operation: "Update", Version: meta.Version("ga"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8457,13 +8772,14 @@ func (g *GCERegionBackendServices) Update(ctx context.Context, key *meta.Key, ar } call := g.s.GA.RegionBackendServices.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8730,6 +9046,7 @@ func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -8739,6 +9056,7 @@ func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.Alpha.RegionBackendServices.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -8753,6 +9071,7 @@ func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key, func (g *GCEAlphaRegionBackendServices) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionBackendServices.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionBackendServices") ck := &CallContextKey{ @@ -8760,6 +9079,7 @@ func (g *GCEAlphaRegionBackendServices) List(ctx context.Context, region string, Operation: "List", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } callObserverStart(ctx, ck) @@ -8818,6 +9138,7 @@ func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Ke Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8829,13 +9150,14 @@ func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Ke call := g.s.Alpha.RegionBackendServices.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8859,6 +9181,7 @@ func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Ke Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8870,13 +9193,14 @@ func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Ke call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -8900,6 +9224,7 @@ func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta Operation: "GetHealth", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8909,6 +9234,7 @@ func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta } call := g.s.Alpha.RegionBackendServices.GetHealth(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -8933,6 +9259,7 @@ func (g *GCEAlphaRegionBackendServices) Patch(ctx context.Context, key *meta.Key Operation: "Patch", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8942,13 +9269,14 @@ func (g *GCEAlphaRegionBackendServices) Patch(ctx context.Context, key *meta.Key } call := g.s.Alpha.RegionBackendServices.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8975,6 +9303,7 @@ func (g *GCEAlphaRegionBackendServices) SetSecurityPolicy(ctx context.Context, k Operation: "SetSecurityPolicy", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8984,13 +9313,14 @@ func (g *GCEAlphaRegionBackendServices) SetSecurityPolicy(ctx context.Context, k } call := g.s.Alpha.RegionBackendServices.SetSecurityPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9017,6 +9347,7 @@ func (g *GCEAlphaRegionBackendServices) Update(ctx context.Context, key *meta.Ke Operation: "Update", Version: meta.Version("alpha"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9026,13 +9357,14 @@ func (g *GCEAlphaRegionBackendServices) Update(ctx context.Context, key *meta.Ke } call := g.s.Alpha.RegionBackendServices.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9299,6 +9631,7 @@ func (g *GCEBetaRegionBackendServices) Get(ctx context.Context, key *meta.Key, o Operation: "Get", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -9308,6 +9641,7 @@ func (g *GCEBetaRegionBackendServices) Get(ctx context.Context, key *meta.Key, o return nil, err } call := g.s.Beta.RegionBackendServices.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaRegionBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -9322,6 +9656,7 @@ func (g *GCEBetaRegionBackendServices) Get(ctx context.Context, key *meta.Key, o func (g *GCEBetaRegionBackendServices) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaRegionBackendServices.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionBackendServices") ck := &CallContextKey{ @@ -9329,6 +9664,7 @@ func (g *GCEBetaRegionBackendServices) List(ctx context.Context, region string, Operation: "List", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } callObserverStart(ctx, ck) @@ -9387,6 +9723,7 @@ func (g *GCEBetaRegionBackendServices) Insert(ctx context.Context, key *meta.Key Operation: "Insert", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9398,13 +9735,14 @@ func (g *GCEBetaRegionBackendServices) Insert(ctx context.Context, key *meta.Key call := g.s.Beta.RegionBackendServices.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9428,6 +9766,7 @@ func (g *GCEBetaRegionBackendServices) Delete(ctx context.Context, key *meta.Key Operation: "Delete", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9439,13 +9778,14 @@ func (g *GCEBetaRegionBackendServices) Delete(ctx context.Context, key *meta.Key call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -9469,6 +9809,7 @@ func (g *GCEBetaRegionBackendServices) GetHealth(ctx context.Context, key *meta. Operation: "GetHealth", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9478,6 +9819,7 @@ func (g *GCEBetaRegionBackendServices) GetHealth(ctx context.Context, key *meta. } call := g.s.Beta.RegionBackendServices.GetHealth(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -9502,6 +9844,7 @@ func (g *GCEBetaRegionBackendServices) Patch(ctx context.Context, key *meta.Key, Operation: "Patch", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9511,13 +9854,14 @@ func (g *GCEBetaRegionBackendServices) Patch(ctx context.Context, key *meta.Key, } call := g.s.Beta.RegionBackendServices.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9544,6 +9888,7 @@ func (g *GCEBetaRegionBackendServices) SetSecurityPolicy(ctx context.Context, ke Operation: "SetSecurityPolicy", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9553,13 +9898,14 @@ func (g *GCEBetaRegionBackendServices) SetSecurityPolicy(ctx context.Context, ke } call := g.s.Beta.RegionBackendServices.SetSecurityPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9586,6 +9932,7 @@ func (g *GCEBetaRegionBackendServices) Update(ctx context.Context, key *meta.Key Operation: "Update", Version: meta.Version("beta"), Service: "RegionBackendServices", + Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9595,13 +9942,14 @@ func (g *GCEBetaRegionBackendServices) Update(ctx context.Context, key *meta.Key } call := g.s.Beta.RegionBackendServices.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9838,6 +10186,7 @@ func (g *GCEDisks) Get(ctx context.Context, key *meta.Key, options ...Option) (* Operation: "Get", Version: meta.Version("ga"), Service: "Disks", + Resource: key, } klog.V(5).Infof("GCEDisks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -9847,6 +10196,7 @@ func (g *GCEDisks) Get(ctx context.Context, key *meta.Key, options ...Option) (* return nil, err } call := g.s.GA.Disks.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEDisks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -9861,6 +10211,7 @@ func (g *GCEDisks) Get(ctx context.Context, key *meta.Key, options ...Option) (* func (g *GCEDisks) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.Disk, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEDisks.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Disks") ck := &CallContextKey{ @@ -9868,6 +10219,7 @@ func (g *GCEDisks) List(ctx context.Context, zone string, fl *filter.F, options Operation: "List", Version: meta.Version("ga"), Service: "Disks", + Resource: key, } callObserverStart(ctx, ck) @@ -9926,6 +10278,7 @@ func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *computega.Dis Operation: "Insert", Version: meta.Version("ga"), Service: "Disks", + Resource: key, } klog.V(5).Infof("GCEDisks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9937,13 +10290,14 @@ func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *computega.Dis call := g.s.GA.Disks.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9967,6 +10321,7 @@ func (g *GCEDisks) Delete(ctx context.Context, key *meta.Key, options ...Option) Operation: "Delete", Version: meta.Version("ga"), Service: "Disks", + Resource: key, } klog.V(5).Infof("GCEDisks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9978,13 +10333,14 @@ func (g *GCEDisks) Delete(ctx context.Context, key *meta.Key, options ...Option) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEDisks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEDisks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -10008,6 +10364,7 @@ func (g *GCEDisks) Resize(ctx context.Context, key *meta.Key, arg0 *computega.Di Operation: "Resize", Version: meta.Version("ga"), Service: "Disks", + Resource: key, } klog.V(5).Infof("GCEDisks.Resize(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10017,13 +10374,14 @@ func (g *GCEDisks) Resize(ctx context.Context, key *meta.Key, arg0 *computega.Di } call := g.s.GA.Disks.Resize(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10260,6 +10618,7 @@ func (g *GCERegionDisks) Get(ctx context.Context, key *meta.Key, options ...Opti Operation: "Get", Version: meta.Version("ga"), Service: "RegionDisks", + Resource: key, } klog.V(5).Infof("GCERegionDisks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -10269,6 +10628,7 @@ func (g *GCERegionDisks) Get(ctx context.Context, key *meta.Key, options ...Opti return nil, err } call := g.s.GA.RegionDisks.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionDisks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -10283,6 +10643,7 @@ func (g *GCERegionDisks) Get(ctx context.Context, key *meta.Key, options ...Opti func (g *GCERegionDisks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Disk, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionDisks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionDisks") ck := &CallContextKey{ @@ -10290,6 +10651,7 @@ func (g *GCERegionDisks) List(ctx context.Context, region string, fl *filter.F, Operation: "List", Version: meta.Version("ga"), Service: "RegionDisks", + Resource: key, } callObserverStart(ctx, ck) @@ -10348,6 +10710,7 @@ func (g *GCERegionDisks) Insert(ctx context.Context, key *meta.Key, obj *compute Operation: "Insert", Version: meta.Version("ga"), Service: "RegionDisks", + Resource: key, } klog.V(5).Infof("GCERegionDisks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10359,13 +10722,14 @@ func (g *GCERegionDisks) Insert(ctx context.Context, key *meta.Key, obj *compute call := g.s.GA.RegionDisks.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10389,6 +10753,7 @@ func (g *GCERegionDisks) Delete(ctx context.Context, key *meta.Key, options ...O Operation: "Delete", Version: meta.Version("ga"), Service: "RegionDisks", + Resource: key, } klog.V(5).Infof("GCERegionDisks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10400,13 +10765,14 @@ func (g *GCERegionDisks) Delete(ctx context.Context, key *meta.Key, options ...O call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionDisks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionDisks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -10430,6 +10796,7 @@ func (g *GCERegionDisks) Resize(ctx context.Context, key *meta.Key, arg0 *comput Operation: "Resize", Version: meta.Version("ga"), Service: "RegionDisks", + Resource: key, } klog.V(5).Infof("GCERegionDisks.Resize(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10439,13 +10806,14 @@ func (g *GCERegionDisks) Resize(ctx context.Context, key *meta.Key, arg0 *comput } call := g.s.GA.RegionDisks.Resize(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10689,6 +11057,7 @@ func (g *GCEAlphaFirewalls) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("alpha"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -10698,6 +11067,7 @@ func (g *GCEAlphaFirewalls) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.Alpha.Firewalls.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaFirewalls.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -10712,6 +11082,7 @@ func (g *GCEAlphaFirewalls) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEAlphaFirewalls) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Firewall, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaFirewalls.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Firewalls") ck := &CallContextKey{ @@ -10719,6 +11090,7 @@ func (g *GCEAlphaFirewalls) List(ctx context.Context, fl *filter.F, options ...O Operation: "List", Version: meta.Version("alpha"), Service: "Firewalls", + Resource: key, } callObserverStart(ctx, ck) @@ -10777,6 +11149,7 @@ func (g *GCEAlphaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("alpha"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10788,13 +11161,14 @@ func (g *GCEAlphaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.Alpha.Firewalls.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10818,6 +11192,7 @@ func (g *GCEAlphaFirewalls) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("alpha"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10829,13 +11204,14 @@ func (g *GCEAlphaFirewalls) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaFirewalls.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaFirewalls.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -10859,6 +11235,7 @@ func (g *GCEAlphaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *comp Operation: "Patch", Version: meta.Version("alpha"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10868,13 +11245,14 @@ func (g *GCEAlphaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.Alpha.Firewalls.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10901,6 +11279,7 @@ func (g *GCEAlphaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *com Operation: "Update", Version: meta.Version("alpha"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10910,13 +11289,14 @@ func (g *GCEAlphaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *com } call := g.s.Alpha.Firewalls.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11160,6 +11540,7 @@ func (g *GCEBetaFirewalls) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("beta"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -11169,6 +11550,7 @@ func (g *GCEBetaFirewalls) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Beta.Firewalls.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaFirewalls.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -11183,6 +11565,7 @@ func (g *GCEBetaFirewalls) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEBetaFirewalls) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Firewall, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaFirewalls.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Firewalls") ck := &CallContextKey{ @@ -11190,6 +11573,7 @@ func (g *GCEBetaFirewalls) List(ctx context.Context, fl *filter.F, options ...Op Operation: "List", Version: meta.Version("beta"), Service: "Firewalls", + Resource: key, } callObserverStart(ctx, ck) @@ -11248,6 +11632,7 @@ func (g *GCEBetaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("beta"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11259,13 +11644,14 @@ func (g *GCEBetaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Beta.Firewalls.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11289,6 +11675,7 @@ func (g *GCEBetaFirewalls) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("beta"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11300,13 +11687,14 @@ func (g *GCEBetaFirewalls) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaFirewalls.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaFirewalls.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -11330,6 +11718,7 @@ func (g *GCEBetaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *compu Operation: "Patch", Version: meta.Version("beta"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11339,13 +11728,14 @@ func (g *GCEBetaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.Beta.Firewalls.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11372,6 +11762,7 @@ func (g *GCEBetaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *comp Operation: "Update", Version: meta.Version("beta"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11381,13 +11772,14 @@ func (g *GCEBetaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.Beta.Firewalls.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11631,6 +12023,7 @@ func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("ga"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEFirewalls.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -11640,6 +12033,7 @@ func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key, options ...Option return nil, err } call := g.s.GA.Firewalls.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEFirewalls.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -11654,6 +12048,7 @@ func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key, options ...Option func (g *GCEFirewalls) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Firewall, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEFirewalls.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Firewalls") ck := &CallContextKey{ @@ -11661,6 +12056,7 @@ func (g *GCEFirewalls) List(ctx context.Context, fl *filter.F, options ...Option Operation: "List", Version: meta.Version("ga"), Service: "Firewalls", + Resource: key, } callObserverStart(ctx, ck) @@ -11719,6 +12115,7 @@ func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *computega Operation: "Insert", Version: meta.Version("ga"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEFirewalls.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11730,13 +12127,14 @@ func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *computega call := g.s.GA.Firewalls.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11760,6 +12158,7 @@ func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("ga"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEFirewalls.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11771,13 +12170,14 @@ func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEFirewalls.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEFirewalls.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -11801,6 +12201,7 @@ func (g *GCEFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *computega Operation: "Patch", Version: meta.Version("ga"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEFirewalls.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11810,13 +12211,14 @@ func (g *GCEFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *computega } call := g.s.GA.Firewalls.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11843,6 +12245,7 @@ func (g *GCEFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *computeg Operation: "Update", Version: meta.Version("ga"), Service: "Firewalls", + Resource: key, } klog.V(5).Infof("GCEFirewalls.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11852,13 +12255,14 @@ func (g *GCEFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *computeg } call := g.s.GA.Firewalls.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12202,6 +12606,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) Get(ctx context.Context, key *meta.Key Operation: "Get", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -12211,6 +12616,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) Get(ctx context.Context, key *meta.Key return nil, err } call := g.s.Alpha.NetworkFirewallPolicies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -12225,6 +12631,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) Get(ctx context.Context, key *meta.Key func (g *GCEAlphaNetworkFirewallPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.FirewallPolicy, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "NetworkFirewallPolicies") ck := &CallContextKey{ @@ -12232,6 +12639,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) List(ctx context.Context, fl *filter.F Operation: "List", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } callObserverStart(ctx, ck) @@ -12290,6 +12698,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) Insert(ctx context.Context, key *meta. Operation: "Insert", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12301,13 +12710,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) Insert(ctx context.Context, key *meta. call := g.s.Alpha.NetworkFirewallPolicies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12331,6 +12741,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) Delete(ctx context.Context, key *meta. Operation: "Delete", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12342,13 +12753,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) Delete(ctx context.Context, key *meta. call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -12372,6 +12784,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddAssociation(ctx context.Context, ke Operation: "AddAssociation", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.AddAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12381,13 +12794,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddAssociation(ctx context.Context, ke } call := g.s.Alpha.NetworkFirewallPolicies.AddAssociation(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12414,6 +12828,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddRule(ctx context.Context, key *meta Operation: "AddRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12423,13 +12838,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddRule(ctx context.Context, key *meta } call := g.s.Alpha.NetworkFirewallPolicies.AddRule(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12456,6 +12872,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) CloneRules(ctx context.Context, key *m Operation: "CloneRules", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.CloneRules(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12465,13 +12882,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) CloneRules(ctx context.Context, key *m } call := g.s.Alpha.NetworkFirewallPolicies.CloneRules(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12498,6 +12916,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetAssociation(ctx context.Context, ke Operation: "GetAssociation", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.GetAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12507,6 +12926,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetAssociation(ctx context.Context, ke } call := g.s.Alpha.NetworkFirewallPolicies.GetAssociation(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -12531,6 +12951,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetIamPolicy(ctx context.Context, key Operation: "GetIamPolicy", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12540,6 +12961,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetIamPolicy(ctx context.Context, key } call := g.s.Alpha.NetworkFirewallPolicies.GetIamPolicy(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -12564,6 +12986,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetRule(ctx context.Context, key *meta Operation: "GetRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12573,6 +12996,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetRule(ctx context.Context, key *meta } call := g.s.Alpha.NetworkFirewallPolicies.GetRule(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -12597,6 +13021,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) Patch(ctx context.Context, key *meta.K Operation: "Patch", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12606,13 +13031,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) Patch(ctx context.Context, key *meta.K } call := g.s.Alpha.NetworkFirewallPolicies.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12639,6 +13065,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) PatchRule(ctx context.Context, key *me Operation: "PatchRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12648,13 +13075,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) PatchRule(ctx context.Context, key *me } call := g.s.Alpha.NetworkFirewallPolicies.PatchRule(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12681,6 +13109,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveAssociation(ctx context.Context, Operation: "RemoveAssociation", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12690,13 +13119,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveAssociation(ctx context.Context, } call := g.s.Alpha.NetworkFirewallPolicies.RemoveAssociation(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12723,6 +13153,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveRule(ctx context.Context, key *m Operation: "RemoveRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12732,13 +13163,14 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveRule(ctx context.Context, key *m } call := g.s.Alpha.NetworkFirewallPolicies.RemoveRule(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12765,6 +13197,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) SetIamPolicy(ctx context.Context, key Operation: "SetIamPolicy", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12774,6 +13207,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) SetIamPolicy(ctx context.Context, key } call := g.s.Alpha.NetworkFirewallPolicies.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -12798,6 +13232,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) TestIamPermissions(ctx context.Context Operation: "TestIamPermissions", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12807,6 +13242,7 @@ func (g *GCEAlphaNetworkFirewallPolicies) TestIamPermissions(ctx context.Context } call := g.s.Alpha.NetworkFirewallPolicies.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13151,6 +13587,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Get(ctx context.Context, key *me Operation: "Get", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -13160,6 +13597,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Get(ctx context.Context, key *me return nil, err } call := g.s.Alpha.RegionNetworkFirewallPolicies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -13174,6 +13612,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Get(ctx context.Context, key *me func (g *GCEAlphaRegionNetworkFirewallPolicies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.FirewallPolicy, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkFirewallPolicies") ck := &CallContextKey{ @@ -13181,6 +13620,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) List(ctx context.Context, region Operation: "List", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } callObserverStart(ctx, ck) @@ -13239,6 +13679,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Insert(ctx context.Context, key Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13250,13 +13691,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Insert(ctx context.Context, key call := g.s.Alpha.RegionNetworkFirewallPolicies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13280,6 +13722,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Delete(ctx context.Context, key Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13291,13 +13734,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Delete(ctx context.Context, key call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -13321,6 +13765,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddAssociation(ctx context.Conte Operation: "AddAssociation", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13330,13 +13775,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddAssociation(ctx context.Conte } call := g.s.Alpha.RegionNetworkFirewallPolicies.AddAssociation(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13363,6 +13809,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddRule(ctx context.Context, key Operation: "AddRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13372,13 +13819,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddRule(ctx context.Context, key } call := g.s.Alpha.RegionNetworkFirewallPolicies.AddRule(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13405,6 +13853,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) CloneRules(ctx context.Context, Operation: "CloneRules", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.CloneRules(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13414,13 +13863,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) CloneRules(ctx context.Context, } call := g.s.Alpha.RegionNetworkFirewallPolicies.CloneRules(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13447,6 +13897,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetAssociation(ctx context.Conte Operation: "GetAssociation", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.GetAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13456,6 +13907,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetAssociation(ctx context.Conte } call := g.s.Alpha.RegionNetworkFirewallPolicies.GetAssociation(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13480,6 +13932,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetIamPolicy(ctx context.Context Operation: "GetIamPolicy", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13489,6 +13942,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetIamPolicy(ctx context.Context } call := g.s.Alpha.RegionNetworkFirewallPolicies.GetIamPolicy(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13513,6 +13967,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetRule(ctx context.Context, key Operation: "GetRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13522,6 +13977,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetRule(ctx context.Context, key } call := g.s.Alpha.RegionNetworkFirewallPolicies.GetRule(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13546,6 +14002,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Patch(ctx context.Context, key * Operation: "Patch", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13555,13 +14012,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Patch(ctx context.Context, key * } call := g.s.Alpha.RegionNetworkFirewallPolicies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13588,6 +14046,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) PatchRule(ctx context.Context, k Operation: "PatchRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13597,13 +14056,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) PatchRule(ctx context.Context, k } call := g.s.Alpha.RegionNetworkFirewallPolicies.PatchRule(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13630,6 +14090,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveAssociation(ctx context.Co Operation: "RemoveAssociation", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13639,13 +14100,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveAssociation(ctx context.Co } call := g.s.Alpha.RegionNetworkFirewallPolicies.RemoveAssociation(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13672,6 +14134,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveRule(ctx context.Context, Operation: "RemoveRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13681,13 +14144,14 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveRule(ctx context.Context, } call := g.s.Alpha.RegionNetworkFirewallPolicies.RemoveRule(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13714,6 +14178,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) SetIamPolicy(ctx context.Context Operation: "SetIamPolicy", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13723,6 +14188,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) SetIamPolicy(ctx context.Context } call := g.s.Alpha.RegionNetworkFirewallPolicies.SetIamPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13747,6 +14213,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) TestIamPermissions(ctx context.C Operation: "TestIamPermissions", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13756,6 +14223,7 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) TestIamPermissions(ctx context.C } call := g.s.Alpha.RegionNetworkFirewallPolicies.TestIamPermissions(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13771,6 +14239,7 @@ type ForwardingRules interface { List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computega.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computega.RegionSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computega.TargetReference, ...Option) error } @@ -13812,6 +14281,7 @@ type MockForwardingRules struct { ListHook func(ctx context.Context, region string, fl *filter.F, m *MockForwardingRules, options ...Option) (bool, []*computega.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, m *MockForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockForwardingRules, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computega.ForwardingRule, *MockForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computega.RegionSetLabelsRequest, *MockForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computega.TargetReference, *MockForwardingRules, ...Option) error @@ -13963,6 +14433,14 @@ func (m *MockForwardingRules) Obj(o *computega.ForwardingRule) *MockForwardingRu return &MockForwardingRulesObj{o} } +// Patch is a mock for the corresponding method. +func (m *MockForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + // SetLabels is a mock for the corresponding method. func (m *MockForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.RegionSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -14000,6 +14478,7 @@ func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key, options ... Operation: "Get", Version: meta.Version("ga"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -14009,6 +14488,7 @@ func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key, options ... return nil, err } call := g.s.GA.ForwardingRules.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -14023,6 +14503,7 @@ func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key, options ... func (g *GCEForwardingRules) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEForwardingRules.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ForwardingRules") ck := &CallContextKey{ @@ -14030,6 +14511,7 @@ func (g *GCEForwardingRules) List(ctx context.Context, region string, fl *filter Operation: "List", Version: meta.Version("ga"), Service: "ForwardingRules", + Resource: key, } callObserverStart(ctx, ck) @@ -14088,6 +14570,7 @@ func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *com Operation: "Insert", Version: meta.Version("ga"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14099,13 +14582,14 @@ func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *com call := g.s.GA.ForwardingRules.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14129,6 +14613,7 @@ func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14140,13 +14625,14 @@ func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -14155,6 +14641,50 @@ func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key, options return err } +// Patch is a method on GCEForwardingRules. +func (g *GCEForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ForwardingRules") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("ga"), + Service: "ForwardingRules", + Resource: key, + } + klog.V(5).Infof("GCEForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.ForwardingRules.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + // SetLabels is a method on GCEForwardingRules. func (g *GCEForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.RegionSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -14170,6 +14700,7 @@ func (g *GCEForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 Operation: "SetLabels", Version: meta.Version("ga"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14179,13 +14710,14 @@ func (g *GCEForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.ForwardingRules.SetLabels(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14212,6 +14744,7 @@ func (g *GCEForwardingRules) SetTarget(ctx context.Context, key *meta.Key, arg0 Operation: "SetTarget", Version: meta.Version("ga"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14221,13 +14754,14 @@ func (g *GCEForwardingRules) SetTarget(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.ForwardingRules.SetTarget(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14245,6 +14779,7 @@ type AlphaForwardingRules interface { List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computealpha.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computealpha.RegionSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computealpha.TargetReference, ...Option) error } @@ -14286,6 +14821,7 @@ type MockAlphaForwardingRules struct { ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaForwardingRules, options ...Option) (bool, []*computealpha.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, m *MockAlphaForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaForwardingRules, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computealpha.ForwardingRule, *MockAlphaForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computealpha.RegionSetLabelsRequest, *MockAlphaForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computealpha.TargetReference, *MockAlphaForwardingRules, ...Option) error @@ -14437,6 +14973,14 @@ func (m *MockAlphaForwardingRules) Obj(o *computealpha.ForwardingRule) *MockForw return &MockForwardingRulesObj{o} } +// Patch is a mock for the corresponding method. +func (m *MockAlphaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + // SetLabels is a mock for the corresponding method. func (m *MockAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -14474,6 +15018,7 @@ func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key, option Operation: "Get", Version: meta.Version("alpha"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -14483,6 +15028,7 @@ func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key, option return nil, err } call := g.s.Alpha.ForwardingRules.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -14497,6 +15043,7 @@ func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key, option func (g *GCEAlphaForwardingRules) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaForwardingRules.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ForwardingRules") ck := &CallContextKey{ @@ -14504,6 +15051,7 @@ func (g *GCEAlphaForwardingRules) List(ctx context.Context, region string, fl *f Operation: "List", Version: meta.Version("alpha"), Service: "ForwardingRules", + Resource: key, } callObserverStart(ctx, ck) @@ -14562,6 +15110,7 @@ func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("alpha"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14573,13 +15122,14 @@ func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Alpha.ForwardingRules.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14603,6 +15153,7 @@ func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key, opt Operation: "Delete", Version: meta.Version("alpha"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14614,13 +15165,14 @@ func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key, opt call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -14629,6 +15181,50 @@ func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key, opt return err } +// Patch is a method on GCEAlphaForwardingRules. +func (g *GCEAlphaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ForwardingRules") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "ForwardingRules", + Resource: key, + } + klog.V(5).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.ForwardingRules.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + // SetLabels is a method on GCEAlphaForwardingRules. func (g *GCEAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -14644,6 +15240,7 @@ func (g *GCEAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, Operation: "SetLabels", Version: meta.Version("alpha"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14653,13 +15250,14 @@ func (g *GCEAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, } call := g.s.Alpha.ForwardingRules.SetLabels(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14686,6 +15284,7 @@ func (g *GCEAlphaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, Operation: "SetTarget", Version: meta.Version("alpha"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14695,13 +15294,14 @@ func (g *GCEAlphaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, } call := g.s.Alpha.ForwardingRules.SetTarget(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14719,6 +15319,7 @@ type BetaForwardingRules interface { List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computebeta.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computebeta.RegionSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computebeta.TargetReference, ...Option) error } @@ -14760,6 +15361,7 @@ type MockBetaForwardingRules struct { ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaForwardingRules, options ...Option) (bool, []*computebeta.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, m *MockBetaForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaForwardingRules, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computebeta.ForwardingRule, *MockBetaForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computebeta.RegionSetLabelsRequest, *MockBetaForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computebeta.TargetReference, *MockBetaForwardingRules, ...Option) error @@ -14911,6 +15513,14 @@ func (m *MockBetaForwardingRules) Obj(o *computebeta.ForwardingRule) *MockForwar return &MockForwardingRulesObj{o} } +// Patch is a mock for the corresponding method. +func (m *MockBetaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + // SetLabels is a mock for the corresponding method. func (m *MockBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -14948,6 +15558,7 @@ func (g *GCEBetaForwardingRules) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("beta"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -14957,6 +15568,7 @@ func (g *GCEBetaForwardingRules) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Beta.ForwardingRules.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -14971,6 +15583,7 @@ func (g *GCEBetaForwardingRules) Get(ctx context.Context, key *meta.Key, options func (g *GCEBetaForwardingRules) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaForwardingRules.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ForwardingRules") ck := &CallContextKey{ @@ -14978,6 +15591,7 @@ func (g *GCEBetaForwardingRules) List(ctx context.Context, region string, fl *fi Operation: "List", Version: meta.Version("beta"), Service: "ForwardingRules", + Resource: key, } callObserverStart(ctx, ck) @@ -15036,6 +15650,7 @@ func (g *GCEBetaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("beta"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15047,13 +15662,14 @@ func (g *GCEBetaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Beta.ForwardingRules.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15077,6 +15693,7 @@ func (g *GCEBetaForwardingRules) Delete(ctx context.Context, key *meta.Key, opti Operation: "Delete", Version: meta.Version("beta"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15088,13 +15705,14 @@ func (g *GCEBetaForwardingRules) Delete(ctx context.Context, key *meta.Key, opti call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -15103,6 +15721,50 @@ func (g *GCEBetaForwardingRules) Delete(ctx context.Context, key *meta.Key, opti return err } +// Patch is a method on GCEBetaForwardingRules. +func (g *GCEBetaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ForwardingRules") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "ForwardingRules", + Resource: key, + } + klog.V(5).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.ForwardingRules.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + // SetLabels is a method on GCEBetaForwardingRules. func (g *GCEBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -15118,6 +15780,7 @@ func (g *GCEBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, a Operation: "SetLabels", Version: meta.Version("beta"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15127,13 +15790,14 @@ func (g *GCEBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, a } call := g.s.Beta.ForwardingRules.SetLabels(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15160,6 +15824,7 @@ func (g *GCEBetaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, a Operation: "SetTarget", Version: meta.Version("beta"), Service: "ForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15169,13 +15834,14 @@ func (g *GCEBetaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, a } call := g.s.Beta.ForwardingRules.SetTarget(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15193,6 +15859,7 @@ type AlphaGlobalForwardingRules interface { List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computealpha.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computealpha.GlobalSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computealpha.TargetReference, ...Option) error } @@ -15234,6 +15901,7 @@ type MockAlphaGlobalForwardingRules struct { ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaGlobalForwardingRules, options ...Option) (bool, []*computealpha.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, m *MockAlphaGlobalForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaGlobalForwardingRules, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computealpha.ForwardingRule, *MockAlphaGlobalForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computealpha.GlobalSetLabelsRequest, *MockAlphaGlobalForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computealpha.TargetReference, *MockAlphaGlobalForwardingRules, ...Option) error @@ -15382,6 +16050,14 @@ func (m *MockAlphaGlobalForwardingRules) Obj(o *computealpha.ForwardingRule) *Mo return &MockGlobalForwardingRulesObj{o} } +// Patch is a mock for the corresponding method. +func (m *MockAlphaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + // SetLabels is a mock for the corresponding method. func (m *MockAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.GlobalSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -15419,6 +16095,7 @@ func (g *GCEAlphaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -15428,6 +16105,7 @@ func (g *GCEAlphaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.Alpha.GlobalForwardingRules.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -15442,6 +16120,7 @@ func (g *GCEAlphaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, func (g *GCEAlphaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaGlobalForwardingRules.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalForwardingRules") ck := &CallContextKey{ @@ -15449,6 +16128,7 @@ func (g *GCEAlphaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, Operation: "List", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", + Resource: key, } callObserverStart(ctx, ck) @@ -15507,6 +16187,7 @@ func (g *GCEAlphaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Ke Operation: "Insert", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15518,13 +16199,14 @@ func (g *GCEAlphaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Ke call := g.s.Alpha.GlobalForwardingRules.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15548,6 +16230,7 @@ func (g *GCEAlphaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Ke Operation: "Delete", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15559,13 +16242,14 @@ func (g *GCEAlphaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Ke call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -15574,6 +16258,50 @@ func (g *GCEAlphaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Ke return err } +// Patch is a method on GCEAlphaGlobalForwardingRules. +func (g *GCEAlphaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalForwardingRules") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "GlobalForwardingRules", + Resource: key, + } + klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.GlobalForwardingRules.Patch(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + // SetLabels is a method on GCEAlphaGlobalForwardingRules. func (g *GCEAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.GlobalSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -15589,6 +16317,7 @@ func (g *GCEAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta Operation: "SetLabels", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15598,13 +16327,14 @@ func (g *GCEAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta } call := g.s.Alpha.GlobalForwardingRules.SetLabels(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15631,6 +16361,7 @@ func (g *GCEAlphaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta Operation: "SetTarget", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15640,13 +16371,14 @@ func (g *GCEAlphaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta } call := g.s.Alpha.GlobalForwardingRules.SetTarget(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15664,6 +16396,7 @@ type BetaGlobalForwardingRules interface { List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computebeta.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computebeta.GlobalSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computebeta.TargetReference, ...Option) error } @@ -15705,6 +16438,7 @@ type MockBetaGlobalForwardingRules struct { ListHook func(ctx context.Context, fl *filter.F, m *MockBetaGlobalForwardingRules, options ...Option) (bool, []*computebeta.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, m *MockBetaGlobalForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaGlobalForwardingRules, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computebeta.ForwardingRule, *MockBetaGlobalForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computebeta.GlobalSetLabelsRequest, *MockBetaGlobalForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computebeta.TargetReference, *MockBetaGlobalForwardingRules, ...Option) error @@ -15853,6 +16587,14 @@ func (m *MockBetaGlobalForwardingRules) Obj(o *computebeta.ForwardingRule) *Mock return &MockGlobalForwardingRulesObj{o} } +// Patch is a mock for the corresponding method. +func (m *MockBetaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + // SetLabels is a mock for the corresponding method. func (m *MockBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.GlobalSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -15890,6 +16632,7 @@ func (g *GCEBetaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, o Operation: "Get", Version: meta.Version("beta"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -15899,6 +16642,7 @@ func (g *GCEBetaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, o return nil, err } call := g.s.Beta.GlobalForwardingRules.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaGlobalForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -15913,6 +16657,7 @@ func (g *GCEBetaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, o func (g *GCEBetaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaGlobalForwardingRules.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalForwardingRules") ck := &CallContextKey{ @@ -15920,6 +16665,7 @@ func (g *GCEBetaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, o Operation: "List", Version: meta.Version("beta"), Service: "GlobalForwardingRules", + Resource: key, } callObserverStart(ctx, ck) @@ -15978,6 +16724,7 @@ func (g *GCEBetaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key Operation: "Insert", Version: meta.Version("beta"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15989,13 +16736,14 @@ func (g *GCEBetaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key call := g.s.Beta.GlobalForwardingRules.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16019,6 +16767,7 @@ func (g *GCEBetaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key Operation: "Delete", Version: meta.Version("beta"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16030,13 +16779,14 @@ func (g *GCEBetaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -16045,6 +16795,50 @@ func (g *GCEBetaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key return err } +// Patch is a method on GCEBetaGlobalForwardingRules. +func (g *GCEBetaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalForwardingRules") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "GlobalForwardingRules", + Resource: key, + } + klog.V(5).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.GlobalForwardingRules.Patch(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + // SetLabels is a method on GCEBetaGlobalForwardingRules. func (g *GCEBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.GlobalSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -16060,6 +16854,7 @@ func (g *GCEBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta. Operation: "SetLabels", Version: meta.Version("beta"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16069,13 +16864,14 @@ func (g *GCEBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta. } call := g.s.Beta.GlobalForwardingRules.SetLabels(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16102,6 +16898,7 @@ func (g *GCEBetaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta. Operation: "SetTarget", Version: meta.Version("beta"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16111,13 +16908,14 @@ func (g *GCEBetaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta. } call := g.s.Beta.GlobalForwardingRules.SetTarget(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16135,6 +16933,7 @@ type GlobalForwardingRules interface { List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computega.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computega.GlobalSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computega.TargetReference, ...Option) error } @@ -16176,6 +16975,7 @@ type MockGlobalForwardingRules struct { ListHook func(ctx context.Context, fl *filter.F, m *MockGlobalForwardingRules, options ...Option) (bool, []*computega.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, m *MockGlobalForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockGlobalForwardingRules, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computega.ForwardingRule, *MockGlobalForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computega.GlobalSetLabelsRequest, *MockGlobalForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computega.TargetReference, *MockGlobalForwardingRules, ...Option) error @@ -16324,6 +17124,14 @@ func (m *MockGlobalForwardingRules) Obj(o *computega.ForwardingRule) *MockGlobal return &MockGlobalForwardingRulesObj{o} } +// Patch is a mock for the corresponding method. +func (m *MockGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + // SetLabels is a mock for the corresponding method. func (m *MockGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.GlobalSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -16361,6 +17169,7 @@ func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -16370,6 +17179,7 @@ func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.GlobalForwardingRules.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEGlobalForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -16384,6 +17194,7 @@ func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, optio func (g *GCEGlobalForwardingRules) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEGlobalForwardingRules.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalForwardingRules") ck := &CallContextKey{ @@ -16391,6 +17202,7 @@ func (g *GCEGlobalForwardingRules) List(ctx context.Context, fl *filter.F, optio Operation: "List", Version: meta.Version("ga"), Service: "GlobalForwardingRules", + Resource: key, } callObserverStart(ctx, ck) @@ -16449,6 +17261,7 @@ func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16460,13 +17273,14 @@ func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.GlobalForwardingRules.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16490,6 +17304,7 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16501,13 +17316,14 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -16516,6 +17332,50 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key, op return err } +// Patch is a method on GCEGlobalForwardingRules. +func (g *GCEGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEGlobalForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEGlobalForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalForwardingRules") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("ga"), + Service: "GlobalForwardingRules", + Resource: key, + } + klog.V(5).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.GlobalForwardingRules.Patch(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + // SetLabels is a method on GCEGlobalForwardingRules. func (g *GCEGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.GlobalSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -16531,6 +17391,7 @@ func (g *GCEGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, Operation: "SetLabels", Version: meta.Version("ga"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16540,13 +17401,14 @@ func (g *GCEGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, } call := g.s.GA.GlobalForwardingRules.SetLabels(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16573,6 +17435,7 @@ func (g *GCEGlobalForwardingRules) SetTarget(ctx context.Context, key *meta.Key, Operation: "SetTarget", Version: meta.Version("ga"), Service: "GlobalForwardingRules", + Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16582,13 +17445,14 @@ func (g *GCEGlobalForwardingRules) SetTarget(ctx context.Context, key *meta.Key, } call := g.s.GA.GlobalForwardingRules.SetTarget(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16822,6 +17686,7 @@ func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("ga"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -16831,6 +17696,7 @@ func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key, options ...Opt return nil, err } call := g.s.GA.HealthChecks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -16845,6 +17711,7 @@ func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *GCEHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "HealthChecks") ck := &CallContextKey{ @@ -16852,6 +17719,7 @@ func (g *GCEHealthChecks) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("ga"), Service: "HealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -16910,6 +17778,7 @@ func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *comput Operation: "Insert", Version: meta.Version("ga"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16921,13 +17790,14 @@ func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *comput call := g.s.GA.HealthChecks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16951,6 +17821,7 @@ func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("ga"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16962,13 +17833,14 @@ func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -16992,6 +17864,7 @@ func (g *GCEHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *compu Operation: "Update", Version: meta.Version("ga"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17001,13 +17874,14 @@ func (g *GCEHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.GA.HealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17241,6 +18115,7 @@ func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("alpha"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -17250,6 +18125,7 @@ func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.Alpha.HealthChecks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -17264,6 +18140,7 @@ func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key, options . func (g *GCEAlphaHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "HealthChecks") ck := &CallContextKey{ @@ -17271,6 +18148,7 @@ func (g *GCEAlphaHealthChecks) List(ctx context.Context, fl *filter.F, options . Operation: "List", Version: meta.Version("alpha"), Service: "HealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -17329,6 +18207,7 @@ func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("alpha"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17340,13 +18219,14 @@ func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.Alpha.HealthChecks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17370,6 +18250,7 @@ func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("alpha"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17381,13 +18262,14 @@ func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -17411,6 +18293,7 @@ func (g *GCEAlphaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * Operation: "Update", Version: meta.Version("alpha"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17420,13 +18303,14 @@ func (g *GCEAlphaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Alpha.HealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17660,6 +18544,7 @@ func (g *GCEBetaHealthChecks) Get(ctx context.Context, key *meta.Key, options .. Operation: "Get", Version: meta.Version("beta"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -17669,6 +18554,7 @@ func (g *GCEBetaHealthChecks) Get(ctx context.Context, key *meta.Key, options .. return nil, err } call := g.s.Beta.HealthChecks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -17683,6 +18569,7 @@ func (g *GCEBetaHealthChecks) Get(ctx context.Context, key *meta.Key, options .. func (g *GCEBetaHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "HealthChecks") ck := &CallContextKey{ @@ -17690,6 +18577,7 @@ func (g *GCEBetaHealthChecks) List(ctx context.Context, fl *filter.F, options .. Operation: "List", Version: meta.Version("beta"), Service: "HealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -17748,6 +18636,7 @@ func (g *GCEBetaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co Operation: "Insert", Version: meta.Version("beta"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17759,13 +18648,14 @@ func (g *GCEBetaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co call := g.s.Beta.HealthChecks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17789,6 +18679,7 @@ func (g *GCEBetaHealthChecks) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("beta"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17800,13 +18691,14 @@ func (g *GCEBetaHealthChecks) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -17830,6 +18722,7 @@ func (g *GCEBetaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c Operation: "Update", Version: meta.Version("beta"), Service: "HealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17839,13 +18732,14 @@ func (g *GCEBetaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c } call := g.s.Beta.HealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18082,6 +18976,7 @@ func (g *GCEAlphaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opt Operation: "Get", Version: meta.Version("alpha"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -18091,6 +18986,7 @@ func (g *GCEAlphaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opt return nil, err } call := g.s.Alpha.RegionHealthChecks.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -18105,6 +19001,7 @@ func (g *GCEAlphaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opt func (g *GCEAlphaRegionHealthChecks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionHealthChecks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionHealthChecks") ck := &CallContextKey{ @@ -18112,6 +19009,7 @@ func (g *GCEAlphaRegionHealthChecks) List(ctx context.Context, region string, fl Operation: "List", Version: meta.Version("alpha"), Service: "RegionHealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -18170,6 +19068,7 @@ func (g *GCEAlphaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18181,13 +19080,14 @@ func (g *GCEAlphaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, call := g.s.Alpha.RegionHealthChecks.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18211,6 +19111,7 @@ func (g *GCEAlphaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18222,13 +19123,14 @@ func (g *GCEAlphaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -18252,6 +19154,7 @@ func (g *GCEAlphaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, Operation: "Update", Version: meta.Version("alpha"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18261,13 +19164,14 @@ func (g *GCEAlphaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, } call := g.s.Alpha.RegionHealthChecks.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18504,6 +19408,7 @@ func (g *GCEBetaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opti Operation: "Get", Version: meta.Version("beta"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -18513,6 +19418,7 @@ func (g *GCEBetaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opti return nil, err } call := g.s.Beta.RegionHealthChecks.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaRegionHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -18527,6 +19433,7 @@ func (g *GCEBetaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opti func (g *GCEBetaRegionHealthChecks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaRegionHealthChecks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionHealthChecks") ck := &CallContextKey{ @@ -18534,6 +19441,7 @@ func (g *GCEBetaRegionHealthChecks) List(ctx context.Context, region string, fl Operation: "List", Version: meta.Version("beta"), Service: "RegionHealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -18592,6 +19500,7 @@ func (g *GCEBetaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, o Operation: "Insert", Version: meta.Version("beta"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18603,13 +19512,14 @@ func (g *GCEBetaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, o call := g.s.Beta.RegionHealthChecks.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18633,6 +19543,7 @@ func (g *GCEBetaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, o Operation: "Delete", Version: meta.Version("beta"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18644,13 +19555,14 @@ func (g *GCEBetaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, o call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -18674,6 +19586,7 @@ func (g *GCEBetaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, a Operation: "Update", Version: meta.Version("beta"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18683,13 +19596,14 @@ func (g *GCEBetaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, a } call := g.s.Beta.RegionHealthChecks.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18926,6 +19840,7 @@ func (g *GCERegionHealthChecks) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("ga"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -18935,6 +19850,7 @@ func (g *GCERegionHealthChecks) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.GA.RegionHealthChecks.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -18949,6 +19865,7 @@ func (g *GCERegionHealthChecks) Get(ctx context.Context, key *meta.Key, options func (g *GCERegionHealthChecks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionHealthChecks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionHealthChecks") ck := &CallContextKey{ @@ -18956,6 +19873,7 @@ func (g *GCERegionHealthChecks) List(ctx context.Context, region string, fl *fil Operation: "List", Version: meta.Version("ga"), Service: "RegionHealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -19014,6 +19932,7 @@ func (g *GCERegionHealthChecks) Insert(ctx context.Context, key *meta.Key, obj * Operation: "Insert", Version: meta.Version("ga"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19025,13 +19944,14 @@ func (g *GCERegionHealthChecks) Insert(ctx context.Context, key *meta.Key, obj * call := g.s.GA.RegionHealthChecks.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19055,6 +19975,7 @@ func (g *GCERegionHealthChecks) Delete(ctx context.Context, key *meta.Key, optio Operation: "Delete", Version: meta.Version("ga"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19066,13 +19987,14 @@ func (g *GCERegionHealthChecks) Delete(ctx context.Context, key *meta.Key, optio call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -19096,6 +20018,7 @@ func (g *GCERegionHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 Operation: "Update", Version: meta.Version("ga"), Service: "RegionHealthChecks", + Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19105,13 +20028,14 @@ func (g *GCERegionHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.RegionHealthChecks.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19345,6 +20269,7 @@ func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key, options .. Operation: "Get", Version: meta.Version("ga"), Service: "HttpHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -19354,6 +20279,7 @@ func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key, options .. return nil, err } call := g.s.GA.HttpHealthChecks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEHttpHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -19368,6 +20294,7 @@ func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key, options .. func (g *GCEHttpHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.HttpHealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEHttpHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "HttpHealthChecks") ck := &CallContextKey{ @@ -19375,6 +20302,7 @@ func (g *GCEHttpHealthChecks) List(ctx context.Context, fl *filter.F, options .. Operation: "List", Version: meta.Version("ga"), Service: "HttpHealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -19433,6 +20361,7 @@ func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co Operation: "Insert", Version: meta.Version("ga"), Service: "HttpHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19444,13 +20373,14 @@ func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co call := g.s.GA.HttpHealthChecks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHttpHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEHttpHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19474,6 +20404,7 @@ func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "HttpHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19485,13 +20416,14 @@ func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHttpHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEHttpHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -19515,6 +20447,7 @@ func (g *GCEHttpHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c Operation: "Update", Version: meta.Version("ga"), Service: "HttpHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19524,13 +20457,14 @@ func (g *GCEHttpHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c } call := g.s.GA.HttpHealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHttpHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEHttpHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19764,6 +20698,7 @@ func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("ga"), Service: "HttpsHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -19773,6 +20708,7 @@ func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.GA.HttpsHealthChecks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEHttpsHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -19787,6 +20723,7 @@ func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key, options . func (g *GCEHttpsHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.HttpsHealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEHttpsHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "HttpsHealthChecks") ck := &CallContextKey{ @@ -19794,6 +20731,7 @@ func (g *GCEHttpsHealthChecks) List(ctx context.Context, fl *filter.F, options . Operation: "List", Version: meta.Version("ga"), Service: "HttpsHealthChecks", + Resource: key, } callObserverStart(ctx, ck) @@ -19852,6 +20790,7 @@ func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("ga"), Service: "HttpsHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19863,13 +20802,14 @@ func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.GA.HttpsHealthChecks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHttpsHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEHttpsHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19893,6 +20833,7 @@ func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("ga"), Service: "HttpsHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19904,13 +20845,14 @@ func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHttpsHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEHttpsHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -19934,6 +20876,7 @@ func (g *GCEHttpsHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * Operation: "Update", Version: meta.Version("ga"), Service: "HttpsHealthChecks", + Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19943,13 +20886,14 @@ func (g *GCEHttpsHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * } call := g.s.GA.HttpsHealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEHttpsHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEHttpsHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20216,6 +21160,7 @@ func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } klog.V(5).Infof("GCEInstanceGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -20225,6 +21170,7 @@ func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.GA.InstanceGroups.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstanceGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -20239,6 +21185,7 @@ func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEInstanceGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.InstanceGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstanceGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "InstanceGroups") ck := &CallContextKey{ @@ -20246,6 +21193,7 @@ func (g *GCEInstanceGroups) List(ctx context.Context, zone string, fl *filter.F, Operation: "List", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } callObserverStart(ctx, ck) @@ -20304,6 +21252,7 @@ func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } klog.V(5).Infof("GCEInstanceGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20315,13 +21264,14 @@ func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.GA.InstanceGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstanceGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20345,6 +21295,7 @@ func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } klog.V(5).Infof("GCEInstanceGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20356,13 +21307,14 @@ func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstanceGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -20386,6 +21338,7 @@ func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg Operation: "AddInstances", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } klog.V(5).Infof("GCEInstanceGroups.AddInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20395,13 +21348,14 @@ func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg } call := g.s.GA.InstanceGroups.AddInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroups.AddInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstanceGroups.AddInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20428,6 +21382,7 @@ func (g *GCEInstanceGroups) ListInstances(ctx context.Context, key *meta.Key, ar Operation: "ListInstances", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } klog.V(5).Infof("GCEInstanceGroups.ListInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20480,6 +21435,7 @@ func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key, Operation: "RemoveInstances", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } klog.V(5).Infof("GCEInstanceGroups.RemoveInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20489,13 +21445,14 @@ func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key, } call := g.s.GA.InstanceGroups.RemoveInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroups.RemoveInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstanceGroups.RemoveInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20522,6 +21479,7 @@ func (g *GCEInstanceGroups) SetNamedPorts(ctx context.Context, key *meta.Key, ar Operation: "SetNamedPorts", Version: meta.Version("ga"), Service: "InstanceGroups", + Resource: key, } klog.V(5).Infof("GCEInstanceGroups.SetNamedPorts(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20531,13 +21489,14 @@ func (g *GCEInstanceGroups) SetNamedPorts(ctx context.Context, key *meta.Key, ar } call := g.s.GA.InstanceGroups.SetNamedPorts(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroups.SetNamedPorts(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstanceGroups.SetNamedPorts(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20784,6 +21743,7 @@ func (g *GCEInstances) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("ga"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEInstances.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -20793,6 +21753,7 @@ func (g *GCEInstances) Get(ctx context.Context, key *meta.Key, options ...Option return nil, err } call := g.s.GA.Instances.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstances.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -20807,6 +21768,7 @@ func (g *GCEInstances) Get(ctx context.Context, key *meta.Key, options ...Option func (g *GCEInstances) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.Instance, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstances.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Instances") ck := &CallContextKey{ @@ -20814,6 +21776,7 @@ func (g *GCEInstances) List(ctx context.Context, zone string, fl *filter.F, opti Operation: "List", Version: meta.Version("ga"), Service: "Instances", + Resource: key, } callObserverStart(ctx, ck) @@ -20872,6 +21835,7 @@ func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *computega Operation: "Insert", Version: meta.Version("ga"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEInstances.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20883,13 +21847,14 @@ func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *computega call := g.s.GA.Instances.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20913,6 +21878,7 @@ func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("ga"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEInstances.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20924,13 +21890,14 @@ func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstances.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstances.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -20954,6 +21921,7 @@ func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *comp Operation: "AttachDisk", Version: meta.Version("ga"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEInstances.AttachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20963,13 +21931,14 @@ func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.GA.Instances.AttachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20996,6 +21965,7 @@ func (g *GCEInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 strin Operation: "DetachDisk", Version: meta.Version("ga"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEInstances.DetachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21005,13 +21975,14 @@ func (g *GCEInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 strin } call := g.s.GA.Instances.DetachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21268,6 +22239,7 @@ func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("beta"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEBetaInstances.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -21277,6 +22249,7 @@ func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Beta.Instances.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaInstances.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -21291,6 +22264,7 @@ func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEBetaInstances) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computebeta.Instance, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaInstances.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Instances") ck := &CallContextKey{ @@ -21298,6 +22272,7 @@ func (g *GCEBetaInstances) List(ctx context.Context, zone string, fl *filter.F, Operation: "List", Version: meta.Version("beta"), Service: "Instances", + Resource: key, } callObserverStart(ctx, ck) @@ -21356,6 +22331,7 @@ func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("beta"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEBetaInstances.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21367,13 +22343,14 @@ func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Beta.Instances.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21397,6 +22374,7 @@ func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("beta"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEBetaInstances.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21408,13 +22386,14 @@ func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaInstances.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaInstances.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -21438,6 +22417,7 @@ func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 * Operation: "AttachDisk", Version: meta.Version("beta"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEBetaInstances.AttachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21447,13 +22427,14 @@ func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Beta.Instances.AttachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21480,6 +22461,7 @@ func (g *GCEBetaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 s Operation: "DetachDisk", Version: meta.Version("beta"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEBetaInstances.DetachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21489,13 +22471,14 @@ func (g *GCEBetaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 s } call := g.s.Beta.Instances.DetachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21522,6 +22505,7 @@ func (g *GCEBetaInstances) UpdateNetworkInterface(ctx context.Context, key *meta Operation: "UpdateNetworkInterface", Version: meta.Version("beta"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEBetaInstances.UpdateNetworkInterface(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21531,13 +22515,14 @@ func (g *GCEBetaInstances) UpdateNetworkInterface(ctx context.Context, key *meta } call := g.s.Beta.Instances.UpdateNetworkInterface(projectID, key.Zone, key.Name, arg0, arg1) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21794,6 +22779,7 @@ func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("alpha"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEAlphaInstances.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -21803,6 +22789,7 @@ func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.Alpha.Instances.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaInstances.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -21817,6 +22804,7 @@ func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEAlphaInstances) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computealpha.Instance, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaInstances.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Instances") ck := &CallContextKey{ @@ -21824,6 +22812,7 @@ func (g *GCEAlphaInstances) List(ctx context.Context, zone string, fl *filter.F, Operation: "List", Version: meta.Version("alpha"), Service: "Instances", + Resource: key, } callObserverStart(ctx, ck) @@ -21882,6 +22871,7 @@ func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("alpha"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEAlphaInstances.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21893,13 +22883,14 @@ func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.Alpha.Instances.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21923,6 +22914,7 @@ func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("alpha"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEAlphaInstances.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21934,13 +22926,14 @@ func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaInstances.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaInstances.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -21964,6 +22957,7 @@ func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 Operation: "AttachDisk", Version: meta.Version("alpha"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEAlphaInstances.AttachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21973,13 +22967,14 @@ func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.Instances.AttachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22006,6 +23001,7 @@ func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 Operation: "DetachDisk", Version: meta.Version("alpha"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEAlphaInstances.DetachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22015,13 +23011,14 @@ func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.Instances.DetachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22048,6 +23045,7 @@ func (g *GCEAlphaInstances) UpdateNetworkInterface(ctx context.Context, key *met Operation: "UpdateNetworkInterface", Version: meta.Version("alpha"), Service: "Instances", + Resource: key, } klog.V(5).Infof("GCEAlphaInstances.UpdateNetworkInterface(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22057,13 +23055,14 @@ func (g *GCEAlphaInstances) UpdateNetworkInterface(ctx context.Context, key *met } call := g.s.Alpha.Instances.UpdateNetworkInterface(projectID, key.Zone, key.Name, arg0, arg1) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22330,6 +23329,7 @@ func (g *GCEInstanceGroupManagers) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -22339,6 +23339,7 @@ func (g *GCEInstanceGroupManagers) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.InstanceGroupManagers.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstanceGroupManagers.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -22353,6 +23354,7 @@ func (g *GCEInstanceGroupManagers) Get(ctx context.Context, key *meta.Key, optio func (g *GCEInstanceGroupManagers) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.InstanceGroupManager, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstanceGroupManagers.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "InstanceGroupManagers") ck := &CallContextKey{ @@ -22360,6 +23362,7 @@ func (g *GCEInstanceGroupManagers) List(ctx context.Context, zone string, fl *fi Operation: "List", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } callObserverStart(ctx, ck) @@ -22418,6 +23421,7 @@ func (g *GCEInstanceGroupManagers) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22429,13 +23433,14 @@ func (g *GCEInstanceGroupManagers) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.InstanceGroupManagers.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroupManagers.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstanceGroupManagers.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22459,6 +23464,7 @@ func (g *GCEInstanceGroupManagers) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22470,13 +23476,14 @@ func (g *GCEInstanceGroupManagers) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroupManagers.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstanceGroupManagers.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -22500,6 +23507,7 @@ func (g *GCEInstanceGroupManagers) CreateInstances(ctx context.Context, key *met Operation: "CreateInstances", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.CreateInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22509,13 +23517,14 @@ func (g *GCEInstanceGroupManagers) CreateInstances(ctx context.Context, key *met } call := g.s.GA.InstanceGroupManagers.CreateInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroupManagers.CreateInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstanceGroupManagers.CreateInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22542,6 +23551,7 @@ func (g *GCEInstanceGroupManagers) DeleteInstances(ctx context.Context, key *met Operation: "DeleteInstances", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.DeleteInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22551,13 +23561,14 @@ func (g *GCEInstanceGroupManagers) DeleteInstances(ctx context.Context, key *met } call := g.s.GA.InstanceGroupManagers.DeleteInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroupManagers.DeleteInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstanceGroupManagers.DeleteInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22584,6 +23595,7 @@ func (g *GCEInstanceGroupManagers) Resize(ctx context.Context, key *meta.Key, ar Operation: "Resize", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Resize(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22593,13 +23605,14 @@ func (g *GCEInstanceGroupManagers) Resize(ctx context.Context, key *meta.Key, ar } call := g.s.GA.InstanceGroupManagers.Resize(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroupManagers.Resize(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstanceGroupManagers.Resize(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22626,6 +23639,7 @@ func (g *GCEInstanceGroupManagers) SetInstanceTemplate(ctx context.Context, key Operation: "SetInstanceTemplate", Version: meta.Version("ga"), Service: "InstanceGroupManagers", + Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.SetInstanceTemplate(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22635,13 +23649,14 @@ func (g *GCEInstanceGroupManagers) SetInstanceTemplate(ctx context.Context, key } call := g.s.GA.InstanceGroupManagers.SetInstanceTemplate(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceGroupManagers.SetInstanceTemplate(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEInstanceGroupManagers.SetInstanceTemplate(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22865,6 +23880,7 @@ func (g *GCEInstanceTemplates) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("ga"), Service: "InstanceTemplates", + Resource: key, } klog.V(5).Infof("GCEInstanceTemplates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -22874,6 +23890,7 @@ func (g *GCEInstanceTemplates) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.GA.InstanceTemplates.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstanceTemplates.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -22888,6 +23905,7 @@ func (g *GCEInstanceTemplates) Get(ctx context.Context, key *meta.Key, options . func (g *GCEInstanceTemplates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.InstanceTemplate, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstanceTemplates.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "InstanceTemplates") ck := &CallContextKey{ @@ -22895,6 +23913,7 @@ func (g *GCEInstanceTemplates) List(ctx context.Context, fl *filter.F, options . Operation: "List", Version: meta.Version("ga"), Service: "InstanceTemplates", + Resource: key, } callObserverStart(ctx, ck) @@ -22953,6 +23972,7 @@ func (g *GCEInstanceTemplates) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("ga"), Service: "InstanceTemplates", + Resource: key, } klog.V(5).Infof("GCEInstanceTemplates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22964,13 +23984,14 @@ func (g *GCEInstanceTemplates) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.GA.InstanceTemplates.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceTemplates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstanceTemplates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22994,6 +24015,7 @@ func (g *GCEInstanceTemplates) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("ga"), Service: "InstanceTemplates", + Resource: key, } klog.V(5).Infof("GCEInstanceTemplates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23005,13 +24027,14 @@ func (g *GCEInstanceTemplates) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEInstanceTemplates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEInstanceTemplates.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -23292,6 +24315,7 @@ func (g *GCEImages) Get(ctx context.Context, key *meta.Key, options ...Option) ( Operation: "Get", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -23301,6 +24325,7 @@ func (g *GCEImages) Get(ctx context.Context, key *meta.Key, options ...Option) ( return nil, err } call := g.s.GA.Images.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEImages.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -23315,6 +24340,7 @@ func (g *GCEImages) Get(ctx context.Context, key *meta.Key, options ...Option) ( func (g *GCEImages) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Image, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEImages.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Images") ck := &CallContextKey{ @@ -23322,6 +24348,7 @@ func (g *GCEImages) List(ctx context.Context, fl *filter.F, options ...Option) ( Operation: "List", Version: meta.Version("ga"), Service: "Images", + Resource: key, } callObserverStart(ctx, ck) @@ -23380,6 +24407,7 @@ func (g *GCEImages) Insert(ctx context.Context, key *meta.Key, obj *computega.Im Operation: "Insert", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23391,13 +24419,14 @@ func (g *GCEImages) Insert(ctx context.Context, key *meta.Key, obj *computega.Im call := g.s.GA.Images.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEImages.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEImages.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23421,6 +24450,7 @@ func (g *GCEImages) Delete(ctx context.Context, key *meta.Key, options ...Option Operation: "Delete", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23432,13 +24462,14 @@ func (g *GCEImages) Delete(ctx context.Context, key *meta.Key, options ...Option call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEImages.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEImages.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -23462,6 +24493,7 @@ func (g *GCEImages) GetFromFamily(ctx context.Context, key *meta.Key, options .. Operation: "GetFromFamily", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.GetFromFamily(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23471,6 +24503,7 @@ func (g *GCEImages) GetFromFamily(ctx context.Context, key *meta.Key, options .. } call := g.s.GA.Images.GetFromFamily(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -23495,6 +24528,7 @@ func (g *GCEImages) GetIamPolicy(ctx context.Context, key *meta.Key, options ... Operation: "GetIamPolicy", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23504,6 +24538,7 @@ func (g *GCEImages) GetIamPolicy(ctx context.Context, key *meta.Key, options ... } call := g.s.GA.Images.GetIamPolicy(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -23528,6 +24563,7 @@ func (g *GCEImages) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Im Operation: "Patch", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23537,13 +24573,14 @@ func (g *GCEImages) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Im } call := g.s.GA.Images.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEImages.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEImages.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23570,6 +24607,7 @@ func (g *GCEImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *compu Operation: "SetIamPolicy", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23579,6 +24617,7 @@ func (g *GCEImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.GA.Images.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -23603,6 +24642,7 @@ func (g *GCEImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *computeg Operation: "SetLabels", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23612,13 +24652,14 @@ func (g *GCEImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *computeg } call := g.s.GA.Images.SetLabels(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23645,6 +24686,7 @@ func (g *GCEImages) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 Operation: "TestIamPermissions", Version: meta.Version("ga"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEImages.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23654,6 +24696,7 @@ func (g *GCEImages) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.Images.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -23935,6 +24978,7 @@ func (g *GCEBetaImages) Get(ctx context.Context, key *meta.Key, options ...Optio Operation: "Get", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -23944,6 +24988,7 @@ func (g *GCEBetaImages) Get(ctx context.Context, key *meta.Key, options ...Optio return nil, err } call := g.s.Beta.Images.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaImages.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -23958,6 +25003,7 @@ func (g *GCEBetaImages) Get(ctx context.Context, key *meta.Key, options ...Optio func (g *GCEBetaImages) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Image, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaImages.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Images") ck := &CallContextKey{ @@ -23965,6 +25011,7 @@ func (g *GCEBetaImages) List(ctx context.Context, fl *filter.F, options ...Optio Operation: "List", Version: meta.Version("beta"), Service: "Images", + Resource: key, } callObserverStart(ctx, ck) @@ -24023,6 +25070,7 @@ func (g *GCEBetaImages) Insert(ctx context.Context, key *meta.Key, obj *computeb Operation: "Insert", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24034,13 +25082,14 @@ func (g *GCEBetaImages) Insert(ctx context.Context, key *meta.Key, obj *computeb call := g.s.Beta.Images.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24064,6 +25113,7 @@ func (g *GCEBetaImages) Delete(ctx context.Context, key *meta.Key, options ...Op Operation: "Delete", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24075,13 +25125,14 @@ func (g *GCEBetaImages) Delete(ctx context.Context, key *meta.Key, options ...Op call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaImages.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaImages.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -24105,6 +25156,7 @@ func (g *GCEBetaImages) GetFromFamily(ctx context.Context, key *meta.Key, option Operation: "GetFromFamily", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.GetFromFamily(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24114,6 +25166,7 @@ func (g *GCEBetaImages) GetFromFamily(ctx context.Context, key *meta.Key, option } call := g.s.Beta.Images.GetFromFamily(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24138,6 +25191,7 @@ func (g *GCEBetaImages) GetIamPolicy(ctx context.Context, key *meta.Key, options Operation: "GetIamPolicy", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24147,6 +25201,7 @@ func (g *GCEBetaImages) GetIamPolicy(ctx context.Context, key *meta.Key, options } call := g.s.Beta.Images.GetIamPolicy(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24171,6 +25226,7 @@ func (g *GCEBetaImages) Patch(ctx context.Context, key *meta.Key, arg0 *computeb Operation: "Patch", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24180,13 +25236,14 @@ func (g *GCEBetaImages) Patch(ctx context.Context, key *meta.Key, arg0 *computeb } call := g.s.Beta.Images.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24213,6 +25270,7 @@ func (g *GCEBetaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *c Operation: "SetIamPolicy", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24222,6 +25280,7 @@ func (g *GCEBetaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *c } call := g.s.Beta.Images.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24246,6 +25305,7 @@ func (g *GCEBetaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *comp Operation: "SetLabels", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24255,13 +25315,14 @@ func (g *GCEBetaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.Beta.Images.SetLabels(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24288,6 +25349,7 @@ func (g *GCEBetaImages) TestIamPermissions(ctx context.Context, key *meta.Key, a Operation: "TestIamPermissions", Version: meta.Version("beta"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEBetaImages.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24297,6 +25359,7 @@ func (g *GCEBetaImages) TestIamPermissions(ctx context.Context, key *meta.Key, a } call := g.s.Beta.Images.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24578,6 +25641,7 @@ func (g *GCEAlphaImages) Get(ctx context.Context, key *meta.Key, options ...Opti Operation: "Get", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -24587,6 +25651,7 @@ func (g *GCEAlphaImages) Get(ctx context.Context, key *meta.Key, options ...Opti return nil, err } call := g.s.Alpha.Images.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaImages.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -24601,6 +25666,7 @@ func (g *GCEAlphaImages) Get(ctx context.Context, key *meta.Key, options ...Opti func (g *GCEAlphaImages) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Image, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaImages.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Images") ck := &CallContextKey{ @@ -24608,6 +25674,7 @@ func (g *GCEAlphaImages) List(ctx context.Context, fl *filter.F, options ...Opti Operation: "List", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } callObserverStart(ctx, ck) @@ -24666,6 +25733,7 @@ func (g *GCEAlphaImages) Insert(ctx context.Context, key *meta.Key, obj *compute Operation: "Insert", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24677,13 +25745,14 @@ func (g *GCEAlphaImages) Insert(ctx context.Context, key *meta.Key, obj *compute call := g.s.Alpha.Images.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24707,6 +25776,7 @@ func (g *GCEAlphaImages) Delete(ctx context.Context, key *meta.Key, options ...O Operation: "Delete", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24718,13 +25788,14 @@ func (g *GCEAlphaImages) Delete(ctx context.Context, key *meta.Key, options ...O call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaImages.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaImages.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -24748,6 +25819,7 @@ func (g *GCEAlphaImages) GetFromFamily(ctx context.Context, key *meta.Key, optio Operation: "GetFromFamily", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.GetFromFamily(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24757,6 +25829,7 @@ func (g *GCEAlphaImages) GetFromFamily(ctx context.Context, key *meta.Key, optio } call := g.s.Alpha.Images.GetFromFamily(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24781,6 +25854,7 @@ func (g *GCEAlphaImages) GetIamPolicy(ctx context.Context, key *meta.Key, option Operation: "GetIamPolicy", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24790,6 +25864,7 @@ func (g *GCEAlphaImages) GetIamPolicy(ctx context.Context, key *meta.Key, option } call := g.s.Alpha.Images.GetIamPolicy(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24814,6 +25889,7 @@ func (g *GCEAlphaImages) Patch(ctx context.Context, key *meta.Key, arg0 *compute Operation: "Patch", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24823,13 +25899,14 @@ func (g *GCEAlphaImages) Patch(ctx context.Context, key *meta.Key, arg0 *compute } call := g.s.Alpha.Images.Patch(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24856,6 +25933,7 @@ func (g *GCEAlphaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 * Operation: "SetIamPolicy", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24865,6 +25943,7 @@ func (g *GCEAlphaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Alpha.Images.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24889,6 +25968,7 @@ func (g *GCEAlphaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *com Operation: "SetLabels", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24898,13 +25978,14 @@ func (g *GCEAlphaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *com } call := g.s.Alpha.Images.SetLabels(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24931,6 +26012,7 @@ func (g *GCEAlphaImages) TestIamPermissions(ctx context.Context, key *meta.Key, Operation: "TestIamPermissions", Version: meta.Version("alpha"), Service: "Images", + Resource: key, } klog.V(5).Infof("GCEAlphaImages.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24940,6 +26022,7 @@ func (g *GCEAlphaImages) TestIamPermissions(ctx context.Context, key *meta.Key, } call := g.s.Alpha.Images.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25161,6 +26244,7 @@ func (g *GCEAlphaNetworks) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("alpha"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -25170,6 +26254,7 @@ func (g *GCEAlphaNetworks) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Alpha.Networks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaNetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -25184,6 +26269,7 @@ func (g *GCEAlphaNetworks) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEAlphaNetworks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Network, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaNetworks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Networks") ck := &CallContextKey{ @@ -25191,6 +26277,7 @@ func (g *GCEAlphaNetworks) List(ctx context.Context, fl *filter.F, options ...Op Operation: "List", Version: meta.Version("alpha"), Service: "Networks", + Resource: key, } callObserverStart(ctx, ck) @@ -25249,6 +26336,7 @@ func (g *GCEAlphaNetworks) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("alpha"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25260,13 +26348,14 @@ func (g *GCEAlphaNetworks) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Alpha.Networks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -25290,6 +26379,7 @@ func (g *GCEAlphaNetworks) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("alpha"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25301,13 +26391,14 @@ func (g *GCEAlphaNetworks) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaNetworks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -25528,6 +26619,7 @@ func (g *GCEBetaNetworks) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("beta"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCEBetaNetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -25537,6 +26629,7 @@ func (g *GCEBetaNetworks) Get(ctx context.Context, key *meta.Key, options ...Opt return nil, err } call := g.s.Beta.Networks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaNetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -25551,6 +26644,7 @@ func (g *GCEBetaNetworks) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *GCEBetaNetworks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Network, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaNetworks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Networks") ck := &CallContextKey{ @@ -25558,6 +26652,7 @@ func (g *GCEBetaNetworks) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("beta"), Service: "Networks", + Resource: key, } callObserverStart(ctx, ck) @@ -25616,6 +26711,7 @@ func (g *GCEBetaNetworks) Insert(ctx context.Context, key *meta.Key, obj *comput Operation: "Insert", Version: meta.Version("beta"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCEBetaNetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25627,13 +26723,14 @@ func (g *GCEBetaNetworks) Insert(ctx context.Context, key *meta.Key, obj *comput call := g.s.Beta.Networks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -25657,6 +26754,7 @@ func (g *GCEBetaNetworks) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("beta"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCEBetaNetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25668,13 +26766,14 @@ func (g *GCEBetaNetworks) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaNetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaNetworks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -25895,6 +26994,7 @@ func (g *GCENetworks) Get(ctx context.Context, key *meta.Key, options ...Option) Operation: "Get", Version: meta.Version("ga"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCENetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -25904,6 +27004,7 @@ func (g *GCENetworks) Get(ctx context.Context, key *meta.Key, options ...Option) return nil, err } call := g.s.GA.Networks.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCENetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -25918,6 +27019,7 @@ func (g *GCENetworks) Get(ctx context.Context, key *meta.Key, options ...Option) func (g *GCENetworks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Network, error) { opts := mergeOptions(options) klog.V(5).Infof("GCENetworks.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Networks") ck := &CallContextKey{ @@ -25925,6 +27027,7 @@ func (g *GCENetworks) List(ctx context.Context, fl *filter.F, options ...Option) Operation: "List", Version: meta.Version("ga"), Service: "Networks", + Resource: key, } callObserverStart(ctx, ck) @@ -25983,6 +27086,7 @@ func (g *GCENetworks) Insert(ctx context.Context, key *meta.Key, obj *computega. Operation: "Insert", Version: meta.Version("ga"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCENetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25994,13 +27098,14 @@ func (g *GCENetworks) Insert(ctx context.Context, key *meta.Key, obj *computega. call := g.s.GA.Networks.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCENetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCENetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -26024,6 +27129,7 @@ func (g *GCENetworks) Delete(ctx context.Context, key *meta.Key, options ...Opti Operation: "Delete", Version: meta.Version("ga"), Service: "Networks", + Resource: key, } klog.V(5).Infof("GCENetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26035,13 +27141,14 @@ func (g *GCENetworks) Delete(ctx context.Context, key *meta.Key, options ...Opti call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCENetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCENetworks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -26333,6 +27440,7 @@ func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -26342,6 +27450,7 @@ func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.Alpha.NetworkEndpointGroups.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -26356,6 +27465,7 @@ func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, func (g *GCEAlphaNetworkEndpointGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "NetworkEndpointGroups") ck := &CallContextKey{ @@ -26363,6 +27473,7 @@ func (g *GCEAlphaNetworkEndpointGroups) List(ctx context.Context, zone string, f Operation: "List", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) @@ -26421,6 +27532,7 @@ func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Ke Operation: "Insert", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26432,13 +27544,14 @@ func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Ke call := g.s.Alpha.NetworkEndpointGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -26462,6 +27575,7 @@ func (g *GCEAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Ke Operation: "Delete", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26473,13 +27587,14 @@ func (g *GCEAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Ke call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -26499,6 +27614,7 @@ func (g *GCEAlphaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl * Operation: "AggregatedList", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -26513,6 +27629,7 @@ func (g *GCEAlphaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl * if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computealpha.NetworkEndpointGroup{} f := func(l *computealpha.NetworkEndpointGroupAggregatedList) error { @@ -26559,6 +27676,7 @@ func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Conte Operation: "AttachNetworkEndpoints", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26568,13 +27686,14 @@ func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Conte } call := g.s.Alpha.NetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -26601,6 +27720,7 @@ func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Conte Operation: "DetachNetworkEndpoints", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26610,13 +27730,14 @@ func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Conte } call := g.s.Alpha.NetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -26643,6 +27764,7 @@ func (g *GCEAlphaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context Operation: "ListNetworkEndpoints", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26963,6 +28085,7 @@ func (g *GCEBetaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, o Operation: "Get", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -26972,6 +28095,7 @@ func (g *GCEBetaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, o return nil, err } call := g.s.Beta.NetworkEndpointGroups.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -26986,6 +28110,7 @@ func (g *GCEBetaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, o func (g *GCEBetaNetworkEndpointGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "NetworkEndpointGroups") ck := &CallContextKey{ @@ -26993,6 +28118,7 @@ func (g *GCEBetaNetworkEndpointGroups) List(ctx context.Context, zone string, fl Operation: "List", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) @@ -27051,6 +28177,7 @@ func (g *GCEBetaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key Operation: "Insert", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27062,13 +28189,14 @@ func (g *GCEBetaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key call := g.s.Beta.NetworkEndpointGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27092,6 +28220,7 @@ func (g *GCEBetaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key Operation: "Delete", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27103,13 +28232,14 @@ func (g *GCEBetaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -27129,6 +28259,7 @@ func (g *GCEBetaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl *f Operation: "AggregatedList", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: &meta.Key{}, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -27143,6 +28274,7 @@ func (g *GCEBetaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl *f if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computebeta.NetworkEndpointGroup{} f := func(l *computebeta.NetworkEndpointGroupAggregatedList) error { @@ -27189,6 +28321,7 @@ func (g *GCEBetaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Contex Operation: "AttachNetworkEndpoints", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27198,13 +28331,14 @@ func (g *GCEBetaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Contex } call := g.s.Beta.NetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27231,6 +28365,7 @@ func (g *GCEBetaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Contex Operation: "DetachNetworkEndpoints", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27240,13 +28375,14 @@ func (g *GCEBetaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Contex } call := g.s.Beta.NetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27273,6 +28409,7 @@ func (g *GCEBetaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, Operation: "ListNetworkEndpoints", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27593,6 +28730,7 @@ func (g *GCENetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -27602,6 +28740,7 @@ func (g *GCENetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.NetworkEndpointGroups.Get(projectID, key.Zone, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCENetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -27616,6 +28755,7 @@ func (g *GCENetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, optio func (g *GCENetworkEndpointGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCENetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) + key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "NetworkEndpointGroups") ck := &CallContextKey{ @@ -27623,6 +28763,7 @@ func (g *GCENetworkEndpointGroups) List(ctx context.Context, zone string, fl *fi Operation: "List", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) @@ -27681,6 +28822,7 @@ func (g *GCENetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27692,13 +28834,14 @@ func (g *GCENetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.NetworkEndpointGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCENetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCENetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27722,6 +28865,7 @@ func (g *GCENetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27733,13 +28877,14 @@ func (g *GCENetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCENetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCENetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -27759,6 +28904,7 @@ func (g *GCENetworkEndpointGroups) AggregatedList(ctx context.Context, fl *filte Operation: "AggregatedList", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: &meta.Key{}, } klog.V(5).Infof("GCENetworkEndpointGroups.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -27773,6 +28919,7 @@ func (g *GCENetworkEndpointGroups) AggregatedList(ctx context.Context, fl *filte if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computega.NetworkEndpointGroup{} f := func(l *computega.NetworkEndpointGroupAggregatedList) error { @@ -27819,6 +28966,7 @@ func (g *GCENetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, k Operation: "AttachNetworkEndpoints", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27828,13 +28976,14 @@ func (g *GCENetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, k } call := g.s.GA.NetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCENetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCENetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27861,6 +29010,7 @@ func (g *GCENetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, k Operation: "DetachNetworkEndpoints", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27870,13 +29020,14 @@ func (g *GCENetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, k } call := g.s.GA.NetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCENetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCENetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27903,6 +29054,7 @@ func (g *GCENetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key Operation: "ListNetworkEndpoints", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28182,6 +29334,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta Operation: "Get", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -28191,6 +29344,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta return nil, err } call := g.s.Alpha.GlobalNetworkEndpointGroups.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -28205,6 +29359,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta func (g *GCEAlphaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalNetworkEndpointGroups") ck := &CallContextKey{ @@ -28212,6 +29367,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filt Operation: "List", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) @@ -28270,6 +29426,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *m Operation: "Insert", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28281,13 +29438,14 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *m call := g.s.Alpha.GlobalNetworkEndpointGroups.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28311,6 +29469,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *m Operation: "Delete", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28322,13 +29481,14 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *m call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -28352,6 +29512,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context Operation: "AttachNetworkEndpoints", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28361,13 +29522,14 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context } call := g.s.Alpha.GlobalNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28394,6 +29556,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context Operation: "DetachNetworkEndpoints", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28403,13 +29566,14 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context } call := g.s.Alpha.GlobalNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28436,6 +29600,7 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.C Operation: "ListNetworkEndpoints", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28715,6 +29880,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta. Operation: "Get", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -28724,6 +29890,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta. return nil, err } call := g.s.Beta.GlobalNetworkEndpointGroups.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -28738,6 +29905,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta. func (g *GCEBetaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalNetworkEndpointGroups") ck := &CallContextKey{ @@ -28745,6 +29913,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filte Operation: "List", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) @@ -28803,6 +29972,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *me Operation: "Insert", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28814,13 +29984,14 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *me call := g.s.Beta.GlobalNetworkEndpointGroups.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28844,6 +30015,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *me Operation: "Delete", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28855,13 +30027,14 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *me call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -28885,6 +30058,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context. Operation: "AttachNetworkEndpoints", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28894,13 +30068,14 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context. } call := g.s.Beta.GlobalNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28927,6 +30102,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context. Operation: "DetachNetworkEndpoints", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28936,13 +30112,14 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context. } call := g.s.Beta.GlobalNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28969,6 +30146,7 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Co Operation: "ListNetworkEndpoints", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29248,6 +30426,7 @@ func (g *GCEGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -29257,6 +30436,7 @@ func (g *GCEGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.GA.GlobalNetworkEndpointGroups.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -29271,6 +30451,7 @@ func (g *GCEGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, func (g *GCEGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalNetworkEndpointGroups") ck := &CallContextKey{ @@ -29278,6 +30459,7 @@ func (g *GCEGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, Operation: "List", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) @@ -29336,6 +30518,7 @@ func (g *GCEGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *meta.K Operation: "Insert", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29347,13 +30530,14 @@ func (g *GCEGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *meta.K call := g.s.GA.GlobalNetworkEndpointGroups.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29377,6 +30561,7 @@ func (g *GCEGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *meta.K Operation: "Delete", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29388,13 +30573,14 @@ func (g *GCEGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *meta.K call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -29418,6 +30604,7 @@ func (g *GCEGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Cont Operation: "AttachNetworkEndpoints", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29427,13 +30614,14 @@ func (g *GCEGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Cont } call := g.s.GA.GlobalNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29460,6 +30648,7 @@ func (g *GCEGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Cont Operation: "DetachNetworkEndpoints", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29469,13 +30658,14 @@ func (g *GCEGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Cont } call := g.s.GA.GlobalNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29502,6 +30692,7 @@ func (g *GCEGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Contex Operation: "ListNetworkEndpoints", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", + Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29539,92 +30730,57 @@ func (g *GCEGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Contex return all, nil } -// Projects is an interface that allows for mocking of Projects. -type Projects interface { - // ProjectsOps is an interface with additional non-CRUD type methods. - // This interface is expected to be implemented by hand (non-autogenerated). - ProjectsOps -} - -// NewMockProjects returns a new mock for Projects. -func NewMockProjects(pr ProjectRouter, objs map[meta.Key]*MockProjectsObj) *MockProjects { - mock := &MockProjects{ - ProjectRouter: pr, - - Objects: objs, - } - return mock -} - -// MockProjects is the mock for Projects. -type MockProjects struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockProjectsObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} - -// Obj wraps the object for use in the mock. -func (m *MockProjects) Obj(o *computega.Project) *MockProjectsObj { - return &MockProjectsObj{o} -} - -// GCEProjects is a simplifying adapter for the GCE Projects. -type GCEProjects struct { - s *Service -} - -// Regions is an interface that allows for mocking of Regions. -type Regions interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) +// AlphaRegionNetworkEndpointGroups is an interface that allows for mocking of RegionNetworkEndpointGroups. +type AlphaRegionNetworkEndpointGroups interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.NetworkEndpointGroup, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + AttachNetworkEndpoints(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, ...Option) error + DetachNetworkEndpoints(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, ...Option) error + ListNetworkEndpoints(context.Context, *meta.Key, *filter.F, ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) } -// NewMockRegions returns a new mock for Regions. -func NewMockRegions(pr ProjectRouter, objs map[meta.Key]*MockRegionsObj) *MockRegions { - mock := &MockRegions{ +// NewMockAlphaRegionNetworkEndpointGroups returns a new mock for RegionNetworkEndpointGroups. +func NewMockAlphaRegionNetworkEndpointGroups(pr ProjectRouter, objs map[meta.Key]*MockRegionNetworkEndpointGroupsObj) *MockAlphaRegionNetworkEndpointGroups { + mock := &MockAlphaRegionNetworkEndpointGroups{ ProjectRouter: pr, - Objects: objs, - GetError: map[meta.Key]error{}, + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, } return mock } -// MockRegions is the mock for Regions. -type MockRegions struct { +// MockAlphaRegionNetworkEndpointGroups is the mock for RegionNetworkEndpointGroups. +type MockAlphaRegionNetworkEndpointGroups struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionsObj + Objects map[meta.Key]*MockRegionNetworkEndpointGroupsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegions, options ...Option) (bool, *computega.Region, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockRegions, options ...Option) (bool, []*computega.Region, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, *computealpha.NetworkEndpointGroup, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, []*computealpha.NetworkEndpointGroup, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, error) + AttachNetworkEndpointsHook func(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, *MockAlphaRegionNetworkEndpointGroups, ...Option) error + DetachNetworkEndpointsHook func(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, *MockAlphaRegionNetworkEndpointGroups, ...Option) error + ListNetworkEndpointsHook func(context.Context, *meta.Key, *filter.F, *MockAlphaRegionNetworkEndpointGroups, ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -29632,10 +30788,10 @@ type MockRegions struct { } // Get returns the object from the mock. -func (m *MockRegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { +func (m *MockAlphaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.NetworkEndpointGroup, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -29647,28 +30803,28 @@ func (m *MockRegions) Get(ctx context.Context, key *meta.Key, options ...Option) defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegions %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionNetworkEndpointGroups %v not found", key), } - klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockRegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -29678,61 +30834,161 @@ func (m *MockRegions) List(ctx context.Context, fl *filter.F, options ...Option) if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegions.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.Region - for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { + var objs []*computealpha.NetworkEndpointGroup + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToGA()) + if !fl.Match(obj.ToAlpha()) { + continue + } + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } +// Insert is a mock for inserting/creating a new object. +func (m *MockAlphaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } + opts := mergeOptions(options) + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.InsertError[*key]; ok { + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + if _, ok := m.Objects[*key]; ok { + err := &googleapi.Error{ + Code: http.StatusConflict, + Message: fmt.Sprintf("MockAlphaRegionNetworkEndpointGroups %v exists", key), + } + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + + obj.Name = key.Name + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "networkEndpointGroups") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "networkEndpointGroups", key) + + m.Objects[*key] = &MockRegionNetworkEndpointGroupsObj{obj} + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = nil", ctx, key, obj) + return nil +} + +// Delete is a mock for deleting the object. +func (m *MockAlphaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + if m.DeleteHook != nil { + if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + return err + } + } + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.DeleteError[*key]; ok { + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + return err + } + if _, ok := m.Objects[*key]; !ok { + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockAlphaRegionNetworkEndpointGroups %v not found", key), + } + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + delete(m.Objects, *key) + klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = nil", ctx, key) + return nil +} + // Obj wraps the object for use in the mock. -func (m *MockRegions) Obj(o *computega.Region) *MockRegionsObj { - return &MockRegionsObj{o} +func (m *MockAlphaRegionNetworkEndpointGroups) Obj(o *computealpha.NetworkEndpointGroup) *MockRegionNetworkEndpointGroupsObj { + return &MockRegionNetworkEndpointGroupsObj{o} } -// GCERegions is a simplifying adapter for the GCE Regions. -type GCERegions struct { +// AttachNetworkEndpoints is a mock for the corresponding method. +func (m *MockAlphaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { + if m.AttachNetworkEndpointsHook != nil { + return m.AttachNetworkEndpointsHook(ctx, key, arg0, m) + } + return nil +} + +// DetachNetworkEndpoints is a mock for the corresponding method. +func (m *MockAlphaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { + if m.DetachNetworkEndpointsHook != nil { + return m.DetachNetworkEndpointsHook(ctx, key, arg0, m) + } + return nil +} + +// ListNetworkEndpoints is a mock for the corresponding method. +func (m *MockAlphaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) { + if m.ListNetworkEndpointsHook != nil { + return m.ListNetworkEndpointsHook(ctx, key, fl, m) + } + return nil, nil +} + +// GCEAlphaRegionNetworkEndpointGroups is a simplifying adapter for the GCE RegionNetworkEndpointGroups. +type GCEAlphaRegionNetworkEndpointGroups struct { s *Service } -// Get the Region named by key. -func (g *GCERegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { +// Get the NetworkEndpointGroup named by key. +func (g *GCEAlphaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.NetworkEndpointGroup, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegions.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegions.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "Regions", + Version: meta.Version("alpha"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCERegions.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegions.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Regions.Get(projectID, key.Name) + call := g.s.Alpha.RegionNetworkEndpointGroups.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegions.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -29740,32 +30996,34 @@ func (g *GCERegions) Get(ctx context.Context, key *meta.Key, options ...Option) return v, err } -// List all Region objects. -func (g *GCERegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { +// List all NetworkEndpointGroup objects. +func (g *GCEAlphaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegions.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "Regions", + Version: meta.Version("alpha"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegions.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.Regions.List(projectID) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionNetworkEndpointGroups.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.Region - f := func(l *computega.RegionList) error { - klog.V(5).Infof("GCERegions.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.NetworkEndpointGroup + f := func(l *computealpha.NetworkEndpointGroupList) error { + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -29773,7 +31031,7 @@ func (g *GCERegions) List(ctx context.Context, fl *filter.F, options ...Option) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -29781,74 +31039,297 @@ func (g *GCERegions) List(ctx context.Context, fl *filter.F, options ...Option) g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegions.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// AlphaRouters is an interface that allows for mocking of Routers. -type AlphaRouters interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) - GetRouterStatus(context.Context, *meta.Key, ...Option) (*computealpha.RouterStatusResponse, error) - Patch(context.Context, *meta.Key, *computealpha.Router, ...Option) error - Preview(context.Context, *meta.Key, *computealpha.Router, ...Option) (*computealpha.RoutersPreviewResponse, error) - TestIamPermissions(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, ...Option) (*computealpha.TestPermissionsResponse, error) -} +// Insert NetworkEndpointGroup with key of value obj. +func (g *GCEAlphaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } -// NewMockAlphaRouters returns a new mock for Routers. -func NewMockAlphaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockAlphaRouters { - mock := &MockAlphaRouters{ - ProjectRouter: pr, + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Insert", + Version: meta.Version("alpha"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - return mock -} + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.Alpha.RegionNetworkEndpointGroups.Insert(projectID, key.Region, obj) + call.Context(ctx) -// MockAlphaRouters is the mock for Routers. -type MockAlphaRouters struct { - Lock sync.Mutex + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) - ProjectRouter ProjectRouter + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) - // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutersObj + if err != nil { + return err + } - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - AggregatedListError *error + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the NetworkEndpointGroup referenced by key. +func (g *GCEAlphaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Delete", + Version: meta.Version("alpha"), + Service: "RegionNetworkEndpointGroups", + Resource: key, + } + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.RegionNetworkEndpointGroups.Delete(projectID, key.Region, key.Name) + + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// AttachNetworkEndpoints is a method on GCEAlphaRegionNetworkEndpointGroups. +func (g *GCEAlphaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "AttachNetworkEndpoints", + Version: meta.Version("alpha"), + Service: "RegionNetworkEndpointGroups", + Resource: key, + } + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.RegionNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// DetachNetworkEndpoints is a method on GCEAlphaRegionNetworkEndpointGroups. +func (g *GCEAlphaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "DetachNetworkEndpoints", + Version: meta.Version("alpha"), + Service: "RegionNetworkEndpointGroups", + Resource: key, + } + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.RegionNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// ListNetworkEndpoints is a method on GCEAlphaRegionNetworkEndpointGroups. +func (g *GCEAlphaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "ListNetworkEndpoints", + Version: meta.Version("alpha"), + Service: "RegionNetworkEndpointGroups", + Resource: key, + } + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Alpha.RegionNetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Region, key.Name) + var all []*computealpha.NetworkEndpointWithHealthStatus + f := func(l *computealpha.NetworkEndpointGroupsListNetworkEndpoints) error { + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v", ctx, key, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, nil, err) + return nil, err + } + + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v", ctx, key, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, asStr, nil) + } + return all, nil +} + +// BetaRegionNetworkEndpointGroups is an interface that allows for mocking of RegionNetworkEndpointGroups. +type BetaRegionNetworkEndpointGroups interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.NetworkEndpointGroup, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + AttachNetworkEndpoints(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, ...Option) error + DetachNetworkEndpoints(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, ...Option) error + ListNetworkEndpoints(context.Context, *meta.Key, *filter.F, ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) +} + +// NewMockBetaRegionNetworkEndpointGroups returns a new mock for RegionNetworkEndpointGroups. +func NewMockBetaRegionNetworkEndpointGroups(pr ProjectRouter, objs map[meta.Key]*MockRegionNetworkEndpointGroupsObj) *MockBetaRegionNetworkEndpointGroups { + mock := &MockBetaRegionNetworkEndpointGroups{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockBetaRegionNetworkEndpointGroups is the mock for RegionNetworkEndpointGroups. +type MockBetaRegionNetworkEndpointGroups struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockRegionNetworkEndpointGroupsObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, *computealpha.Router, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, []*computealpha.Router, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Router, m *MockAlphaRouters, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, error) - AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, map[string][]*computealpha.Router, error) - GetRouterStatusHook func(context.Context, *meta.Key, *MockAlphaRouters, ...Option) (*computealpha.RouterStatusResponse, error) - PatchHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) error - PreviewHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) (*computealpha.RoutersPreviewResponse, error) - TestIamPermissionsHook func(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, *MockAlphaRouters, ...Option) (*computealpha.TestPermissionsResponse, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, *computebeta.NetworkEndpointGroup, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, []*computebeta.NetworkEndpointGroup, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, error) + AttachNetworkEndpointsHook func(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, *MockBetaRegionNetworkEndpointGroups, ...Option) error + DetachNetworkEndpointsHook func(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, *MockBetaRegionNetworkEndpointGroups, ...Option) error + ListNetworkEndpointsHook func(context.Context, *meta.Key, *filter.F, *MockBetaRegionNetworkEndpointGroups, ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -29856,10 +31337,10 @@ type MockAlphaRouters struct { } // Get returns the object from the mock. -func (m *MockAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { +func (m *MockBetaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.NetworkEndpointGroup, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -29871,28 +31352,28 @@ func (m *MockAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Op defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRouters %v not found", key), + Message: fmt.Sprintf("MockBetaRegionNetworkEndpointGroups %v not found", key), } - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { +func (m *MockBetaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -29902,31 +31383,31 @@ func (m *MockAlphaRouters) List(ctx context.Context, region string, fl *filter.F if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.Router + var objs []*computebeta.NetworkEndpointGroup for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToAlpha()) { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { +func (m *MockBetaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -29939,32 +31420,32 @@ func (m *MockAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *compu defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRouters %v exists", key), + Message: fmt.Sprintf("MockBetaRegionNetworkEndpointGroups %v exists", key), } - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "routers") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "routers", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "networkEndpointGroups") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "networkEndpointGroups", key) - m.Objects[*key] = &MockRoutersObj{obj} - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionNetworkEndpointGroupsObj{obj} + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -29976,128 +31457,87 @@ func (m *MockAlphaRouters) Delete(ctx context.Context, key *meta.Key, options .. defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRouters %v not found", key), + Message: fmt.Sprintf("MockBetaRegionNetworkEndpointGroups %v not found", key), } - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = nil", ctx, key) return nil } -// AggregatedList is a mock for AggregatedList. -func (m *MockAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { - if m.AggregatedListHook != nil { - if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.AggregatedListError != nil { - err := *m.AggregatedListError - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - - objs := map[string][]*computealpha.Router{} - for _, obj := range m.Objects { - res, err := ParseResourceURL(obj.ToAlpha().SelfLink) - if err != nil { - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - if !fl.Match(obj.ToAlpha()) { - continue - } - location := aggregatedListKey(res.Key) - objs[location] = append(objs[location], obj.ToAlpha()) - } - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - // Obj wraps the object for use in the mock. -func (m *MockAlphaRouters) Obj(o *computealpha.Router) *MockRoutersObj { - return &MockRoutersObj{o} -} - -// GetRouterStatus is a mock for the corresponding method. -func (m *MockAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { - if m.GetRouterStatusHook != nil { - return m.GetRouterStatusHook(ctx, key, m) - } - return nil, fmt.Errorf("GetRouterStatusHook must be set") +func (m *MockBetaRegionNetworkEndpointGroups) Obj(o *computebeta.NetworkEndpointGroup) *MockRegionNetworkEndpointGroupsObj { + return &MockRegionNetworkEndpointGroupsObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// AttachNetworkEndpoints is a mock for the corresponding method. +func (m *MockBetaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { + if m.AttachNetworkEndpointsHook != nil { + return m.AttachNetworkEndpointsHook(ctx, key, arg0, m) } return nil } -// Preview is a mock for the corresponding method. -func (m *MockAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { - if m.PreviewHook != nil { - return m.PreviewHook(ctx, key, arg0, m) +// DetachNetworkEndpoints is a mock for the corresponding method. +func (m *MockBetaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { + if m.DetachNetworkEndpointsHook != nil { + return m.DetachNetworkEndpointsHook(ctx, key, arg0, m) } - return nil, fmt.Errorf("PreviewHook must be set") + return nil } -// TestIamPermissions is a mock for the corresponding method. -func (m *MockAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { - if m.TestIamPermissionsHook != nil { - return m.TestIamPermissionsHook(ctx, key, arg0, m) +// ListNetworkEndpoints is a mock for the corresponding method. +func (m *MockBetaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) { + if m.ListNetworkEndpointsHook != nil { + return m.ListNetworkEndpointsHook(ctx, key, fl, m) } - return nil, fmt.Errorf("TestIamPermissionsHook must be set") + return nil, nil } -// GCEAlphaRouters is a simplifying adapter for the GCE Routers. -type GCEAlphaRouters struct { +// GCEBetaRegionNetworkEndpointGroups is a simplifying adapter for the GCE RegionNetworkEndpointGroups. +type GCEBetaRegionNetworkEndpointGroups struct { s *Service } -// Get the Router named by key. -func (g *GCEAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { +// Get the NetworkEndpointGroup named by key. +func (g *GCEBetaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.NetworkEndpointGroup, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "Routers", + Version: meta.Version("beta"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.Routers.Get(projectID, key.Region, key.Name) + call := g.s.Beta.RegionNetworkEndpointGroups.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -30105,32 +31545,34 @@ func (g *GCEAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Opt return v, err } -// List all Router objects. -func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { +// List all NetworkEndpointGroup objects. +func (g *GCEBetaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "Routers", + Version: meta.Version("beta"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.Routers.List(projectID, region) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionNetworkEndpointGroups.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.Router - f := func(l *computealpha.RouterList) error { - klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.NetworkEndpointGroup + f := func(l *computebeta.NetworkEndpointGroupList) error { + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -30138,7 +31580,7 @@ func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -30146,221 +31588,182 @@ func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Router with key of value obj. -func (g *GCEAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { +// Insert NetworkEndpointGroup with key of value obj. +func (g *GCEBetaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "Routers", + Version: meta.Version("beta"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.Routers.Insert(projectID, key.Region, obj) + call := g.s.Beta.RegionNetworkEndpointGroups.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Router referenced by key. -func (g *GCEAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the NetworkEndpointGroup referenced by key. +func (g *GCEBetaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "Routers", + Version: meta.Version("beta"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.Routers.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.RegionNetworkEndpointGroups.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } -// AggregatedList lists all resources of the given type across all locations. -func (g *GCEAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { +// AttachNetworkEndpoints is a method on GCEBetaRegionNetworkEndpointGroups. +func (g *GCEBetaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) called", ctx, fl) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + if !key.Valid() { + klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AggregatedList", - Version: meta.Version("alpha"), - Service: "Routers", + Operation: "AttachNetworkEndpoints", + Version: meta.Version("beta"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) - return nil, err + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err } - - call := g.s.Alpha.Routers.AggregatedList(projectID) + call := g.s.Beta.RegionNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Region, key.Name, arg0) call.Context(ctx) - if fl != filter.None { - call.Filter(fl.String()) - } + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - all := map[string][]*computealpha.Router{} - f := func(l *computealpha.RouterAggregatedList) error { - for k, v := range l.Items { - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) - all[k] = append(all[k], v.Routers...) - } - return nil - } - if err := call.Pages(ctx, f); err != nil { + if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) - } - return all, nil -} - -// GetRouterStatus is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "GetRouterStatus", - Version: meta.Version("alpha"), - Service: "Routers", - } - klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err + return err } - call := g.s.Alpha.Routers.GetRouterStatus(projectID, key.Region, key.Name) - call.Context(ctx) - v, err := call.Do() + err = g.s.WaitForCompletion(ctx, op) callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + return err } -// Patch is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { +// DetachNetworkEndpoints is a method on GCEBetaRegionNetworkEndpointGroups. +func (g *GCEBetaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "Routers", + Operation: "DetachNetworkEndpoints", + Version: meta.Version("beta"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.Routers.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.RegionNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -30368,92 +31771,77 @@ func (g *GCEAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *comput callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } -// Preview is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { +// ListNetworkEndpoints is a method on GCEBetaRegionNetworkEndpointGroups. +func (g *GCEBetaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Preview", - Version: meta.Version("alpha"), - Service: "Routers", + Operation: "ListNetworkEndpoints", + Version: meta.Version("beta"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.Routers.Preview(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - v, err := call.Do() - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err -} - -// TestIamPermissions is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "TestIamPermissions", - Version: meta.Version("alpha"), - Service: "Routers", + call := g.s.Beta.RegionNetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Region, key.Name) + var all []*computebeta.NetworkEndpointWithHealthStatus + f := func(l *computebeta.NetworkEndpointGroupsListNetworkEndpoints) error { + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v", ctx, key, l) + all = append(all, l.Items...) + return nil } - klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, nil, err) return nil, err } - call := g.s.Alpha.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - v, err := call.Do() - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) - klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err + if kLogEnabled(4) { + klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v", ctx, key, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, asStr, nil) + } + return all, nil } -// BetaRouters is an interface that allows for mocking of Routers. -type BetaRouters interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error +// RegionNetworkEndpointGroups is an interface that allows for mocking of RegionNetworkEndpointGroups. +type RegionNetworkEndpointGroups interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.NetworkEndpointGroup, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) - GetRouterStatus(context.Context, *meta.Key, ...Option) (*computebeta.RouterStatusResponse, error) - Patch(context.Context, *meta.Key, *computebeta.Router, ...Option) error - Preview(context.Context, *meta.Key, *computebeta.Router, ...Option) (*computebeta.RoutersPreviewResponse, error) - TestIamPermissions(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, ...Option) (*computebeta.TestPermissionsResponse, error) + AttachNetworkEndpoints(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, ...Option) error + DetachNetworkEndpoints(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, ...Option) error + ListNetworkEndpoints(context.Context, *meta.Key, *filter.F, ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) } -// NewMockBetaRouters returns a new mock for Routers. -func NewMockBetaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockBetaRouters { - mock := &MockBetaRouters{ +// NewMockRegionNetworkEndpointGroups returns a new mock for RegionNetworkEndpointGroups. +func NewMockRegionNetworkEndpointGroups(pr ProjectRouter, objs map[meta.Key]*MockRegionNetworkEndpointGroupsObj) *MockRegionNetworkEndpointGroups { + mock := &MockRegionNetworkEndpointGroups{ ProjectRouter: pr, Objects: objs, @@ -30464,36 +31852,33 @@ func NewMockBetaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *Mo return mock } -// MockBetaRouters is the mock for Routers. -type MockBetaRouters struct { +// MockRegionNetworkEndpointGroups is the mock for RegionNetworkEndpointGroups. +type MockRegionNetworkEndpointGroups struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutersObj + Objects map[meta.Key]*MockRegionNetworkEndpointGroupsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - AggregatedListError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, *computebeta.Router, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, []*computebeta.Router, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Router, m *MockBetaRouters, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, error) - AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, map[string][]*computebeta.Router, error) - GetRouterStatusHook func(context.Context, *meta.Key, *MockBetaRouters, ...Option) (*computebeta.RouterStatusResponse, error) - PatchHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) error - PreviewHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) (*computebeta.RoutersPreviewResponse, error) - TestIamPermissionsHook func(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, *MockBetaRouters, ...Option) (*computebeta.TestPermissionsResponse, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, *computega.NetworkEndpointGroup, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, []*computega.NetworkEndpointGroup, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, error) + AttachNetworkEndpointsHook func(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, *MockRegionNetworkEndpointGroups, ...Option) error + DetachNetworkEndpointsHook func(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, *MockRegionNetworkEndpointGroups, ...Option) error + ListNetworkEndpointsHook func(context.Context, *meta.Key, *filter.F, *MockRegionNetworkEndpointGroups, ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -30501,10 +31886,10 @@ type MockBetaRouters struct { } // Get returns the object from the mock. -func (m *MockBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { +func (m *MockRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.NetworkEndpointGroup, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -30516,28 +31901,28 @@ func (m *MockBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRouters %v not found", key), + Message: fmt.Sprintf("MockRegionNetworkEndpointGroups %v not found", key), } - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { +func (m *MockRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -30547,31 +31932,31 @@ func (m *MockBetaRouters) List(ctx context.Context, region string, fl *filter.F, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.Router + var objs []*computega.NetworkEndpointGroup for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToBeta()) { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { +func (m *MockRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -30584,32 +31969,32 @@ func (m *MockBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *comput defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRouters %v exists", key), + Message: fmt.Sprintf("MockRegionNetworkEndpointGroups %v exists", key), } - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "routers") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "routers", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "networkEndpointGroups") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "networkEndpointGroups", key) - m.Objects[*key] = &MockRoutersObj{obj} - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionNetworkEndpointGroupsObj{obj} + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -30621,128 +32006,87 @@ func (m *MockBetaRouters) Delete(ctx context.Context, key *meta.Key, options ... defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRouters %v not found", key), + Message: fmt.Sprintf("MockRegionNetworkEndpointGroups %v not found", key), } - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = nil", ctx, key) return nil } -// AggregatedList is a mock for AggregatedList. -func (m *MockBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { - if m.AggregatedListHook != nil { - if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.AggregatedListError != nil { - err := *m.AggregatedListError - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - - objs := map[string][]*computebeta.Router{} - for _, obj := range m.Objects { - res, err := ParseResourceURL(obj.ToBeta().SelfLink) - if err != nil { - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - if !fl.Match(obj.ToBeta()) { - continue - } - location := aggregatedListKey(res.Key) - objs[location] = append(objs[location], obj.ToBeta()) - } - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - // Obj wraps the object for use in the mock. -func (m *MockBetaRouters) Obj(o *computebeta.Router) *MockRoutersObj { - return &MockRoutersObj{o} -} - -// GetRouterStatus is a mock for the corresponding method. -func (m *MockBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { - if m.GetRouterStatusHook != nil { - return m.GetRouterStatusHook(ctx, key, m) - } - return nil, fmt.Errorf("GetRouterStatusHook must be set") +func (m *MockRegionNetworkEndpointGroups) Obj(o *computega.NetworkEndpointGroup) *MockRegionNetworkEndpointGroupsObj { + return &MockRegionNetworkEndpointGroupsObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// AttachNetworkEndpoints is a mock for the corresponding method. +func (m *MockRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { + if m.AttachNetworkEndpointsHook != nil { + return m.AttachNetworkEndpointsHook(ctx, key, arg0, m) } return nil } -// Preview is a mock for the corresponding method. -func (m *MockBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { - if m.PreviewHook != nil { - return m.PreviewHook(ctx, key, arg0, m) +// DetachNetworkEndpoints is a mock for the corresponding method. +func (m *MockRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { + if m.DetachNetworkEndpointsHook != nil { + return m.DetachNetworkEndpointsHook(ctx, key, arg0, m) } - return nil, fmt.Errorf("PreviewHook must be set") + return nil } -// TestIamPermissions is a mock for the corresponding method. -func (m *MockBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { - if m.TestIamPermissionsHook != nil { - return m.TestIamPermissionsHook(ctx, key, arg0, m) +// ListNetworkEndpoints is a mock for the corresponding method. +func (m *MockRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) { + if m.ListNetworkEndpointsHook != nil { + return m.ListNetworkEndpointsHook(ctx, key, fl, m) } - return nil, fmt.Errorf("TestIamPermissionsHook must be set") + return nil, nil } -// GCEBetaRouters is a simplifying adapter for the GCE Routers. -type GCEBetaRouters struct { +// GCERegionNetworkEndpointGroups is a simplifying adapter for the GCE RegionNetworkEndpointGroups. +type GCERegionNetworkEndpointGroups struct { s *Service } -// Get the Router named by key. -func (g *GCEBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { +// Get the NetworkEndpointGroup named by key. +func (g *GCERegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.NetworkEndpointGroup, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "Routers", + Version: meta.Version("ga"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEBetaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.Routers.Get(projectID, key.Region, key.Name) + call := g.s.GA.RegionNetworkEndpointGroups.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -30750,32 +32094,34 @@ func (g *GCEBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Opti return v, err } -// List all Router objects. -func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { +// List all NetworkEndpointGroup objects. +func (g *GCERegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "Routers", + Version: meta.Version("ga"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.Routers.List(projectID, region) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionNetworkEndpointGroups.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.Router - f := func(l *computebeta.RouterList) error { - klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.NetworkEndpointGroup + f := func(l *computega.NetworkEndpointGroupList) error { + klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -30783,7 +32129,7 @@ func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -30791,221 +32137,182 @@ func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Router with key of value obj. -func (g *GCEBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { +// Insert NetworkEndpointGroup with key of value obj. +func (g *GCERegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "Routers", + Version: meta.Version("ga"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.Routers.Insert(projectID, key.Region, obj) + call := g.s.GA.RegionNetworkEndpointGroups.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Router referenced by key. -func (g *GCEBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the NetworkEndpointGroup referenced by key. +func (g *GCERegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "Routers", + Version: meta.Version("ga"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.Routers.Delete(projectID, key.Region, key.Name) + call := g.s.GA.RegionNetworkEndpointGroups.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } -// AggregatedList lists all resources of the given type across all locations. -func (g *GCEBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { +// AttachNetworkEndpoints is a method on GCERegionNetworkEndpointGroups. +func (g *GCERegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) called", ctx, fl) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + if !key.Valid() { + klog.V(2).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AggregatedList", - Version: meta.Version("beta"), - Service: "Routers", + Operation: "AttachNetworkEndpoints", + Version: meta.Version("ga"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) - return nil, err + klog.V(4).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err } - - call := g.s.Beta.Routers.AggregatedList(projectID) + call := g.s.GA.RegionNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Region, key.Name, arg0) call.Context(ctx) - if fl != filter.None { - call.Filter(fl.String()) - } + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - all := map[string][]*computebeta.Router{} - f := func(l *computebeta.RouterAggregatedList) error { - for k, v := range l.Items { - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) - all[k] = append(all[k], v.Routers...) - } - return nil - } - if err := call.Pages(ctx, f); err != nil { + if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) - } - return all, nil -} - -// GetRouterStatus is a method on GCEBetaRouters. -func (g *GCEBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "GetRouterStatus", - Version: meta.Version("beta"), - Service: "Routers", - } - klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err + return err } - call := g.s.Beta.Routers.GetRouterStatus(projectID, key.Region, key.Name) - call.Context(ctx) - v, err := call.Do() + err = g.s.WaitForCompletion(ctx, op) callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err + klog.V(4).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + return err } -// Patch is a method on GCEBetaRouters. -func (g *GCEBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { +// DetachNetworkEndpoints is a method on GCERegionNetworkEndpointGroups. +func (g *GCERegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "Routers", + Operation: "DetachNetworkEndpoints", + Version: meta.Version("ga"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.Routers.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.GA.RegionNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -31013,130 +32320,149 @@ func (g *GCEBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *compute callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } -// Preview is a method on GCEBetaRouters. -func (g *GCEBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { +// ListNetworkEndpoints is a method on GCERegionNetworkEndpointGroups. +func (g *GCERegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Preview", - Version: meta.Version("beta"), - Service: "Routers", + Operation: "ListNetworkEndpoints", + Version: meta.Version("ga"), + Service: "RegionNetworkEndpointGroups", + Resource: key, } - klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.Routers.Preview(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - v, err := call.Do() + call := g.s.GA.RegionNetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Region, key.Name) + var all []*computega.NetworkEndpointWithHealthStatus + f := func(l *computega.NetworkEndpointGroupsListNetworkEndpoints) error { + klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v", ctx, key, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, nil, err) + return nil, err + } - klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v", ctx, key, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, asStr, nil) + } + return all, nil } -// TestIamPermissions is a method on GCEBetaRouters. -func (g *GCEBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) +// Projects is an interface that allows for mocking of Projects. +type Projects interface { + // ProjectsOps is an interface with additional non-CRUD type methods. + // This interface is expected to be implemented by hand (non-autogenerated). + ProjectsOps +} - if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "TestIamPermissions", - Version: meta.Version("beta"), - Service: "Routers", - } - klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err +// NewMockProjects returns a new mock for Projects. +func NewMockProjects(pr ProjectRouter, objs map[meta.Key]*MockProjectsObj) *MockProjects { + mock := &MockProjects{ + ProjectRouter: pr, + + Objects: objs, } - call := g.s.Beta.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - v, err := call.Do() + return mock +} - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) +// MockProjects is the mock for Projects. +type MockProjects struct { + Lock sync.Mutex - klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockProjectsObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} } -// Routers is an interface that allows for mocking of Routers. -type Routers interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) - GetRouterStatus(context.Context, *meta.Key, ...Option) (*computega.RouterStatusResponse, error) - Patch(context.Context, *meta.Key, *computega.Router, ...Option) error - Preview(context.Context, *meta.Key, *computega.Router, ...Option) (*computega.RoutersPreviewResponse, error) +// Obj wraps the object for use in the mock. +func (m *MockProjects) Obj(o *computega.Project) *MockProjectsObj { + return &MockProjectsObj{o} } -// NewMockRouters returns a new mock for Routers. -func NewMockRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockRouters { - mock := &MockRouters{ +// GCEProjects is a simplifying adapter for the GCE Projects. +type GCEProjects struct { + s *Service +} + +// Regions is an interface that allows for mocking of Regions. +type Regions interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) +} + +// NewMockRegions returns a new mock for Regions. +func NewMockRegions(pr ProjectRouter, objs map[meta.Key]*MockRegionsObj) *MockRegions { + mock := &MockRegions{ ProjectRouter: pr, - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, + Objects: objs, + GetError: map[meta.Key]error{}, } return mock } -// MockRouters is the mock for Routers. -type MockRouters struct { +// MockRegions is the mock for Regions. +type MockRegions struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutersObj + Objects map[meta.Key]*MockRegionsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - AggregatedListError *error + GetError map[meta.Key]error + ListError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, *computega.Router, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRouters, options ...Option) (bool, []*computega.Router, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Router, m *MockRouters, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, error) - AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockRouters, options ...Option) (bool, map[string][]*computega.Router, error) - GetRouterStatusHook func(context.Context, *meta.Key, *MockRouters, ...Option) (*computega.RouterStatusResponse, error) - PatchHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) error - PreviewHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) (*computega.RoutersPreviewResponse, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockRegions, options ...Option) (bool, *computega.Region, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockRegions, options ...Option) (bool, []*computega.Region, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -31144,10 +32470,10 @@ type MockRouters struct { } // Get returns the object from the mock. -func (m *MockRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { +func (m *MockRegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -31159,28 +32485,28 @@ func (m *MockRouters) Get(ctx context.Context, key *meta.Key, options ...Option) defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRouters %v not found", key), + Message: fmt.Sprintf("MockRegions %v not found", key), } - klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { +// List all of the objects in the mock. +func (m *MockRegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -31190,69 +32516,297 @@ func (m *MockRouters) List(ctx context.Context, region string, fl *filter.F, opt if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockRegions.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.Router - for key, obj := range m.Objects { - if key.Region != region { - continue - } + var objs []*computega.Region + for _, obj := range m.Objects { if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } -// Insert is a mock for inserting/creating a new object. -func (m *MockRouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } +// Obj wraps the object for use in the mock. +func (m *MockRegions) Obj(o *computega.Region) *MockRegionsObj { + return &MockRegionsObj{o} +} + +// GCERegions is a simplifying adapter for the GCE Regions. +type GCERegions struct { + s *Service +} + +// Get the Region named by key. +func (g *GCERegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { opts := mergeOptions(options) + klog.V(5).Infof("GCERegions.Get(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) + klog.V(2).Infof("GCERegions.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + return nil, fmt.Errorf("invalid GCE key (%#v)", key) } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") - m.Lock.Lock() - defer m.Lock.Unlock() + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Get", + Version: meta.Version("ga"), + Service: "Regions", + Resource: key, + } - if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("GCERegions.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegions.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.GA.Regions.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) + call.Context(ctx) + v, err := call.Do() + klog.V(4).Infof("GCERegions.Get(%v, %v) = %+v, %v", ctx, key, v, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return v, err +} + +// List all Region objects. +func (g *GCERegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegions.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "List", + Version: meta.Version("ga"), + Service: "Regions", + Resource: key, + } + + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + klog.V(5).Infof("GCERegions.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.Regions.List(projectID) + if fl != filter.None { + call.Filter(fl.String()) + } + + var all []*computega.Region + f := func(l *computega.RegionList) error { + klog.V(5).Infof("GCERegions.List(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCERegions.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// AlphaRouters is an interface that allows for mocking of Routers. +type AlphaRouters interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) + GetRouterStatus(context.Context, *meta.Key, ...Option) (*computealpha.RouterStatusResponse, error) + Patch(context.Context, *meta.Key, *computealpha.Router, ...Option) error + Preview(context.Context, *meta.Key, *computealpha.Router, ...Option) (*computealpha.RoutersPreviewResponse, error) + TestIamPermissions(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, ...Option) (*computealpha.TestPermissionsResponse, error) +} + +// NewMockAlphaRouters returns a new mock for Routers. +func NewMockAlphaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockAlphaRouters { + mock := &MockAlphaRouters{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockAlphaRouters is the mock for Routers. +type MockAlphaRouters struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockRoutersObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + AggregatedListError *error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, *computealpha.Router, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, []*computealpha.Router, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Router, m *MockAlphaRouters, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, error) + AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, map[string][]*computealpha.Router, error) + GetRouterStatusHook func(context.Context, *meta.Key, *MockAlphaRouters, ...Option) (*computealpha.RouterStatusResponse, error) + PatchHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) error + PreviewHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) (*computealpha.RoutersPreviewResponse, error) + TestIamPermissionsHook func(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, *MockAlphaRouters, ...Option) (*computealpha.TestPermissionsResponse, error) + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} +} + +// Get returns the object from the mock. +func (m *MockAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { + if m.GetHook != nil { + if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + return obj, err + } + } + if !key.Valid() { + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.GetError[*key]; ok { + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err + } + if obj, ok := m.Objects[*key]; ok { + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + return typedObj, nil + } + + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockAlphaRouters %v not found", key), + } + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err +} + +// List all of the objects in the mock in the given region. +func (m *MockAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { + if m.ListHook != nil { + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + + return nil, *m.ListError + } + + var objs []*computealpha.Router + for key, obj := range m.Objects { + if key.Region != region { + continue + } + if !fl.Match(obj.ToAlpha()) { + continue + } + objs = append(objs, obj.ToAlpha()) + } + + klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + return objs, nil +} + +// Insert is a mock for inserting/creating a new object. +func (m *MockAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } + opts := mergeOptions(options) + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.InsertError[*key]; ok { + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRouters %v exists", key), + Message: fmt.Sprintf("MockAlphaRouters %v exists", key), } - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routers") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routers", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "routers") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "routers", key) m.Objects[*key] = &MockRoutersObj{obj} - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -31264,28 +32818,28 @@ func (m *MockRouters) Delete(ctx context.Context, key *meta.Key, options ...Opti defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRouters %v not found", key), + Message: fmt.Sprintf("MockAlphaRouters %v not found", key), } - klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRouters.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = nil", ctx, key) return nil } // AggregatedList is a mock for AggregatedList. -func (m *MockRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { +func (m *MockAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { if m.AggregatedListHook != nil { if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -31295,34 +32849,34 @@ func (m *MockRouters) AggregatedList(ctx context.Context, fl *filter.F, options if m.AggregatedListError != nil { err := *m.AggregatedListError - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) return nil, err } - objs := map[string][]*computega.Router{} + objs := map[string][]*computealpha.Router{} for _, obj := range m.Objects { - res, err := ParseResourceURL(obj.ToGA().SelfLink) + res, err := ParseResourceURL(obj.ToAlpha().SelfLink) if err != nil { - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) return nil, err } - if !fl.Match(obj.ToGA()) { + if !fl.Match(obj.ToAlpha()) { continue } location := aggregatedListKey(res.Key) - objs[location] = append(objs[location], obj.ToGA()) + objs[location] = append(objs[location], obj.ToAlpha()) } - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Obj wraps the object for use in the mock. -func (m *MockRouters) Obj(o *computega.Router) *MockRoutersObj { +func (m *MockAlphaRouters) Obj(o *computealpha.Router) *MockRoutersObj { return &MockRoutersObj{o} } // GetRouterStatus is a mock for the corresponding method. -func (m *MockRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { +func (m *MockAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { if m.GetRouterStatusHook != nil { return m.GetRouterStatusHook(ctx, key, m) } @@ -31330,7 +32884,7 @@ func (m *MockRouters) GetRouterStatus(ctx context.Context, key *meta.Key, option } // Patch is a mock for the corresponding method. -func (m *MockRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { +func (m *MockAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } @@ -31338,46 +32892,56 @@ func (m *MockRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega. } // Preview is a mock for the corresponding method. -func (m *MockRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { +func (m *MockAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { if m.PreviewHook != nil { return m.PreviewHook(ctx, key, arg0, m) } return nil, fmt.Errorf("PreviewHook must be set") } -// GCERouters is a simplifying adapter for the GCE Routers. -type GCERouters struct { +// TestIamPermissions is a mock for the corresponding method. +func (m *MockAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { + if m.TestIamPermissionsHook != nil { + return m.TestIamPermissionsHook(ctx, key, arg0, m) + } + return nil, fmt.Errorf("TestIamPermissionsHook must be set") +} + +// GCEAlphaRouters is a simplifying adapter for the GCE Routers. +type GCEAlphaRouters struct { s *Service } // Get the Router named by key. -func (g *GCERouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { +func (g *GCEAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Routers.Get(projectID, key.Region, key.Name) + call := g.s.Alpha.Routers.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -31386,31 +32950,33 @@ func (g *GCERouters) Get(ctx context.Context, key *meta.Key, options ...Option) } // List all Router objects. -func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { +func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.Routers.List(projectID, region) + klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.Routers.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.Router - f := func(l *computega.RouterList) error { - klog.V(5).Infof("GCERouters.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.Router + f := func(l *computealpha.RouterList) error { + klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -31418,7 +32984,7 @@ func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, opti callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -31426,131 +32992,137 @@ func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, opti g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert Router with key of value obj. -func (g *GCERouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { +func (g *GCEAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.Routers.Insert(projectID, key.Region, obj) + call := g.s.Alpha.Routers.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERouters.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the Router referenced by key. -func (g *GCERouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Routers.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.Routers.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } // AggregatedList lists all resources of the given type across all locations. -func (g *GCERouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { +func (g *GCEAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) called", ctx, fl) + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) called", ctx, fl) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "AggregatedList", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: &meta.Key{}, } - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) return nil, err } - call := g.s.GA.Routers.AggregatedList(projectID) + call := g.s.Alpha.Routers.AggregatedList(projectID) call.Context(ctx) if fl != filter.None { call.Filter(fl.String()) } + call.ReturnPartialSuccess(opts.returnPartialSuccess) - all := map[string][]*computega.Router{} - f := func(l *computega.RouterAggregatedList) error { + all := map[string][]*computealpha.Router{} + f := func(l *computealpha.RouterAggregatedList) error { for k, v := range l.Items { - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) all[k] = append(all[k], v.Routers...) } return nil @@ -31559,88 +33131,92 @@ func (g *GCERouters) AggregatedList(ctx context.Context, fl *filter.F, options . callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) return nil, err } callObserverEnd(ctx, ck, nil) g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// GetRouterStatus is a method on GCERouters. -func (g *GCERouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { +// GetRouterStatus is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "GetRouterStatus", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Routers.GetRouterStatus(projectID, key.Region, key.Name) + call := g.s.Alpha.Routers.GetRouterStatus(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) return v, err } -// Patch is a method on GCERouters. -func (g *GCERouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { +// Patch is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Patch", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Routers.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.Routers.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -31648,54 +33224,96 @@ func (g *GCERouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.R callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// Preview is a method on GCERouters. -func (g *GCERouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { +// Preview is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Preview", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Routers.Preview(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.Routers.Preview(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) return v, err } -// Routes is an interface that allows for mocking of Routes. -type Routes interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error +// TestIamPermissions is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "TestIamPermissions", + Version: meta.Version("alpha"), + Service: "Routers", + Resource: key, + } + klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Alpha.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + v, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err +} + +// BetaRouters is an interface that allows for mocking of Routers. +type BetaRouters interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) + GetRouterStatus(context.Context, *meta.Key, ...Option) (*computebeta.RouterStatusResponse, error) + Patch(context.Context, *meta.Key, *computebeta.Router, ...Option) error + Preview(context.Context, *meta.Key, *computebeta.Router, ...Option) (*computebeta.RoutersPreviewResponse, error) + TestIamPermissions(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, ...Option) (*computebeta.TestPermissionsResponse, error) } -// NewMockRoutes returns a new mock for Routes. -func NewMockRoutes(pr ProjectRouter, objs map[meta.Key]*MockRoutesObj) *MockRoutes { - mock := &MockRoutes{ +// NewMockBetaRouters returns a new mock for Routers. +func NewMockBetaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockBetaRouters { + mock := &MockBetaRouters{ ProjectRouter: pr, Objects: objs, @@ -31706,30 +33324,36 @@ func NewMockRoutes(pr ProjectRouter, objs map[meta.Key]*MockRoutesObj) *MockRout return mock } -// MockRoutes is the mock for Routes. -type MockRoutes struct { +// MockBetaRouters is the mock for Routers. +type MockBetaRouters struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutesObj + Objects map[meta.Key]*MockRoutersObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + AggregatedListError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, *computega.Route, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockRoutes, options ...Option) (bool, []*computega.Route, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Route, m *MockRoutes, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, *computebeta.Router, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, []*computebeta.Router, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Router, m *MockBetaRouters, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, error) + AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, map[string][]*computebeta.Router, error) + GetRouterStatusHook func(context.Context, *meta.Key, *MockBetaRouters, ...Option) (*computebeta.RouterStatusResponse, error) + PatchHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) error + PreviewHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) (*computebeta.RoutersPreviewResponse, error) + TestIamPermissionsHook func(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, *MockBetaRouters, ...Option) (*computebeta.TestPermissionsResponse, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -31737,10 +33361,10 @@ type MockRoutes struct { } // Get returns the object from the mock. -func (m *MockRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { +func (m *MockBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -31752,28 +33376,28 @@ func (m *MockRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRoutes %v not found", key), + Message: fmt.Sprintf("MockBetaRouters %v not found", key), } - klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -31783,28 +33407,31 @@ func (m *MockRoutes) List(ctx context.Context, fl *filter.F, options ...Option) if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRoutes.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.Route - for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { + var objs []*computebeta.Router + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToGA()) + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { +func (m *MockBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -31817,32 +33444,32 @@ func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.R defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRoutes %v exists", key), + Message: fmt.Sprintf("MockBetaRouters %v exists", key), } - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routes") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routes", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "routers") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "routers", key) - m.Objects[*key] = &MockRoutesObj{obj} - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRoutersObj{obj} + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -31854,61 +33481,130 @@ func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key, options ...Optio defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRoutes %v not found", key), + Message: fmt.Sprintf("MockBetaRouters %v not found", key), } - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = nil", ctx, key) return nil } +// AggregatedList is a mock for AggregatedList. +func (m *MockBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { + if m.AggregatedListHook != nil { + if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.AggregatedListError != nil { + err := *m.AggregatedListError + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err + } + + objs := map[string][]*computebeta.Router{} + for _, obj := range m.Objects { + res, err := ParseResourceURL(obj.ToBeta().SelfLink) + if err != nil { + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err + } + if !fl.Match(obj.ToBeta()) { + continue + } + location := aggregatedListKey(res.Key) + objs[location] = append(objs[location], obj.ToBeta()) + } + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + // Obj wraps the object for use in the mock. -func (m *MockRoutes) Obj(o *computega.Route) *MockRoutesObj { - return &MockRoutesObj{o} +func (m *MockBetaRouters) Obj(o *computebeta.Router) *MockRoutersObj { + return &MockRoutersObj{o} } -// GCERoutes is a simplifying adapter for the GCE Routes. -type GCERoutes struct { +// GetRouterStatus is a mock for the corresponding method. +func (m *MockBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { + if m.GetRouterStatusHook != nil { + return m.GetRouterStatusHook(ctx, key, m) + } + return nil, fmt.Errorf("GetRouterStatusHook must be set") +} + +// Patch is a mock for the corresponding method. +func (m *MockBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// Preview is a mock for the corresponding method. +func (m *MockBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { + if m.PreviewHook != nil { + return m.PreviewHook(ctx, key, arg0, m) + } + return nil, fmt.Errorf("PreviewHook must be set") +} + +// TestIamPermissions is a mock for the corresponding method. +func (m *MockBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { + if m.TestIamPermissionsHook != nil { + return m.TestIamPermissionsHook(ctx, key, arg0, m) + } + return nil, fmt.Errorf("TestIamPermissionsHook must be set") +} + +// GCEBetaRouters is a simplifying adapter for the GCE Routers. +type GCEBetaRouters struct { s *Service } -// Get the Route named by key. -func (g *GCERoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { +// Get the Router named by key. +func (g *GCEBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRouters.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERoutes.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "Routes", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERoutes.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Routes.Get(projectID, key.Name) + call := g.s.Beta.Routers.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -31916,32 +33612,34 @@ func (g *GCERoutes) Get(ctx context.Context, key *meta.Key, options ...Option) ( return v, err } -// List all Route objects. -func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { +// List all Router objects. +func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "Routes", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.Routes.List(projectID) + klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.Routers.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.Route - f := func(l *computega.RouteList) error { - klog.V(5).Infof("GCERoutes.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.Router + f := func(l *computebeta.RouterList) error { + klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -31949,7 +33647,7 @@ func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ( callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -31957,117 +33655,327 @@ func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ( g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Route with key of value obj. -func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { +// Insert Router with key of value obj. +func (g *GCEBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERoutes.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "Routes", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERoutes.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.Routes.Insert(projectID, obj) + call := g.s.Beta.Routers.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERoutes.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Route referenced by key. -func (g *GCERoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Router referenced by key. +func (g *GCEBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERoutes.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "Routes", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCERoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERoutes.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Routes.Delete(projectID, key.Name) + call := g.s.Beta.Routers.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaSecurityPolicies is an interface that allows for mocking of SecurityPolicies. -type BetaSecurityPolicies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error +// AggregatedList lists all resources of the given type across all locations. +func (g *GCEBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) called", ctx, fl) + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "AggregatedList", + Version: meta.Version("beta"), + Service: "Routers", + Resource: &meta.Key{}, + } + + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) + return nil, err + } + + call := g.s.Beta.Routers.AggregatedList(projectID) + call.Context(ctx) + if fl != filter.None { + call.Filter(fl.String()) + } + call.ReturnPartialSuccess(opts.returnPartialSuccess) + + all := map[string][]*computebeta.Router{} + f := func(l *computebeta.RouterAggregatedList) error { + for k, v := range l.Items { + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) + all[k] = append(all[k], v.Routers...) + } + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) + } + return all, nil +} + +// GetRouterStatus is a method on GCEBetaRouters. +func (g *GCEBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "GetRouterStatus", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, + } + klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Beta.Routers.GetRouterStatus(projectID, key.Region, key.Name) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + v, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err +} + +// Patch is a method on GCEBetaRouters. +func (g *GCEBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, + } + klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.Routers.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// Preview is a method on GCEBetaRouters. +func (g *GCEBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Preview", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, + } + klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Beta.Routers.Preview(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + v, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err +} + +// TestIamPermissions is a method on GCEBetaRouters. +func (g *GCEBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "TestIamPermissions", + Version: meta.Version("beta"), + Service: "Routers", + Resource: key, + } + klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Beta.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + v, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err +} + +// Routers is an interface that allows for mocking of Routers. +type Routers interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AddRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error - GetRule(context.Context, *meta.Key, ...Option) (*computebeta.SecurityPolicyRule, error) - Patch(context.Context, *meta.Key, *computebeta.SecurityPolicy, ...Option) error - PatchRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error - RemoveRule(context.Context, *meta.Key, ...Option) error + AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) + GetRouterStatus(context.Context, *meta.Key, ...Option) (*computega.RouterStatusResponse, error) + Patch(context.Context, *meta.Key, *computega.Router, ...Option) error + Preview(context.Context, *meta.Key, *computega.Router, ...Option) (*computega.RoutersPreviewResponse, error) } -// NewMockBetaSecurityPolicies returns a new mock for SecurityPolicies. -func NewMockBetaSecurityPolicies(pr ProjectRouter, objs map[meta.Key]*MockSecurityPoliciesObj) *MockBetaSecurityPolicies { - mock := &MockBetaSecurityPolicies{ +// NewMockRouters returns a new mock for Routers. +func NewMockRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockRouters { + mock := &MockRouters{ ProjectRouter: pr, Objects: objs, @@ -32078,35 +33986,35 @@ func NewMockBetaSecurityPolicies(pr ProjectRouter, objs map[meta.Key]*MockSecuri return mock } -// MockBetaSecurityPolicies is the mock for SecurityPolicies. -type MockBetaSecurityPolicies struct { +// MockRouters is the mock for Routers. +type MockRouters struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSecurityPoliciesObj + Objects map[meta.Key]*MockRoutersObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + AggregatedListError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, *computebeta.SecurityPolicy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSecurityPolicies, options ...Option) (bool, []*computebeta.SecurityPolicy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, m *MockBetaSecurityPolicies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, error) - AddRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error - GetRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) (*computebeta.SecurityPolicyRule, error) - PatchHook func(context.Context, *meta.Key, *computebeta.SecurityPolicy, *MockBetaSecurityPolicies, ...Option) error - PatchRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error - RemoveRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, *computega.Router, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRouters, options ...Option) (bool, []*computega.Router, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Router, m *MockRouters, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, error) + AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockRouters, options ...Option) (bool, map[string][]*computega.Router, error) + GetRouterStatusHook func(context.Context, *meta.Key, *MockRouters, ...Option) (*computega.RouterStatusResponse, error) + PatchHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) error + PreviewHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) (*computega.RoutersPreviewResponse, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -32114,10 +34022,10 @@ type MockBetaSecurityPolicies struct { } // Get returns the object from the mock. -func (m *MockBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { +func (m *MockRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -32129,28 +34037,28 @@ func (m *MockBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), + Message: fmt.Sprintf("MockRouters %v not found", key), } - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { +// List all of the objects in the mock in the given region. +func (m *MockRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -32160,28 +34068,31 @@ func (m *MockBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, optio if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.SecurityPolicy - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { + var objs []*computega.Router + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToBeta()) + if !fl.Match(obj.ToGA()) { + continue + } + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { +func (m *MockRouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -32194,32 +34105,32 @@ func (m *MockBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, ob defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaSecurityPolicies %v exists", key), + Message: fmt.Sprintf("MockRouters %v exists", key), } - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "securityPolicies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "securityPolicies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routers") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routers", key) - m.Objects[*key] = &MockSecurityPoliciesObj{obj} - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRoutersObj{obj} + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -32231,101 +34142,122 @@ func (m *MockBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), + Message: fmt.Sprintf("MockRouters %v not found", key), } - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = nil", ctx, key) return nil } -// Obj wraps the object for use in the mock. -func (m *MockBetaSecurityPolicies) Obj(o *computebeta.SecurityPolicy) *MockSecurityPoliciesObj { - return &MockSecurityPoliciesObj{o} -} +// AggregatedList is a mock for AggregatedList. +func (m *MockRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { + if m.AggregatedListHook != nil { + if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } -// AddRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { - if m.AddRuleHook != nil { - return m.AddRuleHook(ctx, key, arg0, m) + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.AggregatedListError != nil { + err := *m.AggregatedListError + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err } - return nil + + objs := map[string][]*computega.Router{} + for _, obj := range m.Objects { + res, err := ParseResourceURL(obj.ToGA().SelfLink) + if err != nil { + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err + } + if !fl.Match(obj.ToGA()) { + continue + } + location := aggregatedListKey(res.Key) + objs[location] = append(objs[location], obj.ToGA()) + } + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil } -// GetRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { - if m.GetRuleHook != nil { - return m.GetRuleHook(ctx, key, m) +// Obj wraps the object for use in the mock. +func (m *MockRouters) Obj(o *computega.Router) *MockRoutersObj { + return &MockRoutersObj{o} +} + +// GetRouterStatus is a mock for the corresponding method. +func (m *MockRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { + if m.GetRouterStatusHook != nil { + return m.GetRouterStatusHook(ctx, key, m) } - return nil, fmt.Errorf("GetRuleHook must be set") + return nil, fmt.Errorf("GetRouterStatusHook must be set") } // Patch is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { +func (m *MockRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } return nil } -// PatchRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { - if m.PatchRuleHook != nil { - return m.PatchRuleHook(ctx, key, arg0, m) - } - return nil -} - -// RemoveRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { - if m.RemoveRuleHook != nil { - return m.RemoveRuleHook(ctx, key, m) +// Preview is a mock for the corresponding method. +func (m *MockRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { + if m.PreviewHook != nil { + return m.PreviewHook(ctx, key, arg0, m) } - return nil + return nil, fmt.Errorf("PreviewHook must be set") } -// GCEBetaSecurityPolicies is a simplifying adapter for the GCE SecurityPolicies. -type GCEBetaSecurityPolicies struct { +// GCERouters is a simplifying adapter for the GCE Routers. +type GCERouters struct { s *Service } -// Get the SecurityPolicy named by key. -func (g *GCEBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { +// Get the Router named by key. +func (g *GCERouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Version: meta.Version("ga"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.SecurityPolicies.Get(projectID, key.Name) + call := g.s.GA.Routers.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -32333,32 +34265,34 @@ func (g *GCEBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, option return v, err } -// List all SecurityPolicy objects. -func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { +// List all Router objects. +func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + klog.V(5).Infof("GCERouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Version: meta.Version("ga"), + Service: "Routers", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.SecurityPolicies.List(projectID) + klog.V(5).Infof("GCERouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.Routers.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.SecurityPolicy - f := func(l *computebeta.SecurityPolicyList) error { - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.Router + f := func(l *computega.RouterList) error { + klog.V(5).Infof("GCERouters.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -32366,7 +34300,7 @@ func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, option callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -32374,249 +34308,231 @@ func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, option g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert SecurityPolicy with key of value obj. -func (g *GCEBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { +// Insert Router with key of value obj. +func (g *GCERouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Version: meta.Version("ga"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.SecurityPolicies.Insert(projectID, obj) + call := g.s.GA.Routers.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERouters.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the SecurityPolicy referenced by key. -func (g *GCEBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Router referenced by key. +func (g *GCERouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Version: meta.Version("ga"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.SecurityPolicies.Delete(projectID, key.Name) + call := g.s.GA.Routers.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) return err } -// AddRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { +// AggregatedList lists all resources of the given type across all locations. +func (g *GCERouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) called", ctx, fl) - if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AddRule", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Operation: "AggregatedList", + Version: meta.Version("ga"), + Service: "Routers", + Resource: &meta.Key{}, } - klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) + return nil, err } - call := g.s.Beta.SecurityPolicies.AddRule(projectID, key.Name, arg0) + + call := g.s.GA.Routers.AggregatedList(projectID) call.Context(ctx) - op, err := call.Do() + if fl != filter.None { + call.Filter(fl.String()) + } + call.ReturnPartialSuccess(opts.returnPartialSuccess) - if err != nil { + all := map[string][]*computega.Router{} + f := func(l *computega.RouterAggregatedList) error { + for k, v := range l.Items { + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) + all[k] = append(all[k], v.Routers...) + } + return nil + } + if err := call.Pages(ctx, f); err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) - return err + klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) + return nil, err } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) - return err + if kLogEnabled(4) { + klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) + } + return all, nil } -// GetRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { +// GetRouterStatus is a method on GCERouters. +func (g *GCERouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "GetRule", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Operation: "GetRouterStatus", + Version: meta.Version("ga"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.SecurityPolicies.GetRule(projectID, key.Name) + call := g.s.GA.Routers.GetRouterStatus(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) return v, err } -// Patch is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { +// Patch is a method on GCERouters. +func (g *GCERouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Patch", - Version: meta.Version("beta"), - Service: "SecurityPolicies", - } - klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.SecurityPolicies.Patch(projectID, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// PatchRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "PatchRule", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Version: meta.Version("ga"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.SecurityPolicies.PatchRule(projectID, key.Name, arg0) + call := g.s.GA.Routers.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -32624,64 +34540,56 @@ func (g *GCEBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// RemoveRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { +// Preview is a method on GCERouters. +func (g *GCERouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) + klog.V(2).Infof("GCERouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "RemoveRule", - Version: meta.Version("beta"), - Service: "SecurityPolicies", + Operation: "Preview", + Version: meta.Version("ga"), + Service: "Routers", + Resource: key, } - klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err + klog.V(4).Infof("GCERouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err } - call := g.s.Beta.SecurityPolicies.RemoveRule(projectID, key.Name) + call := g.s.GA.Routers.Preview(projectID, key.Region, key.Name, arg0) call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) - return err - } + handleHeaderOptions(&opts, call.Header()) + v, err := call.Do() - err = g.s.WaitForCompletion(ctx, op) callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX + g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) - return err + klog.V(4).Infof("GCERouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err } -// ServiceAttachments is an interface that allows for mocking of ServiceAttachments. -type ServiceAttachments interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error +// Routes is an interface that allows for mocking of Routes. +type Routes interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computega.ServiceAttachment, ...Option) error } -// NewMockServiceAttachments returns a new mock for ServiceAttachments. -func NewMockServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockServiceAttachments { - mock := &MockServiceAttachments{ +// NewMockRoutes returns a new mock for Routes. +func NewMockRoutes(pr ProjectRouter, objs map[meta.Key]*MockRoutesObj) *MockRoutes { + mock := &MockRoutes{ ProjectRouter: pr, Objects: objs, @@ -32692,14 +34600,14 @@ func NewMockServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceA return mock } -// MockServiceAttachments is the mock for ServiceAttachments. -type MockServiceAttachments struct { +// MockRoutes is the mock for Routes. +type MockRoutes struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockServiceAttachmentsObj + Objects map[meta.Key]*MockRoutesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -32712,11 +34620,10 @@ type MockServiceAttachments struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, *computega.ServiceAttachment, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockServiceAttachments, options ...Option) (bool, []*computega.ServiceAttachment, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, m *MockServiceAttachments, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computega.ServiceAttachment, *MockServiceAttachments, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, *computega.Route, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockRoutes, options ...Option) (bool, []*computega.Route, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Route, m *MockRoutes, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -32724,10 +34631,10 @@ type MockServiceAttachments struct { } // Get returns the object from the mock. -func (m *MockServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { +func (m *MockRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -32739,28 +34646,28 @@ func (m *MockServiceAttachments) Get(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockRoutes %v not found", key), } - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { +// List all of the objects in the mock. +func (m *MockRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -32770,31 +34677,28 @@ func (m *MockServiceAttachments) List(ctx context.Context, region string, fl *fi if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockRoutes.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.ServiceAttachment - for key, obj := range m.Objects { - if key.Region != region { - continue - } + var objs []*computega.Route + for _, obj := range m.Objects { if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { +func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -32807,32 +34711,32 @@ func (m *MockServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockServiceAttachments %v exists", key), + Message: fmt.Sprintf("MockRoutes %v exists", key), } - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "serviceAttachments") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "serviceAttachments", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routes") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routes", key) - m.Objects[*key] = &MockServiceAttachmentsObj{obj} - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRoutesObj{obj} + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -32844,69 +34748,63 @@ func (m *MockServiceAttachments) Delete(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockRoutes %v not found", key), } - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockServiceAttachments) Obj(o *computega.ServiceAttachment) *MockServiceAttachmentsObj { - return &MockServiceAttachmentsObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil +func (m *MockRoutes) Obj(o *computega.Route) *MockRoutesObj { + return &MockRoutesObj{o} } -// GCEServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. -type GCEServiceAttachments struct { +// GCERoutes is a simplifying adapter for the GCE Routes. +type GCERoutes struct { s *Service } -// Get the ServiceAttachment named by key. -func (g *GCEServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { +// Get the Route named by key. +func (g *GCERoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERoutes.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERoutes.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "ServiceAttachments", + Service: "Routes", + Resource: key, } - klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.ServiceAttachments.Get(projectID, key.Region, key.Name) + call := g.s.GA.Routes.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -32914,32 +34812,34 @@ func (g *GCEServiceAttachments) Get(ctx context.Context, key *meta.Key, options return v, err } -// List all ServiceAttachment objects. -func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { +// List all Route objects. +func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + klog.V(5).Infof("GCERoutes.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "ServiceAttachments", + Service: "Routes", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.ServiceAttachments.List(projectID, region) + klog.V(5).Infof("GCERoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.Routes.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.ServiceAttachment - f := func(l *computega.ServiceAttachmentList) error { - klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.Route + f := func(l *computega.RouteList) error { + klog.V(5).Infof("GCERoutes.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -32947,7 +34847,7 @@ func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *fil callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -32955,155 +34855,121 @@ func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *fil g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert ServiceAttachment with key of value obj. -func (g *GCEServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { +// Insert Route with key of value obj. +func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERoutes.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERoutes.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "ServiceAttachments", + Service: "Routes", + Resource: key, } - klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERoutes.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.ServiceAttachments.Insert(projectID, key.Region, obj) + call := g.s.GA.Routes.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERoutes.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the ServiceAttachment referenced by key. -func (g *GCEServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Route referenced by key. +func (g *GCERoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERoutes.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERoutes.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "ServiceAttachments", + Service: "Routes", + Resource: key, } - klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.ServiceAttachments.Delete(projectID, key.Region, key.Name) + call := g.s.GA.Routes.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// Patch is a method on GCEServiceAttachments. -func (g *GCEServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("ga"), - Service: "ServiceAttachments", - } - klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaServiceAttachments is an interface that allows for mocking of ServiceAttachments. -type BetaServiceAttachments interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error +// BetaSecurityPolicies is an interface that allows for mocking of SecurityPolicies. +type BetaSecurityPolicies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computebeta.ServiceAttachment, ...Option) error + AddRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error + GetRule(context.Context, *meta.Key, ...Option) (*computebeta.SecurityPolicyRule, error) + Patch(context.Context, *meta.Key, *computebeta.SecurityPolicy, ...Option) error + PatchRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error + RemoveRule(context.Context, *meta.Key, ...Option) error } -// NewMockBetaServiceAttachments returns a new mock for ServiceAttachments. -func NewMockBetaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockBetaServiceAttachments { - mock := &MockBetaServiceAttachments{ +// NewMockBetaSecurityPolicies returns a new mock for SecurityPolicies. +func NewMockBetaSecurityPolicies(pr ProjectRouter, objs map[meta.Key]*MockSecurityPoliciesObj) *MockBetaSecurityPolicies { + mock := &MockBetaSecurityPolicies{ ProjectRouter: pr, Objects: objs, @@ -33114,14 +34980,14 @@ func NewMockBetaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServ return mock } -// MockBetaServiceAttachments is the mock for ServiceAttachments. -type MockBetaServiceAttachments struct { +// MockBetaSecurityPolicies is the mock for SecurityPolicies. +type MockBetaSecurityPolicies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockServiceAttachmentsObj + Objects map[meta.Key]*MockSecurityPoliciesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -33134,11 +35000,15 @@ type MockBetaServiceAttachments struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, *computebeta.ServiceAttachment, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaServiceAttachments, options ...Option) (bool, []*computebeta.ServiceAttachment, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, m *MockBetaServiceAttachments, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computebeta.ServiceAttachment, *MockBetaServiceAttachments, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, *computebeta.SecurityPolicy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSecurityPolicies, options ...Option) (bool, []*computebeta.SecurityPolicy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, m *MockBetaSecurityPolicies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, error) + AddRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error + GetRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) (*computebeta.SecurityPolicyRule, error) + PatchHook func(context.Context, *meta.Key, *computebeta.SecurityPolicy, *MockBetaSecurityPolicies, ...Option) error + PatchRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error + RemoveRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -33146,10 +35016,10 @@ type MockBetaServiceAttachments struct { } // Get returns the object from the mock. -func (m *MockBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { +func (m *MockBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -33161,28 +35031,28 @@ func (m *MockBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), } - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { +// List all of the objects in the mock. +func (m *MockBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -33192,31 +35062,28 @@ func (m *MockBetaServiceAttachments) List(ctx context.Context, region string, fl if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.ServiceAttachment - for key, obj := range m.Objects { - if key.Region != region { - continue - } + var objs []*computebeta.SecurityPolicy + for _, obj := range m.Objects { if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { +func (m *MockBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -33229,32 +35096,32 @@ func (m *MockBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaServiceAttachments %v exists", key), + Message: fmt.Sprintf("MockBetaSecurityPolicies %v exists", key), } - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "serviceAttachments") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "serviceAttachments", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "securityPolicies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "securityPolicies", key) - m.Objects[*key] = &MockServiceAttachmentsObj{obj} - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSecurityPoliciesObj{obj} + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -33266,69 +35133,103 @@ func (m *MockBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), } - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaServiceAttachments) Obj(o *computebeta.ServiceAttachment) *MockServiceAttachmentsObj { - return &MockServiceAttachmentsObj{o} +func (m *MockBetaSecurityPolicies) Obj(o *computebeta.SecurityPolicy) *MockSecurityPoliciesObj { + return &MockSecurityPoliciesObj{o} +} + +// AddRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { + if m.AddRuleHook != nil { + return m.AddRuleHook(ctx, key, arg0, m) + } + return nil +} + +// GetRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { + if m.GetRuleHook != nil { + return m.GetRuleHook(ctx, key, m) + } + return nil, fmt.Errorf("GetRuleHook must be set") } // Patch is a mock for the corresponding method. -func (m *MockBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { +func (m *MockBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCEBetaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. -type GCEBetaServiceAttachments struct { +// PatchRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { + if m.PatchRuleHook != nil { + return m.PatchRuleHook(ctx, key, arg0, m) + } + return nil +} + +// RemoveRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { + if m.RemoveRuleHook != nil { + return m.RemoveRuleHook(ctx, key, m) + } + return nil +} + +// GCEBetaSecurityPolicies is a simplifying adapter for the GCE SecurityPolicies. +type GCEBetaSecurityPolicies struct { s *Service } -// Get the ServiceAttachment named by key. -func (g *GCEBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { +// Get the SecurityPolicy named by key. +func (g *GCEBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "ServiceAttachments", + Service: "SecurityPolicies", + Resource: key, } - klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.ServiceAttachments.Get(projectID, key.Region, key.Name) + call := g.s.Beta.SecurityPolicies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -33336,32 +35237,34 @@ func (g *GCEBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, opti return v, err } -// List all ServiceAttachment objects. -func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { +// List all SecurityPolicy objects. +func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "ServiceAttachments", + Service: "SecurityPolicies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.ServiceAttachments.List(projectID, region) + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.SecurityPolicies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.ServiceAttachment - f := func(l *computebeta.ServiceAttachmentList) error { - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.SecurityPolicy + f := func(l *computebeta.SecurityPolicyList) error { + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -33369,7 +35272,7 @@ func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -33377,132 +35280,138 @@ func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert ServiceAttachment with key of value obj. -func (g *GCEBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { +// Insert SecurityPolicy with key of value obj. +func (g *GCEBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "ServiceAttachments", + Service: "SecurityPolicies", + Resource: key, } - klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.ServiceAttachments.Insert(projectID, key.Region, obj) + call := g.s.Beta.SecurityPolicies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the ServiceAttachment referenced by key. -func (g *GCEBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the SecurityPolicy referenced by key. +func (g *GCEBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "ServiceAttachments", + Service: "SecurityPolicies", + Resource: key, } - klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.ServiceAttachments.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.SecurityPolicies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } -// Patch is a method on GCEBetaServiceAttachments. -func (g *GCEBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { +// AddRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", + Operation: "AddRule", Version: meta.Version("beta"), - Service: "ServiceAttachments", + Service: "SecurityPolicies", + Resource: key, } - klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.SecurityPolicies.AddRule(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -33510,68 +35419,235 @@ func (g *GCEBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, ar callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaServiceAttachments is an interface that allows for mocking of ServiceAttachments. -type AlphaServiceAttachments interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computealpha.ServiceAttachment, ...Option) error -} - -// NewMockAlphaServiceAttachments returns a new mock for ServiceAttachments. -func NewMockAlphaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockAlphaServiceAttachments { - mock := &MockAlphaServiceAttachments{ - ProjectRouter: pr, +// GetRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): called", ctx, key, opts) - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, + if !key.Valid() { + klog.V(2).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - return mock + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "GetRule", + Version: meta.Version("beta"), + Service: "SecurityPolicies", + Resource: key, + } + klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Beta.SecurityPolicies.GetRule(projectID, key.Name) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + v, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err } -// MockAlphaServiceAttachments is the mock for ServiceAttachments. -type MockAlphaServiceAttachments struct { - Lock sync.Mutex +// Patch is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): called", ctx, key, opts) - ProjectRouter ProjectRouter + if !key.Valid() { + klog.V(2).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "SecurityPolicies", + Resource: key, + } + klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.SecurityPolicies.Patch(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) - // Objects maintained by the mock. - Objects map[meta.Key]*MockServiceAttachmentsObj + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + return err + } - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, *computealpha.ServiceAttachment, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaServiceAttachments, options ...Option) (bool, []*computealpha.ServiceAttachment, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, m *MockAlphaServiceAttachments, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computealpha.ServiceAttachment, *MockAlphaServiceAttachments, ...Option) error + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} + klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// PatchRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "PatchRule", + Version: meta.Version("beta"), + Service: "SecurityPolicies", + Resource: key, + } + klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.SecurityPolicies.PatchRule(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// RemoveRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "RemoveRule", + Version: meta.Version("beta"), + Service: "SecurityPolicies", + Resource: key, + } + klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.SecurityPolicies.RemoveRule(projectID, key.Name) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// ServiceAttachments is an interface that allows for mocking of ServiceAttachments. +type ServiceAttachments interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computega.ServiceAttachment, ...Option) error +} + +// NewMockServiceAttachments returns a new mock for ServiceAttachments. +func NewMockServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockServiceAttachments { + mock := &MockServiceAttachments{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockServiceAttachments is the mock for ServiceAttachments. +type MockServiceAttachments struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockServiceAttachmentsObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, *computega.ServiceAttachment, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockServiceAttachments, options ...Option) (bool, []*computega.ServiceAttachment, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, m *MockServiceAttachments, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computega.ServiceAttachment, *MockServiceAttachments, ...Option) error + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} } // Get returns the object from the mock. -func (m *MockAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { +func (m *MockServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -33583,28 +35659,28 @@ func (m *MockAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockServiceAttachments %v not found", key), } - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { +func (m *MockServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -33614,31 +35690,31 @@ func (m *MockAlphaServiceAttachments) List(ctx context.Context, region string, f if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.ServiceAttachment + var objs []*computega.ServiceAttachment for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToAlpha()) { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { +func (m *MockServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -33651,32 +35727,32 @@ func (m *MockAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaServiceAttachments %v exists", key), + Message: fmt.Sprintf("MockServiceAttachments %v exists", key), } - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "serviceAttachments") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "serviceAttachments", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "serviceAttachments") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "serviceAttachments", key) m.Objects[*key] = &MockServiceAttachmentsObj{obj} - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -33688,69 +35764,71 @@ func (m *MockAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockServiceAttachments %v not found", key), } - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaServiceAttachments) Obj(o *computealpha.ServiceAttachment) *MockServiceAttachmentsObj { +func (m *MockServiceAttachments) Obj(o *computega.ServiceAttachment) *MockServiceAttachmentsObj { return &MockServiceAttachmentsObj{o} } // Patch is a mock for the corresponding method. -func (m *MockAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { +func (m *MockServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCEAlphaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. -type GCEAlphaServiceAttachments struct { +// GCEServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. +type GCEServiceAttachments struct { s *Service } // Get the ServiceAttachment named by key. -func (g *GCEAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { +func (g *GCEServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.ServiceAttachments.Get(projectID, key.Region, key.Name) + call := g.s.GA.ServiceAttachments.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -33759,31 +35837,33 @@ func (g *GCEAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, opt } // List all ServiceAttachment objects. -func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { +func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "ServiceAttachments", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.ServiceAttachments.List(projectID, region) + klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.ServiceAttachments.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.ServiceAttachment - f := func(l *computealpha.ServiceAttachmentList) error { - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.ServiceAttachment + f := func(l *computega.ServiceAttachmentList) error { + klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -33791,7 +35871,7 @@ func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -33799,132 +35879,138 @@ func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert ServiceAttachment with key of value obj. -func (g *GCEAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { +func (g *GCEServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.ServiceAttachments.Insert(projectID, key.Region, obj) + call := g.s.GA.ServiceAttachments.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the ServiceAttachment referenced by key. -func (g *GCEAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.ServiceAttachments.Delete(projectID, key.Region, key.Name) + call := g.s.GA.ServiceAttachments.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } -// Patch is a method on GCEAlphaServiceAttachments. -func (g *GCEAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { +// Patch is a method on GCEServiceAttachments. +func (g *GCEServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Patch", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.GA.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -33932,21 +36018,22 @@ func (g *GCEAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, a callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// SslCertificates is an interface that allows for mocking of SslCertificates. -type SslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error +// BetaServiceAttachments is an interface that allows for mocking of ServiceAttachments. +type BetaServiceAttachments interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computebeta.ServiceAttachment, ...Option) error } -// NewMockSslCertificates returns a new mock for SslCertificates. -func NewMockSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockSslCertificates { - mock := &MockSslCertificates{ +// NewMockBetaServiceAttachments returns a new mock for ServiceAttachments. +func NewMockBetaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockBetaServiceAttachments { + mock := &MockBetaServiceAttachments{ ProjectRouter: pr, Objects: objs, @@ -33957,14 +36044,14 @@ func NewMockSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertific return mock } -// MockSslCertificates is the mock for SslCertificates. -type MockSslCertificates struct { +// MockBetaServiceAttachments is the mock for ServiceAttachments. +type MockBetaServiceAttachments struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSslCertificatesObj + Objects map[meta.Key]*MockServiceAttachmentsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -33977,10 +36064,11 @@ type MockSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, *computebeta.ServiceAttachment, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaServiceAttachments, options ...Option) (bool, []*computebeta.ServiceAttachment, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, m *MockBetaServiceAttachments, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computebeta.ServiceAttachment, *MockBetaServiceAttachments, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -33988,10 +36076,10 @@ type MockSslCertificates struct { } // Get returns the object from the mock. -func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +func (m *MockBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -34003,28 +36091,28 @@ func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key, options .. defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslCertificates %v not found", key), + Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -34034,28 +36122,31 @@ func (m *MockSslCertificates) List(ctx context.Context, fl *filter.F, options .. if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.SslCertificate - for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { + var objs []*computebeta.ServiceAttachment + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToGA()) + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { +func (m *MockBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -34068,32 +36159,32 @@ func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *co defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockSslCertificates %v exists", key), + Message: fmt.Sprintf("MockBetaServiceAttachments %v exists", key), } - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "serviceAttachments") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "serviceAttachments", key) - m.Objects[*key] = &MockSslCertificatesObj{obj} - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockServiceAttachmentsObj{obj} + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -34105,61 +36196,71 @@ func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslCertificates %v not found", key), + Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockSslCertificates) Obj(o *computega.SslCertificate) *MockSslCertificatesObj { - return &MockSslCertificatesObj{o} +func (m *MockBetaServiceAttachments) Obj(o *computebeta.ServiceAttachment) *MockServiceAttachmentsObj { + return &MockServiceAttachmentsObj{o} } -// GCESslCertificates is a simplifying adapter for the GCE SslCertificates. -type GCESslCertificates struct { +// Patch is a mock for the corresponding method. +func (m *MockBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// GCEBetaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. +type GCEBetaServiceAttachments struct { s *Service } -// Get the SslCertificate named by key. -func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +// Get the ServiceAttachment named by key. +func (g *GCEBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "SslCertificates", + Version: meta.Version("beta"), + Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCESslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.SslCertificates.Get(projectID, key.Name) + call := g.s.Beta.ServiceAttachments.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCESslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -34167,32 +36268,34 @@ func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key, options ... return v, err } -// List all SslCertificate objects. -func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { +// List all ServiceAttachment objects. +func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "SslCertificates", + Version: meta.Version("beta"), + Service: "ServiceAttachments", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCESslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.SslCertificates.List(projectID) + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.ServiceAttachments.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.SslCertificate - f := func(l *computega.SslCertificateList) error { - klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.ServiceAttachment + f := func(l *computebeta.ServiceAttachmentList) error { + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -34200,7 +36303,7 @@ func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ... callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -34208,112 +36311,161 @@ func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ... g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert SslCertificate with key of value obj. -func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { +// Insert ServiceAttachment with key of value obj. +func (g *GCEBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCESslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "SslCertificates", + Version: meta.Version("beta"), + Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.SslCertificates.Insert(projectID, obj) + call := g.s.Beta.ServiceAttachments.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the SslCertificate referenced by key. -func (g *GCESslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the ServiceAttachment referenced by key. +func (g *GCEBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "SslCertificates", + Version: meta.Version("beta"), + Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCESslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.SslCertificates.Delete(projectID, key.Name) + call := g.s.Beta.ServiceAttachments.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaSslCertificates is an interface that allows for mocking of SslCertificates. -type BetaSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error +// Patch is a method on GCEBetaServiceAttachments. +func (g *GCEBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "ServiceAttachments", + Resource: key, + } + klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// AlphaServiceAttachments is an interface that allows for mocking of ServiceAttachments. +type AlphaServiceAttachments interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computealpha.ServiceAttachment, ...Option) error } -// NewMockBetaSslCertificates returns a new mock for SslCertificates. -func NewMockBetaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockBetaSslCertificates { - mock := &MockBetaSslCertificates{ +// NewMockAlphaServiceAttachments returns a new mock for ServiceAttachments. +func NewMockAlphaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockAlphaServiceAttachments { + mock := &MockAlphaServiceAttachments{ ProjectRouter: pr, Objects: objs, @@ -34324,14 +36476,14 @@ func NewMockBetaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCert return mock } -// MockBetaSslCertificates is the mock for SslCertificates. -type MockBetaSslCertificates struct { +// MockAlphaServiceAttachments is the mock for ServiceAttachments. +type MockAlphaServiceAttachments struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSslCertificatesObj + Objects map[meta.Key]*MockServiceAttachmentsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -34344,10 +36496,11 @@ type MockBetaSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, *computealpha.ServiceAttachment, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaServiceAttachments, options ...Option) (bool, []*computealpha.ServiceAttachment, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, m *MockAlphaServiceAttachments, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computealpha.ServiceAttachment, *MockAlphaServiceAttachments, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -34355,10 +36508,10 @@ type MockBetaSslCertificates struct { } // Get returns the object from the mock. -func (m *MockBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +func (m *MockAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -34370,28 +36523,28 @@ func (m *MockBetaSslCertificates) Get(ctx context.Context, key *meta.Key, option defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -34401,28 +36554,31 @@ func (m *MockBetaSslCertificates) List(ctx context.Context, fl *filter.F, option if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.SslCertificate - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { + var objs []*computealpha.ServiceAttachment + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToBeta()) + if !fl.Match(obj.ToAlpha()) { + continue + } + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +func (m *MockAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -34435,32 +36591,32 @@ func (m *MockBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaSslCertificates %v exists", key), + Message: fmt.Sprintf("MockAlphaServiceAttachments %v exists", key), } - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "serviceAttachments") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "serviceAttachments", key) - m.Objects[*key] = &MockSslCertificatesObj{obj} - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockServiceAttachmentsObj{obj} + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -34472,61 +36628,71 @@ func (m *MockBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaSslCertificates) Obj(o *computebeta.SslCertificate) *MockSslCertificatesObj { - return &MockSslCertificatesObj{o} +func (m *MockAlphaServiceAttachments) Obj(o *computealpha.ServiceAttachment) *MockServiceAttachmentsObj { + return &MockServiceAttachmentsObj{o} } -// GCEBetaSslCertificates is a simplifying adapter for the GCE SslCertificates. -type GCEBetaSslCertificates struct { +// Patch is a mock for the corresponding method. +func (m *MockAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// GCEAlphaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. +type GCEAlphaServiceAttachments struct { s *Service } -// Get the SslCertificate named by key. -func (g *GCEBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +// Get the ServiceAttachment named by key. +func (g *GCEAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "SslCertificates", + Version: meta.Version("alpha"), + Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.SslCertificates.Get(projectID, key.Name) + call := g.s.Alpha.ServiceAttachments.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -34534,32 +36700,34 @@ func (g *GCEBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options return v, err } -// List all SslCertificate objects. -func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { +// List all ServiceAttachment objects. +func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "SslCertificates", + Version: meta.Version("alpha"), + Service: "ServiceAttachments", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.SslCertificates.List(projectID) + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.ServiceAttachments.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.SslCertificate - f := func(l *computebeta.SslCertificateList) error { - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.ServiceAttachment + f := func(l *computealpha.ServiceAttachmentList) error { + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -34567,7 +36735,7 @@ func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -34575,112 +36743,160 @@ func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert SslCertificate with key of value obj. -func (g *GCEBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +// Insert ServiceAttachment with key of value obj. +func (g *GCEAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "SslCertificates", + Version: meta.Version("alpha"), + Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.SslCertificates.Insert(projectID, obj) + call := g.s.Alpha.ServiceAttachments.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the SslCertificate referenced by key. -func (g *GCEBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the ServiceAttachment referenced by key. +func (g *GCEAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "SslCertificates", + Version: meta.Version("alpha"), + Service: "ServiceAttachments", + Resource: key, } - klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.SslCertificates.Delete(projectID, key.Name) + call := g.s.Alpha.ServiceAttachments.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } -// AlphaSslCertificates is an interface that allows for mocking of SslCertificates. -type AlphaSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error +// Patch is a method on GCEAlphaServiceAttachments. +func (g *GCEAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "ServiceAttachments", + Resource: key, + } + klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SslCertificates is an interface that allows for mocking of SslCertificates. +type SslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockAlphaSslCertificates returns a new mock for SslCertificates. -func NewMockAlphaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockAlphaSslCertificates { - mock := &MockAlphaSslCertificates{ +// NewMockSslCertificates returns a new mock for SslCertificates. +func NewMockSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockSslCertificates { + mock := &MockSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -34691,8 +36907,8 @@ func NewMockAlphaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCer return mock } -// MockAlphaSslCertificates is the mock for SslCertificates. -type MockAlphaSslCertificates struct { +// MockSslCertificates is the mock for SslCertificates. +type MockSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter @@ -34711,10 +36927,10 @@ type MockAlphaSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -34722,10 +36938,10 @@ type MockAlphaSslCertificates struct { } // Get returns the object from the mock. -func (m *MockAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -34737,28 +36953,28 @@ func (m *MockAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock. -func (m *MockAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +func (m *MockSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -34768,28 +36984,28 @@ func (m *MockAlphaSslCertificates) List(ctx context.Context, fl *filter.F, optio if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computealpha.SslCertificate + var objs []*computega.SslCertificate for _, obj := range m.Objects { - if !fl.Match(obj.ToAlpha()) { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -34802,32 +37018,32 @@ func (m *MockAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, ob defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaSslCertificates %v exists", key), + Message: fmt.Sprintf("MockSslCertificates %v exists", key), } - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) m.Objects[*key] = &MockSslCertificatesObj{obj} - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -34839,61 +37055,63 @@ func (m *MockAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaSslCertificates) Obj(o *computealpha.SslCertificate) *MockSslCertificatesObj { +func (m *MockSslCertificates) Obj(o *computega.SslCertificate) *MockSslCertificatesObj { return &MockSslCertificatesObj{o} } -// GCEAlphaSslCertificates is a simplifying adapter for the GCE SslCertificates. -type GCEAlphaSslCertificates struct { +// GCESslCertificates is a simplifying adapter for the GCE SslCertificates. +type GCESslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCEAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.SslCertificates.Get(projectID, key.Name) + call := g.s.GA.SslCertificates.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCESslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -34902,31 +37120,33 @@ func (g *GCEAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, option } // List all SslCertificate objects. -func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + klog.V(5).Infof("GCESslCertificates.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "SslCertificates", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.SslCertificates.List(projectID) + klog.V(5).Infof("GCESslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.SslCertificates.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.SslCertificate - f := func(l *computealpha.SslCertificateList) error { - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.SslCertificate + f := func(l *computega.SslCertificateList) error { + klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -34934,7 +37154,7 @@ func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, option callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -34942,112 +37162,116 @@ func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, option g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCEAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.SslCertificates.Insert(projectID, obj) + call := g.s.GA.SslCertificates.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCEAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCESslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.SslCertificates.Delete(projectID, key.Name) + call := g.s.GA.SslCertificates.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// AlphaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. -type AlphaRegionSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error +// BetaSslCertificates is an interface that allows for mocking of SslCertificates. +type BetaSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockAlphaRegionSslCertificates returns a new mock for RegionSslCertificates. -func NewMockAlphaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockAlphaRegionSslCertificates { - mock := &MockAlphaRegionSslCertificates{ +// NewMockBetaSslCertificates returns a new mock for SslCertificates. +func NewMockBetaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockBetaSslCertificates { + mock := &MockBetaSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -35058,14 +37282,14 @@ func NewMockAlphaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*Mock return mock } -// MockAlphaRegionSslCertificates is the mock for RegionSslCertificates. -type MockAlphaRegionSslCertificates struct { +// MockBetaSslCertificates is the mock for SslCertificates. +type MockBetaSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionSslCertificatesObj + Objects map[meta.Key]*MockSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -35078,10 +37302,10 @@ type MockAlphaRegionSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -35089,10 +37313,10 @@ type MockAlphaRegionSslCertificates struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (m *MockBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -35104,28 +37328,28 @@ func (m *MockAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +// List all of the objects in the mock. +func (m *MockBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -35135,31 +37359,28 @@ func (m *MockAlphaRegionSslCertificates) List(ctx context.Context, region string if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computealpha.SslCertificate - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToAlpha()) { + var objs []*computebeta.SslCertificate + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (m *MockBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -35172,32 +37393,32 @@ func (m *MockAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v exists", key), + Message: fmt.Sprintf("MockBetaSslCertificates %v exists", key), } - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) - m.Objects[*key] = &MockRegionSslCertificatesObj{obj} - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSslCertificatesObj{obj} + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -35209,61 +37430,63 @@ func (m *MockAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionSslCertificates) Obj(o *computealpha.SslCertificate) *MockRegionSslCertificatesObj { - return &MockRegionSslCertificatesObj{o} +func (m *MockBetaSslCertificates) Obj(o *computebeta.SslCertificate) *MockSslCertificatesObj { + return &MockSslCertificatesObj{o} } -// GCEAlphaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. -type GCEAlphaRegionSslCertificates struct { +// GCEBetaSslCertificates is a simplifying adapter for the GCE SslCertificates. +type GCEBetaSslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCEAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (g *GCEBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "RegionSslCertificates", + Version: meta.Version("beta"), + Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionSslCertificates.Get(projectID, key.Region, key.Name) + call := g.s.Beta.SslCertificates.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -35272,31 +37495,33 @@ func (g *GCEAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, } // List all SslCertificate objects. -func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "RegionSslCertificates", + Version: meta.Version("beta"), + Service: "SslCertificates", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionSslCertificates.List(projectID, region) + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.SslCertificates.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.SslCertificate - f := func(l *computealpha.SslCertificateList) error { - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.SslCertificate + f := func(l *computebeta.SslCertificateList) error { + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -35304,7 +37529,7 @@ func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -35312,112 +37537,116 @@ func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCEAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (g *GCEBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "RegionSslCertificates", + Version: meta.Version("beta"), + Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.RegionSslCertificates.Insert(projectID, key.Region, obj) + call := g.s.Beta.SslCertificates.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCEAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "RegionSslCertificates", + Version: meta.Version("beta"), + Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionSslCertificates.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.SslCertificates.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. -type BetaRegionSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error +// AlphaSslCertificates is an interface that allows for mocking of SslCertificates. +type AlphaSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockBetaRegionSslCertificates returns a new mock for RegionSslCertificates. -func NewMockBetaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockBetaRegionSslCertificates { - mock := &MockBetaRegionSslCertificates{ +// NewMockAlphaSslCertificates returns a new mock for SslCertificates. +func NewMockAlphaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockAlphaSslCertificates { + mock := &MockAlphaSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -35428,14 +37657,14 @@ func NewMockBetaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockR return mock } -// MockBetaRegionSslCertificates is the mock for RegionSslCertificates. -type MockBetaRegionSslCertificates struct { +// MockAlphaSslCertificates is the mock for SslCertificates. +type MockAlphaSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionSslCertificatesObj + Objects map[meta.Key]*MockSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -35448,10 +37677,10 @@ type MockBetaRegionSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -35459,10 +37688,10 @@ type MockBetaRegionSslCertificates struct { } // Get returns the object from the mock. -func (m *MockBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +func (m *MockAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -35474,28 +37703,28 @@ func (m *MockBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), } - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { +// List all of the objects in the mock. +func (m *MockAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -35505,31 +37734,28 @@ func (m *MockBetaRegionSslCertificates) List(ctx context.Context, region string, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.SslCertificate - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { + var objs []*computealpha.SslCertificate + for _, obj := range m.Objects { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +func (m *MockAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -35542,32 +37768,32 @@ func (m *MockBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionSslCertificates %v exists", key), + Message: fmt.Sprintf("MockAlphaSslCertificates %v exists", key), } - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) - m.Objects[*key] = &MockRegionSslCertificatesObj{obj} - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSslCertificatesObj{obj} + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -35579,61 +37805,63 @@ func (m *MockBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), } - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaRegionSslCertificates) Obj(o *computebeta.SslCertificate) *MockRegionSslCertificatesObj { - return &MockRegionSslCertificatesObj{o} +func (m *MockAlphaSslCertificates) Obj(o *computealpha.SslCertificate) *MockSslCertificatesObj { + return &MockSslCertificatesObj{o} } -// GCEBetaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. -type GCEBetaRegionSslCertificates struct { +// GCEAlphaSslCertificates is a simplifying adapter for the GCE SslCertificates. +type GCEAlphaSslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCEBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +func (g *GCEAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", + Version: meta.Version("alpha"), + Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionSslCertificates.Get(projectID, key.Region, key.Name) + call := g.s.Alpha.SslCertificates.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -35642,31 +37870,33 @@ func (g *GCEBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, o } // List all SslCertificate objects. -func (g *GCEBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { +func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", + Version: meta.Version("alpha"), + Service: "SslCertificates", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionSslCertificates.List(projectID, region) + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.SslCertificates.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.SslCertificate - f := func(l *computebeta.SslCertificateList) error { - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.SslCertificate + f := func(l *computealpha.SslCertificateList) error { + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -35674,7 +37904,7 @@ func (g *GCEBetaRegionSslCertificates) List(ctx context.Context, region string, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -35682,112 +37912,116 @@ func (g *GCEBetaRegionSslCertificates) List(ctx context.Context, region string, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCEBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +func (g *GCEAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", + Version: meta.Version("alpha"), + Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionSslCertificates.Insert(projectID, key.Region, obj) + call := g.s.Alpha.SslCertificates.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCEBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", + Version: meta.Version("alpha"), + Service: "SslCertificates", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionSslCertificates.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.SslCertificates.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// RegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. -type RegionSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error +// AlphaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. +type AlphaRegionSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockRegionSslCertificates returns a new mock for RegionSslCertificates. -func NewMockRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockRegionSslCertificates { - mock := &MockRegionSslCertificates{ +// NewMockAlphaRegionSslCertificates returns a new mock for RegionSslCertificates. +func NewMockAlphaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockAlphaRegionSslCertificates { + mock := &MockAlphaRegionSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -35798,8 +38032,8 @@ func NewMockRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegio return mock } -// MockRegionSslCertificates is the mock for RegionSslCertificates. -type MockRegionSslCertificates struct { +// MockAlphaRegionSslCertificates is the mock for RegionSslCertificates. +type MockAlphaRegionSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter @@ -35818,10 +38052,10 @@ type MockRegionSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockRegionSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -35829,10 +38063,10 @@ type MockRegionSslCertificates struct { } // Get returns the object from the mock. -func (m *MockRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +func (m *MockAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -35844,28 +38078,28 @@ func (m *MockRegionSslCertificates) Get(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { +func (m *MockAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -35875,31 +38109,31 @@ func (m *MockRegionSslCertificates) List(ctx context.Context, region string, fl if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.SslCertificate + var objs []*computealpha.SslCertificate for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToGA()) { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { +func (m *MockAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -35912,32 +38146,32 @@ func (m *MockRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionSslCertificates %v exists", key), + Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v exists", key), } - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) m.Objects[*key] = &MockRegionSslCertificatesObj{obj} - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -35949,61 +38183,63 @@ func (m *MockRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionSslCertificates) Obj(o *computega.SslCertificate) *MockRegionSslCertificatesObj { +func (m *MockAlphaRegionSslCertificates) Obj(o *computealpha.SslCertificate) *MockRegionSslCertificatesObj { return &MockRegionSslCertificatesObj{o} } -// GCERegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. -type GCERegionSslCertificates struct { +// GCEAlphaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. +type GCEAlphaRegionSslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCERegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +func (g *GCEAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "RegionSslCertificates", + Resource: key, } - klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionSslCertificates.Get(projectID, key.Region, key.Name) + call := g.s.Alpha.RegionSslCertificates.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -36012,31 +38248,33 @@ func (g *GCERegionSslCertificates) Get(ctx context.Context, key *meta.Key, optio } // List all SslCertificate objects. -func (g *GCERegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { +func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "RegionSslCertificates", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionSslCertificates.List(projectID, region) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionSslCertificates.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.SslCertificate - f := func(l *computega.SslCertificateList) error { - klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.SslCertificate + f := func(l *computealpha.SslCertificateList) error { + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -36044,7 +38282,7 @@ func (g *GCERegionSslCertificates) List(ctx context.Context, region string, fl * callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -36052,111 +38290,116 @@ func (g *GCERegionSslCertificates) List(ctx context.Context, region string, fl * g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCERegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { +func (g *GCEAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "RegionSslCertificates", + Resource: key, } - klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.RegionSslCertificates.Insert(projectID, key.Region, obj) + call := g.s.Alpha.RegionSslCertificates.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCERegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "RegionSslCertificates", + Resource: key, } - klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionSslCertificates.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.RegionSslCertificates.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// SslPolicies is an interface that allows for mocking of SslPolicies. -type SslPolicies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error +// BetaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. +type BetaRegionSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockSslPolicies returns a new mock for SslPolicies. -func NewMockSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockSslPoliciesObj) *MockSslPolicies { - mock := &MockSslPolicies{ +// NewMockBetaRegionSslCertificates returns a new mock for RegionSslCertificates. +func NewMockBetaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockBetaRegionSslCertificates { + mock := &MockBetaRegionSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -36167,18 +38410,19 @@ func NewMockSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockSslPoliciesObj) return mock } -// MockSslPolicies is the mock for SslPolicies. -type MockSslPolicies struct { +// MockBetaRegionSslCertificates is the mock for RegionSslCertificates. +type MockBetaRegionSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSslPoliciesObj + Objects map[meta.Key]*MockRegionSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. GetError map[meta.Key]error + ListError *error InsertError map[meta.Key]error DeleteError map[meta.Key]error @@ -36186,9 +38430,10 @@ type MockSslPolicies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockSslPolicies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -36196,10 +38441,10 @@ type MockSslPolicies struct { } // Get returns the object from the mock. -func (m *MockSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { +func (m *MockBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -36211,28 +38456,62 @@ func (m *MockSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslPolicies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } +// List all of the objects in the mock in the given region. +func (m *MockBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { + if m.ListHook != nil { + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + + return nil, *m.ListError + } + + var objs []*computebeta.SslCertificate + for key, obj := range m.Objects { + if key.Region != region { + continue + } + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) + } + + klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + return objs, nil +} + // Insert is a mock for inserting/creating a new object. -func (m *MockSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { +func (m *MockBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -36245,32 +38524,32 @@ func (m *MockSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *comput defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockSslPolicies %v exists", key), + Message: fmt.Sprintf("MockBetaRegionSslCertificates %v exists", key), } - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) - m.Objects[*key] = &MockSslPoliciesObj{obj} - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionSslCertificatesObj{obj} + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -36282,61 +38561,63 @@ func (m *MockSslPolicies) Delete(ctx context.Context, key *meta.Key, options ... defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslPolicies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockSslPolicies) Obj(o *computega.SslPolicy) *MockSslPoliciesObj { - return &MockSslPoliciesObj{o} +func (m *MockBetaRegionSslCertificates) Obj(o *computebeta.SslCertificate) *MockRegionSslCertificatesObj { + return &MockRegionSslCertificatesObj{o} } -// GCESslPolicies is a simplifying adapter for the GCE SslPolicies. -type GCESslPolicies struct { +// GCEBetaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. +type GCEBetaRegionSslCertificates struct { s *Service } -// Get the SslPolicy named by key. -func (g *GCESslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { +// Get the SslCertificate named by key. +func (g *GCEBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESslPolicies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "SslPolicies", + Version: meta.Version("beta"), + Service: "RegionSslCertificates", + Resource: key, } - klog.V(5).Infof("GCESslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.SslPolicies.Get(projectID, key.Name) + call := g.s.Beta.RegionSslCertificates.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCESslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -36344,99 +38625,159 @@ func (g *GCESslPolicies) Get(ctx context.Context, key *meta.Key, options ...Opti return v, err } -// Insert SslPolicy with key of value obj. -func (g *GCESslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { +// List all SslCertificate objects. +func (g *GCEBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "List", + Version: meta.Version("beta"), + Service: "RegionSslCertificates", + Resource: key, + } + + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionSslCertificates.List(projectID, region) + if fl != filter.None { + call.Filter(fl.String()) + } + + var all []*computebeta.SslCertificate + f := func(l *computebeta.SslCertificateList) error { + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Insert SslCertificate with key of value obj. +func (g *GCEBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCESslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "SslPolicies", + Version: meta.Version("beta"), + Service: "RegionSslCertificates", + Resource: key, } - klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.SslPolicies.Insert(projectID, obj) + call := g.s.Beta.RegionSslCertificates.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the SslPolicy referenced by key. -func (g *GCESslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the SslCertificate referenced by key. +func (g *GCEBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "SslPolicies", + Version: meta.Version("beta"), + Service: "RegionSslCertificates", + Resource: key, } - klog.V(5).Infof("GCESslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.SslPolicies.Delete(projectID, key.Name) + call := g.s.Beta.RegionSslCertificates.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// RegionSslPolicies is an interface that allows for mocking of RegionSslPolicies. -type RegionSslPolicies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error +// RegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. +type RegionSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockRegionSslPolicies returns a new mock for RegionSslPolicies. -func NewMockRegionSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockRegionSslPoliciesObj) *MockRegionSslPolicies { - mock := &MockRegionSslPolicies{ +// NewMockRegionSslCertificates returns a new mock for RegionSslCertificates. +func NewMockRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockRegionSslCertificates { + mock := &MockRegionSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -36447,18 +38788,19 @@ func NewMockRegionSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockRegionSsl return mock } -// MockRegionSslPolicies is the mock for RegionSslPolicies. -type MockRegionSslPolicies struct { +// MockRegionSslCertificates is the mock for RegionSslCertificates. +type MockRegionSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionSslPoliciesObj + Objects map[meta.Key]*MockRegionSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. GetError map[meta.Key]error + ListError *error InsertError map[meta.Key]error DeleteError map[meta.Key]error @@ -36466,9 +38808,10 @@ type MockRegionSslPolicies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockRegionSslPolicies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockRegionSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -36476,10 +38819,10 @@ type MockRegionSslPolicies struct { } // Get returns the object from the mock. -func (m *MockRegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { +func (m *MockRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -36491,28 +38834,62 @@ func (m *MockRegionSslPolicies) Get(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), + Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } +// List all of the objects in the mock in the given region. +func (m *MockRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { + if m.ListHook != nil { + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + + return nil, *m.ListError + } + + var objs []*computega.SslCertificate + for key, obj := range m.Objects { + if key.Region != region { + continue + } + if !fl.Match(obj.ToGA()) { + continue + } + objs = append(objs, obj.ToGA()) + } + + klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + return objs, nil +} + // Insert is a mock for inserting/creating a new object. -func (m *MockRegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { +func (m *MockRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -36525,32 +38902,32 @@ func (m *MockRegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj * defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionSslPolicies %v exists", key), + Message: fmt.Sprintf("MockRegionSslCertificates %v exists", key), } - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) - m.Objects[*key] = &MockRegionSslPoliciesObj{obj} - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionSslCertificatesObj{obj} + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -36562,61 +38939,63 @@ func (m *MockRegionSslPolicies) Delete(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), + Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionSslPolicies) Obj(o *computega.SslPolicy) *MockRegionSslPoliciesObj { - return &MockRegionSslPoliciesObj{o} +func (m *MockRegionSslCertificates) Obj(o *computega.SslCertificate) *MockRegionSslCertificatesObj { + return &MockRegionSslCertificatesObj{o} } -// GCERegionSslPolicies is a simplifying adapter for the GCE RegionSslPolicies. -type GCERegionSslPolicies struct { +// GCERegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. +type GCERegionSslCertificates struct { s *Service } -// Get the SslPolicy named by key. -func (g *GCERegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { +// Get the SslCertificate named by key. +func (g *GCERegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionSslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "RegionSslPolicies", + Service: "RegionSslCertificates", + Resource: key, } - klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionSslPolicies.Get(projectID, key.Region, key.Name) + call := g.s.GA.RegionSslCertificates.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -36624,102 +39003,2298 @@ func (g *GCERegionSslPolicies) Get(ctx context.Context, key *meta.Key, options . return v, err } -// Insert SslPolicy with key of value obj. -func (g *GCERegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { +// List all SslCertificate objects. +func (g *GCERegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "List", + Version: meta.Version("ga"), + Service: "RegionSslCertificates", + Resource: key, + } + + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionSslCertificates.List(projectID, region) + if fl != filter.None { + call.Filter(fl.String()) + } + + var all []*computega.SslCertificate + f := func(l *computega.SslCertificateList) error { + klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Insert SslCertificate with key of value obj. +func (g *GCERegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Insert", + Version: meta.Version("ga"), + Service: "RegionSslCertificates", + Resource: key, + } + klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.GA.RegionSslCertificates.Insert(projectID, key.Region, obj) + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the SslCertificate referenced by key. +func (g *GCERegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCERegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Delete", + Version: meta.Version("ga"), + Service: "RegionSslCertificates", + Resource: key, + } + klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.RegionSslCertificates.Delete(projectID, key.Region, key.Name) + + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// SslPolicies is an interface that allows for mocking of SslPolicies. +type SslPolicies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error +} + +// NewMockSslPolicies returns a new mock for SslPolicies. +func NewMockSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockSslPoliciesObj) *MockSslPolicies { + mock := &MockSslPolicies{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockSslPolicies is the mock for SslPolicies. +type MockSslPolicies struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockSslPoliciesObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockSslPolicies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, error) + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} +} + +// Get returns the object from the mock. +func (m *MockSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { + if m.GetHook != nil { + if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + return obj, err + } + } + if !key.Valid() { + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.GetError[*key]; ok { + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err + } + if obj, ok := m.Objects[*key]; ok { + typedObj := obj.ToGA() + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + return typedObj, nil + } + + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockSslPolicies %v not found", key), + } + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err +} + +// Insert is a mock for inserting/creating a new object. +func (m *MockSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } + opts := mergeOptions(options) + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.InsertError[*key]; ok { + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + if _, ok := m.Objects[*key]; ok { + err := &googleapi.Error{ + Code: http.StatusConflict, + Message: fmt.Sprintf("MockSslPolicies %v exists", key), + } + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + + obj.Name = key.Name + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) + + m.Objects[*key] = &MockSslPoliciesObj{obj} + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + return nil +} + +// Delete is a mock for deleting the object. +func (m *MockSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + if m.DeleteHook != nil { + if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + } + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.DeleteError[*key]; ok { + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + if _, ok := m.Objects[*key]; !ok { + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockSslPolicies %v not found", key), + } + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + delete(m.Objects, *key) + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = nil", ctx, key) + return nil +} + +// Obj wraps the object for use in the mock. +func (m *MockSslPolicies) Obj(o *computega.SslPolicy) *MockSslPoliciesObj { + return &MockSslPoliciesObj{o} +} + +// GCESslPolicies is a simplifying adapter for the GCE SslPolicies. +type GCESslPolicies struct { + s *Service +} + +// Get the SslPolicy named by key. +func (g *GCESslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCESslPolicies.Get(%v, %v, %v): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCESslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + return nil, fmt.Errorf("invalid GCE key (%#v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Get", + Version: meta.Version("ga"), + Service: "SslPolicies", + Resource: key, + } + + klog.V(5).Infof("GCESslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCESslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.GA.SslPolicies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) + call.Context(ctx) + v, err := call.Do() + klog.V(4).Infof("GCESslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return v, err +} + +// Insert SslPolicy with key of value obj. +func (g *GCESslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + if !key.Valid() { + klog.V(2).Infof("GCESslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Insert", + Version: meta.Version("ga"), + Service: "SslPolicies", + Resource: key, + } + klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.GA.SslPolicies.Insert(projectID, obj) + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the SslPolicy referenced by key. +func (g *GCESslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCESslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCESslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Delete", + Version: meta.Version("ga"), + Service: "SslPolicies", + Resource: key, + } + klog.V(5).Infof("GCESslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCESslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.SslPolicies.Delete(projectID, key.Name) + + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// RegionSslPolicies is an interface that allows for mocking of RegionSslPolicies. +type RegionSslPolicies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error +} + +// NewMockRegionSslPolicies returns a new mock for RegionSslPolicies. +func NewMockRegionSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockRegionSslPoliciesObj) *MockRegionSslPolicies { + mock := &MockRegionSslPolicies{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockRegionSslPolicies is the mock for RegionSslPolicies. +type MockRegionSslPolicies struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockRegionSslPoliciesObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockRegionSslPolicies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, error) + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} +} + +// Get returns the object from the mock. +func (m *MockRegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { + if m.GetHook != nil { + if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + return obj, err + } + } + if !key.Valid() { + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.GetError[*key]; ok { + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err + } + if obj, ok := m.Objects[*key]; ok { + typedObj := obj.ToGA() + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + return typedObj, nil + } + + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), + } + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err +} + +// Insert is a mock for inserting/creating a new object. +func (m *MockRegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } + opts := mergeOptions(options) + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.InsertError[*key]; ok { + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + if _, ok := m.Objects[*key]; ok { + err := &googleapi.Error{ + Code: http.StatusConflict, + Message: fmt.Sprintf("MockRegionSslPolicies %v exists", key), + } + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + + obj.Name = key.Name + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) + + m.Objects[*key] = &MockRegionSslPoliciesObj{obj} + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + return nil +} + +// Delete is a mock for deleting the object. +func (m *MockRegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + if m.DeleteHook != nil { + if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + } + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.DeleteError[*key]; ok { + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + if _, ok := m.Objects[*key]; !ok { + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), + } + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + delete(m.Objects, *key) + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = nil", ctx, key) + return nil +} + +// Obj wraps the object for use in the mock. +func (m *MockRegionSslPolicies) Obj(o *computega.SslPolicy) *MockRegionSslPoliciesObj { + return &MockRegionSslPoliciesObj{o} +} + +// GCERegionSslPolicies is a simplifying adapter for the GCE RegionSslPolicies. +type GCERegionSslPolicies struct { + s *Service +} + +// Get the SslPolicy named by key. +func (g *GCERegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v, %v): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCERegionSslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + return nil, fmt.Errorf("invalid GCE key (%#v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Get", + Version: meta.Version("ga"), + Service: "RegionSslPolicies", + Resource: key, + } + + klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.GA.RegionSslPolicies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) + call.Context(ctx) + v, err := call.Do() + klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return v, err +} + +// Insert SslPolicy with key of value obj. +func (g *GCERegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + if !key.Valid() { + klog.V(2).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Insert", + Version: meta.Version("ga"), + Service: "RegionSslPolicies", + Resource: key, + } + klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.GA.RegionSslPolicies.Insert(projectID, key.Region, obj) + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the SslPolicy referenced by key. +func (g *GCERegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCERegionSslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Delete", + Version: meta.Version("ga"), + Service: "RegionSslPolicies", + Resource: key, + } + klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.RegionSslPolicies.Delete(projectID, key.Region, key.Name) + + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// AlphaSubnetworks is an interface that allows for mocking of Subnetworks. +type AlphaSubnetworks interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) + Patch(context.Context, *meta.Key, *computealpha.Subnetwork, ...Option) error +} + +// NewMockAlphaSubnetworks returns a new mock for Subnetworks. +func NewMockAlphaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockAlphaSubnetworks { + mock := &MockAlphaSubnetworks{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockAlphaSubnetworks is the mock for Subnetworks. +type MockAlphaSubnetworks struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockSubnetworksObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + ListUsableError *error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, *computealpha.Subnetwork, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.Subnetwork, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, m *MockAlphaSubnetworks, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, error) + ListUsableHook func(ctx context.Context, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.UsableSubnetwork, error) + PatchHook func(context.Context, *meta.Key, *computealpha.Subnetwork, *MockAlphaSubnetworks, ...Option) error + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} +} + +// Get returns the object from the mock. +func (m *MockAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { + if m.GetHook != nil { + if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + return obj, err + } + } + if !key.Valid() { + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.GetError[*key]; ok { + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err + } + if obj, ok := m.Objects[*key]; ok { + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + return typedObj, nil + } + + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), + } + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err +} + +// List all of the objects in the mock in the given region. +func (m *MockAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { + if m.ListHook != nil { + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + + return nil, *m.ListError + } + + var objs []*computealpha.Subnetwork + for key, obj := range m.Objects { + if key.Region != region { + continue + } + if !fl.Match(obj.ToAlpha()) { + continue + } + objs = append(objs, obj.ToAlpha()) + } + + klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + return objs, nil +} + +// Insert is a mock for inserting/creating a new object. +func (m *MockAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } + opts := mergeOptions(options) + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.InsertError[*key]; ok { + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + if _, ok := m.Objects[*key]; ok { + err := &googleapi.Error{ + Code: http.StatusConflict, + Message: fmt.Sprintf("MockAlphaSubnetworks %v exists", key), + } + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + + obj.Name = key.Name + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "subnetworks") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "subnetworks", key) + + m.Objects[*key] = &MockSubnetworksObj{obj} + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) + return nil +} + +// Delete is a mock for deleting the object. +func (m *MockAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + if m.DeleteHook != nil { + if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + } + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.DeleteError[*key]; ok { + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + if _, ok := m.Objects[*key]; !ok { + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), + } + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + delete(m.Objects, *key) + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = nil", ctx, key) + return nil +} + +// List all of the objects in the mock. +func (m *MockAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { + if m.ListUsableHook != nil { + if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) + return nil, *m.ListError + } + + var objs []*computealpha.UsableSubnetwork + + for _, obj := range m.Objects { + if !fl.Match(obj.ToAlpha()) { + continue + } + alphaObj := obj.ToAlpha() + dest := &computealpha.UsableSubnetwork{} + // Convert to Usable type to avoid separate Usable struct + if err := copyViaJSON(dest, alphaObj); err != nil { + klog.Errorf("Could not convert %T to *computealpha.UsableSubnetwork via JSON: %v", alphaObj, err) + } + objs = append(objs, dest) + } + klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + +// Obj wraps the object for use in the mock. +func (m *MockAlphaSubnetworks) Obj(o *computealpha.Subnetwork) *MockSubnetworksObj { + return &MockSubnetworksObj{o} +} + +// Patch is a mock for the corresponding method. +func (m *MockAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// GCEAlphaSubnetworks is a simplifying adapter for the GCE Subnetworks. +type GCEAlphaSubnetworks struct { + s *Service +} + +// Get the Subnetwork named by key. +func (g *GCEAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + return nil, fmt.Errorf("invalid GCE key (%#v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Get", + Version: meta.Version("alpha"), + Service: "Subnetworks", + Resource: key, + } + + klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Alpha.Subnetworks.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) + call.Context(ctx) + v, err := call.Do() + klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return v, err +} + +// List all Subnetwork objects. +func (g *GCEAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "List", + Version: meta.Version("alpha"), + Service: "Subnetworks", + Resource: key, + } + + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.Subnetworks.List(projectID, region) + if fl != filter.None { + call.Filter(fl.String()) + } + + var all []*computealpha.Subnetwork + f := func(l *computealpha.SubnetworkList) error { + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Insert Subnetwork with key of value obj. +func (g *GCEAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + if !key.Valid() { + klog.V(2).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Insert", + Version: meta.Version("alpha"), + Service: "Subnetworks", + Resource: key, + } + klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.Alpha.Subnetworks.Insert(projectID, key.Region, obj) + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the Subnetwork referenced by key. +func (g *GCEAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCEAlphaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Delete", + Version: meta.Version("alpha"), + Service: "Subnetworks", + Resource: key, + } + klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.Subnetworks.Delete(projectID, key.Region, key.Name) + + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// List all Usable Subnetwork objects. +func (g *GCEAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "ListUsable", + Version: meta.Version("alpha"), + Service: "Subnetworks", + Resource: &meta.Key{}, + } + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.Subnetworks.ListUsable(projectID) + if fl != filter.None { + call.Filter(fl.String()) + } + var all []*computealpha.UsableSubnetwork + f := func(l *computealpha.UsableSubnetworksAggregatedList) error { + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Patch is a method on GCEAlphaSubnetworks. +func (g *GCEAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "Subnetworks", + Resource: key, + } + klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// BetaSubnetworks is an interface that allows for mocking of Subnetworks. +type BetaSubnetworks interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) + Patch(context.Context, *meta.Key, *computebeta.Subnetwork, ...Option) error +} + +// NewMockBetaSubnetworks returns a new mock for Subnetworks. +func NewMockBetaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockBetaSubnetworks { + mock := &MockBetaSubnetworks{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockBetaSubnetworks is the mock for Subnetworks. +type MockBetaSubnetworks struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockSubnetworksObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + ListUsableError *error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, *computebeta.Subnetwork, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.Subnetwork, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, m *MockBetaSubnetworks, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, error) + ListUsableHook func(ctx context.Context, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.UsableSubnetwork, error) + PatchHook func(context.Context, *meta.Key, *computebeta.Subnetwork, *MockBetaSubnetworks, ...Option) error + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} +} + +// Get returns the object from the mock. +func (m *MockBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { + if m.GetHook != nil { + if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + return obj, err + } + } + if !key.Valid() { + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.GetError[*key]; ok { + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err + } + if obj, ok := m.Objects[*key]; ok { + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + return typedObj, nil + } + + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), + } + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err +} + +// List all of the objects in the mock in the given region. +func (m *MockBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { + if m.ListHook != nil { + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + + return nil, *m.ListError + } + + var objs []*computebeta.Subnetwork + for key, obj := range m.Objects { + if key.Region != region { + continue + } + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) + } + + klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + return objs, nil +} + +// Insert is a mock for inserting/creating a new object. +func (m *MockBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } + opts := mergeOptions(options) + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.InsertError[*key]; ok { + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + if _, ok := m.Objects[*key]; ok { + err := &googleapi.Error{ + Code: http.StatusConflict, + Message: fmt.Sprintf("MockBetaSubnetworks %v exists", key), + } + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + + obj.Name = key.Name + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "subnetworks") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "subnetworks", key) + + m.Objects[*key] = &MockSubnetworksObj{obj} + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) + return nil +} + +// Delete is a mock for deleting the object. +func (m *MockBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + if m.DeleteHook != nil { + if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + } + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.DeleteError[*key]; ok { + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + if _, ok := m.Objects[*key]; !ok { + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), + } + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + delete(m.Objects, *key) + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = nil", ctx, key) + return nil +} + +// List all of the objects in the mock. +func (m *MockBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { + if m.ListUsableHook != nil { + if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) + return nil, *m.ListError + } + + var objs []*computebeta.UsableSubnetwork + + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { + continue + } + betaObj := obj.ToBeta() + dest := &computebeta.UsableSubnetwork{} + // Convert to Usable type to avoid separate Usable struct + if err := copyViaJSON(dest, betaObj); err != nil { + klog.Errorf("Could not convert %T to *computebeta.UsableSubnetwork via JSON: %v", betaObj, err) + } + objs = append(objs, dest) + } + klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + +// Obj wraps the object for use in the mock. +func (m *MockBetaSubnetworks) Obj(o *computebeta.Subnetwork) *MockSubnetworksObj { + return &MockSubnetworksObj{o} +} + +// Patch is a mock for the corresponding method. +func (m *MockBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// GCEBetaSubnetworks is a simplifying adapter for the GCE Subnetworks. +type GCEBetaSubnetworks struct { + s *Service +} + +// Get the Subnetwork named by key. +func (g *GCEBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + return nil, fmt.Errorf("invalid GCE key (%#v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Get", + Version: meta.Version("beta"), + Service: "Subnetworks", + Resource: key, + } + + klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Beta.Subnetworks.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) + call.Context(ctx) + v, err := call.Do() + klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return v, err +} + +// List all Subnetwork objects. +func (g *GCEBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "List", + Version: meta.Version("beta"), + Service: "Subnetworks", + Resource: key, + } + + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.Subnetworks.List(projectID, region) + if fl != filter.None { + call.Filter(fl.String()) + } + + var all []*computebeta.Subnetwork + f := func(l *computebeta.SubnetworkList) error { + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Insert Subnetwork with key of value obj. +func (g *GCEBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + if !key.Valid() { + klog.V(2).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Insert", + Version: meta.Version("beta"), + Service: "Subnetworks", + Resource: key, + } + klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.Beta.Subnetworks.Insert(projectID, key.Region, obj) + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the Subnetwork referenced by key. +func (g *GCEBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCEBetaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Delete", + Version: meta.Version("beta"), + Service: "Subnetworks", + Resource: key, + } + klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.Subnetworks.Delete(projectID, key.Region, key.Name) + + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// List all Usable Subnetwork objects. +func (g *GCEBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "ListUsable", + Version: meta.Version("beta"), + Service: "Subnetworks", + Resource: &meta.Key{}, + } + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.Subnetworks.ListUsable(projectID) + if fl != filter.None { + call.Filter(fl.String()) + } + var all []*computebeta.UsableSubnetwork + f := func(l *computebeta.UsableSubnetworksAggregatedList) error { + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Patch is a method on GCEBetaSubnetworks. +func (g *GCEBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "Subnetworks", + Resource: key, + } + klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// Subnetworks is an interface that allows for mocking of Subnetworks. +type Subnetworks interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) + Patch(context.Context, *meta.Key, *computega.Subnetwork, ...Option) error +} + +// NewMockSubnetworks returns a new mock for Subnetworks. +func NewMockSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockSubnetworks { + mock := &MockSubnetworks{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock +} + +// MockSubnetworks is the mock for Subnetworks. +type MockSubnetworks struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockSubnetworksObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + ListUsableError *error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, *computega.Subnetwork, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.Subnetwork, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, m *MockSubnetworks, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, error) + ListUsableHook func(ctx context.Context, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.UsableSubnetwork, error) + PatchHook func(context.Context, *meta.Key, *computega.Subnetwork, *MockSubnetworks, ...Option) error + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} +} + +// Get returns the object from the mock. +func (m *MockSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { + if m.GetHook != nil { + if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + return obj, err + } + } + if !key.Valid() { + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.GetError[*key]; ok { + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err + } + if obj, ok := m.Objects[*key]; ok { + typedObj := obj.ToGA() + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + return typedObj, nil + } + + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockSubnetworks %v not found", key), + } + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + return nil, err +} + +// List all of the objects in the mock in the given region. +func (m *MockSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { + if m.ListHook != nil { + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + + return nil, *m.ListError + } + + var objs []*computega.Subnetwork + for key, obj := range m.Objects { + if key.Region != region { + continue + } + if !fl.Match(obj.ToGA()) { + continue + } + objs = append(objs, obj.ToGA()) + } + + klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + return objs, nil +} + +// Insert is a mock for inserting/creating a new object. +func (m *MockSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } + opts := mergeOptions(options) + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.InsertError[*key]; ok { + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + if _, ok := m.Objects[*key]; ok { + err := &googleapi.Error{ + Code: http.StatusConflict, + Message: fmt.Sprintf("MockSubnetworks %v exists", key), + } + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + + obj.Name = key.Name + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "subnetworks") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "subnetworks", key) + + m.Objects[*key] = &MockSubnetworksObj{obj} + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) + return nil +} + +// Delete is a mock for deleting the object. +func (m *MockSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + if m.DeleteHook != nil { + if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + } + if !key.Valid() { + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if err, ok := m.DeleteError[*key]; ok { + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + if _, ok := m.Objects[*key]; !ok { + err := &googleapi.Error{ + Code: http.StatusNotFound, + Message: fmt.Sprintf("MockSubnetworks %v not found", key), + } + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + delete(m.Objects, *key) + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = nil", ctx, key) + return nil +} + +// List all of the objects in the mock. +func (m *MockSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { + if m.ListUsableHook != nil { + if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) + return nil, *m.ListError + } + + var objs []*computega.UsableSubnetwork + + for _, obj := range m.Objects { + if !fl.Match(obj.ToGA()) { + continue + } + gaObj := obj.ToGA() + dest := &computega.UsableSubnetwork{} + // Convert to Usable type to avoid separate Usable struct + if err := copyViaJSON(dest, gaObj); err != nil { + klog.Errorf("Could not convert %T to *computega.UsableSubnetwork via JSON: %v", gaObj, err) + } + objs = append(objs, dest) + } + klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + +// Obj wraps the object for use in the mock. +func (m *MockSubnetworks) Obj(o *computega.Subnetwork) *MockSubnetworksObj { + return &MockSubnetworksObj{o} +} + +// Patch is a mock for the corresponding method. +func (m *MockSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// GCESubnetworks is a simplifying adapter for the GCE Subnetworks. +type GCESubnetworks struct { + s *Service +} + +// Get the Subnetwork named by key. +func (g *GCESubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCESubnetworks.Get(%v, %v, %v): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCESubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + return nil, fmt.Errorf("invalid GCE key (%#v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Get", + Version: meta.Version("ga"), + Service: "Subnetworks", + Resource: key, + } + + klog.V(5).Infof("GCESubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCESubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.GA.Subnetworks.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) + call.Context(ctx) + v, err := call.Do() + klog.V(4).Infof("GCESubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return v, err +} + +// List all Subnetwork objects. +func (g *GCESubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "List", + Version: meta.Version("ga"), + Service: "Subnetworks", + Resource: key, + } + + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.Subnetworks.List(projectID, region) + if fl != filter.None { + call.Filter(fl.String()) + } + + var all []*computega.Subnetwork + f := func(l *computega.SubnetworkList) error { + klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Insert Subnetwork with key of value obj. +func (g *GCESubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + if !key.Valid() { + klog.V(2).Infof("GCESubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Insert", + Version: meta.Version("ga"), + Service: "Subnetworks", + Resource: key, + } + klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.GA.Subnetworks.Insert(projectID, key.Region, obj) + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the Subnetwork referenced by key. +func (g *GCESubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCESubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCESubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") - + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Insert", + Operation: "Delete", Version: meta.Version("ga"), - Service: "RegionSslPolicies", + Service: "Subnetworks", + Resource: key, } - klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - obj.Name = key.Name - call := g.s.GA.RegionSslPolicies.Insert(projectID, key.Region, obj) + call := g.s.GA.Subnetworks.Delete(projectID, key.Region, key.Name) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } -// Delete the SslPolicy referenced by key. -func (g *GCERegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// List all Usable Subnetwork objects. +func (g *GCESubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "ListUsable", + Version: meta.Version("ga"), + Service: "Subnetworks", + Resource: &meta.Key{}, + } + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.Subnetworks.ListUsable(projectID) + if fl != filter.None { + call.Filter(fl.String()) + } + var all []*computega.UsableSubnetwork + f := func(l *computega.UsableSubnetworksAggregatedList) error { + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Patch is a method on GCESubnetworks. +func (g *GCESubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) + if !key.Valid() { - klog.V(2).Infof("GCERegionSslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Delete", + Operation: "Patch", Version: meta.Version("ga"), - Service: "RegionSslPolicies", + Service: "Subnetworks", + Resource: key, } - klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionSslPolicies.Delete(projectID, key.Region, key.Name) - + call := g.s.GA.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaSubnetworks is an interface that allows for mocking of Subnetworks. -type AlphaSubnetworks interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error +// AlphaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. +type AlphaTargetHttpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) - Patch(context.Context, *meta.Key, *computealpha.Subnetwork, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockAlphaSubnetworks returns a new mock for Subnetworks. -func NewMockAlphaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockAlphaSubnetworks { - mock := &MockAlphaSubnetworks{ +// NewMockAlphaTargetHttpProxies returns a new mock for TargetHttpProxies. +func NewMockAlphaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockAlphaTargetHttpProxies { + mock := &MockAlphaTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -36730,33 +41305,31 @@ func NewMockAlphaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetwork return mock } -// MockAlphaSubnetworks is the mock for Subnetworks. -type MockAlphaSubnetworks struct { +// MockAlphaTargetHttpProxies is the mock for TargetHttpProxies. +type MockAlphaTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSubnetworksObj + Objects map[meta.Key]*MockTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - ListUsableError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, *computealpha.Subnetwork, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.Subnetwork, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, m *MockAlphaSubnetworks, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, error) - ListUsableHook func(ctx context.Context, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.UsableSubnetwork, error) - PatchHook func(context.Context, *meta.Key, *computealpha.Subnetwork, *MockAlphaSubnetworks, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -36764,10 +41337,10 @@ type MockAlphaSubnetworks struct { } // Get returns the object from the mock. -func (m *MockAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { +func (m *MockAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -36779,28 +41352,28 @@ func (m *MockAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options . defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { +// List all of the objects in the mock. +func (m *MockAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -36810,31 +41383,28 @@ func (m *MockAlphaSubnetworks) List(ctx context.Context, region string, fl *filt if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computealpha.Subnetwork - for key, obj := range m.Objects { - if key.Region != region { - continue - } + var objs []*computealpha.TargetHttpProxy + for _, obj := range m.Objects { if !fl.Match(obj.ToAlpha()) { continue } objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { +func (m *MockAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -36847,32 +41417,32 @@ func (m *MockAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *c defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaSubnetworks %v exists", key), + Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "subnetworks") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "subnetworks", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockSubnetworksObj{obj} - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -36884,105 +41454,71 @@ func (m *MockAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, option defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } -// List all of the objects in the mock. -func (m *MockAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { - if m.ListUsableHook != nil { - if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) - return nil, *m.ListError - } - - var objs []*computealpha.UsableSubnetwork - - for _, obj := range m.Objects { - if !fl.Match(obj.ToAlpha()) { - continue - } - alphaObj := obj.ToAlpha() - dest := &computealpha.UsableSubnetwork{} - // Convert to Usable type to avoid separate Usable struct - if err := copyViaJSON(dest, alphaObj); err != nil { - klog.Errorf("Could not convert %T to *computealpha.UsableSubnetwork via JSON: %v", alphaObj, err) - } - objs = append(objs, dest) - } - klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - // Obj wraps the object for use in the mock. -func (m *MockAlphaSubnetworks) Obj(o *computealpha.Subnetwork) *MockSubnetworksObj { - return &MockSubnetworksObj{o} +func (m *MockAlphaTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockTargetHttpProxiesObj { + return &MockTargetHttpProxiesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// SetUrlMap is a mock for the corresponding method. +func (m *MockAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { + if m.SetUrlMapHook != nil { + return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEAlphaSubnetworks is a simplifying adapter for the GCE Subnetworks. -type GCEAlphaSubnetworks struct { +// GCEAlphaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. +type GCEAlphaTargetHttpProxies struct { s *Service } -// Get the Subnetwork named by key. -func (g *GCEAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { +// Get the TargetHttpProxy named by key. +func (g *GCEAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("alpha"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.Subnetworks.Get(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetHttpProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -36990,32 +41526,34 @@ func (g *GCEAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options .. return v, err } -// List all Subnetwork objects. -func (g *GCEAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { +// List all TargetHttpProxy objects. +func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("alpha"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.Subnetworks.List(projectID, region) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.TargetHttpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.Subnetwork - f := func(l *computealpha.SubnetworkList) error { - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.TargetHttpProxy + f := func(l *computealpha.TargetHttpProxyList) error { + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -37023,7 +41561,7 @@ func (g *GCEAlphaSubnetworks) List(ctx context.Context, region string, fl *filte callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -37031,182 +41569,138 @@ func (g *GCEAlphaSubnetworks) List(ctx context.Context, region string, fl *filte g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Subnetwork with key of value obj. -func (g *GCEAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { +// Insert TargetHttpProxy with key of value obj. +func (g *GCEAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("alpha"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.Subnetworks.Insert(projectID, key.Region, obj) + call := g.s.Alpha.TargetHttpProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Subnetwork referenced by key. -func (g *GCEAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpProxy referenced by key. +func (g *GCEAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("alpha"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.Subnetworks.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetHttpProxies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// List all Usable Subnetwork objects. -func (g *GCEAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "ListUsable", - Version: meta.Version("alpha"), - Service: "Subnetworks", - } - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.Subnetworks.ListUsable(projectID) - if fl != filter.None { - call.Filter(fl.String()) - } - var all []*computealpha.UsableSubnetwork - f := func(l *computealpha.UsableSubnetworksAggregatedList) error { - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Patch is a method on GCEAlphaSubnetworks. -func (g *GCEAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { +// SetUrlMap is a method on GCEAlphaTargetHttpProxies. +func (g *GCEAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", + Operation: "SetUrlMap", Version: meta.Version("alpha"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -37214,23 +41708,22 @@ func (g *GCEAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *co callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaSubnetworks is an interface that allows for mocking of Subnetworks. -type BetaSubnetworks interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error +// BetaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. +type BetaTargetHttpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) - Patch(context.Context, *meta.Key, *computebeta.Subnetwork, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockBetaSubnetworks returns a new mock for Subnetworks. -func NewMockBetaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockBetaSubnetworks { - mock := &MockBetaSubnetworks{ +// NewMockBetaTargetHttpProxies returns a new mock for TargetHttpProxies. +func NewMockBetaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockBetaTargetHttpProxies { + mock := &MockBetaTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -37241,33 +41734,31 @@ func NewMockBetaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworks return mock } -// MockBetaSubnetworks is the mock for Subnetworks. -type MockBetaSubnetworks struct { +// MockBetaTargetHttpProxies is the mock for TargetHttpProxies. +type MockBetaTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSubnetworksObj + Objects map[meta.Key]*MockTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - ListUsableError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, *computebeta.Subnetwork, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.Subnetwork, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, m *MockBetaSubnetworks, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, error) - ListUsableHook func(ctx context.Context, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.UsableSubnetwork, error) - PatchHook func(context.Context, *meta.Key, *computebeta.Subnetwork, *MockBetaSubnetworks, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -37275,10 +41766,10 @@ type MockBetaSubnetworks struct { } // Get returns the object from the mock. -func (m *MockBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { +func (m *MockBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -37290,28 +41781,28 @@ func (m *MockBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options .. defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { +// List all of the objects in the mock. +func (m *MockBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -37321,31 +41812,28 @@ func (m *MockBetaSubnetworks) List(ctx context.Context, region string, fl *filte if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.Subnetwork - for key, obj := range m.Objects { - if key.Region != region { - continue - } + var objs []*computebeta.TargetHttpProxy + for _, obj := range m.Objects { if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { +func (m *MockBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -37358,32 +41846,32 @@ func (m *MockBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *co defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaSubnetworks %v exists", key), + Message: fmt.Sprintf("MockBetaTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } - obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "subnetworks") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "subnetworks", key) + obj.Name = key.Name + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockSubnetworksObj{obj} - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -37395,105 +41883,71 @@ func (m *MockBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } -// List all of the objects in the mock. -func (m *MockBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { - if m.ListUsableHook != nil { - if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) - return nil, *m.ListError - } - - var objs []*computebeta.UsableSubnetwork - - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { - continue - } - betaObj := obj.ToBeta() - dest := &computebeta.UsableSubnetwork{} - // Convert to Usable type to avoid separate Usable struct - if err := copyViaJSON(dest, betaObj); err != nil { - klog.Errorf("Could not convert %T to *computebeta.UsableSubnetwork via JSON: %v", betaObj, err) - } - objs = append(objs, dest) - } - klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - // Obj wraps the object for use in the mock. -func (m *MockBetaSubnetworks) Obj(o *computebeta.Subnetwork) *MockSubnetworksObj { - return &MockSubnetworksObj{o} +func (m *MockBetaTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockTargetHttpProxiesObj { + return &MockTargetHttpProxiesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// SetUrlMap is a mock for the corresponding method. +func (m *MockBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { + if m.SetUrlMapHook != nil { + return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEBetaSubnetworks is a simplifying adapter for the GCE Subnetworks. -type GCEBetaSubnetworks struct { +// GCEBetaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. +type GCEBetaTargetHttpProxies struct { s *Service } -// Get the Subnetwork named by key. -func (g *GCEBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { +// Get the TargetHttpProxy named by key. +func (g *GCEBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.Subnetworks.Get(projectID, key.Region, key.Name) + call := g.s.Beta.TargetHttpProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -37501,32 +41955,34 @@ func (g *GCEBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ... return v, err } -// List all Subnetwork objects. -func (g *GCEBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { +// List all TargetHttpProxy objects. +func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.Subnetworks.List(projectID, region) + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.TargetHttpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.Subnetwork - f := func(l *computebeta.SubnetworkList) error { - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.TargetHttpProxy + f := func(l *computebeta.TargetHttpProxyList) error { + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -37534,7 +41990,7 @@ func (g *GCEBetaSubnetworks) List(ctx context.Context, region string, fl *filter callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -37542,182 +41998,138 @@ func (g *GCEBetaSubnetworks) List(ctx context.Context, region string, fl *filter g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Subnetwork with key of value obj. -func (g *GCEBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { +// Insert TargetHttpProxy with key of value obj. +func (g *GCEBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.Subnetworks.Insert(projectID, key.Region, obj) + call := g.s.Beta.TargetHttpProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Subnetwork referenced by key. -func (g *GCEBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpProxy referenced by key. +func (g *GCEBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.Subnetworks.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.TargetHttpProxies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// List all Usable Subnetwork objects. -func (g *GCEBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "ListUsable", - Version: meta.Version("beta"), - Service: "Subnetworks", - } - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.Subnetworks.ListUsable(projectID) - if fl != filter.None { - call.Filter(fl.String()) - } - var all []*computebeta.UsableSubnetwork - f := func(l *computebeta.UsableSubnetworksAggregatedList) error { - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Patch is a method on GCEBetaSubnetworks. -func (g *GCEBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { +// SetUrlMap is a method on GCEBetaTargetHttpProxies. +func (g *GCEBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", + Operation: "SetUrlMap", Version: meta.Version("beta"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -37725,23 +42137,22 @@ func (g *GCEBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *com callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// Subnetworks is an interface that allows for mocking of Subnetworks. -type Subnetworks interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error +// TargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. +type TargetHttpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) - Patch(context.Context, *meta.Key, *computega.Subnetwork, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockSubnetworks returns a new mock for Subnetworks. -func NewMockSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockSubnetworks { - mock := &MockSubnetworks{ +// NewMockTargetHttpProxies returns a new mock for TargetHttpProxies. +func NewMockTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockTargetHttpProxies { + mock := &MockTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -37752,33 +42163,31 @@ func NewMockSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) return mock } -// MockSubnetworks is the mock for Subnetworks. -type MockSubnetworks struct { +// MockTargetHttpProxies is the mock for TargetHttpProxies. +type MockTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSubnetworksObj + Objects map[meta.Key]*MockTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - ListUsableError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, *computega.Subnetwork, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.Subnetwork, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, m *MockSubnetworks, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, error) - ListUsableHook func(ctx context.Context, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.UsableSubnetwork, error) - PatchHook func(context.Context, *meta.Key, *computega.Subnetwork, *MockSubnetworks, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -37786,10 +42195,10 @@ type MockSubnetworks struct { } // Get returns the object from the mock. -func (m *MockSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { +func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -37801,28 +42210,28 @@ func (m *MockSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSubnetworks %v not found", key), + Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { +// List all of the objects in the mock. +func (m *MockTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -37832,31 +42241,28 @@ func (m *MockSubnetworks) List(ctx context.Context, region string, fl *filter.F, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.Subnetwork - for key, obj := range m.Objects { - if key.Region != region { - continue - } + var objs []*computega.TargetHttpProxy + for _, obj := range m.Objects { if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { +func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -37869,32 +42275,32 @@ func (m *MockSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *comput defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockSubnetworks %v exists", key), + Message: fmt.Sprintf("MockTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "subnetworks") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "subnetworks", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockSubnetworksObj{obj} - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -37906,105 +42312,71 @@ func (m *MockSubnetworks) Delete(ctx context.Context, key *meta.Key, options ... defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSubnetworks %v not found", key), + Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } -// List all of the objects in the mock. -func (m *MockSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { - if m.ListUsableHook != nil { - if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) - return nil, *m.ListError - } - - var objs []*computega.UsableSubnetwork - - for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { - continue - } - gaObj := obj.ToGA() - dest := &computega.UsableSubnetwork{} - // Convert to Usable type to avoid separate Usable struct - if err := copyViaJSON(dest, gaObj); err != nil { - klog.Errorf("Could not convert %T to *computega.UsableSubnetwork via JSON: %v", gaObj, err) - } - objs = append(objs, dest) - } - klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - // Obj wraps the object for use in the mock. -func (m *MockSubnetworks) Obj(o *computega.Subnetwork) *MockSubnetworksObj { - return &MockSubnetworksObj{o} +func (m *MockTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockTargetHttpProxiesObj { + return &MockTargetHttpProxiesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// SetUrlMap is a mock for the corresponding method. +func (m *MockTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { + if m.SetUrlMapHook != nil { + return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCESubnetworks is a simplifying adapter for the GCE Subnetworks. -type GCESubnetworks struct { +// GCETargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. +type GCETargetHttpProxies struct { s *Service } -// Get the Subnetwork named by key. -func (g *GCESubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { +// Get the TargetHttpProxy named by key. +func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCESubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Subnetworks.Get(projectID, key.Region, key.Name) + call := g.s.GA.TargetHttpProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCESubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -38012,32 +42384,34 @@ func (g *GCESubnetworks) Get(ctx context.Context, key *meta.Key, options ...Opti return v, err } -// List all Subnetwork objects. -func (g *GCESubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { +// List all TargetHttpProxy objects. +func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.Subnetworks.List(projectID, region) + klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.TargetHttpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.Subnetwork - f := func(l *computega.SubnetworkList) error { - klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetHttpProxy + f := func(l *computega.TargetHttpProxyList) error { + klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -38045,7 +42419,7 @@ func (g *GCESubnetworks) List(ctx context.Context, region string, fl *filter.F, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -38053,182 +42427,138 @@ func (g *GCESubnetworks) List(ctx context.Context, region string, fl *filter.F, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Subnetwork with key of value obj. -func (g *GCESubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { +// Insert TargetHttpProxy with key of value obj. +func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.Subnetworks.Insert(projectID, key.Region, obj) + call := g.s.GA.TargetHttpProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Subnetwork referenced by key. -func (g *GCESubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpProxy referenced by key. +func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "Subnetworks", - } - klog.V(5).Infof("GCESubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.Subnetworks.Delete(projectID, key.Region, key.Name) - - call.Context(ctx) - - op, err := call.Do() - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// List all Usable Subnetwork objects. -func (g *GCESubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "ListUsable", - Version: meta.Version("ga"), - Service: "Subnetworks", - } - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.Subnetworks.ListUsable(projectID) - if fl != filter.None { - call.Filter(fl.String()) + Service: "TargetHttpProxies", + Resource: key, } - var all []*computega.UsableSubnetwork - f := func(l *computega.UsableSubnetworksAggregatedList) error { - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil + klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + call := g.s.GA.TargetHttpProxies.Delete(projectID, key.Name) - klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) + call.Context(ctx) - if kLogEnabled(4) { - klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + return err } - return all, nil + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + return err } -// Patch is a method on GCESubnetworks. -func (g *GCESubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { +// SetUrlMap is a method on GCETargetHttpProxies. +func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", + Operation: "SetUrlMap", Version: meta.Version("ga"), - Service: "Subnetworks", + Service: "TargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -38236,22 +42566,22 @@ func (g *GCESubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *compute callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. -type AlphaTargetHttpProxies interface { +// AlphaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. +type AlphaRegionTargetHttpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockAlphaTargetHttpProxies returns a new mock for TargetHttpProxies. -func NewMockAlphaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockAlphaTargetHttpProxies { - mock := &MockAlphaTargetHttpProxies{ +// NewMockAlphaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. +func NewMockAlphaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockAlphaRegionTargetHttpProxies { + mock := &MockAlphaRegionTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -38262,14 +42592,14 @@ func NewMockAlphaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarg return mock } -// MockAlphaTargetHttpProxies is the mock for TargetHttpProxies. -type MockAlphaTargetHttpProxies struct { +// MockAlphaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. +type MockAlphaRegionTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -38282,11 +42612,11 @@ type MockAlphaTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -38294,10 +42624,10 @@ type MockAlphaTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +func (m *MockAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -38309,28 +42639,28 @@ func (m *MockAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -38340,28 +42670,31 @@ func (m *MockAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opt if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } var objs []*computealpha.TargetHttpProxy - for _, obj := range m.Objects { + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToAlpha()) { continue } objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +func (m *MockAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -38374,15 +42707,15 @@ func (m *MockAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -38390,16 +42723,16 @@ func (m *MockAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -38411,69 +42744,71 @@ func (m *MockAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockTargetHttpProxiesObj { - return &MockTargetHttpProxiesObj{o} +func (m *MockAlphaRegionTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { + return &MockRegionTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +func (m *MockAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEAlphaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. -type GCEAlphaTargetHttpProxies struct { +// GCEAlphaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. +type GCEAlphaRegionTargetHttpProxies struct { s *Service } // Get the TargetHttpProxy named by key. -func (g *GCEAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +func (g *GCEAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.TargetHttpProxies.Get(projectID, key.Name) + call := g.s.Alpha.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -38482,31 +42817,33 @@ func (g *GCEAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opti } // List all TargetHttpProxy objects. -func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.TargetHttpProxies.List(projectID) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionTargetHttpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } var all []*computealpha.TargetHttpProxy f := func(l *computealpha.TargetHttpProxyList) error { - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -38514,7 +42851,7 @@ func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opti callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -38522,132 +42859,138 @@ func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opti g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpProxy with key of value obj. -func (g *GCEAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +func (g *GCEAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.TargetHttpProxies.Insert(projectID, obj) + call := g.s.Alpha.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpProxy referenced by key. -func (g *GCEAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpProxies.Delete(projectID, key.Name) + call := g.s.Alpha.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaTargetHttpProxies. -func (g *GCEAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEAlphaRegionTargetHttpProxies. +func (g *GCEAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Alpha.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -38655,22 +42998,22 @@ func (g *GCEAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. -type BetaTargetHttpProxies interface { +// BetaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. +type BetaRegionTargetHttpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockBetaTargetHttpProxies returns a new mock for TargetHttpProxies. -func NewMockBetaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockBetaTargetHttpProxies { - mock := &MockBetaTargetHttpProxies{ +// NewMockBetaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. +func NewMockBetaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockBetaRegionTargetHttpProxies { + mock := &MockBetaRegionTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -38681,14 +43024,14 @@ func NewMockBetaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarge return mock } -// MockBetaTargetHttpProxies is the mock for TargetHttpProxies. -type MockBetaTargetHttpProxies struct { +// MockBetaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. +type MockBetaRegionTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -38701,11 +43044,11 @@ type MockBetaTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -38713,10 +43056,10 @@ type MockBetaTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +func (m *MockBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -38728,28 +43071,28 @@ func (m *MockBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -38759,28 +43102,31 @@ func (m *MockBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opti if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } var objs []*computebeta.TargetHttpProxy - for _, obj := range m.Objects { + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +func (m *MockBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -38793,15 +43139,15 @@ func (m *MockBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -38809,16 +43155,16 @@ func (m *MockBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, o projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -38830,69 +43176,71 @@ func (m *MockBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockTargetHttpProxiesObj { - return &MockTargetHttpProxiesObj{o} +func (m *MockBetaRegionTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { + return &MockRegionTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +func (m *MockBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEBetaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. -type GCEBetaTargetHttpProxies struct { +// GCEBetaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. +type GCEBetaRegionTargetHttpProxies struct { s *Service } // Get the TargetHttpProxy named by key. -func (g *GCEBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +func (g *GCEBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.TargetHttpProxies.Get(projectID, key.Name) + call := g.s.Beta.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -38901,31 +43249,33 @@ func (g *GCEBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, optio } // List all TargetHttpProxy objects. -func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.TargetHttpProxies.List(projectID) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionTargetHttpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } var all []*computebeta.TargetHttpProxy f := func(l *computebeta.TargetHttpProxyList) error { - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -38933,7 +43283,7 @@ func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, optio callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -38941,132 +43291,138 @@ func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, optio g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpProxy with key of value obj. -func (g *GCEBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +func (g *GCEBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.TargetHttpProxies.Insert(projectID, obj) + call := g.s.Beta.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpProxy referenced by key. -func (g *GCEBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpProxies.Delete(projectID, key.Name) + call := g.s.Beta.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaTargetHttpProxies. -func (g *GCEBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEBetaRegionTargetHttpProxies. +func (g *GCEBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", Version: meta.Version("beta"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Beta.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -39074,22 +43430,22 @@ func (g *GCEBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// TargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. -type TargetHttpProxies interface { +// RegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. +type RegionTargetHttpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockTargetHttpProxies returns a new mock for TargetHttpProxies. -func NewMockTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockTargetHttpProxies { - mock := &MockTargetHttpProxies{ +// NewMockRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. +func NewMockRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockRegionTargetHttpProxies { + mock := &MockRegionTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -39100,14 +43456,14 @@ func NewMockTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHtt return mock } -// MockTargetHttpProxies is the mock for TargetHttpProxies. -type MockTargetHttpProxies struct { +// MockRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. +type MockRegionTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -39120,11 +43476,11 @@ type MockTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -39132,10 +43488,10 @@ type MockTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +func (m *MockRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -39147,28 +43503,28 @@ func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -39178,28 +43534,31 @@ func (m *MockTargetHttpProxies) List(ctx context.Context, fl *filter.F, options if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } var objs []*computega.TargetHttpProxy - for _, obj := range m.Objects { + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +func (m *MockRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -39212,15 +43571,15 @@ func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj * defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockRegionTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -39228,16 +43587,16 @@ func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj * projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -39249,69 +43608,71 @@ func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockTargetHttpProxiesObj { - return &MockTargetHttpProxiesObj{o} +func (m *MockRegionTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { + return &MockRegionTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +func (m *MockRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCETargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. -type GCETargetHttpProxies struct { +// GCERegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. +type GCERegionTargetHttpProxies struct { s *Service } // Get the TargetHttpProxy named by key. -func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +func (g *GCERegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetHttpProxies.Get(projectID, key.Name) + call := g.s.GA.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -39320,31 +43681,33 @@ func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key, options . } // List all TargetHttpProxy objects. -func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.TargetHttpProxies.List(projectID) + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionTargetHttpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } var all []*computega.TargetHttpProxy f := func(l *computega.TargetHttpProxyList) error { - klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -39352,7 +43715,7 @@ func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options . callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -39360,132 +43723,138 @@ func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options . g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpProxy with key of value obj. -func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +func (g *GCERegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.TargetHttpProxies.Insert(projectID, obj) + call := g.s.GA.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpProxy referenced by key. -func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCERegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpProxies.Delete(projectID, key.Name) + call := g.s.GA.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCETargetHttpProxies. -func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCERegionTargetHttpProxies. +func (g *GCERegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", Version: meta.Version("ga"), - Service: "TargetHttpProxies", + Service: "RegionTargetHttpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.GA.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -39493,22 +43862,25 @@ func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. -type AlphaRegionTargetHttpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error +// TargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. +type TargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error + SetCertificateMap(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetSslPolicy(context.Context, *meta.Key, *computega.SslPolicyReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockAlphaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. -func NewMockAlphaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockAlphaRegionTargetHttpProxies { - mock := &MockAlphaRegionTargetHttpProxies{ +// NewMockTargetHttpsProxies returns a new mock for TargetHttpsProxies. +func NewMockTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockTargetHttpsProxies { + mock := &MockTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -39519,14 +43891,14 @@ func NewMockAlphaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*Mo return mock } -// MockAlphaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. -type MockAlphaRegionTargetHttpProxies struct { +// MockTargetHttpsProxies is the mock for TargetHttpsProxies. +type MockTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpProxiesObj + Objects map[meta.Key]*MockTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -39539,11 +43911,14 @@ type MockAlphaRegionTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, error) + SetCertificateMapHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, *MockTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, *MockTargetHttpsProxies, ...Option) error + SetSslPolicyHook func(context.Context, *meta.Key, *computega.SslPolicyReference, *MockTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -39551,10 +43926,10 @@ type MockAlphaRegionTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -39566,28 +43941,28 @@ func (m *MockAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +// List all of the objects in the mock. +func (m *MockTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -39597,31 +43972,28 @@ func (m *MockAlphaRegionTargetHttpProxies) List(ctx context.Context, region stri if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computealpha.TargetHttpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToAlpha()) { + var objs []*computega.TargetHttpsProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -39634,32 +44006,32 @@ func (m *MockAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -39671,69 +44043,95 @@ func (m *MockAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { - return &MockRegionTargetHttpProxiesObj{o} +func (m *MockTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockTargetHttpsProxiesObj { + return &MockTargetHttpsProxiesObj{o} +} + +// SetCertificateMap is a mock for the corresponding method. +func (m *MockTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + if m.SetCertificateMapHook != nil { + return m.SetCertificateMapHook(ctx, key, arg0, m) + } + return nil +} + +// SetSslCertificates is a mock for the corresponding method. +func (m *MockTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + if m.SetSslCertificatesHook != nil { + return m.SetSslCertificatesHook(ctx, key, arg0, m) + } + return nil +} + +// SetSslPolicy is a mock for the corresponding method. +func (m *MockTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { + if m.SetSslPolicyHook != nil { + return m.SetSslPolicyHook(ctx, key, arg0, m) + } + return nil } // SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +func (m *MockTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEAlphaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. -type GCEAlphaRegionTargetHttpProxies struct { +// GCETargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. +type GCETargetHttpsProxies struct { s *Service } -// Get the TargetHttpProxy named by key. -func (g *GCEAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +// Get the TargetHttpsProxy named by key. +func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) + call := g.s.GA.TargetHttpsProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -39741,32 +44139,34 @@ func (g *GCEAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key return v, err } -// List all TargetHttpProxy objects. -func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +// List all TargetHttpsProxy objects. +func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionTargetHttpProxies.List(projectID, region) + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.TargetHttpsProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.TargetHttpProxy - f := func(l *computealpha.TargetHttpProxyList) error { - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetHttpsProxy + f := func(l *computega.TargetHttpsProxyList) error { + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -39774,7 +44174,7 @@ func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region strin callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -39782,132 +44182,270 @@ func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region strin g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpProxy with key of value obj. -func (g *GCEAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +// Insert TargetHttpsProxy with key of value obj. +func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) + call := g.s.GA.TargetHttpsProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpProxy referenced by key. -func (g *GCEAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpsProxy referenced by key. +func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.GA.TargetHttpsProxies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaRegionTargetHttpProxies. -func (g *GCEAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// SetCertificateMap is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetCertificateMap", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetSslCertificates is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslCertificates", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetSslPolicy is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslPolicy", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -39915,22 +44453,26 @@ func (g *GCEAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *me callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. -type BetaRegionTargetHttpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error +// AlphaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. +type AlphaTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error + Patch(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, ...Option) error + SetCertificateMap(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetSslPolicy(context.Context, *meta.Key, *computealpha.SslPolicyReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockBetaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. -func NewMockBetaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockBetaRegionTargetHttpProxies { - mock := &MockBetaRegionTargetHttpProxies{ +// NewMockAlphaTargetHttpsProxies returns a new mock for TargetHttpsProxies. +func NewMockAlphaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockAlphaTargetHttpsProxies { + mock := &MockAlphaTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -39941,14 +44483,14 @@ func NewMockBetaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*Moc return mock } -// MockBetaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. -type MockBetaRegionTargetHttpProxies struct { +// MockAlphaTargetHttpsProxies is the mock for TargetHttpsProxies. +type MockAlphaTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpProxiesObj + Objects map[meta.Key]*MockTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -39961,11 +44503,15 @@ type MockBetaRegionTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, *MockAlphaTargetHttpsProxies, ...Option) error + SetCertificateMapHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, *MockAlphaTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaTargetHttpsProxies, ...Option) error + SetSslPolicyHook func(context.Context, *meta.Key, *computealpha.SslPolicyReference, *MockAlphaTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -39973,10 +44519,10 @@ type MockBetaRegionTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +func (m *MockAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -39988,28 +44534,28 @@ func (m *MockBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +// List all of the objects in the mock. +func (m *MockAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -40019,31 +44565,28 @@ func (m *MockBetaRegionTargetHttpProxies) List(ctx context.Context, region strin if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.TargetHttpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { + var objs []*computealpha.TargetHttpsProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +func (m *MockAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -40056,32 +44599,32 @@ func (m *MockBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -40093,69 +44636,103 @@ func (m *MockBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaRegionTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { - return &MockRegionTargetHttpProxiesObj{o} +func (m *MockAlphaTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockTargetHttpsProxiesObj { + return &MockTargetHttpsProxiesObj{o} +} + +// Patch is a mock for the corresponding method. +func (m *MockAlphaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// SetCertificateMap is a mock for the corresponding method. +func (m *MockAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + if m.SetCertificateMapHook != nil { + return m.SetCertificateMapHook(ctx, key, arg0, m) + } + return nil +} + +// SetSslCertificates is a mock for the corresponding method. +func (m *MockAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + if m.SetSslCertificatesHook != nil { + return m.SetSslCertificatesHook(ctx, key, arg0, m) + } + return nil +} + +// SetSslPolicy is a mock for the corresponding method. +func (m *MockAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { + if m.SetSslPolicyHook != nil { + return m.SetSslPolicyHook(ctx, key, arg0, m) + } + return nil } // SetUrlMap is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +func (m *MockAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEBetaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. -type GCEBetaRegionTargetHttpProxies struct { +// GCEAlphaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. +type GCEAlphaTargetHttpsProxies struct { s *Service } -// Get the TargetHttpProxy named by key. -func (g *GCEBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +// Get the TargetHttpsProxy named by key. +func (g *GCEAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetHttpsProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -40163,32 +44740,34 @@ func (g *GCEBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, return v, err } -// List all TargetHttpProxy objects. -func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +// List all TargetHttpsProxy objects. +func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionTargetHttpProxies.List(projectID, region) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.TargetHttpsProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.TargetHttpProxy - f := func(l *computebeta.TargetHttpProxyList) error { - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.TargetHttpsProxy + f := func(l *computealpha.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -40196,7 +44775,7 @@ func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -40204,132 +44783,314 @@ func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpProxy with key of value obj. -func (g *GCEBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +// Insert TargetHttpsProxy with key of value obj. +func (g *GCEAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) + call := g.s.Alpha.TargetHttpsProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpProxy referenced by key. -func (g *GCEBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpsProxy referenced by key. +func (g *GCEAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetHttpsProxies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaRegionTargetHttpProxies. -func (g *GCEBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// Patch is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.TargetHttpsProxies.Patch(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetCertificateMap is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetCertificateMap", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetSslCertificates is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslCertificates", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetSslPolicy is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslPolicy", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -40337,22 +45098,26 @@ func (g *GCEBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *met callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// RegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. -type RegionTargetHttpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error +// BetaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. +type BetaTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error + Patch(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, ...Option) error + SetCertificateMap(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetSslPolicy(context.Context, *meta.Key, *computebeta.SslPolicyReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. -func NewMockRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockRegionTargetHttpProxies { - mock := &MockRegionTargetHttpProxies{ +// NewMockBetaTargetHttpsProxies returns a new mock for TargetHttpsProxies. +func NewMockBetaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockBetaTargetHttpsProxies { + mock := &MockBetaTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -40363,14 +45128,14 @@ func NewMockRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockReg return mock } -// MockRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. -type MockRegionTargetHttpProxies struct { +// MockBetaTargetHttpsProxies is the mock for TargetHttpsProxies. +type MockBetaTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpProxiesObj + Objects map[meta.Key]*MockTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -40383,11 +45148,15 @@ type MockRegionTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, *MockBetaTargetHttpsProxies, ...Option) error + SetCertificateMapHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, *MockBetaTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, *MockBetaTargetHttpsProxies, ...Option) error + SetSslPolicyHook func(context.Context, *meta.Key, *computebeta.SslPolicyReference, *MockBetaTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -40395,10 +45164,10 @@ type MockRegionTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +func (m *MockBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -40410,28 +45179,28 @@ func (m *MockRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +// List all of the objects in the mock. +func (m *MockBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -40441,31 +45210,28 @@ func (m *MockRegionTargetHttpProxies) List(ctx context.Context, region string, f if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.TargetHttpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToGA()) { + var objs []*computebeta.TargetHttpsProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +func (m *MockBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -40478,32 +45244,32 @@ func (m *MockRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpProxies", key) - - m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) + + m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -40515,69 +45281,103 @@ func (m *MockRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { - return &MockRegionTargetHttpProxiesObj{o} +func (m *MockBetaTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockTargetHttpsProxiesObj { + return &MockTargetHttpsProxiesObj{o} +} + +// Patch is a mock for the corresponding method. +func (m *MockBetaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// SetCertificateMap is a mock for the corresponding method. +func (m *MockBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + if m.SetCertificateMapHook != nil { + return m.SetCertificateMapHook(ctx, key, arg0, m) + } + return nil +} + +// SetSslCertificates is a mock for the corresponding method. +func (m *MockBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + if m.SetSslCertificatesHook != nil { + return m.SetSslCertificatesHook(ctx, key, arg0, m) + } + return nil +} + +// SetSslPolicy is a mock for the corresponding method. +func (m *MockBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { + if m.SetSslPolicyHook != nil { + return m.SetSslPolicyHook(ctx, key, arg0, m) + } + return nil } // SetUrlMap is a mock for the corresponding method. -func (m *MockRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +func (m *MockBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCERegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. -type GCERegionTargetHttpProxies struct { +// GCEBetaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. +type GCEBetaTargetHttpsProxies struct { s *Service } -// Get the TargetHttpProxy named by key. -func (g *GCERegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +// Get the TargetHttpsProxy named by key. +func (g *GCEBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) + call := g.s.Beta.TargetHttpsProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -40585,32 +45385,34 @@ func (g *GCERegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opt return v, err } -// List all TargetHttpProxy objects. -func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +// List all TargetHttpsProxy objects. +func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionTargetHttpProxies.List(projectID, region) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.TargetHttpsProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetHttpProxy - f := func(l *computega.TargetHttpProxyList) error { - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.TargetHttpsProxy + f := func(l *computebeta.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -40618,7 +45420,7 @@ func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -40626,132 +45428,314 @@ func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpProxy with key of value obj. -func (g *GCERegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +// Insert TargetHttpsProxy with key of value obj. +func (g *GCEBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) + call := g.s.Beta.TargetHttpsProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpProxy referenced by key. -func (g *GCERegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpsProxy referenced by key. +func (g *GCEBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.TargetHttpsProxies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCERegionTargetHttpProxies. -func (g *GCERegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// Patch is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.TargetHttpsProxies.Patch(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetCertificateMap is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetCertificateMap", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetSslCertificates is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslCertificates", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetSslPolicy is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslPolicy", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, + } + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -40759,25 +45743,24 @@ func (g *GCERegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Ke callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// TargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. -type TargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error +// AlphaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. +type AlphaRegionTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetCertificateMap(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetSslPolicy(context.Context, *meta.Key, *computega.SslPolicyReference, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error + Patch(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockTargetHttpsProxies returns a new mock for TargetHttpsProxies. -func NewMockTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockTargetHttpsProxies { - mock := &MockTargetHttpsProxies{ +// NewMockAlphaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. +func NewMockAlphaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockAlphaRegionTargetHttpsProxies { + mock := &MockAlphaRegionTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -40788,14 +45771,14 @@ func NewMockTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHt return mock } -// MockTargetHttpsProxies is the mock for TargetHttpsProxies. -type MockTargetHttpsProxies struct { +// MockAlphaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. +type MockAlphaRegionTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpsProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -40808,14 +45791,13 @@ type MockTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, error) - SetCertificateMapHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, *MockTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, *MockTargetHttpsProxies, ...Option) error - SetSslPolicyHook func(context.Context, *meta.Key, *computega.SslPolicyReference, *MockTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, *MockAlphaRegionTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaRegionTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -40823,10 +45805,10 @@ type MockTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +func (m *MockAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -40838,28 +45820,28 @@ func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -40869,28 +45851,31 @@ func (m *MockTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.TargetHttpsProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { + var objs []*computealpha.TargetHttpsProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToGA()) + if !fl.Match(obj.ToAlpha()) { + continue + } + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +func (m *MockAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -40903,32 +45888,32 @@ func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -40940,93 +45925,87 @@ func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockTargetHttpsProxiesObj { - return &MockTargetHttpsProxiesObj{o} +func (m *MockAlphaRegionTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { + return &MockRegionTargetHttpsProxiesObj{o} } -// SetCertificateMap is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - if m.SetCertificateMapHook != nil { - return m.SetCertificateMapHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } // SetSslCertificates is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +func (m *MockAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { if m.SetSslCertificatesHook != nil { return m.SetSslCertificatesHook(ctx, key, arg0, m) } return nil } -// SetSslPolicy is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { - if m.SetSslPolicyHook != nil { - return m.SetSslPolicyHook(ctx, key, arg0, m) - } - return nil -} - // SetUrlMap is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +func (m *MockAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCETargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. -type GCETargetHttpsProxies struct { +// GCEAlphaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. +type GCEAlphaRegionTargetHttpsProxies struct { s *Service } // Get the TargetHttpsProxy named by key. -func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +func (g *GCEAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetHttpsProxies.Get(projectID, key.Name) + call := g.s.Alpha.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -41035,31 +46014,33 @@ func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options } // List all TargetHttpsProxy objects. -func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.TargetHttpsProxies.List(projectID) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionTargetHttpsProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetHttpsProxy - f := func(l *computega.TargetHttpsProxyList) error { - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.TargetHttpsProxy + f := func(l *computealpha.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -41067,7 +46048,7 @@ func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -41075,132 +46056,138 @@ func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpsProxy with key of value obj. -func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +func (g *GCEAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.TargetHttpsProxies.Insert(projectID, obj) + call := g.s.Alpha.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpsProxy referenced by key. -func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpsProxies.Delete(projectID, key.Name) + call := g.s.Alpha.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetCertificateMap is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { +// Patch is a method on GCEAlphaRegionTargetHttpsProxies. +func (g *GCEAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetCertificateMap", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) + call := g.s.Alpha.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -41208,83 +46195,43 @@ func (g *GCETargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetSslCertificates is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +// SetSslCertificates is a method on GCEAlphaRegionTargetHttpsProxies. +func (g *GCEAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetSslCertificates", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - } - klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslPolicy is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslPolicy", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call := g.s.Alpha.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -41292,41 +46239,43 @@ func (g *GCETargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetUrlMap is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEAlphaRegionTargetHttpsProxies. +func (g *GCEAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Alpha.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -41334,25 +46283,24 @@ func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, ar callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. -type AlphaTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error +// BetaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. +type BetaRegionTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetCertificateMap(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetSslPolicy(context.Context, *meta.Key, *computealpha.SslPolicyReference, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error + Patch(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockAlphaTargetHttpsProxies returns a new mock for TargetHttpsProxies. -func NewMockAlphaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockAlphaTargetHttpsProxies { - mock := &MockAlphaTargetHttpsProxies{ +// NewMockBetaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. +func NewMockBetaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockBetaRegionTargetHttpsProxies { + mock := &MockBetaRegionTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -41363,14 +46311,14 @@ func NewMockAlphaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTar return mock } -// MockAlphaTargetHttpsProxies is the mock for TargetHttpsProxies. -type MockAlphaTargetHttpsProxies struct { +// MockBetaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. +type MockBetaRegionTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpsProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -41383,14 +46331,13 @@ type MockAlphaTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) - SetCertificateMapHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, *MockAlphaTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaTargetHttpsProxies, ...Option) error - SetSslPolicyHook func(context.Context, *meta.Key, *computealpha.SslPolicyReference, *MockAlphaTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, *MockBetaRegionTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockBetaRegionTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -41398,10 +46345,10 @@ type MockAlphaTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +func (m *MockBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -41413,28 +46360,28 @@ func (m *MockAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -41444,28 +46391,31 @@ func (m *MockAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, op if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.TargetHttpsProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToAlpha()) { + var objs []*computebeta.TargetHttpsProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToAlpha()) + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +func (m *MockBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -41478,32 +46428,32 @@ func (m *MockAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -41515,93 +46465,87 @@ func (m *MockAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockTargetHttpsProxiesObj { - return &MockTargetHttpsProxiesObj{o} +func (m *MockBetaRegionTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { + return &MockRegionTargetHttpsProxiesObj{o} } -// SetCertificateMap is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - if m.SetCertificateMapHook != nil { - return m.SetCertificateMapHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } // SetSslCertificates is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +func (m *MockBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { if m.SetSslCertificatesHook != nil { return m.SetSslCertificatesHook(ctx, key, arg0, m) } return nil } -// SetSslPolicy is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { - if m.SetSslPolicyHook != nil { - return m.SetSslPolicyHook(ctx, key, arg0, m) - } - return nil -} - // SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +func (m *MockBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEAlphaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. -type GCEAlphaTargetHttpsProxies struct { +// GCEBetaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. +type GCEBetaRegionTargetHttpsProxies struct { s *Service } // Get the TargetHttpsProxy named by key. -func (g *GCEAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +func (g *GCEBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.TargetHttpsProxies.Get(projectID, key.Name) + call := g.s.Beta.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -41610,31 +46554,33 @@ func (g *GCEAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, opt } // List all TargetHttpsProxy objects. -func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.TargetHttpsProxies.List(projectID) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionTargetHttpsProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.TargetHttpsProxy - f := func(l *computealpha.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.TargetHttpsProxy + f := func(l *computebeta.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -41642,7 +46588,7 @@ func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opt callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -41650,132 +46596,138 @@ func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opt g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpsProxy with key of value obj. -func (g *GCEAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +func (g *GCEBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.TargetHttpsProxies.Insert(projectID, obj) + call := g.s.Beta.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpsProxy referenced by key. -func (g *GCEAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpsProxies.Delete(projectID, key.Name) + call := g.s.Beta.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetCertificateMap is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { +// Patch is a method on GCEBetaRegionTargetHttpsProxies. +func (g *GCEBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetCertificateMap", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", + Operation: "Patch", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) + call := g.s.Beta.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -41783,83 +46735,43 @@ func (g *GCEAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetSslCertificates is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +// SetSslCertificates is a method on GCEBetaRegionTargetHttpsProxies. +func (g *GCEBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetSslCertificates", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslPolicy is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslPolicy", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call := g.s.Beta.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -41867,41 +46779,43 @@ func (g *GCEAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEBetaRegionTargetHttpsProxies. +func (g *GCEBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Beta.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -41909,25 +46823,24 @@ func (g *GCEAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Ke callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. -type BetaTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error +// RegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. +type RegionTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetCertificateMap(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetSslPolicy(context.Context, *meta.Key, *computebeta.SslPolicyReference, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error + Patch(context.Context, *meta.Key, *computega.TargetHttpsProxy, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockBetaTargetHttpsProxies returns a new mock for TargetHttpsProxies. -func NewMockBetaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockBetaTargetHttpsProxies { - mock := &MockBetaTargetHttpsProxies{ +// NewMockRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. +func NewMockRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockRegionTargetHttpsProxies { + mock := &MockRegionTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -41938,14 +46851,14 @@ func NewMockBetaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTarg return mock } -// MockBetaTargetHttpsProxies is the mock for TargetHttpsProxies. -type MockBetaTargetHttpsProxies struct { +// MockRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. +type MockRegionTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpsProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -41958,14 +46871,13 @@ type MockBetaTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) - SetCertificateMapHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, *MockBetaTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, *MockBetaTargetHttpsProxies, ...Option) error - SetSslPolicyHook func(context.Context, *meta.Key, *computebeta.SslPolicyReference, *MockBetaTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computega.TargetHttpsProxy, *MockRegionTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockRegionTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -41973,10 +46885,10 @@ type MockBetaTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +func (m *MockRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -41988,28 +46900,28 @@ func (m *MockBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -42019,28 +46931,31 @@ func (m *MockBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opt if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.TargetHttpsProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { + var objs []*computega.TargetHttpsProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToBeta()) + if !fl.Match(obj.ToGA()) { + continue + } + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +func (m *MockRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -42053,32 +46968,32 @@ func (m *MockBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -42090,93 +47005,87 @@ func (m *MockBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockTargetHttpsProxiesObj { - return &MockTargetHttpsProxiesObj{o} +func (m *MockRegionTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { + return &MockRegionTargetHttpsProxiesObj{o} } -// SetCertificateMap is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - if m.SetCertificateMapHook != nil { - return m.SetCertificateMapHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } // SetSslCertificates is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +func (m *MockRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { if m.SetSslCertificatesHook != nil { return m.SetSslCertificatesHook(ctx, key, arg0, m) } return nil } -// SetSslPolicy is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { - if m.SetSslPolicyHook != nil { - return m.SetSslPolicyHook(ctx, key, arg0, m) - } - return nil -} - // SetUrlMap is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +func (m *MockRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEBetaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. -type GCEBetaTargetHttpsProxies struct { +// GCERegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. +type GCERegionTargetHttpsProxies struct { s *Service } // Get the TargetHttpsProxy named by key. -func (g *GCEBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +func (g *GCERegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.TargetHttpsProxies.Get(projectID, key.Name) + call := g.s.GA.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -42185,31 +47094,33 @@ func (g *GCEBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, opti } // List all TargetHttpsProxy objects. -func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.TargetHttpsProxies.List(projectID) + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionTargetHttpsProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.TargetHttpsProxy - f := func(l *computebeta.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetHttpsProxy + f := func(l *computega.TargetHttpsProxyList) error { + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -42217,7 +47128,7 @@ func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opti callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -42225,132 +47136,138 @@ func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opti g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpsProxy with key of value obj. -func (g *GCEBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +func (g *GCERegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.TargetHttpsProxies.Insert(projectID, obj) + call := g.s.GA.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpsProxy referenced by key. -func (g *GCEBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCERegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpsProxies.Delete(projectID, key.Name) + call := g.s.GA.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetCertificateMap is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { +// Patch is a method on GCERegionTargetHttpsProxies. +func (g *GCERegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetCertificateMap", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", + Operation: "Patch", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) + call := g.s.GA.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -42358,83 +47275,43 @@ func (g *GCEBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key * callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetSslCertificates is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +// SetSslCertificates is a method on GCERegionTargetHttpsProxies. +func (g *GCERegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetSslCertificates", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslPolicy is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslPolicy", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call := g.s.GA.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -42442,41 +47319,43 @@ func (g *GCEBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta. callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCERegionTargetHttpsProxies. +func (g *GCERegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.GA.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -42484,24 +47363,23 @@ func (g *GCEBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. -type AlphaRegionTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error +// TargetPools is an interface that allows for mocking of TargetPools. +type TargetPools interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error + AddInstance(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, ...Option) error + RemoveInstance(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, ...Option) error } -// NewMockAlphaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. -func NewMockAlphaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockAlphaRegionTargetHttpsProxies { - mock := &MockAlphaRegionTargetHttpsProxies{ +// NewMockTargetPools returns a new mock for TargetPools. +func NewMockTargetPools(pr ProjectRouter, objs map[meta.Key]*MockTargetPoolsObj) *MockTargetPools { + mock := &MockTargetPools{ ProjectRouter: pr, Objects: objs, @@ -42512,14 +47390,14 @@ func NewMockAlphaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*M return mock } -// MockAlphaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. -type MockAlphaRegionTargetHttpsProxies struct { +// MockTargetPools is the mock for TargetPools. +type MockTargetPools struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj + Objects map[meta.Key]*MockTargetPoolsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -42532,13 +47410,12 @@ type MockAlphaRegionTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, *MockAlphaRegionTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaRegionTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, *computega.TargetPool, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockTargetPools, options ...Option) (bool, []*computega.TargetPool, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetPool, m *MockTargetPools, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, error) + AddInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, *MockTargetPools, ...Option) error + RemoveInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, *MockTargetPools, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -42546,10 +47423,10 @@ type MockAlphaRegionTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -42561,28 +47438,28 @@ func (m *MockAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockTargetPools %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +func (m *MockTargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -42592,31 +47469,31 @@ func (m *MockAlphaRegionTargetHttpsProxies) List(ctx context.Context, region str if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.TargetHttpsProxy + var objs []*computega.TargetPool for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToAlpha()) { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -42629,32 +47506,32 @@ func (m *MockAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *met defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockTargetPools %v exists", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetPools") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetPools", key) - m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetPoolsObj{obj} + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -42666,85 +47543,79 @@ func (m *MockAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *met defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockTargetPools %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { - return &MockRegionTargetHttpsProxiesObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil +func (m *MockTargetPools) Obj(o *computega.TargetPool) *MockTargetPoolsObj { + return &MockTargetPoolsObj{o} } -// SetSslCertificates is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - if m.SetSslCertificatesHook != nil { - return m.SetSslCertificatesHook(ctx, key, arg0, m) +// AddInstance is a mock for the corresponding method. +func (m *MockTargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { + if m.AddInstanceHook != nil { + return m.AddInstanceHook(ctx, key, arg0, m) } return nil } -// SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { - if m.SetUrlMapHook != nil { - return m.SetUrlMapHook(ctx, key, arg0, m) +// RemoveInstance is a mock for the corresponding method. +func (m *MockTargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { + if m.RemoveInstanceHook != nil { + return m.RemoveInstanceHook(ctx, key, arg0, m) } return nil } -// GCEAlphaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. -type GCEAlphaRegionTargetHttpsProxies struct { +// GCETargetPools is a simplifying adapter for the GCE TargetPools. +type GCETargetPools struct { s *Service } -// Get the TargetHttpsProxy named by key. -func (g *GCEAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +// Get the TargetPool named by key. +func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetPools.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetPools.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("ga"), + Service: "TargetPools", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) + call := g.s.GA.TargetPools.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetPools.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -42752,32 +47623,34 @@ func (g *GCEAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Ke return v, err } -// List all TargetHttpsProxy objects. -func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +// List all TargetPool objects. +func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + klog.V(5).Infof("GCETargetPools.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("ga"), + Service: "TargetPools", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionTargetHttpsProxies.List(projectID, region) + klog.V(5).Infof("GCETargetPools.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.TargetPools.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.TargetHttpsProxy - f := func(l *computealpha.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetPool + f := func(l *computega.TargetPoolList) error { + klog.V(5).Infof("GCETargetPools.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -42785,7 +47658,7 @@ func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region stri callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -42793,174 +47666,138 @@ func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region stri g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpsProxy with key of value obj. -func (g *GCEAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +// Insert TargetPool with key of value obj. +func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetPools.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetPools.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("ga"), + Service: "TargetPools", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) + call := g.s.GA.TargetPools.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCETargetPools.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpsProxy referenced by key. -func (g *GCEAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetPool referenced by key. +func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetPools.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetPools.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("ga"), + Service: "TargetPools", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) + call := g.s.GA.TargetPools.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// Patch is a method on GCEAlphaRegionTargetHttpsProxies. -func (g *GCEAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetSslCertificates is a method on GCEAlphaRegionTargetHttpsProxies. -func (g *GCEAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +// AddInstance is a method on GCETargetPools. +func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetSslCertificates", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", + Operation: "AddInstance", + Version: meta.Version("ga"), + Service: "TargetPools", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetPools.AddInstance(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -42968,41 +47805,43 @@ func (g *GCEAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Contex callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaRegionTargetHttpsProxies. -func (g *GCEAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// RemoveInstance is a method on GCETargetPools. +func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetUrlMap", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", + Operation: "RemoveInstance", + Version: meta.Version("ga"), + Service: "TargetPools", + Resource: key, } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetPools.RemoveInstance(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -43010,24 +47849,22 @@ func (g *GCEAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *m callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. -type BetaRegionTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error +// AlphaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. +type AlphaTargetTcpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error + SetBackendService(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockBetaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. -func NewMockBetaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockBetaRegionTargetHttpsProxies { - mock := &MockBetaRegionTargetHttpsProxies{ +// NewMockAlphaTargetTcpProxies returns a new mock for TargetTcpProxies. +func NewMockAlphaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockAlphaTargetTcpProxies { + mock := &MockAlphaTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -43038,14 +47875,14 @@ func NewMockBetaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*Mo return mock } -// MockBetaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. -type MockBetaRegionTargetHttpsProxies struct { +// MockAlphaTargetTcpProxies is the mock for TargetTcpProxies. +type MockAlphaTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj + Objects map[meta.Key]*MockTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -43058,13 +47895,11 @@ type MockBetaRegionTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, *MockBetaRegionTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockBetaRegionTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, *computealpha.TargetTcpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetTcpProxies, options ...Option) (bool, []*computealpha.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) + SetBackendServiceHook func(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, *MockAlphaTargetTcpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -43072,10 +47907,10 @@ type MockBetaRegionTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +func (m *MockAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -43087,28 +47922,28 @@ func (m *MockBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +// List all of the objects in the mock. +func (m *MockAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -43118,31 +47953,28 @@ func (m *MockBetaRegionTargetHttpsProxies) List(ctx context.Context, region stri if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.TargetHttpsProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { + var objs []*computealpha.TargetTcpProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +func (m *MockAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -43155,32 +47987,32 @@ func (m *MockBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetTcpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -43192,85 +48024,71 @@ func (m *MockBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaRegionTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { - return &MockRegionTargetHttpsProxiesObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslCertificates is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - if m.SetSslCertificatesHook != nil { - return m.SetSslCertificatesHook(ctx, key, arg0, m) - } - return nil +func (m *MockAlphaTargetTcpProxies) Obj(o *computealpha.TargetTcpProxy) *MockTargetTcpProxiesObj { + return &MockTargetTcpProxiesObj{o} } -// SetUrlMap is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { - if m.SetUrlMapHook != nil { - return m.SetUrlMapHook(ctx, key, arg0, m) +// SetBackendService is a mock for the corresponding method. +func (m *MockAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + if m.SetBackendServiceHook != nil { + return m.SetBackendServiceHook(ctx, key, arg0, m) } return nil } -// GCEBetaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. -type GCEBetaRegionTargetHttpsProxies struct { +// GCEAlphaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. +type GCEAlphaTargetTcpProxies struct { s *Service } -// Get the TargetHttpsProxy named by key. -func (g *GCEBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +// Get the TargetTcpProxy named by key. +func (g *GCEAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetTcpProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -43278,32 +48096,34 @@ func (g *GCEBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key return v, err } -// List all TargetHttpsProxy objects. -func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +// List all TargetTcpProxy objects. +func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "TargetTcpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionTargetHttpsProxies.List(projectID, region) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.TargetTcpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.TargetHttpsProxy - f := func(l *computebeta.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.TargetTcpProxy + f := func(l *computealpha.TargetTcpProxyList) error { + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -43311,7 +48131,7 @@ func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region strin callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -43319,216 +48139,138 @@ func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region strin g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpsProxy with key of value obj. -func (g *GCEBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +// Insert TargetTcpProxy with key of value obj. +func (g *GCEAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) + call := g.s.Alpha.TargetTcpProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpsProxy referenced by key. -func (g *GCEBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetTcpProxy referenced by key. +func (g *GCEAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("alpha"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetTcpProxies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// Patch is a method on GCEBetaRegionTargetHttpsProxies. -func (g *GCEBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslCertificates is a method on GCEBetaRegionTargetHttpsProxies. -func (g *GCEBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslCertificates", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaRegionTargetHttpsProxies. -func (g *GCEBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// SetBackendService is a method on GCEAlphaTargetTcpProxies. +func (g *GCEAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetUrlMap", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", + Operation: "SetBackendService", + Version: meta.Version("alpha"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -43536,24 +48278,22 @@ func (g *GCEBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *me callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } -// RegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. -type RegionTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error +// BetaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. +type BetaTargetTcpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computega.TargetHttpsProxy, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error + SetBackendService(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. -func NewMockRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockRegionTargetHttpsProxies { - mock := &MockRegionTargetHttpsProxies{ +// NewMockBetaTargetTcpProxies returns a new mock for TargetTcpProxies. +func NewMockBetaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockBetaTargetTcpProxies { + mock := &MockBetaTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -43564,14 +48304,14 @@ func NewMockRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRe return mock } -// MockRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. -type MockRegionTargetHttpsProxies struct { +// MockBetaTargetTcpProxies is the mock for TargetTcpProxies. +type MockBetaTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj + Objects map[meta.Key]*MockTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -43584,13 +48324,11 @@ type MockRegionTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computega.TargetHttpsProxy, *MockRegionTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockRegionTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, *computebeta.TargetTcpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetTcpProxies, options ...Option) (bool, []*computebeta.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) + SetBackendServiceHook func(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, *MockBetaTargetTcpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -43598,10 +48336,10 @@ type MockRegionTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +func (m *MockBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -43613,28 +48351,28 @@ func (m *MockRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +// List all of the objects in the mock. +func (m *MockBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -43644,31 +48382,28 @@ func (m *MockRegionTargetHttpsProxies) List(ctx context.Context, region string, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.TargetHttpsProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToGA()) { + var objs []*computebeta.TargetTcpProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +func (m *MockBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -43681,32 +48416,32 @@ func (m *MockRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockBetaTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetTcpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -43718,85 +48453,71 @@ func (m *MockRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { - return &MockRegionTargetHttpsProxiesObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslCertificates is a mock for the corresponding method. -func (m *MockRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - if m.SetSslCertificatesHook != nil { - return m.SetSslCertificatesHook(ctx, key, arg0, m) - } - return nil +func (m *MockBetaTargetTcpProxies) Obj(o *computebeta.TargetTcpProxy) *MockTargetTcpProxiesObj { + return &MockTargetTcpProxiesObj{o} } -// SetUrlMap is a mock for the corresponding method. -func (m *MockRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { - if m.SetUrlMapHook != nil { - return m.SetUrlMapHook(ctx, key, arg0, m) +// SetBackendService is a mock for the corresponding method. +func (m *MockBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + if m.SetBackendServiceHook != nil { + return m.SetBackendServiceHook(ctx, key, arg0, m) } return nil } -// GCERegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. -type GCERegionTargetHttpsProxies struct { +// GCEBetaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. +type GCEBetaTargetTcpProxies struct { s *Service } -// Get the TargetHttpsProxy named by key. -func (g *GCERegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +// Get the TargetTcpProxy named by key. +func (g *GCEBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("beta"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) + call := g.s.Beta.TargetTcpProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -43804,32 +48525,34 @@ func (g *GCERegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, op return v, err } -// List all TargetHttpsProxy objects. -func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +// List all TargetTcpProxy objects. +func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("beta"), + Service: "TargetTcpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionTargetHttpsProxies.List(projectID, region) + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.TargetTcpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetHttpsProxy - f := func(l *computega.TargetHttpsProxyList) error { - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.TargetTcpProxy + f := func(l *computebeta.TargetTcpProxyList) error { + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -43837,7 +48560,7 @@ func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, f callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -43845,216 +48568,138 @@ func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, f g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpsProxy with key of value obj. -func (g *GCERegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +// Insert TargetTcpProxy with key of value obj. +func (g *GCEBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("beta"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) + call := g.s.Beta.TargetTcpProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpsProxy referenced by key. -func (g *GCERegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetTcpProxy referenced by key. +func (g *GCEBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", + Version: meta.Version("beta"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.TargetTcpProxies.Delete(projectID, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// Patch is a method on GCERegionTargetHttpsProxies. -func (g *GCERegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslCertificates is a method on GCERegionTargetHttpsProxies. -func (g *GCERegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslCertificates", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - } - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCERegionTargetHttpsProxies. -func (g *GCERegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// SetBackendService is a method on GCEBetaTargetTcpProxies. +func (g *GCEBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetUrlMap", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", + Operation: "SetBackendService", + Version: meta.Version("beta"), + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -44062,23 +48707,22 @@ func (g *GCERegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.K callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } -// TargetPools is an interface that allows for mocking of TargetPools. -type TargetPools interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error +// TargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. +type TargetTcpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AddInstance(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, ...Option) error - RemoveInstance(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, ...Option) error + SetBackendService(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockTargetPools returns a new mock for TargetPools. -func NewMockTargetPools(pr ProjectRouter, objs map[meta.Key]*MockTargetPoolsObj) *MockTargetPools { - mock := &MockTargetPools{ +// NewMockTargetTcpProxies returns a new mock for TargetTcpProxies. +func NewMockTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockTargetTcpProxies { + mock := &MockTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -44089,14 +48733,14 @@ func NewMockTargetPools(pr ProjectRouter, objs map[meta.Key]*MockTargetPoolsObj) return mock } -// MockTargetPools is the mock for TargetPools. -type MockTargetPools struct { +// MockTargetTcpProxies is the mock for TargetTcpProxies. +type MockTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetPoolsObj + Objects map[meta.Key]*MockTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -44109,12 +48753,11 @@ type MockTargetPools struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, *computega.TargetPool, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockTargetPools, options ...Option) (bool, []*computega.TargetPool, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetPool, m *MockTargetPools, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, error) - AddInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, *MockTargetPools, ...Option) error - RemoveInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, *MockTargetPools, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, *computega.TargetTcpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockTargetTcpProxies, options ...Option) (bool, []*computega.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, m *MockTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, error) + SetBackendServiceHook func(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, *MockTargetTcpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -44122,10 +48765,10 @@ type MockTargetPools struct { } // Get returns the object from the mock. -func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { +func (m *MockTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -44137,28 +48780,28 @@ func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key, options ...Opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetPools %v not found", key), + Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockTargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { +// List all of the objects in the mock. +func (m *MockTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -44168,31 +48811,28 @@ func (m *MockTargetPools) List(ctx context.Context, region string, fl *filter.F, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.TargetPool - for key, obj := range m.Objects { - if key.Region != region { - continue - } + var objs []*computega.TargetTcpProxy + for _, obj := range m.Objects { if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { +func (m *MockTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -44205,32 +48845,32 @@ func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *comput defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetPools %v exists", key), + Message: fmt.Sprintf("MockTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetPools") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetPools", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetTcpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockTargetPoolsObj{obj} - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -44242,77 +48882,71 @@ func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key, options ... defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetPools %v not found", key), + Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockTargetPools) Obj(o *computega.TargetPool) *MockTargetPoolsObj { - return &MockTargetPoolsObj{o} -} - -// AddInstance is a mock for the corresponding method. -func (m *MockTargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { - if m.AddInstanceHook != nil { - return m.AddInstanceHook(ctx, key, arg0, m) - } - return nil +func (m *MockTargetTcpProxies) Obj(o *computega.TargetTcpProxy) *MockTargetTcpProxiesObj { + return &MockTargetTcpProxiesObj{o} } -// RemoveInstance is a mock for the corresponding method. -func (m *MockTargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { - if m.RemoveInstanceHook != nil { - return m.RemoveInstanceHook(ctx, key, arg0, m) +// SetBackendService is a mock for the corresponding method. +func (m *MockTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + if m.SetBackendServiceHook != nil { + return m.SetBackendServiceHook(ctx, key, arg0, m) } return nil } -// GCETargetPools is a simplifying adapter for the GCE TargetPools. -type GCETargetPools struct { +// GCETargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. +type GCETargetTcpProxies struct { s *Service } -// Get the TargetPool named by key. -func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { +// Get the TargetTcpProxy named by key. +func (g *GCETargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "TargetPools", + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetPools.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetPools.Get(projectID, key.Region, key.Name) + call := g.s.GA.TargetTcpProxies.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetPools.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -44320,32 +48954,34 @@ func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key, options ...Opti return v, err } -// List all TargetPool objects. -func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { +// List all TargetTcpProxy objects. +func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "TargetPools", + Service: "TargetTcpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetPools.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.TargetPools.List(projectID, region) + klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.TargetTcpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetPool - f := func(l *computega.TargetPoolList) error { - klog.V(5).Infof("GCETargetPools.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetTcpProxy + f := func(l *computega.TargetTcpProxyList) error { + klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -44353,7 +48989,7 @@ func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -44361,174 +48997,138 @@ func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetPool with key of value obj. -func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { +// Insert TargetTcpProxy with key of value obj. +func (g *GCETargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "TargetPools", - } - klog.V(5).Infof("GCETargetPools.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - obj.Name = key.Name - call := g.s.GA.TargetPools.Insert(projectID, key.Region, obj) - call.Context(ctx) - - op, err := call.Do() - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...) = %+v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetPools.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err -} - -// Delete the TargetPool referenced by key. -func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.Delete(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCETargetPools.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Delete", - Version: meta.Version("ga"), - Service: "TargetPools", + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetPools.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetPools.Delete(projectID, key.Region, key.Name) - + obj.Name = key.Name + call := g.s.GA.TargetTcpProxies.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// AddInstance is a method on GCETargetPools. -func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { +// Delete the TargetTcpProxy referenced by key. +func (g *GCETargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): called", ctx, key, opts) - + klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AddInstance", + Operation: "Delete", Version: meta.Version("ga"), - Service: "TargetPools", + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetPools.AddInstance(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetTcpProxies.Delete(projectID, key.Name) + call.Context(ctx) + + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) + if err != nil { return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// RemoveInstance is a method on GCETargetPools. -func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { +// SetBackendService is a method on GCETargetTcpProxies. +func (g *GCETargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "RemoveInstance", + Operation: "SetBackendService", Version: meta.Version("ga"), - Service: "TargetPools", + Service: "TargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetPools.RemoveInstance(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -44536,22 +49136,21 @@ func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. -type AlphaTargetTcpProxies interface { +// AlphaRegionTargetTcpProxies is an interface that allows for mocking of RegionTargetTcpProxies. +type AlphaRegionTargetTcpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetBackendService(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockAlphaTargetTcpProxies returns a new mock for TargetTcpProxies. -func NewMockAlphaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockAlphaTargetTcpProxies { - mock := &MockAlphaTargetTcpProxies{ +// NewMockAlphaRegionTargetTcpProxies returns a new mock for RegionTargetTcpProxies. +func NewMockAlphaRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetTcpProxiesObj) *MockAlphaRegionTargetTcpProxies { + mock := &MockAlphaRegionTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -44562,14 +49161,14 @@ func NewMockAlphaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarge return mock } -// MockAlphaTargetTcpProxies is the mock for TargetTcpProxies. -type MockAlphaTargetTcpProxies struct { +// MockAlphaRegionTargetTcpProxies is the mock for RegionTargetTcpProxies. +type MockAlphaRegionTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetTcpProxiesObj + Objects map[meta.Key]*MockRegionTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -44582,11 +49181,10 @@ type MockAlphaTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, *computealpha.TargetTcpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetTcpProxies, options ...Option) (bool, []*computealpha.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) - SetBackendServiceHook func(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, *MockAlphaTargetTcpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, *computealpha.TargetTcpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, []*computealpha.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -44594,10 +49192,10 @@ type MockAlphaTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { +func (m *MockAlphaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -44609,28 +49207,28 @@ func (m *MockAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -44640,28 +49238,31 @@ func (m *MockAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, opti if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } var objs []*computealpha.TargetTcpProxy - for _, obj := range m.Objects { + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToAlpha()) { continue } objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { +func (m *MockAlphaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -44674,15 +49275,15 @@ func (m *MockAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaRegionTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -44690,16 +49291,16 @@ func (m *MockAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, o projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetTcpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -44711,69 +49312,63 @@ func (m *MockAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaTargetTcpProxies) Obj(o *computealpha.TargetTcpProxy) *MockTargetTcpProxiesObj { - return &MockTargetTcpProxiesObj{o} -} - -// SetBackendService is a mock for the corresponding method. -func (m *MockAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - if m.SetBackendServiceHook != nil { - return m.SetBackendServiceHook(ctx, key, arg0, m) - } - return nil +func (m *MockAlphaRegionTargetTcpProxies) Obj(o *computealpha.TargetTcpProxy) *MockRegionTargetTcpProxiesObj { + return &MockRegionTargetTcpProxiesObj{o} } -// GCEAlphaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. -type GCEAlphaTargetTcpProxies struct { +// GCEAlphaRegionTargetTcpProxies is a simplifying adapter for the GCE RegionTargetTcpProxies. +type GCEAlphaRegionTargetTcpProxies struct { s *Service } // Get the TargetTcpProxy named by key. -func (g *GCEAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { +func (g *GCEAlphaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("alpha"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.TargetTcpProxies.Get(projectID, key.Name) + call := g.s.Alpha.RegionTargetTcpProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -44782,31 +49377,33 @@ func (g *GCEAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, optio } // List all TargetTcpProxy objects. -func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { +func (g *GCEAlphaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("alpha"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.TargetTcpProxies.List(projectID) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionTargetTcpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } var all []*computealpha.TargetTcpProxy f := func(l *computealpha.TargetTcpProxyList) error { - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -44814,7 +49411,7 @@ func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, optio callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -44822,155 +49419,116 @@ func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, optio g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetTcpProxy with key of value obj. -func (g *GCEAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { +func (g *GCEAlphaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("alpha"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.TargetTcpProxies.Insert(projectID, obj) + call := g.s.Alpha.RegionTargetTcpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetTcpProxy referenced by key. -func (g *GCEAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("alpha"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetTcpProxies.Delete(projectID, key.Name) + call := g.s.Alpha.RegionTargetTcpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// SetBackendService is a method on GCEAlphaTargetTcpProxies. -func (g *GCEAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetBackendService", - Version: meta.Version("alpha"), - Service: "TargetTcpProxies", - } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. -type BetaTargetTcpProxies interface { +// BetaRegionTargetTcpProxies is an interface that allows for mocking of RegionTargetTcpProxies. +type BetaRegionTargetTcpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetBackendService(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockBetaTargetTcpProxies returns a new mock for TargetTcpProxies. -func NewMockBetaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockBetaTargetTcpProxies { - mock := &MockBetaTargetTcpProxies{ +// NewMockBetaRegionTargetTcpProxies returns a new mock for RegionTargetTcpProxies. +func NewMockBetaRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetTcpProxiesObj) *MockBetaRegionTargetTcpProxies { + mock := &MockBetaRegionTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -44981,14 +49539,14 @@ func NewMockBetaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarget return mock } -// MockBetaTargetTcpProxies is the mock for TargetTcpProxies. -type MockBetaTargetTcpProxies struct { +// MockBetaRegionTargetTcpProxies is the mock for RegionTargetTcpProxies. +type MockBetaRegionTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetTcpProxiesObj + Objects map[meta.Key]*MockRegionTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -45001,11 +49559,10 @@ type MockBetaTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, *computebeta.TargetTcpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetTcpProxies, options ...Option) (bool, []*computebeta.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) - SetBackendServiceHook func(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, *MockBetaTargetTcpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, *computebeta.TargetTcpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, []*computebeta.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -45013,10 +49570,10 @@ type MockBetaTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { +func (m *MockBetaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -45028,28 +49585,28 @@ func (m *MockBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -45059,28 +49616,31 @@ func (m *MockBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, optio if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } var objs []*computebeta.TargetTcpProxy - for _, obj := range m.Objects { + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { +func (m *MockBetaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -45093,15 +49653,15 @@ func (m *MockBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, ob defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockBetaRegionTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -45109,16 +49669,16 @@ func (m *MockBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, ob projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetTcpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -45130,69 +49690,63 @@ func (m *MockBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaTargetTcpProxies) Obj(o *computebeta.TargetTcpProxy) *MockTargetTcpProxiesObj { - return &MockTargetTcpProxiesObj{o} -} - -// SetBackendService is a mock for the corresponding method. -func (m *MockBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - if m.SetBackendServiceHook != nil { - return m.SetBackendServiceHook(ctx, key, arg0, m) - } - return nil +func (m *MockBetaRegionTargetTcpProxies) Obj(o *computebeta.TargetTcpProxy) *MockRegionTargetTcpProxiesObj { + return &MockRegionTargetTcpProxiesObj{o} } -// GCEBetaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. -type GCEBetaTargetTcpProxies struct { +// GCEBetaRegionTargetTcpProxies is a simplifying adapter for the GCE RegionTargetTcpProxies. +type GCEBetaRegionTargetTcpProxies struct { s *Service } // Get the TargetTcpProxy named by key. -func (g *GCEBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { +func (g *GCEBetaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.TargetTcpProxies.Get(projectID, key.Name) + call := g.s.Beta.RegionTargetTcpProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -45201,31 +49755,33 @@ func (g *GCEBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, option } // List all TargetTcpProxy objects. -func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { +func (g *GCEBetaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.TargetTcpProxies.List(projectID) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionTargetTcpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } var all []*computebeta.TargetTcpProxy f := func(l *computebeta.TargetTcpProxyList) error { - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -45233,7 +49789,7 @@ func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, option callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -45241,155 +49797,116 @@ func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, option g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetTcpProxy with key of value obj. -func (g *GCEBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { +func (g *GCEBetaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.TargetTcpProxies.Insert(projectID, obj) + call := g.s.Beta.RegionTargetTcpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetTcpProxy referenced by key. -func (g *GCEBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetTcpProxies.Delete(projectID, key.Name) + call := g.s.Beta.RegionTargetTcpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// SetBackendService is a method on GCEBetaTargetTcpProxies. -func (g *GCEBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetBackendService", - Version: meta.Version("beta"), - Service: "TargetTcpProxies", - } - klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// TargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. -type TargetTcpProxies interface { +// RegionTargetTcpProxies is an interface that allows for mocking of RegionTargetTcpProxies. +type RegionTargetTcpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetBackendService(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockTargetTcpProxies returns a new mock for TargetTcpProxies. -func NewMockTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockTargetTcpProxies { - mock := &MockTargetTcpProxies{ +// NewMockRegionTargetTcpProxies returns a new mock for RegionTargetTcpProxies. +func NewMockRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetTcpProxiesObj) *MockRegionTargetTcpProxies { + mock := &MockRegionTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -45400,14 +49917,14 @@ func NewMockTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpP return mock } -// MockTargetTcpProxies is the mock for TargetTcpProxies. -type MockTargetTcpProxies struct { +// MockRegionTargetTcpProxies is the mock for RegionTargetTcpProxies. +type MockRegionTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetTcpProxiesObj + Objects map[meta.Key]*MockRegionTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -45420,11 +49937,10 @@ type MockTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, *computega.TargetTcpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockTargetTcpProxies, options ...Option) (bool, []*computega.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, m *MockTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, error) - SetBackendServiceHook func(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, *MockTargetTcpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetTcpProxies, options ...Option) (bool, *computega.TargetTcpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetTcpProxies, options ...Option) (bool, []*computega.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, m *MockRegionTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetTcpProxies, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -45432,10 +49948,10 @@ type MockTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { +func (m *MockRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -45447,28 +49963,28 @@ func (m *MockTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options . defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -45478,28 +49994,31 @@ func (m *MockTargetTcpProxies) List(ctx context.Context, fl *filter.F, options . if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } var objs []*computega.TargetTcpProxy - for _, obj := range m.Objects { + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { +func (m *MockRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -45512,15 +50031,15 @@ func (m *MockTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *c defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockRegionTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -45528,16 +50047,16 @@ func (m *MockTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *c projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetTcpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -45549,69 +50068,63 @@ func (m *MockTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, option defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockTargetTcpProxies) Obj(o *computega.TargetTcpProxy) *MockTargetTcpProxiesObj { - return &MockTargetTcpProxiesObj{o} -} - -// SetBackendService is a mock for the corresponding method. -func (m *MockTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - if m.SetBackendServiceHook != nil { - return m.SetBackendServiceHook(ctx, key, arg0, m) - } - return nil +func (m *MockRegionTargetTcpProxies) Obj(o *computega.TargetTcpProxy) *MockRegionTargetTcpProxiesObj { + return &MockRegionTargetTcpProxiesObj{o} } -// GCETargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. -type GCETargetTcpProxies struct { +// GCERegionTargetTcpProxies is a simplifying adapter for the GCE RegionTargetTcpProxies. +type GCERegionTargetTcpProxies struct { s *Service } // Get the TargetTcpProxy named by key. -func (g *GCETargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { +func (g *GCERegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetTcpProxies.Get(projectID, key.Name) + call := g.s.GA.RegionTargetTcpProxies.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -45620,31 +50133,33 @@ func (g *GCETargetTcpProxies) Get(ctx context.Context, key *meta.Key, options .. } // List all TargetTcpProxy objects. -func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { +func (g *GCERegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.TargetTcpProxies.List(projectID) + klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionTargetTcpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } var all []*computega.TargetTcpProxy f := func(l *computega.TargetTcpProxyList) error { - klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -45652,7 +50167,7 @@ func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options .. callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -45660,140 +50175,102 @@ func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options .. g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetTcpProxy with key of value obj. -func (g *GCETargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { +func (g *GCERegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.TargetTcpProxies.Insert(projectID, obj) + call := g.s.GA.RegionTargetTcpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetTcpProxy referenced by key. -func (g *GCETargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCERegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "TargetTcpProxies", + Service: "RegionTargetTcpProxies", + Resource: key, } - klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetTcpProxies.Delete(projectID, key.Name) + call := g.s.GA.RegionTargetTcpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// SetBackendService is a method on GCETargetTcpProxies. -func (g *GCETargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetBackendService", - Version: meta.Version("ga"), - Service: "TargetTcpProxies", - } - klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) - call.Context(ctx) - op, err := call.Do() - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -46019,6 +50496,7 @@ func (g *GCEAlphaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("alpha"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -46028,6 +50506,7 @@ func (g *GCEAlphaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opt return nil, err } call := g.s.Alpha.UrlMaps.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -46042,6 +50521,7 @@ func (g *GCEAlphaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *GCEAlphaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaUrlMaps.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "UrlMaps") ck := &CallContextKey{ @@ -46049,6 +50529,7 @@ func (g *GCEAlphaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("alpha"), Service: "UrlMaps", + Resource: key, } callObserverStart(ctx, ck) @@ -46107,6 +50588,7 @@ func (g *GCEAlphaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *comput Operation: "Insert", Version: meta.Version("alpha"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46118,13 +50600,14 @@ func (g *GCEAlphaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *comput call := g.s.Alpha.UrlMaps.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46148,6 +50631,7 @@ func (g *GCEAlphaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("alpha"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46159,13 +50643,14 @@ func (g *GCEAlphaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -46189,6 +50674,7 @@ func (g *GCEAlphaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *compu Operation: "Update", Version: meta.Version("alpha"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46198,13 +50684,14 @@ func (g *GCEAlphaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.Alpha.UrlMaps.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46438,6 +50925,7 @@ func (g *GCEBetaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opti Operation: "Get", Version: meta.Version("beta"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -46447,6 +50935,7 @@ func (g *GCEBetaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opti return nil, err } call := g.s.Beta.UrlMaps.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -46461,6 +50950,7 @@ func (g *GCEBetaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opti func (g *GCEBetaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaUrlMaps.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "UrlMaps") ck := &CallContextKey{ @@ -46468,6 +50958,7 @@ func (g *GCEBetaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Opti Operation: "List", Version: meta.Version("beta"), Service: "UrlMaps", + Resource: key, } callObserverStart(ctx, ck) @@ -46526,6 +51017,7 @@ func (g *GCEBetaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compute Operation: "Insert", Version: meta.Version("beta"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46537,13 +51029,14 @@ func (g *GCEBetaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compute call := g.s.Beta.UrlMaps.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46567,6 +51060,7 @@ func (g *GCEBetaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...O Operation: "Delete", Version: meta.Version("beta"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46578,13 +51072,14 @@ func (g *GCEBetaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...O call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -46608,6 +51103,7 @@ func (g *GCEBetaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comput Operation: "Update", Version: meta.Version("beta"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46617,13 +51113,14 @@ func (g *GCEBetaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comput } call := g.s.Beta.UrlMaps.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46857,6 +51354,7 @@ func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Option) Operation: "Get", Version: meta.Version("ga"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -46866,6 +51364,7 @@ func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Option) return nil, err } call := g.s.GA.UrlMaps.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -46880,6 +51379,7 @@ func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Option) func (g *GCEUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEUrlMaps.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "UrlMaps") ck := &CallContextKey{ @@ -46887,6 +51387,7 @@ func (g *GCEUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) Operation: "List", Version: meta.Version("ga"), Service: "UrlMaps", + Resource: key, } callObserverStart(ctx, ck) @@ -46945,6 +51446,7 @@ func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *computega.U Operation: "Insert", Version: meta.Version("ga"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46956,13 +51458,14 @@ func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *computega.U call := g.s.GA.UrlMaps.Insert(projectID, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46986,6 +51489,7 @@ func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...Optio Operation: "Delete", Version: meta.Version("ga"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -46997,13 +51501,14 @@ func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...Optio call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -47027,6 +51532,7 @@ func (g *GCEUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *computega. Operation: "Update", Version: meta.Version("ga"), Service: "UrlMaps", + Resource: key, } klog.V(5).Infof("GCEUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -47036,13 +51542,14 @@ func (g *GCEUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *computega. } call := g.s.GA.UrlMaps.Update(projectID, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47279,6 +51786,7 @@ func (g *GCEAlphaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("alpha"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -47288,6 +51796,7 @@ func (g *GCEAlphaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Alpha.RegionUrlMaps.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -47302,6 +51811,7 @@ func (g *GCEAlphaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options func (g *GCEAlphaRegionUrlMaps) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionUrlMaps.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionUrlMaps") ck := &CallContextKey{ @@ -47309,6 +51819,7 @@ func (g *GCEAlphaRegionUrlMaps) List(ctx context.Context, region string, fl *fil Operation: "List", Version: meta.Version("alpha"), Service: "RegionUrlMaps", + Resource: key, } callObserverStart(ctx, ck) @@ -47367,6 +51878,7 @@ func (g *GCEAlphaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj * Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -47378,13 +51890,14 @@ func (g *GCEAlphaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj * call := g.s.Alpha.RegionUrlMaps.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47408,6 +51921,7 @@ func (g *GCEAlphaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, optio Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -47419,13 +51933,14 @@ func (g *GCEAlphaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, optio call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEAlphaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -47449,6 +51964,7 @@ func (g *GCEAlphaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 Operation: "Update", Version: meta.Version("alpha"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -47458,13 +51974,14 @@ func (g *GCEAlphaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.RegionUrlMaps.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEAlphaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47701,6 +52218,7 @@ func (g *GCEBetaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("beta"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -47710,6 +52228,7 @@ func (g *GCEBetaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.Beta.RegionUrlMaps.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaRegionUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -47724,6 +52243,7 @@ func (g *GCEBetaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options . func (g *GCEBetaRegionUrlMaps) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaRegionUrlMaps.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionUrlMaps") ck := &CallContextKey{ @@ -47731,6 +52251,7 @@ func (g *GCEBetaRegionUrlMaps) List(ctx context.Context, region string, fl *filt Operation: "List", Version: meta.Version("beta"), Service: "RegionUrlMaps", + Resource: key, } callObserverStart(ctx, ck) @@ -47789,6 +52310,7 @@ func (g *GCEBetaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("beta"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -47800,13 +52322,14 @@ func (g *GCEBetaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.Beta.RegionUrlMaps.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47830,6 +52353,7 @@ func (g *GCEBetaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("beta"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -47841,13 +52365,14 @@ func (g *GCEBetaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCEBetaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -47871,6 +52396,7 @@ func (g *GCEBetaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 * Operation: "Update", Version: meta.Version("beta"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -47880,13 +52406,14 @@ func (g *GCEBetaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Beta.RegionUrlMaps.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCEBetaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -48123,6 +52650,7 @@ func (g *GCERegionUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("ga"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -48132,6 +52660,7 @@ func (g *GCERegionUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.GA.RegionUrlMaps.Get(projectID, key.Region, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -48146,6 +52675,7 @@ func (g *GCERegionUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCERegionUrlMaps) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionUrlMaps.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionUrlMaps") ck := &CallContextKey{ @@ -48153,6 +52683,7 @@ func (g *GCERegionUrlMaps) List(ctx context.Context, region string, fl *filter.F Operation: "List", Version: meta.Version("ga"), Service: "RegionUrlMaps", + Resource: key, } callObserverStart(ctx, ck) @@ -48211,6 +52742,7 @@ func (g *GCERegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("ga"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -48222,13 +52754,14 @@ func (g *GCERegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.GA.RegionUrlMaps.Insert(projectID, key.Region, obj) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -48252,6 +52785,7 @@ func (g *GCERegionUrlMaps) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("ga"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -48263,13 +52797,14 @@ func (g *GCERegionUrlMaps) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("GCERegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -48293,6 +52828,7 @@ func (g *GCERegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comp Operation: "Update", Version: meta.Version("ga"), Service: "RegionUrlMaps", + Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -48302,13 +52838,14 @@ func (g *GCERegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.GA.RegionUrlMaps.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("GCERegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -48453,6 +52990,7 @@ func (g *GCEZones) Get(ctx context.Context, key *meta.Key, options ...Option) (* Operation: "Get", Version: meta.Version("ga"), Service: "Zones", + Resource: key, } klog.V(5).Infof("GCEZones.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -48462,6 +53000,7 @@ func (g *GCEZones) Get(ctx context.Context, key *meta.Key, options ...Option) (* return nil, err } call := g.s.GA.Zones.Get(projectID, key.Name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEZones.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -48476,6 +53015,7 @@ func (g *GCEZones) Get(ctx context.Context, key *meta.Key, options ...Option) (* func (g *GCEZones) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Zone, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEZones.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Zones") ck := &CallContextKey{ @@ -48483,6 +53023,7 @@ func (g *GCEZones) List(ctx context.Context, fl *filter.F, options ...Option) ([ Operation: "List", Version: meta.Version("ga"), Service: "Zones", + Resource: key, } callObserverStart(ctx, ck) @@ -48747,6 +53288,7 @@ func (g *TDTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) Operation: "Get", Version: meta.Version("ga"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDTcpRoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -48757,6 +53299,7 @@ func (g *TDTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) } name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.TcpRoutes.Get(name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDTcpRoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -48771,6 +53314,7 @@ func (g *TDTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) func (g *TDTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesga.TcpRoute, error) { opts := mergeOptions(options) klog.V(5).Infof("TDTcpRoutes.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TcpRoutes") ck := &CallContextKey{ @@ -48778,6 +53322,7 @@ func (g *TDTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) Operation: "List", Version: meta.Version("ga"), Service: "TcpRoutes", + Resource: key, } callObserverStart(ctx, ck) @@ -48785,7 +53330,8 @@ func (g *TDTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) return nil, err } klog.V(5).Infof("TDTcpRoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.NetworkServicesGA.TcpRoutes.List(projectID) + parent := fmt.Sprintf("projects/%s/locations/global", projectID) + call := g.s.NetworkServicesGA.TcpRoutes.List(parent) var all []*networkservicesga.TcpRoute f := func(l *networkservicesga.ListTcpRoutesResponse) error { @@ -48833,6 +53379,7 @@ func (g *TDTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networkser Operation: "Insert", Version: meta.Version("ga"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDTcpRoutes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -48846,13 +53393,14 @@ func (g *TDTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networkser call.TcpRouteId(obj.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -48876,6 +53424,7 @@ func (g *TDTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ...Opti Operation: "Delete", Version: meta.Version("ga"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDTcpRoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -48888,13 +53437,14 @@ func (g *TDTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ...Opti call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -48918,6 +53468,7 @@ func (g *TDTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networkser Operation: "Patch", Version: meta.Version("ga"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDTcpRoutes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -48928,13 +53479,14 @@ func (g *TDTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networkser name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.TcpRoutes.Patch(name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("TDTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -49168,6 +53720,7 @@ func (g *TDBetaTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("beta"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -49178,6 +53731,7 @@ func (g *TDBetaTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Opt } name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.TcpRoutes.Get(name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDBetaTcpRoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -49192,6 +53746,7 @@ func (g *TDBetaTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *TDBetaTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesbeta.TcpRoute, error) { opts := mergeOptions(options) klog.V(5).Infof("TDBetaTcpRoutes.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TcpRoutes") ck := &CallContextKey{ @@ -49199,6 +53754,7 @@ func (g *TDBetaTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("beta"), Service: "TcpRoutes", + Resource: key, } callObserverStart(ctx, ck) @@ -49206,7 +53762,8 @@ func (g *TDBetaTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Opt return nil, err } klog.V(5).Infof("TDBetaTcpRoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.NetworkServicesBeta.TcpRoutes.List(projectID) + parent := fmt.Sprintf("projects/%s/locations/global", projectID) + call := g.s.NetworkServicesBeta.TcpRoutes.List(parent) var all []*networkservicesbeta.TcpRoute f := func(l *networkservicesbeta.ListTcpRoutesResponse) error { @@ -49254,6 +53811,7 @@ func (g *TDBetaTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networ Operation: "Insert", Version: meta.Version("beta"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -49267,13 +53825,14 @@ func (g *TDBetaTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networ call.TcpRouteId(obj.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDBetaTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDBetaTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -49297,6 +53856,7 @@ func (g *TDBetaTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("beta"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -49309,13 +53869,14 @@ func (g *TDBetaTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDBetaTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDBetaTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -49339,6 +53900,7 @@ func (g *TDBetaTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networ Operation: "Patch", Version: meta.Version("beta"), Service: "TcpRoutes", + Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -49349,13 +53911,14 @@ func (g *TDBetaTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networ name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.TcpRoutes.Patch(name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDBetaTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("TDBetaTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -49589,6 +54152,7 @@ func (g *TDMeshes) Get(ctx context.Context, key *meta.Key, options ...Option) (* Operation: "Get", Version: meta.Version("ga"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDMeshes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -49599,6 +54163,7 @@ func (g *TDMeshes) Get(ctx context.Context, key *meta.Key, options ...Option) (* } name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.Meshes.Get(name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDMeshes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -49613,6 +54178,7 @@ func (g *TDMeshes) Get(ctx context.Context, key *meta.Key, options ...Option) (* func (g *TDMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesga.Mesh, error) { opts := mergeOptions(options) klog.V(5).Infof("TDMeshes.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Meshes") ck := &CallContextKey{ @@ -49620,6 +54186,7 @@ func (g *TDMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([ Operation: "List", Version: meta.Version("ga"), Service: "Meshes", + Resource: key, } callObserverStart(ctx, ck) @@ -49627,7 +54194,8 @@ func (g *TDMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([ return nil, err } klog.V(5).Infof("TDMeshes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.NetworkServicesGA.Meshes.List(projectID) + parent := fmt.Sprintf("projects/%s/locations/global", projectID) + call := g.s.NetworkServicesGA.Meshes.List(parent) var all []*networkservicesga.Mesh f := func(l *networkservicesga.ListMeshesResponse) error { @@ -49675,6 +54243,7 @@ func (g *TDMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkservic Operation: "Insert", Version: meta.Version("ga"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDMeshes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -49685,15 +54254,17 @@ func (g *TDMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkservic obj.Name = key.Name parent := fmt.Sprintf("projects/%s/locations/global", projectID) call := g.s.NetworkServicesGA.Meshes.Create(parent, obj) + call.MeshId(obj.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -49717,6 +54288,7 @@ func (g *TDMeshes) Delete(ctx context.Context, key *meta.Key, options ...Option) Operation: "Delete", Version: meta.Version("ga"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDMeshes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -49729,13 +54301,14 @@ func (g *TDMeshes) Delete(ctx context.Context, key *meta.Key, options ...Option) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDMeshes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDMeshes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -49759,6 +54332,7 @@ func (g *TDMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkservic Operation: "Patch", Version: meta.Version("ga"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDMeshes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -49769,13 +54343,14 @@ func (g *TDMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkservic name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.Meshes.Patch(name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("TDMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -50009,6 +54584,7 @@ func (g *TDBetaMeshes) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("beta"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDBetaMeshes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -50019,6 +54595,7 @@ func (g *TDBetaMeshes) Get(ctx context.Context, key *meta.Key, options ...Option } name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.Meshes.Get(name) + handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDBetaMeshes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -50033,6 +54610,7 @@ func (g *TDBetaMeshes) Get(ctx context.Context, key *meta.Key, options ...Option func (g *TDBetaMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesbeta.Mesh, error) { opts := mergeOptions(options) klog.V(5).Infof("TDBetaMeshes.List(%v, %v, %v) called", ctx, fl, opts) + key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Meshes") ck := &CallContextKey{ @@ -50040,6 +54618,7 @@ func (g *TDBetaMeshes) List(ctx context.Context, fl *filter.F, options ...Option Operation: "List", Version: meta.Version("beta"), Service: "Meshes", + Resource: key, } callObserverStart(ctx, ck) @@ -50047,7 +54626,8 @@ func (g *TDBetaMeshes) List(ctx context.Context, fl *filter.F, options ...Option return nil, err } klog.V(5).Infof("TDBetaMeshes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.NetworkServicesBeta.Meshes.List(projectID) + parent := fmt.Sprintf("projects/%s/locations/global", projectID) + call := g.s.NetworkServicesBeta.Meshes.List(parent) var all []*networkservicesbeta.Mesh f := func(l *networkservicesbeta.ListMeshesResponse) error { @@ -50095,6 +54675,7 @@ func (g *TDBetaMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkse Operation: "Insert", Version: meta.Version("beta"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDBetaMeshes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -50105,15 +54686,17 @@ func (g *TDBetaMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkse obj.Name = key.Name parent := fmt.Sprintf("projects/%s/locations/global", projectID) call := g.s.NetworkServicesBeta.Meshes.Create(parent, obj) + call.MeshId(obj.Name) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDBetaMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDBetaMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -50137,6 +54720,7 @@ func (g *TDBetaMeshes) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("beta"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDBetaMeshes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -50149,13 +54733,14 @@ func (g *TDBetaMeshes) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDBetaMeshes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { - klog.V(4).Infof("TDBetaMeshes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -50179,6 +54764,7 @@ func (g *TDBetaMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkse Operation: "Patch", Version: meta.Version("beta"), Service: "Meshes", + Resource: key, } klog.V(5).Infof("TDBetaMeshes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -50189,13 +54775,14 @@ func (g *TDBetaMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkse name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.Meshes.Patch(name, arg0) call.Context(ctx) + handleHeaderOptions(&opts, call.Header()) op, err := call.Do() + klog.V(4).Infof("TDBetaMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("TDBetaMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -50351,6 +54938,12 @@ func NewRegionHealthChecksResourceID(project, region, name string) *ResourceID { return &ResourceID{project, "compute", "healthChecks", key} } +// NewRegionNetworkEndpointGroupsResourceID creates a ResourceID for the RegionNetworkEndpointGroups resource. +func NewRegionNetworkEndpointGroupsResourceID(project, region, name string) *ResourceID { + key := meta.RegionalKey(name, region) + return &ResourceID{project, "compute", "networkEndpointGroups", key} +} + // NewRegionNetworkFirewallPoliciesResourceID creates a ResourceID for the RegionNetworkFirewallPolicies resource. func NewRegionNetworkFirewallPoliciesResourceID(project, region, name string) *ResourceID { key := meta.RegionalKey(name, region) @@ -50381,6 +54974,12 @@ func NewRegionTargetHttpsProxiesResourceID(project, region, name string) *Resour return &ResourceID{project, "compute", "targetHttpsProxies", key} } +// NewRegionTargetTcpProxiesResourceID creates a ResourceID for the RegionTargetTcpProxies resource. +func NewRegionTargetTcpProxiesResourceID(project, region, name string) *ResourceID { + key := meta.RegionalKey(name, region) + return &ResourceID{project, "compute", "targetTcpProxies", key} +} + // NewRegionUrlMapsResourceID creates a ResourceID for the RegionUrlMaps resource. func NewRegionUrlMapsResourceID(project, region, name string) *ResourceID { key := meta.RegionalKey(name, region) diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS new file mode 100644 index 0000000000..40e7bf8687 --- /dev/null +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS @@ -0,0 +1,4 @@ +approvers: +- mag-kol +- kl52752 +- briantkennedy diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go index ba36fddfa6..0ecadcf1ab 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go @@ -278,6 +278,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Regional, serviceType: reflect.TypeOf(&ga.ForwardingRulesService{}), additionalMethods: []string{ + "Patch", "SetTarget", "SetLabels", }, @@ -290,6 +291,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Regional, serviceType: reflect.TypeOf(&alpha.ForwardingRulesService{}), additionalMethods: []string{ + "Patch", "SetTarget", "SetLabels", }, @@ -302,6 +304,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Regional, serviceType: reflect.TypeOf(&beta.ForwardingRulesService{}), additionalMethods: []string{ + "Patch", "SetTarget", "SetLabels", }, @@ -314,6 +317,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&alpha.GlobalForwardingRulesService{}), additionalMethods: []string{ + "Patch", "SetTarget", "SetLabels", }, @@ -326,6 +330,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&beta.GlobalForwardingRulesService{}), additionalMethods: []string{ + "Patch", "SetTarget", "SetLabels", }, @@ -337,6 +342,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&ga.GlobalForwardingRulesService{}), additionalMethods: []string{ + "Patch", "SetTarget", "SetLabels", }, @@ -648,6 +654,45 @@ var ComputeServices = []*ServiceInfo{ "ListNetworkEndpoints", }, }, + { + Object: "NetworkEndpointGroup", + Service: "RegionNetworkEndpointGroups", + Resource: "networkEndpointGroups", + version: VersionAlpha, + keyType: Regional, + serviceType: reflect.TypeOf(&alpha.RegionNetworkEndpointGroupsService{}), + additionalMethods: []string{ + "AttachNetworkEndpoints", + "DetachNetworkEndpoints", + "ListNetworkEndpoints", + }, + }, + { + Object: "NetworkEndpointGroup", + Service: "RegionNetworkEndpointGroups", + Resource: "networkEndpointGroups", + version: VersionBeta, + keyType: Regional, + serviceType: reflect.TypeOf(&beta.RegionNetworkEndpointGroupsService{}), + additionalMethods: []string{ + "AttachNetworkEndpoints", + "DetachNetworkEndpoints", + "ListNetworkEndpoints", + }, + }, + { + Object: "NetworkEndpointGroup", + Service: "RegionNetworkEndpointGroups", + Resource: "networkEndpointGroups", + version: VersionGA, + keyType: Regional, + serviceType: reflect.TypeOf(&ga.RegionNetworkEndpointGroupsService{}), + additionalMethods: []string{ + "AttachNetworkEndpoints", + "DetachNetworkEndpoints", + "ListNetworkEndpoints", + }, + }, { Object: "Project", Service: "Projects", @@ -949,6 +994,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&alpha.TargetHttpsProxiesService{}), additionalMethods: []string{ + "Patch", "SetCertificateMap", "SetSslCertificates", "SetSslPolicy", @@ -963,6 +1009,7 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&beta.TargetHttpsProxiesService{}), additionalMethods: []string{ + "Patch", "SetCertificateMap", "SetSslCertificates", "SetSslPolicy", @@ -1052,6 +1099,33 @@ var ComputeServices = []*ServiceInfo{ "SetBackendService", }, }, + { + Object: "TargetTcpProxy", + Service: "RegionTargetTcpProxies", + Resource: "targetTcpProxies", + version: VersionAlpha, + keyType: Regional, + serviceType: reflect.TypeOf(&alpha.RegionTargetTcpProxiesService{}), + additionalMethods: []string{}, + }, + { + Object: "TargetTcpProxy", + Service: "RegionTargetTcpProxies", + Resource: "targetTcpProxies", + version: VersionBeta, + keyType: Regional, + serviceType: reflect.TypeOf(&beta.RegionTargetTcpProxiesService{}), + additionalMethods: []string{}, + }, + { + Object: "TargetTcpProxy", + Service: "RegionTargetTcpProxies", + Resource: "targetTcpProxies", + version: VersionGA, + keyType: Regional, + serviceType: reflect.TypeOf(&ga.RegionTargetTcpProxiesService{}), + additionalMethods: []string{}, + }, { Object: "UrlMap", Service: "UrlMaps", diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go index b6a94ba062..1928443769 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go @@ -72,6 +72,18 @@ func (k *Key) Type() KeyType { } } +// Location returns the location for the key. +func (k *Key) Location() string { + switch { + case k.Zone != "": + return k.Zone + case k.Region != "": + return k.Region + default: + return "global" + } +} + // String returns a string representation of the key. func (k Key) String() string { switch k.Type() { diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go index ff7e3d2b9f..7e6ed9bcd7 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go @@ -1,27 +1,55 @@ package cloud +import ( + "net/http" +) + // Option are optional parameters to the generated methods. -type Option interface { - mergeInto(all *allOptions) -} +type Option func(*allOptions) // allOptions that can be configured for the generated methods. type allOptions struct { - projectID string + projectID string + addHeaders http.Header + returnPartialSuccess bool } -// ForceProjectID forces the projectID to be used in the call to be the one -// specified. This ignores the default routing done by the ProjectRouter. -func ForceProjectID(projectID string) Option { return projectIDOption(projectID) } - -type projectIDOption string - -func (opt projectIDOption) mergeInto(all *allOptions) { all.projectID = string(opt) } - func mergeOptions(options []Option) allOptions { var ret allOptions for _, opt := range options { - opt.mergeInto(&ret) + opt(&ret) } return ret } + +// ReturnPartialSuccess only affects AggregatedList calls, and will have the call return success +// when fanout calls fail. For example, when partial success behavior is enabled, aggregatedList for +// a single zone scope either returns all resources in the zone or no resources, with an error code. +func ReturnPartialSuccess(returnPartialSuccess bool) Option { + return func(opts *allOptions) { + opts.returnPartialSuccess = returnPartialSuccess + } +} + +// ForceProjectID forces the projectID to be used in the call to be the one +// specified. This ignores the default routing done by the ProjectRouter. +func ForceProjectID(projectID string) Option { + return func(opts *allOptions) { + opts.projectID = projectID + } +} + +// WithHeaders sets the headers to be used in the call. +func AddHeaders(headers http.Header) Option { + return func(opts *allOptions) { + opts.addHeaders = headers + } +} + +func handleHeaderOptions(opts *allOptions, to http.Header) { + for k, vals := range opts.addHeaders { + for _, v := range vals { + to.Add(k, v) + } + } +} diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go index 3af4796e7f..631827eefe 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go @@ -100,10 +100,12 @@ type MinimumRateLimiter struct { // Accept blocks on the minimum duration and context. Once the minimum duration is met, // the func is blocked on the underlying ratelimiter. func (m *MinimumRateLimiter) Accept(ctx context.Context, key *RateLimitKey) error { + t := time.NewTimer(m.Minimum) select { - case <-time.After(m.Minimum): + case <-t.C: return m.RateLimiter.Accept(ctx, key) case <-ctx.Done(): + t.Stop() return ctx.Err() } } @@ -112,3 +114,132 @@ func (m *MinimumRateLimiter) Accept(ctx context.Context, key *RateLimitKey) erro func (m *MinimumRateLimiter) Observe(ctx context.Context, err error, key *RateLimitKey) { m.RateLimiter.Observe(ctx, err, key) } + +// TickerRateLimiter uses time.Ticker to spread Accepts over time. +// +// Concurrent calls to Accept will block on the same channel. It is not +// guaranteed what caller will be unblocked first. +type TickerRateLimiter struct { + ticker *time.Ticker +} + +// NewTickerRateLimiter creates a new TickerRateLimiter which will space Accept +// calls at least interval/limit time apart. +// +// For example, limit=4 interval=time.Minute will unblock a single Accept call +// every 15 seconds. +func NewTickerRateLimiter(limit int, interval time.Duration) *TickerRateLimiter { + return &TickerRateLimiter{ + ticker: time.NewTicker(interval / time.Duration(limit)), + } +} + +// Accept will block until a time, specified when creating TickerRateLimiter, +// passes since the last call to Accept. +func (t *TickerRateLimiter) Accept(ctx context.Context, rlk *RateLimitKey) error { + select { + case <-t.ticker.C: + return nil + case <-ctx.Done(): + return ctx.Err() + } +} + +// Observe does nothing. +func (*TickerRateLimiter) Observe(context.Context, error, *RateLimitKey) { +} + +// Make sure that TickerRateLimiter implements RateLimiter. +var _ RateLimiter = new(TickerRateLimiter) + +// CompositeRateLimiter combines rate limiters based on RateLimitKey. +type CompositeRateLimiter struct { + // map[resource name]map[operation name]RateLimiter + rateLimiters map[string]map[string]RateLimiter + // defaultRL is used when no matching RateLimiter was found. + defaultRL RateLimiter +} + +// NewCompositeRateLimiter creates a new CompositeRateLimiter that will use +// provided default rate limiter if no better match is found. It is intended to +// be used for a single project. +// +// # Example +// +// bsDefaultRL := /* backend service default rate limiter */ +// bsGetListRL := /* backend service rate limiter for get and list operations */ +// +// rl := NewCompositeRateLimiter(defaultRL) +// rl.Register("BackendServices", "", bsDefaultRL) +// rl.Register("BackendServices", "Get", bsGetListRL) +// rl.Register("BackendServices", "List", bsGetListRL) +// +// This rate limiter is not nesting. Only one rate limiter is used for any +// particular combination of: resource, operation. For the case above, rate +// limiter registered at ("BackendServices", "") won't be applied to operation +// ("BackendServices", "Get"), because a more specific rate limiter was +// registered. +func NewCompositeRateLimiter(defaultRL RateLimiter) *CompositeRateLimiter { + m := map[string]map[string]RateLimiter{ + "": { + "": defaultRL, + }, + } + return &CompositeRateLimiter{ + rateLimiters: m, + defaultRL: defaultRL, + } +} + +// ensureExists creates sub-maps as needed. +func (c *CompositeRateLimiter) ensureExists(service string) { + if _, ok := c.rateLimiters[service]; !ok { + c.rateLimiters[service] = map[string]RateLimiter{} + } +} + +// fillMissing finds all combinations where resource and/or operation name +// could be omitted and sets it to defaultRL. +func (c *CompositeRateLimiter) fillMissing() { + for _, subService := range c.rateLimiters { + if subService[""] == nil { + subService[""] = c.defaultRL + } + } +} + +// Register adds provided rl to the composite rate limiter. Service, operation +// can be omitted by providing an empty string. In this case, the provided rate +// limiter will be used only when there is no other rate limiter matching a +// particular resource, or operation. +// +// It replaces previous rate limiter provided for the same service, operation +// combination. Once a rate limiter is added, it can't be removed. +// +// Same rate limiter can be used for multiple Register calls. +func (c *CompositeRateLimiter) Register(service, operation string, rl RateLimiter) { + c.ensureExists(service) + c.rateLimiters[service][operation] = rl + c.fillMissing() +} + +// Accept either calls underlying rate limiter matching rlk or a default rate +// limiter when none is found. +func (c *CompositeRateLimiter) Accept(ctx context.Context, rlk *RateLimitKey) error { + if rlk == nil { + return c.defaultRL.Accept(ctx, rlk) + } + service := rlk.Service + if _, ok := c.rateLimiters[service]; !ok { + service = "" + } + operation := rlk.Operation + if _, ok := c.rateLimiters[service][operation]; !ok { + operation = "" + } + return c.rateLimiters[service][operation].Accept(ctx, rlk) +} + +// Observe does nothing. +func (*CompositeRateLimiter) Observe(context.Context, error, *RateLimitKey) { +} diff --git a/vendor/modules.txt b/vendor/modules.txt index dbdb351932..8860487073 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -54,8 +54,8 @@ github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/ github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/versioned/scheme github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/versioned/typed/nodetopology/v1 github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/versioned/typed/nodetopology/v1/fake -# github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 -## explicit; go 1.20 +# github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 +## explicit; go 1.21 github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/filter github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta From 0ffd95efae72d37014625b44a8e083663064cc7d Mon Sep 17 00:00:00 2001 From: Huy Pham Date: Mon, 11 May 2026 13:15:17 -0700 Subject: [PATCH 39/78] Revert "Update GoogleCloudPlatform/k8s-cloud-provider to v1.34.0 (#1115)" This reverts commit 4d88a83fa9dc47b5d27c2015c7a0ca569c7c4caf. --- .github/dependabot.yml | 36 + .github/release.yml | 15 + .github/workflows/dependabot-sync.yml | 37 + .github/workflows/release.yml | 24 + .github/workflows/tag-auth-provider-gcp.yml | 33 + .github/workflows/tag-ccm.yml | 32 + .../workflows/tag-gke-gcloud-auth-plugin.yml | 33 + go.mod | 2 +- go.sum | 4 +- go.work.sum | 6 +- .../adaptiveipam/v1/adaptiveipam_grpc.pb.go | 2 +- providers/gce/gce_instances_test.go | 10 +- providers/go.mod | 2 +- providers/go.sum | 4 +- test/e2e/go.mod | 2 +- test/e2e/go.sum | 4 +- .../k8s-cloud-provider/pkg/cloud/context.go | 2 - .../k8s-cloud-provider/pkg/cloud/gen.go | 15955 ++++++---------- .../k8s-cloud-provider/pkg/cloud/meta/OWNERS | 4 - .../pkg/cloud/meta/compute_services.go | 74 - .../k8s-cloud-provider/pkg/cloud/meta/key.go | 12 - .../k8s-cloud-provider/pkg/cloud/option.go | 54 +- .../k8s-cloud-provider/pkg/cloud/ratelimit.go | 133 +- vendor/modules.txt | 4 +- 24 files changed, 5922 insertions(+), 10562 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/release.yml create mode 100644 .github/workflows/dependabot-sync.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/tag-auth-provider-gcp.yml create mode 100644 .github/workflows/tag-ccm.yml create mode 100644 .github/workflows/tag-gke-gcloud-auth-plugin.yml delete mode 100644 vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..db4a922e91 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,36 @@ +version: 2 +updates: +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "sunday" + labels: + - "ok-to-test" + - 'area/dependency' + - 'release-note-none' +- package-ecosystem: gomod + directories: + - "/" + - "/providers" + - "/metis" + - "/test/e2e" + schedule: + interval: weekly + labels: + - 'area/dependency' + - 'release-note-none' + - 'ok-to-test' + groups: + k8s-dependencies: + patterns: + - "k8s.io/*" + - "sigs.k8s.io/*" + workspace-deps: + patterns: + - "*" + exclude-patterns: + - "k8s.io/*" + - "sigs.k8s.io/*" + + diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000000..9b8e61c654 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,15 @@ +changelog: + exclude: + labels: + - ignore-for-release + authors: + - dependabot[bot] + categories: + - title: Features + labels: + - feature + - enhancement + - title: Bug Fixes + labels: + - bug + - fix diff --git a/.github/workflows/dependabot-sync.yml b/.github/workflows/dependabot-sync.yml new file mode 100644 index 0000000000..a8ae841a8a --- /dev/null +++ b/.github/workflows/dependabot-sync.yml @@ -0,0 +1,37 @@ +name: Dependabot Go Work Sync + +on: + pull_request: + paths: + - '**/go.mod' + - '**/go.sum' + +permissions: + contents: write + +jobs: + go-work-sync: + runs-on: ubuntu-latest + if: github.actor == 'dependabot[bot]' + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + ref: ${{ github.event.pull_request.head.ref }} + + - name: Setup Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c + with: + go-version-file: 'go.work' + + - name: Sync Go Workspace + run: go work sync + + - name: Commit and Push changes + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add go.work.sum + # Only commit if there are actual changes + git diff --quiet && git diff --staged --quiet || git commit -m "chore: update go.work.sum" + git push \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..b64762abc7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Create GitHub Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 # Important for generating release notes + + - name: Create Draft Release + uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 + with: + draft: true + generate_release_notes: true diff --git a/.github/workflows/tag-auth-provider-gcp.yml b/.github/workflows/tag-auth-provider-gcp.yml new file mode 100644 index 0000000000..e58f2c2eba --- /dev/null +++ b/.github/workflows/tag-auth-provider-gcp.yml @@ -0,0 +1,33 @@ +name: Tag auth-provider-gcp + +on: + push: + branches: + - 'release-1.*' + paths: + - 'cmd/auth-provider-gcp/**' + - 'go.mod' + - 'go.sum' + +jobs: + tag-auth-provider-gcp: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Configure Git User + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Run auto-tag script + env: + DRY_RUN: "false" + FORCE_BRANCH: ${{ github.ref_name }} + COMPONENT_PREFIX: "auth-provider-gcp/" + run: ./tools/auto-tag.sh diff --git a/.github/workflows/tag-ccm.yml b/.github/workflows/tag-ccm.yml new file mode 100644 index 0000000000..929c31ec3e --- /dev/null +++ b/.github/workflows/tag-ccm.yml @@ -0,0 +1,32 @@ +name: Tag CCM + +on: + push: + branches: + - 'release-1.*' + paths-ignore: + - 'cmd/auth-provider-gcp/**' + - 'cmd/gke-gcloud-auth-plugin/**' + +jobs: + tag-ccm: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Configure Git User + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Run auto-tag script + env: + DRY_RUN: "false" + FORCE_BRANCH: ${{ github.ref_name }} + COMPONENT_PREFIX: "" + run: ./tools/auto-tag.sh diff --git a/.github/workflows/tag-gke-gcloud-auth-plugin.yml b/.github/workflows/tag-gke-gcloud-auth-plugin.yml new file mode 100644 index 0000000000..658665874d --- /dev/null +++ b/.github/workflows/tag-gke-gcloud-auth-plugin.yml @@ -0,0 +1,33 @@ +name: Tag gke-gcloud-auth-plugin + +on: + push: + branches: + - 'release-1.*' + paths: + - 'cmd/gke-gcloud-auth-plugin/**' + - 'go.mod' + - 'go.sum' + +jobs: + tag-gke-gcloud-auth-plugin: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 # Fetch all history and tags + + - name: Configure Git User + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + - name: Run auto-tag script + env: + DRY_RUN: "false" + FORCE_BRANCH: ${{ github.ref_name }} + COMPONENT_PREFIX: "gke-gcloud-auth-plugin/" + run: ./tools/auto-tag.sh diff --git a/go.mod b/go.mod index d1a82b25c5..9047acc1de 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect - github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 + github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect diff --git a/go.sum b/go.sum index 8928392c16..20cecf0677 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,8 @@ github.com/GoogleCloudPlatform/gke-enterprise-mt v0.1.0 h1:VbaMM0mWLVKE5z/UrGxdB github.com/GoogleCloudPlatform/gke-enterprise-mt v0.1.0/go.mod h1:4OaeS6mKZtfsPHaDGOgZ3uz15sUO8KXl9tElNunV5Zc= github.com/GoogleCloudPlatform/gke-networking-api v0.2.1-0.20260327205951-1d0cb5d74c02 h1:wU4juqROYf7cVS+9NNJt55ivHVFZrDploNHZWP6TdHA= github.com/GoogleCloudPlatform/gke-networking-api v0.2.1-0.20260327205951-1d0cb5d74c02/go.mod h1:jC8/IazDeY3D4zTcEsZK6WiwbmqSTYjGNTZqXucxVVU= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 h1:QoaPZxsKBqKlIAwQSUJgiXlhz1Nu+Y1DgGqR7GV2uIA= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= diff --git a/go.work.sum b/go.work.sum index 7d4cb5afab..13dcc9ac2b 100644 --- a/go.work.sum +++ b/go.work.sum @@ -1,9 +1,11 @@ +cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= cloud.google.com/go v0.115.1 h1:Jo0SM9cQnSkYfp44+v+NQXHpcHqlnRJk2qxh6yvxxxQ= cloud.google.com/go/compute v1.23.1 h1:V97tBoDaZHb6leicZ1G6DLK2BAaZLJ/7+9BB/En3hR0= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= +cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.1/go.mod h1:Zanoh4+gvIgluNqcfMVTJueD4wSS5hT7zTt4Mrutd90= github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE= +golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto= diff --git a/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go b/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go index 7619b24ee9..35b10e37bf 100644 --- a/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go +++ b/metis/api/adaptiveipam/v1/adaptiveipam_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.6.2 +// - protoc-gen-go-grpc v1.6.1 // - protoc v7.34.1 // source: metis/api/adaptiveipam/v1/adaptiveipam.proto diff --git a/providers/gce/gce_instances_test.go b/providers/gce/gce_instances_test.go index c0b5d56dde..897b06fd0c 100644 --- a/providers/gce/gce_instances_test.go +++ b/providers/gce/gce_instances_test.go @@ -22,6 +22,7 @@ package gce import ( "context" "fmt" + "reflect" "strings" "testing" @@ -606,17 +607,14 @@ func TestProjectFromNodeProviderID(t *testing.T) { }}, } instanceMap[instanceFromNonDefaultProject.SelfLink] = instanceFromNonDefaultProject + forceNonDefaultProject := cloud.ForceProjectID(nonDefaultProject) // Setup mock response. mockGCE := gce.c.(*cloud.MockGCE) mi := mockGCE.Instances().(*cloud.MockInstances) mi.GetHook = func(ctx context.Context, key *meta.Key, m *cloud.MockInstances, options ...cloud.Option) (bool, *ga.Instance, error) { projectID := defaultValues.ProjectID - if len(options) > 0 { - // In v1.34+, cloud.Option is a function closure, so reflect.DeepEqual - // no longer works. Since we only ever pass cloud.ForceProjectID() - // in this test, we assume any option means the project ID should be - // the non-default one. + if len(options) == 1 && reflect.DeepEqual(options[0], forceNonDefaultProject) { projectID = nonDefaultProject } selfLink := fmt.Sprintf("projects/%v/zones/%v/instances/%v", projectID, key.Zone, key.Name) @@ -657,7 +655,7 @@ func TestProjectFromNodeProviderID(t *testing.T) { t.Fatalf("instanceByProviderID(%v) = %v; want nil", node.Spec.ProviderID, err) } if gotGCEInstance.ID != tc.wantInstance.Id { - t.Errorf("instanceByProviderID(%v) returned instance with ID = %v; want instance with ID = %v", node.Spec.ProviderID, gotGCEInstance.ID, tc.wantInstance.Id) + t.Errorf("instanceByProviderID(%v) returned instance with ID = %v; want instance with ID = %v", node.Spec.ProviderID, gotGCEInstance.ID, instanceFromDefaultProject.Id) } }) diff --git a/providers/go.mod b/providers/go.mod index c36486af66..33424b7749 100644 --- a/providers/go.mod +++ b/providers/go.mod @@ -3,7 +3,7 @@ module k8s.io/cloud-provider-gcp/providers go 1.26.0 require ( - github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 + github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 github.com/google/go-cmp v0.7.0 github.com/stretchr/testify v1.11.1 golang.org/x/oauth2 v0.34.0 diff --git a/providers/go.sum b/providers/go.sum index c578cd737c..1dc922c05b 100644 --- a/providers/go.sum +++ b/providers/go.sum @@ -6,8 +6,8 @@ cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLM cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 h1:QoaPZxsKBqKlIAwQSUJgiXlhz1Nu+Y1DgGqR7GV2uIA= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= diff --git a/test/e2e/go.mod b/test/e2e/go.mod index dc8995f934..22743858d7 100644 --- a/test/e2e/go.mod +++ b/test/e2e/go.mod @@ -3,7 +3,7 @@ module k8s.io/cloud-provider-gcp/test/e2e go 1.26.0 require ( - github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 + github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 github.com/onsi/ginkgo/v2 v2.28.1 github.com/onsi/gomega v1.39.1 google.golang.org/api v0.199.0 diff --git a/test/e2e/go.sum b/test/e2e/go.sum index f7e8b169f7..efdaf02f55 100644 --- a/test/e2e/go.sum +++ b/test/e2e/go.sum @@ -8,8 +8,8 @@ cloud.google.com/go/auth/oauth2adapt v0.2.4/go.mod h1:jC/jOpwFP6JBxhB3P5Rr0a9HLM cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs= cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 h1:QoaPZxsKBqKlIAwQSUJgiXlhz1Nu+Y1DgGqR7GV2uIA= -github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0/go.mod h1:Zl1a9zE67QrQpwIib8BlF7mv7FAVXQwJDKD6rAQk/jw= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 h1:5slI4ZAsvkgpVEfrKZGlvcpeYTv2roIbDzK6zvJYhwY= +github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0/go.mod h1:TFNxHb9YGSjLB86UWy5BQCgVTXQscyy/X5tC/2olieA= github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0= github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM= github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I= diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go index 9bc306c2dd..b2899a7c97 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/context.go @@ -43,6 +43,4 @@ type CallContextKey struct { Version meta.Version // Service is the service being invoked (e.g. "Firewalls", "BackendServices") Service string - // Resource is the key of the resource being operated on. - Resource *meta.Key } diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go index 438d1d526e..cef8160c0e 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/gen.go @@ -1,5 +1,5 @@ /* -Copyright 2025 Google LLC +Copyright 2024 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -95,9 +95,6 @@ type Cloud interface { AlphaGlobalNetworkEndpointGroups() AlphaGlobalNetworkEndpointGroups BetaGlobalNetworkEndpointGroups() BetaGlobalNetworkEndpointGroups GlobalNetworkEndpointGroups() GlobalNetworkEndpointGroups - AlphaRegionNetworkEndpointGroups() AlphaRegionNetworkEndpointGroups - BetaRegionNetworkEndpointGroups() BetaRegionNetworkEndpointGroups - RegionNetworkEndpointGroups() RegionNetworkEndpointGroups Projects() Projects Regions() Regions AlphaRouters() AlphaRouters @@ -135,9 +132,6 @@ type Cloud interface { AlphaTargetTcpProxies() AlphaTargetTcpProxies BetaTargetTcpProxies() BetaTargetTcpProxies TargetTcpProxies() TargetTcpProxies - AlphaRegionTargetTcpProxies() AlphaRegionTargetTcpProxies - BetaRegionTargetTcpProxies() BetaRegionTargetTcpProxies - RegionTargetTcpProxies() RegionTargetTcpProxies AlphaUrlMaps() AlphaUrlMaps BetaUrlMaps() BetaUrlMaps UrlMaps() UrlMaps @@ -205,9 +199,6 @@ func NewGCE(s *Service) *GCE { gceAlphaGlobalNetworkEndpointGroups: &GCEAlphaGlobalNetworkEndpointGroups{s}, gceBetaGlobalNetworkEndpointGroups: &GCEBetaGlobalNetworkEndpointGroups{s}, gceGlobalNetworkEndpointGroups: &GCEGlobalNetworkEndpointGroups{s}, - gceAlphaRegionNetworkEndpointGroups: &GCEAlphaRegionNetworkEndpointGroups{s}, - gceBetaRegionNetworkEndpointGroups: &GCEBetaRegionNetworkEndpointGroups{s}, - gceRegionNetworkEndpointGroups: &GCERegionNetworkEndpointGroups{s}, gceProjects: &GCEProjects{s}, gceRegions: &GCERegions{s}, gceAlphaRouters: &GCEAlphaRouters{s}, @@ -245,9 +236,6 @@ func NewGCE(s *Service) *GCE { gceAlphaTargetTcpProxies: &GCEAlphaTargetTcpProxies{s}, gceBetaTargetTcpProxies: &GCEBetaTargetTcpProxies{s}, gceTargetTcpProxies: &GCETargetTcpProxies{s}, - gceAlphaRegionTargetTcpProxies: &GCEAlphaRegionTargetTcpProxies{s}, - gceBetaRegionTargetTcpProxies: &GCEBetaRegionTargetTcpProxies{s}, - gceRegionTargetTcpProxies: &GCERegionTargetTcpProxies{s}, gceAlphaUrlMaps: &GCEAlphaUrlMaps{s}, gceBetaUrlMaps: &GCEBetaUrlMaps{s}, gceUrlMaps: &GCEUrlMaps{s}, @@ -319,9 +307,6 @@ type GCE struct { gceAlphaGlobalNetworkEndpointGroups *GCEAlphaGlobalNetworkEndpointGroups gceBetaGlobalNetworkEndpointGroups *GCEBetaGlobalNetworkEndpointGroups gceGlobalNetworkEndpointGroups *GCEGlobalNetworkEndpointGroups - gceAlphaRegionNetworkEndpointGroups *GCEAlphaRegionNetworkEndpointGroups - gceBetaRegionNetworkEndpointGroups *GCEBetaRegionNetworkEndpointGroups - gceRegionNetworkEndpointGroups *GCERegionNetworkEndpointGroups gceProjects *GCEProjects gceRegions *GCERegions gceAlphaRouters *GCEAlphaRouters @@ -359,9 +344,6 @@ type GCE struct { gceAlphaTargetTcpProxies *GCEAlphaTargetTcpProxies gceBetaTargetTcpProxies *GCEBetaTargetTcpProxies gceTargetTcpProxies *GCETargetTcpProxies - gceAlphaRegionTargetTcpProxies *GCEAlphaRegionTargetTcpProxies - gceBetaRegionTargetTcpProxies *GCEBetaRegionTargetTcpProxies - gceRegionTargetTcpProxies *GCERegionTargetTcpProxies gceAlphaUrlMaps *GCEAlphaUrlMaps gceBetaUrlMaps *GCEBetaUrlMaps gceUrlMaps *GCEUrlMaps @@ -630,21 +612,6 @@ func (gce *GCE) GlobalNetworkEndpointGroups() GlobalNetworkEndpointGroups { return gce.gceGlobalNetworkEndpointGroups } -// AlphaRegionNetworkEndpointGroups returns the interface for the alpha RegionNetworkEndpointGroups. -func (gce *GCE) AlphaRegionNetworkEndpointGroups() AlphaRegionNetworkEndpointGroups { - return gce.gceAlphaRegionNetworkEndpointGroups -} - -// BetaRegionNetworkEndpointGroups returns the interface for the beta RegionNetworkEndpointGroups. -func (gce *GCE) BetaRegionNetworkEndpointGroups() BetaRegionNetworkEndpointGroups { - return gce.gceBetaRegionNetworkEndpointGroups -} - -// RegionNetworkEndpointGroups returns the interface for the ga RegionNetworkEndpointGroups. -func (gce *GCE) RegionNetworkEndpointGroups() RegionNetworkEndpointGroups { - return gce.gceRegionNetworkEndpointGroups -} - // Projects returns the interface for the ga Projects. func (gce *GCE) Projects() Projects { return gce.gceProjects @@ -830,21 +797,6 @@ func (gce *GCE) TargetTcpProxies() TargetTcpProxies { return gce.gceTargetTcpProxies } -// AlphaRegionTargetTcpProxies returns the interface for the alpha RegionTargetTcpProxies. -func (gce *GCE) AlphaRegionTargetTcpProxies() AlphaRegionTargetTcpProxies { - return gce.gceAlphaRegionTargetTcpProxies -} - -// BetaRegionTargetTcpProxies returns the interface for the beta RegionTargetTcpProxies. -func (gce *GCE) BetaRegionTargetTcpProxies() BetaRegionTargetTcpProxies { - return gce.gceBetaRegionTargetTcpProxies -} - -// RegionTargetTcpProxies returns the interface for the ga RegionTargetTcpProxies. -func (gce *GCE) RegionTargetTcpProxies() RegionTargetTcpProxies { - return gce.gceRegionTargetTcpProxies -} - // AlphaUrlMaps returns the interface for the alpha UrlMaps. func (gce *GCE) AlphaUrlMaps() AlphaUrlMaps { return gce.gceAlphaUrlMaps @@ -926,13 +878,11 @@ func NewMockGCE(projectRouter ProjectRouter) *MockGCE { mockRegionBackendServicesObjs := map[meta.Key]*MockRegionBackendServicesObj{} mockRegionDisksObjs := map[meta.Key]*MockRegionDisksObj{} mockRegionHealthChecksObjs := map[meta.Key]*MockRegionHealthChecksObj{} - mockRegionNetworkEndpointGroupsObjs := map[meta.Key]*MockRegionNetworkEndpointGroupsObj{} mockRegionNetworkFirewallPoliciesObjs := map[meta.Key]*MockRegionNetworkFirewallPoliciesObj{} mockRegionSslCertificatesObjs := map[meta.Key]*MockRegionSslCertificatesObj{} mockRegionSslPoliciesObjs := map[meta.Key]*MockRegionSslPoliciesObj{} mockRegionTargetHttpProxiesObjs := map[meta.Key]*MockRegionTargetHttpProxiesObj{} mockRegionTargetHttpsProxiesObjs := map[meta.Key]*MockRegionTargetHttpsProxiesObj{} - mockRegionTargetTcpProxiesObjs := map[meta.Key]*MockRegionTargetTcpProxiesObj{} mockRegionUrlMapsObjs := map[meta.Key]*MockRegionUrlMapsObj{} mockRegionsObjs := map[meta.Key]*MockRegionsObj{} mockRoutersObjs := map[meta.Key]*MockRoutersObj{} @@ -1002,9 +952,6 @@ func NewMockGCE(projectRouter ProjectRouter) *MockGCE { MockAlphaGlobalNetworkEndpointGroups: NewMockAlphaGlobalNetworkEndpointGroups(projectRouter, mockGlobalNetworkEndpointGroupsObjs), MockBetaGlobalNetworkEndpointGroups: NewMockBetaGlobalNetworkEndpointGroups(projectRouter, mockGlobalNetworkEndpointGroupsObjs), MockGlobalNetworkEndpointGroups: NewMockGlobalNetworkEndpointGroups(projectRouter, mockGlobalNetworkEndpointGroupsObjs), - MockAlphaRegionNetworkEndpointGroups: NewMockAlphaRegionNetworkEndpointGroups(projectRouter, mockRegionNetworkEndpointGroupsObjs), - MockBetaRegionNetworkEndpointGroups: NewMockBetaRegionNetworkEndpointGroups(projectRouter, mockRegionNetworkEndpointGroupsObjs), - MockRegionNetworkEndpointGroups: NewMockRegionNetworkEndpointGroups(projectRouter, mockRegionNetworkEndpointGroupsObjs), MockProjects: NewMockProjects(projectRouter, mockProjectsObjs), MockRegions: NewMockRegions(projectRouter, mockRegionsObjs), MockAlphaRouters: NewMockAlphaRouters(projectRouter, mockRoutersObjs), @@ -1042,9 +989,6 @@ func NewMockGCE(projectRouter ProjectRouter) *MockGCE { MockAlphaTargetTcpProxies: NewMockAlphaTargetTcpProxies(projectRouter, mockTargetTcpProxiesObjs), MockBetaTargetTcpProxies: NewMockBetaTargetTcpProxies(projectRouter, mockTargetTcpProxiesObjs), MockTargetTcpProxies: NewMockTargetTcpProxies(projectRouter, mockTargetTcpProxiesObjs), - MockAlphaRegionTargetTcpProxies: NewMockAlphaRegionTargetTcpProxies(projectRouter, mockRegionTargetTcpProxiesObjs), - MockBetaRegionTargetTcpProxies: NewMockBetaRegionTargetTcpProxies(projectRouter, mockRegionTargetTcpProxiesObjs), - MockRegionTargetTcpProxies: NewMockRegionTargetTcpProxies(projectRouter, mockRegionTargetTcpProxiesObjs), MockAlphaUrlMaps: NewMockAlphaUrlMaps(projectRouter, mockUrlMapsObjs), MockBetaUrlMaps: NewMockBetaUrlMaps(projectRouter, mockUrlMapsObjs), MockUrlMaps: NewMockUrlMaps(projectRouter, mockUrlMapsObjs), @@ -1116,9 +1060,6 @@ type MockGCE struct { MockAlphaGlobalNetworkEndpointGroups *MockAlphaGlobalNetworkEndpointGroups MockBetaGlobalNetworkEndpointGroups *MockBetaGlobalNetworkEndpointGroups MockGlobalNetworkEndpointGroups *MockGlobalNetworkEndpointGroups - MockAlphaRegionNetworkEndpointGroups *MockAlphaRegionNetworkEndpointGroups - MockBetaRegionNetworkEndpointGroups *MockBetaRegionNetworkEndpointGroups - MockRegionNetworkEndpointGroups *MockRegionNetworkEndpointGroups MockProjects *MockProjects MockRegions *MockRegions MockAlphaRouters *MockAlphaRouters @@ -1156,9 +1097,6 @@ type MockGCE struct { MockAlphaTargetTcpProxies *MockAlphaTargetTcpProxies MockBetaTargetTcpProxies *MockBetaTargetTcpProxies MockTargetTcpProxies *MockTargetTcpProxies - MockAlphaRegionTargetTcpProxies *MockAlphaRegionTargetTcpProxies - MockBetaRegionTargetTcpProxies *MockBetaRegionTargetTcpProxies - MockRegionTargetTcpProxies *MockRegionTargetTcpProxies MockAlphaUrlMaps *MockAlphaUrlMaps MockBetaUrlMaps *MockBetaUrlMaps MockUrlMaps *MockUrlMaps @@ -1427,21 +1365,6 @@ func (mock *MockGCE) GlobalNetworkEndpointGroups() GlobalNetworkEndpointGroups { return mock.MockGlobalNetworkEndpointGroups } -// AlphaRegionNetworkEndpointGroups returns the interface for the alpha RegionNetworkEndpointGroups. -func (mock *MockGCE) AlphaRegionNetworkEndpointGroups() AlphaRegionNetworkEndpointGroups { - return mock.MockAlphaRegionNetworkEndpointGroups -} - -// BetaRegionNetworkEndpointGroups returns the interface for the beta RegionNetworkEndpointGroups. -func (mock *MockGCE) BetaRegionNetworkEndpointGroups() BetaRegionNetworkEndpointGroups { - return mock.MockBetaRegionNetworkEndpointGroups -} - -// RegionNetworkEndpointGroups returns the interface for the ga RegionNetworkEndpointGroups. -func (mock *MockGCE) RegionNetworkEndpointGroups() RegionNetworkEndpointGroups { - return mock.MockRegionNetworkEndpointGroups -} - // Projects returns the interface for the ga Projects. func (mock *MockGCE) Projects() Projects { return mock.MockProjects @@ -1627,21 +1550,6 @@ func (mock *MockGCE) TargetTcpProxies() TargetTcpProxies { return mock.MockTargetTcpProxies } -// AlphaRegionTargetTcpProxies returns the interface for the alpha RegionTargetTcpProxies. -func (mock *MockGCE) AlphaRegionTargetTcpProxies() AlphaRegionTargetTcpProxies { - return mock.MockAlphaRegionTargetTcpProxies -} - -// BetaRegionTargetTcpProxies returns the interface for the beta RegionTargetTcpProxies. -func (mock *MockGCE) BetaRegionTargetTcpProxies() BetaRegionTargetTcpProxies { - return mock.MockBetaRegionTargetTcpProxies -} - -// RegionTargetTcpProxies returns the interface for the ga RegionTargetTcpProxies. -func (mock *MockGCE) RegionTargetTcpProxies() RegionTargetTcpProxies { - return mock.MockRegionTargetTcpProxies -} - // AlphaUrlMaps returns the interface for the alpha UrlMaps. func (mock *MockGCE) AlphaUrlMaps() AlphaUrlMaps { return mock.MockAlphaUrlMaps @@ -2554,52 +2462,6 @@ func (m *MockRegionHealthChecksObj) ToGA() *computega.HealthCheck { return ret } -// MockRegionNetworkEndpointGroupsObj is used to store the various object versions in the shared -// map of mocked objects. This allows for multiple API versions to co-exist and -// share the same "view" of the objects in the backend. -type MockRegionNetworkEndpointGroupsObj struct { - Obj interface{} -} - -// ToAlpha retrieves the given version of the object. -func (m *MockRegionNetworkEndpointGroupsObj) ToAlpha() *computealpha.NetworkEndpointGroup { - if ret, ok := m.Obj.(*computealpha.NetworkEndpointGroup); ok { - return ret - } - // Convert the object via JSON copying to the type that was requested. - ret := &computealpha.NetworkEndpointGroup{} - if err := copyViaJSON(ret, m.Obj); err != nil { - klog.Errorf("Could not convert %T to *computealpha.NetworkEndpointGroup via JSON: %v", m.Obj, err) - } - return ret -} - -// ToBeta retrieves the given version of the object. -func (m *MockRegionNetworkEndpointGroupsObj) ToBeta() *computebeta.NetworkEndpointGroup { - if ret, ok := m.Obj.(*computebeta.NetworkEndpointGroup); ok { - return ret - } - // Convert the object via JSON copying to the type that was requested. - ret := &computebeta.NetworkEndpointGroup{} - if err := copyViaJSON(ret, m.Obj); err != nil { - klog.Errorf("Could not convert %T to *computebeta.NetworkEndpointGroup via JSON: %v", m.Obj, err) - } - return ret -} - -// ToGA retrieves the given version of the object. -func (m *MockRegionNetworkEndpointGroupsObj) ToGA() *computega.NetworkEndpointGroup { - if ret, ok := m.Obj.(*computega.NetworkEndpointGroup); ok { - return ret - } - // Convert the object via JSON copying to the type that was requested. - ret := &computega.NetworkEndpointGroup{} - if err := copyViaJSON(ret, m.Obj); err != nil { - klog.Errorf("Could not convert %T to *computega.NetworkEndpointGroup via JSON: %v", m.Obj, err) - } - return ret -} - // MockRegionNetworkFirewallPoliciesObj is used to store the various object versions in the shared // map of mocked objects. This allows for multiple API versions to co-exist and // share the same "view" of the objects in the backend. @@ -2778,52 +2640,6 @@ func (m *MockRegionTargetHttpsProxiesObj) ToGA() *computega.TargetHttpsProxy { return ret } -// MockRegionTargetTcpProxiesObj is used to store the various object versions in the shared -// map of mocked objects. This allows for multiple API versions to co-exist and -// share the same "view" of the objects in the backend. -type MockRegionTargetTcpProxiesObj struct { - Obj interface{} -} - -// ToAlpha retrieves the given version of the object. -func (m *MockRegionTargetTcpProxiesObj) ToAlpha() *computealpha.TargetTcpProxy { - if ret, ok := m.Obj.(*computealpha.TargetTcpProxy); ok { - return ret - } - // Convert the object via JSON copying to the type that was requested. - ret := &computealpha.TargetTcpProxy{} - if err := copyViaJSON(ret, m.Obj); err != nil { - klog.Errorf("Could not convert %T to *computealpha.TargetTcpProxy via JSON: %v", m.Obj, err) - } - return ret -} - -// ToBeta retrieves the given version of the object. -func (m *MockRegionTargetTcpProxiesObj) ToBeta() *computebeta.TargetTcpProxy { - if ret, ok := m.Obj.(*computebeta.TargetTcpProxy); ok { - return ret - } - // Convert the object via JSON copying to the type that was requested. - ret := &computebeta.TargetTcpProxy{} - if err := copyViaJSON(ret, m.Obj); err != nil { - klog.Errorf("Could not convert %T to *computebeta.TargetTcpProxy via JSON: %v", m.Obj, err) - } - return ret -} - -// ToGA retrieves the given version of the object. -func (m *MockRegionTargetTcpProxiesObj) ToGA() *computega.TargetTcpProxy { - if ret, ok := m.Obj.(*computega.TargetTcpProxy); ok { - return ret - } - // Convert the object via JSON copying to the type that was requested. - ret := &computega.TargetTcpProxy{} - if err := copyViaJSON(ret, m.Obj); err != nil { - klog.Errorf("Could not convert %T to *computega.TargetTcpProxy via JSON: %v", m.Obj, err) - } - return ret -} - // MockRegionUrlMapsObj is used to store the various object versions in the shared // map of mocked objects. This allows for multiple API versions to co-exist and // share the same "view" of the objects in the backend. @@ -3644,7 +3460,6 @@ func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("ga"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -3654,7 +3469,6 @@ func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key, options ...Option return nil, err } call := g.s.GA.Addresses.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -3669,7 +3483,6 @@ func (g *GCEAddresses) Get(ctx context.Context, key *meta.Key, options ...Option func (g *GCEAddresses) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAddresses.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Addresses") ck := &CallContextKey{ @@ -3677,7 +3490,6 @@ func (g *GCEAddresses) List(ctx context.Context, region string, fl *filter.F, op Operation: "List", Version: meta.Version("ga"), Service: "Addresses", - Resource: key, } callObserverStart(ctx, ck) @@ -3736,7 +3548,6 @@ func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *computega Operation: "Insert", Version: meta.Version("ga"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -3748,14 +3559,13 @@ func (g *GCEAddresses) Insert(ctx context.Context, key *meta.Key, obj *computega call := g.s.GA.Addresses.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -3779,7 +3589,6 @@ func (g *GCEAddresses) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("ga"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -3791,14 +3600,13 @@ func (g *GCEAddresses) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -3818,7 +3626,6 @@ func (g *GCEAddresses) AggregatedList(ctx context.Context, fl *filter.F, options Operation: "AggregatedList", Version: meta.Version("ga"), Service: "Addresses", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEAddresses.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -3833,7 +3640,6 @@ func (g *GCEAddresses) AggregatedList(ctx context.Context, fl *filter.F, options if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computega.Address{} f := func(l *computega.AddressAggregatedList) error { @@ -4118,7 +3924,6 @@ func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("alpha"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEAlphaAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -4128,7 +3933,6 @@ func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.Alpha.Addresses.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -4143,7 +3947,6 @@ func (g *GCEAlphaAddresses) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEAlphaAddresses) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaAddresses.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Addresses") ck := &CallContextKey{ @@ -4151,7 +3954,6 @@ func (g *GCEAlphaAddresses) List(ctx context.Context, region string, fl *filter. Operation: "List", Version: meta.Version("alpha"), Service: "Addresses", - Resource: key, } callObserverStart(ctx, ck) @@ -4210,7 +4012,6 @@ func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("alpha"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEAlphaAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4222,14 +4023,13 @@ func (g *GCEAlphaAddresses) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.Alpha.Addresses.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -4253,7 +4053,6 @@ func (g *GCEAlphaAddresses) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("alpha"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEAlphaAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4265,14 +4064,13 @@ func (g *GCEAlphaAddresses) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -4292,7 +4090,6 @@ func (g *GCEAlphaAddresses) AggregatedList(ctx context.Context, fl *filter.F, op Operation: "AggregatedList", Version: meta.Version("alpha"), Service: "Addresses", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEAlphaAddresses.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -4307,7 +4104,6 @@ func (g *GCEAlphaAddresses) AggregatedList(ctx context.Context, fl *filter.F, op if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computealpha.Address{} f := func(l *computealpha.AddressAggregatedList) error { @@ -4592,7 +4388,6 @@ func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("beta"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEBetaAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -4602,7 +4397,6 @@ func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Beta.Addresses.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -4617,7 +4411,6 @@ func (g *GCEBetaAddresses) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEBetaAddresses) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaAddresses.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Addresses") ck := &CallContextKey{ @@ -4625,7 +4418,6 @@ func (g *GCEBetaAddresses) List(ctx context.Context, region string, fl *filter.F Operation: "List", Version: meta.Version("beta"), Service: "Addresses", - Resource: key, } callObserverStart(ctx, ck) @@ -4684,7 +4476,6 @@ func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("beta"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEBetaAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4696,14 +4487,13 @@ func (g *GCEBetaAddresses) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Beta.Addresses.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -4727,7 +4517,6 @@ func (g *GCEBetaAddresses) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("beta"), Service: "Addresses", - Resource: key, } klog.V(5).Infof("GCEBetaAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -4739,14 +4528,13 @@ func (g *GCEBetaAddresses) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -4766,7 +4554,6 @@ func (g *GCEBetaAddresses) AggregatedList(ctx context.Context, fl *filter.F, opt Operation: "AggregatedList", Version: meta.Version("beta"), Service: "Addresses", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEBetaAddresses.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -4781,7 +4568,6 @@ func (g *GCEBetaAddresses) AggregatedList(ctx context.Context, fl *filter.F, opt if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computebeta.Address{} f := func(l *computebeta.AddressAggregatedList) error { @@ -5025,7 +4811,6 @@ func (g *GCEAlphaGlobalAddresses) Get(ctx context.Context, key *meta.Key, option Operation: "Get", Version: meta.Version("alpha"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -5035,7 +4820,6 @@ func (g *GCEAlphaGlobalAddresses) Get(ctx context.Context, key *meta.Key, option return nil, err } call := g.s.Alpha.GlobalAddresses.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaGlobalAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -5050,7 +4834,6 @@ func (g *GCEAlphaGlobalAddresses) Get(ctx context.Context, key *meta.Key, option func (g *GCEAlphaGlobalAddresses) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaGlobalAddresses.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalAddresses") ck := &CallContextKey{ @@ -5058,7 +4841,6 @@ func (g *GCEAlphaGlobalAddresses) List(ctx context.Context, fl *filter.F, option Operation: "List", Version: meta.Version("alpha"), Service: "GlobalAddresses", - Resource: key, } callObserverStart(ctx, ck) @@ -5117,7 +4899,6 @@ func (g *GCEAlphaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("alpha"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5129,14 +4910,13 @@ func (g *GCEAlphaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Alpha.GlobalAddresses.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -5160,7 +4940,6 @@ func (g *GCEAlphaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opt Operation: "Delete", Version: meta.Version("alpha"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5172,14 +4951,13 @@ func (g *GCEAlphaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opt call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -5400,7 +5178,6 @@ func (g *GCEBetaGlobalAddresses) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("beta"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -5410,7 +5187,6 @@ func (g *GCEBetaGlobalAddresses) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Beta.GlobalAddresses.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaGlobalAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -5425,7 +5201,6 @@ func (g *GCEBetaGlobalAddresses) Get(ctx context.Context, key *meta.Key, options func (g *GCEBetaGlobalAddresses) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaGlobalAddresses.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalAddresses") ck := &CallContextKey{ @@ -5433,7 +5208,6 @@ func (g *GCEBetaGlobalAddresses) List(ctx context.Context, fl *filter.F, options Operation: "List", Version: meta.Version("beta"), Service: "GlobalAddresses", - Resource: key, } callObserverStart(ctx, ck) @@ -5492,7 +5266,6 @@ func (g *GCEBetaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("beta"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5504,14 +5277,13 @@ func (g *GCEBetaGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Beta.GlobalAddresses.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -5535,7 +5307,6 @@ func (g *GCEBetaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opti Operation: "Delete", Version: meta.Version("beta"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5547,14 +5318,13 @@ func (g *GCEBetaGlobalAddresses) Delete(ctx context.Context, key *meta.Key, opti call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -5775,7 +5545,6 @@ func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key, options ... Operation: "Get", Version: meta.Version("ga"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEGlobalAddresses.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -5785,7 +5554,6 @@ func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key, options ... return nil, err } call := g.s.GA.GlobalAddresses.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEGlobalAddresses.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -5800,7 +5568,6 @@ func (g *GCEGlobalAddresses) Get(ctx context.Context, key *meta.Key, options ... func (g *GCEGlobalAddresses) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Address, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEGlobalAddresses.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalAddresses") ck := &CallContextKey{ @@ -5808,7 +5575,6 @@ func (g *GCEGlobalAddresses) List(ctx context.Context, fl *filter.F, options ... Operation: "List", Version: meta.Version("ga"), Service: "GlobalAddresses", - Resource: key, } callObserverStart(ctx, ck) @@ -5867,7 +5633,6 @@ func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *com Operation: "Insert", Version: meta.Version("ga"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEGlobalAddresses.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5879,14 +5644,13 @@ func (g *GCEGlobalAddresses) Insert(ctx context.Context, key *meta.Key, obj *com call := g.s.GA.GlobalAddresses.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEGlobalAddresses.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -5910,7 +5674,6 @@ func (g *GCEGlobalAddresses) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "GlobalAddresses", - Resource: key, } klog.V(5).Infof("GCEGlobalAddresses.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -5922,14 +5685,13 @@ func (g *GCEGlobalAddresses) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEGlobalAddresses.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -6248,7 +6010,6 @@ func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key, options ... Operation: "Get", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -6258,7 +6019,6 @@ func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key, options ... return nil, err } call := g.s.GA.BackendServices.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -6273,7 +6033,6 @@ func (g *GCEBackendServices) Get(ctx context.Context, key *meta.Key, options ... func (g *GCEBackendServices) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBackendServices.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "BackendServices") ck := &CallContextKey{ @@ -6281,7 +6040,6 @@ func (g *GCEBackendServices) List(ctx context.Context, fl *filter.F, options ... Operation: "List", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } callObserverStart(ctx, ck) @@ -6340,7 +6098,6 @@ func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *com Operation: "Insert", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6352,14 +6109,13 @@ func (g *GCEBackendServices) Insert(ctx context.Context, key *meta.Key, obj *com call := g.s.GA.BackendServices.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6383,7 +6139,6 @@ func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6395,14 +6150,13 @@ func (g *GCEBackendServices) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -6422,7 +6176,6 @@ func (g *GCEBackendServices) AggregatedList(ctx context.Context, fl *filter.F, o Operation: "AggregatedList", Version: meta.Version("ga"), Service: "BackendServices", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEBackendServices.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -6437,7 +6190,6 @@ func (g *GCEBackendServices) AggregatedList(ctx context.Context, fl *filter.F, o if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computega.BackendService{} f := func(l *computega.BackendServiceAggregatedList) error { @@ -6484,7 +6236,6 @@ func (g *GCEBackendServices) AddSignedUrlKey(ctx context.Context, key *meta.Key, Operation: "AddSignedUrlKey", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.AddSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6494,14 +6245,13 @@ func (g *GCEBackendServices) AddSignedUrlKey(ctx context.Context, key *meta.Key, } call := g.s.GA.BackendServices.AddSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6528,7 +6278,6 @@ func (g *GCEBackendServices) DeleteSignedUrlKey(ctx context.Context, key *meta.K Operation: "DeleteSignedUrlKey", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.DeleteSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6538,14 +6287,13 @@ func (g *GCEBackendServices) DeleteSignedUrlKey(ctx context.Context, key *meta.K } call := g.s.GA.BackendServices.DeleteSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6572,7 +6320,6 @@ func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 Operation: "GetHealth", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6582,7 +6329,6 @@ func (g *GCEBackendServices) GetHealth(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.BackendServices.GetHealth(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -6607,7 +6353,6 @@ func (g *GCEBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 *com Operation: "Patch", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6617,14 +6362,13 @@ func (g *GCEBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 *com } call := g.s.GA.BackendServices.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6651,7 +6395,6 @@ func (g *GCEBackendServices) SetSecurityPolicy(ctx context.Context, key *meta.Ke Operation: "SetSecurityPolicy", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6661,14 +6404,13 @@ func (g *GCEBackendServices) SetSecurityPolicy(ctx context.Context, key *meta.Ke } call := g.s.GA.BackendServices.SetSecurityPolicy(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -6695,7 +6437,6 @@ func (g *GCEBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *co Operation: "Update", Version: meta.Version("ga"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -6705,14 +6446,13 @@ func (g *GCEBackendServices) Update(ctx context.Context, key *meta.Key, arg0 *co } call := g.s.GA.BackendServices.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7024,7 +6764,6 @@ func (g *GCEBetaBackendServices) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -7034,7 +6773,6 @@ func (g *GCEBetaBackendServices) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Beta.BackendServices.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -7049,7 +6787,6 @@ func (g *GCEBetaBackendServices) Get(ctx context.Context, key *meta.Key, options func (g *GCEBetaBackendServices) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaBackendServices.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "BackendServices") ck := &CallContextKey{ @@ -7057,7 +6794,6 @@ func (g *GCEBetaBackendServices) List(ctx context.Context, fl *filter.F, options Operation: "List", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } callObserverStart(ctx, ck) @@ -7116,7 +6852,6 @@ func (g *GCEBetaBackendServices) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7128,14 +6863,13 @@ func (g *GCEBetaBackendServices) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Beta.BackendServices.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7159,7 +6893,6 @@ func (g *GCEBetaBackendServices) Delete(ctx context.Context, key *meta.Key, opti Operation: "Delete", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7171,14 +6904,13 @@ func (g *GCEBetaBackendServices) Delete(ctx context.Context, key *meta.Key, opti call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -7198,7 +6930,6 @@ func (g *GCEBetaBackendServices) AggregatedList(ctx context.Context, fl *filter. Operation: "AggregatedList", Version: meta.Version("beta"), Service: "BackendServices", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEBetaBackendServices.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -7213,7 +6944,6 @@ func (g *GCEBetaBackendServices) AggregatedList(ctx context.Context, fl *filter. if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computebeta.BackendService{} f := func(l *computebeta.BackendServiceAggregatedList) error { @@ -7260,7 +6990,6 @@ func (g *GCEBetaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta. Operation: "AddSignedUrlKey", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.AddSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7270,14 +6999,13 @@ func (g *GCEBetaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta. } call := g.s.Beta.BackendServices.AddSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7304,7 +7032,6 @@ func (g *GCEBetaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *me Operation: "DeleteSignedUrlKey", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.DeleteSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7314,14 +7041,13 @@ func (g *GCEBetaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *me } call := g.s.Beta.BackendServices.DeleteSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7348,7 +7074,6 @@ func (g *GCEBetaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 Operation: "Patch", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7358,14 +7083,13 @@ func (g *GCEBetaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 } call := g.s.Beta.BackendServices.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7392,7 +7116,6 @@ func (g *GCEBetaBackendServices) SetSecurityPolicy(ctx context.Context, key *met Operation: "SetSecurityPolicy", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7402,14 +7125,13 @@ func (g *GCEBetaBackendServices) SetSecurityPolicy(ctx context.Context, key *met } call := g.s.Beta.BackendServices.SetSecurityPolicy(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7436,7 +7158,6 @@ func (g *GCEBetaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 Operation: "Update", Version: meta.Version("beta"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7446,14 +7167,13 @@ func (g *GCEBetaBackendServices) Update(ctx context.Context, key *meta.Key, arg0 } call := g.s.Beta.BackendServices.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7765,7 +7485,6 @@ func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key, option Operation: "Get", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -7775,7 +7494,6 @@ func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key, option return nil, err } call := g.s.Alpha.BackendServices.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -7790,7 +7508,6 @@ func (g *GCEAlphaBackendServices) Get(ctx context.Context, key *meta.Key, option func (g *GCEAlphaBackendServices) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaBackendServices.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "BackendServices") ck := &CallContextKey{ @@ -7798,7 +7515,6 @@ func (g *GCEAlphaBackendServices) List(ctx context.Context, fl *filter.F, option Operation: "List", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } callObserverStart(ctx, ck) @@ -7857,7 +7573,6 @@ func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7869,14 +7584,13 @@ func (g *GCEAlphaBackendServices) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Alpha.BackendServices.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -7900,7 +7614,6 @@ func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key, opt Operation: "Delete", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -7912,14 +7625,13 @@ func (g *GCEAlphaBackendServices) Delete(ctx context.Context, key *meta.Key, opt call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -7939,7 +7651,6 @@ func (g *GCEAlphaBackendServices) AggregatedList(ctx context.Context, fl *filter Operation: "AggregatedList", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEAlphaBackendServices.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -7954,7 +7665,6 @@ func (g *GCEAlphaBackendServices) AggregatedList(ctx context.Context, fl *filter if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computealpha.BackendService{} f := func(l *computealpha.BackendServiceAggregatedList) error { @@ -8001,7 +7711,6 @@ func (g *GCEAlphaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta Operation: "AddSignedUrlKey", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.AddSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8011,14 +7720,13 @@ func (g *GCEAlphaBackendServices) AddSignedUrlKey(ctx context.Context, key *meta } call := g.s.Alpha.BackendServices.AddSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaBackendServices.AddSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8045,7 +7753,6 @@ func (g *GCEAlphaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *m Operation: "DeleteSignedUrlKey", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.DeleteSignedUrlKey(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8055,14 +7762,13 @@ func (g *GCEAlphaBackendServices) DeleteSignedUrlKey(ctx context.Context, key *m } call := g.s.Alpha.BackendServices.DeleteSignedUrlKey(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaBackendServices.DeleteSignedUrlKey(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8089,7 +7795,6 @@ func (g *GCEAlphaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 Operation: "Patch", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8099,14 +7804,13 @@ func (g *GCEAlphaBackendServices) Patch(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.BackendServices.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8133,7 +7837,6 @@ func (g *GCEAlphaBackendServices) SetSecurityPolicy(ctx context.Context, key *me Operation: "SetSecurityPolicy", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8143,14 +7846,13 @@ func (g *GCEAlphaBackendServices) SetSecurityPolicy(ctx context.Context, key *me } call := g.s.Alpha.BackendServices.SetSecurityPolicy(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8177,7 +7879,6 @@ func (g *GCEAlphaBackendServices) Update(ctx context.Context, key *meta.Key, arg Operation: "Update", Version: meta.Version("alpha"), Service: "BackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8187,14 +7888,13 @@ func (g *GCEAlphaBackendServices) Update(ctx context.Context, key *meta.Key, arg } call := g.s.Alpha.BackendServices.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8461,7 +8161,6 @@ func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -8471,7 +8170,6 @@ func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.RegionBackendServices.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -8486,7 +8184,6 @@ func (g *GCERegionBackendServices) Get(ctx context.Context, key *meta.Key, optio func (g *GCERegionBackendServices) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionBackendServices.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionBackendServices") ck := &CallContextKey{ @@ -8494,7 +8191,6 @@ func (g *GCERegionBackendServices) List(ctx context.Context, region string, fl * Operation: "List", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } callObserverStart(ctx, ck) @@ -8553,7 +8249,6 @@ func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8565,14 +8260,13 @@ func (g *GCERegionBackendServices) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.RegionBackendServices.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8596,7 +8290,6 @@ func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8608,14 +8301,13 @@ func (g *GCERegionBackendServices) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -8639,7 +8331,6 @@ func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, Operation: "GetHealth", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCERegionBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8649,7 +8340,6 @@ func (g *GCERegionBackendServices) GetHealth(ctx context.Context, key *meta.Key, } call := g.s.GA.RegionBackendServices.GetHealth(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -8674,7 +8364,6 @@ func (g *GCERegionBackendServices) Patch(ctx context.Context, key *meta.Key, arg Operation: "Patch", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8684,14 +8373,13 @@ func (g *GCERegionBackendServices) Patch(ctx context.Context, key *meta.Key, arg } call := g.s.GA.RegionBackendServices.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8718,7 +8406,6 @@ func (g *GCERegionBackendServices) SetSecurityPolicy(ctx context.Context, key *m Operation: "SetSecurityPolicy", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCERegionBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8728,14 +8415,13 @@ func (g *GCERegionBackendServices) SetSecurityPolicy(ctx context.Context, key *m } call := g.s.GA.RegionBackendServices.SetSecurityPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -8762,7 +8448,6 @@ func (g *GCERegionBackendServices) Update(ctx context.Context, key *meta.Key, ar Operation: "Update", Version: meta.Version("ga"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCERegionBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -8772,14 +8457,13 @@ func (g *GCERegionBackendServices) Update(ctx context.Context, key *meta.Key, ar } call := g.s.GA.RegionBackendServices.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9046,7 +8730,6 @@ func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -9056,7 +8739,6 @@ func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.Alpha.RegionBackendServices.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -9071,7 +8753,6 @@ func (g *GCEAlphaRegionBackendServices) Get(ctx context.Context, key *meta.Key, func (g *GCEAlphaRegionBackendServices) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionBackendServices.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionBackendServices") ck := &CallContextKey{ @@ -9079,7 +8760,6 @@ func (g *GCEAlphaRegionBackendServices) List(ctx context.Context, region string, Operation: "List", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } callObserverStart(ctx, ck) @@ -9138,7 +8818,6 @@ func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Ke Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9150,14 +8829,13 @@ func (g *GCEAlphaRegionBackendServices) Insert(ctx context.Context, key *meta.Ke call := g.s.Alpha.RegionBackendServices.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9181,7 +8859,6 @@ func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Ke Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9193,14 +8870,13 @@ func (g *GCEAlphaRegionBackendServices) Delete(ctx context.Context, key *meta.Ke call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -9224,7 +8900,6 @@ func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta Operation: "GetHealth", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9234,7 +8909,6 @@ func (g *GCEAlphaRegionBackendServices) GetHealth(ctx context.Context, key *meta } call := g.s.Alpha.RegionBackendServices.GetHealth(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -9259,7 +8933,6 @@ func (g *GCEAlphaRegionBackendServices) Patch(ctx context.Context, key *meta.Key Operation: "Patch", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9269,14 +8942,13 @@ func (g *GCEAlphaRegionBackendServices) Patch(ctx context.Context, key *meta.Key } call := g.s.Alpha.RegionBackendServices.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9303,7 +8975,6 @@ func (g *GCEAlphaRegionBackendServices) SetSecurityPolicy(ctx context.Context, k Operation: "SetSecurityPolicy", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9313,14 +8984,13 @@ func (g *GCEAlphaRegionBackendServices) SetSecurityPolicy(ctx context.Context, k } call := g.s.Alpha.RegionBackendServices.SetSecurityPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9347,7 +9017,6 @@ func (g *GCEAlphaRegionBackendServices) Update(ctx context.Context, key *meta.Ke Operation: "Update", Version: meta.Version("alpha"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9357,14 +9026,13 @@ func (g *GCEAlphaRegionBackendServices) Update(ctx context.Context, key *meta.Ke } call := g.s.Alpha.RegionBackendServices.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9631,7 +9299,6 @@ func (g *GCEBetaRegionBackendServices) Get(ctx context.Context, key *meta.Key, o Operation: "Get", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -9641,7 +9308,6 @@ func (g *GCEBetaRegionBackendServices) Get(ctx context.Context, key *meta.Key, o return nil, err } call := g.s.Beta.RegionBackendServices.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaRegionBackendServices.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -9656,7 +9322,6 @@ func (g *GCEBetaRegionBackendServices) Get(ctx context.Context, key *meta.Key, o func (g *GCEBetaRegionBackendServices) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.BackendService, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaRegionBackendServices.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionBackendServices") ck := &CallContextKey{ @@ -9664,7 +9329,6 @@ func (g *GCEBetaRegionBackendServices) List(ctx context.Context, region string, Operation: "List", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } callObserverStart(ctx, ck) @@ -9723,7 +9387,6 @@ func (g *GCEBetaRegionBackendServices) Insert(ctx context.Context, key *meta.Key Operation: "Insert", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9735,14 +9398,13 @@ func (g *GCEBetaRegionBackendServices) Insert(ctx context.Context, key *meta.Key call := g.s.Beta.RegionBackendServices.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionBackendServices.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9766,7 +9428,6 @@ func (g *GCEBetaRegionBackendServices) Delete(ctx context.Context, key *meta.Key Operation: "Delete", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9778,14 +9439,13 @@ func (g *GCEBetaRegionBackendServices) Delete(ctx context.Context, key *meta.Key call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionBackendServices.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -9809,7 +9469,6 @@ func (g *GCEBetaRegionBackendServices) GetHealth(ctx context.Context, key *meta. Operation: "GetHealth", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.GetHealth(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9819,7 +9478,6 @@ func (g *GCEBetaRegionBackendServices) GetHealth(ctx context.Context, key *meta. } call := g.s.Beta.RegionBackendServices.GetHealth(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -9844,7 +9502,6 @@ func (g *GCEBetaRegionBackendServices) Patch(ctx context.Context, key *meta.Key, Operation: "Patch", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9854,14 +9511,13 @@ func (g *GCEBetaRegionBackendServices) Patch(ctx context.Context, key *meta.Key, } call := g.s.Beta.RegionBackendServices.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRegionBackendServices.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9888,7 +9544,6 @@ func (g *GCEBetaRegionBackendServices) SetSecurityPolicy(ctx context.Context, ke Operation: "SetSecurityPolicy", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.SetSecurityPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9898,14 +9553,13 @@ func (g *GCEBetaRegionBackendServices) SetSecurityPolicy(ctx context.Context, ke } call := g.s.Beta.RegionBackendServices.SetSecurityPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRegionBackendServices.SetSecurityPolicy(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -9932,7 +9586,6 @@ func (g *GCEBetaRegionBackendServices) Update(ctx context.Context, key *meta.Key Operation: "Update", Version: meta.Version("beta"), Service: "RegionBackendServices", - Resource: key, } klog.V(5).Infof("GCEBetaRegionBackendServices.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -9942,14 +9595,13 @@ func (g *GCEBetaRegionBackendServices) Update(ctx context.Context, key *meta.Key } call := g.s.Beta.RegionBackendServices.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRegionBackendServices.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10186,7 +9838,6 @@ func (g *GCEDisks) Get(ctx context.Context, key *meta.Key, options ...Option) (* Operation: "Get", Version: meta.Version("ga"), Service: "Disks", - Resource: key, } klog.V(5).Infof("GCEDisks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -10196,7 +9847,6 @@ func (g *GCEDisks) Get(ctx context.Context, key *meta.Key, options ...Option) (* return nil, err } call := g.s.GA.Disks.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEDisks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -10211,7 +9861,6 @@ func (g *GCEDisks) Get(ctx context.Context, key *meta.Key, options ...Option) (* func (g *GCEDisks) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.Disk, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEDisks.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Disks") ck := &CallContextKey{ @@ -10219,7 +9868,6 @@ func (g *GCEDisks) List(ctx context.Context, zone string, fl *filter.F, options Operation: "List", Version: meta.Version("ga"), Service: "Disks", - Resource: key, } callObserverStart(ctx, ck) @@ -10278,7 +9926,6 @@ func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *computega.Dis Operation: "Insert", Version: meta.Version("ga"), Service: "Disks", - Resource: key, } klog.V(5).Infof("GCEDisks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10290,14 +9937,13 @@ func (g *GCEDisks) Insert(ctx context.Context, key *meta.Key, obj *computega.Dis call := g.s.GA.Disks.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10321,7 +9967,6 @@ func (g *GCEDisks) Delete(ctx context.Context, key *meta.Key, options ...Option) Operation: "Delete", Version: meta.Version("ga"), Service: "Disks", - Resource: key, } klog.V(5).Infof("GCEDisks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10333,14 +9978,13 @@ func (g *GCEDisks) Delete(ctx context.Context, key *meta.Key, options ...Option) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEDisks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEDisks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -10364,7 +10008,6 @@ func (g *GCEDisks) Resize(ctx context.Context, key *meta.Key, arg0 *computega.Di Operation: "Resize", Version: meta.Version("ga"), Service: "Disks", - Resource: key, } klog.V(5).Infof("GCEDisks.Resize(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10374,14 +10017,13 @@ func (g *GCEDisks) Resize(ctx context.Context, key *meta.Key, arg0 *computega.Di } call := g.s.GA.Disks.Resize(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10618,7 +10260,6 @@ func (g *GCERegionDisks) Get(ctx context.Context, key *meta.Key, options ...Opti Operation: "Get", Version: meta.Version("ga"), Service: "RegionDisks", - Resource: key, } klog.V(5).Infof("GCERegionDisks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -10628,7 +10269,6 @@ func (g *GCERegionDisks) Get(ctx context.Context, key *meta.Key, options ...Opti return nil, err } call := g.s.GA.RegionDisks.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionDisks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -10643,7 +10283,6 @@ func (g *GCERegionDisks) Get(ctx context.Context, key *meta.Key, options ...Opti func (g *GCERegionDisks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Disk, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionDisks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionDisks") ck := &CallContextKey{ @@ -10651,7 +10290,6 @@ func (g *GCERegionDisks) List(ctx context.Context, region string, fl *filter.F, Operation: "List", Version: meta.Version("ga"), Service: "RegionDisks", - Resource: key, } callObserverStart(ctx, ck) @@ -10710,7 +10348,6 @@ func (g *GCERegionDisks) Insert(ctx context.Context, key *meta.Key, obj *compute Operation: "Insert", Version: meta.Version("ga"), Service: "RegionDisks", - Resource: key, } klog.V(5).Infof("GCERegionDisks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10722,14 +10359,13 @@ func (g *GCERegionDisks) Insert(ctx context.Context, key *meta.Key, obj *compute call := g.s.GA.RegionDisks.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionDisks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -10753,7 +10389,6 @@ func (g *GCERegionDisks) Delete(ctx context.Context, key *meta.Key, options ...O Operation: "Delete", Version: meta.Version("ga"), Service: "RegionDisks", - Resource: key, } klog.V(5).Infof("GCERegionDisks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10765,14 +10400,13 @@ func (g *GCERegionDisks) Delete(ctx context.Context, key *meta.Key, options ...O call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionDisks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionDisks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -10796,7 +10430,6 @@ func (g *GCERegionDisks) Resize(ctx context.Context, key *meta.Key, arg0 *comput Operation: "Resize", Version: meta.Version("ga"), Service: "RegionDisks", - Resource: key, } klog.V(5).Infof("GCERegionDisks.Resize(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -10806,14 +10439,13 @@ func (g *GCERegionDisks) Resize(ctx context.Context, key *meta.Key, arg0 *comput } call := g.s.GA.RegionDisks.Resize(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionDisks.Resize(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11057,7 +10689,6 @@ func (g *GCEAlphaFirewalls) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("alpha"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -11067,7 +10698,6 @@ func (g *GCEAlphaFirewalls) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.Alpha.Firewalls.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaFirewalls.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -11082,7 +10712,6 @@ func (g *GCEAlphaFirewalls) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEAlphaFirewalls) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Firewall, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaFirewalls.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Firewalls") ck := &CallContextKey{ @@ -11090,7 +10719,6 @@ func (g *GCEAlphaFirewalls) List(ctx context.Context, fl *filter.F, options ...O Operation: "List", Version: meta.Version("alpha"), Service: "Firewalls", - Resource: key, } callObserverStart(ctx, ck) @@ -11149,7 +10777,6 @@ func (g *GCEAlphaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("alpha"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11161,14 +10788,13 @@ func (g *GCEAlphaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.Alpha.Firewalls.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11192,7 +10818,6 @@ func (g *GCEAlphaFirewalls) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("alpha"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11204,14 +10829,13 @@ func (g *GCEAlphaFirewalls) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaFirewalls.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaFirewalls.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -11235,7 +10859,6 @@ func (g *GCEAlphaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *comp Operation: "Patch", Version: meta.Version("alpha"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11245,14 +10868,13 @@ func (g *GCEAlphaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.Alpha.Firewalls.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11279,7 +10901,6 @@ func (g *GCEAlphaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *com Operation: "Update", Version: meta.Version("alpha"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEAlphaFirewalls.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11289,14 +10910,13 @@ func (g *GCEAlphaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *com } call := g.s.Alpha.Firewalls.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11540,7 +11160,6 @@ func (g *GCEBetaFirewalls) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("beta"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -11550,7 +11169,6 @@ func (g *GCEBetaFirewalls) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Beta.Firewalls.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaFirewalls.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -11565,7 +11183,6 @@ func (g *GCEBetaFirewalls) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEBetaFirewalls) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Firewall, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaFirewalls.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Firewalls") ck := &CallContextKey{ @@ -11573,7 +11190,6 @@ func (g *GCEBetaFirewalls) List(ctx context.Context, fl *filter.F, options ...Op Operation: "List", Version: meta.Version("beta"), Service: "Firewalls", - Resource: key, } callObserverStart(ctx, ck) @@ -11632,7 +11248,6 @@ func (g *GCEBetaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("beta"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11644,14 +11259,13 @@ func (g *GCEBetaFirewalls) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Beta.Firewalls.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11675,7 +11289,6 @@ func (g *GCEBetaFirewalls) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("beta"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11687,14 +11300,13 @@ func (g *GCEBetaFirewalls) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaFirewalls.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaFirewalls.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -11718,7 +11330,6 @@ func (g *GCEBetaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *compu Operation: "Patch", Version: meta.Version("beta"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11728,14 +11339,13 @@ func (g *GCEBetaFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.Beta.Firewalls.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -11762,7 +11372,6 @@ func (g *GCEBetaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *comp Operation: "Update", Version: meta.Version("beta"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEBetaFirewalls.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -11772,14 +11381,13 @@ func (g *GCEBetaFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.Beta.Firewalls.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12023,7 +11631,6 @@ func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("ga"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEFirewalls.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -12033,7 +11640,6 @@ func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key, options ...Option return nil, err } call := g.s.GA.Firewalls.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEFirewalls.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -12048,7 +11654,6 @@ func (g *GCEFirewalls) Get(ctx context.Context, key *meta.Key, options ...Option func (g *GCEFirewalls) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Firewall, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEFirewalls.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Firewalls") ck := &CallContextKey{ @@ -12056,7 +11661,6 @@ func (g *GCEFirewalls) List(ctx context.Context, fl *filter.F, options ...Option Operation: "List", Version: meta.Version("ga"), Service: "Firewalls", - Resource: key, } callObserverStart(ctx, ck) @@ -12115,7 +11719,6 @@ func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *computega Operation: "Insert", Version: meta.Version("ga"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEFirewalls.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12127,14 +11730,13 @@ func (g *GCEFirewalls) Insert(ctx context.Context, key *meta.Key, obj *computega call := g.s.GA.Firewalls.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEFirewalls.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12158,7 +11760,6 @@ func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("ga"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEFirewalls.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12170,14 +11771,13 @@ func (g *GCEFirewalls) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEFirewalls.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEFirewalls.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -12201,7 +11801,6 @@ func (g *GCEFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *computega Operation: "Patch", Version: meta.Version("ga"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEFirewalls.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12211,14 +11810,13 @@ func (g *GCEFirewalls) Patch(ctx context.Context, key *meta.Key, arg0 *computega } call := g.s.GA.Firewalls.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEFirewalls.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12245,7 +11843,6 @@ func (g *GCEFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *computeg Operation: "Update", Version: meta.Version("ga"), Service: "Firewalls", - Resource: key, } klog.V(5).Infof("GCEFirewalls.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12255,14 +11852,13 @@ func (g *GCEFirewalls) Update(ctx context.Context, key *meta.Key, arg0 *computeg } call := g.s.GA.Firewalls.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEFirewalls.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12606,7 +12202,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) Get(ctx context.Context, key *meta.Key Operation: "Get", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -12616,7 +12211,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) Get(ctx context.Context, key *meta.Key return nil, err } call := g.s.Alpha.NetworkFirewallPolicies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -12631,7 +12225,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) Get(ctx context.Context, key *meta.Key func (g *GCEAlphaNetworkFirewallPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.FirewallPolicy, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "NetworkFirewallPolicies") ck := &CallContextKey{ @@ -12639,7 +12232,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) List(ctx context.Context, fl *filter.F Operation: "List", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } callObserverStart(ctx, ck) @@ -12698,7 +12290,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) Insert(ctx context.Context, key *meta. Operation: "Insert", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12710,14 +12301,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) Insert(ctx context.Context, key *meta. call := g.s.Alpha.NetworkFirewallPolicies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12741,7 +12331,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) Delete(ctx context.Context, key *meta. Operation: "Delete", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12753,14 +12342,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) Delete(ctx context.Context, key *meta. call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -12784,7 +12372,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddAssociation(ctx context.Context, ke Operation: "AddAssociation", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.AddAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12794,14 +12381,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddAssociation(ctx context.Context, ke } call := g.s.Alpha.NetworkFirewallPolicies.AddAssociation(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12828,7 +12414,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddRule(ctx context.Context, key *meta Operation: "AddRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12838,14 +12423,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) AddRule(ctx context.Context, key *meta } call := g.s.Alpha.NetworkFirewallPolicies.AddRule(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12872,7 +12456,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) CloneRules(ctx context.Context, key *m Operation: "CloneRules", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.CloneRules(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12882,14 +12465,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) CloneRules(ctx context.Context, key *m } call := g.s.Alpha.NetworkFirewallPolicies.CloneRules(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -12916,7 +12498,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetAssociation(ctx context.Context, ke Operation: "GetAssociation", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.GetAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12926,7 +12507,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetAssociation(ctx context.Context, ke } call := g.s.Alpha.NetworkFirewallPolicies.GetAssociation(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -12951,7 +12531,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetIamPolicy(ctx context.Context, key Operation: "GetIamPolicy", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12961,7 +12540,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetIamPolicy(ctx context.Context, key } call := g.s.Alpha.NetworkFirewallPolicies.GetIamPolicy(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -12986,7 +12564,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetRule(ctx context.Context, key *meta Operation: "GetRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -12996,7 +12573,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) GetRule(ctx context.Context, key *meta } call := g.s.Alpha.NetworkFirewallPolicies.GetRule(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13021,7 +12597,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) Patch(ctx context.Context, key *meta.K Operation: "Patch", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13031,14 +12606,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) Patch(ctx context.Context, key *meta.K } call := g.s.Alpha.NetworkFirewallPolicies.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13065,7 +12639,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) PatchRule(ctx context.Context, key *me Operation: "PatchRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13075,14 +12648,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) PatchRule(ctx context.Context, key *me } call := g.s.Alpha.NetworkFirewallPolicies.PatchRule(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13109,7 +12681,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveAssociation(ctx context.Context, Operation: "RemoveAssociation", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13119,14 +12690,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveAssociation(ctx context.Context, } call := g.s.Alpha.NetworkFirewallPolicies.RemoveAssociation(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13153,7 +12723,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveRule(ctx context.Context, key *m Operation: "RemoveRule", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13163,14 +12732,13 @@ func (g *GCEAlphaNetworkFirewallPolicies) RemoveRule(ctx context.Context, key *m } call := g.s.Alpha.NetworkFirewallPolicies.RemoveRule(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13197,7 +12765,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) SetIamPolicy(ctx context.Context, key Operation: "SetIamPolicy", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13207,7 +12774,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) SetIamPolicy(ctx context.Context, key } call := g.s.Alpha.NetworkFirewallPolicies.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13232,7 +12798,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) TestIamPermissions(ctx context.Context Operation: "TestIamPermissions", Version: meta.Version("alpha"), Service: "NetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkFirewallPolicies.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13242,7 +12807,6 @@ func (g *GCEAlphaNetworkFirewallPolicies) TestIamPermissions(ctx context.Context } call := g.s.Alpha.NetworkFirewallPolicies.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13587,7 +13151,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Get(ctx context.Context, key *me Operation: "Get", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -13597,7 +13160,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Get(ctx context.Context, key *me return nil, err } call := g.s.Alpha.RegionNetworkFirewallPolicies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -13612,7 +13174,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Get(ctx context.Context, key *me func (g *GCEAlphaRegionNetworkFirewallPolicies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.FirewallPolicy, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkFirewallPolicies") ck := &CallContextKey{ @@ -13620,7 +13181,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) List(ctx context.Context, region Operation: "List", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } callObserverStart(ctx, ck) @@ -13679,7 +13239,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Insert(ctx context.Context, key Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13691,14 +13250,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Insert(ctx context.Context, key call := g.s.Alpha.RegionNetworkFirewallPolicies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13722,7 +13280,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Delete(ctx context.Context, key Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13734,14 +13291,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Delete(ctx context.Context, key call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -13765,7 +13321,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddAssociation(ctx context.Conte Operation: "AddAssociation", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13775,14 +13330,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddAssociation(ctx context.Conte } call := g.s.Alpha.RegionNetworkFirewallPolicies.AddAssociation(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13809,7 +13363,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddRule(ctx context.Context, key Operation: "AddRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13819,14 +13372,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) AddRule(ctx context.Context, key } call := g.s.Alpha.RegionNetworkFirewallPolicies.AddRule(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13853,7 +13405,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) CloneRules(ctx context.Context, Operation: "CloneRules", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.CloneRules(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13863,14 +13414,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) CloneRules(ctx context.Context, } call := g.s.Alpha.RegionNetworkFirewallPolicies.CloneRules(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.CloneRules(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -13897,7 +13447,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetAssociation(ctx context.Conte Operation: "GetAssociation", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.GetAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13907,7 +13456,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetAssociation(ctx context.Conte } call := g.s.Alpha.RegionNetworkFirewallPolicies.GetAssociation(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13932,7 +13480,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetIamPolicy(ctx context.Context Operation: "GetIamPolicy", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13942,7 +13489,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetIamPolicy(ctx context.Context } call := g.s.Alpha.RegionNetworkFirewallPolicies.GetIamPolicy(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -13967,7 +13513,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetRule(ctx context.Context, key Operation: "GetRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -13977,7 +13522,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) GetRule(ctx context.Context, key } call := g.s.Alpha.RegionNetworkFirewallPolicies.GetRule(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -14002,7 +13546,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Patch(ctx context.Context, key * Operation: "Patch", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14012,14 +13555,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) Patch(ctx context.Context, key * } call := g.s.Alpha.RegionNetworkFirewallPolicies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14046,7 +13588,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) PatchRule(ctx context.Context, k Operation: "PatchRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14056,14 +13597,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) PatchRule(ctx context.Context, k } call := g.s.Alpha.RegionNetworkFirewallPolicies.PatchRule(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14090,7 +13630,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveAssociation(ctx context.Co Operation: "RemoveAssociation", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14100,14 +13639,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveAssociation(ctx context.Co } call := g.s.Alpha.RegionNetworkFirewallPolicies.RemoveAssociation(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveAssociation(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14134,7 +13672,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveRule(ctx context.Context, Operation: "RemoveRule", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14144,14 +13681,13 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) RemoveRule(ctx context.Context, } call := g.s.Alpha.RegionNetworkFirewallPolicies.RemoveRule(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionNetworkFirewallPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14178,7 +13714,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) SetIamPolicy(ctx context.Context Operation: "SetIamPolicy", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14188,7 +13723,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) SetIamPolicy(ctx context.Context } call := g.s.Alpha.RegionNetworkFirewallPolicies.SetIamPolicy(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -14213,7 +13747,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) TestIamPermissions(ctx context.C Operation: "TestIamPermissions", Version: meta.Version("alpha"), Service: "RegionNetworkFirewallPolicies", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionNetworkFirewallPolicies.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14223,7 +13756,6 @@ func (g *GCEAlphaRegionNetworkFirewallPolicies) TestIamPermissions(ctx context.C } call := g.s.Alpha.RegionNetworkFirewallPolicies.TestIamPermissions(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -14239,7 +13771,6 @@ type ForwardingRules interface { List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computega.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computega.RegionSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computega.TargetReference, ...Option) error } @@ -14281,7 +13812,6 @@ type MockForwardingRules struct { ListHook func(ctx context.Context, region string, fl *filter.F, m *MockForwardingRules, options ...Option) (bool, []*computega.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, m *MockForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockForwardingRules, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computega.ForwardingRule, *MockForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computega.RegionSetLabelsRequest, *MockForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computega.TargetReference, *MockForwardingRules, ...Option) error @@ -14433,14 +13963,6 @@ func (m *MockForwardingRules) Obj(o *computega.ForwardingRule) *MockForwardingRu return &MockForwardingRulesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - // SetLabels is a mock for the corresponding method. func (m *MockForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.RegionSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -14478,7 +14000,6 @@ func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key, options ... Operation: "Get", Version: meta.Version("ga"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -14488,7 +14009,6 @@ func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key, options ... return nil, err } call := g.s.GA.ForwardingRules.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -14503,7 +14023,6 @@ func (g *GCEForwardingRules) Get(ctx context.Context, key *meta.Key, options ... func (g *GCEForwardingRules) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEForwardingRules.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ForwardingRules") ck := &CallContextKey{ @@ -14511,7 +14030,6 @@ func (g *GCEForwardingRules) List(ctx context.Context, region string, fl *filter Operation: "List", Version: meta.Version("ga"), Service: "ForwardingRules", - Resource: key, } callObserverStart(ctx, ck) @@ -14570,7 +14088,6 @@ func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *com Operation: "Insert", Version: meta.Version("ga"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14582,14 +14099,13 @@ func (g *GCEForwardingRules) Insert(ctx context.Context, key *meta.Key, obj *com call := g.s.GA.ForwardingRules.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14613,7 +14129,6 @@ func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14625,14 +14140,13 @@ func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -14641,50 +14155,6 @@ func (g *GCEForwardingRules) Delete(ctx context.Context, key *meta.Key, options return err } -// Patch is a method on GCEForwardingRules. -func (g *GCEForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ForwardingRules") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("ga"), - Service: "ForwardingRules", - Resource: key, - } - klog.V(5).Infof("GCEForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.ForwardingRules.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - // SetLabels is a method on GCEForwardingRules. func (g *GCEForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.RegionSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -14700,7 +14170,6 @@ func (g *GCEForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 Operation: "SetLabels", Version: meta.Version("ga"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14710,14 +14179,13 @@ func (g *GCEForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.ForwardingRules.SetLabels(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14744,7 +14212,6 @@ func (g *GCEForwardingRules) SetTarget(ctx context.Context, key *meta.Key, arg0 Operation: "SetTarget", Version: meta.Version("ga"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -14754,14 +14221,13 @@ func (g *GCEForwardingRules) SetTarget(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.ForwardingRules.SetTarget(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -14779,7 +14245,6 @@ type AlphaForwardingRules interface { List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computealpha.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computealpha.RegionSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computealpha.TargetReference, ...Option) error } @@ -14821,7 +14286,6 @@ type MockAlphaForwardingRules struct { ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaForwardingRules, options ...Option) (bool, []*computealpha.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, m *MockAlphaForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaForwardingRules, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computealpha.ForwardingRule, *MockAlphaForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computealpha.RegionSetLabelsRequest, *MockAlphaForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computealpha.TargetReference, *MockAlphaForwardingRules, ...Option) error @@ -14973,14 +14437,6 @@ func (m *MockAlphaForwardingRules) Obj(o *computealpha.ForwardingRule) *MockForw return &MockForwardingRulesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockAlphaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - // SetLabels is a mock for the corresponding method. func (m *MockAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -15018,7 +14474,6 @@ func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key, option Operation: "Get", Version: meta.Version("alpha"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -15028,7 +14483,6 @@ func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key, option return nil, err } call := g.s.Alpha.ForwardingRules.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -15043,7 +14497,6 @@ func (g *GCEAlphaForwardingRules) Get(ctx context.Context, key *meta.Key, option func (g *GCEAlphaForwardingRules) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaForwardingRules.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ForwardingRules") ck := &CallContextKey{ @@ -15051,7 +14504,6 @@ func (g *GCEAlphaForwardingRules) List(ctx context.Context, region string, fl *f Operation: "List", Version: meta.Version("alpha"), Service: "ForwardingRules", - Resource: key, } callObserverStart(ctx, ck) @@ -15110,7 +14562,6 @@ func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("alpha"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15122,14 +14573,13 @@ func (g *GCEAlphaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Alpha.ForwardingRules.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15153,7 +14603,6 @@ func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key, opt Operation: "Delete", Version: meta.Version("alpha"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15165,14 +14614,13 @@ func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key, opt call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -15181,50 +14629,6 @@ func (g *GCEAlphaForwardingRules) Delete(ctx context.Context, key *meta.Key, opt return err } -// Patch is a method on GCEAlphaForwardingRules. -func (g *GCEAlphaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ForwardingRules") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "ForwardingRules", - Resource: key, - } - klog.V(5).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.ForwardingRules.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - // SetLabels is a method on GCEAlphaForwardingRules. func (g *GCEAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -15240,7 +14644,6 @@ func (g *GCEAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, Operation: "SetLabels", Version: meta.Version("alpha"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15250,14 +14653,13 @@ func (g *GCEAlphaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, } call := g.s.Alpha.ForwardingRules.SetLabels(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15284,7 +14686,6 @@ func (g *GCEAlphaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, Operation: "SetTarget", Version: meta.Version("alpha"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15294,14 +14695,13 @@ func (g *GCEAlphaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, } call := g.s.Alpha.ForwardingRules.SetTarget(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15319,7 +14719,6 @@ type BetaForwardingRules interface { List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computebeta.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computebeta.RegionSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computebeta.TargetReference, ...Option) error } @@ -15361,7 +14760,6 @@ type MockBetaForwardingRules struct { ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaForwardingRules, options ...Option) (bool, []*computebeta.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, m *MockBetaForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaForwardingRules, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computebeta.ForwardingRule, *MockBetaForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computebeta.RegionSetLabelsRequest, *MockBetaForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computebeta.TargetReference, *MockBetaForwardingRules, ...Option) error @@ -15513,14 +14911,6 @@ func (m *MockBetaForwardingRules) Obj(o *computebeta.ForwardingRule) *MockForwar return &MockForwardingRulesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockBetaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - // SetLabels is a mock for the corresponding method. func (m *MockBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -15558,7 +14948,6 @@ func (g *GCEBetaForwardingRules) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("beta"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -15568,7 +14957,6 @@ func (g *GCEBetaForwardingRules) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Beta.ForwardingRules.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -15583,7 +14971,6 @@ func (g *GCEBetaForwardingRules) Get(ctx context.Context, key *meta.Key, options func (g *GCEBetaForwardingRules) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaForwardingRules.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ForwardingRules") ck := &CallContextKey{ @@ -15591,7 +14978,6 @@ func (g *GCEBetaForwardingRules) List(ctx context.Context, region string, fl *fi Operation: "List", Version: meta.Version("beta"), Service: "ForwardingRules", - Resource: key, } callObserverStart(ctx, ck) @@ -15650,7 +15036,6 @@ func (g *GCEBetaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj Operation: "Insert", Version: meta.Version("beta"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15662,14 +15047,13 @@ func (g *GCEBetaForwardingRules) Insert(ctx context.Context, key *meta.Key, obj call := g.s.Beta.ForwardingRules.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15693,7 +15077,6 @@ func (g *GCEBetaForwardingRules) Delete(ctx context.Context, key *meta.Key, opti Operation: "Delete", Version: meta.Version("beta"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15705,14 +15088,13 @@ func (g *GCEBetaForwardingRules) Delete(ctx context.Context, key *meta.Key, opti call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -15721,50 +15103,6 @@ func (g *GCEBetaForwardingRules) Delete(ctx context.Context, key *meta.Key, opti return err } -// Patch is a method on GCEBetaForwardingRules. -func (g *GCEBetaForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ForwardingRules") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "ForwardingRules", - Resource: key, - } - klog.V(5).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.ForwardingRules.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - // SetLabels is a method on GCEBetaForwardingRules. func (g *GCEBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -15780,7 +15118,6 @@ func (g *GCEBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, a Operation: "SetLabels", Version: meta.Version("beta"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15790,14 +15127,13 @@ func (g *GCEBetaForwardingRules) SetLabels(ctx context.Context, key *meta.Key, a } call := g.s.Beta.ForwardingRules.SetLabels(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15824,7 +15160,6 @@ func (g *GCEBetaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, a Operation: "SetTarget", Version: meta.Version("beta"), Service: "ForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -15834,14 +15169,13 @@ func (g *GCEBetaForwardingRules) SetTarget(ctx context.Context, key *meta.Key, a } call := g.s.Beta.ForwardingRules.SetTarget(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -15859,7 +15193,6 @@ type AlphaGlobalForwardingRules interface { List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computealpha.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computealpha.GlobalSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computealpha.TargetReference, ...Option) error } @@ -15901,7 +15234,6 @@ type MockAlphaGlobalForwardingRules struct { ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaGlobalForwardingRules, options ...Option) (bool, []*computealpha.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ForwardingRule, m *MockAlphaGlobalForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaGlobalForwardingRules, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computealpha.ForwardingRule, *MockAlphaGlobalForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computealpha.GlobalSetLabelsRequest, *MockAlphaGlobalForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computealpha.TargetReference, *MockAlphaGlobalForwardingRules, ...Option) error @@ -16050,14 +15382,6 @@ func (m *MockAlphaGlobalForwardingRules) Obj(o *computealpha.ForwardingRule) *Mo return &MockGlobalForwardingRulesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockAlphaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - // SetLabels is a mock for the corresponding method. func (m *MockAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.GlobalSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -16095,7 +15419,6 @@ func (g *GCEAlphaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -16105,7 +15428,6 @@ func (g *GCEAlphaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.Alpha.GlobalForwardingRules.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -16120,7 +15442,6 @@ func (g *GCEAlphaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, func (g *GCEAlphaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaGlobalForwardingRules.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalForwardingRules") ck := &CallContextKey{ @@ -16128,7 +15449,6 @@ func (g *GCEAlphaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, Operation: "List", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", - Resource: key, } callObserverStart(ctx, ck) @@ -16187,7 +15507,6 @@ func (g *GCEAlphaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Ke Operation: "Insert", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16199,14 +15518,13 @@ func (g *GCEAlphaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Ke call := g.s.Alpha.GlobalForwardingRules.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16230,7 +15548,6 @@ func (g *GCEAlphaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Ke Operation: "Delete", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16242,14 +15559,13 @@ func (g *GCEAlphaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Ke call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -16258,50 +15574,6 @@ func (g *GCEAlphaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Ke return err } -// Patch is a method on GCEAlphaGlobalForwardingRules. -func (g *GCEAlphaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ForwardingRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalForwardingRules") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "GlobalForwardingRules", - Resource: key, - } - klog.V(5).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.GlobalForwardingRules.Patch(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - // SetLabels is a method on GCEAlphaGlobalForwardingRules. func (g *GCEAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computealpha.GlobalSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -16317,7 +15589,6 @@ func (g *GCEAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta Operation: "SetLabels", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16327,14 +15598,13 @@ func (g *GCEAlphaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta } call := g.s.Alpha.GlobalForwardingRules.SetLabels(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16361,7 +15631,6 @@ func (g *GCEAlphaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta Operation: "SetTarget", Version: meta.Version("alpha"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16371,14 +15640,13 @@ func (g *GCEAlphaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta } call := g.s.Alpha.GlobalForwardingRules.SetTarget(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16396,7 +15664,6 @@ type BetaGlobalForwardingRules interface { List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computebeta.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computebeta.GlobalSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computebeta.TargetReference, ...Option) error } @@ -16438,7 +15705,6 @@ type MockBetaGlobalForwardingRules struct { ListHook func(ctx context.Context, fl *filter.F, m *MockBetaGlobalForwardingRules, options ...Option) (bool, []*computebeta.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ForwardingRule, m *MockBetaGlobalForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaGlobalForwardingRules, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computebeta.ForwardingRule, *MockBetaGlobalForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computebeta.GlobalSetLabelsRequest, *MockBetaGlobalForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computebeta.TargetReference, *MockBetaGlobalForwardingRules, ...Option) error @@ -16587,14 +15853,6 @@ func (m *MockBetaGlobalForwardingRules) Obj(o *computebeta.ForwardingRule) *Mock return &MockGlobalForwardingRulesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockBetaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - // SetLabels is a mock for the corresponding method. func (m *MockBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.GlobalSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -16632,7 +15890,6 @@ func (g *GCEBetaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, o Operation: "Get", Version: meta.Version("beta"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -16642,7 +15899,6 @@ func (g *GCEBetaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, o return nil, err } call := g.s.Beta.GlobalForwardingRules.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaGlobalForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -16657,7 +15913,6 @@ func (g *GCEBetaGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, o func (g *GCEBetaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaGlobalForwardingRules.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalForwardingRules") ck := &CallContextKey{ @@ -16665,7 +15920,6 @@ func (g *GCEBetaGlobalForwardingRules) List(ctx context.Context, fl *filter.F, o Operation: "List", Version: meta.Version("beta"), Service: "GlobalForwardingRules", - Resource: key, } callObserverStart(ctx, ck) @@ -16724,7 +15978,6 @@ func (g *GCEBetaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key Operation: "Insert", Version: meta.Version("beta"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16736,14 +15989,13 @@ func (g *GCEBetaGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key call := g.s.Beta.GlobalForwardingRules.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16767,7 +16019,6 @@ func (g *GCEBetaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key Operation: "Delete", Version: meta.Version("beta"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16779,14 +16030,13 @@ func (g *GCEBetaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -16795,50 +16045,6 @@ func (g *GCEBetaGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key return err } -// Patch is a method on GCEBetaGlobalForwardingRules. -func (g *GCEBetaGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ForwardingRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalForwardingRules") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "GlobalForwardingRules", - Resource: key, - } - klog.V(5).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.GlobalForwardingRules.Patch(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - // SetLabels is a method on GCEBetaGlobalForwardingRules. func (g *GCEBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computebeta.GlobalSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -16854,7 +16060,6 @@ func (g *GCEBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta. Operation: "SetLabels", Version: meta.Version("beta"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16864,14 +16069,13 @@ func (g *GCEBetaGlobalForwardingRules) SetLabels(ctx context.Context, key *meta. } call := g.s.Beta.GlobalForwardingRules.SetLabels(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16898,7 +16102,6 @@ func (g *GCEBetaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta. Operation: "SetTarget", Version: meta.Version("beta"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -16908,14 +16111,13 @@ func (g *GCEBetaGlobalForwardingRules) SetTarget(ctx context.Context, key *meta. } call := g.s.Beta.GlobalForwardingRules.SetTarget(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -16933,7 +16135,6 @@ type GlobalForwardingRules interface { List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) Insert(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computega.ForwardingRule, ...Option) error SetLabels(context.Context, *meta.Key, *computega.GlobalSetLabelsRequest, ...Option) error SetTarget(context.Context, *meta.Key, *computega.TargetReference, ...Option) error } @@ -16975,7 +16176,6 @@ type MockGlobalForwardingRules struct { ListHook func(ctx context.Context, fl *filter.F, m *MockGlobalForwardingRules, options ...Option) (bool, []*computega.ForwardingRule, error) InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ForwardingRule, m *MockGlobalForwardingRules, options ...Option) (bool, error) DeleteHook func(ctx context.Context, key *meta.Key, m *MockGlobalForwardingRules, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computega.ForwardingRule, *MockGlobalForwardingRules, ...Option) error SetLabelsHook func(context.Context, *meta.Key, *computega.GlobalSetLabelsRequest, *MockGlobalForwardingRules, ...Option) error SetTargetHook func(context.Context, *meta.Key, *computega.TargetReference, *MockGlobalForwardingRules, ...Option) error @@ -17124,14 +16324,6 @@ func (m *MockGlobalForwardingRules) Obj(o *computega.ForwardingRule) *MockGlobal return &MockGlobalForwardingRulesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - // SetLabels is a mock for the corresponding method. func (m *MockGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.GlobalSetLabelsRequest, options ...Option) error { if m.SetLabelsHook != nil { @@ -17169,7 +16361,6 @@ func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -17179,7 +16370,6 @@ func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.GlobalForwardingRules.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEGlobalForwardingRules.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -17194,7 +16384,6 @@ func (g *GCEGlobalForwardingRules) Get(ctx context.Context, key *meta.Key, optio func (g *GCEGlobalForwardingRules) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.ForwardingRule, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEGlobalForwardingRules.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalForwardingRules") ck := &CallContextKey{ @@ -17202,7 +16391,6 @@ func (g *GCEGlobalForwardingRules) List(ctx context.Context, fl *filter.F, optio Operation: "List", Version: meta.Version("ga"), Service: "GlobalForwardingRules", - Resource: key, } callObserverStart(ctx, ck) @@ -17261,7 +16449,6 @@ func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17273,14 +16460,13 @@ func (g *GCEGlobalForwardingRules) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.GlobalForwardingRules.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEGlobalForwardingRules.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17304,7 +16490,6 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17316,14 +16501,13 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEGlobalForwardingRules.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -17332,50 +16516,6 @@ func (g *GCEGlobalForwardingRules) Delete(ctx context.Context, key *meta.Key, op return err } -// Patch is a method on GCEGlobalForwardingRules. -func (g *GCEGlobalForwardingRules) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ForwardingRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEGlobalForwardingRules.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEGlobalForwardingRules.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalForwardingRules") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("ga"), - Service: "GlobalForwardingRules", - Resource: key, - } - klog.V(5).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.GlobalForwardingRules.Patch(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEGlobalForwardingRules.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - // SetLabels is a method on GCEGlobalForwardingRules. func (g *GCEGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, arg0 *computega.GlobalSetLabelsRequest, options ...Option) error { opts := mergeOptions(options) @@ -17391,7 +16531,6 @@ func (g *GCEGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, Operation: "SetLabels", Version: meta.Version("ga"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17401,14 +16540,13 @@ func (g *GCEGlobalForwardingRules) SetLabels(ctx context.Context, key *meta.Key, } call := g.s.GA.GlobalForwardingRules.SetLabels(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEGlobalForwardingRules.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17435,7 +16573,6 @@ func (g *GCEGlobalForwardingRules) SetTarget(ctx context.Context, key *meta.Key, Operation: "SetTarget", Version: meta.Version("ga"), Service: "GlobalForwardingRules", - Resource: key, } klog.V(5).Infof("GCEGlobalForwardingRules.SetTarget(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17445,14 +16582,13 @@ func (g *GCEGlobalForwardingRules) SetTarget(ctx context.Context, key *meta.Key, } call := g.s.GA.GlobalForwardingRules.SetTarget(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEGlobalForwardingRules.SetTarget(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17686,7 +16822,6 @@ func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("ga"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -17696,7 +16831,6 @@ func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key, options ...Opt return nil, err } call := g.s.GA.HealthChecks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -17711,7 +16845,6 @@ func (g *GCEHealthChecks) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *GCEHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "HealthChecks") ck := &CallContextKey{ @@ -17719,7 +16852,6 @@ func (g *GCEHealthChecks) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("ga"), Service: "HealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -17778,7 +16910,6 @@ func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *comput Operation: "Insert", Version: meta.Version("ga"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17790,14 +16921,13 @@ func (g *GCEHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *comput call := g.s.GA.HealthChecks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -17821,7 +16951,6 @@ func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("ga"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17833,14 +16962,13 @@ func (g *GCEHealthChecks) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -17864,7 +16992,6 @@ func (g *GCEHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *compu Operation: "Update", Version: meta.Version("ga"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -17874,14 +17001,13 @@ func (g *GCEHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.GA.HealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18115,7 +17241,6 @@ func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("alpha"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -18125,7 +17250,6 @@ func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.Alpha.HealthChecks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -18140,7 +17264,6 @@ func (g *GCEAlphaHealthChecks) Get(ctx context.Context, key *meta.Key, options . func (g *GCEAlphaHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "HealthChecks") ck := &CallContextKey{ @@ -18148,7 +17271,6 @@ func (g *GCEAlphaHealthChecks) List(ctx context.Context, fl *filter.F, options . Operation: "List", Version: meta.Version("alpha"), Service: "HealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -18207,7 +17329,6 @@ func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("alpha"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18219,14 +17340,13 @@ func (g *GCEAlphaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.Alpha.HealthChecks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18250,7 +17370,6 @@ func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("alpha"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18262,14 +17381,13 @@ func (g *GCEAlphaHealthChecks) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -18293,7 +17411,6 @@ func (g *GCEAlphaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * Operation: "Update", Version: meta.Version("alpha"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18303,14 +17420,13 @@ func (g *GCEAlphaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Alpha.HealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18544,7 +17660,6 @@ func (g *GCEBetaHealthChecks) Get(ctx context.Context, key *meta.Key, options .. Operation: "Get", Version: meta.Version("beta"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -18554,7 +17669,6 @@ func (g *GCEBetaHealthChecks) Get(ctx context.Context, key *meta.Key, options .. return nil, err } call := g.s.Beta.HealthChecks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -18569,7 +17683,6 @@ func (g *GCEBetaHealthChecks) Get(ctx context.Context, key *meta.Key, options .. func (g *GCEBetaHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "HealthChecks") ck := &CallContextKey{ @@ -18577,7 +17690,6 @@ func (g *GCEBetaHealthChecks) List(ctx context.Context, fl *filter.F, options .. Operation: "List", Version: meta.Version("beta"), Service: "HealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -18636,7 +17748,6 @@ func (g *GCEBetaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co Operation: "Insert", Version: meta.Version("beta"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18648,14 +17759,13 @@ func (g *GCEBetaHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co call := g.s.Beta.HealthChecks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18679,7 +17789,6 @@ func (g *GCEBetaHealthChecks) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("beta"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18691,14 +17800,13 @@ func (g *GCEBetaHealthChecks) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -18722,7 +17830,6 @@ func (g *GCEBetaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c Operation: "Update", Version: meta.Version("beta"), Service: "HealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -18732,14 +17839,13 @@ func (g *GCEBetaHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c } call := g.s.Beta.HealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -18976,7 +18082,6 @@ func (g *GCEAlphaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opt Operation: "Get", Version: meta.Version("alpha"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -18986,7 +18091,6 @@ func (g *GCEAlphaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opt return nil, err } call := g.s.Alpha.RegionHealthChecks.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -19001,7 +18105,6 @@ func (g *GCEAlphaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opt func (g *GCEAlphaRegionHealthChecks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionHealthChecks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionHealthChecks") ck := &CallContextKey{ @@ -19009,7 +18112,6 @@ func (g *GCEAlphaRegionHealthChecks) List(ctx context.Context, region string, fl Operation: "List", Version: meta.Version("alpha"), Service: "RegionHealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -19068,7 +18170,6 @@ func (g *GCEAlphaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19080,14 +18181,13 @@ func (g *GCEAlphaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, call := g.s.Alpha.RegionHealthChecks.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19111,7 +18211,6 @@ func (g *GCEAlphaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19123,14 +18222,13 @@ func (g *GCEAlphaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -19154,7 +18252,6 @@ func (g *GCEAlphaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, Operation: "Update", Version: meta.Version("alpha"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19164,14 +18261,13 @@ func (g *GCEAlphaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, } call := g.s.Alpha.RegionHealthChecks.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19408,7 +18504,6 @@ func (g *GCEBetaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opti Operation: "Get", Version: meta.Version("beta"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -19418,7 +18513,6 @@ func (g *GCEBetaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opti return nil, err } call := g.s.Beta.RegionHealthChecks.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaRegionHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -19433,7 +18527,6 @@ func (g *GCEBetaRegionHealthChecks) Get(ctx context.Context, key *meta.Key, opti func (g *GCEBetaRegionHealthChecks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaRegionHealthChecks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionHealthChecks") ck := &CallContextKey{ @@ -19441,7 +18534,6 @@ func (g *GCEBetaRegionHealthChecks) List(ctx context.Context, region string, fl Operation: "List", Version: meta.Version("beta"), Service: "RegionHealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -19500,7 +18592,6 @@ func (g *GCEBetaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, o Operation: "Insert", Version: meta.Version("beta"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19512,14 +18603,13 @@ func (g *GCEBetaRegionHealthChecks) Insert(ctx context.Context, key *meta.Key, o call := g.s.Beta.RegionHealthChecks.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19543,7 +18633,6 @@ func (g *GCEBetaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, o Operation: "Delete", Version: meta.Version("beta"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19555,14 +18644,13 @@ func (g *GCEBetaRegionHealthChecks) Delete(ctx context.Context, key *meta.Key, o call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -19586,7 +18674,6 @@ func (g *GCEBetaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, a Operation: "Update", Version: meta.Version("beta"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCEBetaRegionHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19596,14 +18683,13 @@ func (g *GCEBetaRegionHealthChecks) Update(ctx context.Context, key *meta.Key, a } call := g.s.Beta.RegionHealthChecks.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19840,7 +18926,6 @@ func (g *GCERegionHealthChecks) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("ga"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -19850,7 +18935,6 @@ func (g *GCERegionHealthChecks) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.GA.RegionHealthChecks.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -19865,7 +18949,6 @@ func (g *GCERegionHealthChecks) Get(ctx context.Context, key *meta.Key, options func (g *GCERegionHealthChecks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.HealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionHealthChecks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionHealthChecks") ck := &CallContextKey{ @@ -19873,7 +18956,6 @@ func (g *GCERegionHealthChecks) List(ctx context.Context, region string, fl *fil Operation: "List", Version: meta.Version("ga"), Service: "RegionHealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -19932,7 +19014,6 @@ func (g *GCERegionHealthChecks) Insert(ctx context.Context, key *meta.Key, obj * Operation: "Insert", Version: meta.Version("ga"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19944,14 +19025,13 @@ func (g *GCERegionHealthChecks) Insert(ctx context.Context, key *meta.Key, obj * call := g.s.GA.RegionHealthChecks.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -19975,7 +19055,6 @@ func (g *GCERegionHealthChecks) Delete(ctx context.Context, key *meta.Key, optio Operation: "Delete", Version: meta.Version("ga"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -19987,14 +19066,13 @@ func (g *GCERegionHealthChecks) Delete(ctx context.Context, key *meta.Key, optio call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -20018,7 +19096,6 @@ func (g *GCERegionHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 Operation: "Update", Version: meta.Version("ga"), Service: "RegionHealthChecks", - Resource: key, } klog.V(5).Infof("GCERegionHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20028,14 +19105,13 @@ func (g *GCERegionHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.RegionHealthChecks.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20269,7 +19345,6 @@ func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key, options .. Operation: "Get", Version: meta.Version("ga"), Service: "HttpHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -20279,7 +19354,6 @@ func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key, options .. return nil, err } call := g.s.GA.HttpHealthChecks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEHttpHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -20294,7 +19368,6 @@ func (g *GCEHttpHealthChecks) Get(ctx context.Context, key *meta.Key, options .. func (g *GCEHttpHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.HttpHealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEHttpHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "HttpHealthChecks") ck := &CallContextKey{ @@ -20302,7 +19375,6 @@ func (g *GCEHttpHealthChecks) List(ctx context.Context, fl *filter.F, options .. Operation: "List", Version: meta.Version("ga"), Service: "HttpHealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -20361,7 +19433,6 @@ func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co Operation: "Insert", Version: meta.Version("ga"), Service: "HttpHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20373,14 +19444,13 @@ func (g *GCEHttpHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *co call := g.s.GA.HttpHealthChecks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHttpHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEHttpHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20404,7 +19474,6 @@ func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key, options Operation: "Delete", Version: meta.Version("ga"), Service: "HttpHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20416,14 +19485,13 @@ func (g *GCEHttpHealthChecks) Delete(ctx context.Context, key *meta.Key, options call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHttpHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEHttpHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -20447,7 +19515,6 @@ func (g *GCEHttpHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c Operation: "Update", Version: meta.Version("ga"), Service: "HttpHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20457,14 +19524,13 @@ func (g *GCEHttpHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 *c } call := g.s.GA.HttpHealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHttpHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEHttpHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20698,7 +19764,6 @@ func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("ga"), Service: "HttpsHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -20708,7 +19773,6 @@ func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.GA.HttpsHealthChecks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEHttpsHealthChecks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -20723,7 +19787,6 @@ func (g *GCEHttpsHealthChecks) Get(ctx context.Context, key *meta.Key, options . func (g *GCEHttpsHealthChecks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.HttpsHealthCheck, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEHttpsHealthChecks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "HttpsHealthChecks") ck := &CallContextKey{ @@ -20731,7 +19794,6 @@ func (g *GCEHttpsHealthChecks) List(ctx context.Context, fl *filter.F, options . Operation: "List", Version: meta.Version("ga"), Service: "HttpsHealthChecks", - Resource: key, } callObserverStart(ctx, ck) @@ -20790,7 +19852,6 @@ func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("ga"), Service: "HttpsHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20802,14 +19863,13 @@ func (g *GCEHttpsHealthChecks) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.GA.HttpsHealthChecks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHttpsHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEHttpsHealthChecks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -20833,7 +19893,6 @@ func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("ga"), Service: "HttpsHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20845,14 +19904,13 @@ func (g *GCEHttpsHealthChecks) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHttpsHealthChecks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEHttpsHealthChecks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -20876,7 +19934,6 @@ func (g *GCEHttpsHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * Operation: "Update", Version: meta.Version("ga"), Service: "HttpsHealthChecks", - Resource: key, } klog.V(5).Infof("GCEHttpsHealthChecks.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -20886,14 +19943,13 @@ func (g *GCEHttpsHealthChecks) Update(ctx context.Context, key *meta.Key, arg0 * } call := g.s.GA.HttpsHealthChecks.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEHttpsHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEHttpsHealthChecks.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21160,7 +20216,6 @@ func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } klog.V(5).Infof("GCEInstanceGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -21170,7 +20225,6 @@ func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.GA.InstanceGroups.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstanceGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -21185,7 +20239,6 @@ func (g *GCEInstanceGroups) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEInstanceGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.InstanceGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstanceGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "InstanceGroups") ck := &CallContextKey{ @@ -21193,7 +20246,6 @@ func (g *GCEInstanceGroups) List(ctx context.Context, zone string, fl *filter.F, Operation: "List", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } callObserverStart(ctx, ck) @@ -21252,7 +20304,6 @@ func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } klog.V(5).Infof("GCEInstanceGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21264,14 +20315,13 @@ func (g *GCEInstanceGroups) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.GA.InstanceGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstanceGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21295,7 +20345,6 @@ func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } klog.V(5).Infof("GCEInstanceGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21307,14 +20356,13 @@ func (g *GCEInstanceGroups) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstanceGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -21338,7 +20386,6 @@ func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg Operation: "AddInstances", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } klog.V(5).Infof("GCEInstanceGroups.AddInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21348,14 +20395,13 @@ func (g *GCEInstanceGroups) AddInstances(ctx context.Context, key *meta.Key, arg } call := g.s.GA.InstanceGroups.AddInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroups.AddInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstanceGroups.AddInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21382,7 +20428,6 @@ func (g *GCEInstanceGroups) ListInstances(ctx context.Context, key *meta.Key, ar Operation: "ListInstances", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } klog.V(5).Infof("GCEInstanceGroups.ListInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21435,7 +20480,6 @@ func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key, Operation: "RemoveInstances", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } klog.V(5).Infof("GCEInstanceGroups.RemoveInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21445,14 +20489,13 @@ func (g *GCEInstanceGroups) RemoveInstances(ctx context.Context, key *meta.Key, } call := g.s.GA.InstanceGroups.RemoveInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroups.RemoveInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstanceGroups.RemoveInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21479,7 +20522,6 @@ func (g *GCEInstanceGroups) SetNamedPorts(ctx context.Context, key *meta.Key, ar Operation: "SetNamedPorts", Version: meta.Version("ga"), Service: "InstanceGroups", - Resource: key, } klog.V(5).Infof("GCEInstanceGroups.SetNamedPorts(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21489,14 +20531,13 @@ func (g *GCEInstanceGroups) SetNamedPorts(ctx context.Context, key *meta.Key, ar } call := g.s.GA.InstanceGroups.SetNamedPorts(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroups.SetNamedPorts(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstanceGroups.SetNamedPorts(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21743,7 +20784,6 @@ func (g *GCEInstances) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("ga"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEInstances.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -21753,7 +20793,6 @@ func (g *GCEInstances) Get(ctx context.Context, key *meta.Key, options ...Option return nil, err } call := g.s.GA.Instances.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstances.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -21768,7 +20807,6 @@ func (g *GCEInstances) Get(ctx context.Context, key *meta.Key, options ...Option func (g *GCEInstances) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.Instance, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstances.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Instances") ck := &CallContextKey{ @@ -21776,7 +20814,6 @@ func (g *GCEInstances) List(ctx context.Context, zone string, fl *filter.F, opti Operation: "List", Version: meta.Version("ga"), Service: "Instances", - Resource: key, } callObserverStart(ctx, ck) @@ -21835,7 +20872,6 @@ func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *computega Operation: "Insert", Version: meta.Version("ga"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEInstances.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21847,14 +20883,13 @@ func (g *GCEInstances) Insert(ctx context.Context, key *meta.Key, obj *computega call := g.s.GA.Instances.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21878,7 +20913,6 @@ func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("ga"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEInstances.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21890,14 +20924,13 @@ func (g *GCEInstances) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstances.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstances.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -21921,7 +20954,6 @@ func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *comp Operation: "AttachDisk", Version: meta.Version("ga"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEInstances.AttachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21931,14 +20963,13 @@ func (g *GCEInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.GA.Instances.AttachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -21965,7 +20996,6 @@ func (g *GCEInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 strin Operation: "DetachDisk", Version: meta.Version("ga"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEInstances.DetachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -21975,14 +21005,13 @@ func (g *GCEInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 strin } call := g.s.GA.Instances.DetachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22239,7 +21268,6 @@ func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("beta"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEBetaInstances.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -22249,7 +21277,6 @@ func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Beta.Instances.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaInstances.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -22264,7 +21291,6 @@ func (g *GCEBetaInstances) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEBetaInstances) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computebeta.Instance, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaInstances.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Instances") ck := &CallContextKey{ @@ -22272,7 +21298,6 @@ func (g *GCEBetaInstances) List(ctx context.Context, zone string, fl *filter.F, Operation: "List", Version: meta.Version("beta"), Service: "Instances", - Resource: key, } callObserverStart(ctx, ck) @@ -22331,7 +21356,6 @@ func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("beta"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEBetaInstances.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22343,14 +21367,13 @@ func (g *GCEBetaInstances) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Beta.Instances.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22374,7 +21397,6 @@ func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("beta"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEBetaInstances.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22386,14 +21408,13 @@ func (g *GCEBetaInstances) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaInstances.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaInstances.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -22417,7 +21438,6 @@ func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 * Operation: "AttachDisk", Version: meta.Version("beta"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEBetaInstances.AttachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22427,14 +21447,13 @@ func (g *GCEBetaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Beta.Instances.AttachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22461,7 +21480,6 @@ func (g *GCEBetaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 s Operation: "DetachDisk", Version: meta.Version("beta"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEBetaInstances.DetachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22471,14 +21489,13 @@ func (g *GCEBetaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 s } call := g.s.Beta.Instances.DetachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22505,7 +21522,6 @@ func (g *GCEBetaInstances) UpdateNetworkInterface(ctx context.Context, key *meta Operation: "UpdateNetworkInterface", Version: meta.Version("beta"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEBetaInstances.UpdateNetworkInterface(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22515,14 +21531,13 @@ func (g *GCEBetaInstances) UpdateNetworkInterface(ctx context.Context, key *meta } call := g.s.Beta.Instances.UpdateNetworkInterface(projectID, key.Zone, key.Name, arg0, arg1) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22779,7 +21794,6 @@ func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key, options ...O Operation: "Get", Version: meta.Version("alpha"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEAlphaInstances.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -22789,7 +21803,6 @@ func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key, options ...O return nil, err } call := g.s.Alpha.Instances.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaInstances.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -22804,7 +21817,6 @@ func (g *GCEAlphaInstances) Get(ctx context.Context, key *meta.Key, options ...O func (g *GCEAlphaInstances) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computealpha.Instance, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaInstances.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Instances") ck := &CallContextKey{ @@ -22812,7 +21824,6 @@ func (g *GCEAlphaInstances) List(ctx context.Context, zone string, fl *filter.F, Operation: "List", Version: meta.Version("alpha"), Service: "Instances", - Resource: key, } callObserverStart(ctx, ck) @@ -22871,7 +21882,6 @@ func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *comp Operation: "Insert", Version: meta.Version("alpha"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEAlphaInstances.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22883,14 +21893,13 @@ func (g *GCEAlphaInstances) Insert(ctx context.Context, key *meta.Key, obj *comp call := g.s.Alpha.Instances.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaInstances.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -22914,7 +21923,6 @@ func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key, options . Operation: "Delete", Version: meta.Version("alpha"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEAlphaInstances.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22926,14 +21934,13 @@ func (g *GCEAlphaInstances) Delete(ctx context.Context, key *meta.Key, options . call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaInstances.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaInstances.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -22957,7 +21964,6 @@ func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 Operation: "AttachDisk", Version: meta.Version("alpha"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEAlphaInstances.AttachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -22967,14 +21973,13 @@ func (g *GCEAlphaInstances) AttachDisk(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.Instances.AttachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaInstances.AttachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23001,7 +22006,6 @@ func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 Operation: "DetachDisk", Version: meta.Version("alpha"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEAlphaInstances.DetachDisk(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23011,14 +22015,13 @@ func (g *GCEAlphaInstances) DetachDisk(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.Instances.DetachDisk(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaInstances.DetachDisk(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23045,7 +22048,6 @@ func (g *GCEAlphaInstances) UpdateNetworkInterface(ctx context.Context, key *met Operation: "UpdateNetworkInterface", Version: meta.Version("alpha"), Service: "Instances", - Resource: key, } klog.V(5).Infof("GCEAlphaInstances.UpdateNetworkInterface(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23055,14 +22057,13 @@ func (g *GCEAlphaInstances) UpdateNetworkInterface(ctx context.Context, key *met } call := g.s.Alpha.Instances.UpdateNetworkInterface(projectID, key.Zone, key.Name, arg0, arg1) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaInstances.UpdateNetworkInterface(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23329,7 +22330,6 @@ func (g *GCEInstanceGroupManagers) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -23339,7 +22339,6 @@ func (g *GCEInstanceGroupManagers) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.InstanceGroupManagers.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstanceGroupManagers.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -23354,7 +22353,6 @@ func (g *GCEInstanceGroupManagers) Get(ctx context.Context, key *meta.Key, optio func (g *GCEInstanceGroupManagers) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.InstanceGroupManager, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstanceGroupManagers.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "InstanceGroupManagers") ck := &CallContextKey{ @@ -23362,7 +22360,6 @@ func (g *GCEInstanceGroupManagers) List(ctx context.Context, zone string, fl *fi Operation: "List", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } callObserverStart(ctx, ck) @@ -23421,7 +22418,6 @@ func (g *GCEInstanceGroupManagers) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23433,14 +22429,13 @@ func (g *GCEInstanceGroupManagers) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.InstanceGroupManagers.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroupManagers.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstanceGroupManagers.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23464,7 +22459,6 @@ func (g *GCEInstanceGroupManagers) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23476,14 +22470,13 @@ func (g *GCEInstanceGroupManagers) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroupManagers.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstanceGroupManagers.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -23507,7 +22500,6 @@ func (g *GCEInstanceGroupManagers) CreateInstances(ctx context.Context, key *met Operation: "CreateInstances", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.CreateInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23517,14 +22509,13 @@ func (g *GCEInstanceGroupManagers) CreateInstances(ctx context.Context, key *met } call := g.s.GA.InstanceGroupManagers.CreateInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroupManagers.CreateInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstanceGroupManagers.CreateInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23551,7 +22542,6 @@ func (g *GCEInstanceGroupManagers) DeleteInstances(ctx context.Context, key *met Operation: "DeleteInstances", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.DeleteInstances(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23561,14 +22551,13 @@ func (g *GCEInstanceGroupManagers) DeleteInstances(ctx context.Context, key *met } call := g.s.GA.InstanceGroupManagers.DeleteInstances(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroupManagers.DeleteInstances(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstanceGroupManagers.DeleteInstances(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23595,7 +22584,6 @@ func (g *GCEInstanceGroupManagers) Resize(ctx context.Context, key *meta.Key, ar Operation: "Resize", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.Resize(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23605,14 +22593,13 @@ func (g *GCEInstanceGroupManagers) Resize(ctx context.Context, key *meta.Key, ar } call := g.s.GA.InstanceGroupManagers.Resize(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroupManagers.Resize(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstanceGroupManagers.Resize(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23639,7 +22626,6 @@ func (g *GCEInstanceGroupManagers) SetInstanceTemplate(ctx context.Context, key Operation: "SetInstanceTemplate", Version: meta.Version("ga"), Service: "InstanceGroupManagers", - Resource: key, } klog.V(5).Infof("GCEInstanceGroupManagers.SetInstanceTemplate(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23649,14 +22635,13 @@ func (g *GCEInstanceGroupManagers) SetInstanceTemplate(ctx context.Context, key } call := g.s.GA.InstanceGroupManagers.SetInstanceTemplate(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceGroupManagers.SetInstanceTemplate(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEInstanceGroupManagers.SetInstanceTemplate(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -23880,7 +22865,6 @@ func (g *GCEInstanceTemplates) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("ga"), Service: "InstanceTemplates", - Resource: key, } klog.V(5).Infof("GCEInstanceTemplates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -23890,7 +22874,6 @@ func (g *GCEInstanceTemplates) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.GA.InstanceTemplates.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEInstanceTemplates.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -23905,7 +22888,6 @@ func (g *GCEInstanceTemplates) Get(ctx context.Context, key *meta.Key, options . func (g *GCEInstanceTemplates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.InstanceTemplate, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEInstanceTemplates.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "InstanceTemplates") ck := &CallContextKey{ @@ -23913,7 +22895,6 @@ func (g *GCEInstanceTemplates) List(ctx context.Context, fl *filter.F, options . Operation: "List", Version: meta.Version("ga"), Service: "InstanceTemplates", - Resource: key, } callObserverStart(ctx, ck) @@ -23972,7 +22953,6 @@ func (g *GCEInstanceTemplates) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("ga"), Service: "InstanceTemplates", - Resource: key, } klog.V(5).Infof("GCEInstanceTemplates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -23984,14 +22964,13 @@ func (g *GCEInstanceTemplates) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.GA.InstanceTemplates.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceTemplates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstanceTemplates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24015,7 +22994,6 @@ func (g *GCEInstanceTemplates) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("ga"), Service: "InstanceTemplates", - Resource: key, } klog.V(5).Infof("GCEInstanceTemplates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24027,14 +23005,13 @@ func (g *GCEInstanceTemplates) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEInstanceTemplates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEInstanceTemplates.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -24315,7 +23292,6 @@ func (g *GCEImages) Get(ctx context.Context, key *meta.Key, options ...Option) ( Operation: "Get", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -24325,7 +23301,6 @@ func (g *GCEImages) Get(ctx context.Context, key *meta.Key, options ...Option) ( return nil, err } call := g.s.GA.Images.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEImages.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -24340,7 +23315,6 @@ func (g *GCEImages) Get(ctx context.Context, key *meta.Key, options ...Option) ( func (g *GCEImages) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Image, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEImages.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Images") ck := &CallContextKey{ @@ -24348,7 +23322,6 @@ func (g *GCEImages) List(ctx context.Context, fl *filter.F, options ...Option) ( Operation: "List", Version: meta.Version("ga"), Service: "Images", - Resource: key, } callObserverStart(ctx, ck) @@ -24407,7 +23380,6 @@ func (g *GCEImages) Insert(ctx context.Context, key *meta.Key, obj *computega.Im Operation: "Insert", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24419,14 +23391,13 @@ func (g *GCEImages) Insert(ctx context.Context, key *meta.Key, obj *computega.Im call := g.s.GA.Images.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEImages.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEImages.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24450,7 +23421,6 @@ func (g *GCEImages) Delete(ctx context.Context, key *meta.Key, options ...Option Operation: "Delete", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24462,14 +23432,13 @@ func (g *GCEImages) Delete(ctx context.Context, key *meta.Key, options ...Option call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEImages.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEImages.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -24493,7 +23462,6 @@ func (g *GCEImages) GetFromFamily(ctx context.Context, key *meta.Key, options .. Operation: "GetFromFamily", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.GetFromFamily(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24503,7 +23471,6 @@ func (g *GCEImages) GetFromFamily(ctx context.Context, key *meta.Key, options .. } call := g.s.GA.Images.GetFromFamily(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24528,7 +23495,6 @@ func (g *GCEImages) GetIamPolicy(ctx context.Context, key *meta.Key, options ... Operation: "GetIamPolicy", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24538,7 +23504,6 @@ func (g *GCEImages) GetIamPolicy(ctx context.Context, key *meta.Key, options ... } call := g.s.GA.Images.GetIamPolicy(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24563,7 +23528,6 @@ func (g *GCEImages) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Im Operation: "Patch", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24573,14 +23537,13 @@ func (g *GCEImages) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Im } call := g.s.GA.Images.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEImages.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEImages.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24607,7 +23570,6 @@ func (g *GCEImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *compu Operation: "SetIamPolicy", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24617,7 +23579,6 @@ func (g *GCEImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.GA.Images.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24642,7 +23603,6 @@ func (g *GCEImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *computeg Operation: "SetLabels", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24652,14 +23612,13 @@ func (g *GCEImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *computeg } call := g.s.GA.Images.SetLabels(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -24686,7 +23645,6 @@ func (g *GCEImages) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 Operation: "TestIamPermissions", Version: meta.Version("ga"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEImages.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -24696,7 +23654,6 @@ func (g *GCEImages) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 } call := g.s.GA.Images.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -24978,7 +23935,6 @@ func (g *GCEBetaImages) Get(ctx context.Context, key *meta.Key, options ...Optio Operation: "Get", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -24988,7 +23944,6 @@ func (g *GCEBetaImages) Get(ctx context.Context, key *meta.Key, options ...Optio return nil, err } call := g.s.Beta.Images.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaImages.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -25003,7 +23958,6 @@ func (g *GCEBetaImages) Get(ctx context.Context, key *meta.Key, options ...Optio func (g *GCEBetaImages) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Image, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaImages.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Images") ck := &CallContextKey{ @@ -25011,7 +23965,6 @@ func (g *GCEBetaImages) List(ctx context.Context, fl *filter.F, options ...Optio Operation: "List", Version: meta.Version("beta"), Service: "Images", - Resource: key, } callObserverStart(ctx, ck) @@ -25070,7 +24023,6 @@ func (g *GCEBetaImages) Insert(ctx context.Context, key *meta.Key, obj *computeb Operation: "Insert", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25082,14 +24034,13 @@ func (g *GCEBetaImages) Insert(ctx context.Context, key *meta.Key, obj *computeb call := g.s.Beta.Images.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -25113,7 +24064,6 @@ func (g *GCEBetaImages) Delete(ctx context.Context, key *meta.Key, options ...Op Operation: "Delete", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25125,14 +24075,13 @@ func (g *GCEBetaImages) Delete(ctx context.Context, key *meta.Key, options ...Op call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaImages.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaImages.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -25156,7 +24105,6 @@ func (g *GCEBetaImages) GetFromFamily(ctx context.Context, key *meta.Key, option Operation: "GetFromFamily", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.GetFromFamily(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25166,7 +24114,6 @@ func (g *GCEBetaImages) GetFromFamily(ctx context.Context, key *meta.Key, option } call := g.s.Beta.Images.GetFromFamily(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25191,7 +24138,6 @@ func (g *GCEBetaImages) GetIamPolicy(ctx context.Context, key *meta.Key, options Operation: "GetIamPolicy", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25201,7 +24147,6 @@ func (g *GCEBetaImages) GetIamPolicy(ctx context.Context, key *meta.Key, options } call := g.s.Beta.Images.GetIamPolicy(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25226,7 +24171,6 @@ func (g *GCEBetaImages) Patch(ctx context.Context, key *meta.Key, arg0 *computeb Operation: "Patch", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25236,14 +24180,13 @@ func (g *GCEBetaImages) Patch(ctx context.Context, key *meta.Key, arg0 *computeb } call := g.s.Beta.Images.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -25270,7 +24213,6 @@ func (g *GCEBetaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *c Operation: "SetIamPolicy", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25280,7 +24222,6 @@ func (g *GCEBetaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 *c } call := g.s.Beta.Images.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25305,7 +24246,6 @@ func (g *GCEBetaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *comp Operation: "SetLabels", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25315,14 +24255,13 @@ func (g *GCEBetaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.Beta.Images.SetLabels(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -25349,7 +24288,6 @@ func (g *GCEBetaImages) TestIamPermissions(ctx context.Context, key *meta.Key, a Operation: "TestIamPermissions", Version: meta.Version("beta"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEBetaImages.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25359,7 +24297,6 @@ func (g *GCEBetaImages) TestIamPermissions(ctx context.Context, key *meta.Key, a } call := g.s.Beta.Images.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25641,7 +24578,6 @@ func (g *GCEAlphaImages) Get(ctx context.Context, key *meta.Key, options ...Opti Operation: "Get", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -25651,7 +24587,6 @@ func (g *GCEAlphaImages) Get(ctx context.Context, key *meta.Key, options ...Opti return nil, err } call := g.s.Alpha.Images.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaImages.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -25666,7 +24601,6 @@ func (g *GCEAlphaImages) Get(ctx context.Context, key *meta.Key, options ...Opti func (g *GCEAlphaImages) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Image, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaImages.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Images") ck := &CallContextKey{ @@ -25674,7 +24608,6 @@ func (g *GCEAlphaImages) List(ctx context.Context, fl *filter.F, options ...Opti Operation: "List", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } callObserverStart(ctx, ck) @@ -25733,7 +24666,6 @@ func (g *GCEAlphaImages) Insert(ctx context.Context, key *meta.Key, obj *compute Operation: "Insert", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25745,14 +24677,13 @@ func (g *GCEAlphaImages) Insert(ctx context.Context, key *meta.Key, obj *compute call := g.s.Alpha.Images.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaImages.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -25776,7 +24707,6 @@ func (g *GCEAlphaImages) Delete(ctx context.Context, key *meta.Key, options ...O Operation: "Delete", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25788,14 +24718,13 @@ func (g *GCEAlphaImages) Delete(ctx context.Context, key *meta.Key, options ...O call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaImages.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaImages.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -25819,7 +24748,6 @@ func (g *GCEAlphaImages) GetFromFamily(ctx context.Context, key *meta.Key, optio Operation: "GetFromFamily", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.GetFromFamily(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25829,7 +24757,6 @@ func (g *GCEAlphaImages) GetFromFamily(ctx context.Context, key *meta.Key, optio } call := g.s.Alpha.Images.GetFromFamily(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25854,7 +24781,6 @@ func (g *GCEAlphaImages) GetIamPolicy(ctx context.Context, key *meta.Key, option Operation: "GetIamPolicy", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.GetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25864,7 +24790,6 @@ func (g *GCEAlphaImages) GetIamPolicy(ctx context.Context, key *meta.Key, option } call := g.s.Alpha.Images.GetIamPolicy(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25889,7 +24814,6 @@ func (g *GCEAlphaImages) Patch(ctx context.Context, key *meta.Key, arg0 *compute Operation: "Patch", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25899,14 +24823,13 @@ func (g *GCEAlphaImages) Patch(ctx context.Context, key *meta.Key, arg0 *compute } call := g.s.Alpha.Images.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaImages.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -25933,7 +24856,6 @@ func (g *GCEAlphaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 * Operation: "SetIamPolicy", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.SetIamPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25943,7 +24865,6 @@ func (g *GCEAlphaImages) SetIamPolicy(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Alpha.Images.SetIamPolicy(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -25968,7 +24889,6 @@ func (g *GCEAlphaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *com Operation: "SetLabels", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.SetLabels(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -25978,14 +24898,13 @@ func (g *GCEAlphaImages) SetLabels(ctx context.Context, key *meta.Key, arg0 *com } call := g.s.Alpha.Images.SetLabels(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaImages.SetLabels(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -26012,7 +24931,6 @@ func (g *GCEAlphaImages) TestIamPermissions(ctx context.Context, key *meta.Key, Operation: "TestIamPermissions", Version: meta.Version("alpha"), Service: "Images", - Resource: key, } klog.V(5).Infof("GCEAlphaImages.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26022,7 +24940,6 @@ func (g *GCEAlphaImages) TestIamPermissions(ctx context.Context, key *meta.Key, } call := g.s.Alpha.Images.TestIamPermissions(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) @@ -26244,7 +25161,6 @@ func (g *GCEAlphaNetworks) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("alpha"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -26254,7 +25170,6 @@ func (g *GCEAlphaNetworks) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.Alpha.Networks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaNetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -26269,7 +25184,6 @@ func (g *GCEAlphaNetworks) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCEAlphaNetworks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.Network, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaNetworks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Networks") ck := &CallContextKey{ @@ -26277,7 +25191,6 @@ func (g *GCEAlphaNetworks) List(ctx context.Context, fl *filter.F, options ...Op Operation: "List", Version: meta.Version("alpha"), Service: "Networks", - Resource: key, } callObserverStart(ctx, ck) @@ -26336,7 +25249,6 @@ func (g *GCEAlphaNetworks) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("alpha"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26348,14 +25260,13 @@ func (g *GCEAlphaNetworks) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.Alpha.Networks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -26379,7 +25290,6 @@ func (g *GCEAlphaNetworks) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("alpha"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26391,14 +25301,13 @@ func (g *GCEAlphaNetworks) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaNetworks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -26619,7 +25528,6 @@ func (g *GCEBetaNetworks) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("beta"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCEBetaNetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -26629,7 +25537,6 @@ func (g *GCEBetaNetworks) Get(ctx context.Context, key *meta.Key, options ...Opt return nil, err } call := g.s.Beta.Networks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaNetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -26644,7 +25551,6 @@ func (g *GCEBetaNetworks) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *GCEBetaNetworks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.Network, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaNetworks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Networks") ck := &CallContextKey{ @@ -26652,7 +25558,6 @@ func (g *GCEBetaNetworks) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("beta"), Service: "Networks", - Resource: key, } callObserverStart(ctx, ck) @@ -26711,7 +25616,6 @@ func (g *GCEBetaNetworks) Insert(ctx context.Context, key *meta.Key, obj *comput Operation: "Insert", Version: meta.Version("beta"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCEBetaNetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26723,14 +25627,13 @@ func (g *GCEBetaNetworks) Insert(ctx context.Context, key *meta.Key, obj *comput call := g.s.Beta.Networks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaNetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -26754,7 +25657,6 @@ func (g *GCEBetaNetworks) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("beta"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCEBetaNetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -26766,14 +25668,13 @@ func (g *GCEBetaNetworks) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaNetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaNetworks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -26994,7 +25895,6 @@ func (g *GCENetworks) Get(ctx context.Context, key *meta.Key, options ...Option) Operation: "Get", Version: meta.Version("ga"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCENetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -27004,7 +25904,6 @@ func (g *GCENetworks) Get(ctx context.Context, key *meta.Key, options ...Option) return nil, err } call := g.s.GA.Networks.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCENetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -27019,7 +25918,6 @@ func (g *GCENetworks) Get(ctx context.Context, key *meta.Key, options ...Option) func (g *GCENetworks) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Network, error) { opts := mergeOptions(options) klog.V(5).Infof("GCENetworks.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Networks") ck := &CallContextKey{ @@ -27027,7 +25925,6 @@ func (g *GCENetworks) List(ctx context.Context, fl *filter.F, options ...Option) Operation: "List", Version: meta.Version("ga"), Service: "Networks", - Resource: key, } callObserverStart(ctx, ck) @@ -27086,7 +25983,6 @@ func (g *GCENetworks) Insert(ctx context.Context, key *meta.Key, obj *computega. Operation: "Insert", Version: meta.Version("ga"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCENetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27098,14 +25994,13 @@ func (g *GCENetworks) Insert(ctx context.Context, key *meta.Key, obj *computega. call := g.s.GA.Networks.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCENetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCENetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27129,7 +26024,6 @@ func (g *GCENetworks) Delete(ctx context.Context, key *meta.Key, options ...Opti Operation: "Delete", Version: meta.Version("ga"), Service: "Networks", - Resource: key, } klog.V(5).Infof("GCENetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27141,14 +26035,13 @@ func (g *GCENetworks) Delete(ctx context.Context, key *meta.Key, options ...Opti call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCENetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCENetworks.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -27440,7 +26333,6 @@ func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -27450,7 +26342,6 @@ func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.Alpha.NetworkEndpointGroups.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -27465,7 +26356,6 @@ func (g *GCEAlphaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, func (g *GCEAlphaNetworkEndpointGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "NetworkEndpointGroups") ck := &CallContextKey{ @@ -27473,7 +26363,6 @@ func (g *GCEAlphaNetworkEndpointGroups) List(ctx context.Context, zone string, f Operation: "List", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: key, } callObserverStart(ctx, ck) @@ -27532,7 +26421,6 @@ func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Ke Operation: "Insert", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27544,14 +26432,13 @@ func (g *GCEAlphaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Ke call := g.s.Alpha.NetworkEndpointGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27575,7 +26462,6 @@ func (g *GCEAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Ke Operation: "Delete", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27587,14 +26473,13 @@ func (g *GCEAlphaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Ke call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -27614,7 +26499,6 @@ func (g *GCEAlphaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl * Operation: "AggregatedList", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -27629,7 +26513,6 @@ func (g *GCEAlphaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl * if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computealpha.NetworkEndpointGroup{} f := func(l *computealpha.NetworkEndpointGroupAggregatedList) error { @@ -27676,7 +26559,6 @@ func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Conte Operation: "AttachNetworkEndpoints", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27686,14 +26568,13 @@ func (g *GCEAlphaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Conte } call := g.s.Alpha.NetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27720,7 +26601,6 @@ func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Conte Operation: "DetachNetworkEndpoints", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -27730,14 +26610,13 @@ func (g *GCEAlphaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Conte } call := g.s.Alpha.NetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -27764,7 +26643,6 @@ func (g *GCEAlphaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context Operation: "ListNetworkEndpoints", Version: meta.Version("alpha"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28085,7 +26963,6 @@ func (g *GCEBetaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, o Operation: "Get", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -28095,7 +26972,6 @@ func (g *GCEBetaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, o return nil, err } call := g.s.Beta.NetworkEndpointGroups.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -28110,7 +26986,6 @@ func (g *GCEBetaNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, o func (g *GCEBetaNetworkEndpointGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "NetworkEndpointGroups") ck := &CallContextKey{ @@ -28118,7 +26993,6 @@ func (g *GCEBetaNetworkEndpointGroups) List(ctx context.Context, zone string, fl Operation: "List", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: key, } callObserverStart(ctx, ck) @@ -28177,7 +27051,6 @@ func (g *GCEBetaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key Operation: "Insert", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28189,14 +27062,13 @@ func (g *GCEBetaNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key call := g.s.Beta.NetworkEndpointGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28220,7 +27092,6 @@ func (g *GCEBetaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key Operation: "Delete", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28232,14 +27103,13 @@ func (g *GCEBetaNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -28259,7 +27129,6 @@ func (g *GCEBetaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl *f Operation: "AggregatedList", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: &meta.Key{}, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -28274,7 +27143,6 @@ func (g *GCEBetaNetworkEndpointGroups) AggregatedList(ctx context.Context, fl *f if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computebeta.NetworkEndpointGroup{} f := func(l *computebeta.NetworkEndpointGroupAggregatedList) error { @@ -28321,7 +27189,6 @@ func (g *GCEBetaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Contex Operation: "AttachNetworkEndpoints", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28331,14 +27198,13 @@ func (g *GCEBetaNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Contex } call := g.s.Beta.NetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28365,7 +27231,6 @@ func (g *GCEBetaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Contex Operation: "DetachNetworkEndpoints", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28375,14 +27240,13 @@ func (g *GCEBetaNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Contex } call := g.s.Beta.NetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28409,7 +27273,6 @@ func (g *GCEBetaNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, Operation: "ListNetworkEndpoints", Version: meta.Version("beta"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28730,7 +27593,6 @@ func (g *GCENetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, optio Operation: "Get", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -28740,7 +27602,6 @@ func (g *GCENetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, optio return nil, err } call := g.s.GA.NetworkEndpointGroups.Get(projectID, key.Zone, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCENetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -28755,7 +27616,6 @@ func (g *GCENetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, optio func (g *GCENetworkEndpointGroups) List(ctx context.Context, zone string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCENetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, zone, fl, opts) - key := &meta.Key{Name: zone} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "NetworkEndpointGroups") ck := &CallContextKey{ @@ -28763,7 +27623,6 @@ func (g *GCENetworkEndpointGroups) List(ctx context.Context, zone string, fl *fi Operation: "List", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: key, } callObserverStart(ctx, ck) @@ -28822,7 +27681,6 @@ func (g *GCENetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, ob Operation: "Insert", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28834,14 +27692,13 @@ func (g *GCENetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, ob call := g.s.GA.NetworkEndpointGroups.Insert(projectID, key.Zone, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCENetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCENetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -28865,7 +27722,6 @@ func (g *GCENetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, op Operation: "Delete", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28877,14 +27733,13 @@ func (g *GCENetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, op call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCENetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCENetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -28904,7 +27759,6 @@ func (g *GCENetworkEndpointGroups) AggregatedList(ctx context.Context, fl *filte Operation: "AggregatedList", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: &meta.Key{}, } klog.V(5).Infof("GCENetworkEndpointGroups.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) @@ -28919,7 +27773,6 @@ func (g *GCENetworkEndpointGroups) AggregatedList(ctx context.Context, fl *filte if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) all := map[string][]*computega.NetworkEndpointGroup{} f := func(l *computega.NetworkEndpointGroupAggregatedList) error { @@ -28966,7 +27819,6 @@ func (g *GCENetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, k Operation: "AttachNetworkEndpoints", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -28976,14 +27828,13 @@ func (g *GCENetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, k } call := g.s.GA.NetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCENetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCENetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29010,7 +27861,6 @@ func (g *GCENetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, k Operation: "DetachNetworkEndpoints", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29020,14 +27870,13 @@ func (g *GCENetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, k } call := g.s.GA.NetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Zone, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCENetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCENetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29054,7 +27903,6 @@ func (g *GCENetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key Operation: "ListNetworkEndpoints", Version: meta.Version("ga"), Service: "NetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCENetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29334,7 +28182,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta Operation: "Get", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -29344,7 +28191,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta return nil, err } call := g.s.Alpha.GlobalNetworkEndpointGroups.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -29359,7 +28205,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta func (g *GCEAlphaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "GlobalNetworkEndpointGroups") ck := &CallContextKey{ @@ -29367,7 +28212,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filt Operation: "List", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } callObserverStart(ctx, ck) @@ -29426,7 +28270,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *m Operation: "Insert", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29438,14 +28281,13 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *m call := g.s.Alpha.GlobalNetworkEndpointGroups.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29469,7 +28311,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *m Operation: "Delete", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29481,14 +28322,13 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *m call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -29512,7 +28352,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context Operation: "AttachNetworkEndpoints", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29522,14 +28361,13 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context } call := g.s.Alpha.GlobalNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29556,7 +28394,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context Operation: "DetachNetworkEndpoints", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29566,14 +28403,13 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context } call := g.s.Alpha.GlobalNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -29600,7 +28436,6 @@ func (g *GCEAlphaGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.C Operation: "ListNetworkEndpoints", Version: meta.Version("alpha"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEAlphaGlobalNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29880,7 +28715,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta. Operation: "Get", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -29890,7 +28724,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta. return nil, err } call := g.s.Beta.GlobalNetworkEndpointGroups.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -29905,7 +28738,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta. func (g *GCEBetaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "GlobalNetworkEndpointGroups") ck := &CallContextKey{ @@ -29913,7 +28745,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filte Operation: "List", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } callObserverStart(ctx, ck) @@ -29972,7 +28803,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *me Operation: "Insert", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -29984,14 +28814,13 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *me call := g.s.Beta.GlobalNetworkEndpointGroups.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -30015,7 +28844,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *me Operation: "Delete", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30027,14 +28855,13 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *me call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -30058,7 +28885,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context. Operation: "AttachNetworkEndpoints", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30068,14 +28894,13 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context. } call := g.s.Beta.GlobalNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -30102,7 +28927,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context. Operation: "DetachNetworkEndpoints", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30112,14 +28936,13 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context. } call := g.s.Beta.GlobalNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -30146,7 +28969,6 @@ func (g *GCEBetaGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Co Operation: "ListNetworkEndpoints", Version: meta.Version("beta"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEBetaGlobalNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30426,7 +29248,6 @@ func (g *GCEGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, Operation: "Get", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -30436,7 +29257,6 @@ func (g *GCEGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, return nil, err } call := g.s.GA.GlobalNetworkEndpointGroups.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -30451,7 +29271,6 @@ func (g *GCEGlobalNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, func (g *GCEGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "GlobalNetworkEndpointGroups") ck := &CallContextKey{ @@ -30459,7 +29278,6 @@ func (g *GCEGlobalNetworkEndpointGroups) List(ctx context.Context, fl *filter.F, Operation: "List", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } callObserverStart(ctx, ck) @@ -30518,7 +29336,6 @@ func (g *GCEGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *meta.K Operation: "Insert", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30530,14 +29347,13 @@ func (g *GCEGlobalNetworkEndpointGroups) Insert(ctx context.Context, key *meta.K call := g.s.GA.GlobalNetworkEndpointGroups.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -30561,7 +29377,6 @@ func (g *GCEGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *meta.K Operation: "Delete", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30573,14 +29388,13 @@ func (g *GCEGlobalNetworkEndpointGroups) Delete(ctx context.Context, key *meta.K call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -30604,7 +29418,6 @@ func (g *GCEGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Cont Operation: "AttachNetworkEndpoints", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30614,14 +29427,13 @@ func (g *GCEGlobalNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Cont } call := g.s.GA.GlobalNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -30648,7 +29460,6 @@ func (g *GCEGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Cont Operation: "DetachNetworkEndpoints", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30658,14 +29469,13 @@ func (g *GCEGlobalNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Cont } call := g.s.GA.GlobalNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEGlobalNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -30692,7 +29502,6 @@ func (g *GCEGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Contex Operation: "ListNetworkEndpoints", Version: meta.Version("ga"), Service: "GlobalNetworkEndpointGroups", - Resource: key, } klog.V(5).Infof("GCEGlobalNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -30730,57 +29539,92 @@ func (g *GCEGlobalNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Contex return all, nil } -// AlphaRegionNetworkEndpointGroups is an interface that allows for mocking of RegionNetworkEndpointGroups. -type AlphaRegionNetworkEndpointGroups interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.NetworkEndpointGroup, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - AttachNetworkEndpoints(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, ...Option) error - DetachNetworkEndpoints(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, ...Option) error - ListNetworkEndpoints(context.Context, *meta.Key, *filter.F, ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) +// Projects is an interface that allows for mocking of Projects. +type Projects interface { + // ProjectsOps is an interface with additional non-CRUD type methods. + // This interface is expected to be implemented by hand (non-autogenerated). + ProjectsOps } -// NewMockAlphaRegionNetworkEndpointGroups returns a new mock for RegionNetworkEndpointGroups. -func NewMockAlphaRegionNetworkEndpointGroups(pr ProjectRouter, objs map[meta.Key]*MockRegionNetworkEndpointGroupsObj) *MockAlphaRegionNetworkEndpointGroups { - mock := &MockAlphaRegionNetworkEndpointGroups{ +// NewMockProjects returns a new mock for Projects. +func NewMockProjects(pr ProjectRouter, objs map[meta.Key]*MockProjectsObj) *MockProjects { + mock := &MockProjects{ ProjectRouter: pr, - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, + Objects: objs, } return mock } -// MockAlphaRegionNetworkEndpointGroups is the mock for RegionNetworkEndpointGroups. -type MockAlphaRegionNetworkEndpointGroups struct { +// MockProjects is the mock for Projects. +type MockProjects struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionNetworkEndpointGroupsObj + Objects map[meta.Key]*MockProjectsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, *computealpha.NetworkEndpointGroup, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, []*computealpha.NetworkEndpointGroup, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionNetworkEndpointGroups, options ...Option) (bool, error) - AttachNetworkEndpointsHook func(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, *MockAlphaRegionNetworkEndpointGroups, ...Option) error - DetachNetworkEndpointsHook func(context.Context, *meta.Key, *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, *MockAlphaRegionNetworkEndpointGroups, ...Option) error - ListNetworkEndpointsHook func(context.Context, *meta.Key, *filter.F, *MockAlphaRegionNetworkEndpointGroups, ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) + + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} +} + +// Obj wraps the object for use in the mock. +func (m *MockProjects) Obj(o *computega.Project) *MockProjectsObj { + return &MockProjectsObj{o} +} + +// GCEProjects is a simplifying adapter for the GCE Projects. +type GCEProjects struct { + s *Service +} + +// Regions is an interface that allows for mocking of Regions. +type Regions interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) +} + +// NewMockRegions returns a new mock for Regions. +func NewMockRegions(pr ProjectRouter, objs map[meta.Key]*MockRegionsObj) *MockRegions { + mock := &MockRegions{ + ProjectRouter: pr, + + Objects: objs, + GetError: map[meta.Key]error{}, + } + return mock +} + +// MockRegions is the mock for Regions. +type MockRegions struct { + Lock sync.Mutex + + ProjectRouter ProjectRouter + + // Objects maintained by the mock. + Objects map[meta.Key]*MockRegionsObj + + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockRegions, options ...Option) (bool, *computega.Region, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockRegions, options ...Option) (bool, []*computega.Region, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -30788,10 +29632,10 @@ type MockAlphaRegionNetworkEndpointGroups struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.NetworkEndpointGroup, error) { +func (m *MockRegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -30803,28 +29647,28 @@ func (m *MockAlphaRegionNetworkEndpointGroups) Get(ctx context.Context, key *met defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionNetworkEndpointGroups %v not found", key), + Message: fmt.Sprintf("MockRegions %v not found", key), } - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { +// List all of the objects in the mock. +func (m *MockRegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -30834,161 +29678,61 @@ func (m *MockAlphaRegionNetworkEndpointGroups) List(ctx context.Context, region if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockRegions.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computealpha.NetworkEndpointGroup - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToAlpha()) { + var objs []*computega.Region + for _, obj := range m.Objects { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } -// Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } - opts := mergeOptions(options) - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - if _, ok := m.Objects[*key]; ok { - err := &googleapi.Error{ - Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionNetworkEndpointGroups %v exists", key), - } - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - - obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "networkEndpointGroups") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "networkEndpointGroups", key) - - m.Objects[*key] = &MockRegionNetworkEndpointGroupsObj{obj} - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = nil", ctx, key, obj) - return nil -} - -// Delete is a mock for deleting the object. -func (m *MockAlphaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - if m.DeleteHook != nil { - if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) - return err - } - } - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) - return err - } - if _, ok := m.Objects[*key]; !ok { - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionNetworkEndpointGroups %v not found", key), - } - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = nil", ctx, key) - return nil -} - // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionNetworkEndpointGroups) Obj(o *computealpha.NetworkEndpointGroup) *MockRegionNetworkEndpointGroupsObj { - return &MockRegionNetworkEndpointGroupsObj{o} -} - -// AttachNetworkEndpoints is a mock for the corresponding method. -func (m *MockAlphaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { - if m.AttachNetworkEndpointsHook != nil { - return m.AttachNetworkEndpointsHook(ctx, key, arg0, m) - } - return nil -} - -// DetachNetworkEndpoints is a mock for the corresponding method. -func (m *MockAlphaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { - if m.DetachNetworkEndpointsHook != nil { - return m.DetachNetworkEndpointsHook(ctx, key, arg0, m) - } - return nil -} - -// ListNetworkEndpoints is a mock for the corresponding method. -func (m *MockAlphaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) { - if m.ListNetworkEndpointsHook != nil { - return m.ListNetworkEndpointsHook(ctx, key, fl, m) - } - return nil, nil +func (m *MockRegions) Obj(o *computega.Region) *MockRegionsObj { + return &MockRegionsObj{o} } -// GCEAlphaRegionNetworkEndpointGroups is a simplifying adapter for the GCE RegionNetworkEndpointGroups. -type GCEAlphaRegionNetworkEndpointGroups struct { +// GCERegions is a simplifying adapter for the GCE Regions. +type GCERegions struct { s *Service } -// Get the NetworkEndpointGroup named by key. -func (g *GCEAlphaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.NetworkEndpointGroup, error) { +// Get the Region named by key. +func (g *GCERegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegions.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegions.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("ga"), + Service: "Regions", } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegions.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegions.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionNetworkEndpointGroups.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.Regions.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegions.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -30996,34 +29740,32 @@ func (g *GCEAlphaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta return v, err } -// List all NetworkEndpointGroup objects. -func (g *GCEAlphaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointGroup, error) { +// List all Region objects. +func (g *GCERegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") + klog.V(5).Infof("GCERegions.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("ga"), + Service: "Regions", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionNetworkEndpointGroups.List(projectID, region) + klog.V(5).Infof("GCERegions.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.Regions.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.NetworkEndpointGroup - f := func(l *computealpha.NetworkEndpointGroupList) error { - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.Region + f := func(l *computega.RegionList) error { + klog.V(5).Infof("GCERegions.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -31031,7 +29773,7 @@ func (g *GCEAlphaRegionNetworkEndpointGroups) List(ctx context.Context, region s callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -31039,297 +29781,74 @@ func (g *GCEAlphaRegionNetworkEndpointGroups) List(ctx context.Context, region s g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegions.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert NetworkEndpointGroup with key of value obj. -func (g *GCEAlphaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computealpha.NetworkEndpointGroup, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } +// AlphaRouters is an interface that allows for mocking of Routers. +type AlphaRouters interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) + GetRouterStatus(context.Context, *meta.Key, ...Option) (*computealpha.RouterStatusResponse, error) + Patch(context.Context, *meta.Key, *computealpha.Router, ...Option) error + Preview(context.Context, *meta.Key, *computealpha.Router, ...Option) (*computealpha.RoutersPreviewResponse, error) + TestIamPermissions(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, ...Option) (*computealpha.TestPermissionsResponse, error) +} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") +// NewMockAlphaRouters returns a new mock for Routers. +func NewMockAlphaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockAlphaRouters { + mock := &MockAlphaRouters{ + ProjectRouter: pr, - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Insert", - Version: meta.Version("alpha"), - Service: "RegionNetworkEndpointGroups", - Resource: key, - } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, } - obj.Name = key.Name - call := g.s.Alpha.RegionNetworkEndpointGroups.Insert(projectID, key.Region, obj) - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) + return mock +} - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) +// MockAlphaRouters is the mock for Routers. +type MockAlphaRouters struct { + Lock sync.Mutex - if err != nil { - return err - } + ProjectRouter ProjectRouter - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err -} - -// Delete the NetworkEndpointGroup referenced by key. -func (g *GCEAlphaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Delete", - Version: meta.Version("alpha"), - Service: "RegionNetworkEndpointGroups", - Resource: key, - } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.RegionNetworkEndpointGroups.Delete(projectID, key.Region, key.Name) - - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// AttachNetworkEndpoints is a method on GCEAlphaRegionNetworkEndpointGroups. -func (g *GCEAlphaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "AttachNetworkEndpoints", - Version: meta.Version("alpha"), - Service: "RegionNetworkEndpointGroups", - Resource: key, - } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.RegionNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// DetachNetworkEndpoints is a method on GCEAlphaRegionNetworkEndpointGroups. -func (g *GCEAlphaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "DetachNetworkEndpoints", - Version: meta.Version("alpha"), - Service: "RegionNetworkEndpointGroups", - Resource: key, - } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.RegionNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// ListNetworkEndpoints is a method on GCEAlphaRegionNetworkEndpointGroups. -func (g *GCEAlphaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computealpha.NetworkEndpointWithHealthStatus, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionNetworkEndpointGroups") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "ListNetworkEndpoints", - Version: meta.Version("alpha"), - Service: "RegionNetworkEndpointGroups", - Resource: key, - } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Alpha.RegionNetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Region, key.Name) - var all []*computealpha.NetworkEndpointWithHealthStatus - f := func(l *computealpha.NetworkEndpointGroupsListNetworkEndpoints) error { - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v", ctx, key, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, nil, err) - return nil, err - } - - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v", ctx, key, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEAlphaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, asStr, nil) - } - return all, nil -} - -// BetaRegionNetworkEndpointGroups is an interface that allows for mocking of RegionNetworkEndpointGroups. -type BetaRegionNetworkEndpointGroups interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.NetworkEndpointGroup, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - AttachNetworkEndpoints(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, ...Option) error - DetachNetworkEndpoints(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, ...Option) error - ListNetworkEndpoints(context.Context, *meta.Key, *filter.F, ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) -} - -// NewMockBetaRegionNetworkEndpointGroups returns a new mock for RegionNetworkEndpointGroups. -func NewMockBetaRegionNetworkEndpointGroups(pr ProjectRouter, objs map[meta.Key]*MockRegionNetworkEndpointGroupsObj) *MockBetaRegionNetworkEndpointGroups { - mock := &MockBetaRegionNetworkEndpointGroups{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockBetaRegionNetworkEndpointGroups is the mock for RegionNetworkEndpointGroups. -type MockBetaRegionNetworkEndpointGroups struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionNetworkEndpointGroupsObj + // Objects maintained by the mock. + Objects map[meta.Key]*MockRoutersObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + AggregatedListError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, *computebeta.NetworkEndpointGroup, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, []*computebeta.NetworkEndpointGroup, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionNetworkEndpointGroups, options ...Option) (bool, error) - AttachNetworkEndpointsHook func(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, *MockBetaRegionNetworkEndpointGroups, ...Option) error - DetachNetworkEndpointsHook func(context.Context, *meta.Key, *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, *MockBetaRegionNetworkEndpointGroups, ...Option) error - ListNetworkEndpointsHook func(context.Context, *meta.Key, *filter.F, *MockBetaRegionNetworkEndpointGroups, ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, *computealpha.Router, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, []*computealpha.Router, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Router, m *MockAlphaRouters, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, error) + AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, map[string][]*computealpha.Router, error) + GetRouterStatusHook func(context.Context, *meta.Key, *MockAlphaRouters, ...Option) (*computealpha.RouterStatusResponse, error) + PatchHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) error + PreviewHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) (*computealpha.RoutersPreviewResponse, error) + TestIamPermissionsHook func(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, *MockAlphaRouters, ...Option) (*computealpha.TestPermissionsResponse, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -31337,10 +29856,10 @@ type MockBetaRegionNetworkEndpointGroups struct { } // Get returns the object from the mock. -func (m *MockBetaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.NetworkEndpointGroup, error) { +func (m *MockAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -31352,28 +29871,28 @@ func (m *MockBetaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionNetworkEndpointGroups %v not found", key), + Message: fmt.Sprintf("MockAlphaRouters %v not found", key), } - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockBetaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { +func (m *MockAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -31383,31 +29902,31 @@ func (m *MockBetaRegionNetworkEndpointGroups) List(ctx context.Context, region s if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.NetworkEndpointGroup + var objs []*computealpha.Router for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToBeta()) { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, options ...Option) error { +func (m *MockAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -31420,32 +29939,32 @@ func (m *MockBetaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *m defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionNetworkEndpointGroups %v exists", key), + Message: fmt.Sprintf("MockAlphaRouters %v exists", key), } - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "networkEndpointGroups") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "networkEndpointGroups", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "routers") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "routers", key) - m.Objects[*key] = &MockRegionNetworkEndpointGroupsObj{obj} - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRoutersObj{obj} + klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -31457,87 +29976,128 @@ func (m *MockBetaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *m defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionNetworkEndpointGroups %v not found", key), + Message: fmt.Sprintf("MockAlphaRouters %v not found", key), } - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionNetworkEndpointGroups.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = nil", ctx, key) return nil } +// AggregatedList is a mock for AggregatedList. +func (m *MockAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { + if m.AggregatedListHook != nil { + if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.AggregatedListError != nil { + err := *m.AggregatedListError + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err + } + + objs := map[string][]*computealpha.Router{} + for _, obj := range m.Objects { + res, err := ParseResourceURL(obj.ToAlpha().SelfLink) + if err != nil { + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err + } + if !fl.Match(obj.ToAlpha()) { + continue + } + location := aggregatedListKey(res.Key) + objs[location] = append(objs[location], obj.ToAlpha()) + } + klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + // Obj wraps the object for use in the mock. -func (m *MockBetaRegionNetworkEndpointGroups) Obj(o *computebeta.NetworkEndpointGroup) *MockRegionNetworkEndpointGroupsObj { - return &MockRegionNetworkEndpointGroupsObj{o} +func (m *MockAlphaRouters) Obj(o *computealpha.Router) *MockRoutersObj { + return &MockRoutersObj{o} } -// AttachNetworkEndpoints is a mock for the corresponding method. -func (m *MockBetaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { - if m.AttachNetworkEndpointsHook != nil { - return m.AttachNetworkEndpointsHook(ctx, key, arg0, m) +// GetRouterStatus is a mock for the corresponding method. +func (m *MockAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { + if m.GetRouterStatusHook != nil { + return m.GetRouterStatusHook(ctx, key, m) } - return nil + return nil, fmt.Errorf("GetRouterStatusHook must be set") } -// DetachNetworkEndpoints is a mock for the corresponding method. -func (m *MockBetaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { - if m.DetachNetworkEndpointsHook != nil { - return m.DetachNetworkEndpointsHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// ListNetworkEndpoints is a mock for the corresponding method. -func (m *MockBetaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) { - if m.ListNetworkEndpointsHook != nil { - return m.ListNetworkEndpointsHook(ctx, key, fl, m) +// Preview is a mock for the corresponding method. +func (m *MockAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { + if m.PreviewHook != nil { + return m.PreviewHook(ctx, key, arg0, m) } - return nil, nil + return nil, fmt.Errorf("PreviewHook must be set") +} + +// TestIamPermissions is a mock for the corresponding method. +func (m *MockAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { + if m.TestIamPermissionsHook != nil { + return m.TestIamPermissionsHook(ctx, key, arg0, m) + } + return nil, fmt.Errorf("TestIamPermissionsHook must be set") } -// GCEBetaRegionNetworkEndpointGroups is a simplifying adapter for the GCE RegionNetworkEndpointGroups. -type GCEBetaRegionNetworkEndpointGroups struct { +// GCEAlphaRouters is a simplifying adapter for the GCE Routers. +type GCEAlphaRouters struct { s *Service } -// Get the NetworkEndpointGroup named by key. -func (g *GCEBetaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.NetworkEndpointGroup, error) { +// Get the Router named by key. +func (g *GCEAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("alpha"), + Service: "Routers", } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionNetworkEndpointGroups.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.Routers.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -31545,34 +30105,32 @@ func (g *GCEBetaRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta. return v, err } -// List all NetworkEndpointGroup objects. -func (g *GCEBetaRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointGroup, error) { +// List all Router objects. +func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") + klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("alpha"), + Service: "Routers", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionNetworkEndpointGroups.List(projectID, region) + klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.Routers.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.NetworkEndpointGroup - f := func(l *computebeta.NetworkEndpointGroupList) error { - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.Router + f := func(l *computealpha.RouterList) error { + klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -31580,7 +30138,7 @@ func (g *GCEBetaRegionNetworkEndpointGroups) List(ctx context.Context, region st callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -31588,182 +30146,221 @@ func (g *GCEBetaRegionNetworkEndpointGroups) List(ctx context.Context, region st g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert NetworkEndpointGroup with key of value obj. -func (g *GCEBetaRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computebeta.NetworkEndpointGroup, options ...Option) error { +// Insert Router with key of value obj. +func (g *GCEAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("alpha"), + Service: "Routers", } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionNetworkEndpointGroups.Insert(projectID, key.Region, obj) + call := g.s.Alpha.Routers.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the NetworkEndpointGroup referenced by key. -func (g *GCEBetaRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Router referenced by key. +func (g *GCEAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("alpha"), + Service: "Routers", } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionNetworkEndpointGroups.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.Routers.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } -// AttachNetworkEndpoints is a method on GCEBetaRegionNetworkEndpointGroups. -func (g *GCEBetaRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { +// AggregatedList lists all resources of the given type across all locations. +func (g *GCEAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) called", ctx, fl) - if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AttachNetworkEndpoints", - Version: meta.Version("beta"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Operation: "AggregatedList", + Version: meta.Version("alpha"), + Service: "Routers", } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) + return nil, err } - call := g.s.Beta.RegionNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Region, key.Name, arg0) + + call := g.s.Alpha.Routers.AggregatedList(projectID) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + if fl != filter.None { + call.Filter(fl.String()) + } - if err != nil { + all := map[string][]*computealpha.Router{} + f := func(l *computealpha.RouterAggregatedList) error { + for k, v := range l.Items { + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) + all[k] = append(all[k], v.Routers...) + } + return nil + } + if err := call.Pages(ctx, f); err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - return err + klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) + return nil, err } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) + } + return all, nil +} + +// GetRouterStatus is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "GetRouterStatus", + Version: meta.Version("alpha"), + Service: "Routers", + } + klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Alpha.Routers.GetRouterStatus(projectID, key.Region, key.Name) + call.Context(ctx) + v, err := call.Do() - err = g.s.WaitForCompletion(ctx, op) callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX + g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - return err + klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err } -// DetachNetworkEndpoints is a method on GCEBetaRegionNetworkEndpointGroups. -func (g *GCEBetaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { +// Patch is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "DetachNetworkEndpoints", - Version: meta.Version("beta"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "Routers", } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.Routers.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -31771,79 +30368,94 @@ func (g *GCEBetaRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context. callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// ListNetworkEndpoints is a method on GCEBetaRegionNetworkEndpointGroups. -func (g *GCEBetaRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computebeta.NetworkEndpointWithHealthStatus, error) { +// Preview is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "ListNetworkEndpoints", - Version: meta.Version("beta"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Operation: "Preview", + Version: meta.Version("alpha"), + Service: "Routers", } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionNetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Region, key.Name) - var all []*computebeta.NetworkEndpointWithHealthStatus - f := func(l *computebeta.NetworkEndpointGroupsListNetworkEndpoints) error { - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v", ctx, key, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + call := g.s.Alpha.Routers.Preview(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + v, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err +} + +// TestIamPermissions is a method on GCEAlphaRouters. +func (g *GCEAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, nil, err) + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "TestIamPermissions", + Version: meta.Version("alpha"), + Service: "Routers", + } + klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } + call := g.s.Alpha.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + v, err := call.Do() - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) - if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v", ctx, key, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEBetaRegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, asStr, nil) - } - return all, nil + klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err } -// RegionNetworkEndpointGroups is an interface that allows for mocking of RegionNetworkEndpointGroups. -type RegionNetworkEndpointGroups interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.NetworkEndpointGroup, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, options ...Option) error +// BetaRouters is an interface that allows for mocking of Routers. +type BetaRouters interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AttachNetworkEndpoints(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, ...Option) error - DetachNetworkEndpoints(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, ...Option) error - ListNetworkEndpoints(context.Context, *meta.Key, *filter.F, ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) + AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) + GetRouterStatus(context.Context, *meta.Key, ...Option) (*computebeta.RouterStatusResponse, error) + Patch(context.Context, *meta.Key, *computebeta.Router, ...Option) error + Preview(context.Context, *meta.Key, *computebeta.Router, ...Option) (*computebeta.RoutersPreviewResponse, error) + TestIamPermissions(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, ...Option) (*computebeta.TestPermissionsResponse, error) } -// NewMockRegionNetworkEndpointGroups returns a new mock for RegionNetworkEndpointGroups. -func NewMockRegionNetworkEndpointGroups(pr ProjectRouter, objs map[meta.Key]*MockRegionNetworkEndpointGroupsObj) *MockRegionNetworkEndpointGroups { - mock := &MockRegionNetworkEndpointGroups{ - ProjectRouter: pr, - +// NewMockBetaRouters returns a new mock for Routers. +func NewMockBetaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockBetaRouters { + mock := &MockBetaRouters{ + ProjectRouter: pr, + Objects: objs, GetError: map[meta.Key]error{}, InsertError: map[meta.Key]error{}, @@ -31852,33 +30464,36 @@ func NewMockRegionNetworkEndpointGroups(pr ProjectRouter, objs map[meta.Key]*Moc return mock } -// MockRegionNetworkEndpointGroups is the mock for RegionNetworkEndpointGroups. -type MockRegionNetworkEndpointGroups struct { +// MockBetaRouters is the mock for Routers. +type MockBetaRouters struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionNetworkEndpointGroupsObj + Objects map[meta.Key]*MockRoutersObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + AggregatedListError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, *computega.NetworkEndpointGroup, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, []*computega.NetworkEndpointGroup, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionNetworkEndpointGroups, options ...Option) (bool, error) - AttachNetworkEndpointsHook func(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, *MockRegionNetworkEndpointGroups, ...Option) error - DetachNetworkEndpointsHook func(context.Context, *meta.Key, *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, *MockRegionNetworkEndpointGroups, ...Option) error - ListNetworkEndpointsHook func(context.Context, *meta.Key, *filter.F, *MockRegionNetworkEndpointGroups, ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, *computebeta.Router, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, []*computebeta.Router, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Router, m *MockBetaRouters, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, error) + AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, map[string][]*computebeta.Router, error) + GetRouterStatusHook func(context.Context, *meta.Key, *MockBetaRouters, ...Option) (*computebeta.RouterStatusResponse, error) + PatchHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) error + PreviewHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) (*computebeta.RoutersPreviewResponse, error) + TestIamPermissionsHook func(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, *MockBetaRouters, ...Option) (*computebeta.TestPermissionsResponse, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -31886,10 +30501,10 @@ type MockRegionNetworkEndpointGroups struct { } // Get returns the object from the mock. -func (m *MockRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.NetworkEndpointGroup, error) { +func (m *MockBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -31901,28 +30516,28 @@ func (m *MockRegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionNetworkEndpointGroups %v not found", key), + Message: fmt.Sprintf("MockBetaRouters %v not found", key), } - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockRegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { +func (m *MockBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -31932,31 +30547,31 @@ func (m *MockRegionNetworkEndpointGroups) List(ctx context.Context, region strin if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegionNetworkEndpointGroups.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.NetworkEndpointGroup + var objs []*computebeta.Router for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToGA()) { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockRegionNetworkEndpointGroups.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, options ...Option) error { +func (m *MockBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -31969,32 +30584,32 @@ func (m *MockRegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionNetworkEndpointGroups %v exists", key), + Message: fmt.Sprintf("MockBetaRouters %v exists", key), } - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "networkEndpointGroups") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "networkEndpointGroups", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "routers") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "routers", key) - m.Objects[*key] = &MockRegionNetworkEndpointGroupsObj{obj} - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRoutersObj{obj} + klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -32006,87 +30621,128 @@ func (m *MockRegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionNetworkEndpointGroups %v not found", key), + Message: fmt.Sprintf("MockBetaRouters %v not found", key), } - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionNetworkEndpointGroups.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = nil", ctx, key) return nil } +// AggregatedList is a mock for AggregatedList. +func (m *MockBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { + if m.AggregatedListHook != nil { + if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.AggregatedListError != nil { + err := *m.AggregatedListError + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err + } + + objs := map[string][]*computebeta.Router{} + for _, obj := range m.Objects { + res, err := ParseResourceURL(obj.ToBeta().SelfLink) + if err != nil { + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + return nil, err + } + if !fl.Match(obj.ToBeta()) { + continue + } + location := aggregatedListKey(res.Key) + objs[location] = append(objs[location], obj.ToBeta()) + } + klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + // Obj wraps the object for use in the mock. -func (m *MockRegionNetworkEndpointGroups) Obj(o *computega.NetworkEndpointGroup) *MockRegionNetworkEndpointGroupsObj { - return &MockRegionNetworkEndpointGroupsObj{o} +func (m *MockBetaRouters) Obj(o *computebeta.Router) *MockRoutersObj { + return &MockRoutersObj{o} } -// AttachNetworkEndpoints is a mock for the corresponding method. -func (m *MockRegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { - if m.AttachNetworkEndpointsHook != nil { - return m.AttachNetworkEndpointsHook(ctx, key, arg0, m) +// GetRouterStatus is a mock for the corresponding method. +func (m *MockBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { + if m.GetRouterStatusHook != nil { + return m.GetRouterStatusHook(ctx, key, m) } - return nil + return nil, fmt.Errorf("GetRouterStatusHook must be set") } -// DetachNetworkEndpoints is a mock for the corresponding method. -func (m *MockRegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { - if m.DetachNetworkEndpointsHook != nil { - return m.DetachNetworkEndpointsHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// ListNetworkEndpoints is a mock for the corresponding method. -func (m *MockRegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) { - if m.ListNetworkEndpointsHook != nil { - return m.ListNetworkEndpointsHook(ctx, key, fl, m) +// Preview is a mock for the corresponding method. +func (m *MockBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { + if m.PreviewHook != nil { + return m.PreviewHook(ctx, key, arg0, m) } - return nil, nil + return nil, fmt.Errorf("PreviewHook must be set") +} + +// TestIamPermissions is a mock for the corresponding method. +func (m *MockBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { + if m.TestIamPermissionsHook != nil { + return m.TestIamPermissionsHook(ctx, key, arg0, m) + } + return nil, fmt.Errorf("TestIamPermissionsHook must be set") } -// GCERegionNetworkEndpointGroups is a simplifying adapter for the GCE RegionNetworkEndpointGroups. -type GCERegionNetworkEndpointGroups struct { +// GCEBetaRouters is a simplifying adapter for the GCE Routers. +type GCEBetaRouters struct { s *Service } -// Get the NetworkEndpointGroup named by key. -func (g *GCERegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.NetworkEndpointGroup, error) { +// Get the Router named by key. +func (g *GCEBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRouters.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("beta"), + Service: "Routers", } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionNetworkEndpointGroups.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.Routers.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -32094,34 +30750,32 @@ func (g *GCERegionNetworkEndpointGroups) Get(ctx context.Context, key *meta.Key, return v, err } -// List all NetworkEndpointGroup objects. -func (g *GCERegionNetworkEndpointGroups) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointGroup, error) { +// List all Router objects. +func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") + klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("beta"), + Service: "Routers", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionNetworkEndpointGroups.List(projectID, region) + klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.Routers.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.NetworkEndpointGroup - f := func(l *computega.NetworkEndpointGroupList) error { - klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.Router + f := func(l *computebeta.RouterList) error { + klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -32129,7 +30783,7 @@ func (g *GCERegionNetworkEndpointGroups) List(ctx context.Context, region string callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -32137,182 +30791,221 @@ func (g *GCERegionNetworkEndpointGroups) List(ctx context.Context, region string g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert NetworkEndpointGroup with key of value obj. -func (g *GCERegionNetworkEndpointGroups) Insert(ctx context.Context, key *meta.Key, obj *computega.NetworkEndpointGroup, options ...Option) error { +// Insert Router with key of value obj. +func (g *GCEBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("beta"), + Service: "Routers", } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.RegionNetworkEndpointGroups.Insert(projectID, key.Region, obj) + call := g.s.Beta.Routers.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the NetworkEndpointGroup referenced by key. -func (g *GCERegionNetworkEndpointGroups) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Router referenced by key. +func (g *GCEBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Version: meta.Version("beta"), + Service: "Routers", } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionNetworkEndpointGroups.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.Routers.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionNetworkEndpointGroups.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) return err } -// AttachNetworkEndpoints is a method on GCERegionNetworkEndpointGroups. -func (g *GCERegionNetworkEndpointGroups) AttachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsAttachEndpointsRequest, options ...Option) error { +// AggregatedList lists all resources of the given type across all locations. +func (g *GCEBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) called", ctx, fl) - if !key.Valid() { - klog.V(2).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AttachNetworkEndpoints", - Version: meta.Version("ga"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Operation: "AggregatedList", + Version: meta.Version("beta"), + Service: "Routers", } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) + return nil, err } - call := g.s.GA.RegionNetworkEndpointGroups.AttachNetworkEndpoints(projectID, key.Region, key.Name, arg0) + + call := g.s.Beta.Routers.AggregatedList(projectID) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + if fl != filter.None { + call.Filter(fl.String()) + } - if err != nil { + all := map[string][]*computebeta.Router{} + f := func(l *computebeta.RouterAggregatedList) error { + for k, v := range l.Items { + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) + all[k] = append(all[k], v.Routers...) + } + return nil + } + if err := call.Pages(ctx, f); err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - return err + klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) + return nil, err } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) + } + return all, nil +} + +// GetRouterStatus is a method on GCEBetaRouters. +func (g *GCEBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "GetRouterStatus", + Version: meta.Version("beta"), + Service: "Routers", + } + klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Beta.Routers.GetRouterStatus(projectID, key.Region, key.Name) + call.Context(ctx) + v, err := call.Do() - err = g.s.WaitForCompletion(ctx, op) callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX + g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionNetworkEndpointGroups.AttachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) - return err + klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err } -// DetachNetworkEndpoints is a method on GCERegionNetworkEndpointGroups. -func (g *GCERegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Context, key *meta.Key, arg0 *computega.RegionNetworkEndpointGroupsDetachEndpointsRequest, options ...Option) error { +// Patch is a method on GCEBetaRouters. +func (g *GCEBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "DetachNetworkEndpoints", - Version: meta.Version("ga"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "Routers", } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionNetworkEndpointGroups.DetachNetworkEndpoints(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.Routers.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -32320,149 +31013,130 @@ func (g *GCERegionNetworkEndpointGroups) DetachNetworkEndpoints(ctx context.Cont callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERegionNetworkEndpointGroups.DetachNetworkEndpoints(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// ListNetworkEndpoints is a method on GCERegionNetworkEndpointGroups. -func (g *GCERegionNetworkEndpointGroups) ListNetworkEndpoints(ctx context.Context, key *meta.Key, fl *filter.F, options ...Option) ([]*computega.NetworkEndpointWithHealthStatus, error) { +// Preview is a method on GCEBetaRouters. +func (g *GCEBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionNetworkEndpointGroups") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") ck := &CallContextKey{ ProjectID: projectID, - Operation: "ListNetworkEndpoints", - Version: meta.Version("ga"), - Service: "RegionNetworkEndpointGroups", - Resource: key, + Operation: "Preview", + Version: meta.Version("beta"), + Service: "Routers", } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.GA.RegionNetworkEndpointGroups.ListNetworkEndpoints(projectID, key.Region, key.Name) - var all []*computega.NetworkEndpointWithHealthStatus - f := func(l *computega.NetworkEndpointGroupsListNetworkEndpoints) error { - klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...): page %+v", ctx, key, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, nil, err) + klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } + call := g.s.Beta.Routers.Preview(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + v, err := call.Do() - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = [%v items], %v", ctx, key, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCERegionNetworkEndpointGroups.ListNetworkEndpoints(%v, %v, ...) = %v, %v", ctx, key, asStr, nil) - } - return all, nil -} + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) -// Projects is an interface that allows for mocking of Projects. -type Projects interface { - // ProjectsOps is an interface with additional non-CRUD type methods. - // This interface is expected to be implemented by hand (non-autogenerated). - ProjectsOps + klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err } -// NewMockProjects returns a new mock for Projects. -func NewMockProjects(pr ProjectRouter, objs map[meta.Key]*MockProjectsObj) *MockProjects { - mock := &MockProjects{ - ProjectRouter: pr, +// TestIamPermissions is a method on GCEBetaRouters. +func (g *GCEBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) - Objects: objs, + if !key.Valid() { + klog.V(2).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - return mock -} - -// MockProjects is the mock for Projects. -type MockProjects struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockProjectsObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "TestIamPermissions", + Version: meta.Version("beta"), + Service: "Routers", + } + klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return nil, err + } + call := g.s.Beta.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + v, err := call.Do() -// Obj wraps the object for use in the mock. -func (m *MockProjects) Obj(o *computega.Project) *MockProjectsObj { - return &MockProjectsObj{o} -} + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) -// GCEProjects is a simplifying adapter for the GCE Projects. -type GCEProjects struct { - s *Service + klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) + return v, err } -// Regions is an interface that allows for mocking of Regions. -type Regions interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) +// Routers is an interface that allows for mocking of Routers. +type Routers interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) + GetRouterStatus(context.Context, *meta.Key, ...Option) (*computega.RouterStatusResponse, error) + Patch(context.Context, *meta.Key, *computega.Router, ...Option) error + Preview(context.Context, *meta.Key, *computega.Router, ...Option) (*computega.RoutersPreviewResponse, error) } -// NewMockRegions returns a new mock for Regions. -func NewMockRegions(pr ProjectRouter, objs map[meta.Key]*MockRegionsObj) *MockRegions { - mock := &MockRegions{ +// NewMockRouters returns a new mock for Routers. +func NewMockRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockRouters { + mock := &MockRouters{ ProjectRouter: pr, - Objects: objs, - GetError: map[meta.Key]error{}, + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, } return mock } -// MockRegions is the mock for Regions. -type MockRegions struct { +// MockRouters is the mock for Routers. +type MockRouters struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionsObj + Objects map[meta.Key]*MockRoutersObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + AggregatedListError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegions, options ...Option) (bool, *computega.Region, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockRegions, options ...Option) (bool, []*computega.Region, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, *computega.Router, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRouters, options ...Option) (bool, []*computega.Router, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Router, m *MockRouters, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, error) + AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockRouters, options ...Option) (bool, map[string][]*computega.Router, error) + GetRouterStatusHook func(context.Context, *meta.Key, *MockRouters, ...Option) (*computega.RouterStatusResponse, error) + PatchHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) error + PreviewHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) (*computega.RoutersPreviewResponse, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -32470,10 +31144,10 @@ type MockRegions struct { } // Get returns the object from the mock. -func (m *MockRegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { +func (m *MockRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -32485,28 +31159,28 @@ func (m *MockRegions) Get(ctx context.Context, key *meta.Key, options ...Option) defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockRegions.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegions %v not found", key), + Message: fmt.Sprintf("MockRouters %v not found", key), } - klog.V(5).Infof("MockRegions.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockRegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { +// List all of the objects in the mock in the given region. +func (m *MockRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -32516,297 +31190,69 @@ func (m *MockRegions) List(ctx context.Context, fl *filter.F, options ...Option) if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegions.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.Region - for _, obj := range m.Objects { + var objs []*computega.Router + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockRegions.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } -// Obj wraps the object for use in the mock. -func (m *MockRegions) Obj(o *computega.Region) *MockRegionsObj { - return &MockRegionsObj{o} -} - -// GCERegions is a simplifying adapter for the GCE Regions. -type GCERegions struct { - s *Service -} - -// Get the Region named by key. -func (g *GCERegions) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Region, error) { +// Insert is a mock for inserting/creating a new object. +func (m *MockRouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { + if m.InsertHook != nil { + if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + return err + } + } opts := mergeOptions(options) - klog.V(5).Infof("GCERegions.Get(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCERegions.Get(%v, %v): key is invalid (%#v)", ctx, key, key) - return nil, fmt.Errorf("invalid GCE key (%#v)", key) + return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Get", - Version: meta.Version("ga"), - Service: "Regions", - Resource: key, - } - - klog.V(5).Infof("GCERegions.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegions.Get(%v, %v): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.GA.Regions.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) - call.Context(ctx) - v, err := call.Do() - klog.V(4).Infof("GCERegions.Get(%v, %v) = %+v, %v", ctx, key, v, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return v, err -} - -// List all Region objects. -func (g *GCERegions) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Region, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegions.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Regions") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "List", - Version: meta.Version("ga"), - Service: "Regions", - Resource: key, - } - - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - klog.V(5).Infof("GCERegions.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.Regions.List(projectID) - if fl != filter.None { - call.Filter(fl.String()) - } - - var all []*computega.Region - f := func(l *computega.RegionList) error { - klog.V(5).Infof("GCERegions.List(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCERegions.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCERegions.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// AlphaRouters is an interface that allows for mocking of Routers. -type AlphaRouters interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) - GetRouterStatus(context.Context, *meta.Key, ...Option) (*computealpha.RouterStatusResponse, error) - Patch(context.Context, *meta.Key, *computealpha.Router, ...Option) error - Preview(context.Context, *meta.Key, *computealpha.Router, ...Option) (*computealpha.RoutersPreviewResponse, error) - TestIamPermissions(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, ...Option) (*computealpha.TestPermissionsResponse, error) -} - -// NewMockAlphaRouters returns a new mock for Routers. -func NewMockAlphaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockAlphaRouters { - mock := &MockAlphaRouters{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockAlphaRouters is the mock for Routers. -type MockAlphaRouters struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutersObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - AggregatedListError *error - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, *computealpha.Router, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, []*computealpha.Router, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Router, m *MockAlphaRouters, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRouters, options ...Option) (bool, error) - AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockAlphaRouters, options ...Option) (bool, map[string][]*computealpha.Router, error) - GetRouterStatusHook func(context.Context, *meta.Key, *MockAlphaRouters, ...Option) (*computealpha.RouterStatusResponse, error) - PatchHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) error - PreviewHook func(context.Context, *meta.Key, *computealpha.Router, *MockAlphaRouters, ...Option) (*computealpha.RoutersPreviewResponse, error) - TestIamPermissionsHook func(context.Context, *meta.Key, *computealpha.TestPermissionsRequest, *MockAlphaRouters, ...Option) (*computealpha.TestPermissionsResponse, error) - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} - -// Get returns the object from the mock. -func (m *MockAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { - if m.GetHook != nil { - if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) - return obj, err - } - } - if !key.Valid() { - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err - } - if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) - return typedObj, nil - } - - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRouters %v not found", key), - } - klog.V(5).Infof("MockAlphaRouters.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err -} - -// List all of the objects in the mock in the given region. -func (m *MockAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { - if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) - - return nil, *m.ListError - } - - var objs []*computealpha.Router - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToAlpha()) { - continue - } - objs = append(objs, obj.ToAlpha()) - } - - klog.V(5).Infof("MockAlphaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) - return objs, nil -} - -// Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } - opts := mergeOptions(options) - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() + m.Lock.Lock() + defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRouters %v exists", key), + Message: fmt.Sprintf("MockRouters %v exists", key), } - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "routers") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "routers", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routers") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routers", key) m.Objects[*key] = &MockRoutersObj{obj} - klog.V(5).Infof("MockAlphaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -32818,28 +31264,28 @@ func (m *MockAlphaRouters) Delete(ctx context.Context, key *meta.Key, options .. defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRouters %v not found", key), + Message: fmt.Sprintf("MockRouters %v not found", key), } - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRouters.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRouters.Delete(%v, %v) = nil", ctx, key) return nil } // AggregatedList is a mock for AggregatedList. -func (m *MockAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { +func (m *MockRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { if m.AggregatedListHook != nil { if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -32849,34 +31295,34 @@ func (m *MockAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, opt if m.AggregatedListError != nil { err := *m.AggregatedListError - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) return nil, err } - objs := map[string][]*computealpha.Router{} + objs := map[string][]*computega.Router{} for _, obj := range m.Objects { - res, err := ParseResourceURL(obj.ToAlpha().SelfLink) + res, err := ParseResourceURL(obj.ToGA().SelfLink) if err != nil { - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) return nil, err } - if !fl.Match(obj.ToAlpha()) { + if !fl.Match(obj.ToGA()) { continue } location := aggregatedListKey(res.Key) - objs[location] = append(objs[location], obj.ToAlpha()) + objs[location] = append(objs[location], obj.ToGA()) } - klog.V(5).Infof("MockAlphaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRouters) Obj(o *computealpha.Router) *MockRoutersObj { +func (m *MockRouters) Obj(o *computega.Router) *MockRoutersObj { return &MockRoutersObj{o} } // GetRouterStatus is a mock for the corresponding method. -func (m *MockAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { +func (m *MockRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { if m.GetRouterStatusHook != nil { return m.GetRouterStatusHook(ctx, key, m) } @@ -32884,7 +31330,7 @@ func (m *MockAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, o } // Patch is a mock for the corresponding method. -func (m *MockAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { +func (m *MockRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } @@ -32892,56 +31338,46 @@ func (m *MockAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *compu } // Preview is a mock for the corresponding method. -func (m *MockAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { +func (m *MockRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { if m.PreviewHook != nil { return m.PreviewHook(ctx, key, arg0, m) } return nil, fmt.Errorf("PreviewHook must be set") } -// TestIamPermissions is a mock for the corresponding method. -func (m *MockAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { - if m.TestIamPermissionsHook != nil { - return m.TestIamPermissionsHook(ctx, key, arg0, m) - } - return nil, fmt.Errorf("TestIamPermissionsHook must be set") -} - -// GCEAlphaRouters is a simplifying adapter for the GCE Routers. -type GCEAlphaRouters struct { +// GCERouters is a simplifying adapter for the GCE Routers. +type GCERouters struct { s *Service } // Get the Router named by key. -func (g *GCEAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Router, error) { +func (g *GCERouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.Routers.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.Routers.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -32950,33 +31386,31 @@ func (g *GCEAlphaRouters) Get(ctx context.Context, key *meta.Key, options ...Opt } // List all Router objects. -func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Router, error) { +func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + klog.V(5).Infof("GCERouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.Routers.List(projectID, region) + klog.V(5).Infof("GCERouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.Routers.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.Router - f := func(l *computealpha.RouterList) error { - klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.Router + f := func(l *computega.RouterList) error { + klog.V(5).Infof("GCERouters.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -32984,7 +31418,7 @@ func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -32992,137 +31426,131 @@ func (g *GCEAlphaRouters) List(ctx context.Context, region string, fl *filter.F, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert Router with key of value obj. -func (g *GCEAlphaRouters) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Router, options ...Option) error { +func (g *GCERouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.Routers.Insert(projectID, key.Region, obj) + call := g.s.GA.Routers.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERouters.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the Router referenced by key. -func (g *GCEAlphaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCERouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.Routers.Delete(projectID, key.Region, key.Name) + call := g.s.GA.Routers.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) return err } // AggregatedList lists all resources of the given type across all locations. -func (g *GCEAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computealpha.Router, error) { +func (g *GCERouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) called", ctx, fl) + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) called", ctx, fl) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "AggregatedList", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: &meta.Key{}, } - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) return nil, err } - call := g.s.Alpha.Routers.AggregatedList(projectID) + call := g.s.GA.Routers.AggregatedList(projectID) call.Context(ctx) if fl != filter.None { call.Filter(fl.String()) } - call.ReturnPartialSuccess(opts.returnPartialSuccess) - all := map[string][]*computealpha.Router{} - f := func(l *computealpha.RouterAggregatedList) error { + all := map[string][]*computega.Router{} + f := func(l *computega.RouterAggregatedList) error { for k, v := range l.Items { - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) all[k] = append(all[k], v.Routers...) } return nil @@ -33131,92 +31559,88 @@ func (g *GCEAlphaRouters) AggregatedList(ctx context.Context, fl *filter.F, opti callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) return nil, err } callObserverEnd(ctx, ck, nil) g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// GetRouterStatus is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.RouterStatusResponse, error) { +// GetRouterStatus is a method on GCERouters. +func (g *GCERouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "GetRouterStatus", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.Routers.GetRouterStatus(projectID, key.Region, key.Name) + call := g.s.GA.Routers.GetRouterStatus(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) return v, err } -// Patch is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) error { +// Patch is a method on GCERouters. +func (g *GCERouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Patch", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.Routers.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.GA.Routers.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -33224,96 +31648,54 @@ func (g *GCEAlphaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *comput callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// Preview is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computealpha.Router, options ...Option) (*computealpha.RoutersPreviewResponse, error) { +// Preview is a method on GCERouters. +func (g *GCERouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") ck := &CallContextKey{ ProjectID: projectID, Operation: "Preview", - Version: meta.Version("alpha"), - Service: "Routers", - Resource: key, - } - klog.V(5).Infof("GCEAlphaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Alpha.Routers.Preview(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - v, err := call.Do() - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err -} - -// TestIamPermissions is a method on GCEAlphaRouters. -func (g *GCEAlphaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computealpha.TestPermissionsRequest, options ...Option) (*computealpha.TestPermissionsResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "TestIamPermissions", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "Routers", - Resource: key, } - klog.V(5).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) + call := g.s.GA.Routers.Preview(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) return v, err } -// BetaRouters is an interface that allows for mocking of Routers. -type BetaRouters interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error +// Routes is an interface that allows for mocking of Routes. +type Routes interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) - GetRouterStatus(context.Context, *meta.Key, ...Option) (*computebeta.RouterStatusResponse, error) - Patch(context.Context, *meta.Key, *computebeta.Router, ...Option) error - Preview(context.Context, *meta.Key, *computebeta.Router, ...Option) (*computebeta.RoutersPreviewResponse, error) - TestIamPermissions(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, ...Option) (*computebeta.TestPermissionsResponse, error) } -// NewMockBetaRouters returns a new mock for Routers. -func NewMockBetaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockBetaRouters { - mock := &MockBetaRouters{ +// NewMockRoutes returns a new mock for Routes. +func NewMockRoutes(pr ProjectRouter, objs map[meta.Key]*MockRoutesObj) *MockRoutes { + mock := &MockRoutes{ ProjectRouter: pr, Objects: objs, @@ -33324,36 +31706,30 @@ func NewMockBetaRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *Mo return mock } -// MockBetaRouters is the mock for Routers. -type MockBetaRouters struct { +// MockRoutes is the mock for Routes. +type MockRoutes struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutersObj + Objects map[meta.Key]*MockRoutesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - AggregatedListError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, *computebeta.Router, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, []*computebeta.Router, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Router, m *MockBetaRouters, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRouters, options ...Option) (bool, error) - AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockBetaRouters, options ...Option) (bool, map[string][]*computebeta.Router, error) - GetRouterStatusHook func(context.Context, *meta.Key, *MockBetaRouters, ...Option) (*computebeta.RouterStatusResponse, error) - PatchHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) error - PreviewHook func(context.Context, *meta.Key, *computebeta.Router, *MockBetaRouters, ...Option) (*computebeta.RoutersPreviewResponse, error) - TestIamPermissionsHook func(context.Context, *meta.Key, *computebeta.TestPermissionsRequest, *MockBetaRouters, ...Option) (*computebeta.TestPermissionsResponse, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, *computega.Route, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockRoutes, options ...Option) (bool, []*computega.Route, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Route, m *MockRoutes, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -33361,10 +31737,10 @@ type MockBetaRouters struct { } // Get returns the object from the mock. -func (m *MockBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { +func (m *MockRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -33376,28 +31752,28 @@ func (m *MockBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRouters %v not found", key), + Message: fmt.Sprintf("MockRoutes %v not found", key), } - klog.V(5).Infof("MockBetaRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { +// List all of the objects in the mock. +func (m *MockRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -33407,31 +31783,28 @@ func (m *MockBetaRouters) List(ctx context.Context, region string, fl *filter.F, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockRoutes.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.Router - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { + var objs []*computega.Route + for _, obj := range m.Objects { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockBetaRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { +func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -33444,32 +31817,32 @@ func (m *MockBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *comput defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRouters %v exists", key), + Message: fmt.Sprintf("MockRoutes %v exists", key), } - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "routers") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "routers", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routes") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routes", key) - m.Objects[*key] = &MockRoutersObj{obj} - klog.V(5).Infof("MockBetaRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRoutesObj{obj} + klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -33481,130 +31854,61 @@ func (m *MockBetaRouters) Delete(ctx context.Context, key *meta.Key, options ... defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRouters %v not found", key), + Message: fmt.Sprintf("MockRoutes %v not found", key), } - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRouters.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRoutes.Delete(%v, %v) = nil", ctx, key) return nil } -// AggregatedList is a mock for AggregatedList. -func (m *MockBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { - if m.AggregatedListHook != nil { - if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.AggregatedListError != nil { - err := *m.AggregatedListError - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - - objs := map[string][]*computebeta.Router{} - for _, obj := range m.Objects { - res, err := ParseResourceURL(obj.ToBeta().SelfLink) - if err != nil { - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - if !fl.Match(obj.ToBeta()) { - continue - } - location := aggregatedListKey(res.Key) - objs[location] = append(objs[location], obj.ToBeta()) - } - klog.V(5).Infof("MockBetaRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - // Obj wraps the object for use in the mock. -func (m *MockBetaRouters) Obj(o *computebeta.Router) *MockRoutersObj { - return &MockRoutersObj{o} -} - -// GetRouterStatus is a mock for the corresponding method. -func (m *MockBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { - if m.GetRouterStatusHook != nil { - return m.GetRouterStatusHook(ctx, key, m) - } - return nil, fmt.Errorf("GetRouterStatusHook must be set") -} - -// Patch is a mock for the corresponding method. -func (m *MockBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// Preview is a mock for the corresponding method. -func (m *MockBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { - if m.PreviewHook != nil { - return m.PreviewHook(ctx, key, arg0, m) - } - return nil, fmt.Errorf("PreviewHook must be set") -} - -// TestIamPermissions is a mock for the corresponding method. -func (m *MockBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { - if m.TestIamPermissionsHook != nil { - return m.TestIamPermissionsHook(ctx, key, arg0, m) - } - return nil, fmt.Errorf("TestIamPermissionsHook must be set") +func (m *MockRoutes) Obj(o *computega.Route) *MockRoutesObj { + return &MockRoutesObj{o} } -// GCEBetaRouters is a simplifying adapter for the GCE Routers. -type GCEBetaRouters struct { +// GCERoutes is a simplifying adapter for the GCE Routes. +type GCERoutes struct { s *Service } -// Get the Router named by key. -func (g *GCEBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Router, error) { +// Get the Route named by key. +func (g *GCERoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERoutes.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERoutes.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, + Version: meta.Version("ga"), + Service: "Routes", } - klog.V(5).Infof("GCEBetaRouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.Routers.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.Routes.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -33612,34 +31916,32 @@ func (g *GCEBetaRouters) Get(ctx context.Context, key *meta.Key, options ...Opti return v, err } -// List all Router objects. -func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Router, error) { +// List all Route objects. +func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + klog.V(5).Infof("GCERoutes.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, + Version: meta.Version("ga"), + Service: "Routes", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.Routers.List(projectID, region) + klog.V(5).Infof("GCERoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.Routes.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.Router - f := func(l *computebeta.RouterList) error { - klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.Route + f := func(l *computega.RouteList) error { + klog.V(5).Infof("GCERoutes.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -33647,7 +31949,7 @@ func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -33655,327 +31957,117 @@ func (g *GCEBetaRouters) List(ctx context.Context, region string, fl *filter.F, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Router with key of value obj. -func (g *GCEBetaRouters) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Router, options ...Option) error { +// Insert Route with key of value obj. +func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERoutes.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERoutes.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, + Version: meta.Version("ga"), + Service: "Routes", } - klog.V(5).Infof("GCEBetaRouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERoutes.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.Routers.Insert(projectID, key.Region, obj) + call := g.s.GA.Routes.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERoutes.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Router referenced by key. -func (g *GCEBetaRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Route referenced by key. +func (g *GCERoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERoutes.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERoutes.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, + Version: meta.Version("ga"), + Service: "Routes", } - klog.V(5).Infof("GCEBetaRouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.Routers.Delete(projectID, key.Region, key.Name) + call := g.s.GA.Routes.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRouters.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// AggregatedList lists all resources of the given type across all locations. -func (g *GCEBetaRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computebeta.Router, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) called", ctx, fl) - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "AggregatedList", - Version: meta.Version("beta"), - Service: "Routers", - Resource: &meta.Key{}, - } - - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) - return nil, err - } - - call := g.s.Beta.Routers.AggregatedList(projectID) - call.Context(ctx) - if fl != filter.None { - call.Filter(fl.String()) - } - call.ReturnPartialSuccess(opts.returnPartialSuccess) - - all := map[string][]*computebeta.Router{} - f := func(l *computebeta.RouterAggregatedList) error { - for k, v := range l.Items { - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) - all[k] = append(all[k], v.Routers...) - } - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEBetaRouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) - } - return all, nil -} - -// GetRouterStatus is a method on GCEBetaRouters. -func (g *GCEBetaRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.RouterStatusResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "GetRouterStatus", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, - } - klog.V(5).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Beta.Routers.GetRouterStatus(projectID, key.Region, key.Name) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - v, err := call.Do() callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err -} - -// Patch is a method on GCEBetaRouters. -func (g *GCEBetaRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, - } - klog.V(5).Infof("GCEBetaRouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.Routers.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - + klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaRouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) return err } -// Preview is a method on GCEBetaRouters. -func (g *GCEBetaRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computebeta.Router, options ...Option) (*computebeta.RoutersPreviewResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Preview", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, - } - klog.V(5).Infof("GCEBetaRouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Beta.Routers.Preview(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - v, err := call.Do() - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaRouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err -} - -// TestIamPermissions is a method on GCEBetaRouters. -func (g *GCEBetaRouters) TestIamPermissions(ctx context.Context, key *meta.Key, arg0 *computebeta.TestPermissionsRequest, options ...Option) (*computebeta.TestPermissionsResponse, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Routers") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "TestIamPermissions", - Version: meta.Version("beta"), - Service: "Routers", - Resource: key, - } - klog.V(5).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Beta.Routers.TestIamPermissions(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - v, err := call.Do() - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaRouters.TestIamPermissions(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err -} - -// Routers is an interface that allows for mocking of Routers. -type Routers interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error +// BetaSecurityPolicies is an interface that allows for mocking of SecurityPolicies. +type BetaSecurityPolicies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) - GetRouterStatus(context.Context, *meta.Key, ...Option) (*computega.RouterStatusResponse, error) - Patch(context.Context, *meta.Key, *computega.Router, ...Option) error - Preview(context.Context, *meta.Key, *computega.Router, ...Option) (*computega.RoutersPreviewResponse, error) + AddRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error + GetRule(context.Context, *meta.Key, ...Option) (*computebeta.SecurityPolicyRule, error) + Patch(context.Context, *meta.Key, *computebeta.SecurityPolicy, ...Option) error + PatchRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error + RemoveRule(context.Context, *meta.Key, ...Option) error } -// NewMockRouters returns a new mock for Routers. -func NewMockRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockRouters { - mock := &MockRouters{ +// NewMockBetaSecurityPolicies returns a new mock for SecurityPolicies. +func NewMockBetaSecurityPolicies(pr ProjectRouter, objs map[meta.Key]*MockSecurityPoliciesObj) *MockBetaSecurityPolicies { + mock := &MockBetaSecurityPolicies{ ProjectRouter: pr, Objects: objs, @@ -33986,35 +32078,35 @@ func NewMockRouters(pr ProjectRouter, objs map[meta.Key]*MockRoutersObj) *MockRo return mock } -// MockRouters is the mock for Routers. -type MockRouters struct { +// MockBetaSecurityPolicies is the mock for SecurityPolicies. +type MockBetaSecurityPolicies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutersObj + Objects map[meta.Key]*MockSecurityPoliciesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - AggregatedListError *error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, *computega.Router, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRouters, options ...Option) (bool, []*computega.Router, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Router, m *MockRouters, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRouters, options ...Option) (bool, error) - AggregatedListHook func(ctx context.Context, fl *filter.F, m *MockRouters, options ...Option) (bool, map[string][]*computega.Router, error) - GetRouterStatusHook func(context.Context, *meta.Key, *MockRouters, ...Option) (*computega.RouterStatusResponse, error) - PatchHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) error - PreviewHook func(context.Context, *meta.Key, *computega.Router, *MockRouters, ...Option) (*computega.RoutersPreviewResponse, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, *computebeta.SecurityPolicy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSecurityPolicies, options ...Option) (bool, []*computebeta.SecurityPolicy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, m *MockBetaSecurityPolicies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, error) + AddRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error + GetRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) (*computebeta.SecurityPolicyRule, error) + PatchHook func(context.Context, *meta.Key, *computebeta.SecurityPolicy, *MockBetaSecurityPolicies, ...Option) error + PatchRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error + RemoveRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -34022,10 +32114,10 @@ type MockRouters struct { } // Get returns the object from the mock. -func (m *MockRouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { +func (m *MockBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -34037,28 +32129,28 @@ func (m *MockRouters) Get(ctx context.Context, key *meta.Key, options ...Option) defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRouters.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRouters %v not found", key), + Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), } - klog.V(5).Infof("MockRouters.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { +// List all of the objects in the mock. +func (m *MockBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -34068,31 +32160,28 @@ func (m *MockRouters) List(ctx context.Context, region string, fl *filter.F, opt if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRouters.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.Router - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToGA()) { + var objs []*computebeta.SecurityPolicy + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockRouters.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { +func (m *MockBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -34105,32 +32194,32 @@ func (m *MockRouters) Insert(ctx context.Context, key *meta.Key, obj *computega. defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRouters %v exists", key), + Message: fmt.Sprintf("MockBetaSecurityPolicies %v exists", key), } - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routers") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routers", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "securityPolicies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "securityPolicies", key) - m.Objects[*key] = &MockRoutersObj{obj} - klog.V(5).Infof("MockRouters.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSecurityPoliciesObj{obj} + klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -34142,122 +32231,101 @@ func (m *MockRouters) Delete(ctx context.Context, key *meta.Key, options ...Opti defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRouters %v not found", key), + Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), } - klog.V(5).Infof("MockRouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRouters.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = nil", ctx, key) return nil } -// AggregatedList is a mock for AggregatedList. -func (m *MockRouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { - if m.AggregatedListHook != nil { - if intercept, objs, err := m.AggregatedListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.AggregatedListError != nil { - err := *m.AggregatedListError - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - - objs := map[string][]*computega.Router{} - for _, obj := range m.Objects { - res, err := ParseResourceURL(obj.ToGA().SelfLink) - if err != nil { - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = nil, %v", ctx, fl, err) - return nil, err - } - if !fl.Match(obj.ToGA()) { - continue - } - location := aggregatedListKey(res.Key) - objs[location] = append(objs[location], obj.ToGA()) - } - klog.V(5).Infof("MockRouters.AggregatedList(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil +// Obj wraps the object for use in the mock. +func (m *MockBetaSecurityPolicies) Obj(o *computebeta.SecurityPolicy) *MockSecurityPoliciesObj { + return &MockSecurityPoliciesObj{o} } -// Obj wraps the object for use in the mock. -func (m *MockRouters) Obj(o *computega.Router) *MockRoutersObj { - return &MockRoutersObj{o} +// AddRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { + if m.AddRuleHook != nil { + return m.AddRuleHook(ctx, key, arg0, m) + } + return nil } -// GetRouterStatus is a mock for the corresponding method. -func (m *MockRouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { - if m.GetRouterStatusHook != nil { - return m.GetRouterStatusHook(ctx, key, m) +// GetRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { + if m.GetRuleHook != nil { + return m.GetRuleHook(ctx, key, m) } - return nil, fmt.Errorf("GetRouterStatusHook must be set") + return nil, fmt.Errorf("GetRuleHook must be set") } // Patch is a mock for the corresponding method. -func (m *MockRouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { +func (m *MockBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } return nil } -// Preview is a mock for the corresponding method. -func (m *MockRouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { - if m.PreviewHook != nil { - return m.PreviewHook(ctx, key, arg0, m) +// PatchRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { + if m.PatchRuleHook != nil { + return m.PatchRuleHook(ctx, key, arg0, m) } - return nil, fmt.Errorf("PreviewHook must be set") + return nil } -// GCERouters is a simplifying adapter for the GCE Routers. -type GCERouters struct { +// RemoveRule is a mock for the corresponding method. +func (m *MockBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { + if m.RemoveRuleHook != nil { + return m.RemoveRuleHook(ctx, key, m) + } + return nil +} + +// GCEBetaSecurityPolicies is a simplifying adapter for the GCE SecurityPolicies. +type GCEBetaSecurityPolicies struct { s *Service } -// Get the Router named by key. -func (g *GCERouters) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Router, error) { +// Get the SecurityPolicy named by key. +func (g *GCEBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "Routers", - Resource: key, + Version: meta.Version("beta"), + Service: "SecurityPolicies", } - klog.V(5).Infof("GCERouters.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Routers.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.SecurityPolicies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERouters.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -34265,34 +32333,32 @@ func (g *GCERouters) Get(ctx context.Context, key *meta.Key, options ...Option) return v, err } -// List all Router objects. -func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Router, error) { +// List all SecurityPolicy objects. +func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "Routers", - Resource: key, + Version: meta.Version("beta"), + Service: "SecurityPolicies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERouters.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.Routers.List(projectID, region) + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.SecurityPolicies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.Router - f := func(l *computega.RouterList) error { - klog.V(5).Infof("GCERouters.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.SecurityPolicy + f := func(l *computebeta.SecurityPolicyList) error { + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -34300,7 +32366,7 @@ func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, opti callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -34308,231 +32374,207 @@ func (g *GCERouters) List(ctx context.Context, region string, fl *filter.F, opti g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERouters.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERouters.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Router with key of value obj. -func (g *GCERouters) Insert(ctx context.Context, key *meta.Key, obj *computega.Router, options ...Option) error { +// Insert SecurityPolicy with key of value obj. +func (g *GCEBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "Routers", - Resource: key, + Version: meta.Version("beta"), + Service: "SecurityPolicies", } - klog.V(5).Infof("GCERouters.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.Routers.Insert(projectID, key.Region, obj) + call := g.s.Beta.SecurityPolicies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERouters.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERouters.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Router referenced by key. -func (g *GCERouters) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the SecurityPolicy referenced by key. +func (g *GCEBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "Routers", - Resource: key, + Version: meta.Version("beta"), + Service: "SecurityPolicies", } - klog.V(5).Infof("GCERouters.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Routers.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.SecurityPolicies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERouters.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } -// AggregatedList lists all resources of the given type across all locations. -func (g *GCERouters) AggregatedList(ctx context.Context, fl *filter.F, options ...Option) (map[string][]*computega.Router, error) { +// AddRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) called", ctx, fl) + klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): called", ctx, key, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + if !key.Valid() { + klog.V(2).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AggregatedList", - Version: meta.Version("ga"), - Service: "Routers", - Resource: &meta.Key{}, + Operation: "AddRule", + Version: meta.Version("beta"), + Service: "SecurityPolicies", } - - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): RateLimiter error: %v", ctx, fl, err) - return nil, err + klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err } - - call := g.s.GA.Routers.AggregatedList(projectID) + call := g.s.Beta.SecurityPolicies.AddRule(projectID, key.Name, arg0) call.Context(ctx) - if fl != filter.None { - call.Filter(fl.String()) - } - call.ReturnPartialSuccess(opts.returnPartialSuccess) + op, err := call.Do() - all := map[string][]*computega.Router{} - f := func(l *computega.RouterAggregatedList) error { - for k, v := range l.Items { - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v): page[%v]%+v", ctx, fl, k, v) - all[k] = append(all[k], v.Routers...) - } - return nil - } - if err := call.Pages(ctx, f); err != nil { + if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, nil, err) - return nil, err + klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) + return err } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - if kLogEnabled(4) { - klog.V(4).Infof("GCERouters.AggregatedList(%v, %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCERouters.AggregatedList(%v, %v) = %v, %v", ctx, fl, asStr, nil) - } - return all, nil + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) + return err } -// GetRouterStatus is a method on GCERouters. -func (g *GCERouters) GetRouterStatus(ctx context.Context, key *meta.Key, options ...Option) (*computega.RouterStatusResponse, error) { +// GetRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.GetRouterStatus(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return nil, fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "GetRouterStatus", - Version: meta.Version("ga"), - Service: "Routers", - Resource: key, + Operation: "GetRule", + Version: meta.Version("beta"), + Service: "SecurityPolicies", } - klog.V(5).Infof("GCERouters.GetRouterStatus(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Routers.GetRouterStatus(projectID, key.Region, key.Name) + call := g.s.Beta.SecurityPolicies.GetRule(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) v, err := call.Do() callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERouters.GetRouterStatus(%v, %v, ...) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...) = %+v, %v", ctx, key, v, err) return v, err } -// Patch is a method on GCERouters. -func (g *GCERouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) error { +// Patch is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Patch", - Version: meta.Version("ga"), - Service: "Routers", - Resource: key, + Version: meta.Version("beta"), + Service: "SecurityPolicies", } - klog.V(5).Infof("GCERouters.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Routers.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.SecurityPolicies.Patch(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -34540,56 +32582,106 @@ func (g *GCERouters) Patch(ctx context.Context, key *meta.Key, arg0 *computega.R callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERouters.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// Preview is a method on GCERouters. -func (g *GCERouters) Preview(ctx context.Context, key *meta.Key, arg0 *computega.Router, options ...Option) (*computega.RoutersPreviewResponse, error) { +// PatchRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERouters.Preview(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERouters.Preview(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) + klog.V(2).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routers") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Preview", - Version: meta.Version("ga"), - Service: "Routers", - Resource: key, + Operation: "PatchRule", + Version: meta.Version("beta"), + Service: "SecurityPolicies", } - klog.V(5).Infof("GCERouters.Preview(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERouters.Preview(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err + klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err } - call := g.s.GA.Routers.Preview(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.SecurityPolicies.PatchRule(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - v, err := call.Do() + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) + return err + } + err = g.s.WaitForCompletion(ctx, op) callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERouters.Preview(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err + klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) + return err } -// Routes is an interface that allows for mocking of Routes. -type Routes interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error +// RemoveRule is a method on GCEBetaSecurityPolicies. +func (g *GCEBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "RemoveRule", + Version: meta.Version("beta"), + Service: "SecurityPolicies", + } + klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.SecurityPolicies.RemoveRule(projectID, key.Name) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// ServiceAttachments is an interface that allows for mocking of ServiceAttachments. +type ServiceAttachments interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computega.ServiceAttachment, ...Option) error } -// NewMockRoutes returns a new mock for Routes. -func NewMockRoutes(pr ProjectRouter, objs map[meta.Key]*MockRoutesObj) *MockRoutes { - mock := &MockRoutes{ +// NewMockServiceAttachments returns a new mock for ServiceAttachments. +func NewMockServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockServiceAttachments { + mock := &MockServiceAttachments{ ProjectRouter: pr, Objects: objs, @@ -34600,14 +32692,14 @@ func NewMockRoutes(pr ProjectRouter, objs map[meta.Key]*MockRoutesObj) *MockRout return mock } -// MockRoutes is the mock for Routes. -type MockRoutes struct { +// MockServiceAttachments is the mock for ServiceAttachments. +type MockServiceAttachments struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRoutesObj + Objects map[meta.Key]*MockServiceAttachmentsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -34620,10 +32712,11 @@ type MockRoutes struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, *computega.Route, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockRoutes, options ...Option) (bool, []*computega.Route, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Route, m *MockRoutes, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRoutes, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, *computega.ServiceAttachment, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockServiceAttachments, options ...Option) (bool, []*computega.ServiceAttachment, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, m *MockServiceAttachments, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computega.ServiceAttachment, *MockServiceAttachments, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -34631,10 +32724,10 @@ type MockRoutes struct { } // Get returns the object from the mock. -func (m *MockRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { +func (m *MockServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -34646,28 +32739,28 @@ func (m *MockRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockRoutes.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRoutes %v not found", key), + Message: fmt.Sprintf("MockServiceAttachments %v not found", key), } - klog.V(5).Infof("MockRoutes.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { +// List all of the objects in the mock in the given region. +func (m *MockServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -34677,28 +32770,31 @@ func (m *MockRoutes) List(ctx context.Context, fl *filter.F, options ...Option) if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRoutes.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.Route - for _, obj := range m.Objects { + var objs []*computega.ServiceAttachment + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockRoutes.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { +func (m *MockServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -34711,32 +32807,32 @@ func (m *MockRoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.R defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRoutes %v exists", key), + Message: fmt.Sprintf("MockServiceAttachments %v exists", key), } - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "routes") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "routes", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "serviceAttachments") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "serviceAttachments", key) - m.Objects[*key] = &MockRoutesObj{obj} - klog.V(5).Infof("MockRoutes.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockServiceAttachmentsObj{obj} + klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -34748,63 +32844,69 @@ func (m *MockRoutes) Delete(ctx context.Context, key *meta.Key, options ...Optio defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRoutes %v not found", key), + Message: fmt.Sprintf("MockServiceAttachments %v not found", key), } - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRoutes.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRoutes) Obj(o *computega.Route) *MockRoutesObj { - return &MockRoutesObj{o} +func (m *MockServiceAttachments) Obj(o *computega.ServiceAttachment) *MockServiceAttachmentsObj { + return &MockServiceAttachmentsObj{o} } -// GCERoutes is a simplifying adapter for the GCE Routes. -type GCERoutes struct { +// Patch is a mock for the corresponding method. +func (m *MockServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) + } + return nil +} + +// GCEServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. +type GCEServiceAttachments struct { s *Service } -// Get the Route named by key. -func (g *GCERoutes) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Route, error) { +// Get the ServiceAttachment named by key. +func (g *GCEServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERoutes.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "Routes", - Resource: key, + Service: "ServiceAttachments", } - klog.V(5).Infof("GCERoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERoutes.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.Routes.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.ServiceAttachments.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -34812,34 +32914,32 @@ func (g *GCERoutes) Get(ctx context.Context, key *meta.Key, options ...Option) ( return v, err } -// List all Route objects. -func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Route, error) { +// List all ServiceAttachment objects. +func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "Routes", - Resource: key, + Service: "ServiceAttachments", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.Routes.List(projectID) + klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.ServiceAttachments.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.Route - f := func(l *computega.RouteList) error { - klog.V(5).Infof("GCERoutes.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.ServiceAttachment + f := func(l *computega.ServiceAttachmentList) error { + klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -34847,7 +32947,7 @@ func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ( callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -34855,121 +32955,155 @@ func (g *GCERoutes) List(ctx context.Context, fl *filter.F, options ...Option) ( g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERoutes.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERoutes.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert Route with key of value obj. -func (g *GCERoutes) Insert(ctx context.Context, key *meta.Key, obj *computega.Route, options ...Option) error { +// Insert ServiceAttachment with key of value obj. +func (g *GCEServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERoutes.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "Routes", - Resource: key, + Service: "ServiceAttachments", } - klog.V(5).Infof("GCERoutes.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.Routes.Insert(projectID, obj) + call := g.s.GA.ServiceAttachments.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERoutes.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the Route referenced by key. -func (g *GCERoutes) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the ServiceAttachment referenced by key. +func (g *GCEServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERoutes.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERoutes.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Routes") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "Routes", - Resource: key, + Service: "ServiceAttachments", } - klog.V(5).Infof("GCERoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERoutes.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Routes.Delete(projectID, key.Name) + call := g.s.GA.ServiceAttachments.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERoutes.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaSecurityPolicies is an interface that allows for mocking of SecurityPolicies. -type BetaSecurityPolicies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error +// Patch is a method on GCEServiceAttachments. +func (g *GCEServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Patch", + Version: meta.Version("ga"), + Service: "ServiceAttachments", + } + klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// BetaServiceAttachments is an interface that allows for mocking of ServiceAttachments. +type BetaServiceAttachments interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AddRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error - GetRule(context.Context, *meta.Key, ...Option) (*computebeta.SecurityPolicyRule, error) - Patch(context.Context, *meta.Key, *computebeta.SecurityPolicy, ...Option) error - PatchRule(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, ...Option) error - RemoveRule(context.Context, *meta.Key, ...Option) error + Patch(context.Context, *meta.Key, *computebeta.ServiceAttachment, ...Option) error } -// NewMockBetaSecurityPolicies returns a new mock for SecurityPolicies. -func NewMockBetaSecurityPolicies(pr ProjectRouter, objs map[meta.Key]*MockSecurityPoliciesObj) *MockBetaSecurityPolicies { - mock := &MockBetaSecurityPolicies{ +// NewMockBetaServiceAttachments returns a new mock for ServiceAttachments. +func NewMockBetaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockBetaServiceAttachments { + mock := &MockBetaServiceAttachments{ ProjectRouter: pr, Objects: objs, @@ -34980,14 +33114,14 @@ func NewMockBetaSecurityPolicies(pr ProjectRouter, objs map[meta.Key]*MockSecuri return mock } -// MockBetaSecurityPolicies is the mock for SecurityPolicies. -type MockBetaSecurityPolicies struct { +// MockBetaServiceAttachments is the mock for ServiceAttachments. +type MockBetaServiceAttachments struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSecurityPoliciesObj + Objects map[meta.Key]*MockServiceAttachmentsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -35000,15 +33134,11 @@ type MockBetaSecurityPolicies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, *computebeta.SecurityPolicy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSecurityPolicies, options ...Option) (bool, []*computebeta.SecurityPolicy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, m *MockBetaSecurityPolicies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSecurityPolicies, options ...Option) (bool, error) - AddRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error - GetRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) (*computebeta.SecurityPolicyRule, error) - PatchHook func(context.Context, *meta.Key, *computebeta.SecurityPolicy, *MockBetaSecurityPolicies, ...Option) error - PatchRuleHook func(context.Context, *meta.Key, *computebeta.SecurityPolicyRule, *MockBetaSecurityPolicies, ...Option) error - RemoveRuleHook func(context.Context, *meta.Key, *MockBetaSecurityPolicies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, *computebeta.ServiceAttachment, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaServiceAttachments, options ...Option) (bool, []*computebeta.ServiceAttachment, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, m *MockBetaServiceAttachments, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computebeta.ServiceAttachment, *MockBetaServiceAttachments, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -35016,10 +33146,10 @@ type MockBetaSecurityPolicies struct { } // Get returns the object from the mock. -func (m *MockBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { +func (m *MockBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -35031,28 +33161,28 @@ func (m *MockBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), + Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockBetaSecurityPolicies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -35062,28 +33192,31 @@ func (m *MockBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, optio if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.SecurityPolicy - for _, obj := range m.Objects { + var objs []*computebeta.ServiceAttachment + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaSecurityPolicies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { +func (m *MockBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -35096,32 +33229,32 @@ func (m *MockBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, ob defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaSecurityPolicies %v exists", key), + Message: fmt.Sprintf("MockBetaServiceAttachments %v exists", key), } - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "securityPolicies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "securityPolicies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "serviceAttachments") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "serviceAttachments", key) - m.Objects[*key] = &MockSecurityPoliciesObj{obj} - klog.V(5).Infof("MockBetaSecurityPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockServiceAttachmentsObj{obj} + klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -35133,103 +33266,69 @@ func (m *MockBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSecurityPolicies %v not found", key), + Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaSecurityPolicies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaSecurityPolicies) Obj(o *computebeta.SecurityPolicy) *MockSecurityPoliciesObj { - return &MockSecurityPoliciesObj{o} -} - -// AddRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { - if m.AddRuleHook != nil { - return m.AddRuleHook(ctx, key, arg0, m) - } - return nil -} - -// GetRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { - if m.GetRuleHook != nil { - return m.GetRuleHook(ctx, key, m) - } - return nil, fmt.Errorf("GetRuleHook must be set") +func (m *MockBetaServiceAttachments) Obj(o *computebeta.ServiceAttachment) *MockServiceAttachmentsObj { + return &MockServiceAttachmentsObj{o} } // Patch is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { +func (m *MockBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } return nil } -// PatchRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { - if m.PatchRuleHook != nil { - return m.PatchRuleHook(ctx, key, arg0, m) - } - return nil -} - -// RemoveRule is a mock for the corresponding method. -func (m *MockBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { - if m.RemoveRuleHook != nil { - return m.RemoveRuleHook(ctx, key, m) - } - return nil -} - -// GCEBetaSecurityPolicies is a simplifying adapter for the GCE SecurityPolicies. -type GCEBetaSecurityPolicies struct { +// GCEBetaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. +type GCEBetaServiceAttachments struct { s *Service } -// Get the SecurityPolicy named by key. -func (g *GCEBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicy, error) { +// Get the ServiceAttachment named by key. +func (g *GCEBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, + Service: "ServiceAttachments", } - klog.V(5).Infof("GCEBetaSecurityPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.SecurityPolicies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.ServiceAttachments.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -35237,34 +33336,32 @@ func (g *GCEBetaSecurityPolicies) Get(ctx context.Context, key *meta.Key, option return v, err } -// List all SecurityPolicy objects. -func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SecurityPolicy, error) { +// List all ServiceAttachment objects. +func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, + Service: "ServiceAttachments", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.SecurityPolicies.List(projectID) + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.ServiceAttachments.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.SecurityPolicy - f := func(l *computebeta.SecurityPolicyList) error { - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.ServiceAttachment + f := func(l *computebeta.ServiceAttachmentList) error { + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -35272,7 +33369,7 @@ func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, option callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -35280,138 +33377,132 @@ func (g *GCEBetaSecurityPolicies) List(ctx context.Context, fl *filter.F, option g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaSecurityPolicies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert SecurityPolicy with key of value obj. -func (g *GCEBetaSecurityPolicies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SecurityPolicy, options ...Option) error { +// Insert ServiceAttachment with key of value obj. +func (g *GCEBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, + Service: "ServiceAttachments", } - klog.V(5).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.SecurityPolicies.Insert(projectID, obj) + call := g.s.Beta.ServiceAttachments.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSecurityPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the SecurityPolicy referenced by key. -func (g *GCEBetaSecurityPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the ServiceAttachment referenced by key. +func (g *GCEBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, + Service: "ServiceAttachments", } - klog.V(5).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.SecurityPolicies.Delete(projectID, key.Name) + call := g.s.Beta.ServiceAttachments.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSecurityPolicies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } -// AddRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { +// Patch is a method on GCEBetaServiceAttachments. +func (g *GCEBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AddRule", + Operation: "Patch", Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, + Service: "ServiceAttachments", } - klog.V(5).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.SecurityPolicies.AddRule(projectID, key.Name, arg0) + call := g.s.Beta.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -35419,235 +33510,68 @@ func (g *GCEBetaSecurityPolicies) AddRule(ctx context.Context, key *meta.Key, ar callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaSecurityPolicies.AddRule(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// GetRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) GetRule(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SecurityPolicyRule, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "GetRule", - Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, - } - klog.V(5).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Beta.SecurityPolicies.GetRule(projectID, key.Name) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - v, err := call.Do() +// AlphaServiceAttachments is an interface that allows for mocking of ServiceAttachments. +type AlphaServiceAttachments interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error + Delete(ctx context.Context, key *meta.Key, options ...Option) error + Patch(context.Context, *meta.Key, *computealpha.ServiceAttachment, ...Option) error +} - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) +// NewMockAlphaServiceAttachments returns a new mock for ServiceAttachments. +func NewMockAlphaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockAlphaServiceAttachments { + mock := &MockAlphaServiceAttachments{ + ProjectRouter: pr, - klog.V(4).Infof("GCEBetaSecurityPolicies.GetRule(%v, %v, ...) = %+v, %v", ctx, key, v, err) - return v, err + Objects: objs, + GetError: map[meta.Key]error{}, + InsertError: map[meta.Key]error{}, + DeleteError: map[meta.Key]error{}, + } + return mock } -// Patch is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): called", ctx, key, opts) +// MockAlphaServiceAttachments is the mock for ServiceAttachments. +type MockAlphaServiceAttachments struct { + Lock sync.Mutex - if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, - } - klog.V(5).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.SecurityPolicies.Patch(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) + ProjectRouter ProjectRouter - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + // Objects maintained by the mock. + Objects map[meta.Key]*MockServiceAttachmentsObj - return err - } + // If an entry exists for the given key and operation, then the error + // will be returned instead of the operation. + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX + // xxxHook allow you to intercept the standard processing of the mock in + // order to add your own logic. Return (true, _, _) to prevent the normal + // execution flow of the mock. Return (false, nil, nil) to continue with + // normal mock behavior/ after the hook function executes. + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, *computealpha.ServiceAttachment, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaServiceAttachments, options ...Option) (bool, []*computealpha.ServiceAttachment, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, m *MockAlphaServiceAttachments, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computealpha.ServiceAttachment, *MockAlphaServiceAttachments, ...Option) error - klog.V(4).Infof("GCEBetaSecurityPolicies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// PatchRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) PatchRule(ctx context.Context, key *meta.Key, arg0 *computebeta.SecurityPolicyRule, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "PatchRule", - Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, - } - klog.V(5).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.SecurityPolicies.PatchRule(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaSecurityPolicies.PatchRule(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// RemoveRule is a method on GCEBetaSecurityPolicies. -func (g *GCEBetaSecurityPolicies) RemoveRule(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SecurityPolicies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "RemoveRule", - Version: meta.Version("beta"), - Service: "SecurityPolicies", - Resource: key, - } - klog.V(5).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.SecurityPolicies.RemoveRule(projectID, key.Name) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaSecurityPolicies.RemoveRule(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// ServiceAttachments is an interface that allows for mocking of ServiceAttachments. -type ServiceAttachments interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computega.ServiceAttachment, ...Option) error -} - -// NewMockServiceAttachments returns a new mock for ServiceAttachments. -func NewMockServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockServiceAttachments { - mock := &MockServiceAttachments{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockServiceAttachments is the mock for ServiceAttachments. -type MockServiceAttachments struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockServiceAttachmentsObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, *computega.ServiceAttachment, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockServiceAttachments, options ...Option) (bool, []*computega.ServiceAttachment, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, m *MockServiceAttachments, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockServiceAttachments, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computega.ServiceAttachment, *MockServiceAttachments, ...Option) error - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} + // X is extra state that can be used as part of the mock. Generated code + // will not use this field. + X interface{} } // Get returns the object from the mock. -func (m *MockServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { +func (m *MockAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -35659,28 +33583,28 @@ func (m *MockServiceAttachments) Get(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { +func (m *MockAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -35690,31 +33614,31 @@ func (m *MockServiceAttachments) List(ctx context.Context, region string, fl *fi if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.ServiceAttachment + var objs []*computealpha.ServiceAttachment for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToGA()) { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { +func (m *MockAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -35727,32 +33651,32 @@ func (m *MockServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockServiceAttachments %v exists", key), + Message: fmt.Sprintf("MockAlphaServiceAttachments %v exists", key), } - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "serviceAttachments") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "serviceAttachments", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "serviceAttachments") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "serviceAttachments", key) m.Objects[*key] = &MockServiceAttachmentsObj{obj} - klog.V(5).Infof("MockServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -35764,71 +33688,69 @@ func (m *MockServiceAttachments) Delete(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), } - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockServiceAttachments.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockServiceAttachments) Obj(o *computega.ServiceAttachment) *MockServiceAttachmentsObj { +func (m *MockAlphaServiceAttachments) Obj(o *computealpha.ServiceAttachment) *MockServiceAttachmentsObj { return &MockServiceAttachmentsObj{o} } // Patch is a mock for the corresponding method. -func (m *MockServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { +func (m *MockAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { if m.PatchHook != nil { return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCEServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. -type GCEServiceAttachments struct { +// GCEAlphaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. +type GCEAlphaServiceAttachments struct { s *Service } // Get the ServiceAttachment named by key. -func (g *GCEServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.ServiceAttachment, error) { +func (g *GCEAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "ServiceAttachments", - Resource: key, } - klog.V(5).Infof("GCEServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.ServiceAttachments.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.ServiceAttachments.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -35837,33 +33759,31 @@ func (g *GCEServiceAttachments) Get(ctx context.Context, key *meta.Key, options } // List all ServiceAttachment objects. -func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.ServiceAttachment, error) { +func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "ServiceAttachments", - Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.ServiceAttachments.List(projectID, region) + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.ServiceAttachments.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.ServiceAttachment - f := func(l *computega.ServiceAttachmentList) error { - klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.ServiceAttachment + f := func(l *computealpha.ServiceAttachmentList) error { + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -35871,7 +33791,7 @@ func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *fil callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -35879,138 +33799,132 @@ func (g *GCEServiceAttachments) List(ctx context.Context, region string, fl *fil g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert ServiceAttachment with key of value obj. -func (g *GCEServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computega.ServiceAttachment, options ...Option) error { +func (g *GCEAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "ServiceAttachments", - Resource: key, } - klog.V(5).Infof("GCEServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.ServiceAttachments.Insert(projectID, key.Region, obj) + call := g.s.Alpha.ServiceAttachments.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the ServiceAttachment referenced by key. -func (g *GCEServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "ServiceAttachments", - Resource: key, } - klog.V(5).Infof("GCEServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.ServiceAttachments.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.ServiceAttachments.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) return err } -// Patch is a method on GCEServiceAttachments. -func (g *GCEServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computega.ServiceAttachment, options ...Option) error { +// Patch is a method on GCEAlphaServiceAttachments. +func (g *GCEAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") ck := &CallContextKey{ ProjectID: projectID, Operation: "Patch", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "ServiceAttachments", - Resource: key, } - klog.V(5).Infof("GCEServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -36018,22 +33932,21 @@ func (g *GCEServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 * callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaServiceAttachments is an interface that allows for mocking of ServiceAttachments. -type BetaServiceAttachments interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error +// SslCertificates is an interface that allows for mocking of SslCertificates. +type SslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computebeta.ServiceAttachment, ...Option) error } -// NewMockBetaServiceAttachments returns a new mock for ServiceAttachments. -func NewMockBetaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockBetaServiceAttachments { - mock := &MockBetaServiceAttachments{ +// NewMockSslCertificates returns a new mock for SslCertificates. +func NewMockSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockSslCertificates { + mock := &MockSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -36044,14 +33957,14 @@ func NewMockBetaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServ return mock } -// MockBetaServiceAttachments is the mock for ServiceAttachments. -type MockBetaServiceAttachments struct { +// MockSslCertificates is the mock for SslCertificates. +type MockSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockServiceAttachmentsObj + Objects map[meta.Key]*MockSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -36064,11 +33977,10 @@ type MockBetaServiceAttachments struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, *computebeta.ServiceAttachment, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaServiceAttachments, options ...Option) (bool, []*computebeta.ServiceAttachment, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, m *MockBetaServiceAttachments, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaServiceAttachments, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computebeta.ServiceAttachment, *MockBetaServiceAttachments, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -36076,10 +33988,10 @@ type MockBetaServiceAttachments struct { } // Get returns the object from the mock. -func (m *MockBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { +func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -36091,28 +34003,28 @@ func (m *MockBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockSslCertificates %v not found", key), } - klog.V(5).Infof("MockBetaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { +// List all of the objects in the mock. +func (m *MockSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -36122,31 +34034,28 @@ func (m *MockBetaServiceAttachments) List(ctx context.Context, region string, fl if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.ServiceAttachment - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { + var objs []*computega.SslCertificate + for _, obj := range m.Objects { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockBetaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { +func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -36159,32 +34068,32 @@ func (m *MockBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaServiceAttachments %v exists", key), + Message: fmt.Sprintf("MockSslCertificates %v exists", key), } - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "serviceAttachments") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "serviceAttachments", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) - m.Objects[*key] = &MockServiceAttachmentsObj{obj} - klog.V(5).Infof("MockBetaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSslCertificatesObj{obj} + klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -36196,71 +34105,61 @@ func (m *MockBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockSslCertificates %v not found", key), } - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaServiceAttachments.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaServiceAttachments) Obj(o *computebeta.ServiceAttachment) *MockServiceAttachmentsObj { - return &MockServiceAttachmentsObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil +func (m *MockSslCertificates) Obj(o *computega.SslCertificate) *MockSslCertificatesObj { + return &MockSslCertificatesObj{o} } -// GCEBetaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. -type GCEBetaServiceAttachments struct { +// GCESslCertificates is a simplifying adapter for the GCE SslCertificates. +type GCESslCertificates struct { s *Service } -// Get the ServiceAttachment named by key. -func (g *GCEBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.ServiceAttachment, error) { +// Get the SslCertificate named by key. +func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("ga"), + Service: "SslCertificates", } - klog.V(5).Infof("GCEBetaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.ServiceAttachments.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.SslCertificates.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCESslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -36268,34 +34167,32 @@ func (g *GCEBetaServiceAttachments) Get(ctx context.Context, key *meta.Key, opti return v, err } -// List all ServiceAttachment objects. -func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.ServiceAttachment, error) { +// List all SslCertificate objects. +func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + klog.V(5).Infof("GCESslCertificates.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("ga"), + Service: "SslCertificates", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.ServiceAttachments.List(projectID, region) + klog.V(5).Infof("GCESslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.SslCertificates.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.ServiceAttachment - f := func(l *computebeta.ServiceAttachmentList) error { - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.SslCertificate + f := func(l *computega.SslCertificateList) error { + klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -36303,7 +34200,7 @@ func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -36311,161 +34208,112 @@ func (g *GCEBetaServiceAttachments) List(ctx context.Context, region string, fl g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert ServiceAttachment with key of value obj. -func (g *GCEBetaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computebeta.ServiceAttachment, options ...Option) error { +// Insert SslCertificate with key of value obj. +func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("ga"), + Service: "SslCertificates", } - klog.V(5).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.ServiceAttachments.Insert(projectID, key.Region, obj) + call := g.s.GA.SslCertificates.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the ServiceAttachment referenced by key. -func (g *GCEBetaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the SslCertificate referenced by key. +func (g *GCESslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("ga"), + Service: "SslCertificates", } - klog.V(5).Infof("GCEBetaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.ServiceAttachments.Delete(projectID, key.Region, key.Name) + call := g.s.GA.SslCertificates.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// Patch is a method on GCEBetaServiceAttachments. -func (g *GCEBetaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.ServiceAttachment, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "ServiceAttachments") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "ServiceAttachments", - Resource: key, - } - klog.V(5).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// AlphaServiceAttachments is an interface that allows for mocking of ServiceAttachments. -type AlphaServiceAttachments interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error +// BetaSslCertificates is an interface that allows for mocking of SslCertificates. +type BetaSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computealpha.ServiceAttachment, ...Option) error } -// NewMockAlphaServiceAttachments returns a new mock for ServiceAttachments. -func NewMockAlphaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockServiceAttachmentsObj) *MockAlphaServiceAttachments { - mock := &MockAlphaServiceAttachments{ +// NewMockBetaSslCertificates returns a new mock for SslCertificates. +func NewMockBetaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockBetaSslCertificates { + mock := &MockBetaSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -36476,14 +34324,14 @@ func NewMockAlphaServiceAttachments(pr ProjectRouter, objs map[meta.Key]*MockSer return mock } -// MockAlphaServiceAttachments is the mock for ServiceAttachments. -type MockAlphaServiceAttachments struct { +// MockBetaSslCertificates is the mock for SslCertificates. +type MockBetaSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockServiceAttachmentsObj + Objects map[meta.Key]*MockSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -36496,11 +34344,10 @@ type MockAlphaServiceAttachments struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, *computealpha.ServiceAttachment, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaServiceAttachments, options ...Option) (bool, []*computealpha.ServiceAttachment, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, m *MockAlphaServiceAttachments, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaServiceAttachments, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computealpha.ServiceAttachment, *MockAlphaServiceAttachments, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -36508,10 +34355,10 @@ type MockAlphaServiceAttachments struct { } // Get returns the object from the mock. -func (m *MockAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { +func (m *MockBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -36523,28 +34370,28 @@ func (m *MockAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaServiceAttachments.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { +// List all of the objects in the mock. +func (m *MockBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -36554,31 +34401,28 @@ func (m *MockAlphaServiceAttachments) List(ctx context.Context, region string, f if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computealpha.ServiceAttachment - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToAlpha()) { + var objs []*computebeta.SslCertificate + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockAlphaServiceAttachments.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { +func (m *MockBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -36591,32 +34435,32 @@ func (m *MockAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaServiceAttachments %v exists", key), + Message: fmt.Sprintf("MockBetaSslCertificates %v exists", key), } - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "serviceAttachments") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "serviceAttachments", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) - m.Objects[*key] = &MockServiceAttachmentsObj{obj} - klog.V(5).Infof("MockAlphaServiceAttachments.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSslCertificatesObj{obj} + klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -36628,71 +34472,61 @@ func (m *MockAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaServiceAttachments %v not found", key), + Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaServiceAttachments.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaServiceAttachments) Obj(o *computealpha.ServiceAttachment) *MockServiceAttachmentsObj { - return &MockServiceAttachmentsObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil +func (m *MockBetaSslCertificates) Obj(o *computebeta.SslCertificate) *MockSslCertificatesObj { + return &MockSslCertificatesObj{o} } -// GCEAlphaServiceAttachments is a simplifying adapter for the GCE ServiceAttachments. -type GCEAlphaServiceAttachments struct { +// GCEBetaSslCertificates is a simplifying adapter for the GCE SslCertificates. +type GCEBetaSslCertificates struct { s *Service } -// Get the ServiceAttachment named by key. -func (g *GCEAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.ServiceAttachment, error) { +// Get the SslCertificate named by key. +func (g *GCEBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("beta"), + Service: "SslCertificates", } - klog.V(5).Infof("GCEAlphaServiceAttachments.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.ServiceAttachments.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.SslCertificates.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaServiceAttachments.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -36700,34 +34534,32 @@ func (g *GCEAlphaServiceAttachments) Get(ctx context.Context, key *meta.Key, opt return v, err } -// List all ServiceAttachment objects. -func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.ServiceAttachment, error) { +// List all SslCertificate objects. +func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("beta"), + Service: "SslCertificates", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.ServiceAttachments.List(projectID, region) + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.SslCertificates.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.ServiceAttachment - f := func(l *computealpha.ServiceAttachmentList) error { - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.SslCertificate + f := func(l *computebeta.SslCertificateList) error { + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -36735,7 +34567,7 @@ func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -36743,160 +34575,112 @@ func (g *GCEAlphaServiceAttachments) List(ctx context.Context, region string, fl g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaServiceAttachments.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert ServiceAttachment with key of value obj. -func (g *GCEAlphaServiceAttachments) Insert(ctx context.Context, key *meta.Key, obj *computealpha.ServiceAttachment, options ...Option) error { +// Insert SslCertificate with key of value obj. +func (g *GCEBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("beta"), + Service: "SslCertificates", } - klog.V(5).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.ServiceAttachments.Insert(projectID, key.Region, obj) + call := g.s.Beta.SslCertificates.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaServiceAttachments.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the ServiceAttachment referenced by key. -func (g *GCEAlphaServiceAttachments) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the SslCertificate referenced by key. +func (g *GCEBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "ServiceAttachments", - Resource: key, + Version: meta.Version("beta"), + Service: "SslCertificates", } - klog.V(5).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.ServiceAttachments.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.SslCertificates.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaServiceAttachments.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// Patch is a method on GCEAlphaServiceAttachments. -func (g *GCEAlphaServiceAttachments) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.ServiceAttachment, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "ServiceAttachments") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "ServiceAttachments", - Resource: key, - } - klog.V(5).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.ServiceAttachments.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaServiceAttachments.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// SslCertificates is an interface that allows for mocking of SslCertificates. -type SslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error +// AlphaSslCertificates is an interface that allows for mocking of SslCertificates. +type AlphaSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockSslCertificates returns a new mock for SslCertificates. -func NewMockSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockSslCertificates { - mock := &MockSslCertificates{ +// NewMockAlphaSslCertificates returns a new mock for SslCertificates. +func NewMockAlphaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockAlphaSslCertificates { + mock := &MockAlphaSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -36907,8 +34691,8 @@ func NewMockSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertific return mock } -// MockSslCertificates is the mock for SslCertificates. -type MockSslCertificates struct { +// MockAlphaSslCertificates is the mock for SslCertificates. +type MockAlphaSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter @@ -36927,10 +34711,10 @@ type MockSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -36938,10 +34722,10 @@ type MockSslCertificates struct { } // Get returns the object from the mock. -func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +func (m *MockAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -36953,28 +34737,28 @@ func (m *MockSslCertificates) Get(ctx context.Context, key *meta.Key, options .. defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), } - klog.V(5).Infof("MockSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock. -func (m *MockSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { +func (m *MockAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -36984,28 +34768,28 @@ func (m *MockSslCertificates) List(ctx context.Context, fl *filter.F, options .. if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.SslCertificate + var objs []*computealpha.SslCertificate for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { +func (m *MockAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -37018,32 +34802,32 @@ func (m *MockSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *co defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockSslCertificates %v exists", key), + Message: fmt.Sprintf("MockAlphaSslCertificates %v exists", key), } - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) m.Objects[*key] = &MockSslCertificatesObj{obj} - klog.V(5).Infof("MockSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -37055,63 +34839,61 @@ func (m *MockSslCertificates) Delete(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), } - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockSslCertificates) Obj(o *computega.SslCertificate) *MockSslCertificatesObj { +func (m *MockAlphaSslCertificates) Obj(o *computealpha.SslCertificate) *MockSslCertificatesObj { return &MockSslCertificatesObj{o} } -// GCESslCertificates is a simplifying adapter for the GCE SslCertificates. -type GCESslCertificates struct { +// GCEAlphaSslCertificates is a simplifying adapter for the GCE SslCertificates. +type GCEAlphaSslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +func (g *GCEAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "SslCertificates", - Resource: key, } - klog.V(5).Infof("GCESslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.SslCertificates.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.SslCertificates.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCESslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -37120,33 +34902,31 @@ func (g *GCESslCertificates) Get(ctx context.Context, key *meta.Key, options ... } // List all SslCertificate objects. -func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { +func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "SslCertificates", - Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCESslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.SslCertificates.List(projectID) + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.SslCertificates.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.SslCertificate - f := func(l *computega.SslCertificateList) error { - klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.SslCertificate + f := func(l *computealpha.SslCertificateList) error { + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -37154,7 +34934,7 @@ func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ... callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -37162,116 +34942,112 @@ func (g *GCESslCertificates) List(ctx context.Context, fl *filter.F, options ... g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCESslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCESslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCESslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { +func (g *GCEAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCESslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "SslCertificates", - Resource: key, } - klog.V(5).Infof("GCESslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.SslCertificates.Insert(projectID, obj) + call := g.s.Alpha.SslCertificates.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCESslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), + Version: meta.Version("alpha"), Service: "SslCertificates", - Resource: key, } - klog.V(5).Infof("GCESslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.SslCertificates.Delete(projectID, key.Name) + call := g.s.Alpha.SslCertificates.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaSslCertificates is an interface that allows for mocking of SslCertificates. -type BetaSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error +// AlphaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. +type AlphaRegionSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockBetaSslCertificates returns a new mock for SslCertificates. -func NewMockBetaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockBetaSslCertificates { - mock := &MockBetaSslCertificates{ +// NewMockAlphaRegionSslCertificates returns a new mock for RegionSslCertificates. +func NewMockAlphaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockAlphaRegionSslCertificates { + mock := &MockAlphaRegionSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -37282,14 +35058,14 @@ func NewMockBetaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCert return mock } -// MockBetaSslCertificates is the mock for SslCertificates. -type MockBetaSslCertificates struct { +// MockAlphaRegionSslCertificates is the mock for RegionSslCertificates. +type MockAlphaRegionSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSslCertificatesObj + Objects map[meta.Key]*MockRegionSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -37302,10 +35078,10 @@ type MockBetaSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -37313,10 +35089,10 @@ type MockBetaSslCertificates struct { } // Get returns the object from the mock. -func (m *MockBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +func (m *MockAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -37328,28 +35104,28 @@ func (m *MockBetaSslCertificates) Get(ctx context.Context, key *meta.Key, option defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockBetaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -37359,28 +35135,31 @@ func (m *MockBetaSslCertificates) List(ctx context.Context, fl *filter.F, option if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.SslCertificate - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { + var objs []*computealpha.SslCertificate + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToBeta()) + if !fl.Match(obj.ToAlpha()) { + continue + } + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockBetaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +func (m *MockAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -37393,32 +35172,32 @@ func (m *MockBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaSslCertificates %v exists", key), + Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v exists", key), } - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) - m.Objects[*key] = &MockSslCertificatesObj{obj} - klog.V(5).Infof("MockBetaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionSslCertificatesObj{obj} + klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -37430,63 +35209,61 @@ func (m *MockBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaSslCertificates) Obj(o *computebeta.SslCertificate) *MockSslCertificatesObj { - return &MockSslCertificatesObj{o} +func (m *MockAlphaRegionSslCertificates) Obj(o *computealpha.SslCertificate) *MockRegionSslCertificatesObj { + return &MockRegionSslCertificatesObj{o} } -// GCEBetaSslCertificates is a simplifying adapter for the GCE SslCertificates. -type GCEBetaSslCertificates struct { +// GCEAlphaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. +type GCEAlphaRegionSslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCEBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +func (g *GCEAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionSslCertificates", } - klog.V(5).Infof("GCEBetaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.SslCertificates.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.RegionSslCertificates.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -37495,33 +35272,31 @@ func (g *GCEBetaSslCertificates) Get(ctx context.Context, key *meta.Key, options } // List all SslCertificate objects. -func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { +func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionSslCertificates", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.SslCertificates.List(projectID) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionSslCertificates.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.SslCertificate - f := func(l *computebeta.SslCertificateList) error { - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.SslCertificate + f := func(l *computealpha.SslCertificateList) error { + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -37529,7 +35304,7 @@ func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -37537,116 +35312,112 @@ func (g *GCEBetaSslCertificates) List(ctx context.Context, fl *filter.F, options g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCEBetaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +func (g *GCEAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionSslCertificates", } - klog.V(5).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.SslCertificates.Insert(projectID, obj) + call := g.s.Alpha.RegionSslCertificates.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCEBetaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionSslCertificates", } - klog.V(5).Infof("GCEBetaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.SslCertificates.Delete(projectID, key.Name) + call := g.s.Alpha.RegionSslCertificates.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// AlphaSslCertificates is an interface that allows for mocking of SslCertificates. -type AlphaSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error +// BetaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. +type BetaRegionSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockAlphaSslCertificates returns a new mock for SslCertificates. -func NewMockAlphaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCertificatesObj) *MockAlphaSslCertificates { - mock := &MockAlphaSslCertificates{ +// NewMockBetaRegionSslCertificates returns a new mock for RegionSslCertificates. +func NewMockBetaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockBetaRegionSslCertificates { + mock := &MockBetaRegionSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -37657,14 +35428,14 @@ func NewMockAlphaSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockSslCer return mock } -// MockAlphaSslCertificates is the mock for SslCertificates. -type MockAlphaSslCertificates struct { +// MockBetaRegionSslCertificates is the mock for RegionSslCertificates. +type MockBetaRegionSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockSslCertificatesObj + Objects map[meta.Key]*MockRegionSslCertificatesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -37677,10 +35448,10 @@ type MockAlphaSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -37688,10 +35459,10 @@ type MockAlphaSslCertificates struct { } // Get returns the object from the mock. -func (m *MockAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (m *MockBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -37703,28 +35474,28 @@ func (m *MockAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -37734,28 +35505,31 @@ func (m *MockAlphaSslCertificates) List(ctx context.Context, fl *filter.F, optio if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.SslCertificate - for _, obj := range m.Objects { - if !fl.Match(obj.ToAlpha()) { + var objs []*computebeta.SslCertificate + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToAlpha()) + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockAlphaSslCertificates.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (m *MockBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -37768,32 +35542,32 @@ func (m *MockAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, ob defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaSslCertificates %v exists", key), + Message: fmt.Sprintf("MockBetaRegionSslCertificates %v exists", key), } - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) - m.Objects[*key] = &MockSslCertificatesObj{obj} - klog.V(5).Infof("MockAlphaSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionSslCertificatesObj{obj} + klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -37805,63 +35579,61 @@ func (m *MockAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSslCertificates %v not found", key), + Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaSslCertificates) Obj(o *computealpha.SslCertificate) *MockSslCertificatesObj { - return &MockSslCertificatesObj{o} +func (m *MockBetaRegionSslCertificates) Obj(o *computebeta.SslCertificate) *MockRegionSslCertificatesObj { + return &MockRegionSslCertificatesObj{o} } -// GCEAlphaSslCertificates is a simplifying adapter for the GCE SslCertificates. -type GCEAlphaSslCertificates struct { +// GCEBetaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. +type GCEBetaRegionSslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCEAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (g *GCEBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionSslCertificates", } - klog.V(5).Infof("GCEAlphaSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.SslCertificates.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.RegionSslCertificates.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -37870,33 +35642,31 @@ func (g *GCEAlphaSslCertificates) Get(ctx context.Context, key *meta.Key, option } // List all SslCertificate objects. -func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +func (g *GCEBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionSslCertificates", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.SslCertificates.List(projectID) + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionSslCertificates.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.SslCertificate - f := func(l *computealpha.SslCertificateList) error { - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.SslCertificate + f := func(l *computebeta.SslCertificateList) error { + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -37904,7 +35674,7 @@ func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, option callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -37912,116 +35682,112 @@ func (g *GCEAlphaSslCertificates) List(ctx context.Context, fl *filter.F, option g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCEAlphaSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (g *GCEBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionSslCertificates", } - klog.V(5).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.SslCertificates.Insert(projectID, obj) + call := g.s.Beta.RegionSslCertificates.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCEAlphaSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "SslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "SslCertificates", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionSslCertificates", } - klog.V(5).Infof("GCEAlphaSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.SslCertificates.Delete(projectID, key.Name) + call := g.s.Beta.RegionSslCertificates.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// AlphaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. -type AlphaRegionSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error +// RegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. +type RegionSslCertificates interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockAlphaRegionSslCertificates returns a new mock for RegionSslCertificates. -func NewMockAlphaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockAlphaRegionSslCertificates { - mock := &MockAlphaRegionSslCertificates{ +// NewMockRegionSslCertificates returns a new mock for RegionSslCertificates. +func NewMockRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockRegionSslCertificates { + mock := &MockRegionSslCertificates{ ProjectRouter: pr, Objects: objs, @@ -38032,8 +35798,8 @@ func NewMockAlphaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*Mock return mock } -// MockAlphaRegionSslCertificates is the mock for RegionSslCertificates. -type MockAlphaRegionSslCertificates struct { +// MockRegionSslCertificates is the mock for RegionSslCertificates. +type MockRegionSslCertificates struct { Lock sync.Mutex ProjectRouter ProjectRouter @@ -38052,10 +35818,10 @@ type MockAlphaRegionSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, *computealpha.SslCertificate, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionSslCertificates, options ...Option) (bool, []*computealpha.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockRegionSslCertificates, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -38063,10 +35829,10 @@ type MockAlphaRegionSslCertificates struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (m *MockRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -38078,28 +35844,28 @@ func (m *MockAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +func (m *MockRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -38109,31 +35875,31 @@ func (m *MockAlphaRegionSslCertificates) List(ctx context.Context, region string if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.SslCertificate + var objs []*computega.SslCertificate for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToAlpha()) { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockAlphaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (m *MockRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -38146,32 +35912,32 @@ func (m *MockAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v exists", key), + Message: fmt.Sprintf("MockRegionSslCertificates %v exists", key), } - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) m.Objects[*key] = &MockRegionSslCertificatesObj{obj} - klog.V(5).Infof("MockAlphaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -38183,63 +35949,61 @@ func (m *MockAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), } - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionSslCertificates) Obj(o *computealpha.SslCertificate) *MockRegionSslCertificatesObj { +func (m *MockRegionSslCertificates) Obj(o *computega.SslCertificate) *MockRegionSslCertificatesObj { return &MockRegionSslCertificatesObj{o} } -// GCEAlphaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. -type GCEAlphaRegionSslCertificates struct { +// GCERegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. +type GCERegionSslCertificates struct { s *Service } // Get the SslCertificate named by key. -func (g *GCEAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.SslCertificate, error) { +func (g *GCERegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "RegionSslCertificates", - Resource: key, } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionSslCertificates.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.RegionSslCertificates.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -38248,33 +36012,31 @@ func (g *GCEAlphaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, } // List all SslCertificate objects. -func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.SslCertificate, error) { +func (g *GCERegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "RegionSslCertificates", - Resource: key, } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionSslCertificates.List(projectID, region) + klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionSslCertificates.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.SslCertificate - f := func(l *computealpha.SslCertificateList) error { - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.SslCertificate + f := func(l *computega.SslCertificateList) error { + klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -38282,7 +36044,7 @@ func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -38290,116 +36052,111 @@ func (g *GCEAlphaRegionSslCertificates) List(ctx context.Context, region string, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert SslCertificate with key of value obj. -func (g *GCEAlphaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computealpha.SslCertificate, options ...Option) error { +func (g *GCERegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "RegionSslCertificates", - Resource: key, } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.RegionSslCertificates.Insert(projectID, key.Region, obj) + call := g.s.GA.RegionSslCertificates.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the SslCertificate referenced by key. -func (g *GCEAlphaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCERegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), + Version: meta.Version("ga"), Service: "RegionSslCertificates", - Resource: key, } - klog.V(5).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionSslCertificates.Delete(projectID, key.Region, key.Name) + call := g.s.GA.RegionSslCertificates.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) return err } -// BetaRegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. -type BetaRegionSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error +// SslPolicies is an interface that allows for mocking of SslPolicies. +type SslPolicies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockBetaRegionSslCertificates returns a new mock for RegionSslCertificates. -func NewMockBetaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockBetaRegionSslCertificates { - mock := &MockBetaRegionSslCertificates{ +// NewMockSslPolicies returns a new mock for SslPolicies. +func NewMockSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockSslPoliciesObj) *MockSslPolicies { + mock := &MockSslPolicies{ ProjectRouter: pr, Objects: objs, @@ -38410,19 +36167,18 @@ func NewMockBetaRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockR return mock } -// MockBetaRegionSslCertificates is the mock for RegionSslCertificates. -type MockBetaRegionSslCertificates struct { +// MockSslPolicies is the mock for SslPolicies. +type MockSslPolicies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionSslCertificatesObj + Objects map[meta.Key]*MockSslPoliciesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. GetError map[meta.Key]error - ListError *error InsertError map[meta.Key]error DeleteError map[meta.Key]error @@ -38430,10 +36186,9 @@ type MockBetaRegionSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, *computebeta.SslCertificate, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionSslCertificates, options ...Option) (bool, []*computebeta.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockSslPolicies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -38441,10 +36196,10 @@ type MockBetaRegionSslCertificates struct { } // Get returns the object from the mock. -func (m *MockBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +func (m *MockSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -38456,62 +36211,28 @@ func (m *MockBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockSslPolicies %v not found", key), } - klog.V(5).Infof("MockBetaRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { - if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) - - return nil, *m.ListError - } - - var objs []*computebeta.SslCertificate - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { - continue - } - objs = append(objs, obj.ToBeta()) - } - - klog.V(5).Infof("MockBetaRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) - return objs, nil -} - // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +func (m *MockSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -38524,32 +36245,32 @@ func (m *MockBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionSslCertificates %v exists", key), + Message: fmt.Sprintf("MockSslPolicies %v exists", key), } - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) - m.Objects[*key] = &MockRegionSslCertificatesObj{obj} - klog.V(5).Infof("MockBetaRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSslPoliciesObj{obj} + klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -38561,63 +36282,61 @@ func (m *MockBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockSslPolicies %v not found", key), } - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaRegionSslCertificates) Obj(o *computebeta.SslCertificate) *MockRegionSslCertificatesObj { - return &MockRegionSslCertificatesObj{o} +func (m *MockSslPolicies) Obj(o *computega.SslPolicy) *MockSslPoliciesObj { + return &MockSslPoliciesObj{o} } -// GCEBetaRegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. -type GCEBetaRegionSslCertificates struct { +// GCESslPolicies is a simplifying adapter for the GCE SslPolicies. +type GCESslPolicies struct { s *Service } -// Get the SslCertificate named by key. -func (g *GCEBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.SslCertificate, error) { +// Get the SslPolicy named by key. +func (g *GCESslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESslPolicies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", - Resource: key, + Version: meta.Version("ga"), + Service: "SslPolicies", } - klog.V(5).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionSslCertificates.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.SslPolicies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCESslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -38625,159 +36344,99 @@ func (g *GCEBetaRegionSslCertificates) Get(ctx context.Context, key *meta.Key, o return v, err } -// List all SslCertificate objects. -func (g *GCEBetaRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.SslCertificate, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "List", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", - Resource: key, - } - - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionSslCertificates.List(projectID, region) - if fl != filter.None { - call.Filter(fl.String()) - } - - var all []*computebeta.SslCertificate - f := func(l *computebeta.SslCertificateList) error { - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEBetaRegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Insert SslCertificate with key of value obj. -func (g *GCEBetaRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computebeta.SslCertificate, options ...Option) error { +// Insert SslPolicy with key of value obj. +func (g *GCESslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", - Resource: key, + Version: meta.Version("ga"), + Service: "SslPolicies", } - klog.V(5).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionSslCertificates.Insert(projectID, key.Region, obj) + call := g.s.GA.SslPolicies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the SslCertificate referenced by key. -func (g *GCEBetaRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the SslPolicy referenced by key. +func (g *GCESslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "RegionSslCertificates", - Resource: key, + Version: meta.Version("ga"), + Service: "SslPolicies", } - klog.V(5).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionSslCertificates.Delete(projectID, key.Region, key.Name) + call := g.s.GA.SslPolicies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } -// RegionSslCertificates is an interface that allows for mocking of RegionSslCertificates. -type RegionSslCertificates interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error +// RegionSslPolicies is an interface that allows for mocking of RegionSslPolicies. +type RegionSslPolicies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error } -// NewMockRegionSslCertificates returns a new mock for RegionSslCertificates. -func NewMockRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegionSslCertificatesObj) *MockRegionSslCertificates { - mock := &MockRegionSslCertificates{ +// NewMockRegionSslPolicies returns a new mock for RegionSslPolicies. +func NewMockRegionSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockRegionSslPoliciesObj) *MockRegionSslPolicies { + mock := &MockRegionSslPolicies{ ProjectRouter: pr, Objects: objs, @@ -38788,19 +36447,18 @@ func NewMockRegionSslCertificates(pr ProjectRouter, objs map[meta.Key]*MockRegio return mock } -// MockRegionSslCertificates is the mock for RegionSslCertificates. -type MockRegionSslCertificates struct { +// MockRegionSslPolicies is the mock for RegionSslPolicies. +type MockRegionSslPolicies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionSslCertificatesObj + Objects map[meta.Key]*MockRegionSslPoliciesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. GetError map[meta.Key]error - ListError *error InsertError map[meta.Key]error DeleteError map[meta.Key]error @@ -38808,10 +36466,9 @@ type MockRegionSslCertificates struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, *computega.SslCertificate, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionSslCertificates, options ...Option) (bool, []*computega.SslCertificate, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, m *MockRegionSslCertificates, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslCertificates, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockRegionSslPolicies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, error) // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -38819,10 +36476,10 @@ type MockRegionSslCertificates struct { } // Get returns the object from the mock. -func (m *MockRegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +func (m *MockRegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -38834,62 +36491,28 @@ func (m *MockRegionSslCertificates) Get(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), } - klog.V(5).Infof("MockRegionSslCertificates.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { - if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) - - return nil, *m.ListError - } - - var objs []*computega.SslCertificate - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToGA()) { - continue - } - objs = append(objs, obj.ToGA()) - } - - klog.V(5).Infof("MockRegionSslCertificates.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) - return objs, nil -} - // Insert is a mock for inserting/creating a new object. -func (m *MockRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { +func (m *MockRegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -38902,32 +36525,32 @@ func (m *MockRegionSslCertificates) Insert(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionSslCertificates %v exists", key), + Message: fmt.Sprintf("MockRegionSslPolicies %v exists", key), } - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslCertificates") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslCertificates", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) - m.Objects[*key] = &MockRegionSslCertificatesObj{obj} - klog.V(5).Infof("MockRegionSslCertificates.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionSslPoliciesObj{obj} + klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -38939,2362 +36562,164 @@ func (m *MockRegionSslCertificates) Delete(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslCertificates %v not found", key), + Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), } - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionSslCertificates.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionSslCertificates) Obj(o *computega.SslCertificate) *MockRegionSslCertificatesObj { - return &MockRegionSslCertificatesObj{o} +func (m *MockRegionSslPolicies) Obj(o *computega.SslPolicy) *MockRegionSslPoliciesObj { + return &MockRegionSslPoliciesObj{o} } -// GCERegionSslCertificates is a simplifying adapter for the GCE RegionSslCertificates. -type GCERegionSslCertificates struct { +// GCERegionSslPolicies is a simplifying adapter for the GCE RegionSslPolicies. +type GCERegionSslPolicies struct { s *Service } -// Get the SslCertificate named by key. -func (g *GCERegionSslCertificates) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslCertificate, error) { +// Get the SslPolicy named by key. +func (g *GCERegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionSslCertificates.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionSslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "RegionSslCertificates", - Resource: key, + Service: "RegionSslPolicies", } - klog.V(5).Infof("GCERegionSslCertificates.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionSslCertificates.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.RegionSslPolicies.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionSslCertificates.Get(%v, %v) = %+v, %v", ctx, key, v, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return v, err -} - -// List all SslCertificate objects. -func (g *GCERegionSslCertificates) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.SslCertificate, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "List", - Version: meta.Version("ga"), - Service: "RegionSslCertificates", - Resource: key, - } - - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - klog.V(5).Infof("GCERegionSslCertificates.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionSslCertificates.List(projectID, region) - if fl != filter.None { - call.Filter(fl.String()) - } - - var all []*computega.SslCertificate - f := func(l *computega.SslCertificateList) error { - klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCERegionSslCertificates.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCERegionSslCertificates.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Insert SslCertificate with key of value obj. -func (g *GCERegionSslCertificates) Insert(ctx context.Context, key *meta.Key, obj *computega.SslCertificate, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) - if !key.Valid() { - klog.V(2).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Insert", - Version: meta.Version("ga"), - Service: "RegionSslCertificates", - Resource: key, - } - klog.V(5).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - obj.Name = key.Name - call := g.s.GA.RegionSslCertificates.Insert(projectID, key.Region, obj) - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, ...) = %+v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslCertificates.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err -} - -// Delete the SslCertificate referenced by key. -func (g *GCERegionSslCertificates) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCERegionSslCertificates.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslCertificates") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Delete", - Version: meta.Version("ga"), - Service: "RegionSslCertificates", - Resource: key, - } - klog.V(5).Infof("GCERegionSslCertificates.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.RegionSslCertificates.Delete(projectID, key.Region, key.Name) - - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslCertificates.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// SslPolicies is an interface that allows for mocking of SslPolicies. -type SslPolicies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error -} - -// NewMockSslPolicies returns a new mock for SslPolicies. -func NewMockSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockSslPoliciesObj) *MockSslPolicies { - mock := &MockSslPolicies{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockSslPolicies is the mock for SslPolicies. -type MockSslPolicies struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockSslPoliciesObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockSslPolicies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockSslPolicies, options ...Option) (bool, error) - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} - -// Get returns the object from the mock. -func (m *MockSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { - if m.GetHook != nil { - if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) - return obj, err - } - } - if !key.Valid() { - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err - } - if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) - return typedObj, nil - } - - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslPolicies %v not found", key), - } - klog.V(5).Infof("MockSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err -} - -// Insert is a mock for inserting/creating a new object. -func (m *MockSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } - opts := mergeOptions(options) - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - if _, ok := m.Objects[*key]; ok { - err := &googleapi.Error{ - Code: http.StatusConflict, - Message: fmt.Sprintf("MockSslPolicies %v exists", key), - } - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - - obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) - - m.Objects[*key] = &MockSslPoliciesObj{obj} - klog.V(5).Infof("MockSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) - return nil -} - -// Delete is a mock for deleting the object. -func (m *MockSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - if m.DeleteHook != nil { - if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - } - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - if _, ok := m.Objects[*key]; !ok { - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSslPolicies %v not found", key), - } - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - delete(m.Objects, *key) - klog.V(5).Infof("MockSslPolicies.Delete(%v, %v) = nil", ctx, key) - return nil -} - -// Obj wraps the object for use in the mock. -func (m *MockSslPolicies) Obj(o *computega.SslPolicy) *MockSslPoliciesObj { - return &MockSslPoliciesObj{o} -} - -// GCESslPolicies is a simplifying adapter for the GCE SslPolicies. -type GCESslPolicies struct { - s *Service -} - -// Get the SslPolicy named by key. -func (g *GCESslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCESslPolicies.Get(%v, %v, %v): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCESslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) - return nil, fmt.Errorf("invalid GCE key (%#v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Get", - Version: meta.Version("ga"), - Service: "SslPolicies", - Resource: key, - } - - klog.V(5).Infof("GCESslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.GA.SslPolicies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) - call.Context(ctx) - v, err := call.Do() - klog.V(4).Infof("GCESslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return v, err -} - -// Insert SslPolicy with key of value obj. -func (g *GCESslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) - if !key.Valid() { - klog.V(2).Infof("GCESslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Insert", - Version: meta.Version("ga"), - Service: "SslPolicies", - Resource: key, - } - klog.V(5).Infof("GCESslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - obj.Name = key.Name - call := g.s.GA.SslPolicies.Insert(projectID, obj) - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err -} - -// Delete the SslPolicy referenced by key. -func (g *GCESslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCESslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCESslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "SslPolicies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Delete", - Version: meta.Version("ga"), - Service: "SslPolicies", - Resource: key, - } - klog.V(5).Infof("GCESslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.SslPolicies.Delete(projectID, key.Name) - - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// RegionSslPolicies is an interface that allows for mocking of RegionSslPolicies. -type RegionSslPolicies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error -} - -// NewMockRegionSslPolicies returns a new mock for RegionSslPolicies. -func NewMockRegionSslPolicies(pr ProjectRouter, objs map[meta.Key]*MockRegionSslPoliciesObj) *MockRegionSslPolicies { - mock := &MockRegionSslPolicies{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockRegionSslPolicies is the mock for RegionSslPolicies. -type MockRegionSslPolicies struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionSslPoliciesObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, *computega.SslPolicy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, m *MockRegionSslPolicies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionSslPolicies, options ...Option) (bool, error) - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} - -// Get returns the object from the mock. -func (m *MockRegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { - if m.GetHook != nil { - if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) - return obj, err - } - } - if !key.Valid() { - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err - } - if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) - return typedObj, nil - } - - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), - } - klog.V(5).Infof("MockRegionSslPolicies.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err -} - -// Insert is a mock for inserting/creating a new object. -func (m *MockRegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } - opts := mergeOptions(options) - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - if _, ok := m.Objects[*key]; ok { - err := &googleapi.Error{ - Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionSslPolicies %v exists", key), - } - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - - obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "sslPolicies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "sslPolicies", key) - - m.Objects[*key] = &MockRegionSslPoliciesObj{obj} - klog.V(5).Infof("MockRegionSslPolicies.Insert(%v, %v, %+v) = nil", ctx, key, obj) - return nil -} - -// Delete is a mock for deleting the object. -func (m *MockRegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - if m.DeleteHook != nil { - if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - } - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - if _, ok := m.Objects[*key]; !ok { - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionSslPolicies %v not found", key), - } - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - delete(m.Objects, *key) - klog.V(5).Infof("MockRegionSslPolicies.Delete(%v, %v) = nil", ctx, key) - return nil -} - -// Obj wraps the object for use in the mock. -func (m *MockRegionSslPolicies) Obj(o *computega.SslPolicy) *MockRegionSslPoliciesObj { - return &MockRegionSslPoliciesObj{o} -} - -// GCERegionSslPolicies is a simplifying adapter for the GCE RegionSslPolicies. -type GCERegionSslPolicies struct { - s *Service -} - -// Get the SslPolicy named by key. -func (g *GCERegionSslPolicies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.SslPolicy, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v, %v): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCERegionSslPolicies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) - return nil, fmt.Errorf("invalid GCE key (%#v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Get", - Version: meta.Version("ga"), - Service: "RegionSslPolicies", - Resource: key, - } - - klog.V(5).Infof("GCERegionSslPolicies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.GA.RegionSslPolicies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) - call.Context(ctx) - v, err := call.Do() - klog.V(4).Infof("GCERegionSslPolicies.Get(%v, %v) = %+v, %v", ctx, key, v, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return v, err -} - -// Insert SslPolicy with key of value obj. -func (g *GCERegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) - if !key.Valid() { - klog.V(2).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Insert", - Version: meta.Version("ga"), - Service: "RegionSslPolicies", - Resource: key, - } - klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - obj.Name = key.Name - call := g.s.GA.RegionSslPolicies.Insert(projectID, key.Region, obj) - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err -} - -// Delete the SslPolicy referenced by key. -func (g *GCERegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCERegionSslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Delete", - Version: meta.Version("ga"), - Service: "RegionSslPolicies", - Resource: key, - } - klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.RegionSslPolicies.Delete(projectID, key.Region, key.Name) - - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// AlphaSubnetworks is an interface that allows for mocking of Subnetworks. -type AlphaSubnetworks interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) - Patch(context.Context, *meta.Key, *computealpha.Subnetwork, ...Option) error -} - -// NewMockAlphaSubnetworks returns a new mock for Subnetworks. -func NewMockAlphaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockAlphaSubnetworks { - mock := &MockAlphaSubnetworks{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockAlphaSubnetworks is the mock for Subnetworks. -type MockAlphaSubnetworks struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockSubnetworksObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - ListUsableError *error - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, *computealpha.Subnetwork, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.Subnetwork, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, m *MockAlphaSubnetworks, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, error) - ListUsableHook func(ctx context.Context, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.UsableSubnetwork, error) - PatchHook func(context.Context, *meta.Key, *computealpha.Subnetwork, *MockAlphaSubnetworks, ...Option) error - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} - -// Get returns the object from the mock. -func (m *MockAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { - if m.GetHook != nil { - if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) - return obj, err - } - } - if !key.Valid() { - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err - } - if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) - return typedObj, nil - } - - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), - } - klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err -} - -// List all of the objects in the mock in the given region. -func (m *MockAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { - if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) - - return nil, *m.ListError - } - - var objs []*computealpha.Subnetwork - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToAlpha()) { - continue - } - objs = append(objs, obj.ToAlpha()) - } - - klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) - return objs, nil -} - -// Insert is a mock for inserting/creating a new object. -func (m *MockAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } - opts := mergeOptions(options) - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - if _, ok := m.Objects[*key]; ok { - err := &googleapi.Error{ - Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaSubnetworks %v exists", key), - } - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - - obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "subnetworks") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "subnetworks", key) - - m.Objects[*key] = &MockSubnetworksObj{obj} - klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) - return nil -} - -// Delete is a mock for deleting the object. -func (m *MockAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - if m.DeleteHook != nil { - if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - } - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - if _, ok := m.Objects[*key]; !ok { - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), - } - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = nil", ctx, key) - return nil -} - -// List all of the objects in the mock. -func (m *MockAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { - if m.ListUsableHook != nil { - if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) - return nil, *m.ListError - } - - var objs []*computealpha.UsableSubnetwork - - for _, obj := range m.Objects { - if !fl.Match(obj.ToAlpha()) { - continue - } - alphaObj := obj.ToAlpha() - dest := &computealpha.UsableSubnetwork{} - // Convert to Usable type to avoid separate Usable struct - if err := copyViaJSON(dest, alphaObj); err != nil { - klog.Errorf("Could not convert %T to *computealpha.UsableSubnetwork via JSON: %v", alphaObj, err) - } - objs = append(objs, dest) - } - klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - -// Obj wraps the object for use in the mock. -func (m *MockAlphaSubnetworks) Obj(o *computealpha.Subnetwork) *MockSubnetworksObj { - return &MockSubnetworksObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// GCEAlphaSubnetworks is a simplifying adapter for the GCE Subnetworks. -type GCEAlphaSubnetworks struct { - s *Service -} - -// Get the Subnetwork named by key. -func (g *GCEAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) - return nil, fmt.Errorf("invalid GCE key (%#v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Get", - Version: meta.Version("alpha"), - Service: "Subnetworks", - Resource: key, - } - - klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Alpha.Subnetworks.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) - call.Context(ctx) - v, err := call.Do() - klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return v, err -} - -// List all Subnetwork objects. -func (g *GCEAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "List", - Version: meta.Version("alpha"), - Service: "Subnetworks", - Resource: key, - } - - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.Subnetworks.List(projectID, region) - if fl != filter.None { - call.Filter(fl.String()) - } - - var all []*computealpha.Subnetwork - f := func(l *computealpha.SubnetworkList) error { - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Insert Subnetwork with key of value obj. -func (g *GCEAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) - if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Insert", - Version: meta.Version("alpha"), - Service: "Subnetworks", - Resource: key, - } - klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - obj.Name = key.Name - call := g.s.Alpha.Subnetworks.Insert(projectID, key.Region, obj) - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err -} - -// Delete the Subnetwork referenced by key. -func (g *GCEAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Delete", - Version: meta.Version("alpha"), - Service: "Subnetworks", - Resource: key, - } - klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.Subnetworks.Delete(projectID, key.Region, key.Name) - - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// List all Usable Subnetwork objects. -func (g *GCEAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "ListUsable", - Version: meta.Version("alpha"), - Service: "Subnetworks", - Resource: &meta.Key{}, - } - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.Subnetworks.ListUsable(projectID) - if fl != filter.None { - call.Filter(fl.String()) - } - var all []*computealpha.UsableSubnetwork - f := func(l *computealpha.UsableSubnetworksAggregatedList) error { - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Patch is a method on GCEAlphaSubnetworks. -func (g *GCEAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "Subnetworks", - Resource: key, - } - klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// BetaSubnetworks is an interface that allows for mocking of Subnetworks. -type BetaSubnetworks interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) - Patch(context.Context, *meta.Key, *computebeta.Subnetwork, ...Option) error -} - -// NewMockBetaSubnetworks returns a new mock for Subnetworks. -func NewMockBetaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockBetaSubnetworks { - mock := &MockBetaSubnetworks{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockBetaSubnetworks is the mock for Subnetworks. -type MockBetaSubnetworks struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockSubnetworksObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - ListUsableError *error - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, *computebeta.Subnetwork, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.Subnetwork, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, m *MockBetaSubnetworks, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, error) - ListUsableHook func(ctx context.Context, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.UsableSubnetwork, error) - PatchHook func(context.Context, *meta.Key, *computebeta.Subnetwork, *MockBetaSubnetworks, ...Option) error - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} - -// Get returns the object from the mock. -func (m *MockBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { - if m.GetHook != nil { - if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) - return obj, err - } - } - if !key.Valid() { - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err - } - if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) - return typedObj, nil - } - - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), - } - klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err -} - -// List all of the objects in the mock in the given region. -func (m *MockBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { - if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) - - return nil, *m.ListError - } - - var objs []*computebeta.Subnetwork - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { - continue - } - objs = append(objs, obj.ToBeta()) - } - - klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) - return objs, nil -} - -// Insert is a mock for inserting/creating a new object. -func (m *MockBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } - opts := mergeOptions(options) - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - if _, ok := m.Objects[*key]; ok { - err := &googleapi.Error{ - Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaSubnetworks %v exists", key), - } - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - - obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "subnetworks") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "subnetworks", key) - - m.Objects[*key] = &MockSubnetworksObj{obj} - klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) - return nil -} - -// Delete is a mock for deleting the object. -func (m *MockBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - if m.DeleteHook != nil { - if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - } - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - if _, ok := m.Objects[*key]; !ok { - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), - } - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - delete(m.Objects, *key) - klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = nil", ctx, key) - return nil -} - -// List all of the objects in the mock. -func (m *MockBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { - if m.ListUsableHook != nil { - if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) - return nil, *m.ListError - } - - var objs []*computebeta.UsableSubnetwork - - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { - continue - } - betaObj := obj.ToBeta() - dest := &computebeta.UsableSubnetwork{} - // Convert to Usable type to avoid separate Usable struct - if err := copyViaJSON(dest, betaObj); err != nil { - klog.Errorf("Could not convert %T to *computebeta.UsableSubnetwork via JSON: %v", betaObj, err) - } - objs = append(objs, dest) - } - klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - -// Obj wraps the object for use in the mock. -func (m *MockBetaSubnetworks) Obj(o *computebeta.Subnetwork) *MockSubnetworksObj { - return &MockSubnetworksObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// GCEBetaSubnetworks is a simplifying adapter for the GCE Subnetworks. -type GCEBetaSubnetworks struct { - s *Service -} - -// Get the Subnetwork named by key. -func (g *GCEBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) - return nil, fmt.Errorf("invalid GCE key (%#v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Get", - Version: meta.Version("beta"), - Service: "Subnetworks", - Resource: key, - } - - klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.Beta.Subnetworks.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) - call.Context(ctx) - v, err := call.Do() - klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return v, err -} - -// List all Subnetwork objects. -func (g *GCEBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "List", - Version: meta.Version("beta"), - Service: "Subnetworks", - Resource: key, - } - - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.Subnetworks.List(projectID, region) - if fl != filter.None { - call.Filter(fl.String()) - } - - var all []*computebeta.Subnetwork - f := func(l *computebeta.SubnetworkList) error { - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Insert Subnetwork with key of value obj. -func (g *GCEBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) - if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Insert", - Version: meta.Version("beta"), - Service: "Subnetworks", - Resource: key, - } - klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - obj.Name = key.Name - call := g.s.Beta.Subnetworks.Insert(projectID, key.Region, obj) - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err -} - -// Delete the Subnetwork referenced by key. -func (g *GCEBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) - if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Delete", - Version: meta.Version("beta"), - Service: "Subnetworks", - Resource: key, - } - klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.Subnetworks.Delete(projectID, key.Region, key.Name) - - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// List all Usable Subnetwork objects. -func (g *GCEBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "ListUsable", - Version: meta.Version("beta"), - Service: "Subnetworks", - Resource: &meta.Key{}, - } - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.Subnetworks.ListUsable(projectID) - if fl != filter.None { - call.Filter(fl.String()) - } - var all []*computebeta.UsableSubnetwork - f := func(l *computebeta.UsableSubnetworksAggregatedList) error { - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Patch is a method on GCEBetaSubnetworks. -func (g *GCEBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "Subnetworks", - Resource: key, - } - klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// Subnetworks is an interface that allows for mocking of Subnetworks. -type Subnetworks interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error - Delete(ctx context.Context, key *meta.Key, options ...Option) error - ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) - Patch(context.Context, *meta.Key, *computega.Subnetwork, ...Option) error -} - -// NewMockSubnetworks returns a new mock for Subnetworks. -func NewMockSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockSubnetworks { - mock := &MockSubnetworks{ - ProjectRouter: pr, - - Objects: objs, - GetError: map[meta.Key]error{}, - InsertError: map[meta.Key]error{}, - DeleteError: map[meta.Key]error{}, - } - return mock -} - -// MockSubnetworks is the mock for Subnetworks. -type MockSubnetworks struct { - Lock sync.Mutex - - ProjectRouter ProjectRouter - - // Objects maintained by the mock. - Objects map[meta.Key]*MockSubnetworksObj - - // If an entry exists for the given key and operation, then the error - // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error - ListUsableError *error - - // xxxHook allow you to intercept the standard processing of the mock in - // order to add your own logic. Return (true, _, _) to prevent the normal - // execution flow of the mock. Return (false, nil, nil) to continue with - // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, *computega.Subnetwork, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.Subnetwork, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, m *MockSubnetworks, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, error) - ListUsableHook func(ctx context.Context, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.UsableSubnetwork, error) - PatchHook func(context.Context, *meta.Key, *computega.Subnetwork, *MockSubnetworks, ...Option) error - - // X is extra state that can be used as part of the mock. Generated code - // will not use this field. - X interface{} -} - -// Get returns the object from the mock. -func (m *MockSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { - if m.GetHook != nil { - if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) - return obj, err - } - } - if !key.Valid() { - return nil, fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err - } - if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) - return typedObj, nil - } - - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSubnetworks %v not found", key), - } - klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) - return nil, err -} - -// List all of the objects in the mock in the given region. -func (m *MockSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { - if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) - - return nil, *m.ListError - } - - var objs []*computega.Subnetwork - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToGA()) { - continue - } - objs = append(objs, obj.ToGA()) - } - - klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) - return objs, nil -} - -// Insert is a mock for inserting/creating a new object. -func (m *MockSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { - if m.InsertHook != nil { - if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - } - opts := mergeOptions(options) - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - if _, ok := m.Objects[*key]; ok { - err := &googleapi.Error{ - Code: http.StatusConflict, - Message: fmt.Sprintf("MockSubnetworks %v exists", key), - } - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) - return err - } - - obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "subnetworks") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "subnetworks", key) - - m.Objects[*key] = &MockSubnetworksObj{obj} - klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) - return nil -} - -// Delete is a mock for deleting the object. -func (m *MockSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { - if m.DeleteHook != nil { - if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - } - if !key.Valid() { - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - if _, ok := m.Objects[*key]; !ok { - err := &googleapi.Error{ - Code: http.StatusNotFound, - Message: fmt.Sprintf("MockSubnetworks %v not found", key), - } - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) - return err - } - - delete(m.Objects, *key) - klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = nil", ctx, key) - return nil -} - -// List all of the objects in the mock. -func (m *MockSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { - if m.ListUsableHook != nil { - if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) - return objs, err - } - } - - m.Lock.Lock() - defer m.Lock.Unlock() - - if m.ListError != nil { - err := *m.ListError - klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) - return nil, *m.ListError - } - - var objs []*computega.UsableSubnetwork - - for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { - continue - } - gaObj := obj.ToGA() - dest := &computega.UsableSubnetwork{} - // Convert to Usable type to avoid separate Usable struct - if err := copyViaJSON(dest, gaObj); err != nil { - klog.Errorf("Could not convert %T to *computega.UsableSubnetwork via JSON: %v", gaObj, err) - } - objs = append(objs, dest) - } - klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) - return objs, nil -} - -// Obj wraps the object for use in the mock. -func (m *MockSubnetworks) Obj(o *computega.Subnetwork) *MockSubnetworksObj { - return &MockSubnetworksObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// GCESubnetworks is a simplifying adapter for the GCE Subnetworks. -type GCESubnetworks struct { - s *Service -} - -// Get the Subnetwork named by key. -func (g *GCESubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Get(%v, %v, %v): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) - return nil, fmt.Errorf("invalid GCE key (%#v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Get", - Version: meta.Version("ga"), - Service: "Subnetworks", - Resource: key, - } - - klog.V(5).Infof("GCESubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) - return nil, err - } - call := g.s.GA.Subnetworks.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) - call.Context(ctx) - v, err := call.Do() - klog.V(4).Infof("GCESubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return v, err -} - -// List all Subnetwork objects. -func (g *GCESubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "List", - Version: meta.Version("ga"), - Service: "Subnetworks", - Resource: key, - } - - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.Subnetworks.List(projectID, region) - if fl != filter.None { - call.Filter(fl.String()) - } - - var all []*computega.Subnetwork - f := func(l *computega.SubnetworkList) error { - klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Insert Subnetwork with key of value obj. -func (g *GCESubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) - if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") - - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Insert", - Version: meta.Version("ga"), - Service: "Subnetworks", - Resource: key, - } - klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - obj.Name = key.Name - call := g.s.GA.Subnetworks.Insert(projectID, key.Region, obj) - call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - if err != nil { - return err - } - - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) - return err + g.s.RateLimiter.Observe(ctx, err, ck) + + return v, err } -// Delete the Subnetwork referenced by key. -func (g *GCESubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Insert SslPolicy with key of value obj. +func (g *GCERegionSslPolicies) Insert(ctx context.Context, key *meta.Key, obj *computega.SslPolicy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") + ck := &CallContextKey{ ProjectID: projectID, - Operation: "Delete", + Operation: "Insert", Version: meta.Version("ga"), - Service: "Subnetworks", - Resource: key, + Service: "RegionSslPolicies", } - klog.V(5).Infof("GCESubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Subnetworks.Delete(projectID, key.Region, key.Name) - + obj.Name = key.Name + call := g.s.GA.RegionSslPolicies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslPolicies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// List all Usable Subnetwork objects. -func (g *GCESubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { - opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "ListUsable", - Version: meta.Version("ga"), - Service: "Subnetworks", - Resource: &meta.Key{}, - } - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - return nil, err - } - - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.Subnetworks.ListUsable(projectID) - if fl != filter.None { - call.Filter(fl.String()) - } - var all []*computega.UsableSubnetwork - f := func(l *computega.UsableSubnetworksAggregatedList) error { - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) - all = append(all, l.Items...) - return nil - } - if err := call.Pages(ctx, f); err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) - return nil, err - } - callObserverEnd(ctx, ck, nil) - g.s.RateLimiter.Observe(ctx, nil, ck) - - if kLogEnabled(4) { - klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) - } else if kLogEnabled(5) { - var asStr []string - for _, o := range all { - asStr = append(asStr, fmt.Sprintf("%+v", o)) - } - klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) - } - - return all, nil -} - -// Patch is a method on GCESubnetworks. -func (g *GCESubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { +// Delete the SslPolicy referenced by key. +func (g *GCERegionSslPolicies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) - + klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionSslPolicies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionSslPolicies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", + Operation: "Delete", Version: meta.Version("ga"), - Service: "Subnetworks", - Resource: key, + Service: "RegionSslPolicies", } - klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionSslPolicies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.GA.RegionSslPolicies.Delete(projectID, key.Region, key.Name) + call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) + op, err := call.Do() - klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + if err != nil { + klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionSslPolicies.Delete(%v, %v) = %v", ctx, key, err) return err } -// AlphaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. -type AlphaTargetHttpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error +// AlphaSubnetworks is an interface that allows for mocking of Subnetworks. +type AlphaSubnetworks interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error + ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) + Patch(context.Context, *meta.Key, *computealpha.Subnetwork, ...Option) error } -// NewMockAlphaTargetHttpProxies returns a new mock for TargetHttpProxies. -func NewMockAlphaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockAlphaTargetHttpProxies { - mock := &MockAlphaTargetHttpProxies{ +// NewMockAlphaSubnetworks returns a new mock for Subnetworks. +func NewMockAlphaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockAlphaSubnetworks { + mock := &MockAlphaSubnetworks{ ProjectRouter: pr, Objects: objs, @@ -41305,31 +36730,33 @@ func NewMockAlphaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarg return mock } -// MockAlphaTargetHttpProxies is the mock for TargetHttpProxies. -type MockAlphaTargetHttpProxies struct { +// MockAlphaSubnetworks is the mock for Subnetworks. +type MockAlphaSubnetworks struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpProxiesObj + Objects map[meta.Key]*MockSubnetworksObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + ListUsableError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, *computealpha.Subnetwork, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.Subnetwork, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, m *MockAlphaSubnetworks, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaSubnetworks, options ...Option) (bool, error) + ListUsableHook func(ctx context.Context, fl *filter.F, m *MockAlphaSubnetworks, options ...Option) (bool, []*computealpha.UsableSubnetwork, error) + PatchHook func(context.Context, *meta.Key, *computealpha.Subnetwork, *MockAlphaSubnetworks, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -41337,10 +36764,10 @@ type MockAlphaTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +func (m *MockAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -41352,28 +36779,28 @@ func (m *MockAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -41383,28 +36810,31 @@ func (m *MockAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opt if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.TargetHttpProxy - for _, obj := range m.Objects { + var objs []*computealpha.Subnetwork + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToAlpha()) { continue } objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +func (m *MockAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -41417,32 +36847,32 @@ func (m *MockAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaSubnetworks %v exists", key), } - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "subnetworks") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "subnetworks", key) - m.Objects[*key] = &MockTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSubnetworksObj{obj} + klog.V(5).Infof("MockAlphaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -41454,71 +36884,105 @@ func (m *MockAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaSubnetworks %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaSubnetworks.Delete(%v, %v) = nil", ctx, key) return nil } +// List all of the objects in the mock. +func (m *MockAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { + if m.ListUsableHook != nil { + if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) + return nil, *m.ListError + } + + var objs []*computealpha.UsableSubnetwork + + for _, obj := range m.Objects { + if !fl.Match(obj.ToAlpha()) { + continue + } + alphaObj := obj.ToAlpha() + dest := &computealpha.UsableSubnetwork{} + // Convert to Usable type to avoid separate Usable struct + if err := copyViaJSON(dest, alphaObj); err != nil { + klog.Errorf("Could not convert %T to *computealpha.UsableSubnetwork via JSON: %v", alphaObj, err) + } + objs = append(objs, dest) + } + klog.V(5).Infof("MockAlphaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + // Obj wraps the object for use in the mock. -func (m *MockAlphaTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockTargetHttpProxiesObj { - return &MockTargetHttpProxiesObj{o} +func (m *MockAlphaSubnetworks) Obj(o *computealpha.Subnetwork) *MockSubnetworksObj { + return &MockSubnetworksObj{o} } -// SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { - if m.SetUrlMapHook != nil { - return m.SetUrlMapHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCEAlphaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. -type GCEAlphaTargetHttpProxies struct { +// GCEAlphaSubnetworks is a simplifying adapter for the GCE Subnetworks. +type GCEAlphaSubnetworks struct { s *Service } -// Get the TargetHttpProxy named by key. -func (g *GCEAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +// Get the Subnetwork named by key. +func (g *GCEAlphaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.Subnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.TargetHttpProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.Subnetworks.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -41526,34 +36990,32 @@ func (g *GCEAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opti return v, err } -// List all TargetHttpProxy objects. -func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +// List all Subnetwork objects. +func (g *GCEAlphaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.Subnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.TargetHttpProxies.List(projectID) + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.Subnetworks.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.TargetHttpProxy - f := func(l *computealpha.TargetHttpProxyList) error { - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.Subnetwork + f := func(l *computealpha.SubnetworkList) error { + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -41561,7 +37023,7 @@ func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opti callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -41569,138 +37031,182 @@ func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opti g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpProxy with key of value obj. -func (g *GCEAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +// Insert Subnetwork with key of value obj. +func (g *GCEAlphaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computealpha.Subnetwork, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.TargetHttpProxies.Insert(projectID, obj) + call := g.s.Alpha.Subnetworks.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpProxy referenced by key. -func (g *GCEAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Subnetwork referenced by key. +func (g *GCEAlphaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpProxies.Delete(projectID, key.Name) + call := g.s.Alpha.Subnetworks.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaTargetHttpProxies. -func (g *GCEAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// List all Usable Subnetwork objects. +func (g *GCEAlphaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UsableSubnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "ListUsable", + Version: meta.Version("alpha"), + Service: "Subnetworks", + } + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.Subnetworks.ListUsable(projectID) + if fl != filter.None { + call.Filter(fl.String()) + } + var all []*computealpha.UsableSubnetwork + f := func(l *computealpha.UsableSubnetworksAggregatedList) error { + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEAlphaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Patch is a method on GCEAlphaSubnetworks. +func (g *GCEAlphaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetUrlMap", + Operation: "Patch", Version: meta.Version("alpha"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Alpha.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -41708,22 +37214,23 @@ func (g *GCEAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. -type BetaTargetHttpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error +// BetaSubnetworks is an interface that allows for mocking of Subnetworks. +type BetaSubnetworks interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error + ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) + Patch(context.Context, *meta.Key, *computebeta.Subnetwork, ...Option) error } -// NewMockBetaTargetHttpProxies returns a new mock for TargetHttpProxies. -func NewMockBetaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockBetaTargetHttpProxies { - mock := &MockBetaTargetHttpProxies{ +// NewMockBetaSubnetworks returns a new mock for Subnetworks. +func NewMockBetaSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockBetaSubnetworks { + mock := &MockBetaSubnetworks{ ProjectRouter: pr, Objects: objs, @@ -41734,31 +37241,33 @@ func NewMockBetaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarge return mock } -// MockBetaTargetHttpProxies is the mock for TargetHttpProxies. -type MockBetaTargetHttpProxies struct { +// MockBetaSubnetworks is the mock for Subnetworks. +type MockBetaSubnetworks struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpProxiesObj + Objects map[meta.Key]*MockSubnetworksObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + ListUsableError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, *computebeta.Subnetwork, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.Subnetwork, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, m *MockBetaSubnetworks, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaSubnetworks, options ...Option) (bool, error) + ListUsableHook func(ctx context.Context, fl *filter.F, m *MockBetaSubnetworks, options ...Option) (bool, []*computebeta.UsableSubnetwork, error) + PatchHook func(context.Context, *meta.Key, *computebeta.Subnetwork, *MockBetaSubnetworks, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -41766,10 +37275,10 @@ type MockBetaTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +func (m *MockBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -41781,28 +37290,28 @@ func (m *MockBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -41812,28 +37321,31 @@ func (m *MockBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, opti if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.TargetHttpProxy - for _, obj := range m.Objects { + var objs []*computebeta.Subnetwork + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +func (m *MockBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -41846,32 +37358,32 @@ func (m *MockBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockBetaSubnetworks %v exists", key), } - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "subnetworks") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "subnetworks", key) - m.Objects[*key] = &MockTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSubnetworksObj{obj} + klog.V(5).Infof("MockBetaSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -41883,71 +37395,105 @@ func (m *MockBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaSubnetworks %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaSubnetworks.Delete(%v, %v) = nil", ctx, key) return nil } +// List all of the objects in the mock. +func (m *MockBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { + if m.ListUsableHook != nil { + if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) + return nil, *m.ListError + } + + var objs []*computebeta.UsableSubnetwork + + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { + continue + } + betaObj := obj.ToBeta() + dest := &computebeta.UsableSubnetwork{} + // Convert to Usable type to avoid separate Usable struct + if err := copyViaJSON(dest, betaObj); err != nil { + klog.Errorf("Could not convert %T to *computebeta.UsableSubnetwork via JSON: %v", betaObj, err) + } + objs = append(objs, dest) + } + klog.V(5).Infof("MockBetaSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + // Obj wraps the object for use in the mock. -func (m *MockBetaTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockTargetHttpProxiesObj { - return &MockTargetHttpProxiesObj{o} +func (m *MockBetaSubnetworks) Obj(o *computebeta.Subnetwork) *MockSubnetworksObj { + return &MockSubnetworksObj{o} } -// SetUrlMap is a mock for the corresponding method. -func (m *MockBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { - if m.SetUrlMapHook != nil { - return m.SetUrlMapHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCEBetaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. -type GCEBetaTargetHttpProxies struct { +// GCEBetaSubnetworks is a simplifying adapter for the GCE Subnetworks. +type GCEBetaSubnetworks struct { s *Service } -// Get the TargetHttpProxy named by key. -func (g *GCEBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +// Get the Subnetwork named by key. +func (g *GCEBetaSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.Subnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.TargetHttpProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.Subnetworks.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaSubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -41955,34 +37501,32 @@ func (g *GCEBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, optio return v, err } -// List all TargetHttpProxy objects. -func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +// List all Subnetwork objects. +func (g *GCEBetaSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.Subnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.TargetHttpProxies.List(projectID) + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.Subnetworks.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.TargetHttpProxy - f := func(l *computebeta.TargetHttpProxyList) error { - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.Subnetwork + f := func(l *computebeta.SubnetworkList) error { + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -41990,7 +37534,7 @@ func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, optio callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -41998,138 +37542,182 @@ func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, optio g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaSubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpProxy with key of value obj. -func (g *GCEBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +// Insert Subnetwork with key of value obj. +func (g *GCEBetaSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computebeta.Subnetwork, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.TargetHttpProxies.Insert(projectID, obj) + call := g.s.Beta.Subnetworks.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaSubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpProxy referenced by key. -func (g *GCEBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Subnetwork referenced by key. +func (g *GCEBetaSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaSubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpProxies.Delete(projectID, key.Name) + call := g.s.Beta.Subnetworks.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaTargetHttpProxies. -func (g *GCEBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// List all Usable Subnetwork objects. +func (g *GCEBetaSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UsableSubnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "ListUsable", + Version: meta.Version("beta"), + Service: "Subnetworks", + } + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.Subnetworks.ListUsable(projectID) + if fl != filter.None { + call.Filter(fl.String()) + } + var all []*computebeta.UsableSubnetwork + f := func(l *computebeta.UsableSubnetworksAggregatedList) error { + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) + + if kLogEnabled(4) { + klog.V(4).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCEBetaSubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + } + + return all, nil +} + +// Patch is a method on GCEBetaSubnetworks. +func (g *GCEBetaSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.Subnetwork, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaSubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetUrlMap", + Operation: "Patch", Version: meta.Version("beta"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Beta.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -42137,22 +37725,23 @@ func (g *GCEBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaSubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// TargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. -type TargetHttpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error +// Subnetworks is an interface that allows for mocking of Subnetworks. +type Subnetworks interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error + ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) + Patch(context.Context, *meta.Key, *computega.Subnetwork, ...Option) error } -// NewMockTargetHttpProxies returns a new mock for TargetHttpProxies. -func NewMockTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockTargetHttpProxies { - mock := &MockTargetHttpProxies{ +// NewMockSubnetworks returns a new mock for Subnetworks. +func NewMockSubnetworks(pr ProjectRouter, objs map[meta.Key]*MockSubnetworksObj) *MockSubnetworks { + mock := &MockSubnetworks{ ProjectRouter: pr, Objects: objs, @@ -42163,31 +37752,33 @@ func NewMockTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHtt return mock } -// MockTargetHttpProxies is the mock for TargetHttpProxies. -type MockTargetHttpProxies struct { +// MockSubnetworks is the mock for Subnetworks. +type MockSubnetworks struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpProxiesObj + Objects map[meta.Key]*MockSubnetworksObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. - GetError map[meta.Key]error - ListError *error - InsertError map[meta.Key]error - DeleteError map[meta.Key]error + GetError map[meta.Key]error + ListError *error + InsertError map[meta.Key]error + DeleteError map[meta.Key]error + ListUsableError *error // xxxHook allow you to intercept the standard processing of the mock in // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, *computega.Subnetwork, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.Subnetwork, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, m *MockSubnetworks, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockSubnetworks, options ...Option) (bool, error) + ListUsableHook func(ctx context.Context, fl *filter.F, m *MockSubnetworks, options ...Option) (bool, []*computega.UsableSubnetwork, error) + PatchHook func(context.Context, *meta.Key, *computega.Subnetwork, *MockSubnetworks, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -42195,10 +37786,10 @@ type MockTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +func (m *MockSubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -42210,28 +37801,28 @@ func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockSubnetworks %v not found", key), } - klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockSubnetworks.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockSubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -42241,28 +37832,31 @@ func (m *MockTargetHttpProxies) List(ctx context.Context, fl *filter.F, options if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.TargetHttpProxy - for _, obj := range m.Objects { + var objs []*computega.Subnetwork + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockSubnetworks.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +func (m *MockSubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -42275,32 +37869,32 @@ func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj * defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockSubnetworks %v exists", key), } - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "subnetworks") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "subnetworks", key) - m.Objects[*key] = &MockTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockSubnetworksObj{obj} + klog.V(5).Infof("MockSubnetworks.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockSubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -42312,71 +37906,105 @@ func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockSubnetworks %v not found", key), } - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockSubnetworks.Delete(%v, %v) = nil", ctx, key) return nil } +// List all of the objects in the mock. +func (m *MockSubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { + if m.ListUsableHook != nil { + if intercept, objs, err := m.ListUsableHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + return objs, err + } + } + + m.Lock.Lock() + defer m.Lock.Unlock() + + if m.ListError != nil { + err := *m.ListError + klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = nil, %v", ctx, fl, err) + return nil, *m.ListError + } + + var objs []*computega.UsableSubnetwork + + for _, obj := range m.Objects { + if !fl.Match(obj.ToGA()) { + continue + } + gaObj := obj.ToGA() + dest := &computega.UsableSubnetwork{} + // Convert to Usable type to avoid separate Usable struct + if err := copyViaJSON(dest, gaObj); err != nil { + klog.Errorf("Could not convert %T to *computega.UsableSubnetwork via JSON: %v", gaObj, err) + } + objs = append(objs, dest) + } + klog.V(5).Infof("MockSubnetworks.ListUsable(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + return objs, nil +} + // Obj wraps the object for use in the mock. -func (m *MockTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockTargetHttpProxiesObj { - return &MockTargetHttpProxiesObj{o} +func (m *MockSubnetworks) Obj(o *computega.Subnetwork) *MockSubnetworksObj { + return &MockSubnetworksObj{o} } -// SetUrlMap is a mock for the corresponding method. -func (m *MockTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { - if m.SetUrlMapHook != nil { - return m.SetUrlMapHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockSubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCETargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. -type GCETargetHttpProxies struct { +// GCESubnetworks is a simplifying adapter for the GCE Subnetworks. +type GCESubnetworks struct { s *Service } -// Get the TargetHttpProxy named by key. -func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +// Get the Subnetwork named by key. +func (g *GCESubnetworks) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.Subnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESubnetworks.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESubnetworks.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESubnetworks.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESubnetworks.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetHttpProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.Subnetworks.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCESubnetworks.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -42384,34 +38012,32 @@ func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key, options . return v, err } -// List all TargetHttpProxy objects. -func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +// List all Subnetwork objects. +func (g *GCESubnetworks) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.Subnetwork, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.TargetHttpProxies.List(projectID) + klog.V(5).Infof("GCESubnetworks.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.Subnetworks.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetHttpProxy - f := func(l *computega.TargetHttpProxyList) error { - klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.Subnetwork + f := func(l *computega.SubnetworkList) error { + klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -42419,7 +38045,7 @@ func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options . callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -42427,138 +38053,182 @@ func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options . g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCESubnetworks.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCESubnetworks.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpProxy with key of value obj. -func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +// Insert Subnetwork with key of value obj. +func (g *GCESubnetworks) Insert(ctx context.Context, key *meta.Key, obj *computega.Subnetwork, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESubnetworks.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESubnetworks.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.TargetHttpProxies.Insert(projectID, obj) + call := g.s.GA.Subnetworks.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCESubnetworks.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpProxy referenced by key. -func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the Subnetwork referenced by key. +func (g *GCESubnetworks) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCESubnetworks.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCESubnetworks.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESubnetworks.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESubnetworks.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.Subnetworks.Delete(projectID, key.Region, key.Name) + + call.Context(ctx) + + op, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpProxies.Delete(projectID, key.Name) - - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCESubnetworks.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// List all Usable Subnetwork objects. +func (g *GCESubnetworks) ListUsable(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UsableSubnetwork, error) { + opts := mergeOptions(options) + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "ListUsable", + Version: meta.Version("ga"), + Service: "Subnetworks", + } + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + return nil, err + } + + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.Subnetworks.ListUsable(projectID) + if fl != filter.None { + call.Filter(fl.String()) + } + var all []*computega.UsableSubnetwork + f := func(l *computega.UsableSubnetworksAggregatedList) error { + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v): page %+v", ctx, fl, l) + all = append(all, l.Items...) + return nil + } + if err := call.Pages(ctx, f); err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + return nil, err + } + callObserverEnd(ctx, ck, nil) + g.s.RateLimiter.Observe(ctx, nil, ck) - if err != nil { - return err + if kLogEnabled(4) { + klog.V(4).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + } else if kLogEnabled(5) { + var asStr []string + for _, o := range all { + asStr = append(asStr, fmt.Sprintf("%+v", o)) + } + klog.V(5).Infof("GCESubnetworks.ListUsable(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } - err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) - return err + return all, nil } -// SetUrlMap is a method on GCETargetHttpProxies. -func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// Patch is a method on GCESubnetworks. +func (g *GCESubnetworks) Patch(ctx context.Context, key *meta.Key, arg0 *computega.Subnetwork, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCESubnetworks.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Subnetworks") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetUrlMap", + Operation: "Patch", Version: meta.Version("ga"), - Service: "TargetHttpProxies", - Resource: key, + Service: "Subnetworks", } - klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCESubnetworks.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.GA.Subnetworks.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -42566,22 +38236,22 @@ func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCESubnetworks.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. -type AlphaRegionTargetHttpProxies interface { +// AlphaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. +type AlphaTargetHttpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockAlphaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. -func NewMockAlphaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockAlphaRegionTargetHttpProxies { - mock := &MockAlphaRegionTargetHttpProxies{ +// NewMockAlphaTargetHttpProxies returns a new mock for TargetHttpProxies. +func NewMockAlphaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockAlphaTargetHttpProxies { + mock := &MockAlphaTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -42592,14 +38262,14 @@ func NewMockAlphaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*Mo return mock } -// MockAlphaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. -type MockAlphaRegionTargetHttpProxies struct { +// MockAlphaTargetHttpProxies is the mock for TargetHttpProxies. +type MockAlphaTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpProxiesObj + Objects map[meta.Key]*MockTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -42612,11 +38282,11 @@ type MockAlphaRegionTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -42624,10 +38294,10 @@ type MockAlphaRegionTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +func (m *MockAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -42639,28 +38309,28 @@ func (m *MockAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +// List all of the objects in the mock. +func (m *MockAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -42670,31 +38340,28 @@ func (m *MockAlphaRegionTargetHttpProxies) List(ctx context.Context, region stri if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } var objs []*computealpha.TargetHttpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } + for _, obj := range m.Objects { if !fl.Match(obj.ToAlpha()) { continue } objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +func (m *MockAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -42707,15 +38374,15 @@ func (m *MockAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -42723,16 +38390,16 @@ func (m *MockAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockAlphaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -42744,71 +38411,69 @@ func (m *MockAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { - return &MockRegionTargetHttpProxiesObj{o} +func (m *MockAlphaTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockTargetHttpProxiesObj { + return &MockTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +func (m *MockAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEAlphaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. -type GCEAlphaRegionTargetHttpProxies struct { +// GCEAlphaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. +type GCEAlphaTargetHttpProxies struct { s *Service } // Get the TargetHttpProxy named by key. -func (g *GCEAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { +func (g *GCEAlphaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.TargetHttpProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -42817,33 +38482,31 @@ func (g *GCEAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key } // List all TargetHttpProxy objects. -func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { +func (g *GCEAlphaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionTargetHttpProxies.List(projectID, region) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.TargetHttpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } var all []*computealpha.TargetHttpProxy f := func(l *computealpha.TargetHttpProxyList) error { - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -42851,7 +38514,7 @@ func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region strin callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -42859,138 +38522,132 @@ func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region strin g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpProxy with key of value obj. -func (g *GCEAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { +func (g *GCEAlphaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) + call := g.s.Alpha.TargetHttpProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpProxy referenced by key. -func (g *GCEAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetHttpProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaRegionTargetHttpProxies. -func (g *GCEAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEAlphaTargetHttpProxies. +func (g *GCEAlphaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", Version: meta.Version("alpha"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -42998,22 +38655,22 @@ func (g *GCEAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *me callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. -type BetaRegionTargetHttpProxies interface { +// BetaTargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. +type BetaTargetHttpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockBetaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. -func NewMockBetaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockBetaRegionTargetHttpProxies { - mock := &MockBetaRegionTargetHttpProxies{ +// NewMockBetaTargetHttpProxies returns a new mock for TargetHttpProxies. +func NewMockBetaTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockBetaTargetHttpProxies { + mock := &MockBetaTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -43024,14 +38681,14 @@ func NewMockBetaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*Moc return mock } -// MockBetaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. -type MockBetaRegionTargetHttpProxies struct { +// MockBetaTargetHttpProxies is the mock for TargetHttpProxies. +type MockBetaTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpProxiesObj + Objects map[meta.Key]*MockTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -43044,11 +38701,11 @@ type MockBetaRegionTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -43056,10 +38713,10 @@ type MockBetaRegionTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +func (m *MockBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -43071,28 +38728,28 @@ func (m *MockBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +// List all of the objects in the mock. +func (m *MockBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -43102,31 +38759,28 @@ func (m *MockBetaRegionTargetHttpProxies) List(ctx context.Context, region strin if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } var objs []*computebeta.TargetHttpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } + for _, obj := range m.Objects { if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +func (m *MockBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -43139,15 +38793,15 @@ func (m *MockBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockBetaTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -43155,16 +38809,16 @@ func (m *MockBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta. projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockBetaTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -43176,71 +38830,69 @@ func (m *MockBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaRegionTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { - return &MockRegionTargetHttpProxiesObj{o} +func (m *MockBetaTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockTargetHttpProxiesObj { + return &MockTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +func (m *MockBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEBetaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. -type GCEBetaRegionTargetHttpProxies struct { +// GCEBetaTargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. +type GCEBetaTargetHttpProxies struct { s *Service } // Get the TargetHttpProxy named by key. -func (g *GCEBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { +func (g *GCEBetaTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.TargetHttpProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -43249,33 +38901,31 @@ func (g *GCEBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, } // List all TargetHttpProxy objects. -func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { +func (g *GCEBetaTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionTargetHttpProxies.List(projectID, region) + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.TargetHttpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } var all []*computebeta.TargetHttpProxy f := func(l *computebeta.TargetHttpProxyList) error { - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -43283,7 +38933,7 @@ func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -43291,138 +38941,132 @@ func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpProxy with key of value obj. -func (g *GCEBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { +func (g *GCEBetaTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) + call := g.s.Beta.TargetHttpProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpProxy referenced by key. -func (g *GCEBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.TargetHttpProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaRegionTargetHttpProxies. -func (g *GCEBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEBetaTargetHttpProxies. +func (g *GCEBetaTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", Version: meta.Version("beta"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -43430,22 +39074,22 @@ func (g *GCEBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *met callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// RegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. -type RegionTargetHttpProxies interface { +// TargetHttpProxies is an interface that allows for mocking of TargetHttpProxies. +type TargetHttpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. -func NewMockRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockRegionTargetHttpProxies { - mock := &MockRegionTargetHttpProxies{ +// NewMockTargetHttpProxies returns a new mock for TargetHttpProxies. +func NewMockTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpProxiesObj) *MockTargetHttpProxies { + mock := &MockTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -43456,14 +39100,14 @@ func NewMockRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockReg return mock } -// MockRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. -type MockRegionTargetHttpProxies struct { +// MockTargetHttpProxies is the mock for TargetHttpProxies. +type MockTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpProxiesObj + Objects map[meta.Key]*MockTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -43476,11 +39120,11 @@ type MockRegionTargetHttpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -43488,10 +39132,10 @@ type MockRegionTargetHttpProxies struct { } // Get returns the object from the mock. -func (m *MockRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +func (m *MockTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -43503,28 +39147,28 @@ func (m *MockRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +// List all of the objects in the mock. +func (m *MockTargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -43534,31 +39178,28 @@ func (m *MockRegionTargetHttpProxies) List(ctx context.Context, region string, f if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } var objs []*computega.TargetHttpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } + for _, obj := range m.Objects { if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockTargetHttpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +func (m *MockTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -43571,15 +39212,15 @@ func (m *MockRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionTargetHttpProxies %v exists", key), + Message: fmt.Sprintf("MockTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -43587,16 +39228,16 @@ func (m *MockRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} - klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -43608,71 +39249,69 @@ func (m *MockRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { - return &MockRegionTargetHttpProxiesObj{o} +func (m *MockTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockTargetHttpProxiesObj { + return &MockTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +func (m *MockTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCERegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. -type GCERegionTargetHttpProxies struct { +// GCETargetHttpProxies is a simplifying adapter for the GCE TargetHttpProxies. +type GCETargetHttpProxies struct { s *Service } // Get the TargetHttpProxy named by key. -func (g *GCERegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { +func (g *GCETargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.TargetHttpProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -43681,33 +39320,31 @@ func (g *GCERegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, opt } // List all TargetHttpProxy objects. -func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { +func (g *GCETargetHttpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionTargetHttpProxies.List(projectID, region) + klog.V(5).Infof("GCETargetHttpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.TargetHttpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } var all []*computega.TargetHttpProxy f := func(l *computega.TargetHttpProxyList) error { - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -43715,7 +39352,7 @@ func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -43723,138 +39360,132 @@ func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpProxy with key of value obj. -func (g *GCERegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { +func (g *GCETargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) + call := g.s.GA.TargetHttpProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCETargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpProxy referenced by key. -func (g *GCERegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCETargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.GA.TargetHttpProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCERegionTargetHttpProxies. -func (g *GCERegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCETargetHttpProxies. +func (g *GCETargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", Version: meta.Version("ga"), - Service: "RegionTargetHttpProxies", - Resource: key, + Service: "TargetHttpProxies", } - klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetHttpProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -43862,25 +39493,22 @@ func (g *GCERegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Ke callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// TargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. -type TargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error +// AlphaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. +type AlphaRegionTargetHttpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetCertificateMap(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetSslPolicy(context.Context, *meta.Key, *computega.SslPolicyReference, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockTargetHttpsProxies returns a new mock for TargetHttpsProxies. -func NewMockTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockTargetHttpsProxies { - mock := &MockTargetHttpsProxies{ +// NewMockAlphaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. +func NewMockAlphaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockAlphaRegionTargetHttpProxies { + mock := &MockAlphaRegionTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -43891,14 +39519,14 @@ func NewMockTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHt return mock } -// MockTargetHttpsProxies is the mock for TargetHttpsProxies. -type MockTargetHttpsProxies struct { +// MockAlphaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. +type MockAlphaRegionTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpsProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -43911,14 +39539,11 @@ type MockTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, error) - SetCertificateMapHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, *MockTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, *MockTargetHttpsProxies, ...Option) error - SetSslPolicyHook func(context.Context, *meta.Key, *computega.SslPolicyReference, *MockTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, *computealpha.TargetHttpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, []*computealpha.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -43926,10 +39551,10 @@ type MockTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +func (m *MockAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -43941,28 +39566,28 @@ func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -43972,28 +39597,31 @@ func (m *MockTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.TargetHttpsProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToGA()) { + var objs []*computealpha.TargetHttpProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToGA()) + if !fl.Match(obj.ToAlpha()) { + continue + } + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +func (m *MockAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -44006,32 +39634,32 @@ func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -44043,95 +39671,69 @@ func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockTargetHttpsProxiesObj { - return &MockTargetHttpsProxiesObj{o} -} - -// SetCertificateMap is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - if m.SetCertificateMapHook != nil { - return m.SetCertificateMapHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslCertificates is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - if m.SetSslCertificatesHook != nil { - return m.SetSslCertificatesHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslPolicy is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { - if m.SetSslPolicyHook != nil { - return m.SetSslPolicyHook(ctx, key, arg0, m) - } - return nil +func (m *MockAlphaRegionTargetHttpProxies) Obj(o *computealpha.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { + return &MockRegionTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +func (m *MockAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCETargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. -type GCETargetHttpsProxies struct { +// GCEAlphaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. +type GCEAlphaRegionTargetHttpProxies struct { s *Service } -// Get the TargetHttpsProxy named by key. -func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +// Get the TargetHttpProxy named by key. +func (g *GCEAlphaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetHttpsProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -44139,34 +39741,32 @@ func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options return v, err } -// List all TargetHttpsProxy objects. -func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +// List all TargetHttpProxy objects. +func (g *GCEAlphaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.TargetHttpsProxies.List(projectID) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionTargetHttpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetHttpsProxy - f := func(l *computega.TargetHttpsProxyList) error { - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.TargetHttpProxy + f := func(l *computealpha.TargetHttpProxyList) error { + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -44174,7 +39774,7 @@ func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -44182,270 +39782,132 @@ func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpsProxy with key of value obj. -func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +// Insert TargetHttpProxy with key of value obj. +func (g *GCEAlphaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.TargetHttpsProxies.Insert(projectID, obj) + call := g.s.Alpha.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpsProxy referenced by key. -func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpProxy referenced by key. +func (g *GCEAlphaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpsProxies.Delete(projectID, key.Name) + call := g.s.Alpha.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// SetCertificateMap is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetCertificateMap", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslCertificates is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslCertificates", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslPolicy is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslPolicy", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.GA.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCETargetHttpsProxies. -func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEAlphaRegionTargetHttpProxies. +func (g *GCEAlphaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("ga"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Alpha.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -44453,26 +39915,22 @@ func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, ar callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. -type AlphaTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error +// BetaRegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. +type BetaRegionTargetHttpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, ...Option) error - SetCertificateMap(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetSslPolicy(context.Context, *meta.Key, *computealpha.SslPolicyReference, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockAlphaTargetHttpsProxies returns a new mock for TargetHttpsProxies. -func NewMockAlphaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockAlphaTargetHttpsProxies { - mock := &MockAlphaTargetHttpsProxies{ +// NewMockBetaRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. +func NewMockBetaRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockBetaRegionTargetHttpProxies { + mock := &MockBetaRegionTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -44483,14 +39941,14 @@ func NewMockAlphaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTar return mock } -// MockAlphaTargetHttpsProxies is the mock for TargetHttpsProxies. -type MockAlphaTargetHttpsProxies struct { +// MockBetaRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. +type MockBetaRegionTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpsProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -44503,15 +39961,11 @@ type MockAlphaTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, *MockAlphaTargetHttpsProxies, ...Option) error - SetCertificateMapHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, *MockAlphaTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaTargetHttpsProxies, ...Option) error - SetSslPolicyHook func(context.Context, *meta.Key, *computealpha.SslPolicyReference, *MockAlphaTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, *computebeta.TargetHttpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, []*computebeta.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -44519,10 +39973,10 @@ type MockAlphaTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +func (m *MockBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -44534,28 +39988,28 @@ func (m *MockAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -44565,28 +40019,31 @@ func (m *MockAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, op if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.TargetHttpsProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToAlpha()) { + var objs []*computebeta.TargetHttpProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToAlpha()) + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +func (m *MockBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -44599,32 +40056,32 @@ func (m *MockAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpProxies", key) - m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -44636,103 +40093,69 @@ func (m *MockAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockTargetHttpsProxiesObj { - return &MockTargetHttpsProxiesObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// SetCertificateMap is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - if m.SetCertificateMapHook != nil { - return m.SetCertificateMapHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslCertificates is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - if m.SetSslCertificatesHook != nil { - return m.SetSslCertificatesHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslPolicy is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { - if m.SetSslPolicyHook != nil { - return m.SetSslPolicyHook(ctx, key, arg0, m) - } - return nil +func (m *MockBetaRegionTargetHttpProxies) Obj(o *computebeta.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { + return &MockRegionTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +func (m *MockBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEAlphaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. -type GCEAlphaTargetHttpsProxies struct { +// GCEBetaRegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. +type GCEBetaRegionTargetHttpProxies struct { s *Service } -// Get the TargetHttpsProxy named by key. -func (g *GCEAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +// Get the TargetHttpProxy named by key. +func (g *GCEBetaRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.TargetHttpsProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -44740,34 +40163,32 @@ func (g *GCEAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, opt return v, err } -// List all TargetHttpsProxy objects. -func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +// List all TargetHttpProxy objects. +func (g *GCEBetaRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.TargetHttpsProxies.List(projectID) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionTargetHttpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.TargetHttpsProxy - f := func(l *computealpha.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.TargetHttpProxy + f := func(l *computebeta.TargetHttpProxyList) error { + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -44775,7 +40196,7 @@ func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opt callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -44783,314 +40204,132 @@ func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opt g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpsProxy with key of value obj. -func (g *GCEAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +// Insert TargetHttpProxy with key of value obj. +func (g *GCEBetaRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.TargetHttpsProxies.Insert(projectID, obj) + call := g.s.Beta.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpsProxy referenced by key. -func (g *GCEAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpProxy referenced by key. +func (g *GCEBetaRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpsProxies.Delete(projectID, key.Name) + call := g.s.Beta.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// Patch is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.TargetHttpsProxies.Patch(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetCertificateMap is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetCertificateMap", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslCertificates is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslCertificates", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslPolicy is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslPolicy", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Alpha.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaTargetHttpsProxies. -func (g *GCEAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCEBetaRegionTargetHttpProxies. +func (g *GCEBetaRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("alpha"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.Beta.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -45098,26 +40337,22 @@ func (g *GCEAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Ke callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. -type BetaTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error +// RegionTargetHttpProxies is an interface that allows for mocking of RegionTargetHttpProxies. +type RegionTargetHttpProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, ...Option) error - SetCertificateMap(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetSslPolicy(context.Context, *meta.Key, *computebeta.SslPolicyReference, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockBetaTargetHttpsProxies returns a new mock for TargetHttpsProxies. -func NewMockBetaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockBetaTargetHttpsProxies { - mock := &MockBetaTargetHttpsProxies{ +// NewMockRegionTargetHttpProxies returns a new mock for RegionTargetHttpProxies. +func NewMockRegionTargetHttpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpProxiesObj) *MockRegionTargetHttpProxies { + mock := &MockRegionTargetHttpProxies{ ProjectRouter: pr, Objects: objs, @@ -45128,14 +40363,14 @@ func NewMockBetaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTarg return mock } -// MockBetaTargetHttpsProxies is the mock for TargetHttpsProxies. -type MockBetaTargetHttpsProxies struct { +// MockRegionTargetHttpProxies is the mock for RegionTargetHttpProxies. +type MockRegionTargetHttpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetHttpsProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -45148,15 +40383,11 @@ type MockBetaTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, *MockBetaTargetHttpsProxies, ...Option) error - SetCertificateMapHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, *MockBetaTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, *MockBetaTargetHttpsProxies, ...Option) error - SetSslPolicyHook func(context.Context, *meta.Key, *computebeta.SslPolicyReference, *MockBetaTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, *computega.TargetHttpProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpProxies, options ...Option) (bool, []*computega.TargetHttpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpProxies, options ...Option) (bool, error) + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -45164,10 +40395,10 @@ type MockBetaTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +func (m *MockRegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -45179,28 +40410,28 @@ func (m *MockBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockRegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -45210,28 +40441,31 @@ func (m *MockBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opt if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.TargetHttpsProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { + var objs []*computega.TargetHttpProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToBeta()) + if !fl.Match(obj.ToGA()) { + continue + } + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRegionTargetHttpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +func (m *MockRegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -45244,32 +40478,32 @@ func (m *MockBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockRegionTargetHttpProxies %v exists", key), } - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) - - m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpProxies", key) + + m.Objects[*key] = &MockRegionTargetHttpProxiesObj{obj} + klog.V(5).Infof("MockRegionTargetHttpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -45281,103 +40515,69 @@ func (m *MockBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionTargetHttpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockTargetHttpsProxiesObj { - return &MockTargetHttpsProxiesObj{o} -} - -// Patch is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) - } - return nil -} - -// SetCertificateMap is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - if m.SetCertificateMapHook != nil { - return m.SetCertificateMapHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslCertificates is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - if m.SetSslCertificatesHook != nil { - return m.SetSslCertificatesHook(ctx, key, arg0, m) - } - return nil -} - -// SetSslPolicy is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { - if m.SetSslPolicyHook != nil { - return m.SetSslPolicyHook(ctx, key, arg0, m) - } - return nil +func (m *MockRegionTargetHttpProxies) Obj(o *computega.TargetHttpProxy) *MockRegionTargetHttpProxiesObj { + return &MockRegionTargetHttpProxiesObj{o} } // SetUrlMap is a mock for the corresponding method. -func (m *MockBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +func (m *MockRegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEBetaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. -type GCEBetaTargetHttpsProxies struct { +// GCERegionTargetHttpProxies is a simplifying adapter for the GCE RegionTargetHttpProxies. +type GCERegionTargetHttpProxies struct { s *Service } -// Get the TargetHttpsProxy named by key. -func (g *GCEBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +// Get the TargetHttpProxy named by key. +func (g *GCERegionTargetHttpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.TargetHttpsProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.RegionTargetHttpProxies.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -45385,34 +40585,32 @@ func (g *GCEBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, opti return v, err } -// List all TargetHttpsProxy objects. -func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +// List all TargetHttpProxy objects. +func (g *GCERegionTargetHttpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.TargetHttpsProxies.List(projectID) + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionTargetHttpProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.TargetHttpsProxy - f := func(l *computebeta.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetHttpProxy + f := func(l *computega.TargetHttpProxyList) error { + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -45420,7 +40618,7 @@ func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opti callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -45428,314 +40626,132 @@ func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, opti g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegionTargetHttpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetHttpsProxy with key of value obj. -func (g *GCEBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +// Insert TargetHttpProxy with key of value obj. +func (g *GCERegionTargetHttpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.TargetHttpsProxies.Insert(projectID, obj) + call := g.s.GA.RegionTargetHttpProxies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetHttpsProxy referenced by key. -func (g *GCEBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpProxy referenced by key. +func (g *GCERegionTargetHttpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpsProxies.Delete(projectID, key.Name) + call := g.s.GA.RegionTargetHttpProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) - return err -} - -// Patch is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.TargetHttpsProxies.Patch(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetCertificateMap is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetCertificateMap", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslCertificates is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslCertificates", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) - return err -} - -// SetSslPolicy is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { - opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) - - if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) - return fmt.Errorf("invalid GCE key (%+v)", key) - } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") - ck := &CallContextKey{ - ProjectID: projectID, - Operation: "SetSslPolicy", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, - } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) - callObserverStart(ctx, ck) - if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) - return err - } - call := g.s.Beta.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) - call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) - op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) - - if err != nil { - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) - - return err - } - - err = g.s.WaitForCompletion(ctx, op) - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) // XXX - - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaTargetHttpsProxies. -func (g *GCEBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// SetUrlMap is a method on GCERegionTargetHttpProxies. +func (g *GCERegionTargetHttpProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("beta"), - Service: "TargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpProxies", } - klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) + call := g.s.GA.RegionTargetHttpProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -45743,24 +40759,25 @@ func (g *GCEBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. -type AlphaRegionTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error +// TargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. +type TargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error + SetCertificateMap(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetSslPolicy(context.Context, *meta.Key, *computega.SslPolicyReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockAlphaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. -func NewMockAlphaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockAlphaRegionTargetHttpsProxies { - mock := &MockAlphaRegionTargetHttpsProxies{ +// NewMockTargetHttpsProxies returns a new mock for TargetHttpsProxies. +func NewMockTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockTargetHttpsProxies { + mock := &MockTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -45771,14 +40788,14 @@ func NewMockAlphaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*M return mock } -// MockAlphaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. -type MockAlphaRegionTargetHttpsProxies struct { +// MockTargetHttpsProxies is the mock for TargetHttpsProxies. +type MockTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj + Objects map[meta.Key]*MockTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -45791,13 +40808,14 @@ type MockAlphaRegionTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, *MockAlphaRegionTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaRegionTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetHttpsProxies, options ...Option) (bool, error) + SetCertificateMapHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetCertificateMapRequest, *MockTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computega.TargetHttpsProxiesSetSslCertificatesRequest, *MockTargetHttpsProxies, ...Option) error + SetSslPolicyHook func(context.Context, *meta.Key, *computega.SslPolicyReference, *MockTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -45805,10 +40823,10 @@ type MockAlphaRegionTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +func (m *MockTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -45820,28 +40838,28 @@ func (m *MockAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +// List all of the objects in the mock. +func (m *MockTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -45851,31 +40869,28 @@ func (m *MockAlphaRegionTargetHttpsProxies) List(ctx context.Context, region str if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computealpha.TargetHttpsProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToAlpha()) { + var objs []*computega.TargetHttpsProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToGA()) { continue } - objs = append(objs, obj.ToAlpha()) + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +func (m *MockTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -45888,32 +40903,32 @@ func (m *MockAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *met defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -45925,87 +40940,93 @@ func (m *MockAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *met defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { - return &MockRegionTargetHttpsProxiesObj{o} +func (m *MockTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockTargetHttpsProxiesObj { + return &MockTargetHttpsProxiesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// SetCertificateMap is a mock for the corresponding method. +func (m *MockTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + if m.SetCertificateMapHook != nil { + return m.SetCertificateMapHook(ctx, key, arg0, m) } return nil } // SetSslCertificates is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +func (m *MockTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { if m.SetSslCertificatesHook != nil { return m.SetSslCertificatesHook(ctx, key, arg0, m) } return nil } +// SetSslPolicy is a mock for the corresponding method. +func (m *MockTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { + if m.SetSslPolicyHook != nil { + return m.SetSslPolicyHook(ctx, key, arg0, m) + } + return nil +} + // SetUrlMap is a mock for the corresponding method. -func (m *MockAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +func (m *MockTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEAlphaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. -type GCEAlphaRegionTargetHttpsProxies struct { +// GCETargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. +type GCETargetHttpsProxies struct { s *Service } // Get the TargetHttpsProxy named by key. -func (g *GCEAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { +func (g *GCETargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.TargetHttpsProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -46014,33 +41035,31 @@ func (g *GCEAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Ke } // List all TargetHttpsProxy objects. -func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { +func (g *GCETargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionTargetHttpsProxies.List(projectID, region) + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.TargetHttpsProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.TargetHttpsProxy - f := func(l *computealpha.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetHttpsProxy + f := func(l *computega.TargetHttpsProxyList) error { + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -46048,7 +41067,7 @@ func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region stri callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -46056,138 +41075,132 @@ func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region stri g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpsProxy with key of value obj. -func (g *GCEAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { +func (g *GCETargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) + call := g.s.GA.TargetHttpsProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCETargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpsProxy referenced by key. -func (g *GCEAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCETargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) + call := g.s.GA.TargetHttpsProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// Patch is a method on GCEAlphaRegionTargetHttpsProxies. -func (g *GCEAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { +// SetCertificateMap is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Operation: "SetCertificateMap", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46195,43 +41208,41 @@ func (g *GCEAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta. callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetSslCertificates is a method on GCEAlphaRegionTargetHttpsProxies. -func (g *GCEAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +// SetSslCertificates is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetSslCertificates", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46239,43 +41250,83 @@ func (g *GCEAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Contex callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetUrlMap is a method on GCEAlphaRegionTargetHttpsProxies. -func (g *GCEAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { +// SetSslPolicy is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computega.SslPolicyReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslPolicy", + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", + } + klog.V(5).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCETargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCETargetHttpsProxies. +func (g *GCETargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("alpha"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.GA.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46283,24 +41334,25 @@ func (g *GCEAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *m callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. -type BetaRegionTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error +// AlphaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. +type AlphaTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error + SetCertificateMap(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetSslPolicy(context.Context, *meta.Key, *computealpha.SslPolicyReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockBetaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. -func NewMockBetaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockBetaRegionTargetHttpsProxies { - mock := &MockBetaRegionTargetHttpsProxies{ +// NewMockAlphaTargetHttpsProxies returns a new mock for TargetHttpsProxies. +func NewMockAlphaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockAlphaTargetHttpsProxies { + mock := &MockAlphaTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -46311,14 +41363,14 @@ func NewMockBetaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*Mo return mock } -// MockBetaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. -type MockBetaRegionTargetHttpsProxies struct { +// MockAlphaTargetHttpsProxies is the mock for TargetHttpsProxies. +type MockAlphaTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj + Objects map[meta.Key]*MockTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -46331,13 +41383,14 @@ type MockBetaRegionTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, *MockBetaRegionTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockBetaRegionTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetHttpsProxies, options ...Option) (bool, error) + SetCertificateMapHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetCertificateMapRequest, *MockAlphaTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaTargetHttpsProxies, ...Option) error + SetSslPolicyHook func(context.Context, *meta.Key, *computealpha.SslPolicyReference, *MockAlphaTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -46345,10 +41398,10 @@ type MockBetaRegionTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +func (m *MockAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -46360,28 +41413,28 @@ func (m *MockBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Ke defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +// List all of the objects in the mock. +func (m *MockAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -46391,31 +41444,28 @@ func (m *MockBetaRegionTargetHttpsProxies) List(ctx context.Context, region stri if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computebeta.TargetHttpsProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToBeta()) { + var objs []*computealpha.TargetHttpsProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToBeta()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +func (m *MockAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -46428,32 +41478,32 @@ func (m *MockBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -46465,87 +41515,93 @@ func (m *MockBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaRegionTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { - return &MockRegionTargetHttpsProxiesObj{o} +func (m *MockAlphaTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockTargetHttpsProxiesObj { + return &MockTargetHttpsProxiesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// SetCertificateMap is a mock for the corresponding method. +func (m *MockAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + if m.SetCertificateMapHook != nil { + return m.SetCertificateMapHook(ctx, key, arg0, m) } return nil } // SetSslCertificates is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +func (m *MockAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { if m.SetSslCertificatesHook != nil { return m.SetSslCertificatesHook(ctx, key, arg0, m) } return nil } +// SetSslPolicy is a mock for the corresponding method. +func (m *MockAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { + if m.SetSslPolicyHook != nil { + return m.SetSslPolicyHook(ctx, key, arg0, m) + } + return nil +} + // SetUrlMap is a mock for the corresponding method. -func (m *MockBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +func (m *MockAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCEBetaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. -type GCEBetaRegionTargetHttpsProxies struct { +// GCEAlphaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. +type GCEAlphaTargetHttpsProxies struct { s *Service } // Get the TargetHttpsProxy named by key. -func (g *GCEBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { +func (g *GCEAlphaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.TargetHttpsProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -46554,33 +41610,31 @@ func (g *GCEBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key } // List all TargetHttpsProxy objects. -func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { +func (g *GCEAlphaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionTargetHttpsProxies.List(projectID, region) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.TargetHttpsProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.TargetHttpsProxy - f := func(l *computebeta.TargetHttpsProxyList) error { - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.TargetHttpsProxy + f := func(l *computealpha.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -46588,7 +41642,7 @@ func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region strin callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -46596,138 +41650,132 @@ func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region strin g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpsProxy with key of value obj. -func (g *GCEBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { +func (g *GCEAlphaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) + call := g.s.Alpha.TargetHttpsProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpsProxy referenced by key. -func (g *GCEBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetHttpsProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// Patch is a method on GCEBetaRegionTargetHttpsProxies. -func (g *GCEBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { +// SetCertificateMap is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Operation: "SetCertificateMap", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46735,43 +41783,41 @@ func (g *GCEBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.K callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetSslCertificates is a method on GCEBetaRegionTargetHttpsProxies. -func (g *GCEBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +// SetSslCertificates is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetSslCertificates", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46779,43 +41825,83 @@ func (g *GCEBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetUrlMap is a method on GCEBetaRegionTargetHttpsProxies. -func (g *GCEBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { +// SetSslPolicy is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computealpha.SslPolicyReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslPolicy", + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", + } + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCEAlphaTargetHttpsProxies. +func (g *GCEAlphaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("beta"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("alpha"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -46823,24 +41909,25 @@ func (g *GCEBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *me callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// RegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. -type RegionTargetHttpsProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error +// BetaTargetHttpsProxies is an interface that allows for mocking of TargetHttpsProxies. +type BetaTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - Patch(context.Context, *meta.Key, *computega.TargetHttpsProxy, ...Option) error - SetSslCertificates(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error - SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error + SetCertificateMap(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetSslPolicy(context.Context, *meta.Key, *computebeta.SslPolicyReference, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. -func NewMockRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockRegionTargetHttpsProxies { - mock := &MockRegionTargetHttpsProxies{ +// NewMockBetaTargetHttpsProxies returns a new mock for TargetHttpsProxies. +func NewMockBetaTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetHttpsProxiesObj) *MockBetaTargetHttpsProxies { + mock := &MockBetaTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -46851,14 +41938,14 @@ func NewMockRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRe return mock } -// MockRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. -type MockRegionTargetHttpsProxies struct { +// MockBetaTargetHttpsProxies is the mock for TargetHttpsProxies. +type MockBetaTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj + Objects map[meta.Key]*MockTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -46871,13 +41958,14 @@ type MockRegionTargetHttpsProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) - PatchHook func(context.Context, *meta.Key, *computega.TargetHttpsProxy, *MockRegionTargetHttpsProxies, ...Option) error - SetSslCertificatesHook func(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockRegionTargetHttpsProxies, ...Option) error - SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpsProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetHttpsProxies, options ...Option) (bool, error) + SetCertificateMapHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetCertificateMapRequest, *MockBetaTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, *MockBetaTargetHttpsProxies, ...Option) error + SetSslPolicyHook func(context.Context, *meta.Key, *computebeta.SslPolicyReference, *MockBetaTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -46885,10 +41973,10 @@ type MockRegionTargetHttpsProxies struct { } // Get returns the object from the mock. -func (m *MockRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +func (m *MockBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -46900,28 +41988,28 @@ func (m *MockRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +// List all of the objects in the mock. +func (m *MockBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -46931,31 +42019,28 @@ func (m *MockRegionTargetHttpsProxies) List(ctx context.Context, region string, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } - var objs []*computega.TargetHttpsProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } - if !fl.Match(obj.ToGA()) { + var objs []*computebeta.TargetHttpsProxy + for _, obj := range m.Objects { + if !fl.Match(obj.ToBeta()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaTargetHttpsProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +func (m *MockBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -46968,32 +42053,32 @@ func (m *MockRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v exists", key), + Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} - klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockBetaTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -47005,87 +42090,93 @@ func (m *MockRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { - return &MockRegionTargetHttpsProxiesObj{o} +func (m *MockBetaTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockTargetHttpsProxiesObj { + return &MockTargetHttpsProxiesObj{o} } -// Patch is a mock for the corresponding method. -func (m *MockRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { - if m.PatchHook != nil { - return m.PatchHook(ctx, key, arg0, m) +// SetCertificateMap is a mock for the corresponding method. +func (m *MockBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { + if m.SetCertificateMapHook != nil { + return m.SetCertificateMapHook(ctx, key, arg0, m) } return nil } // SetSslCertificates is a mock for the corresponding method. -func (m *MockRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +func (m *MockBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { if m.SetSslCertificatesHook != nil { return m.SetSslCertificatesHook(ctx, key, arg0, m) } return nil } +// SetSslPolicy is a mock for the corresponding method. +func (m *MockBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { + if m.SetSslPolicyHook != nil { + return m.SetSslPolicyHook(ctx, key, arg0, m) + } + return nil +} + // SetUrlMap is a mock for the corresponding method. -func (m *MockRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +func (m *MockBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { if m.SetUrlMapHook != nil { return m.SetUrlMapHook(ctx, key, arg0, m) } return nil } -// GCERegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. -type GCERegionTargetHttpsProxies struct { +// GCEBetaTargetHttpsProxies is a simplifying adapter for the GCE TargetHttpsProxies. +type GCEBetaTargetHttpsProxies struct { s *Service } // Get the TargetHttpsProxy named by key. -func (g *GCERegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { +func (g *GCEBetaTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.TargetHttpsProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -47094,33 +42185,31 @@ func (g *GCERegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, op } // List all TargetHttpsProxy objects. -func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { +func (g *GCEBetaTargetHttpsProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionTargetHttpsProxies.List(projectID, region) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.TargetHttpsProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetHttpsProxy - f := func(l *computega.TargetHttpsProxyList) error { - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.TargetHttpsProxy + f := func(l *computebeta.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -47128,7 +42217,7 @@ func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, f callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -47136,138 +42225,132 @@ func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, f g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetHttpsProxy with key of value obj. -func (g *GCERegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { +func (g *GCEBetaTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) + call := g.s.Beta.TargetHttpsProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetHttpsProxy referenced by key. -func (g *GCERegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.TargetHttpsProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// Patch is a method on GCERegionTargetHttpsProxies. -func (g *GCERegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { +// SetCertificateMap is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetCertificateMap(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetCertificateMapRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Patch", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Operation: "SetCertificateMap", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.TargetHttpsProxies.SetCertificateMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47275,43 +42358,41 @@ func (g *GCERegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetCertificateMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetSslCertificates is a method on GCERegionTargetHttpsProxies. -func (g *GCERegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { +// SetSslCertificates is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetSslCertificates", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.TargetHttpsProxies.SetSslCertificates(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47319,43 +42400,83 @@ func (g *GCERegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, ke callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetUrlMap is a method on GCERegionTargetHttpsProxies. -func (g *GCERegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { +// SetSslPolicy is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetSslPolicy(ctx context.Context, key *meta.Key, arg0 *computebeta.SslPolicyReference, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslPolicy", + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", + } + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.TargetHttpsProxies.SetSslPolicy(projectID, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetSslPolicy(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCEBetaTargetHttpsProxies. +func (g *GCEBetaTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "SetUrlMap", - Version: meta.Version("ga"), - Service: "RegionTargetHttpsProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "TargetHttpsProxies", } - klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call := g.s.Beta.TargetHttpsProxies.SetUrlMap(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47363,23 +42484,24 @@ func (g *GCERegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.K callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) return err } -// TargetPools is an interface that allows for mocking of TargetPools. -type TargetPools interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error +// AlphaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. +type AlphaRegionTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - AddInstance(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, ...Option) error - RemoveInstance(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, ...Option) error + Patch(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computealpha.UrlMapReference, ...Option) error } -// NewMockTargetPools returns a new mock for TargetPools. -func NewMockTargetPools(pr ProjectRouter, objs map[meta.Key]*MockTargetPoolsObj) *MockTargetPools { - mock := &MockTargetPools{ +// NewMockAlphaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. +func NewMockAlphaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockAlphaRegionTargetHttpsProxies { + mock := &MockAlphaRegionTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -47390,14 +42512,14 @@ func NewMockTargetPools(pr ProjectRouter, objs map[meta.Key]*MockTargetPoolsObj) return mock } -// MockTargetPools is the mock for TargetPools. -type MockTargetPools struct { +// MockAlphaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. +type MockAlphaRegionTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetPoolsObj + Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -47410,12 +42532,13 @@ type MockTargetPools struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, *computega.TargetPool, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockTargetPools, options ...Option) (bool, []*computega.TargetPool, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetPool, m *MockTargetPools, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, error) - AddInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, *MockTargetPools, ...Option) error - RemoveInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, *MockTargetPools, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, *computealpha.TargetHttpsProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, []*computealpha.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computealpha.TargetHttpsProxy, *MockAlphaRegionTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockAlphaRegionTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computealpha.UrlMapReference, *MockAlphaRegionTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -47423,10 +42546,10 @@ type MockTargetPools struct { } // Get returns the object from the mock. -func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { +func (m *MockAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -47438,28 +42561,28 @@ func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key, options ...Opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToAlpha() + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetPools %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } // List all of the objects in the mock in the given region. -func (m *MockTargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { +func (m *MockAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { if m.ListHook != nil { if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -47469,31 +42592,31 @@ func (m *MockTargetPools) List(ctx context.Context, region string, fl *filter.F, if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.TargetPool + var objs []*computealpha.TargetHttpsProxy for key, obj := range m.Objects { if key.Region != region { continue } - if !fl.Match(obj.ToGA()) { + if !fl.Match(obj.ToAlpha()) { continue } - objs = append(objs, obj.ToGA()) + objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { +func (m *MockAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -47506,32 +42629,32 @@ func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *comput defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetPools %v exists", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetPools") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetPools", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockTargetPoolsObj{obj} - klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -47543,79 +42666,85 @@ func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key, options ... defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetPools %v not found", key), + Message: fmt.Sprintf("MockAlphaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockTargetPools) Obj(o *computega.TargetPool) *MockTargetPoolsObj { - return &MockTargetPoolsObj{o} +func (m *MockAlphaRegionTargetHttpsProxies) Obj(o *computealpha.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { + return &MockRegionTargetHttpsProxiesObj{o} } -// AddInstance is a mock for the corresponding method. -func (m *MockTargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { - if m.AddInstanceHook != nil { - return m.AddInstanceHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// RemoveInstance is a mock for the corresponding method. -func (m *MockTargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { - if m.RemoveInstanceHook != nil { - return m.RemoveInstanceHook(ctx, key, arg0, m) +// SetSslCertificates is a mock for the corresponding method. +func (m *MockAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + if m.SetSslCertificatesHook != nil { + return m.SetSslCertificatesHook(ctx, key, arg0, m) } return nil } -// GCETargetPools is a simplifying adapter for the GCE TargetPools. -type GCETargetPools struct { +// SetUrlMap is a mock for the corresponding method. +func (m *MockAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { + if m.SetUrlMapHook != nil { + return m.SetUrlMapHook(ctx, key, arg0, m) + } + return nil +} + +// GCEAlphaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. +type GCEAlphaRegionTargetHttpsProxies struct { s *Service } -// Get the TargetPool named by key. -func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { +// Get the TargetHttpsProxy named by key. +func (g *GCEAlphaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("ga"), - Service: "TargetPools", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCETargetPools.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetPools.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetPools.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -47623,34 +42752,32 @@ func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key, options ...Opti return v, err } -// List all TargetPool objects. -func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { +// List all TargetHttpsProxy objects. +func (g *GCEAlphaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("ga"), - Service: "TargetPools", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetPools.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.TargetPools.List(projectID, region) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Alpha.RegionTargetHttpsProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetPool - f := func(l *computega.TargetPoolList) error { - klog.V(5).Infof("GCETargetPools.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computealpha.TargetHttpsProxy + f := func(l *computealpha.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -47658,7 +42785,7 @@ func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -47666,138 +42793,132 @@ func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetPool with key of value obj. -func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { +// Insert TargetHttpsProxy with key of value obj. +func (g *GCEAlphaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("ga"), - Service: "TargetPools", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCETargetPools.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.TargetPools.Insert(projectID, key.Region, obj) + call := g.s.Alpha.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetPools.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetPool referenced by key. -func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpsProxy referenced by key. +func (g *GCEAlphaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("ga"), - Service: "TargetPools", - Resource: key, + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCETargetPools.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetPools.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// AddInstance is a method on GCETargetPools. -func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { +// Patch is a method on GCEAlphaRegionTargetHttpsProxies. +func (g *GCEAlphaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "AddInstance", - Version: meta.Version("ga"), - Service: "TargetPools", - Resource: key, + Operation: "Patch", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetPools.AddInstance(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47805,43 +42926,41 @@ func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *c callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// RemoveInstance is a method on GCETargetPools. -func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { +// SetSslCertificates is a method on GCEAlphaRegionTargetHttpsProxies. +func (g *GCEAlphaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computealpha.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "RemoveInstance", - Version: meta.Version("ga"), - Service: "TargetPools", - Resource: key, + Operation: "SetSslCertificates", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetPools.RemoveInstance(projectID, key.Region, key.Name, arg0) + call := g.s.Alpha.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -47849,22 +42968,66 @@ func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. -type AlphaTargetTcpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error +// SetUrlMap is a method on GCEAlphaRegionTargetHttpsProxies. +func (g *GCEAlphaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computealpha.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetUrlMap", + Version: meta.Version("alpha"), + Service: "RegionTargetHttpsProxies", + } + klog.V(5).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// BetaRegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. +type BetaRegionTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetBackendService(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, ...Option) error + Patch(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computebeta.UrlMapReference, ...Option) error } -// NewMockAlphaTargetTcpProxies returns a new mock for TargetTcpProxies. -func NewMockAlphaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockAlphaTargetTcpProxies { - mock := &MockAlphaTargetTcpProxies{ +// NewMockBetaRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. +func NewMockBetaRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockBetaRegionTargetHttpsProxies { + mock := &MockBetaRegionTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -47875,14 +43038,14 @@ func NewMockAlphaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarge return mock } -// MockAlphaTargetTcpProxies is the mock for TargetTcpProxies. -type MockAlphaTargetTcpProxies struct { +// MockBetaRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. +type MockBetaRegionTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetTcpProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -47895,11 +43058,13 @@ type MockAlphaTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, *computealpha.TargetTcpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetTcpProxies, options ...Option) (bool, []*computealpha.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) - SetBackendServiceHook func(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, *MockAlphaTargetTcpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, *computebeta.TargetHttpsProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, []*computebeta.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computebeta.TargetHttpsProxy, *MockBetaRegionTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockBetaRegionTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computebeta.UrlMapReference, *MockBetaRegionTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -47907,10 +43072,10 @@ type MockAlphaTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { +func (m *MockBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -47922,28 +43087,28 @@ func (m *MockAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, opti defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToBeta() + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -47953,28 +43118,31 @@ func (m *MockAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, opti if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computealpha.TargetTcpProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToAlpha()) { + var objs []*computebeta.TargetHttpsProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToAlpha()) + if !fl.Match(obj.ToBeta()) { + continue + } + objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { +func (m *MockBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -47987,32 +43155,32 @@ func (m *MockAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetTcpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetTcpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -48024,71 +43192,85 @@ func (m *MockAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, o defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaTargetTcpProxies) Obj(o *computealpha.TargetTcpProxy) *MockTargetTcpProxiesObj { - return &MockTargetTcpProxiesObj{o} +func (m *MockBetaRegionTargetHttpsProxies) Obj(o *computebeta.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { + return &MockRegionTargetHttpsProxiesObj{o} } -// SetBackendService is a mock for the corresponding method. -func (m *MockAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - if m.SetBackendServiceHook != nil { - return m.SetBackendServiceHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCEAlphaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. -type GCEAlphaTargetTcpProxies struct { +// SetSslCertificates is a mock for the corresponding method. +func (m *MockBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + if m.SetSslCertificatesHook != nil { + return m.SetSslCertificatesHook(ctx, key, arg0, m) + } + return nil +} + +// SetUrlMap is a mock for the corresponding method. +func (m *MockBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { + if m.SetUrlMapHook != nil { + return m.SetUrlMapHook(ctx, key, arg0, m) + } + return nil +} + +// GCEBetaRegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. +type GCEBetaRegionTargetHttpsProxies struct { s *Service } -// Get the TargetTcpProxy named by key. -func (g *GCEAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { +// Get the TargetHttpsProxy named by key. +func (g *GCEBetaRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("alpha"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.TargetTcpProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -48096,34 +43278,32 @@ func (g *GCEAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, optio return v, err } -// List all TargetTcpProxy objects. -func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { +// List all TargetHttpsProxy objects. +func (g *GCEBetaRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("alpha"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Alpha.TargetTcpProxies.List(projectID) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.Beta.RegionTargetHttpsProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computealpha.TargetTcpProxy - f := func(l *computealpha.TargetTcpProxyList) error { - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computebeta.TargetHttpsProxy + f := func(l *computebeta.TargetHttpsProxyList) error { + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -48131,7 +43311,7 @@ func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, optio callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -48139,138 +43319,132 @@ func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, optio g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetTcpProxy with key of value obj. -func (g *GCEAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { +// Insert TargetHttpsProxy with key of value obj. +func (g *GCEBetaRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("alpha"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.TargetTcpProxies.Insert(projectID, obj) + call := g.s.Beta.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetTcpProxy referenced by key. -func (g *GCEAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpsProxy referenced by key. +func (g *GCEBetaRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("alpha"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetTcpProxies.Delete(projectID, key.Name) + call := g.s.Beta.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetBackendService is a method on GCEAlphaTargetTcpProxies. -func (g *GCEAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { +// Patch is a method on GCEBetaRegionTargetHttpsProxies. +func (g *GCEBetaRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetBackendService", - Version: meta.Version("alpha"), - Service: "TargetTcpProxies", - Resource: key, + Operation: "Patch", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) + call := g.s.Beta.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -48278,22 +43452,108 @@ func (g *GCEAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *m callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. -type BetaTargetTcpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error +// SetSslCertificates is a method on GCEBetaRegionTargetHttpsProxies. +func (g *GCEBetaRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computebeta.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslCertificates", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + } + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCEBetaRegionTargetHttpsProxies. +func (g *GCEBetaRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computebeta.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetUrlMap", + Version: meta.Version("beta"), + Service: "RegionTargetHttpsProxies", + } + klog.V(5).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaRegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// RegionTargetHttpsProxies is an interface that allows for mocking of RegionTargetHttpsProxies. +type RegionTargetHttpsProxies interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetBackendService(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, ...Option) error + Patch(context.Context, *meta.Key, *computega.TargetHttpsProxy, ...Option) error + SetSslCertificates(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, ...Option) error + SetUrlMap(context.Context, *meta.Key, *computega.UrlMapReference, ...Option) error } -// NewMockBetaTargetTcpProxies returns a new mock for TargetTcpProxies. -func NewMockBetaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockBetaTargetTcpProxies { - mock := &MockBetaTargetTcpProxies{ +// NewMockRegionTargetHttpsProxies returns a new mock for RegionTargetHttpsProxies. +func NewMockRegionTargetHttpsProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetHttpsProxiesObj) *MockRegionTargetHttpsProxies { + mock := &MockRegionTargetHttpsProxies{ ProjectRouter: pr, Objects: objs, @@ -48304,14 +43564,14 @@ func NewMockBetaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTarget return mock } -// MockBetaTargetTcpProxies is the mock for TargetTcpProxies. -type MockBetaTargetTcpProxies struct { +// MockRegionTargetHttpsProxies is the mock for RegionTargetHttpsProxies. +type MockRegionTargetHttpsProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetTcpProxiesObj + Objects map[meta.Key]*MockRegionTargetHttpsProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -48324,11 +43584,13 @@ type MockBetaTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, *computebeta.TargetTcpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetTcpProxies, options ...Option) (bool, []*computebeta.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) - SetBackendServiceHook func(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, *MockBetaTargetTcpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, *computega.TargetHttpsProxy, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetHttpsProxies, options ...Option) (bool, []*computega.TargetHttpsProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetHttpsProxies, options ...Option) (bool, error) + PatchHook func(context.Context, *meta.Key, *computega.TargetHttpsProxy, *MockRegionTargetHttpsProxies, ...Option) error + SetSslCertificatesHook func(context.Context, *meta.Key, *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, *MockRegionTargetHttpsProxies, ...Option) error + SetUrlMapHook func(context.Context, *meta.Key, *computega.UrlMapReference, *MockRegionTargetHttpsProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -48336,10 +43598,10 @@ type MockBetaTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { +func (m *MockRegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -48351,28 +43613,28 @@ func (m *MockBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, optio defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { - typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + typedObj := obj.ToGA() + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockRegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -48382,28 +43644,31 @@ func (m *MockBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, optio if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computebeta.TargetTcpProxy - for _, obj := range m.Objects { - if !fl.Match(obj.ToBeta()) { + var objs []*computega.TargetHttpsProxy + for key, obj := range m.Objects { + if key.Region != region { continue } - objs = append(objs, obj.ToBeta()) + if !fl.Match(obj.ToGA()) { + continue + } + objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockRegionTargetHttpsProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { +func (m *MockRegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -48416,32 +43681,32 @@ func (m *MockBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, ob defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v exists", key), } - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetTcpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetTcpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetHttpsProxies") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetHttpsProxies", key) - m.Objects[*key] = &MockTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockRegionTargetHttpsProxiesObj{obj} + klog.V(5).Infof("MockRegionTargetHttpsProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockRegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -48453,71 +43718,85 @@ func (m *MockBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, op defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockRegionTargetHttpsProxies %v not found", key), } - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockRegionTargetHttpsProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaTargetTcpProxies) Obj(o *computebeta.TargetTcpProxy) *MockTargetTcpProxiesObj { - return &MockTargetTcpProxiesObj{o} +func (m *MockRegionTargetHttpsProxies) Obj(o *computega.TargetHttpsProxy) *MockRegionTargetHttpsProxiesObj { + return &MockRegionTargetHttpsProxiesObj{o} } -// SetBackendService is a mock for the corresponding method. -func (m *MockBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - if m.SetBackendServiceHook != nil { - return m.SetBackendServiceHook(ctx, key, arg0, m) +// Patch is a mock for the corresponding method. +func (m *MockRegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { + if m.PatchHook != nil { + return m.PatchHook(ctx, key, arg0, m) } return nil } -// GCEBetaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. -type GCEBetaTargetTcpProxies struct { +// SetSslCertificates is a mock for the corresponding method. +func (m *MockRegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + if m.SetSslCertificatesHook != nil { + return m.SetSslCertificatesHook(ctx, key, arg0, m) + } + return nil +} + +// SetUrlMap is a mock for the corresponding method. +func (m *MockRegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { + if m.SetUrlMapHook != nil { + return m.SetUrlMapHook(ctx, key, arg0, m) + } + return nil +} + +// GCERegionTargetHttpsProxies is a simplifying adapter for the GCE RegionTargetHttpsProxies. +type GCERegionTargetHttpsProxies struct { s *Service } -// Get the TargetTcpProxy named by key. -func (g *GCEBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { +// Get the TargetHttpsProxy named by key. +func (g *GCERegionTargetHttpsProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", - Version: meta.Version("beta"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.TargetTcpProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.RegionTargetHttpsProxies.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -48525,34 +43804,32 @@ func (g *GCEBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, option return v, err } -// List all TargetTcpProxy objects. -func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { +// List all TargetHttpsProxy objects. +func (g *GCERegionTargetHttpsProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetHttpsProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", - Version: meta.Version("beta"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.Beta.TargetTcpProxies.List(projectID) + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.RegionTargetHttpsProxies.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computebeta.TargetTcpProxy - f := func(l *computebeta.TargetTcpProxyList) error { - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetHttpsProxy + f := func(l *computega.TargetHttpsProxyList) error { + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -48560,7 +43837,7 @@ func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, option callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -48568,138 +43845,132 @@ func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, option g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCERegionTargetHttpsProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetTcpProxy with key of value obj. -func (g *GCEBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { +// Insert TargetHttpsProxy with key of value obj. +func (g *GCERegionTargetHttpsProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", - Version: meta.Version("beta"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.TargetTcpProxies.Insert(projectID, obj) + call := g.s.GA.RegionTargetHttpsProxies.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } -// Delete the TargetTcpProxy referenced by key. -func (g *GCEBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// Delete the TargetHttpsProxy referenced by key. +func (g *GCERegionTargetHttpsProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", - Version: meta.Version("beta"), - Service: "TargetTcpProxies", - Resource: key, + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetTcpProxies.Delete(projectID, key.Name) + call := g.s.GA.RegionTargetHttpsProxies.Delete(projectID, key.Region, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Delete(%v, %v) = %v", ctx, key, err) return err } -// SetBackendService is a method on GCEBetaTargetTcpProxies. -func (g *GCEBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { +// Patch is a method on GCERegionTargetHttpsProxies. +func (g *GCERegionTargetHttpsProxies) Patch(ctx context.Context, key *meta.Key, arg0 *computega.TargetHttpsProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetBackendService", - Version: meta.Version("beta"), - Service: "TargetTcpProxies", - Resource: key, + Operation: "Patch", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", } - klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) + call := g.s.GA.RegionTargetHttpsProxies.Patch(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -48707,22 +43978,107 @@ func (g *GCEBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *me callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCERegionTargetHttpsProxies.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } -// TargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. -type TargetTcpProxies interface { - Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) - List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) - Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error +// SetSslCertificates is a method on GCERegionTargetHttpsProxies. +func (g *GCERegionTargetHttpsProxies) SetSslCertificates(ctx context.Context, key *meta.Key, arg0 *computega.RegionTargetHttpsProxiesSetSslCertificatesRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetSslCertificates", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + } + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.RegionTargetHttpsProxies.SetSslCertificates(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetSslCertificates(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// SetUrlMap is a method on GCERegionTargetHttpsProxies. +func (g *GCERegionTargetHttpsProxies) SetUrlMap(ctx context.Context, key *meta.Key, arg0 *computega.UrlMapReference, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetHttpsProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetUrlMap", + Version: meta.Version("ga"), + Service: "RegionTargetHttpsProxies", + } + klog.V(5).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.RegionTargetHttpsProxies.SetUrlMap(projectID, key.Region, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCERegionTargetHttpsProxies.SetUrlMap(%v, %v, ...) = %+v", ctx, key, err) + return err +} + +// TargetPools is an interface that allows for mocking of TargetPools. +type TargetPools interface { + Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) + List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) + Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error - SetBackendService(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, ...Option) error + AddInstance(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, ...Option) error + RemoveInstance(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, ...Option) error } -// NewMockTargetTcpProxies returns a new mock for TargetTcpProxies. -func NewMockTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockTargetTcpProxies { - mock := &MockTargetTcpProxies{ +// NewMockTargetPools returns a new mock for TargetPools. +func NewMockTargetPools(pr ProjectRouter, objs map[meta.Key]*MockTargetPoolsObj) *MockTargetPools { + mock := &MockTargetPools{ ProjectRouter: pr, Objects: objs, @@ -48733,14 +44089,14 @@ func NewMockTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpP return mock } -// MockTargetTcpProxies is the mock for TargetTcpProxies. -type MockTargetTcpProxies struct { +// MockTargetPools is the mock for TargetPools. +type MockTargetPools struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockTargetTcpProxiesObj + Objects map[meta.Key]*MockTargetPoolsObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -48753,11 +44109,12 @@ type MockTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, *computega.TargetTcpProxy, error) - ListHook func(ctx context.Context, fl *filter.F, m *MockTargetTcpProxies, options ...Option) (bool, []*computega.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, m *MockTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, error) - SetBackendServiceHook func(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, *MockTargetTcpProxies, ...Option) error + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, *computega.TargetPool, error) + ListHook func(ctx context.Context, region string, fl *filter.F, m *MockTargetPools, options ...Option) (bool, []*computega.TargetPool, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetPool, m *MockTargetPools, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetPools, options ...Option) (bool, error) + AddInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsAddInstanceRequest, *MockTargetPools, ...Option) error + RemoveInstanceHook func(context.Context, *meta.Key, *computega.TargetPoolsRemoveInstanceRequest, *MockTargetPools, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -48765,10 +44122,10 @@ type MockTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { +func (m *MockTargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -48780,28 +44137,28 @@ func (m *MockTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options . defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetPools %v not found", key), } - klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock. -func (m *MockTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { +// List all of the objects in the mock in the given region. +func (m *MockTargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { + klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) return objs, err } } @@ -48811,28 +44168,31 @@ func (m *MockTargetTcpProxies) List(ctx context.Context, fl *filter.F, options . if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) + klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) return nil, *m.ListError } - var objs []*computega.TargetTcpProxy - for _, obj := range m.Objects { + var objs []*computega.TargetPool + for key, obj := range m.Objects { + if key.Region != region { + continue + } if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) + klog.V(5).Infof("MockTargetPools.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { +func (m *MockTargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -48845,32 +44205,32 @@ func (m *MockTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *c defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockTargetPools %v exists", key), } - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } obj.Name = key.Name - projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetTcpProxies") - obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetTcpProxies", key) + projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetPools") + obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetPools", key) - m.Objects[*key] = &MockTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetPoolsObj{obj} + klog.V(5).Infof("MockTargetPools.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -48882,71 +44242,77 @@ func (m *MockTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, option defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetPools %v not found", key), } - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetPools.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockTargetTcpProxies) Obj(o *computega.TargetTcpProxy) *MockTargetTcpProxiesObj { - return &MockTargetTcpProxiesObj{o} +func (m *MockTargetPools) Obj(o *computega.TargetPool) *MockTargetPoolsObj { + return &MockTargetPoolsObj{o} } -// SetBackendService is a mock for the corresponding method. -func (m *MockTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { - if m.SetBackendServiceHook != nil { - return m.SetBackendServiceHook(ctx, key, arg0, m) +// AddInstance is a mock for the corresponding method. +func (m *MockTargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { + if m.AddInstanceHook != nil { + return m.AddInstanceHook(ctx, key, arg0, m) } return nil } -// GCETargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. -type GCETargetTcpProxies struct { +// RemoveInstance is a mock for the corresponding method. +func (m *MockTargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { + if m.RemoveInstanceHook != nil { + return m.RemoveInstanceHook(ctx, key, arg0, m) + } + return nil +} + +// GCETargetPools is a simplifying adapter for the GCE TargetPools. +type GCETargetPools struct { s *Service } -// Get the TargetTcpProxy named by key. -func (g *GCETargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { +// Get the TargetPool named by key. +func (g *GCETargetPools) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetPool, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetPools.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetPools.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "TargetTcpProxies", - Resource: key, + Service: "TargetPools", } - klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.TargetTcpProxies.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.TargetPools.Get(projectID, key.Region, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetPools.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -48954,34 +44320,32 @@ func (g *GCETargetTcpProxies) Get(ctx context.Context, key *meta.Key, options .. return v, err } -// List all TargetTcpProxy objects. -func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { +// List all TargetPool objects. +func (g *GCETargetPools) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetPool, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + klog.V(5).Infof("GCETargetPools.List(%v, %v, %v, %v) called", ctx, region, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "TargetTcpProxies", - Resource: key, + Service: "TargetPools", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - call := g.s.GA.TargetTcpProxies.List(projectID) + klog.V(5).Infof("GCETargetPools.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) + call := g.s.GA.TargetPools.List(projectID, region) if fl != filter.None { call.Filter(fl.String()) } - var all []*computega.TargetTcpProxy - f := func(l *computega.TargetTcpProxyList) error { - klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + var all []*computega.TargetPool + f := func(l *computega.TargetPoolList) error { + klog.V(5).Infof("GCETargetPools.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -48989,7 +44353,7 @@ func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options .. callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -48997,138 +44361,174 @@ func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options .. g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetPools.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetPools.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } -// Insert TargetTcpProxy with key of value obj. -func (g *GCETargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { +// Insert TargetPool with key of value obj. +func (g *GCETargetPools) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetPool, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetPools.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetPools.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "TargetTcpProxies", - Resource: key, + Service: "TargetPools", + } + klog.V(5).Infof("GCETargetPools.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + obj.Name = key.Name + call := g.s.GA.TargetPools.Insert(projectID, key.Region, obj) + call.Context(ctx) + + op, err := call.Do() + + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + if err != nil { + klog.V(4).Infof("GCETargetPools.Insert(%v, %v, ...) = %+v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCETargetPools.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + return err +} + +// Delete the TargetPool referenced by key. +func (g *GCETargetPools) Delete(ctx context.Context, key *meta.Key, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCETargetPools.Delete(%v, %v, %v): called", ctx, key, opts) + if !key.Valid() { + klog.V(2).Infof("GCETargetPools.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "Delete", + Version: meta.Version("ga"), + Service: "TargetPools", } - klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - obj.Name = key.Name - call := g.s.GA.TargetTcpProxies.Insert(projectID, obj) + call := g.s.GA.TargetPools.Delete(projectID, key.Region, key.Name) + call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCETargetPools.Delete(%v, %v) = %v", ctx, key, err) return err } -// Delete the TargetTcpProxy referenced by key. -func (g *GCETargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +// AddInstance is a method on GCETargetPools. +func (g *GCETargetPools) AddInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsAddInstanceRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): called", ctx, key, opts) + if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetPools.AddInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, - Operation: "Delete", + Operation: "AddInstance", Version: meta.Version("ga"), - Service: "TargetTcpProxies", - Resource: key, + Service: "TargetPools", } - klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.AddInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetTcpProxies.Delete(projectID, key.Name) - + call := g.s.GA.TargetPools.AddInstance(projectID, key.Region, key.Name, arg0) call.Context(ctx) - - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) - - callObserverEnd(ctx, ck, err) - g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCETargetPools.AddInstance(%v, %v, ...) = %+v", ctx, key, err) return err } -// SetBackendService is a method on GCETargetTcpProxies. -func (g *GCETargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { +// RemoveInstance is a method on GCETargetPools. +func (g *GCETargetPools) RemoveInstance(ctx context.Context, key *meta.Key, arg0 *computega.TargetPoolsRemoveInstanceRequest, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) + klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + klog.V(2).Infof("GCETargetPools.RemoveInstance(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetPools") ck := &CallContextKey{ ProjectID: projectID, - Operation: "SetBackendService", + Operation: "RemoveInstance", Version: meta.Version("ga"), - Service: "TargetTcpProxies", - Resource: key, + Service: "TargetPools", } - klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) + call := g.s.GA.TargetPools.RemoveInstance(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -49136,21 +44536,22 @@ func (g *GCETargetTcpProxies) SetBackendService(ctx context.Context, key *meta.K callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) // XXX - klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) + klog.V(4).Infof("GCETargetPools.RemoveInstance(%v, %v, ...) = %+v", ctx, key, err) return err } -// AlphaRegionTargetTcpProxies is an interface that allows for mocking of RegionTargetTcpProxies. -type AlphaRegionTargetTcpProxies interface { +// AlphaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. +type AlphaTargetTcpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + SetBackendService(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockAlphaRegionTargetTcpProxies returns a new mock for RegionTargetTcpProxies. -func NewMockAlphaRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetTcpProxiesObj) *MockAlphaRegionTargetTcpProxies { - mock := &MockAlphaRegionTargetTcpProxies{ +// NewMockAlphaTargetTcpProxies returns a new mock for TargetTcpProxies. +func NewMockAlphaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockAlphaTargetTcpProxies { + mock := &MockAlphaTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -49161,14 +44562,14 @@ func NewMockAlphaRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*Moc return mock } -// MockAlphaRegionTargetTcpProxies is the mock for RegionTargetTcpProxies. -type MockAlphaRegionTargetTcpProxies struct { +// MockAlphaTargetTcpProxies is the mock for TargetTcpProxies. +type MockAlphaTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetTcpProxiesObj + Objects map[meta.Key]*MockTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -49181,10 +44582,11 @@ type MockAlphaRegionTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, *computealpha.TargetTcpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, []*computealpha.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaRegionTargetTcpProxies, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, *computealpha.TargetTcpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockAlphaTargetTcpProxies, options ...Option) (bool, []*computealpha.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockAlphaTargetTcpProxies, options ...Option) (bool, error) + SetBackendServiceHook func(context.Context, *meta.Key, *computealpha.TargetTcpProxiesSetBackendServiceRequest, *MockAlphaTargetTcpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -49192,10 +44594,10 @@ type MockAlphaRegionTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockAlphaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { +func (m *MockAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -49207,28 +44609,28 @@ func (m *MockAlphaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToAlpha() - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockAlphaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { +// List all of the objects in the mock. +func (m *MockAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -49238,31 +44640,28 @@ func (m *MockAlphaRegionTargetTcpProxies) List(ctx context.Context, region strin if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } var objs []*computealpha.TargetTcpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } + for _, obj := range m.Objects { if !fl.Match(obj.ToAlpha()) { continue } objs = append(objs, obj.ToAlpha()) } - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockAlphaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockAlphaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { +func (m *MockAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -49275,15 +44674,15 @@ func (m *MockAlphaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockAlphaRegionTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -49291,16 +44690,16 @@ func (m *MockAlphaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta. projectID := getProjectID(ctx, m.ProjectRouter, opts, "alpha", "targetTcpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionAlpha, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockRegionTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockAlphaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockAlphaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -49312,63 +44711,69 @@ func (m *MockAlphaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta. defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockAlphaRegionTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockAlphaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockAlphaRegionTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockAlphaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockAlphaRegionTargetTcpProxies) Obj(o *computealpha.TargetTcpProxy) *MockRegionTargetTcpProxiesObj { - return &MockRegionTargetTcpProxiesObj{o} +func (m *MockAlphaTargetTcpProxies) Obj(o *computealpha.TargetTcpProxy) *MockTargetTcpProxiesObj { + return &MockTargetTcpProxiesObj{o} +} + +// SetBackendService is a mock for the corresponding method. +func (m *MockAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + if m.SetBackendServiceHook != nil { + return m.SetBackendServiceHook(ctx, key, arg0, m) + } + return nil } -// GCEAlphaRegionTargetTcpProxies is a simplifying adapter for the GCE RegionTargetTcpProxies. -type GCEAlphaRegionTargetTcpProxies struct { +// GCEAlphaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. +type GCEAlphaTargetTcpProxies struct { s *Service } // Get the TargetTcpProxy named by key. -func (g *GCEAlphaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { +func (g *GCEAlphaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computealpha.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("alpha"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Alpha.RegionTargetTcpProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Alpha.TargetTcpProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -49377,33 +44782,31 @@ func (g *GCEAlphaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, } // List all TargetTcpProxy objects. -func (g *GCEAlphaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { +func (g *GCEAlphaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("alpha"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Alpha.RegionTargetTcpProxies.List(projectID, region) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Alpha.TargetTcpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } var all []*computealpha.TargetTcpProxy f := func(l *computealpha.TargetTcpProxyList) error { - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -49411,7 +44814,7 @@ func (g *GCEAlphaRegionTargetTcpProxies) List(ctx context.Context, region string callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -49419,116 +44822,155 @@ func (g *GCEAlphaRegionTargetTcpProxies) List(ctx context.Context, region string g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetTcpProxy with key of value obj. -func (g *GCEAlphaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { +func (g *GCEAlphaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computealpha.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("alpha"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Alpha.RegionTargetTcpProxies.Insert(projectID, key.Region, obj) + call := g.s.Alpha.TargetTcpProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetTcpProxy referenced by key. -func (g *GCEAlphaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEAlphaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("alpha"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Alpha.RegionTargetTcpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Alpha.TargetTcpProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEAlphaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// SetBackendService is a method on GCEAlphaTargetTcpProxies. +func (g *GCEAlphaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computealpha.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "TargetTcpProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetBackendService", + Version: meta.Version("alpha"), + Service: "TargetTcpProxies", + } + klog.V(5).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Alpha.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEAlphaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEAlphaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } -// BetaRegionTargetTcpProxies is an interface that allows for mocking of RegionTargetTcpProxies. -type BetaRegionTargetTcpProxies interface { +// BetaTargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. +type BetaTargetTcpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + SetBackendService(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockBetaRegionTargetTcpProxies returns a new mock for RegionTargetTcpProxies. -func NewMockBetaRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetTcpProxiesObj) *MockBetaRegionTargetTcpProxies { - mock := &MockBetaRegionTargetTcpProxies{ +// NewMockBetaTargetTcpProxies returns a new mock for TargetTcpProxies. +func NewMockBetaTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockBetaTargetTcpProxies { + mock := &MockBetaTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -49539,14 +44981,14 @@ func NewMockBetaRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*Mock return mock } -// MockBetaRegionTargetTcpProxies is the mock for RegionTargetTcpProxies. -type MockBetaRegionTargetTcpProxies struct { +// MockBetaTargetTcpProxies is the mock for TargetTcpProxies. +type MockBetaTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetTcpProxiesObj + Objects map[meta.Key]*MockTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -49559,10 +45001,11 @@ type MockBetaRegionTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, *computebeta.TargetTcpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, []*computebeta.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaRegionTargetTcpProxies, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, *computebeta.TargetTcpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockBetaTargetTcpProxies, options ...Option) (bool, []*computebeta.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockBetaTargetTcpProxies, options ...Option) (bool, error) + SetBackendServiceHook func(context.Context, *meta.Key, *computebeta.TargetTcpProxiesSetBackendServiceRequest, *MockBetaTargetTcpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -49570,10 +45013,10 @@ type MockBetaRegionTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockBetaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { +func (m *MockBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -49585,28 +45028,28 @@ func (m *MockBetaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToBeta() - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockBetaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { +// List all of the objects in the mock. +func (m *MockBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -49616,31 +45059,28 @@ func (m *MockBetaRegionTargetTcpProxies) List(ctx context.Context, region string if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } var objs []*computebeta.TargetTcpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } + for _, obj := range m.Objects { if !fl.Match(obj.ToBeta()) { continue } objs = append(objs, obj.ToBeta()) } - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockBetaTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockBetaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { +func (m *MockBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -49653,15 +45093,15 @@ func (m *MockBetaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockBetaRegionTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockBetaTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -49669,16 +45109,16 @@ func (m *MockBetaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.K projectID := getProjectID(ctx, m.ProjectRouter, opts, "beta", "targetTcpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionBeta, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockRegionTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockBetaTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockBetaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -49690,63 +45130,69 @@ func (m *MockBetaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.K defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockBetaRegionTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockBetaTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockBetaRegionTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockBetaTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockBetaRegionTargetTcpProxies) Obj(o *computebeta.TargetTcpProxy) *MockRegionTargetTcpProxiesObj { - return &MockRegionTargetTcpProxiesObj{o} +func (m *MockBetaTargetTcpProxies) Obj(o *computebeta.TargetTcpProxy) *MockTargetTcpProxiesObj { + return &MockTargetTcpProxiesObj{o} +} + +// SetBackendService is a mock for the corresponding method. +func (m *MockBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + if m.SetBackendServiceHook != nil { + return m.SetBackendServiceHook(ctx, key, arg0, m) + } + return nil } -// GCEBetaRegionTargetTcpProxies is a simplifying adapter for the GCE RegionTargetTcpProxies. -type GCEBetaRegionTargetTcpProxies struct { +// GCEBetaTargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. +type GCEBetaTargetTcpProxies struct { s *Service } // Get the TargetTcpProxy named by key. -func (g *GCEBetaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { +func (g *GCEBetaTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computebeta.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("beta"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.Beta.RegionTargetTcpProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.Beta.TargetTcpProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -49755,33 +45201,31 @@ func (g *GCEBetaRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, } // List all TargetTcpProxy objects. -func (g *GCEBetaRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { +func (g *GCEBetaTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("beta"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.Beta.RegionTargetTcpProxies.List(projectID, region) + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.Beta.TargetTcpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } var all []*computebeta.TargetTcpProxy f := func(l *computebeta.TargetTcpProxyList) error { - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -49789,7 +45233,7 @@ func (g *GCEBetaRegionTargetTcpProxies) List(ctx context.Context, region string, callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -49797,116 +45241,155 @@ func (g *GCEBetaRegionTargetTcpProxies) List(ctx context.Context, region string, g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCEBetaTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetTcpProxy with key of value obj. -func (g *GCEBetaRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { +func (g *GCEBetaTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computebeta.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("beta"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.Beta.RegionTargetTcpProxies.Insert(projectID, key.Region, obj) + call := g.s.Beta.TargetTcpProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetTcpProxy referenced by key. -func (g *GCEBetaRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCEBetaTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("beta"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.Beta.RegionTargetTcpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.Beta.TargetTcpProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCEBetaTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// SetBackendService is a method on GCEBetaTargetTcpProxies. +func (g *GCEBetaTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computebeta.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TargetTcpProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetBackendService", + Version: meta.Version("beta"), + Service: "TargetTcpProxies", + } + klog.V(5).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.Beta.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCEBetaRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCEBetaTargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } -// RegionTargetTcpProxies is an interface that allows for mocking of RegionTargetTcpProxies. -type RegionTargetTcpProxies interface { +// TargetTcpProxies is an interface that allows for mocking of TargetTcpProxies. +type TargetTcpProxies interface { Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) - List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) + List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error Delete(ctx context.Context, key *meta.Key, options ...Option) error + SetBackendService(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, ...Option) error } -// NewMockRegionTargetTcpProxies returns a new mock for RegionTargetTcpProxies. -func NewMockRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegionTargetTcpProxiesObj) *MockRegionTargetTcpProxies { - mock := &MockRegionTargetTcpProxies{ +// NewMockTargetTcpProxies returns a new mock for TargetTcpProxies. +func NewMockTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockTargetTcpProxiesObj) *MockTargetTcpProxies { + mock := &MockTargetTcpProxies{ ProjectRouter: pr, Objects: objs, @@ -49917,14 +45400,14 @@ func NewMockRegionTargetTcpProxies(pr ProjectRouter, objs map[meta.Key]*MockRegi return mock } -// MockRegionTargetTcpProxies is the mock for RegionTargetTcpProxies. -type MockRegionTargetTcpProxies struct { +// MockTargetTcpProxies is the mock for TargetTcpProxies. +type MockTargetTcpProxies struct { Lock sync.Mutex ProjectRouter ProjectRouter // Objects maintained by the mock. - Objects map[meta.Key]*MockRegionTargetTcpProxiesObj + Objects map[meta.Key]*MockTargetTcpProxiesObj // If an entry exists for the given key and operation, then the error // will be returned instead of the operation. @@ -49937,10 +45420,11 @@ type MockRegionTargetTcpProxies struct { // order to add your own logic. Return (true, _, _) to prevent the normal // execution flow of the mock. Return (false, nil, nil) to continue with // normal mock behavior/ after the hook function executes. - GetHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetTcpProxies, options ...Option) (bool, *computega.TargetTcpProxy, error) - ListHook func(ctx context.Context, region string, fl *filter.F, m *MockRegionTargetTcpProxies, options ...Option) (bool, []*computega.TargetTcpProxy, error) - InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, m *MockRegionTargetTcpProxies, options ...Option) (bool, error) - DeleteHook func(ctx context.Context, key *meta.Key, m *MockRegionTargetTcpProxies, options ...Option) (bool, error) + GetHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, *computega.TargetTcpProxy, error) + ListHook func(ctx context.Context, fl *filter.F, m *MockTargetTcpProxies, options ...Option) (bool, []*computega.TargetTcpProxy, error) + InsertHook func(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, m *MockTargetTcpProxies, options ...Option) (bool, error) + DeleteHook func(ctx context.Context, key *meta.Key, m *MockTargetTcpProxies, options ...Option) (bool, error) + SetBackendServiceHook func(context.Context, *meta.Key, *computega.TargetTcpProxiesSetBackendServiceRequest, *MockTargetTcpProxies, ...Option) error // X is extra state that can be used as part of the mock. Generated code // will not use this field. @@ -49948,10 +45432,10 @@ type MockRegionTargetTcpProxies struct { } // Get returns the object from the mock. -func (m *MockRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { +func (m *MockTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { if m.GetHook != nil { if intercept, obj, err := m.GetHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, %v", ctx, key, obj, err) return obj, err } } @@ -49963,28 +45447,28 @@ func (m *MockRegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, opt defer m.Lock.Unlock() if err, ok := m.GetError[*key]; ok { - klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } if obj, ok := m.Objects[*key]; ok { typedObj := obj.ToGA() - klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = %+v, nil", ctx, key, typedObj) return typedObj, nil } err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Get(%v, %s) = nil, %v", ctx, key, err) return nil, err } -// List all of the objects in the mock in the given region. -func (m *MockRegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { +// List all of the objects in the mock. +func (m *MockTargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { if m.ListHook != nil { - if intercept, objs, err := m.ListHook(ctx, region, fl, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], %v", ctx, region, fl, len(objs), err) + if intercept, objs, err := m.ListHook(ctx, fl, m, options...); intercept { + klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], %v", ctx, fl, len(objs), err) return objs, err } } @@ -49994,31 +45478,28 @@ func (m *MockRegionTargetTcpProxies) List(ctx context.Context, region string, fl if m.ListError != nil { err := *m.ListError - klog.V(5).Infof("MockRegionTargetTcpProxies.List(%v, %q, %v) = nil, %v", ctx, region, fl, err) + klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = nil, %v", ctx, fl, err) return nil, *m.ListError } var objs []*computega.TargetTcpProxy - for key, obj := range m.Objects { - if key.Region != region { - continue - } + for _, obj := range m.Objects { if !fl.Match(obj.ToGA()) { continue } objs = append(objs, obj.ToGA()) } - klog.V(5).Infof("MockRegionTargetTcpProxies.List(%v, %q, %v) = [%v items], nil", ctx, region, fl, len(objs)) + klog.V(5).Infof("MockTargetTcpProxies.List(%v, %v) = [%v items], nil", ctx, fl, len(objs)) return objs, nil } // Insert is a mock for inserting/creating a new object. -func (m *MockRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { +func (m *MockTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { if m.InsertHook != nil { if intercept, err := m.InsertHook(ctx, key, obj, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } } @@ -50031,15 +45512,15 @@ func (m *MockRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.InsertError[*key]; ok { - klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } if _, ok := m.Objects[*key]; ok { err := &googleapi.Error{ Code: http.StatusConflict, - Message: fmt.Sprintf("MockRegionTargetTcpProxies %v exists", key), + Message: fmt.Sprintf("MockTargetTcpProxies %v exists", key), } - klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = %v", ctx, key, obj, err) return err } @@ -50047,16 +45528,16 @@ func (m *MockRegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, projectID := getProjectID(ctx, m.ProjectRouter, opts, "ga", "targetTcpProxies") obj.SelfLink = SelfLinkWithGroup("compute", meta.VersionGA, projectID, "targetTcpProxies", key) - m.Objects[*key] = &MockRegionTargetTcpProxiesObj{obj} - klog.V(5).Infof("MockRegionTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) + m.Objects[*key] = &MockTargetTcpProxiesObj{obj} + klog.V(5).Infof("MockTargetTcpProxies.Insert(%v, %v, %+v) = nil", ctx, key, obj) return nil } // Delete is a mock for deleting the object. -func (m *MockRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (m *MockTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { if m.DeleteHook != nil { if intercept, err := m.DeleteHook(ctx, key, m, options...); intercept { - klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } } @@ -50068,63 +45549,69 @@ func (m *MockRegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, defer m.Lock.Unlock() if err, ok := m.DeleteError[*key]; ok { - klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } if _, ok := m.Objects[*key]; !ok { err := &googleapi.Error{ Code: http.StatusNotFound, - Message: fmt.Sprintf("MockRegionTargetTcpProxies %v not found", key), + Message: fmt.Sprintf("MockTargetTcpProxies %v not found", key), } - klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) return err } delete(m.Objects, *key) - klog.V(5).Infof("MockRegionTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) + klog.V(5).Infof("MockTargetTcpProxies.Delete(%v, %v) = nil", ctx, key) return nil } // Obj wraps the object for use in the mock. -func (m *MockRegionTargetTcpProxies) Obj(o *computega.TargetTcpProxy) *MockRegionTargetTcpProxiesObj { - return &MockRegionTargetTcpProxiesObj{o} +func (m *MockTargetTcpProxies) Obj(o *computega.TargetTcpProxy) *MockTargetTcpProxiesObj { + return &MockTargetTcpProxiesObj{o} +} + +// SetBackendService is a mock for the corresponding method. +func (m *MockTargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + if m.SetBackendServiceHook != nil { + return m.SetBackendServiceHook(ctx, key, arg0, m) + } + return nil } -// GCERegionTargetTcpProxies is a simplifying adapter for the GCE RegionTargetTcpProxies. -type GCERegionTargetTcpProxies struct { +// GCETargetTcpProxies is a simplifying adapter for the GCE TargetTcpProxies. +type GCETargetTcpProxies struct { s *Service } // Get the TargetTcpProxy named by key. -func (g *GCERegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { +func (g *GCETargetTcpProxies) Get(ctx context.Context, key *meta.Key, options ...Option) (*computega.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetTcpProxies.Get(%v, %v): key is invalid (%#v)", ctx, key, key) return nil, fmt.Errorf("invalid GCE key (%#v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Get", Version: meta.Version("ga"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCERegionTargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetTcpProxies.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v): RateLimiter error: %v", ctx, key, err) return nil, err } - call := g.s.GA.RegionTargetTcpProxies.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) + call := g.s.GA.TargetTcpProxies.Get(projectID, key.Name) call.Context(ctx) v, err := call.Do() - klog.V(4).Infof("GCERegionTargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) + klog.V(4).Infof("GCETargetTcpProxies.Get(%v, %v) = %+v, %v", ctx, key, v, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) @@ -50133,33 +45620,31 @@ func (g *GCERegionTargetTcpProxies) Get(ctx context.Context, key *meta.Key, opti } // List all TargetTcpProxy objects. -func (g *GCERegionTargetTcpProxies) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { +func (g *GCETargetTcpProxies) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.TargetTcpProxy, error) { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") + klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v, %v) called", ctx, fl, opts) + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "List", Version: meta.Version("ga"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { return nil, err } - klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, %v, %v): projectID = %v, ck = %+v", ctx, region, fl, projectID, ck) - call := g.s.GA.RegionTargetTcpProxies.List(projectID, region) + klog.V(5).Infof("GCETargetTcpProxies.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) + call := g.s.GA.TargetTcpProxies.List(projectID) if fl != filter.None { call.Filter(fl.String()) } var all []*computega.TargetTcpProxy f := func(l *computega.TargetTcpProxyList) error { - klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) + klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v): page %+v", ctx, fl, l) all = append(all, l.Items...) return nil } @@ -50167,7 +45652,7 @@ func (g *GCERegionTargetTcpProxies) List(ctx context.Context, region string, fl callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) - klog.V(4).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) + klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, nil, err) return nil, err } @@ -50175,102 +45660,140 @@ func (g *GCERegionTargetTcpProxies) List(ctx context.Context, region string, fl g.s.RateLimiter.Observe(ctx, nil, ck) if kLogEnabled(4) { - klog.V(4).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) + klog.V(4).Infof("GCETargetTcpProxies.List(%v, ..., %v) = [%v items], %v", ctx, fl, len(all), nil) } else if kLogEnabled(5) { var asStr []string for _, o := range all { asStr = append(asStr, fmt.Sprintf("%+v", o)) } - klog.V(5).Infof("GCERegionTargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) + klog.V(5).Infof("GCETargetTcpProxies.List(%v, ..., %v) = %v, %v", ctx, fl, asStr, nil) } return all, nil } // Insert TargetTcpProxy with key of value obj. -func (g *GCERegionTargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { +func (g *GCETargetTcpProxies) Insert(ctx context.Context, key *meta.Key, obj *computega.TargetTcpProxy, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) + klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v, %v): called", ctx, key, obj, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Insert", Version: meta.Version("ga"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...): RateLimiter error: %v", ctx, key, err) return err } obj.Name = key.Name - call := g.s.GA.RegionTargetTcpProxies.Insert(projectID, key.Region, obj) + call := g.s.GA.TargetTcpProxies.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) + klog.V(4).Infof("GCETargetTcpProxies.Insert(%v, %v, %+v) = %+v", ctx, key, obj, err) return err } // Delete the TargetTcpProxy referenced by key. -func (g *GCERegionTargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { +func (g *GCETargetTcpProxies) Delete(ctx context.Context, key *meta.Key, options ...Option) error { opts := mergeOptions(options) - klog.V(5).Infof("GCERegionTargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) + klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v, %v): called", ctx, key, opts) if !key.Valid() { - klog.V(2).Infof("GCERegionTargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) + klog.V(2).Infof("GCETargetTcpProxies.Delete(%v, %v): key is invalid (%#v)", ctx, key, key) return fmt.Errorf("invalid GCE key (%+v)", key) } - projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionTargetTcpProxies") + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") ck := &CallContextKey{ ProjectID: projectID, Operation: "Delete", Version: meta.Version("ga"), - Service: "RegionTargetTcpProxies", - Resource: key, + Service: "TargetTcpProxies", } - klog.V(5).Infof("GCERegionTargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) + klog.V(5).Infof("GCETargetTcpProxies.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { - klog.V(4).Infof("GCERegionTargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) + klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v): RateLimiter error: %v", ctx, key, err) return err } - call := g.s.GA.RegionTargetTcpProxies.Delete(projectID, key.Region, key.Name) + call := g.s.GA.TargetTcpProxies.Delete(projectID, key.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + return err + } + + err = g.s.WaitForCompletion(ctx, op) + klog.V(4).Infof("GCETargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + return err +} + +// SetBackendService is a method on GCETargetTcpProxies. +func (g *GCETargetTcpProxies) SetBackendService(ctx context.Context, key *meta.Key, arg0 *computega.TargetTcpProxiesSetBackendServiceRequest, options ...Option) error { + opts := mergeOptions(options) + klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): called", ctx, key, opts) + + if !key.Valid() { + klog.V(2).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, %v, ...): key is invalid (%#v)", ctx, key, opts, key) + return fmt.Errorf("invalid GCE key (%+v)", key) + } + projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TargetTcpProxies") + ck := &CallContextKey{ + ProjectID: projectID, + Operation: "SetBackendService", + Version: meta.Version("ga"), + Service: "TargetTcpProxies", + } + klog.V(5).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) + callObserverStart(ctx, ck) + if err := g.s.RateLimiter.Accept(ctx, ck); err != nil { + klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...): RateLimiter error: %v", ctx, key, err) + return err + } + call := g.s.GA.TargetTcpProxies.SetBackendService(projectID, key.Name, arg0) + call.Context(ctx) + op, err := call.Do() + + if err != nil { + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) + + klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } err = g.s.WaitForCompletion(ctx, op) - klog.V(4).Infof("GCERegionTargetTcpProxies.Delete(%v, %v) = %v", ctx, key, err) + callObserverEnd(ctx, ck, err) + g.s.RateLimiter.Observe(ctx, err, ck) // XXX + + klog.V(4).Infof("GCETargetTcpProxies.SetBackendService(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -50496,7 +46019,6 @@ func (g *GCEAlphaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("alpha"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -50506,7 +46028,6 @@ func (g *GCEAlphaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opt return nil, err } call := g.s.Alpha.UrlMaps.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -50521,7 +46042,6 @@ func (g *GCEAlphaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *GCEAlphaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computealpha.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaUrlMaps.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "UrlMaps") ck := &CallContextKey{ @@ -50529,7 +46049,6 @@ func (g *GCEAlphaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("alpha"), Service: "UrlMaps", - Resource: key, } callObserverStart(ctx, ck) @@ -50588,7 +46107,6 @@ func (g *GCEAlphaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *comput Operation: "Insert", Version: meta.Version("alpha"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -50600,14 +46118,13 @@ func (g *GCEAlphaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *comput call := g.s.Alpha.UrlMaps.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -50631,7 +46148,6 @@ func (g *GCEAlphaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("alpha"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -50643,14 +46159,13 @@ func (g *GCEAlphaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -50674,7 +46189,6 @@ func (g *GCEAlphaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *compu Operation: "Update", Version: meta.Version("alpha"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -50684,14 +46198,13 @@ func (g *GCEAlphaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *compu } call := g.s.Alpha.UrlMaps.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -50925,7 +46438,6 @@ func (g *GCEBetaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opti Operation: "Get", Version: meta.Version("beta"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -50935,7 +46447,6 @@ func (g *GCEBetaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opti return nil, err } call := g.s.Beta.UrlMaps.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -50950,7 +46461,6 @@ func (g *GCEBetaUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Opti func (g *GCEBetaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computebeta.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaUrlMaps.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "UrlMaps") ck := &CallContextKey{ @@ -50958,7 +46468,6 @@ func (g *GCEBetaUrlMaps) List(ctx context.Context, fl *filter.F, options ...Opti Operation: "List", Version: meta.Version("beta"), Service: "UrlMaps", - Resource: key, } callObserverStart(ctx, ck) @@ -51017,7 +46526,6 @@ func (g *GCEBetaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compute Operation: "Insert", Version: meta.Version("beta"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51029,14 +46537,13 @@ func (g *GCEBetaUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compute call := g.s.Beta.UrlMaps.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -51060,7 +46567,6 @@ func (g *GCEBetaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...O Operation: "Delete", Version: meta.Version("beta"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51072,14 +46578,13 @@ func (g *GCEBetaUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...O call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -51103,7 +46608,6 @@ func (g *GCEBetaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comput Operation: "Update", Version: meta.Version("beta"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51113,14 +46617,13 @@ func (g *GCEBetaUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comput } call := g.s.Beta.UrlMaps.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -51354,7 +46857,6 @@ func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Option) Operation: "Get", Version: meta.Version("ga"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -51364,7 +46866,6 @@ func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Option) return nil, err } call := g.s.GA.UrlMaps.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -51379,7 +46880,6 @@ func (g *GCEUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Option) func (g *GCEUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEUrlMaps.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "UrlMaps") ck := &CallContextKey{ @@ -51387,7 +46887,6 @@ func (g *GCEUrlMaps) List(ctx context.Context, fl *filter.F, options ...Option) Operation: "List", Version: meta.Version("ga"), Service: "UrlMaps", - Resource: key, } callObserverStart(ctx, ck) @@ -51446,7 +46945,6 @@ func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *computega.U Operation: "Insert", Version: meta.Version("ga"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51458,14 +46956,13 @@ func (g *GCEUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *computega.U call := g.s.GA.UrlMaps.Insert(projectID, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -51489,7 +46986,6 @@ func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...Optio Operation: "Delete", Version: meta.Version("ga"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51501,14 +46997,13 @@ func (g *GCEUrlMaps) Delete(ctx context.Context, key *meta.Key, options ...Optio call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -51532,7 +47027,6 @@ func (g *GCEUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *computega. Operation: "Update", Version: meta.Version("ga"), Service: "UrlMaps", - Resource: key, } klog.V(5).Infof("GCEUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51542,14 +47036,13 @@ func (g *GCEUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *computega. } call := g.s.GA.UrlMaps.Update(projectID, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -51786,7 +47279,6 @@ func (g *GCEAlphaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options Operation: "Get", Version: meta.Version("alpha"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -51796,7 +47288,6 @@ func (g *GCEAlphaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options return nil, err } call := g.s.Alpha.RegionUrlMaps.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEAlphaRegionUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -51811,7 +47302,6 @@ func (g *GCEAlphaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options func (g *GCEAlphaRegionUrlMaps) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computealpha.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEAlphaRegionUrlMaps.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "alpha", "RegionUrlMaps") ck := &CallContextKey{ @@ -51819,7 +47309,6 @@ func (g *GCEAlphaRegionUrlMaps) List(ctx context.Context, region string, fl *fil Operation: "List", Version: meta.Version("alpha"), Service: "RegionUrlMaps", - Resource: key, } callObserverStart(ctx, ck) @@ -51878,7 +47367,6 @@ func (g *GCEAlphaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj * Operation: "Insert", Version: meta.Version("alpha"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51890,14 +47378,13 @@ func (g *GCEAlphaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj * call := g.s.Alpha.RegionUrlMaps.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -51921,7 +47408,6 @@ func (g *GCEAlphaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, optio Operation: "Delete", Version: meta.Version("alpha"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51933,14 +47419,13 @@ func (g *GCEAlphaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, optio call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEAlphaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -51964,7 +47449,6 @@ func (g *GCEAlphaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 Operation: "Update", Version: meta.Version("alpha"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEAlphaRegionUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -51974,14 +47458,13 @@ func (g *GCEAlphaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 } call := g.s.Alpha.RegionUrlMaps.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEAlphaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEAlphaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -52218,7 +47701,6 @@ func (g *GCEBetaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options . Operation: "Get", Version: meta.Version("beta"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -52228,7 +47710,6 @@ func (g *GCEBetaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options . return nil, err } call := g.s.Beta.RegionUrlMaps.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEBetaRegionUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -52243,7 +47724,6 @@ func (g *GCEBetaRegionUrlMaps) Get(ctx context.Context, key *meta.Key, options . func (g *GCEBetaRegionUrlMaps) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computebeta.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEBetaRegionUrlMaps.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "RegionUrlMaps") ck := &CallContextKey{ @@ -52251,7 +47731,6 @@ func (g *GCEBetaRegionUrlMaps) List(ctx context.Context, region string, fl *filt Operation: "List", Version: meta.Version("beta"), Service: "RegionUrlMaps", - Resource: key, } callObserverStart(ctx, ck) @@ -52310,7 +47789,6 @@ func (g *GCEBetaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *c Operation: "Insert", Version: meta.Version("beta"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -52322,14 +47800,13 @@ func (g *GCEBetaRegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *c call := g.s.Beta.RegionUrlMaps.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -52353,7 +47830,6 @@ func (g *GCEBetaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, option Operation: "Delete", Version: meta.Version("beta"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -52365,14 +47841,13 @@ func (g *GCEBetaRegionUrlMaps) Delete(ctx context.Context, key *meta.Key, option call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCEBetaRegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -52396,7 +47871,6 @@ func (g *GCEBetaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 * Operation: "Update", Version: meta.Version("beta"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCEBetaRegionUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -52406,14 +47880,13 @@ func (g *GCEBetaRegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 * } call := g.s.Beta.RegionUrlMaps.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCEBetaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCEBetaRegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -52650,7 +48123,6 @@ func (g *GCERegionUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Op Operation: "Get", Version: meta.Version("ga"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -52660,7 +48132,6 @@ func (g *GCERegionUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Op return nil, err } call := g.s.GA.RegionUrlMaps.Get(projectID, key.Region, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCERegionUrlMaps.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -52675,7 +48146,6 @@ func (g *GCERegionUrlMaps) Get(ctx context.Context, key *meta.Key, options ...Op func (g *GCERegionUrlMaps) List(ctx context.Context, region string, fl *filter.F, options ...Option) ([]*computega.UrlMap, error) { opts := mergeOptions(options) klog.V(5).Infof("GCERegionUrlMaps.List(%v, %v, %v, %v) called", ctx, region, fl, opts) - key := &meta.Key{Region: region} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "RegionUrlMaps") ck := &CallContextKey{ @@ -52683,7 +48153,6 @@ func (g *GCERegionUrlMaps) List(ctx context.Context, region string, fl *filter.F Operation: "List", Version: meta.Version("ga"), Service: "RegionUrlMaps", - Resource: key, } callObserverStart(ctx, ck) @@ -52742,7 +48211,6 @@ func (g *GCERegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compu Operation: "Insert", Version: meta.Version("ga"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Insert(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -52754,14 +48222,13 @@ func (g *GCERegionUrlMaps) Insert(ctx context.Context, key *meta.Key, obj *compu call := g.s.GA.RegionUrlMaps.Insert(projectID, key.Region, obj) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionUrlMaps.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -52785,7 +48252,6 @@ func (g *GCERegionUrlMaps) Delete(ctx context.Context, key *meta.Key, options .. Operation: "Delete", Version: meta.Version("ga"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -52797,14 +48263,13 @@ func (g *GCERegionUrlMaps) Delete(ctx context.Context, key *meta.Key, options .. call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("GCERegionUrlMaps.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -52828,7 +48293,6 @@ func (g *GCERegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comp Operation: "Update", Version: meta.Version("ga"), Service: "RegionUrlMaps", - Resource: key, } klog.V(5).Infof("GCERegionUrlMaps.Update(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -52838,14 +48302,13 @@ func (g *GCERegionUrlMaps) Update(ctx context.Context, key *meta.Key, arg0 *comp } call := g.s.GA.RegionUrlMaps.Update(projectID, key.Region, key.Name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("GCERegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("GCERegionUrlMaps.Update(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -52990,7 +48453,6 @@ func (g *GCEZones) Get(ctx context.Context, key *meta.Key, options ...Option) (* Operation: "Get", Version: meta.Version("ga"), Service: "Zones", - Resource: key, } klog.V(5).Infof("GCEZones.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -53000,7 +48462,6 @@ func (g *GCEZones) Get(ctx context.Context, key *meta.Key, options ...Option) (* return nil, err } call := g.s.GA.Zones.Get(projectID, key.Name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("GCEZones.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -53015,7 +48476,6 @@ func (g *GCEZones) Get(ctx context.Context, key *meta.Key, options ...Option) (* func (g *GCEZones) List(ctx context.Context, fl *filter.F, options ...Option) ([]*computega.Zone, error) { opts := mergeOptions(options) klog.V(5).Infof("GCEZones.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Zones") ck := &CallContextKey{ @@ -53023,7 +48483,6 @@ func (g *GCEZones) List(ctx context.Context, fl *filter.F, options ...Option) ([ Operation: "List", Version: meta.Version("ga"), Service: "Zones", - Resource: key, } callObserverStart(ctx, ck) @@ -53288,7 +48747,6 @@ func (g *TDTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) Operation: "Get", Version: meta.Version("ga"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDTcpRoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -53299,7 +48757,6 @@ func (g *TDTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) } name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.TcpRoutes.Get(name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDTcpRoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -53314,7 +48771,6 @@ func (g *TDTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Option) func (g *TDTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesga.TcpRoute, error) { opts := mergeOptions(options) klog.V(5).Infof("TDTcpRoutes.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "TcpRoutes") ck := &CallContextKey{ @@ -53322,7 +48778,6 @@ func (g *TDTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) Operation: "List", Version: meta.Version("ga"), Service: "TcpRoutes", - Resource: key, } callObserverStart(ctx, ck) @@ -53330,8 +48785,7 @@ func (g *TDTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) return nil, err } klog.V(5).Infof("TDTcpRoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - parent := fmt.Sprintf("projects/%s/locations/global", projectID) - call := g.s.NetworkServicesGA.TcpRoutes.List(parent) + call := g.s.NetworkServicesGA.TcpRoutes.List(projectID) var all []*networkservicesga.TcpRoute f := func(l *networkservicesga.ListTcpRoutesResponse) error { @@ -53379,7 +48833,6 @@ func (g *TDTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networkser Operation: "Insert", Version: meta.Version("ga"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDTcpRoutes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -53393,14 +48846,13 @@ func (g *TDTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networkser call.TcpRouteId(obj.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -53424,7 +48876,6 @@ func (g *TDTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ...Opti Operation: "Delete", Version: meta.Version("ga"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDTcpRoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -53437,14 +48888,13 @@ func (g *TDTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ...Opti call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -53468,7 +48918,6 @@ func (g *TDTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networkser Operation: "Patch", Version: meta.Version("ga"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDTcpRoutes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -53479,14 +48928,13 @@ func (g *TDTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networkser name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.TcpRoutes.Patch(name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("TDTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -53720,7 +49168,6 @@ func (g *TDBetaTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Opt Operation: "Get", Version: meta.Version("beta"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -53731,7 +49178,6 @@ func (g *TDBetaTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Opt } name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.TcpRoutes.Get(name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDBetaTcpRoutes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -53746,7 +49192,6 @@ func (g *TDBetaTcpRoutes) Get(ctx context.Context, key *meta.Key, options ...Opt func (g *TDBetaTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesbeta.TcpRoute, error) { opts := mergeOptions(options) klog.V(5).Infof("TDBetaTcpRoutes.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "TcpRoutes") ck := &CallContextKey{ @@ -53754,7 +49199,6 @@ func (g *TDBetaTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Opt Operation: "List", Version: meta.Version("beta"), Service: "TcpRoutes", - Resource: key, } callObserverStart(ctx, ck) @@ -53762,8 +49206,7 @@ func (g *TDBetaTcpRoutes) List(ctx context.Context, fl *filter.F, options ...Opt return nil, err } klog.V(5).Infof("TDBetaTcpRoutes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - parent := fmt.Sprintf("projects/%s/locations/global", projectID) - call := g.s.NetworkServicesBeta.TcpRoutes.List(parent) + call := g.s.NetworkServicesBeta.TcpRoutes.List(projectID) var all []*networkservicesbeta.TcpRoute f := func(l *networkservicesbeta.ListTcpRoutesResponse) error { @@ -53811,7 +49254,6 @@ func (g *TDBetaTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networ Operation: "Insert", Version: meta.Version("beta"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -53825,14 +49267,13 @@ func (g *TDBetaTcpRoutes) Insert(ctx context.Context, key *meta.Key, obj *networ call.TcpRouteId(obj.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDBetaTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDBetaTcpRoutes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -53856,7 +49297,6 @@ func (g *TDBetaTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ... Operation: "Delete", Version: meta.Version("beta"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -53869,14 +49309,13 @@ func (g *TDBetaTcpRoutes) Delete(ctx context.Context, key *meta.Key, options ... call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDBetaTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDBetaTcpRoutes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -53900,7 +49339,6 @@ func (g *TDBetaTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networ Operation: "Patch", Version: meta.Version("beta"), Service: "TcpRoutes", - Resource: key, } klog.V(5).Infof("TDBetaTcpRoutes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -53911,14 +49349,13 @@ func (g *TDBetaTcpRoutes) Patch(ctx context.Context, key *meta.Key, arg0 *networ name := fmt.Sprintf("projects/%s/locations/global/tcpRoutes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.TcpRoutes.Patch(name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDBetaTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("TDBetaTcpRoutes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -54152,7 +49589,6 @@ func (g *TDMeshes) Get(ctx context.Context, key *meta.Key, options ...Option) (* Operation: "Get", Version: meta.Version("ga"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDMeshes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -54163,7 +49599,6 @@ func (g *TDMeshes) Get(ctx context.Context, key *meta.Key, options ...Option) (* } name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.Meshes.Get(name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDMeshes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -54178,7 +49613,6 @@ func (g *TDMeshes) Get(ctx context.Context, key *meta.Key, options ...Option) (* func (g *TDMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesga.Mesh, error) { opts := mergeOptions(options) klog.V(5).Infof("TDMeshes.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "ga", "Meshes") ck := &CallContextKey{ @@ -54186,7 +49620,6 @@ func (g *TDMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([ Operation: "List", Version: meta.Version("ga"), Service: "Meshes", - Resource: key, } callObserverStart(ctx, ck) @@ -54194,8 +49627,7 @@ func (g *TDMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([ return nil, err } klog.V(5).Infof("TDMeshes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - parent := fmt.Sprintf("projects/%s/locations/global", projectID) - call := g.s.NetworkServicesGA.Meshes.List(parent) + call := g.s.NetworkServicesGA.Meshes.List(projectID) var all []*networkservicesga.Mesh f := func(l *networkservicesga.ListMeshesResponse) error { @@ -54243,7 +49675,6 @@ func (g *TDMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkservic Operation: "Insert", Version: meta.Version("ga"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDMeshes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -54254,17 +49685,15 @@ func (g *TDMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkservic obj.Name = key.Name parent := fmt.Sprintf("projects/%s/locations/global", projectID) call := g.s.NetworkServicesGA.Meshes.Create(parent, obj) - call.MeshId(obj.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -54288,7 +49717,6 @@ func (g *TDMeshes) Delete(ctx context.Context, key *meta.Key, options ...Option) Operation: "Delete", Version: meta.Version("ga"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDMeshes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -54301,14 +49729,13 @@ func (g *TDMeshes) Delete(ctx context.Context, key *meta.Key, options ...Option) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDMeshes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDMeshes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -54332,7 +49759,6 @@ func (g *TDMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkservic Operation: "Patch", Version: meta.Version("ga"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDMeshes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -54343,14 +49769,13 @@ func (g *TDMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkservic name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesGA.Meshes.Patch(name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("TDMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -54584,7 +50009,6 @@ func (g *TDBetaMeshes) Get(ctx context.Context, key *meta.Key, options ...Option Operation: "Get", Version: meta.Version("beta"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDBetaMeshes.Get(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) @@ -54595,7 +50019,6 @@ func (g *TDBetaMeshes) Get(ctx context.Context, key *meta.Key, options ...Option } name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.Meshes.Get(name) - handleHeaderOptions(&opts, call.Header()) call.Context(ctx) v, err := call.Do() klog.V(4).Infof("TDBetaMeshes.Get(%v, %v) = %+v, %v", ctx, key, v, err) @@ -54610,7 +50033,6 @@ func (g *TDBetaMeshes) Get(ctx context.Context, key *meta.Key, options ...Option func (g *TDBetaMeshes) List(ctx context.Context, fl *filter.F, options ...Option) ([]*networkservicesbeta.Mesh, error) { opts := mergeOptions(options) klog.V(5).Infof("TDBetaMeshes.List(%v, %v, %v) called", ctx, fl, opts) - key := &meta.Key{} projectID := getProjectID(ctx, g.s.ProjectRouter, opts, "beta", "Meshes") ck := &CallContextKey{ @@ -54618,7 +50040,6 @@ func (g *TDBetaMeshes) List(ctx context.Context, fl *filter.F, options ...Option Operation: "List", Version: meta.Version("beta"), Service: "Meshes", - Resource: key, } callObserverStart(ctx, ck) @@ -54626,8 +50047,7 @@ func (g *TDBetaMeshes) List(ctx context.Context, fl *filter.F, options ...Option return nil, err } klog.V(5).Infof("TDBetaMeshes.List(%v, %v): projectID = %v, ck = %+v", ctx, fl, projectID, ck) - parent := fmt.Sprintf("projects/%s/locations/global", projectID) - call := g.s.NetworkServicesBeta.Meshes.List(parent) + call := g.s.NetworkServicesBeta.Meshes.List(projectID) var all []*networkservicesbeta.Mesh f := func(l *networkservicesbeta.ListMeshesResponse) error { @@ -54675,7 +50095,6 @@ func (g *TDBetaMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkse Operation: "Insert", Version: meta.Version("beta"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDBetaMeshes.Create(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -54686,17 +50105,15 @@ func (g *TDBetaMeshes) Insert(ctx context.Context, key *meta.Key, obj *networkse obj.Name = key.Name parent := fmt.Sprintf("projects/%s/locations/global", projectID) call := g.s.NetworkServicesBeta.Meshes.Create(parent, obj) - call.MeshId(obj.Name) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDBetaMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDBetaMeshes.Insert(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -54720,7 +50137,6 @@ func (g *TDBetaMeshes) Delete(ctx context.Context, key *meta.Key, options ...Opt Operation: "Delete", Version: meta.Version("beta"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDBetaMeshes.Delete(%v, %v): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -54733,14 +50149,13 @@ func (g *TDBetaMeshes) Delete(ctx context.Context, key *meta.Key, options ...Opt call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDBetaMeshes.Delete(%v, %v) = %v", ctx, key, err) callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) if err != nil { + klog.V(4).Infof("TDBetaMeshes.Delete(%v, %v) = %v", ctx, key, err) return err } @@ -54764,7 +50179,6 @@ func (g *TDBetaMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkse Operation: "Patch", Version: meta.Version("beta"), Service: "Meshes", - Resource: key, } klog.V(5).Infof("TDBetaMeshes.Patch(%v, %v, ...): projectID = %v, ck = %+v", ctx, key, projectID, ck) callObserverStart(ctx, ck) @@ -54775,14 +50189,13 @@ func (g *TDBetaMeshes) Patch(ctx context.Context, key *meta.Key, arg0 *networkse name := fmt.Sprintf("projects/%s/locations/global/meshes/%s", projectID, key.Name) call := g.s.NetworkServicesBeta.Meshes.Patch(name, arg0) call.Context(ctx) - handleHeaderOptions(&opts, call.Header()) op, err := call.Do() - klog.V(4).Infof("TDBetaMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) if err != nil { callObserverEnd(ctx, ck, err) g.s.RateLimiter.Observe(ctx, err, ck) + klog.V(4).Infof("TDBetaMeshes.Patch(%v, %v, ...) = %+v", ctx, key, err) return err } @@ -54938,12 +50351,6 @@ func NewRegionHealthChecksResourceID(project, region, name string) *ResourceID { return &ResourceID{project, "compute", "healthChecks", key} } -// NewRegionNetworkEndpointGroupsResourceID creates a ResourceID for the RegionNetworkEndpointGroups resource. -func NewRegionNetworkEndpointGroupsResourceID(project, region, name string) *ResourceID { - key := meta.RegionalKey(name, region) - return &ResourceID{project, "compute", "networkEndpointGroups", key} -} - // NewRegionNetworkFirewallPoliciesResourceID creates a ResourceID for the RegionNetworkFirewallPolicies resource. func NewRegionNetworkFirewallPoliciesResourceID(project, region, name string) *ResourceID { key := meta.RegionalKey(name, region) @@ -54974,12 +50381,6 @@ func NewRegionTargetHttpsProxiesResourceID(project, region, name string) *Resour return &ResourceID{project, "compute", "targetHttpsProxies", key} } -// NewRegionTargetTcpProxiesResourceID creates a ResourceID for the RegionTargetTcpProxies resource. -func NewRegionTargetTcpProxiesResourceID(project, region, name string) *ResourceID { - key := meta.RegionalKey(name, region) - return &ResourceID{project, "compute", "targetTcpProxies", key} -} - // NewRegionUrlMapsResourceID creates a ResourceID for the RegionUrlMaps resource. func NewRegionUrlMapsResourceID(project, region, name string) *ResourceID { key := meta.RegionalKey(name, region) diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS deleted file mode 100644 index 40e7bf8687..0000000000 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/OWNERS +++ /dev/null @@ -1,4 +0,0 @@ -approvers: -- mag-kol -- kl52752 -- briantkennedy diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go index 0ecadcf1ab..ba36fddfa6 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/compute_services.go @@ -278,7 +278,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Regional, serviceType: reflect.TypeOf(&ga.ForwardingRulesService{}), additionalMethods: []string{ - "Patch", "SetTarget", "SetLabels", }, @@ -291,7 +290,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Regional, serviceType: reflect.TypeOf(&alpha.ForwardingRulesService{}), additionalMethods: []string{ - "Patch", "SetTarget", "SetLabels", }, @@ -304,7 +302,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Regional, serviceType: reflect.TypeOf(&beta.ForwardingRulesService{}), additionalMethods: []string{ - "Patch", "SetTarget", "SetLabels", }, @@ -317,7 +314,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&alpha.GlobalForwardingRulesService{}), additionalMethods: []string{ - "Patch", "SetTarget", "SetLabels", }, @@ -330,7 +326,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&beta.GlobalForwardingRulesService{}), additionalMethods: []string{ - "Patch", "SetTarget", "SetLabels", }, @@ -342,7 +337,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&ga.GlobalForwardingRulesService{}), additionalMethods: []string{ - "Patch", "SetTarget", "SetLabels", }, @@ -654,45 +648,6 @@ var ComputeServices = []*ServiceInfo{ "ListNetworkEndpoints", }, }, - { - Object: "NetworkEndpointGroup", - Service: "RegionNetworkEndpointGroups", - Resource: "networkEndpointGroups", - version: VersionAlpha, - keyType: Regional, - serviceType: reflect.TypeOf(&alpha.RegionNetworkEndpointGroupsService{}), - additionalMethods: []string{ - "AttachNetworkEndpoints", - "DetachNetworkEndpoints", - "ListNetworkEndpoints", - }, - }, - { - Object: "NetworkEndpointGroup", - Service: "RegionNetworkEndpointGroups", - Resource: "networkEndpointGroups", - version: VersionBeta, - keyType: Regional, - serviceType: reflect.TypeOf(&beta.RegionNetworkEndpointGroupsService{}), - additionalMethods: []string{ - "AttachNetworkEndpoints", - "DetachNetworkEndpoints", - "ListNetworkEndpoints", - }, - }, - { - Object: "NetworkEndpointGroup", - Service: "RegionNetworkEndpointGroups", - Resource: "networkEndpointGroups", - version: VersionGA, - keyType: Regional, - serviceType: reflect.TypeOf(&ga.RegionNetworkEndpointGroupsService{}), - additionalMethods: []string{ - "AttachNetworkEndpoints", - "DetachNetworkEndpoints", - "ListNetworkEndpoints", - }, - }, { Object: "Project", Service: "Projects", @@ -994,7 +949,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&alpha.TargetHttpsProxiesService{}), additionalMethods: []string{ - "Patch", "SetCertificateMap", "SetSslCertificates", "SetSslPolicy", @@ -1009,7 +963,6 @@ var ComputeServices = []*ServiceInfo{ keyType: Global, serviceType: reflect.TypeOf(&beta.TargetHttpsProxiesService{}), additionalMethods: []string{ - "Patch", "SetCertificateMap", "SetSslCertificates", "SetSslPolicy", @@ -1099,33 +1052,6 @@ var ComputeServices = []*ServiceInfo{ "SetBackendService", }, }, - { - Object: "TargetTcpProxy", - Service: "RegionTargetTcpProxies", - Resource: "targetTcpProxies", - version: VersionAlpha, - keyType: Regional, - serviceType: reflect.TypeOf(&alpha.RegionTargetTcpProxiesService{}), - additionalMethods: []string{}, - }, - { - Object: "TargetTcpProxy", - Service: "RegionTargetTcpProxies", - Resource: "targetTcpProxies", - version: VersionBeta, - keyType: Regional, - serviceType: reflect.TypeOf(&beta.RegionTargetTcpProxiesService{}), - additionalMethods: []string{}, - }, - { - Object: "TargetTcpProxy", - Service: "RegionTargetTcpProxies", - Resource: "targetTcpProxies", - version: VersionGA, - keyType: Regional, - serviceType: reflect.TypeOf(&ga.RegionTargetTcpProxiesService{}), - additionalMethods: []string{}, - }, { Object: "UrlMap", Service: "UrlMaps", diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go index 1928443769..b6a94ba062 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta/key.go @@ -72,18 +72,6 @@ func (k *Key) Type() KeyType { } } -// Location returns the location for the key. -func (k *Key) Location() string { - switch { - case k.Zone != "": - return k.Zone - case k.Region != "": - return k.Region - default: - return "global" - } -} - // String returns a string representation of the key. func (k Key) String() string { switch k.Type() { diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go index 7e6ed9bcd7..ff7e3d2b9f 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/option.go @@ -1,55 +1,27 @@ package cloud -import ( - "net/http" -) - // Option are optional parameters to the generated methods. -type Option func(*allOptions) +type Option interface { + mergeInto(all *allOptions) +} // allOptions that can be configured for the generated methods. type allOptions struct { - projectID string - addHeaders http.Header - returnPartialSuccess bool -} - -func mergeOptions(options []Option) allOptions { - var ret allOptions - for _, opt := range options { - opt(&ret) - } - return ret -} - -// ReturnPartialSuccess only affects AggregatedList calls, and will have the call return success -// when fanout calls fail. For example, when partial success behavior is enabled, aggregatedList for -// a single zone scope either returns all resources in the zone or no resources, with an error code. -func ReturnPartialSuccess(returnPartialSuccess bool) Option { - return func(opts *allOptions) { - opts.returnPartialSuccess = returnPartialSuccess - } + projectID string } // ForceProjectID forces the projectID to be used in the call to be the one // specified. This ignores the default routing done by the ProjectRouter. -func ForceProjectID(projectID string) Option { - return func(opts *allOptions) { - opts.projectID = projectID - } -} +func ForceProjectID(projectID string) Option { return projectIDOption(projectID) } -// WithHeaders sets the headers to be used in the call. -func AddHeaders(headers http.Header) Option { - return func(opts *allOptions) { - opts.addHeaders = headers - } -} +type projectIDOption string -func handleHeaderOptions(opts *allOptions, to http.Header) { - for k, vals := range opts.addHeaders { - for _, v := range vals { - to.Add(k, v) - } +func (opt projectIDOption) mergeInto(all *allOptions) { all.projectID = string(opt) } + +func mergeOptions(options []Option) allOptions { + var ret allOptions + for _, opt := range options { + opt.mergeInto(&ret) } + return ret } diff --git a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go index 631827eefe..3af4796e7f 100644 --- a/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go +++ b/vendor/github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/ratelimit.go @@ -100,12 +100,10 @@ type MinimumRateLimiter struct { // Accept blocks on the minimum duration and context. Once the minimum duration is met, // the func is blocked on the underlying ratelimiter. func (m *MinimumRateLimiter) Accept(ctx context.Context, key *RateLimitKey) error { - t := time.NewTimer(m.Minimum) select { - case <-t.C: + case <-time.After(m.Minimum): return m.RateLimiter.Accept(ctx, key) case <-ctx.Done(): - t.Stop() return ctx.Err() } } @@ -114,132 +112,3 @@ func (m *MinimumRateLimiter) Accept(ctx context.Context, key *RateLimitKey) erro func (m *MinimumRateLimiter) Observe(ctx context.Context, err error, key *RateLimitKey) { m.RateLimiter.Observe(ctx, err, key) } - -// TickerRateLimiter uses time.Ticker to spread Accepts over time. -// -// Concurrent calls to Accept will block on the same channel. It is not -// guaranteed what caller will be unblocked first. -type TickerRateLimiter struct { - ticker *time.Ticker -} - -// NewTickerRateLimiter creates a new TickerRateLimiter which will space Accept -// calls at least interval/limit time apart. -// -// For example, limit=4 interval=time.Minute will unblock a single Accept call -// every 15 seconds. -func NewTickerRateLimiter(limit int, interval time.Duration) *TickerRateLimiter { - return &TickerRateLimiter{ - ticker: time.NewTicker(interval / time.Duration(limit)), - } -} - -// Accept will block until a time, specified when creating TickerRateLimiter, -// passes since the last call to Accept. -func (t *TickerRateLimiter) Accept(ctx context.Context, rlk *RateLimitKey) error { - select { - case <-t.ticker.C: - return nil - case <-ctx.Done(): - return ctx.Err() - } -} - -// Observe does nothing. -func (*TickerRateLimiter) Observe(context.Context, error, *RateLimitKey) { -} - -// Make sure that TickerRateLimiter implements RateLimiter. -var _ RateLimiter = new(TickerRateLimiter) - -// CompositeRateLimiter combines rate limiters based on RateLimitKey. -type CompositeRateLimiter struct { - // map[resource name]map[operation name]RateLimiter - rateLimiters map[string]map[string]RateLimiter - // defaultRL is used when no matching RateLimiter was found. - defaultRL RateLimiter -} - -// NewCompositeRateLimiter creates a new CompositeRateLimiter that will use -// provided default rate limiter if no better match is found. It is intended to -// be used for a single project. -// -// # Example -// -// bsDefaultRL := /* backend service default rate limiter */ -// bsGetListRL := /* backend service rate limiter for get and list operations */ -// -// rl := NewCompositeRateLimiter(defaultRL) -// rl.Register("BackendServices", "", bsDefaultRL) -// rl.Register("BackendServices", "Get", bsGetListRL) -// rl.Register("BackendServices", "List", bsGetListRL) -// -// This rate limiter is not nesting. Only one rate limiter is used for any -// particular combination of: resource, operation. For the case above, rate -// limiter registered at ("BackendServices", "") won't be applied to operation -// ("BackendServices", "Get"), because a more specific rate limiter was -// registered. -func NewCompositeRateLimiter(defaultRL RateLimiter) *CompositeRateLimiter { - m := map[string]map[string]RateLimiter{ - "": { - "": defaultRL, - }, - } - return &CompositeRateLimiter{ - rateLimiters: m, - defaultRL: defaultRL, - } -} - -// ensureExists creates sub-maps as needed. -func (c *CompositeRateLimiter) ensureExists(service string) { - if _, ok := c.rateLimiters[service]; !ok { - c.rateLimiters[service] = map[string]RateLimiter{} - } -} - -// fillMissing finds all combinations where resource and/or operation name -// could be omitted and sets it to defaultRL. -func (c *CompositeRateLimiter) fillMissing() { - for _, subService := range c.rateLimiters { - if subService[""] == nil { - subService[""] = c.defaultRL - } - } -} - -// Register adds provided rl to the composite rate limiter. Service, operation -// can be omitted by providing an empty string. In this case, the provided rate -// limiter will be used only when there is no other rate limiter matching a -// particular resource, or operation. -// -// It replaces previous rate limiter provided for the same service, operation -// combination. Once a rate limiter is added, it can't be removed. -// -// Same rate limiter can be used for multiple Register calls. -func (c *CompositeRateLimiter) Register(service, operation string, rl RateLimiter) { - c.ensureExists(service) - c.rateLimiters[service][operation] = rl - c.fillMissing() -} - -// Accept either calls underlying rate limiter matching rlk or a default rate -// limiter when none is found. -func (c *CompositeRateLimiter) Accept(ctx context.Context, rlk *RateLimitKey) error { - if rlk == nil { - return c.defaultRL.Accept(ctx, rlk) - } - service := rlk.Service - if _, ok := c.rateLimiters[service]; !ok { - service = "" - } - operation := rlk.Operation - if _, ok := c.rateLimiters[service][operation]; !ok { - operation = "" - } - return c.rateLimiters[service][operation].Accept(ctx, rlk) -} - -// Observe does nothing. -func (*CompositeRateLimiter) Observe(context.Context, error, *RateLimitKey) { -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 8860487073..dbdb351932 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -54,8 +54,8 @@ github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/ github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/versioned/scheme github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/versioned/typed/nodetopology/v1 github.com/GoogleCloudPlatform/gke-networking-api/client/nodetopology/clientset/versioned/typed/nodetopology/v1/fake -# github.com/GoogleCloudPlatform/k8s-cloud-provider v1.34.0 -## explicit; go 1.21 +# github.com/GoogleCloudPlatform/k8s-cloud-provider v1.27.0 +## explicit; go 1.20 github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/filter github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud/meta From c3b0081d79606f0a1c92d145fac357a2efd77761 Mon Sep 17 00:00:00 2001 From: Walter Fender Date: Mon, 11 May 2026 13:44:12 -0700 Subject: [PATCH 40/78] Remove the cluster directory (#1116) This task removes the cluster directory and related scripts/targets. It's no longer needed after removing kubetest2-gce dependency. This PR was generated by Overseer (powered by the gemini-3-flash-preview model). --- .gitignore | 1 - Makefile | 66 +- cluster/OWNERS | 24 - cluster/addons/README.md | 34 - cluster/addons/addon-manager/CHANGELOG.md | 109 - cluster/addons/addon-manager/Dockerfile | 25 - cluster/addons/addon-manager/Makefile | 57 - cluster/addons/addon-manager/README.md | 59 - .../addons/addon-manager/kube-addons-main.sh | 74 - .../addons/addon-manager/kube-addons-test.sh | 286 -- cluster/addons/addon-manager/kube-addons.sh | 294 -- .../addons/calico-policy-controller/README.md | 13 - .../bgpconfigurations-crd.yaml | 131 - .../bgppeers-crd.yaml | 105 - .../blockaffinity-crd.yaml | 60 - .../calico-clusterrole.yaml | 140 - .../calico-clusterrolebinding.yaml | 14 - .../calico-cpva-clusterrole.yaml | 13 - .../calico-cpva-clusterrolebinding.yaml | 14 - .../calico-cpva-serviceaccount.yaml | 7 - .../calico-node-daemonset.yaml | 189 - ...co-node-vertical-autoscaler-configmap.yaml | 21 - ...o-node-vertical-autoscaler-deployment.yaml | 38 - .../calico-serviceaccount.yaml | 7 - .../clusterinformations-crd.yaml | 64 - .../felixconfigurations-crd.yaml | 540 --- .../globalnetworkpolicy-crd.yaml | 771 --- .../globalnetworksets-crd.yaml | 53 - .../hostendpoints-crd.yaml | 108 - .../ipamblock-crd.yaml | 81 - .../ipamconfig-crd.yaml | 52 - .../ipamhandle-crd.yaml | 54 - .../calico-policy-controller/ippool-crd.yaml | 99 - .../kubecontrollersconfigurations-crd.yaml | 223 - .../networkpolicies-crd.yaml | 752 --- .../networkset-crd.yaml | 51 - .../typha-deployment.yaml | 75 - ...pha-horizontal-autoscaler-clusterrole.yaml | 10 - ...izontal-autoscaler-clusterrolebinding.yaml | 14 - ...typha-horizontal-autoscaler-configmap.yaml | 23 - ...ypha-horizontal-autoscaler-deployment.yaml | 38 - .../typha-horizontal-autoscaler-role.yaml | 14 - ...pha-horizontal-autoscaler-rolebinding.yaml | 15 - ...-horizontal-autoscaler-serviceaccount.yaml | 7 - .../typha-service.yaml | 17 - ...typha-vertical-autoscaler-clusterrole.yaml | 13 - ...ertical-autoscaler-clusterrolebinding.yaml | 14 - .../typha-vertical-autoscaler-configmap.yaml | 21 - .../typha-vertical-autoscaler-deployment.yaml | 38 - ...ha-vertical-autoscaler-serviceaccount.yaml | 7 - .../cloud-node-controller-binding.yaml | 46 - .../cloud-node-controller-role.yaml | 177 - .../pvl-controller-role.yaml | 23 - .../cluster-loadbalancing/glbc/README.md | 9 - .../glbc/default-svc-controller.yaml | 45 - .../glbc/default-svc.yaml | 22 - .../dns-horizontal-autoscaler/MAINTAINERS.md | 3 - .../dns-horizontal-autoscaler/README.md | 11 - .../dns-horizontal-autoscaler.yaml | 108 - cluster/addons/dns/coredns/Makefile | 34 - cluster/addons/dns/coredns/coredns.yaml.base | 216 - cluster/addons/dns/coredns/coredns.yaml.in | 216 - cluster/addons/dns/coredns/coredns.yaml.sed | 216 - .../addons/dns/coredns/transforms2salt.sed | 5 - cluster/addons/dns/coredns/transforms2sed.sed | 5 - cluster/addons/dns/kube-dns/Makefile | 34 - cluster/addons/dns/kube-dns/README.md | 62 - .../addons/dns/kube-dns/kube-dns.yaml.base | 247 - cluster/addons/dns/kube-dns/kube-dns.yaml.in | 247 - cluster/addons/dns/kube-dns/kube-dns.yaml.sed | 247 - .../addons/dns/kube-dns/transforms2salt.sed | 5 - .../addons/dns/kube-dns/transforms2sed.sed | 5 - cluster/addons/dns/nodelocaldns/README.md | 55 - .../addons/dns/nodelocaldns/nodelocaldns.yaml | 211 - cluster/addons/fluentd-gcp/README.md | 75 - .../addons/fluentd-gcp/event-exporter.yaml | 82 - .../fluentd-gcp-configmap-old.yaml | 425 -- .../fluentd-gcp/fluentd-gcp-configmap.yaml | 465 -- .../addons/fluentd-gcp/fluentd-gcp-ds-sa.yaml | 8 - .../addons/fluentd-gcp/fluentd-gcp-ds.yaml | 117 - .../fluentd-gcp/fluentd-gcp-image/README.md | 4 - .../addons/fluentd-gcp/scaler-deployment.yaml | 36 - cluster/addons/fluentd-gcp/scaler-policy.yaml | 20 - cluster/addons/fluentd-gcp/scaler-rbac.yaml | 48 - .../addons/ip-masq-agent/ip-masq-agent.yaml | 64 - .../kube-network-policies-rbac.yaml | 49 - .../kube-network-policies.yaml | 47 - cluster/addons/kube-proxy/kube-proxy-ds.yaml | 74 - .../addons/kube-proxy/kube-proxy-rbac.yaml | 22 - cluster/addons/metadata-agent/README.md | 4 - .../stackdriver/metadata-agent-rbac.yaml | 32 - .../stackdriver/metadata-agent.yaml | 131 - cluster/addons/metadata-proxy/README.md | 5 - .../metadata-proxy/gce/metadata-proxy.yaml | 89 - cluster/addons/metrics-server/README.md | 18 - .../addons/metrics-server/auth-delegator.yaml | 15 - .../addons/metrics-server/auth-reader.yaml | 16 - .../metrics-server/metrics-apiservice.yaml | 16 - .../metrics-server-deployment.yaml | 129 - .../metrics-server-service.yaml | 16 - .../metrics-server/resource-reader.yaml | 49 - .../node-problem-detector/MAINTAINERS.md | 4 - .../addons/node-problem-detector/README.md | 7 - .../kubelet-user-standalone/npd-binding.yaml | 15 - cluster/addons/node-problem-detector/npd.yaml | 96 - .../standalone/npd-binding.yaml | 15 - cluster/addons/pdcsi-driver/README.md | 5 - cluster/addons/pdcsi-driver/pd-csi-psp.yaml | 74 - cluster/addons/pdcsi-driver/pd-csi-rbac.yaml | 458 -- cluster/addons/pdcsi-driver/pd-csi.yaml | 188 - cluster/addons/pdcsi-driver/sc-premium.yaml | 14 - cluster/addons/pdcsi-driver/sc-standard.yaml | 14 - .../cluster-autoscaler-rbac.yaml | 71 - .../cluster-loadbalancing/glbc/roles.yaml | 73 - .../glbc/user-rolebindings.yaml | 28 - ...e-apiserver-kubelet-api-admin-binding.yaml | 15 - .../kubelet-api-admin-role.yaml | 17 - .../kubelet-certificate-management.yaml | 58 - .../kubelet-binding.yaml | 29 - .../legacy-kubelet-user/kubelet-binding.yaml | 18 - .../addons/storage-class/azure/default.yaml | 9 - cluster/addons/storage-class/gce/default.yaml | 12 - .../addons/storage-class/local/default.yaml | 10 - ....storage.k8s.io_volumesnapshotclasses.yaml | 145 - ...storage.k8s.io_volumesnapshotcontents.yaml | 459 -- ...apshot.storage.k8s.io_volumesnapshots.yaml | 353 -- .../rbac-volume-snapshot-controller.yaml | 99 - ...volume-snapshot-controller-deployment.yaml | 29 - cluster/clientbin.sh | 99 - cluster/common.sh | 568 --- cluster/gce/addons/README.md | 7 - .../resource-quota.yaml | 18 - .../mutating-webhook-configuration.yaml | 25 - .../konnectivity-agent-ds.yaml | 82 - .../konnectivity-agent-rbac.yaml | 8 - .../konnectivity-agent/konnectivity-rbac.yaml | 15 - .../gce/addons/limit-range/limit-range.yaml | 12 - .../loadbalancing/cloud-provider-binding.yaml | 30 - .../loadbalancing/cloud-provider-role.yaml | 86 - cluster/gce/config-common.sh | 177 - cluster/gce/config-default.sh | 568 --- cluster/gce/config-test.sh | 616 --- cluster/gce/cos | 1 - cluster/gce/custom | 1 - cluster/gce/delete-stranded-load-balancers.sh | 35 - cluster/gce/gci/README.md | 108 - cluster/gce/gci/apiserver_etcd_test.go | 215 - cluster/gce/gci/apiserver_kms_test.go | 225 - .../append_or_replace_prefixed_line_test.go | 182 - cluster/gce/gci/audit_policy_test.go | 265 -- cluster/gce/gci/configure-helper.sh | 3751 --------------- cluster/gce/gci/configure-kubeapiserver.sh | 492 -- cluster/gce/gci/configure.sh | 1055 ----- cluster/gce/gci/configure_helper_test.go | 179 - cluster/gce/gci/flexvolume_node_setup.sh | 183 - cluster/gce/gci/helper.sh | 26 - cluster/gce/gci/kube-master-internal-route.sh | 27 - cluster/gce/gci/master-helper.sh | 216 - cluster/gce/gci/master.yaml | 140 - cluster/gce/gci/mounter/.gitignore | 1 - cluster/gce/gci/mounter/Changelog | 7 - cluster/gce/gci/mounter/Dockerfile | 19 - cluster/gce/gci/mounter/Makefile | 30 - cluster/gce/gci/mounter/mounter.go | 93 - cluster/gce/gci/mounter/stage-upload.sh | 68 - cluster/gce/gci/node-helper.sh | 47 - cluster/gce/gci/node.yaml | 96 - cluster/gce/gci/shutdown.sh | 23 - .../gci/testdata/kube-apiserver/base.template | 22 - .../gci/testdata/kube-apiserver/etcd.template | 16 - .../gci/testdata/kube-apiserver/kms.template | 9 - cluster/gce/list-resources.sh | 102 - cluster/gce/manifests/abac-authz-policy.jsonl | 7 - .../cloud-controller-manager.manifest | 115 - .../gce/manifests/cluster-autoscaler.manifest | 115 - cluster/gce/manifests/cri-auth-config.yaml | 12 - cluster/gce/manifests/etcd.manifest | 132 - cluster/gce/manifests/glbc.manifest | 85 - .../gce/manifests/konnectivity-server.yaml | 67 - cluster/gce/manifests/kube-addon-manager.yaml | 61 - cluster/gce/manifests/kube-apiserver.manifest | 154 - .../kube-controller-manager.manifest | 121 - cluster/gce/manifests/kube-proxy.manifest | 77 - cluster/gce/manifests/kube-scheduler.manifest | 79 - cluster/gce/manifests/pdcsi-controller.yaml | 165 - cluster/gce/ubuntu | 1 - cluster/gce/upgrade-aliases.sh | 180 - cluster/gce/upgrade.sh | 707 --- cluster/gce/util.sh | 4218 ----------------- .../gce/windows/README-GCE-Windows-kube-up.md | 241 - cluster/gce/windows/common.psm1 | 672 --- cluster/gce/windows/configure.ps1 | 213 - cluster/gce/windows/k8s-node-setup.psm1 | 2350 --------- cluster/gce/windows/node-helper.sh | 58 - cluster/gce/windows/smoke-test.sh | 642 --- cluster/gce/windows/testonly/install-ssh.psm1 | 294 -- .../gce/windows/testonly/user-profile.psm1 | 343 -- cluster/get-kube-binaries.sh | 292 -- cluster/get-kube.sh | 268 -- cluster/kube-down.sh | 40 - cluster/kube-up.sh | 79 - cluster/kube-util.sh | 39 - cluster/kubectl.sh | 76 - cluster/kubemark/gce/config-default.sh | 61 - cluster/kubemark/iks/config-default.sh | 44 - .../kubemark/pre-existing/config-default.sh | 37 - cluster/kubemark/util.sh | 20 - cluster/log-dump/README.md | 19 - cluster/log-dump/log-dump.sh | 716 --- cluster/log-dump/logexporter-daemonset.yaml | 81 - cluster/pre-existing/util.sh | 45 - cluster/skeleton/util.sh | 79 - cluster/util.sh | 821 ---- cluster/validate-cluster.sh | 192 - docs/RELEASE.md | 68 - tools/bump_cluster.sh | 63 - 216 files changed, 2 insertions(+), 35647 deletions(-) delete mode 100644 cluster/OWNERS delete mode 100644 cluster/addons/README.md delete mode 100644 cluster/addons/addon-manager/CHANGELOG.md delete mode 100644 cluster/addons/addon-manager/Dockerfile delete mode 100644 cluster/addons/addon-manager/Makefile delete mode 100644 cluster/addons/addon-manager/README.md delete mode 100755 cluster/addons/addon-manager/kube-addons-main.sh delete mode 100755 cluster/addons/addon-manager/kube-addons-test.sh delete mode 100755 cluster/addons/addon-manager/kube-addons.sh delete mode 100644 cluster/addons/calico-policy-controller/README.md delete mode 100644 cluster/addons/calico-policy-controller/bgpconfigurations-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/bgppeers-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/blockaffinity-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-clusterrole.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-clusterrolebinding.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-cpva-clusterrole.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-cpva-clusterrolebinding.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-cpva-serviceaccount.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-node-daemonset.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-configmap.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-deployment.yaml delete mode 100644 cluster/addons/calico-policy-controller/calico-serviceaccount.yaml delete mode 100644 cluster/addons/calico-policy-controller/clusterinformations-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/felixconfigurations-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/globalnetworkpolicy-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/globalnetworksets-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/hostendpoints-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/ipamblock-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/ipamconfig-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/ipamhandle-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/ippool-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/kubecontrollersconfigurations-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/networkpolicies-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/networkset-crd.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-deployment.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrole.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrolebinding.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-configmap.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-deployment.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-role.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-rolebinding.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-serviceaccount.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-service.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrole.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrolebinding.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-vertical-autoscaler-configmap.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-vertical-autoscaler-deployment.yaml delete mode 100644 cluster/addons/calico-policy-controller/typha-vertical-autoscaler-serviceaccount.yaml delete mode 100644 cluster/addons/cloud-controller-manager/cloud-node-controller-binding.yaml delete mode 100644 cluster/addons/cloud-controller-manager/cloud-node-controller-role.yaml delete mode 100644 cluster/addons/cloud-controller-manager/pvl-controller-role.yaml delete mode 100644 cluster/addons/cluster-loadbalancing/glbc/README.md delete mode 100644 cluster/addons/cluster-loadbalancing/glbc/default-svc-controller.yaml delete mode 100644 cluster/addons/cluster-loadbalancing/glbc/default-svc.yaml delete mode 100644 cluster/addons/dns-horizontal-autoscaler/MAINTAINERS.md delete mode 100644 cluster/addons/dns-horizontal-autoscaler/README.md delete mode 100644 cluster/addons/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml delete mode 100644 cluster/addons/dns/coredns/Makefile delete mode 100644 cluster/addons/dns/coredns/coredns.yaml.base delete mode 100644 cluster/addons/dns/coredns/coredns.yaml.in delete mode 100644 cluster/addons/dns/coredns/coredns.yaml.sed delete mode 100644 cluster/addons/dns/coredns/transforms2salt.sed delete mode 100644 cluster/addons/dns/coredns/transforms2sed.sed delete mode 100644 cluster/addons/dns/kube-dns/Makefile delete mode 100644 cluster/addons/dns/kube-dns/README.md delete mode 100644 cluster/addons/dns/kube-dns/kube-dns.yaml.base delete mode 100644 cluster/addons/dns/kube-dns/kube-dns.yaml.in delete mode 100644 cluster/addons/dns/kube-dns/kube-dns.yaml.sed delete mode 100644 cluster/addons/dns/kube-dns/transforms2salt.sed delete mode 100644 cluster/addons/dns/kube-dns/transforms2sed.sed delete mode 100644 cluster/addons/dns/nodelocaldns/README.md delete mode 100644 cluster/addons/dns/nodelocaldns/nodelocaldns.yaml delete mode 100644 cluster/addons/fluentd-gcp/README.md delete mode 100644 cluster/addons/fluentd-gcp/event-exporter.yaml delete mode 100644 cluster/addons/fluentd-gcp/fluentd-gcp-configmap-old.yaml delete mode 100644 cluster/addons/fluentd-gcp/fluentd-gcp-configmap.yaml delete mode 100644 cluster/addons/fluentd-gcp/fluentd-gcp-ds-sa.yaml delete mode 100644 cluster/addons/fluentd-gcp/fluentd-gcp-ds.yaml delete mode 100644 cluster/addons/fluentd-gcp/fluentd-gcp-image/README.md delete mode 100644 cluster/addons/fluentd-gcp/scaler-deployment.yaml delete mode 100644 cluster/addons/fluentd-gcp/scaler-policy.yaml delete mode 100644 cluster/addons/fluentd-gcp/scaler-rbac.yaml delete mode 100644 cluster/addons/ip-masq-agent/ip-masq-agent.yaml delete mode 100644 cluster/addons/kube-network-policies/kube-network-policies-rbac.yaml delete mode 100644 cluster/addons/kube-network-policies/kube-network-policies.yaml delete mode 100644 cluster/addons/kube-proxy/kube-proxy-ds.yaml delete mode 100644 cluster/addons/kube-proxy/kube-proxy-rbac.yaml delete mode 100644 cluster/addons/metadata-agent/README.md delete mode 100644 cluster/addons/metadata-agent/stackdriver/metadata-agent-rbac.yaml delete mode 100644 cluster/addons/metadata-agent/stackdriver/metadata-agent.yaml delete mode 100644 cluster/addons/metadata-proxy/README.md delete mode 100644 cluster/addons/metadata-proxy/gce/metadata-proxy.yaml delete mode 100644 cluster/addons/metrics-server/README.md delete mode 100644 cluster/addons/metrics-server/auth-delegator.yaml delete mode 100644 cluster/addons/metrics-server/auth-reader.yaml delete mode 100644 cluster/addons/metrics-server/metrics-apiservice.yaml delete mode 100644 cluster/addons/metrics-server/metrics-server-deployment.yaml delete mode 100644 cluster/addons/metrics-server/metrics-server-service.yaml delete mode 100644 cluster/addons/metrics-server/resource-reader.yaml delete mode 100644 cluster/addons/node-problem-detector/MAINTAINERS.md delete mode 100644 cluster/addons/node-problem-detector/README.md delete mode 100644 cluster/addons/node-problem-detector/kubelet-user-standalone/npd-binding.yaml delete mode 100644 cluster/addons/node-problem-detector/npd.yaml delete mode 100644 cluster/addons/node-problem-detector/standalone/npd-binding.yaml delete mode 100644 cluster/addons/pdcsi-driver/README.md delete mode 100644 cluster/addons/pdcsi-driver/pd-csi-psp.yaml delete mode 100644 cluster/addons/pdcsi-driver/pd-csi-rbac.yaml delete mode 100644 cluster/addons/pdcsi-driver/pd-csi.yaml delete mode 100644 cluster/addons/pdcsi-driver/sc-premium.yaml delete mode 100644 cluster/addons/pdcsi-driver/sc-standard.yaml delete mode 100644 cluster/addons/rbac/cluster-autoscaler/cluster-autoscaler-rbac.yaml delete mode 100644 cluster/addons/rbac/cluster-loadbalancing/glbc/roles.yaml delete mode 100644 cluster/addons/rbac/cluster-loadbalancing/glbc/user-rolebindings.yaml delete mode 100644 cluster/addons/rbac/kubelet-api-auth/kube-apiserver-kubelet-api-admin-binding.yaml delete mode 100644 cluster/addons/rbac/kubelet-api-auth/kubelet-api-admin-role.yaml delete mode 100644 cluster/addons/rbac/kubelet-cert-rotation/kubelet-certificate-management.yaml delete mode 100644 cluster/addons/rbac/legacy-kubelet-user-disable/kubelet-binding.yaml delete mode 100644 cluster/addons/rbac/legacy-kubelet-user/kubelet-binding.yaml delete mode 100644 cluster/addons/storage-class/azure/default.yaml delete mode 100644 cluster/addons/storage-class/gce/default.yaml delete mode 100644 cluster/addons/storage-class/local/default.yaml delete mode 100644 cluster/addons/volumesnapshots/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml delete mode 100644 cluster/addons/volumesnapshots/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml delete mode 100644 cluster/addons/volumesnapshots/crd/snapshot.storage.k8s.io_volumesnapshots.yaml delete mode 100644 cluster/addons/volumesnapshots/volume-snapshot-controller/rbac-volume-snapshot-controller.yaml delete mode 100644 cluster/addons/volumesnapshots/volume-snapshot-controller/volume-snapshot-controller-deployment.yaml delete mode 100755 cluster/clientbin.sh delete mode 100755 cluster/common.sh delete mode 100644 cluster/gce/addons/README.md delete mode 100644 cluster/gce/addons/admission-resource-quota-critical-pods/resource-quota.yaml delete mode 100644 cluster/gce/addons/cloud-pvl-admission/mutating-webhook-configuration.yaml delete mode 100644 cluster/gce/addons/konnectivity-agent/konnectivity-agent-ds.yaml delete mode 100644 cluster/gce/addons/konnectivity-agent/konnectivity-agent-rbac.yaml delete mode 100644 cluster/gce/addons/konnectivity-agent/konnectivity-rbac.yaml delete mode 100644 cluster/gce/addons/limit-range/limit-range.yaml delete mode 100644 cluster/gce/addons/loadbalancing/cloud-provider-binding.yaml delete mode 100644 cluster/gce/addons/loadbalancing/cloud-provider-role.yaml delete mode 100644 cluster/gce/config-common.sh delete mode 100755 cluster/gce/config-default.sh delete mode 100755 cluster/gce/config-test.sh delete mode 120000 cluster/gce/cos delete mode 120000 cluster/gce/custom delete mode 100755 cluster/gce/delete-stranded-load-balancers.sh delete mode 100644 cluster/gce/gci/README.md delete mode 100644 cluster/gce/gci/apiserver_etcd_test.go delete mode 100644 cluster/gce/gci/apiserver_kms_test.go delete mode 100644 cluster/gce/gci/append_or_replace_prefixed_line_test.go delete mode 100644 cluster/gce/gci/audit_policy_test.go delete mode 100755 cluster/gce/gci/configure-helper.sh delete mode 100644 cluster/gce/gci/configure-kubeapiserver.sh delete mode 100644 cluster/gce/gci/configure.sh delete mode 100644 cluster/gce/gci/configure_helper_test.go delete mode 100755 cluster/gce/gci/flexvolume_node_setup.sh delete mode 100755 cluster/gce/gci/helper.sh delete mode 100644 cluster/gce/gci/kube-master-internal-route.sh delete mode 100755 cluster/gce/gci/master-helper.sh delete mode 100644 cluster/gce/gci/master.yaml delete mode 100644 cluster/gce/gci/mounter/.gitignore delete mode 100644 cluster/gce/gci/mounter/Changelog delete mode 100644 cluster/gce/gci/mounter/Dockerfile delete mode 100644 cluster/gce/gci/mounter/Makefile delete mode 100644 cluster/gce/gci/mounter/mounter.go delete mode 100755 cluster/gce/gci/mounter/stage-upload.sh delete mode 100755 cluster/gce/gci/node-helper.sh delete mode 100644 cluster/gce/gci/node.yaml delete mode 100755 cluster/gce/gci/shutdown.sh delete mode 100644 cluster/gce/gci/testdata/kube-apiserver/base.template delete mode 100644 cluster/gce/gci/testdata/kube-apiserver/etcd.template delete mode 100644 cluster/gce/gci/testdata/kube-apiserver/kms.template delete mode 100755 cluster/gce/list-resources.sh delete mode 100644 cluster/gce/manifests/abac-authz-policy.jsonl delete mode 100644 cluster/gce/manifests/cloud-controller-manager.manifest delete mode 100644 cluster/gce/manifests/cluster-autoscaler.manifest delete mode 100644 cluster/gce/manifests/cri-auth-config.yaml delete mode 100644 cluster/gce/manifests/etcd.manifest delete mode 100644 cluster/gce/manifests/glbc.manifest delete mode 100644 cluster/gce/manifests/konnectivity-server.yaml delete mode 100644 cluster/gce/manifests/kube-addon-manager.yaml delete mode 100644 cluster/gce/manifests/kube-apiserver.manifest delete mode 100644 cluster/gce/manifests/kube-controller-manager.manifest delete mode 100644 cluster/gce/manifests/kube-proxy.manifest delete mode 100644 cluster/gce/manifests/kube-scheduler.manifest delete mode 100644 cluster/gce/manifests/pdcsi-controller.yaml delete mode 120000 cluster/gce/ubuntu delete mode 100755 cluster/gce/upgrade-aliases.sh delete mode 100755 cluster/gce/upgrade.sh delete mode 100755 cluster/gce/util.sh delete mode 100644 cluster/gce/windows/README-GCE-Windows-kube-up.md delete mode 100644 cluster/gce/windows/common.psm1 delete mode 100644 cluster/gce/windows/configure.ps1 delete mode 100644 cluster/gce/windows/k8s-node-setup.psm1 delete mode 100755 cluster/gce/windows/node-helper.sh delete mode 100755 cluster/gce/windows/smoke-test.sh delete mode 100644 cluster/gce/windows/testonly/install-ssh.psm1 delete mode 100644 cluster/gce/windows/testonly/user-profile.psm1 delete mode 100755 cluster/get-kube-binaries.sh delete mode 100755 cluster/get-kube.sh delete mode 100755 cluster/kube-down.sh delete mode 100755 cluster/kube-up.sh delete mode 100755 cluster/kube-util.sh delete mode 100755 cluster/kubectl.sh delete mode 100644 cluster/kubemark/gce/config-default.sh delete mode 100644 cluster/kubemark/iks/config-default.sh delete mode 100644 cluster/kubemark/pre-existing/config-default.sh delete mode 100644 cluster/kubemark/util.sh delete mode 100644 cluster/log-dump/README.md delete mode 100755 cluster/log-dump/log-dump.sh delete mode 100644 cluster/log-dump/logexporter-daemonset.yaml delete mode 100644 cluster/pre-existing/util.sh delete mode 100644 cluster/skeleton/util.sh delete mode 100755 cluster/util.sh delete mode 100755 cluster/validate-cluster.sh delete mode 100755 tools/bump_cluster.sh diff --git a/.gitignore b/.gitignore index 1528e9f936..44c96c28b8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -cluster/bin MERGED_LICENSES release/* .go-cache/ diff --git a/Makefile b/Makefile index e192761344..ac5d74e410 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ copy-binaries-to-gcs: build-all ## Build and copy binaries to GCS. gcloud storage cp --recursive release/$(GIT_VERSION) gs://$(BUCKET_NAME)/$(GIT_VERSION) .PHONY: release-tars -release-tars: release-tars-linux-amd64 release-tars-windows-amd64 release-manifests generate-all-checksums ## Build all release artifacts. +release-tars: release-tars-linux-amd64 release-tars-windows-amd64 generate-all-checksums ## Build all release artifacts. # Helper for release-tars, not intended for direct use. .PHONY: .ensure-kube-version @@ -200,56 +200,8 @@ release-tars-windows-amd64: auth-provider-gcp-windows-amd64 ## Build release art rm -rf release/$(GIT_VERSION)/node-windows @echo "Windows amd64 release tarball created in release/$(GIT_VERSION)/" -.PHONY: release-manifests -release-manifests: .ensure-kube-version ## Build the kubernetes-manifests.tar.gz artifact. - # Pack kubernetes-manifests.tar.gz - # 1. Download and unpack the UPSTREAM manifests - @echo "Packing kubernetes-manifests.tar.gz..." - mkdir -p release/$(GIT_VERSION)/manifests release/upstream-manifests - curl -L "https://dl.k8s.io/release/$$(cat release/$(GIT_VERSION)/kube-version.txt)/kubernetes-manifests.tar.gz" -o release/upstream-manifests/manifests.tar.gz - tar xzf release/upstream-manifests/manifests.tar.gz -C release/$(GIT_VERSION)/manifests - - - # 2. OVERLAY your local changes from the cloud-provider-gcp repo - # Standard addons should go in the 'addons' directory - mkdir -p release/$(GIT_VERSION)/manifests/kubernetes/addons - cp -r cluster/addons/* release/$(GIT_VERSION)/manifests/kubernetes/addons/ - # Additional GCE-specific addons - cp -r cluster/gce/addons/* release/$(GIT_VERSION)/manifests/kubernetes/addons/ || true - - # GCE specific configs go in 'gci-trusty' - # Ensure gci-trusty dir exists - mkdir -p release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty - cp cluster/gce/manifests/*.manifest release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/ - # Ignore errors for json/yaml if they don't exist - cp cluster/gce/manifests/*.json release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/ || true - cp cluster/gce/manifests/*.yaml release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/ || true - # Substitute variables in manifests - find release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty -name "*.manifest" -exec sed -i "s|{{pillar\['cloud-controller-manager_docker_tag'\]}}|$(GIT_VERSION)|g" {} + - - # Substitute variables in addons - find release/$(GIT_VERSION)/manifests/kubernetes/addons -name "*.yaml" -exec sed -i "s|{{ fluentd_gcp_yaml_version }}|$(FLUENTD_GCP_YAML_VERSION)|g" {} + - find release/$(GIT_VERSION)/manifests/kubernetes/addons -name "*.yaml" -exec sed -i "s|{{ fluentd_gcp_version }}|$(FLUENTD_GCP_VERSION)|g" {} + - find release/$(GIT_VERSION)/manifests/kubernetes/addons -name "*.yaml" -exec sed -i "s|{{ prometheus_to_sd_prefix }}|$(PROMETHEUS_TO_SD_PREFIX)|g" {} + - find release/$(GIT_VERSION)/manifests/kubernetes/addons -name "*.yaml" -exec sed -i "s|{{ prometheus_to_sd_endpoint }}|$(PROMETHEUS_TO_SD_ENDPOINT)|g" {} + - find release/$(GIT_VERSION)/manifests/kubernetes/addons -name "*.yaml" -exec sed -i "s|{{ fluentd_gcp_configmap_name }}|$(FLUENTD_GCP_CONFIGMAP_NAME)|g" {} + - - # Include cri-auth-config if present - cp cluster/gce/manifests/cri-auth-config.yaml release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/ || true - - cp cluster/gce/gci/configure-helper.sh release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/gci-configure-helper.sh - cp cluster/gce/gci/configure-helper.sh release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/configure-helper.sh - cp cluster/gce/gci/configure-kubeapiserver.sh release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/configure-kubeapiserver.sh - if [ -f cluster/gce/gci/gke-internal-configure-helper.sh ]; then \ - cp cluster/gce/gci/gke-internal-configure-helper.sh release/$(GIT_VERSION)/manifests/kubernetes/gci-trusty/; \ - fi - # 3. Repack the combined manifests - tar -czf release/$(GIT_VERSION)/kubernetes-manifests.tar.gz -C release/$(GIT_VERSION)/manifests . - rm -rf release/$(GIT_VERSION)/manifests release/upstream-manifests - @echo "Manifests artifact generated in release/$(GIT_VERSION)" - .PHONY: generate-all-checksums -generate-all-checksums: release-tars-linux-amd64 release-tars-windows-amd64 release-manifests ## Generate checksums for all release artifacts. +generate-all-checksums: release-tars-linux-amd64 release-tars-windows-amd64 ## Generate checksums for all release artifacts. # Final step: generate checksums for all artifacts. @echo "Generating Checksums for all release artifacts..." @if [ -f release/$(GIT_VERSION)/kubernetes-server-linux-amd64.tar.gz ]; then \ @@ -264,10 +216,6 @@ generate-all-checksums: release-tars-linux-amd64 release-tars-windows-amd64 rele shasum -a 1 release/$(GIT_VERSION)/kubernetes-node-linux-amd64.tar.gz | awk '{print $$1}' > release/$(GIT_VERSION)/kubernetes-node-linux-amd64.tar.gz.sha1; \ shasum -a 256 release/$(GIT_VERSION)/kubernetes-node-linux-amd64.tar.gz | awk '{print $$1}' > release/$(GIT_VERSION)/kubernetes-node-linux-amd64.tar.gz.sha256; \ fi - @if [ -f release/$(GIT_VERSION)/kubernetes-manifests.tar.gz ]; then \ - shasum -a 1 release/$(GIT_VERSION)/kubernetes-manifests.tar.gz | awk '{print $$1}' > release/$(GIT_VERSION)/kubernetes-manifests.tar.gz.sha1; \ - shasum -a 256 release/$(GIT_VERSION)/kubernetes-manifests.tar.gz | awk '{print $$1}' > release/$(GIT_VERSION)/kubernetes-manifests.tar.gz.sha256; \ - fi @echo "Release artifacts generated in release/$(GIT_VERSION)" ## -------------------------------------- @@ -279,12 +227,6 @@ test: ## Run unit tests. go test -race ./... go test -race ./providers/... -.PHONY: test-sh -test-sh: ## Run shell script syntax checks. - bash -n cluster/common.sh - bash -n cluster/clientbin.sh - bash -n cluster/kube-util.sh - ## -------------------------------------- ##@ Tools ## -------------------------------------- @@ -309,10 +251,6 @@ update-golang: ## Update golang version. pin-k8s-deps: ## Pin Kubernetes dependencies. ./tools/pin_k8s_deps.sh -.PHONY: bump-cluster -bump-cluster: ## Bump cluster version. - ./tools/bump_cluster.sh - .PHONY: push-images push-images: ## Push images to IMAGE_REPO. gcloud auth configure-docker diff --git a/cluster/OWNERS b/cluster/OWNERS deleted file mode 100644 index 8b37fd5222..0000000000 --- a/cluster/OWNERS +++ /dev/null @@ -1,24 +0,0 @@ -# See the OWNERS docs at https://go.k8s.io/owners - -reviewers: - - bowei - - cjcullen - - MaciekPytel - - mtaufen - - mwielgus - - vishh - - yujuhong -approvers: - - amwat - - BenTheElder - - bowei - - cheftako - - cjcullen - - MaciekPytel - - mtaufen - - mwielgus - - vishh - - yujuhong -emeritus_approvers: -- gmarek -- jingax10 diff --git a/cluster/addons/README.md b/cluster/addons/README.md deleted file mode 100644 index 1ab9ef0aaf..0000000000 --- a/cluster/addons/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Legacy Cluster add-ons - -For more information on add-ons see [the documentation](https://kubernetes.io/docs/concepts/cluster-administration/addons/). - -## Overview - -Cluster add-ons are resources like Services and Deployments (with pods) that are -shipped with the Kubernetes binaries and are considered an inherent part of the -Kubernetes clusters. - -There are currently two classes of add-ons: -- Add-ons that will be reconciled. -- Add-ons that will be created if they don't exist. - -More details could be found in [addon-manager/README.md](addon-manager/README.md). - -## Cooperating Horizontal / Vertical Auto-Scaling with "reconcile class addons" - -"Reconcile" class addons will be periodically reconciled to the original state given -by the initial config. In order to make Horizontal / Vertical Auto-scaling functional, -the related fields in config should be left unset. More specifically, leave `replicas` -in `ReplicationController` / `Deployment` / `ReplicaSet` unset for Horizontal Scaling, -leave `resources` for container unset for Vertical Scaling. The periodic reconcile -won't clobbered these fields, hence they could be managed by Horizontal / Vertical -Auto-scaler. - -## Add-on naming - -The suggested naming for most of the resources is `` (with no version number). -Though resources like `Pod`, `ReplicationController` and `DaemonSet` are exceptional. -It would be hard to update `Pod` because many fields in `Pod` are immutable. For -`ReplicationController` and `DaemonSet`, in-place update may not trigger the underlying -pods to be re-created. You probably need to change their names during update to trigger -a complete deletion and creation. diff --git a/cluster/addons/addon-manager/CHANGELOG.md b/cluster/addons/addon-manager/CHANGELOG.md deleted file mode 100644 index 0cc424c91c..0000000000 --- a/cluster/addons/addon-manager/CHANGELOG.md +++ /dev/null @@ -1,109 +0,0 @@ -### Version 9.1.8 (Mon Mar 3 2025 Jeffrey Ying ) -- Update kubectl to v1.32.2. -- Update base image to debian-base:bookworm-v1.0.4. - -### Version 9.1.7 (Thu May 15 2023 Paco Xu ) -- Update kubectl to v1.27.1. -- Use `--prune-allowlist` instead of deprecated `--prune-whitelist`. - -### Version 9.1.6 (Thu February 24 2022 Shihang Zhang ) - - Clean up the wait check for service account (https://github.com/kubernetes/kubernetes/pull/108313) - -### Version 9.1.5 (Mon April 19 2021 Spencer Peterson ) - - Update baseimage to debian-base:v1.0.1. - -### Version 9.1.4 (Wed February 10 2021 Jordan Liggitt ) - - Update kubectl to v1.20.2. - - Fix a bug in leader election (https://github.com/kubernetes/kubernetes/issues/98966) - -### Version 9.1.3 (Mon November 30 2020 Spencer Peterson ) - - Update kubectl to v1.19.3. - -### Version 9.1.2 (Thu August 6 2020 Spencer Peterson ) - - Fix `start_addon` overwriting resources with `addonmanager.kubernetes.io/mode=EnsureExists`. - -### Version 9.1.1 (Wed May 19 2020 Antoni Zawodny ) - - Fix kube-addons.sh and kubectl permissions - -### Version 9.1.0 (Wed May 13 2020 Antoni Zawodny ) - - Enable overriding the default list of whitelisted resources - -### Version 9.0.2 (Thu August 1 2019 Maciej Borsz - - Fix a bug in leader election (https://github.com/kubernetes/kubernetes/pull/80575) - -### Version 9.0.1 (Wed April 10 2019 Zihong Zheng ) - - Update to use debian-base:v1.0.0. - -### Version 9.0 (Wed January 16 2019 Jordan Liggitt ) - - Prune workload resources via apps/v1 APIs - - Update kubectl to v1.13.2. - -### Version 8.9 (Fri October 19 2018 Jeff Grafton ) - - Update to use debian-base:0.4.0. - - Update kubectl to v1.11.3. - -### Version 8.8 (Mon October 1 2018 Zihong Zheng ) - - Update to use debian-base:0.3.2. - -### Version 8.7 (Tue September 4 2018 Zihong Zheng ) - - Support extra `--prune-whitelist` resources in kube-addon-manager. - - Update kubectl to v1.10.7. - -### Version 8.6 (Tue February 20 2018 Zihong Zheng ) - - Allow reconcile/ensure loop to work with resource under non-kube-system namespace. - - Update kubectl to v1.9.3. - -### Version 8.4 (Thu November 30 2017 zou nengren @zouyee) - - Update kubectl to v1.8.4. - -### Version 6.5 (Wed October 15 2017 Daniel Kłobuszewski ) - - Support for HA masters. - -### Version 6.4-beta.2 (Mon June 12 2017 Jeff Grafton ) - - Update kubectl to v1.6.4. - - Refresh base images. - -### Version 6.4-beta.1 (Wed March 8 2017 Zihong Zheng ) - - Create EnsureExists class addons before Reconcile class addons. - -### Version 6.4-alpha.3 (Fri February 24 2017 Zihong Zheng ) - - Support 'ensure exist' class addon and use addon-manager specific label. - -### Version 6.4-alpha.2 (Wed February 16 2017 Zihong Zheng ) - - Update kubectl to v1.6.0-alpha.2 to use HPA in autoscaling/v1 instead of extensions/v1beta1. - -### Version 6.4-alpha.1 (Wed February 1 2017 Zihong Zheng ) - - Update kubectl to v1.6.0-alpha.1 for supporting optional ConfigMap. - -### Version 6.3 (Fri January 27 2017 Lucas Käldström ) - - Updated the arm base image to `armhf/busybox` and now using qemu v2.7 for emulation. - -### Version 6.2 (Thu January 12 2017 Zihong Zheng ) - - Update kubectl to the stable version. - -### Version 6.1 (Tue November 29 2016 Zihong Zheng ) - - Support pruning old Deployments. - -### Version 6.0 (Fri November 18 2016 Zihong Zheng ) - - Upgrade Addon Manager to use `kubectl apply`. - -### Version 5.2 (Wed October 26 2016 Zihong Zheng ) - - Added support for ConfigMap and upgraded kubectl version to v1.4.4 (pr #35255) - -### Version 5.1 (Mon Jul 4 2016 Marek Grabowski ) - - Fixed the way addon-manager handles non-namespaced objects - -### Version 5 (Fri Jun 24 2016 Jerzy Szczepkowski @jszczepkowski) - - Added PetSet support to addon manager - -### Version 4 (Tue Jun 21 2016 Mike Danese @mikedanese) - - Increased addon check interval - -### Version 3 (Sun Jun 19 2016 Lucas Käldström @luxas) - - Bumped up addon-manager to v3 - -### Version 2 (Fri May 20 2016 Lucas Käldström @luxas) - - Removed deprecated kubectl command, added support for DaemonSets - -### Version 1 (Thu May 5 2016 Mike Danese @mikedanese) - - Run kube-addon-manager in a pod diff --git a/cluster/addons/addon-manager/Dockerfile b/cluster/addons/addon-manager/Dockerfile deleted file mode 100644 index e7418d41c6..0000000000 --- a/cluster/addons/addon-manager/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2016 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. - -ARG BASEIMAGE - -FROM ${BASEIMAGE} - -RUN clean-install bash - -ADD kube-addons.sh /opt/ -ADD kube-addons-main.sh /opt/ -ADD kubectl /usr/local/bin/ - -CMD ["/opt/kube-addons-main.sh"] diff --git a/cluster/addons/addon-manager/Makefile b/cluster/addons/addon-manager/Makefile deleted file mode 100644 index 8727a80417..0000000000 --- a/cluster/addons/addon-manager/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2016 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. - -IMAGE=gcr.io/k8s-staging-addon-manager/kube-addon-manager -ARCH?=amd64 -TEMP_DIR:=$(shell mktemp -d) -VERSION=v9.1.8 -KUBECTL_VERSION?=v1.32.2 - -BASEIMAGE=registry.k8s.io/build-image/debian-base-$(ARCH):bookworm-v1.0.6 - -SUDO=$(if $(filter 0,$(shell id -u)),,sudo) - -.PHONY: build push - -all: build - -build: - cp ./* $(TEMP_DIR) - curl -sSL --retry 5 https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/$(ARCH)/kubectl > $(TEMP_DIR)/kubectl - chmod a+rx $(TEMP_DIR)/kube-addons.sh $(TEMP_DIR)/kube-addons-main.sh $(TEMP_DIR)/kubectl - -ifneq ($(ARCH),amd64) - # Register /usr/bin/qemu-ARCH-static as the handler for non-x86 binaries in the kernel - $(SUDO) ../../../third_party/multiarch/qemu-user-static/register/register.sh --reset -endif - - docker build --pull -t $(IMAGE)-$(ARCH):$(VERSION) $(TEMP_DIR) --build-arg BASEIMAGE=$(BASEIMAGE) - -push: build - docker push $(IMAGE)-$(ARCH):$(VERSION) -ifeq ($(ARCH),amd64) - # Backward compatibility. TODO: deprecate this image tag - docker rmi $(IMAGE):$(VERSION) 2>/dev/null || true - docker tag $(IMAGE)-$(ARCH):$(VERSION) $(IMAGE):$(VERSION) - docker push $(IMAGE):$(VERSION) -endif - -test: - cp ./* $(TEMP_DIR) - curl -sSL --retry 5 https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/$(ARCH)/kubectl > $(TEMP_DIR)/kubectl - chmod a+rx $(TEMP_DIR)/kube-addons.sh $(TEMP_DIR)/kube-addons-test.sh $(TEMP_DIR)/kubectl - cd $(TEMP_DIR) && KUBECTL_BIN=$(TEMP_DIR)/kubectl ./kube-addons-test.sh - -clean: - docker rmi -f $(IMAGE)-$(ARCH):$(VERSION) diff --git a/cluster/addons/addon-manager/README.md b/cluster/addons/addon-manager/README.md deleted file mode 100644 index e6d82fb5e3..0000000000 --- a/cluster/addons/addon-manager/README.md +++ /dev/null @@ -1,59 +0,0 @@ -### Addon-manager - -addon-manager manages two classes of addons with given template files in -`$ADDON_PATH` (default `/etc/kubernetes/addons/`). -- Addons with label `addonmanager.kubernetes.io/mode=Reconcile` will be periodically -reconciled. Direct manipulation to these addons through apiserver is discouraged because -addon-manager will bring them back to the original state. In particular: - - Addon will be re-created if it is deleted. - - Addon will be reconfigured to the state given by the supplied fields in the template - file periodically. - - Addon will be deleted when its manifest file is deleted from the `$ADDON_PATH`. -- Addons with label `addonmanager.kubernetes.io/mode=EnsureExists` will be checked for -existence only. Users can edit these addons as they want. In particular: - - Addon will only be created/re-created with the given template file when there is no - instance of the resource with that name. - - Addon will not be deleted when the manifest file is deleted from the `$ADDON_PATH`. - -Notes: -- Label `kubernetes.io/cluster-service=true` is deprecated (only for Addon Manager). -In future release (after one year), Addon Manager may not respect it anymore. Addons -have this label but without `addonmanager.kubernetes.io/mode=EnsureExists` will be -treated as "reconcile class addons" for now. -- Resources under `$ADDON_PATH` need to have either one of these two labels. -Otherwise it will be omitted. - -#### Images - -addon-manager images are pushed to `registry.k8s.io`. As addon-manager is built for multiple architectures, there is an image per architecture in the format - `registry.k8s.io/addon-manager/kube-addon-manager-$(ARCH):$(VERSION)`. - -#### How to release - -The `addon-manager` is built for multiple architectures. - -1. Change something in the source -2. Bump `VERSION` in the `Makefile` -3. Bump `KUBECTL_VERSION` in the `Makefile` if required -4. Build the `amd64` image and test it on a cluster -5. Push all images - -```console -# Build for linux/amd64 (default) -$ make push ARCH=amd64 -# ---> staging-k8s.gcr.io/addon-manager/kube-addon-manager-amd64:VERSION -# ---> staging-k8s.gcr.io/addon-manager/kube-addon-manager:VERSION (image with backwards-compatible naming) - -$ make push ARCH=arm -# ---> staging-k8s.gcr.io/addon-manager/kube-addon-manager-arm:VERSION - -$ make push ARCH=arm64 -# ---> staging-k8s.gcr.io/addon-manager/kube-addon-manager-arm64:VERSION - -$ make push ARCH=ppc64le -# ---> staging-k8s.gcr.io/addon-manager/kube-addon-manager-ppc64le:VERSION - -$ make push ARCH=s390x -# ---> staging-k8s.gcr.io/addon-manager/kube-addon-manager-s390x:VERSION -``` - -If you don't want to push the images, run `make` or `make build` instead diff --git a/cluster/addons/addon-manager/kube-addons-main.sh b/cluster/addons/addon-manager/kube-addons-main.sh deleted file mode 100755 index 7ae2d5669c..0000000000 --- a/cluster/addons/addon-manager/kube-addons-main.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2020 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. - -# Import required functions. The addon manager is installed to /opt in -# production use (see the Dockerfile) -# Disabling shellcheck following files as the full path would be required. -if [ -f "kube-addons.sh" ]; then - # shellcheck disable=SC1091 - source "kube-addons.sh" -elif [ -f "/opt/kube-addons.sh" ]; then - # shellcheck disable=SC1091 - source "/opt/kube-addons.sh" -else - # If the required source is missing, we have to fail. - log ERR "== Could not find kube-addons.sh (not in working directory or /opt) at $(date -Is) ==" - exit 1 -fi - -# The business logic for whether a given object should be created -# was already enforced by salt, and /etc/kubernetes/addons is the -# managed result of that. Start everything below that directory. -log INFO "== Kubernetes addon manager started at $(date -Is) with ADDON_CHECK_INTERVAL_SEC=${ADDON_CHECK_INTERVAL_SEC} ==" - -# Wait for the default service account to be created in the kube-system namespace. -# shellcheck disable=SC2086 -# Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here -while ! ${KUBECTL} ${KUBECTL_OPTS} get --namespace="${SYSTEM_NAMESPACE}" serviceaccount default; do - log WRN "== Error getting default service account, retry in 0.5 second ==" - sleep 0.5 -done - -log INFO "== Default service account in the ${SYSTEM_NAMESPACE} namespace ==" - -# Create admission_control objects if defined before any other addon services. If the limits -# are defined in a namespace other than default, we should still create the limits for the -# default namespace. -while IFS=$'\n' read -r obj; do - start_addon "${obj}" 100 10 default & - log INFO "++ obj ${obj} is created ++" -done < <(find /etc/kubernetes/admission-controls \( -name \*.yaml -o -name \*.json \)) - -# Start the apply loop. -# Check if the configuration has changed recently - in case the user -# created/updated/deleted the files on the master. -log INFO "== Entering periodical apply loop at $(date -Is) ==" -while true; do - start_sec=$(date +"%s") - if is_leader; then - ensure_addons - reconcile_addons - else - log INFO "Not elected leader, going back to sleep." - fi - end_sec=$(date +"%s") - len_sec=$((end_sec-start_sec)) - # subtract the time passed from the sleep time - if [[ ${len_sec} -lt ${ADDON_CHECK_INTERVAL_SEC} ]]; then - sleep_time=$((ADDON_CHECK_INTERVAL_SEC-len_sec)) - sleep ${sleep_time} - fi -done diff --git a/cluster/addons/addon-manager/kube-addons-test.sh b/cluster/addons/addon-manager/kube-addons-test.sh deleted file mode 100755 index e22d0af3c5..0000000000 --- a/cluster/addons/addon-manager/kube-addons-test.sh +++ /dev/null @@ -1,286 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2020 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. - -# These tests enforce behavior of kube-addon-manager functions against a real -# cluster. A working Kubernetes cluster must be set up with kubectl configured. -# To run with the released version of kubectl, use `make test`. - -set -o errexit -set -o pipefail -set -o nounset - -# Default kubectl to the test users installation if needed. -KUBECTL_BIN="${KUBECTL_BIN:-kubectl}" - -# Disabling shellcheck following files as the full path would be required. -# shellcheck disable=SC1091 -source "kube-addons.sh" - -TEST_NS="kube-addon-manager-test" - -function retry() { - local tries=10 - while [ "${tries}" -gt 0 ]; do - "$@" && return 0; - (( tries-- )) - sleep 1 - done -} - -function setup(){ - retry kubectl create namespace "${TEST_NS}" -} - -function teardown() { - retry kubectl delete namespace "${TEST_NS}" -} - -function error() { - echo -e "\e[31m$*\e[0m" -} - -function echo_green() { - echo -e "\e[32m$*\e[0m" -} - -function echo_blue() { - echo -e "\e[34m$*\e[0m" -} - -function test_create_resource_reconcile() { - local limitrange - read -r -d '' limitrange << EOF -apiVersion: "v1" -kind: "LimitRange" -metadata: - name: "limits" - namespace: "${TEST_NS}" - labels: - addonmanager.kubernetes.io/mode: Reconcile -spec: - limits: - - type: "Container" - defaultRequest: - cpu: "100m" -EOF - - # arguments are yaml text, number of tries, delay, name of file, and namespace - echo_blue "Creating initial resource to test Reconcile mode" - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if ! (kubectl get limits/limits -n "${TEST_NS}"); then - error "failed to create limits w/ reconcile" - return 1 - elif ! (kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "100m"); then - error "limits does not match applied config" - return 1 - fi - - # Changes to addons with mode reconcile should be reflected. - echo_blue "Changes to manifest should be reflected in the cluster" - limitrange="${limitrange//100m/50m}" - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "100m"; then - error "failed to update resource, still has 100m" - return 1 - elif ! (kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "50m"); then - error "failed to update resource, 50m limit was not reflected" - return 1 - fi - - # Finally, the users configuration will not be respected. - echo_blue "Changes the user makes should be overwritten by kube-addon-manager" - EDITOR="sed -i 's/50m/600m/'" kubectl edit limits/limits -n ${TEST_NS} - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "50m"; then - error "failed to edit resource with sed -- test is broken" - return 1 - fi - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if ! ( kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "50m"); then - error "failed to update resource, user config was respected when it should have been rewritten" - return 1 - fi -} - -function test_create_resource_ensureexists() { - local limitrange - read -r -d '' limitrange << EOF -apiVersion: "v1" -kind: "LimitRange" -metadata: - name: "limits" - namespace: "${TEST_NS}" - labels: - addonmanager.kubernetes.io/mode: EnsureExists -spec: - limits: - - type: "Container" - defaultRequest: - cpu: "100m" -EOF - - # arguments are yaml text, number of tries, delay, name of file, and namespace - echo_blue "Creating initial resource to test mode EnsureExists" - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if ! (kubectl get limits/limits -n "${TEST_NS}"); then - error "failed to create limits w/ EnsureExists" - return 1 - elif ! (kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "100m"); then - error "limits does not match applied config" - return 1 - fi - - # Changes to addons with mode EnsureExists should NOT be reflected. - echo_blue "Changes to the manifest should not be reconciled with the cluster" - limitrange="${limitrange//100m/50m}" - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "50m"; then - error "failed to respect existing resource, was overwritten despite EnsureExists" - return 1 - fi - - # the users configuration must be respected - echo_blue "User configuration will be persisted for EnsureExists" - EDITOR="sed -i 's/100m/600m/'" kubectl edit limits/limits -n ${TEST_NS} - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "100m"; then - error "failed to edit resource with sed -- test is broken" - return 1 - fi - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "100m"; then - error "failed to respect user changes to EnsureExists object" - return 1 - fi - - # unless they delete the object, in which case it should return - echo_blue "Missing EnsureExists resources will be re-created" - kubectl delete limits/limits -n ${TEST_NS} - if kubectl get limits/limits -n ${TEST_NS}; then - error "failed to delete limitrange" - return 1 - fi - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if ! kubectl get limits/limits -n ${TEST_NS}; then - error "failed to recreate deleted EnsureExists resource" - return 1 - fi -} - -function test_create_multiresource() { - local limitrange - read -r -d '' limitrange << EOF -apiVersion: "v1" -kind: "LimitRange" -metadata: - name: "limits" - namespace: "${TEST_NS}" - labels: - addonmanager.kubernetes.io/mode: EnsureExists -spec: - limits: - - type: "Container" - defaultRequest: - cpu: "100m" ---- -apiVersion: "v1" -kind: "LimitRange" -metadata: - name: "limits2" - namespace: "${TEST_NS}" - labels: - addonmanager.kubernetes.io/mode: Reconcile -spec: - limits: - - type: "Container" - defaultRequest: - cpu: "100m" -EOF - - # arguments are yaml text, number of tries, delay, name of file, and namespace - echo_blue "Creating initial resources from multi-resource manifest" - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if ! (kubectl get limits/limits -n "${TEST_NS}"); then - error "failed to create limits w/ EnsureExists" - return 1 - elif ! (kubectl get limits/limits2 -n "${TEST_NS}"); then - error "failed to create limits2 w/ Reconcile" - return 1 - fi - - # Changes to addons with mode EnsureExists should NOT be reflected. - # However, the mode=Reconcile addon should be changed. - echo_blue "Multi-resource manifest changes should apply to EnsureExists, not Reconcile" - limitrange="${limitrange//100m/50m}" - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "50m"; then - error "failed to respect existing resource, was overwritten despite EnsureExists" - return 1 - elif kubectl get limits/limits2 -n ${TEST_NS} | grep --silent "100m"; then - error "failed to update resource with mode Reconcile" - return 1 - fi - - # the users configuration must be respected for EnsureExists - echo_blue "Multi-resource manifest should not overwrite user config in EnsureExists" - EDITOR="sed -i 's/100m/600m/'" kubectl edit limits/limits -n ${TEST_NS} - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "100m"; then - error "failed to edit resource with sed -- test is broken" - return 1 - fi - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if kubectl get limits/limits -n ${TEST_NS} -o yaml | grep --silent "100m"; then - error "failed to respect user changes to EnsureExists object" - return 1 - fi - - # But not for Reconcile. - echo_blue "Multi-resource manifest should overwrite user config in EnsureExists" - EDITOR="sed -i 's/50m/600m/'" kubectl edit limits/limits2 -n ${TEST_NS} - if kubectl get limits/limits2 -n ${TEST_NS} -o yaml | grep --silent "50m"; then - error "failed to edit resource with sed -- test is broken" - return 1 - fi - create_resource_from_string "${limitrange}" "10" "1" "limitrange.yaml" "${TEST_NS}" - if ! ( kubectl get limits/limits2 -n ${TEST_NS} -o yaml | grep --silent "50m"); then - error "failed to update resource, user config was respected when it should have been rewritten" - return 1 - fi -} - -function test_func() { - local -r name="${1}" - - echo_blue "=== TEST ${name}" - setup - if ! "${name}"; then - failures=$((failures+1)) - error "=== FAIL" - else - echo_green "=== PASS" - fi - teardown -} - -failures=0 -test_func test_create_resource_reconcile -test_func test_create_resource_ensureexists -test_func test_create_multiresource -if [ "${failures}" -gt 0 ]; then - error "no. failed tests: ${failures}" - error "FAIL" - exit 1 -else - echo_green "PASS" -fi diff --git a/cluster/addons/addon-manager/kube-addons.sh b/cluster/addons/addon-manager/kube-addons.sh deleted file mode 100755 index f20ae03afc..0000000000 --- a/cluster/addons/addon-manager/kube-addons.sh +++ /dev/null @@ -1,294 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2014 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. - -# LIMITATIONS -# 1. Exit code is probably not always correct. -# 2. There are no unittests. -# 3. Will not work if the total length of paths to addons is greater than -# bash can handle. Probably it is not a problem: ARG_MAX=2097152 on GCE. - -# cosmetic improvements to be done -# 1. Improve the log function; add timestamp, file name, etc. -# 2. Logging doesn't work from files that print things out. -# 3. Kubectl prints the output to stderr (the output should be captured and then -# logged) - -KUBECTL=${KUBECTL_BIN:-/usr/local/bin/kubectl} -KUBECTL_OPTS=${KUBECTL_OPTS:-} -# KUBECTL_PRUNE_WHITELIST is a list of resources whitelisted by default. -# This is currently the same with the default in: -# https://github.com/kubernetes/kubectl/blob/master/pkg/cmd/apply/prune.go. -# To override the default list with other values, set -# KUBECTL_PRUNE_WHITELIST_OVERRIDE environment variable to space-separated -# names of resources to whitelist. -if [ -z "${KUBECTL_PRUNE_WHITELIST_OVERRIDE:-}" ]; then - KUBECTL_PRUNE_WHITELIST=( - core/v1/ConfigMap - core/v1/Endpoints - core/v1/Namespace - core/v1/PersistentVolumeClaim - core/v1/PersistentVolume - core/v1/Pod - core/v1/ReplicationController - core/v1/Secret - core/v1/Service - batch/v1/Job - batch/v1/CronJob - apps/v1/DaemonSet - apps/v1/Deployment - apps/v1/ReplicaSet - apps/v1/StatefulSet - networking.k8s.io/v1/Ingress - ) -else - read -ra KUBECTL_PRUNE_WHITELIST <<< "${KUBECTL_PRUNE_WHITELIST_OVERRIDE}" -fi - -# This variable is unused in this file, but not in those that source it. -# shellcheck disable=SC2034 -ADDON_CHECK_INTERVAL_SEC=${TEST_ADDON_CHECK_INTERVAL_SEC:-60} -ADDON_PATH=${ADDON_PATH:-/etc/kubernetes/addons} - -# This variable is unused in this file, but not in those that source it. -# shellcheck disable=SC2034 -SYSTEM_NAMESPACE=kube-system - -# Addons could use this label with two modes: -# - ADDON_MANAGER_LABEL=Reconcile -# - ADDON_MANAGER_LABEL=EnsureExists -ADDON_MANAGER_LABEL="addonmanager.kubernetes.io/mode" -# This label is deprecated (only for Addon Manager). In future release -# addon-manager may not respect it anymore. Addons with -# CLUSTER_SERVICE_LABEL=true and without ADDON_MANAGER_LABEL=EnsureExists -# will be reconciled for now. -CLUSTER_SERVICE_LABEL="kubernetes.io/cluster-service" - -# Whether only one addon manager should be running in a multi-master setup. -# Disabling this flag will force all addon managers to assume they are the -# leaders. -ADDON_MANAGER_LEADER_ELECTION=${ADDON_MANAGER_LEADER_ELECTION:-true} - -# Remember that you can't log from functions that print some output (because -# logs are also printed on stdout). -# $1 level -# $2 message -function log() { - # manage log levels manually here - - # add the timestamp if you find it useful - case $1 in - DB3 ) -# echo "$1: $2" - ;; - DB2 ) -# echo "$1: $2" - ;; - DBG ) -# echo "$1: $2" - ;; - INFO ) - echo "$1: $2" - ;; - WRN ) - echo "$1: $2" - ;; - ERR ) - echo "$1: $2" - ;; - * ) - echo "INVALID_LOG_LEVEL $1: $2" - ;; - esac -} - -# Generate kubectl prune-allowlist flags from provided resource list. -function generate_prune_allowlist_flags() { - local -r resources=( "$@" ) - for resource in "${resources[@]}"; do - # Check if $resource isn't composed just of whitespaces by replacing ' ' - # with '' and checking whether the resulting string is not empty. - if [[ -n "${resource// /}" ]]; then - printf "%s" "--prune-allowlist ${resource} " - fi - done -} - -# KUBECTL_EXTRA_PRUNE_WHITELIST is a list of extra allowed resources -# besides the default ones. -extra_prune_allowlist= -if [ -n "${KUBECTL_EXTRA_PRUNE_WHITELIST:-}" ]; then - read -ra extra_prune_allowlist <<< "${KUBECTL_EXTRA_PRUNE_WHITELIST}" -fi -prune_allowlist=( "${KUBECTL_PRUNE_WHITELIST[@]}" "${extra_prune_allowlist[@]}" ) -prune_allowlist_flags=$(generate_prune_allowlist_flags "${prune_allowlist[@]}") - -log INFO "== Generated kubectl prune allowlist flags: $prune_allowlist_flags ==" - -# $1 filename of addon to start. -# $2 count of tries to start the addon. -# $3 delay in seconds between two consecutive tries -# $4 namespace -function start_addon() { - local -r addon_filename=$1; - local -r tries=$2; - local -r delay=$3; - local -r namespace=$4 - - create_resource_from_string "$(cat "${addon_filename}")" "${tries}" "${delay}" "${addon_filename}" "${namespace}" -} - -# $1 string with json or yaml. -# $2 count of tries to start the addon. -# $3 delay in seconds between two consecutive tries -# $4 name of this object to use when logging about it. -# $5 namespace for this object -function create_resource_from_string() { - local -r config_string=$1; - local tries=$2; - local -r delay=$3; - local -r config_name=$4; - local -r namespace=$5; - while [ "${tries}" -gt 0 ]; do - reconcile_resource_from_string "${config_string}" "${config_name}" "${namespace}" && \ - ensure_resource_from_string "${config_string}" "${config_name}" "${namespace}" && \ - return 0; - (( tries-- )) - log WRN "== Failed to start ${config_name} in namespace ${namespace} at $(date -Is). ${tries} tries remaining. ==" - sleep "${delay}"; - done - return 1; -} - -# Creates resources with addon mode Reconcile for create_resource_from_string. -# Does not perform pruning. -# $1 string with json or yaml. -# $2 name of this object for logging -# $3 namespace for the object -function reconcile_resource_from_string() { - local -r config_string=$1; - local -r config_name=$2; - local -r namespace=$3; - - # kubectl_output must be declared ahead of time to allow capturing kubectl's exit code and not local's exit code. - local kubectl_output; - # shellcheck disable=SC2086 - # Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here - kubectl_output=$(echo "${config_string}" | ${KUBECTL} ${KUBECTL_OPTS} apply -f - \ - --namespace="${namespace}" -l ${ADDON_MANAGER_LABEL}=Reconcile 2>&1) && \ - log INFO "== Successfully reconciled ${config_name} in namespace ${namespace} at $(date -Is)" && \ - return 0; - if echo "${kubectl_output}" | grep --silent "no objects"; then - # Nothing to do. - return 0; - fi - echo "${kubectl_output}" # for visibility of errors - return 1; -} - -# Creates resources with addon mode EnsureExists for create_resource_from_string. -# Does not perform pruning. -# $1 string with json or yaml. -# $2 name of this object for logging -# $3 namespace for the object -function ensure_resource_from_string() { - local -r config_string=$1; - local -r config_name=$2; - local -r namespace=$3; - - # Resources that are set to the addon mode EnsureExists should not be overwritten if they already exist. - local kubectl_output; - # shellcheck disable=SC2086 - # Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here - kubectl_output=$(echo "${config_string}" | ${KUBECTL} ${KUBECTL_OPTS} create -f - \ - --namespace="${namespace}" -l ${ADDON_MANAGER_LABEL}=EnsureExists 2>&1) && \ - log INFO "== Successfully started ${config_name} in namespace ${namespace} at $(date -Is)" && \ - return 0; - # Detect an already exists failure for creating EnsureExists resources. - # All other errors should result in a retry. - if echo "${kubectl_output}" | grep --silent "AlreadyExists"; then - log INFO "== Skipping start ${config_name} in namespace ${namespace}, already exists at $(date -Is)" - return 0; - elif echo "${kubectl_output}" | grep --silent "no objects"; then - # Nothing to do. - return 0; - fi - echo "${kubectl_output}" # for visibility of errors - return 1; -} - -function reconcile_addons() { - # TODO: Remove the first command in future release. - # Adding this for backward compatibility. Old addons have CLUSTER_SERVICE_LABEL=true and don't have - # ADDON_MANAGER_LABEL=EnsureExists will still be reconciled. - # Filter out `configured` message to not noisily log. - # `created`, `pruned` and errors will be logged. - log INFO "== Reconciling with deprecated label ==" - # shellcheck disable=SC2086 - # Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here - ${KUBECTL} ${KUBECTL_OPTS} apply -f ${ADDON_PATH} \ - -l ${CLUSTER_SERVICE_LABEL}=true,${ADDON_MANAGER_LABEL}!=EnsureExists \ - --prune=true ${prune_allowlist_flags} --recursive | grep -v configured - - log INFO "== Reconciling with addon-manager label ==" - # shellcheck disable=SC2086 - # Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here - ${KUBECTL} ${KUBECTL_OPTS} apply -f ${ADDON_PATH} \ - -l ${CLUSTER_SERVICE_LABEL}!=true,${ADDON_MANAGER_LABEL}=Reconcile \ - --prune=true ${prune_allowlist_flags} --recursive | grep -v configured - - log INFO "== Kubernetes addon reconcile completed at $(date -Is) ==" -} - -function ensure_addons() { - # Create objects already exist should fail. - # Filter out `AlreadyExists` message to not noisily log. - # shellcheck disable=SC2086 - # Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here - ${KUBECTL} ${KUBECTL_OPTS} create -f ${ADDON_PATH} \ - -l ${ADDON_MANAGER_LABEL}=EnsureExists --recursive 2>&1 | grep -v AlreadyExists - - log INFO "== Kubernetes addon ensure completed at $(date -Is) ==" -} - -function is_leader() { - # In multi-master setup, only one addon manager should be running. We use - # existing leader election in kube-controller-manager instead of implementing - # a separate mechanism here. - if ! $ADDON_MANAGER_LEADER_ELECTION; then - log INFO "Leader election disabled." - return 0; - fi - # shellcheck disable=SC2086 - # Disabling because "${KUBECTL_OPTS}" needs to allow for expansion here - KUBE_CONTROLLER_MANAGER_LEADER=$(${KUBECTL} ${KUBECTL_OPTS} -n kube-system get leases.v1.coordination.k8s.io kube-controller-manager -o "jsonpath={.spec.holderIdentity}") - - case "${KUBE_CONTROLLER_MANAGER_LEADER}" in - "") - log ERR "No leader election info found." - return 1 - ;; - - "${HOSTNAME}"_*) - log INFO "Leader is $KUBE_CONTROLLER_MANAGER_LEADER" - return 0 - ;; - - *) - log INFO "Leader is $KUBE_CONTROLLER_MANAGER_LEADER, not ${HOSTNAME}_*" - return 1 - ;; - esac -} diff --git a/cluster/addons/calico-policy-controller/README.md b/cluster/addons/calico-policy-controller/README.md deleted file mode 100644 index c43b09dac5..0000000000 --- a/cluster/addons/calico-policy-controller/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Calico Policy Controller - -Calico is an implementation of the Kubernetes network policy API. The provided manifests install: - -- A DaemonSet which runs Calico on each node in the cluster. -- A Deployment which installs the Calico Typha agent. -- A Service for the Calico Typha agent. -- Horizontal and vertical autoscalers for Calico. - -### Learn More - -Learn more about Calico at https://docs.projectcalico.org - diff --git a/cluster/addons/calico-policy-controller/bgpconfigurations-crd.yaml b/cluster/addons/calico-policy-controller/bgpconfigurations-crd.yaml deleted file mode 100644 index 5913a885f8..0000000000 --- a/cluster/addons/calico-policy-controller/bgpconfigurations-crd.yaml +++ /dev/null @@ -1,131 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: bgpconfigurations.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: BGPConfiguration - listKind: BGPConfigurationList - plural: bgpconfigurations - singular: bgpconfiguration - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - description: BGPConfiguration contains the configuration for any BGP routing. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: BGPConfigurationSpec contains the values of the BGP configuration. - properties: - asNumber: - description: 'ASNumber is the default AS number used by a node. [Default: - 64512]' - format: int32 - type: integer - communities: - description: Communities is a list of BGP community values and their - arbitrary names for tagging routes. - items: - description: Community contains standard or large community value - and its name. - properties: - name: - description: Name given to community value. - type: string - value: - description: Value must be of format `aa:nn` or `aa:nn:mm`. - For standard community use `aa:nn` format, where `aa` and - `nn` are 16 bit number. For large community use `aa:nn:mm` - format, where `aa`, `nn` and `mm` are 32 bit number. Where, - `aa` is an AS Number, `nn` and `mm` are per-AS identifier. - pattern: ^(\d+):(\d+)$|^(\d+):(\d+):(\d+)$ - type: string - type: object - type: array - listenPort: - description: ListenPort is the port where BGP protocol should listen. - Defaults to 179 - maximum: 65535 - minimum: 1 - type: integer - logSeverityScreen: - description: 'LogSeverityScreen is the log severity above which logs - are sent to the stdout. [Default: INFO]' - type: string - nodeToNodeMeshEnabled: - description: 'NodeToNodeMeshEnabled sets whether full node to node - BGP mesh is enabled. [Default: true]' - type: boolean - prefixAdvertisements: - description: PrefixAdvertisements contains per-prefix advertisement - configuration. - items: - description: PrefixAdvertisement configures advertisement properties - for the specified CIDR. - properties: - cidr: - description: CIDR for which properties should be advertised. - type: string - communities: - description: Communities can be list of either community names - already defined in `Specs.Communities` or community value - of format `aa:nn` or `aa:nn:mm`. For standard community use - `aa:nn` format, where `aa` and `nn` are 16 bit number. For - large community use `aa:nn:mm` format, where `aa`, `nn` and - `mm` are 32 bit number. Where,`aa` is an AS Number, `nn` and - `mm` are per-AS identifier. - items: - type: string - type: array - type: object - type: array - serviceClusterIPs: - description: ServiceClusterIPs are the CIDR blocks from which service - cluster IPs are allocated. If specified, Calico will advertise these - blocks, as well as any cluster IPs within them. - items: - description: ServiceClusterIPBlock represents a single allowed ClusterIP - CIDR block. - properties: - cidr: - type: string - type: object - type: array - serviceExternalIPs: - description: ServiceExternalIPs are the CIDR blocks for Kubernetes - Service External IPs. Kubernetes Service ExternalIPs will only be - advertised if they are within one of these blocks. - items: - description: ServiceExternalIPBlock represents a single allowed - External IP CIDR block. - properties: - cidr: - type: string - type: object - type: array - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/bgppeers-crd.yaml b/cluster/addons/calico-policy-controller/bgppeers-crd.yaml deleted file mode 100644 index a7db643fb2..0000000000 --- a/cluster/addons/calico-policy-controller/bgppeers-crd.yaml +++ /dev/null @@ -1,105 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: bgppeers.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: BGPPeer - listKind: BGPPeerList - plural: bgppeers - singular: bgppeer - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: BGPPeerSpec contains the specification for a BGPPeer resource. - properties: - asNumber: - description: The AS Number of the peer. - format: int32 - type: integer - keepOriginalNextHop: - description: Option to keep the original nexthop field when routes - are sent to a BGP Peer. Setting "true" configures the selected BGP - Peers node to use the "next hop keep;" instead of "next hop self;"(default) - in the specific branch of the Node on "bird.cfg". - type: boolean - node: - description: The node name identifying the Calico node instance that - is peering with this peer. If this is not set, this represents a - global peer, i.e. a peer that peers with every node in the deployment. - type: string - nodeSelector: - description: Selector for the nodes that should have this peering. When - this is set, the Node field must be empty. - type: string - password: - description: Optional BGP password for the peerings generated by this - BGPPeer resource. - properties: - secretKeyRef: - description: Selects a key of a secret in the node pod's namespace. - properties: - key: - description: The key of the secret to select from. Must be - a valid secret key. - type: string - name: - description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names - TODO: Add other useful fields. apiVersion, kind, uid?' - type: string - optional: - description: Specify whether the Secret or its key must be - defined - type: boolean - required: - - key - type: object - type: object - peerIP: - description: The IP address of the peer followed by an optional port - number to peer with. If port number is given, format should be `[]:port` - or `:` for IPv4. If optional port number is not set, - and this peer IP and ASNumber belongs to a calico/node with ListenPort - set in BGPConfiguration, then we use that port to peer. - type: string - peerSelector: - description: Selector for the remote nodes to peer with. When this - is set, the PeerIP and ASNumber fields must be empty. For each - peering between the local node and selected remote nodes, we configure - an IPv4 peering if both ends have NodeBGPSpec.IPv4Address specified, - and an IPv6 peering if both ends have NodeBGPSpec.IPv6Address specified. The - remote AS number comes from the remote node’s NodeBGPSpec.ASNumber, - or the global default if that is not set. - type: string - required: - - asNumber - - peerIP - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/blockaffinity-crd.yaml b/cluster/addons/calico-policy-controller/blockaffinity-crd.yaml deleted file mode 100644 index 49cea41819..0000000000 --- a/cluster/addons/calico-policy-controller/blockaffinity-crd.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: blockaffinities.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: BlockAffinity - listKind: BlockAffinityList - plural: blockaffinities - singular: blockaffinity - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: BlockAffinitySpec contains the specification for a BlockAffinity - resource. - properties: - cidr: - type: string - deleted: - description: Deleted indicates that this block affinity is being deleted. - This field is a string for compatibility with older releases that - mistakenly treat this field as a string. - type: string - node: - type: string - state: - type: string - required: - - cidr - - node - - state - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/calico-clusterrole.yaml b/cluster/addons/calico-policy-controller/calico-clusterrole.yaml deleted file mode 100644 index b3adead79a..0000000000 --- a/cluster/addons/calico-policy-controller/calico-clusterrole.yaml +++ /dev/null @@ -1,140 +0,0 @@ -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: calico - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile -rules: - # The CNI plugin needs to get pods, nodes, and namespaces. - - apiGroups: [""] - resources: - - pods - - nodes - - namespaces - verbs: - - get - # calico/node checks configmaps for cluster CIDR. - - apiGroups: [""] - resources: - - configmaps - verbs: - - get - - apiGroups: [""] - resources: - - endpoints - - services - verbs: - # Used to discover service IPs for advertisement. - - watch - - list - # Used to discover Typhas. - - get - - apiGroups: [""] - resources: - - nodes/status - verbs: - # Needed for clearing NodeNetworkUnavailable flag. - - patch - # Calico stores some configuration information in node annotations. - - update - # Watch for changes to Kubernetes NetworkPolicies. - - apiGroups: ["networking.k8s.io"] - resources: - - networkpolicies - verbs: - - watch - - list - # Used by Calico for policy information. - - apiGroups: [""] - resources: - - pods - - namespaces - - serviceaccounts - verbs: - - list - - watch - # The CNI plugin patches pods/status. - - apiGroups: [""] - resources: - - pods/status - verbs: - - patch - # Calico monitors various CRDs for config. - # Note: Though we are not using ipam from calico, calico node still needs those permissions - # to boot. - - apiGroups: ["crd.projectcalico.org"] - resources: - - globalfelixconfigs - - felixconfigurations - - bgppeers - - globalbgpconfigs - - bgpconfigurations - - ippools - - ipamblocks - - globalnetworkpolicies - - globalnetworksets - - networkpolicies - - networksets - - clusterinformations - - hostendpoints - verbs: - - get - - list - - watch - # Calico must create and update some CRDs on startup. - - apiGroups: ["crd.projectcalico.org"] - resources: - - ippools - - felixconfigurations - - clusterinformations - verbs: - - create - - update - # Calico stores some configuration information on the node. - - apiGroups: [""] - resources: - - nodes - verbs: - - get - - list - - watch - # These permissions are only required for upgrade from v2.6, and can - # be removed after upgrade or on fresh installations. - - apiGroups: ["crd.projectcalico.org"] - resources: - - bgpconfigurations - - bgppeers - verbs: - - create - - update - # These permissions are required for Calico CNI to perform IPAM allocations. - - apiGroups: ["crd.projectcalico.org"] - resources: - - blockaffinities - - ipamblocks - - ipamhandles - verbs: - - get - - list - - create - - update - - delete - - apiGroups: ["crd.projectcalico.org"] - resources: - - ipamconfigs - verbs: - - get - # Block affinities must also be watchable by confd for route aggregation. - - apiGroups: ["crd.projectcalico.org"] - resources: - - blockaffinities - verbs: - - watch - # The Calico IPAM migration needs to get daemonsets. These permissions can be - # removed if not upgrading from an installation using host-local IPAM. - - apiGroups: ["apps"] - resources: - - daemonsets - verbs: - - get diff --git a/cluster/addons/calico-policy-controller/calico-clusterrolebinding.yaml b/cluster/addons/calico-policy-controller/calico-clusterrolebinding.yaml deleted file mode 100644 index 2dbbd0e6e8..0000000000 --- a/cluster/addons/calico-policy-controller/calico-clusterrolebinding.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: calico - labels: - addonmanager.kubernetes.io/mode: Reconcile -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: calico -subjects: -- kind: ServiceAccount - name: calico - namespace: kube-system diff --git a/cluster/addons/calico-policy-controller/calico-cpva-clusterrole.yaml b/cluster/addons/calico-policy-controller/calico-cpva-clusterrole.yaml deleted file mode 100644 index 78f0cc8816..0000000000 --- a/cluster/addons/calico-policy-controller/calico-cpva-clusterrole.yaml +++ /dev/null @@ -1,13 +0,0 @@ -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: calico-cpva - labels: - addonmanager.kubernetes.io/mode: Reconcile -rules: - - apiGroups: [""] - resources: ["nodes"] - verbs: ["list"] - - apiGroups: ["apps"] - resources: ["deployments", "daemonsets"] - verbs: ["patch"] diff --git a/cluster/addons/calico-policy-controller/calico-cpva-clusterrolebinding.yaml b/cluster/addons/calico-policy-controller/calico-cpva-clusterrolebinding.yaml deleted file mode 100644 index b04abce43b..0000000000 --- a/cluster/addons/calico-policy-controller/calico-cpva-clusterrolebinding.yaml +++ /dev/null @@ -1,14 +0,0 @@ -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: calico-cpva - labels: - addonmanager.kubernetes.io/mode: Reconcile -subjects: - - kind: ServiceAccount - name: calico-cpva - namespace: kube-system -roleRef: - kind: ClusterRole - name: calico-cpva - apiGroup: rbac.authorization.k8s.io diff --git a/cluster/addons/calico-policy-controller/calico-cpva-serviceaccount.yaml b/cluster/addons/calico-policy-controller/calico-cpva-serviceaccount.yaml deleted file mode 100644 index 8d19907860..0000000000 --- a/cluster/addons/calico-policy-controller/calico-cpva-serviceaccount.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: ServiceAccount -apiVersion: v1 -metadata: - name: calico-cpva - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile diff --git a/cluster/addons/calico-policy-controller/calico-node-daemonset.yaml b/cluster/addons/calico-policy-controller/calico-node-daemonset.yaml deleted file mode 100644 index d409232e07..0000000000 --- a/cluster/addons/calico-policy-controller/calico-node-daemonset.yaml +++ /dev/null @@ -1,189 +0,0 @@ -kind: DaemonSet -apiVersion: apps/v1 -metadata: - name: calico-node - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile - k8s-app: calico-node -spec: - selector: - matchLabels: - k8s-app: calico-node - updateStrategy: - type: RollingUpdate - template: - metadata: - labels: - k8s-app: calico-node - spec: - priorityClassName: system-node-critical - nodeSelector: - projectcalico.org/ds-ready: "true" - hostNetwork: true - serviceAccountName: calico - # Minimize downtime during a rolling upgrade or deletion; tell Kubernetes to do a "force - # deletion": https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods. - terminationGracePeriodSeconds: 0 - initContainers: - - name: install-cni - image: gcr.io/projectcalico-org/cni:v3.19.1 - command: ["/opt/cni/bin/install"] - env: - - name: CNI_CONF_NAME - value: "10-calico.conflist" - - name: CNI_NETWORK_CONFIG - value: |- - { - "name": "k8s-pod-network", - "cniVersion": "0.3.1", - "plugins": [ - { - "type": "calico", - "log_level": "info", - "datastore_type": "kubernetes", - "nodename": "__KUBERNETES_NODE_NAME__", - "ipam": { - "type": "host-local", - "subnet": "usePodCidr" - }, - "policy": { - "type": "k8s" - }, - "kubernetes": { - "kubeconfig": "/etc/cni/net.d/calico-kubeconfig" - } - }, - { - "type": "portmap", - "capabilities": {"portMappings": true}, - "snat": true - } - ] - } - - name: KUBERNETES_NODE_NAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - # Prevents the container from sleeping forever. - - name: SLEEP - value: "false" - volumeMounts: - - mountPath: /host/opt/cni/bin - name: cni-bin-dir - - mountPath: /host/etc/cni/net.d - name: cni-net-dir - containers: - # Runs calico/node container on each Kubernetes node. This - # container programs network policy and routes on each - # host. - - name: calico-node - image: gcr.io/projectcalico-org/node:v3.19.1 - env: - - name: CALICO_MANAGE_CNI - value: "true" - - name: CALICO_DISABLE_FILE_LOGGING - value: "true" - - name: CALICO_NETWORKING_BACKEND - value: "none" - - name: DATASTORE_TYPE - value: "kubernetes" - - name: FELIX_DEFAULTENDPOINTTOHOSTACTION - value: "ACCEPT" - - name: FELIX_HEALTHENABLED - value: "true" - - name: FELIX_IPV6SUPPORT - value: "false" - - name: FELIX_LOGSEVERITYSYS - value: "none" - - name: FELIX_LOGSEVERITYSCREEN - value: "info" - - name: FELIX_PROMETHEUSMETRICSENABLED - value: "true" - - name: FELIX_REPORTINGINTERVALSECS - value: "0" - - name: FELIX_TYPHAK8SSERVICENAME - value: "calico-typha" - - name: FELIX_ROUTETABLERANGE - value: "10-250" - - name: USE_POD_CIDR - value: "true" - - name: IP - value: "autodetect" - - name: NO_DEFAULT_POOLS - value: "true" - - name: NODENAME - valueFrom: - fieldRef: - fieldPath: spec.nodeName - - name: WAIT_FOR_DATASTORE - value: "true" - securityContext: - privileged: true - livenessProbe: - httpGet: - path: /liveness - port: 9099 - host: localhost - periodSeconds: 10 - initialDelaySeconds: 10 - failureThreshold: 6 - readinessProbe: - httpGet: - path: /readiness - port: 9099 - host: localhost - periodSeconds: 10 - volumeMounts: - - mountPath: /host/etc/cni/net.d - name: cni-net-dir - - mountPath: /lib/modules - name: lib-modules - readOnly: true - - mountPath: /etc/calico - name: etc-calico - readOnly: true - - mountPath: /var/run/calico - name: var-run-calico - readOnly: false - - mountPath: /var/lib/calico - name: var-lib-calico - readOnly: false - - mountPath: /run/xtables.lock - name: xtables-lock - readOnly: false - volumes: - # Used to ensure proper kmods are installed. - - name: lib-modules - hostPath: - path: /lib/modules - # Mount in the Felix config file from the host. - - name: etc-calico - hostPath: - path: /etc/calico - # Used to install CNI binaries. - - name: cni-bin-dir - hostPath: - path: __CALICO_CNI_DIR__ - # Used to install CNI network config. - - name: cni-net-dir - hostPath: - path: /etc/cni/net.d - - name: var-run-calico - hostPath: - path: /var/run/calico - - name: var-lib-calico - hostPath: - path: /var/lib/calico - - name: xtables-lock - hostPath: - path: /run/xtables.lock - type: FileOrCreate - tolerations: - # Make sure calico/node gets scheduled on all nodes. - - effect: NoSchedule - operator: Exists - - effect: NoExecute - operator: Exists - - key: CriticalAddonsOnly - operator: Exists diff --git a/cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-configmap.yaml b/cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-configmap.yaml deleted file mode 100644 index e4a8e1457b..0000000000 --- a/cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-configmap.yaml +++ /dev/null @@ -1,21 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: calico-node-vertical-autoscaler - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile -data: - node-autoscaler: |- - { - "calico-node": { - "requests": { - "cpu": { - "base": "80m", - "step": "20m", - "nodesPerStep": 10, - "max": "500m" - } - } - } - } diff --git a/cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-deployment.yaml b/cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-deployment.yaml deleted file mode 100644 index 90ca651ee8..0000000000 --- a/cluster/addons/calico-policy-controller/calico-node-vertical-autoscaler-deployment.yaml +++ /dev/null @@ -1,38 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - name: calico-node-vertical-autoscaler - namespace: kube-system - labels: - k8s-app: calico-node-autoscaler - addonmanager.kubernetes.io/mode: Reconcile -spec: - replicas: 1 - selector: - matchLabels: - k8s-app: calico-node-autoscaler - template: - metadata: - labels: - k8s-app: calico-node-autoscaler - spec: - priorityClassName: system-cluster-critical - containers: - - image: registry.k8s.io/cpvpa-amd64:v0.8.3 - name: autoscaler - command: - - /cpvpa - - --target=daemonset/calico-node - - --namespace=kube-system - - --logtostderr=true - - --poll-period-seconds=30 - - --v=2 - - --config-file=/etc/config/node-autoscaler - volumeMounts: - - name: config - mountPath: /etc/config - volumes: - - name: config - configMap: - name: calico-node-vertical-autoscaler - serviceAccountName: calico-cpva diff --git a/cluster/addons/calico-policy-controller/calico-serviceaccount.yaml b/cluster/addons/calico-policy-controller/calico-serviceaccount.yaml deleted file mode 100644 index 94adc0fd71..0000000000 --- a/cluster/addons/calico-policy-controller/calico-serviceaccount.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: calico - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile diff --git a/cluster/addons/calico-policy-controller/clusterinformations-crd.yaml b/cluster/addons/calico-policy-controller/clusterinformations-crd.yaml deleted file mode 100644 index d245a38a0a..0000000000 --- a/cluster/addons/calico-policy-controller/clusterinformations-crd.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: clusterinformations.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: ClusterInformation - listKind: ClusterInformationList - plural: clusterinformations - singular: clusterinformation - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - description: ClusterInformation contains the cluster specific information. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: ClusterInformationSpec contains the values of describing - the cluster. - properties: - calicoVersion: - description: CalicoVersion is the version of Calico that the cluster - is running - type: string - clusterGUID: - description: ClusterGUID is the GUID of the cluster - type: string - clusterType: - description: ClusterType describes the type of the cluster - type: string - datastoreReady: - description: DatastoreReady is used during significant datastore migrations - to signal to components such as Felix that it should wait before - accessing the datastore. - type: boolean - variant: - description: Variant declares which variant of Calico should be active. - type: string - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/felixconfigurations-crd.yaml b/cluster/addons/calico-policy-controller/felixconfigurations-crd.yaml deleted file mode 100644 index e2add59f40..0000000000 --- a/cluster/addons/calico-policy-controller/felixconfigurations-crd.yaml +++ /dev/null @@ -1,540 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: felixconfigurations.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: FelixConfiguration - listKind: FelixConfigurationList - plural: felixconfigurations - singular: felixconfiguration - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - description: Felix Configuration contains the configuration for Felix. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: FelixConfigurationSpec contains the values of the Felix configuration. - properties: - allowIPIPPacketsFromWorkloads: - description: 'AllowIPIPPacketsFromWorkloads controls whether Felix - will add a rule to drop IPIP encapsulated traffic from workloads - [Default: false]' - type: boolean - allowVXLANPacketsFromWorkloads: - description: 'AllowVXLANPacketsFromWorkloads controls whether Felix - will add a rule to drop VXLAN encapsulated traffic from workloads - [Default: false]' - type: boolean - awsSrcDstCheck: - description: 'Set source-destination-check on AWS EC2 instances. Accepted - value must be one of "DoNothing", "Enabled" or "Disabled". [Default: - DoNothing]' - enum: - - DoNothing - - Enable - - Disable - type: string - bpfConnectTimeLoadBalancingEnabled: - description: 'BPFConnectTimeLoadBalancingEnabled when in BPF mode, - controls whether Felix installs the connection-time load balancer. The - connect-time load balancer is required for the host to be able to - reach Kubernetes services and it improves the performance of pod-to-service - connections. The only reason to disable it is for debugging purposes. [Default: - true]' - type: boolean - bpfDataIfacePattern: - description: 'BPFDataIfacePattern is a regular expression that controls - which interfaces Felix should attach BPF programs to in order to - catch traffic to/from the network. This needs to match the interfaces - that Calico workload traffic flows over as well as any interfaces - that handle incoming traffic to nodeports and services from outside - the cluster. It should not match the workload interfaces (usually - named cali...). [Default: ^(en.*|eth.*|tunl0$)]' - type: string - bpfDisableUnprivileged: - description: 'BPFDisableUnprivileged, if enabled, Felix sets the kernel.unprivileged_bpf_disabled - sysctl to disable unprivileged use of BPF. This ensures that unprivileged - users cannot access Calico''s BPF maps and cannot insert their own - BPF programs to interfere with Calico''s. [Default: true]' - type: boolean - bpfEnabled: - description: 'BPFEnabled, if enabled Felix will use the BPF dataplane. - [Default: false]' - type: boolean - bpfExternalServiceMode: - description: 'BPFExternalServiceMode in BPF mode, controls how connections - from outside the cluster to services (node ports and cluster IPs) - are forwarded to remote workloads. If set to "Tunnel" then both - request and response traffic is tunneled to the remote node. If - set to "DSR", the request traffic is tunneled but the response traffic - is sent directly from the remote node. In "DSR" mode, the remote - node appears to use the IP of the ingress node; this requires a - permissive L2 network. [Default: Tunnel]' - type: string - bpfKubeProxyEndpointSlicesEnabled: - description: BPFKubeProxyEndpointSlicesEnabled in BPF mode, controls - whether Felix's embedded kube-proxy accepts EndpointSlices or not. - type: boolean - bpfKubeProxyIptablesCleanupEnabled: - description: 'BPFKubeProxyIptablesCleanupEnabled, if enabled in BPF - mode, Felix will proactively clean up the upstream Kubernetes kube-proxy''s - iptables chains. Should only be enabled if kube-proxy is not running. [Default: - true]' - type: boolean - bpfKubeProxyMinSyncPeriod: - description: 'BPFKubeProxyMinSyncPeriod, in BPF mode, controls the - minimum time between updates to the dataplane for Felix''s embedded - kube-proxy. Lower values give reduced set-up latency. Higher values - reduce Felix CPU usage by batching up more work. [Default: 1s]' - type: string - bpfLogLevel: - description: 'BPFLogLevel controls the log level of the BPF programs - when in BPF dataplane mode. One of "Off", "Info", or "Debug". The - logs are emitted to the BPF trace pipe, accessible with the command - `tc exec bpf debug`. [Default: Off].' - type: string - chainInsertMode: - description: 'ChainInsertMode controls whether Felix hooks the kernel’s - top-level iptables chains by inserting a rule at the top of the - chain or by appending a rule at the bottom. insert is the safe default - since it prevents Calico’s rules from being bypassed. If you switch - to append mode, be sure that the other rules in the chains signal - acceptance by falling through to the Calico rules, otherwise the - Calico policy will be bypassed. [Default: insert]' - type: string - dataplaneDriver: - type: string - debugDisableLogDropping: - type: boolean - debugMemoryProfilePath: - type: string - debugSimulateCalcGraphHangAfter: - type: string - debugSimulateDataplaneHangAfter: - type: string - defaultEndpointToHostAction: - description: 'DefaultEndpointToHostAction controls what happens to - traffic that goes from a workload endpoint to the host itself (after - the traffic hits the endpoint egress policy). By default Calico - blocks traffic from workload endpoints to the host itself with an - iptables “DROP” action. If you want to allow some or all traffic - from endpoint to host, set this parameter to RETURN or ACCEPT. Use - RETURN if you have your own rules in the iptables “INPUT” chain; - Calico will insert its rules at the top of that chain, then “RETURN” - packets to the “INPUT” chain once it has completed processing workload - endpoint egress policy. Use ACCEPT to unconditionally accept packets - from workloads after processing workload endpoint egress policy. - [Default: Drop]' - type: string - deviceRouteProtocol: - description: This defines the route protocol added to programmed device - routes, by default this will be RTPROT_BOOT when left blank. - type: integer - deviceRouteSourceAddress: - description: This is the source address to use on programmed device - routes. By default the source address is left blank, leaving the - kernel to choose the source address used. - type: string - disableConntrackInvalidCheck: - type: boolean - endpointReportingDelay: - type: string - endpointReportingEnabled: - type: boolean - externalNodesList: - description: ExternalNodesCIDRList is a list of CIDR's of external-non-calico-nodes - which may source tunnel traffic and have the tunneled traffic be - accepted at calico nodes. - items: - type: string - type: array - failsafeInboundHostPorts: - description: 'FailsafeInboundHostPorts is a comma-delimited list of - UDP/TCP ports that Felix will allow incoming traffic to host endpoints - on irrespective of the security policy. This is useful to avoid - accidentally cutting off a host with incorrect configuration. Each - port should be specified as tcp: or udp:. - For back-compatibility, if the protocol is not specified, it defaults - to “tcp”. To disable all inbound host ports, use the value none. - The default value allows ssh access and DHCP. [Default: tcp:22, - udp:68, tcp:179, tcp:2379, tcp:2380, tcp:6443, tcp:6666, tcp:6667]' - items: - description: ProtoPort is combination of protocol and port, both - must be specified. - properties: - port: - type: integer - protocol: - type: string - required: - - port - - protocol - type: object - type: array - failsafeOutboundHostPorts: - description: 'FailsafeOutboundHostPorts is a comma-delimited list - of UDP/TCP ports that Felix will allow outgoing traffic from host - endpoints to irrespective of the security policy. This is useful - to avoid accidentally cutting off a host with incorrect configuration. - Each port should be specified as tcp: or udp:. - For back-compatibility, if the protocol is not specified, it defaults - to “tcp”. To disable all outbound host ports, use the value none. - The default value opens etcd’s standard ports to ensure that Felix - does not get cut off from etcd as well as allowing DHCP and DNS. - [Default: tcp:179, tcp:2379, tcp:2380, tcp:6443, tcp:6666, tcp:6667, - udp:53, udp:67]' - items: - description: ProtoPort is combination of protocol and port, both - must be specified. - properties: - port: - type: integer - protocol: - type: string - required: - - port - - protocol - type: object - type: array - featureDetectOverride: - description: FeatureDetectOverride is used to override the feature - detection. Values are specified in a comma separated list with no - spaces, example; "SNATFullyRandom=true,MASQFullyRandom=false,RestoreSupportsLock=". - "true" or "false" will force the feature, empty or omitted values - are auto-detected. - type: string - genericXDPEnabled: - description: 'GenericXDPEnabled enables Generic XDP so network cards - that don''t support XDP offload or driver modes can use XDP. This - is not recommended since it doesn''t provide better performance - than iptables. [Default: false]' - type: boolean - healthEnabled: - type: boolean - healthHost: - type: string - healthPort: - type: integer - interfaceExclude: - description: 'InterfaceExclude is a comma-separated list of interfaces - that Felix should exclude when monitoring for host endpoints. The - default value ensures that Felix ignores Kubernetes'' IPVS dummy - interface, which is used internally by kube-proxy. If you want to - exclude multiple interface names using a single value, the list - supports regular expressions. For regular expressions you must wrap - the value with ''/''. For example having values ''/^kube/,veth1'' - will exclude all interfaces that begin with ''kube'' and also the - interface ''veth1''. [Default: kube-ipvs0]' - type: string - interfacePrefix: - description: 'InterfacePrefix is the interface name prefix that identifies - workload endpoints and so distinguishes them from host endpoint - interfaces. Note: in environments other than bare metal, the orchestrators - configure this appropriately. For example our Kubernetes and Docker - integrations set the ‘cali’ value, and our OpenStack integration - sets the ‘tap’ value. [Default: cali]' - type: string - interfaceRefreshInterval: - description: InterfaceRefreshInterval is the period at which Felix - rescans local interfaces to verify their state. The rescan can be - disabled by setting the interval to 0. - type: string - ipipEnabled: - type: boolean - ipipMTU: - description: 'IPIPMTU is the MTU to set on the tunnel device. See - Configuring MTU [Default: 1440]' - type: integer - ipsetsRefreshInterval: - description: 'IpsetsRefreshInterval is the period at which Felix re-checks - all iptables state to ensure that no other process has accidentally - broken Calico’s rules. Set to 0 to disable iptables refresh. [Default: - 90s]' - type: string - iptablesBackend: - description: IptablesBackend specifies which backend of iptables will - be used. The default is legacy. - type: string - iptablesFilterAllowAction: - type: string - iptablesLockFilePath: - description: 'IptablesLockFilePath is the location of the iptables - lock file. You may need to change this if the lock file is not in - its standard location (for example if you have mapped it into Felix’s - container at a different path). [Default: /run/xtables.lock]' - type: string - iptablesLockProbeInterval: - description: 'IptablesLockProbeInterval is the time that Felix will - wait between attempts to acquire the iptables lock if it is not - available. Lower values make Felix more responsive when the lock - is contended, but use more CPU. [Default: 50ms]' - type: string - iptablesLockTimeout: - description: 'IptablesLockTimeout is the time that Felix will wait - for the iptables lock, or 0, to disable. To use this feature, Felix - must share the iptables lock file with all other processes that - also take the lock. When running Felix inside a container, this - requires the /run directory of the host to be mounted into the calico/node - or calico/felix container. [Default: 0s disabled]' - type: string - iptablesMangleAllowAction: - type: string - iptablesMarkMask: - description: 'IptablesMarkMask is the mask that Felix selects its - IPTables Mark bits from. Should be a 32 bit hexadecimal number with - at least 8 bits set, none of which clash with any other mark bits - in use on the system. [Default: 0xff000000]' - format: int32 - type: integer - iptablesNATOutgoingInterfaceFilter: - type: string - iptablesPostWriteCheckInterval: - description: 'IptablesPostWriteCheckInterval is the period after Felix - has done a write to the dataplane that it schedules an extra read - back in order to check the write was not clobbered by another process. - This should only occur if another application on the system doesn’t - respect the iptables lock. [Default: 1s]' - type: string - iptablesRefreshInterval: - description: 'IptablesRefreshInterval is the period at which Felix - re-checks the IP sets in the dataplane to ensure that no other process - has accidentally broken Calico’s rules. Set to 0 to disable IP sets - refresh. Note: the default for this value is lower than the other - refresh intervals as a workaround for a Linux kernel bug that was - fixed in kernel version 4.11. If you are using v4.11 or greater - you may want to set this to, a higher value to reduce Felix CPU - usage. [Default: 10s]' - type: string - ipv6Support: - type: boolean - kubeNodePortRanges: - description: 'KubeNodePortRanges holds list of port ranges used for - service node ports. Only used if felix detects kube-proxy running - in ipvs mode. Felix uses these ranges to separate host and workload - traffic. [Default: 30000:32767].' - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - logFilePath: - description: 'LogFilePath is the full path to the Felix log. Set to - none to disable file logging. [Default: /var/log/calico/felix.log]' - type: string - logPrefix: - description: 'LogPrefix is the log prefix that Felix uses when rendering - LOG rules. [Default: calico-packet]' - type: string - logSeverityFile: - description: 'LogSeverityFile is the log severity above which logs - are sent to the log file. [Default: Info]' - type: string - logSeverityScreen: - description: 'LogSeverityScreen is the log severity above which logs - are sent to the stdout. [Default: Info]' - type: string - logSeveritySys: - description: 'LogSeveritySys is the log severity above which logs - are sent to the syslog. Set to None for no logging to syslog. [Default: - Info]' - type: string - maxIpsetSize: - type: integer - metadataAddr: - description: 'MetadataAddr is the IP address or domain name of the - server that can answer VM queries for cloud-init metadata. In OpenStack, - this corresponds to the machine running nova-api (or in Ubuntu, - nova-api-metadata). A value of none (case insensitive) means that - Felix should not set up any NAT rule for the metadata path. [Default: - 127.0.0.1]' - type: string - metadataPort: - description: 'MetadataPort is the port of the metadata server. This, - combined with global.MetadataAddr (if not ‘None’), is used to set - up a NAT rule, from 169.254.169.254:80 to MetadataAddr:MetadataPort. - In most cases this should not need to be changed [Default: 8775].' - type: integer - natOutgoingAddress: - description: NATOutgoingAddress specifies an address to use when performing - source NAT for traffic in a natOutgoing pool that is leaving the - network. By default the address used is an address on the interface - the traffic is leaving on (ie it uses the iptables MASQUERADE target) - type: string - natPortRange: - anyOf: - - type: integer - - type: string - description: NATPortRange specifies the range of ports that is used - for port mapping when doing outgoing NAT. When unset the default - behavior of the network stack is used. - pattern: ^.* - x-kubernetes-int-or-string: true - netlinkTimeout: - type: string - openstackRegion: - description: 'OpenstackRegion is the name of the region that a particular - Felix belongs to. In a multi-region Calico/OpenStack deployment, - this must be configured somehow for each Felix (here in the datamodel, - or in felix.cfg or the environment on each compute node), and must - match the [calico] openstack_region value configured in neutron.conf - on each node. [Default: Empty]' - type: string - policySyncPathPrefix: - description: 'PolicySyncPathPrefix is used to by Felix to communicate - policy changes to external services, like Application layer policy. - [Default: Empty]' - type: string - prometheusGoMetricsEnabled: - description: 'PrometheusGoMetricsEnabled disables Go runtime metrics - collection, which the Prometheus client does by default, when set - to false. This reduces the number of metrics reported, reducing - Prometheus load. [Default: true]' - type: boolean - prometheusMetricsEnabled: - description: 'PrometheusMetricsEnabled enables the Prometheus metrics - server in Felix if set to true. [Default: false]' - type: boolean - prometheusMetricsHost: - description: 'PrometheusMetricsHost is the host that the Prometheus - metrics server should bind to. [Default: empty]' - type: string - prometheusMetricsPort: - description: 'PrometheusMetricsPort is the TCP port that the Prometheus - metrics server should bind to. [Default: 9091]' - type: integer - prometheusProcessMetricsEnabled: - description: 'PrometheusProcessMetricsEnabled disables process metrics - collection, which the Prometheus client does by default, when set - to false. This reduces the number of metrics reported, reducing - Prometheus load. [Default: true]' - type: boolean - removeExternalRoutes: - description: Whether or not to remove device routes that have not - been programmed by Felix. Disabling this will allow external applications - to also add device routes. This is enabled by default which means - we will remove externally added routes. - type: boolean - reportingInterval: - description: 'ReportingInterval is the interval at which Felix reports - its status into the datastore or 0 to disable. Must be non-zero - in OpenStack deployments. [Default: 30s]' - type: string - reportingTTL: - description: 'ReportingTTL is the time-to-live setting for process-wide - status reports. [Default: 90s]' - type: string - routeRefreshInterval: - description: 'RouterefreshInterval is the period at which Felix re-checks - the routes in the dataplane to ensure that no other process has - accidentally broken Calico’s rules. Set to 0 to disable route refresh. - [Default: 90s]' - type: string - routeSource: - description: 'RouteSource configures where Felix gets its routing - information. - WorkloadIPs: use workload endpoints to construct - routes. - CalicoIPAM: the default - use IPAM data to construct routes.' - type: string - routeTableRange: - description: Calico programs additional Linux route tables for various - purposes. RouteTableRange specifies the indices of the route tables - that Calico should use. - properties: - max: - type: integer - min: - type: integer - required: - - max - - min - type: object - sidecarAccelerationEnabled: - description: 'SidecarAccelerationEnabled enables experimental sidecar - acceleration [Default: false]' - type: boolean - usageReportingEnabled: - description: 'UsageReportingEnabled reports anonymous Calico version - number and cluster size to projectcalico.org. Logs warnings returned - by the usage server. For example, if a significant security vulnerability - has been discovered in the version of Calico being used. [Default: - true]' - type: boolean - usageReportingInitialDelay: - description: 'UsageReportingInitialDelay controls the minimum delay - before Felix makes a report. [Default: 300s]' - type: string - usageReportingInterval: - description: 'UsageReportingInterval controls the interval at which - Felix makes reports. [Default: 86400s]' - type: string - useInternalDataplaneDriver: - type: boolean - vxlanEnabled: - type: boolean - vxlanMTU: - description: 'VXLANMTU is the MTU to set on the tunnel device. See - Configuring MTU [Default: 1440]' - type: integer - vxlanPort: - type: integer - vxlanVNI: - type: integer - wireguardEnabled: - description: 'WireguardEnabled controls whether Wireguard is enabled. - [Default: false]' - type: boolean - wireguardInterfaceName: - description: 'WireguardInterfaceName specifies the name to use for - the Wireguard interface. [Default: wg.calico]' - type: string - wireguardListeningPort: - description: 'WireguardListeningPort controls the listening port used - by Wireguard. [Default: 51820]' - type: integer - wireguardMTU: - description: 'WireguardMTU controls the MTU on the Wireguard interface. - See Configuring MTU [Default: 1420]' - type: integer - wireguardRoutingRulePriority: - description: 'WireguardRoutingRulePriority controls the priority value - to use for the Wireguard routing rule. [Default: 99]' - type: integer - xdpEnabled: - description: 'XDPEnabled enables XDP acceleration for suitable untracked - incoming deny rules. [Default: true]' - type: boolean - xdpRefreshInterval: - description: 'XDPRefreshInterval is the period at which Felix re-checks - all XDP state to ensure that no other process has accidentally broken - Calico''s BPF maps or attached programs. Set to 0 to disable XDP - refresh. [Default: 90s]' - type: string - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/globalnetworkpolicy-crd.yaml b/cluster/addons/calico-policy-controller/globalnetworkpolicy-crd.yaml deleted file mode 100644 index 54f9fe055e..0000000000 --- a/cluster/addons/calico-policy-controller/globalnetworkpolicy-crd.yaml +++ /dev/null @@ -1,771 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: globalnetworkpolicies.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: GlobalNetworkPolicy - listKind: GlobalNetworkPolicyList - plural: globalnetworkpolicies - singular: globalnetworkpolicy - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - applyOnForward: - description: ApplyOnForward indicates to apply the rules in this policy - on forward traffic. - type: boolean - doNotTrack: - description: DoNotTrack indicates whether packets matched by the rules - in this policy should go through the data plane's connection tracking, - such as Linux conntrack. If True, the rules in this policy are - applied before any data plane connection tracking, and packets allowed - by this policy are marked as not to be tracked. - type: boolean - egress: - description: The ordered set of egress rules. Each rule contains - a set of packet match criteria and a corresponding action to apply. - items: - description: "A Rule encapsulates a set of match criteria and an - action. Both selector-based security Policy and security Profiles - reference rules - separated out as a list of rules for both ingress - and egress packet matching. \n Each positive match criteria has - a negated version, prefixed with ”Not”. All the match criteria - within a rule must be satisfied for a packet to match. A single - rule can contain the positive and negative version of a match - and both must be satisfied for the rule to match." - properties: - action: - type: string - destination: - description: Destination contains the match criteria that apply - to destination entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - http: - description: HTTP contains match criteria that apply to HTTP - requests. - properties: - methods: - description: Methods is an optional field that restricts - the rule to apply only to HTTP requests that use one of - the listed HTTP Methods (e.g. GET, PUT, etc.) Multiple - methods are OR'd together. - items: - type: string - type: array - paths: - description: 'Paths is an optional field that restricts - the rule to apply to HTTP requests that use one of the - listed HTTP Paths. Multiple paths are OR''d together. - e.g: - exact: /foo - prefix: /bar NOTE: Each entry may - ONLY specify either a `exact` or a `prefix` match. The - validator will check for it.' - items: - description: 'HTTPPath specifies an HTTP path to match. - It may be either of the form: exact: : which matches - the path exactly or prefix: : which matches - the path prefix' - properties: - exact: - type: string - prefix: - type: string - type: object - type: array - type: object - icmp: - description: ICMP is an optional field that restricts the rule - to apply to a specific type and code of ICMP traffic. This - should only be specified if the Protocol field is set to "ICMP" - or "ICMPv6". - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - ipVersion: - description: IPVersion is an optional field that restricts the - rule to only match a specific IP version. - type: integer - metadata: - description: Metadata contains additional information for this - rule - properties: - annotations: - additionalProperties: - type: string - description: Annotations is a set of key value pairs that - give extra information about the rule - type: object - type: object - notICMP: - description: NotICMP is the negated version of the ICMP field. - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - notProtocol: - anyOf: - - type: integer - - type: string - description: NotProtocol is the negated version of the Protocol - field. - pattern: ^.* - x-kubernetes-int-or-string: true - protocol: - anyOf: - - type: integer - - type: string - description: "Protocol is an optional field that restricts the - rule to only apply to traffic of a specific IP protocol. Required - if any of the EntityRules contain Ports (because ports only - apply to certain protocols). \n Must be one of these string - values: \"TCP\", \"UDP\", \"ICMP\", \"ICMPv6\", \"SCTP\", - \"UDPLite\" or an integer in the range 1-255." - pattern: ^.* - x-kubernetes-int-or-string: true - source: - description: Source contains the match criteria that apply to - source entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - required: - - action - type: object - type: array - ingress: - description: The ordered set of ingress rules. Each rule contains - a set of packet match criteria and a corresponding action to apply. - items: - description: "A Rule encapsulates a set of match criteria and an - action. Both selector-based security Policy and security Profiles - reference rules - separated out as a list of rules for both ingress - and egress packet matching. \n Each positive match criteria has - a negated version, prefixed with ”Not”. All the match criteria - within a rule must be satisfied for a packet to match. A single - rule can contain the positive and negative version of a match - and both must be satisfied for the rule to match." - properties: - action: - type: string - destination: - description: Destination contains the match criteria that apply - to destination entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - http: - description: HTTP contains match criteria that apply to HTTP - requests. - properties: - methods: - description: Methods is an optional field that restricts - the rule to apply only to HTTP requests that use one of - the listed HTTP Methods (e.g. GET, PUT, etc.) Multiple - methods are OR'd together. - items: - type: string - type: array - paths: - description: 'Paths is an optional field that restricts - the rule to apply to HTTP requests that use one of the - listed HTTP Paths. Multiple paths are OR''d together. - e.g: - exact: /foo - prefix: /bar NOTE: Each entry may - ONLY specify either a `exact` or a `prefix` match. The - validator will check for it.' - items: - description: 'HTTPPath specifies an HTTP path to match. - It may be either of the form: exact: : which matches - the path exactly or prefix: : which matches - the path prefix' - properties: - exact: - type: string - prefix: - type: string - type: object - type: array - type: object - icmp: - description: ICMP is an optional field that restricts the rule - to apply to a specific type and code of ICMP traffic. This - should only be specified if the Protocol field is set to "ICMP" - or "ICMPv6". - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - ipVersion: - description: IPVersion is an optional field that restricts the - rule to only match a specific IP version. - type: integer - metadata: - description: Metadata contains additional information for this - rule - properties: - annotations: - additionalProperties: - type: string - description: Annotations is a set of key value pairs that - give extra information about the rule - type: object - type: object - notICMP: - description: NotICMP is the negated version of the ICMP field. - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - notProtocol: - anyOf: - - type: integer - - type: string - description: NotProtocol is the negated version of the Protocol - field. - pattern: ^.* - x-kubernetes-int-or-string: true - protocol: - anyOf: - - type: integer - - type: string - description: "Protocol is an optional field that restricts the - rule to only apply to traffic of a specific IP protocol. Required - if any of the EntityRules contain Ports (because ports only - apply to certain protocols). \n Must be one of these string - values: \"TCP\", \"UDP\", \"ICMP\", \"ICMPv6\", \"SCTP\", - \"UDPLite\" or an integer in the range 1-255." - pattern: ^.* - x-kubernetes-int-or-string: true - source: - description: Source contains the match criteria that apply to - source entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - required: - - action - type: object - type: array - namespaceSelector: - description: NamespaceSelector is an optional field for an expression - used to select a pod based on namespaces. - type: string - order: - description: Order is an optional field that specifies the order in - which the policy is applied. Policies with higher "order" are applied - after those with lower order. If the order is omitted, it may be - considered to be "infinite" - i.e. the policy will be applied last. Policies - with identical order will be applied in alphanumerical order based - on the Policy "Name". - type: number - preDNAT: - description: PreDNAT indicates to apply the rules in this policy before - any DNAT. - type: boolean - selector: - description: "The selector is an expression used to pick pick out - the endpoints that the policy should be applied to. \n Selector - expressions follow this syntax: \n \tlabel == \"string_literal\" - \ -> comparison, e.g. my_label == \"foo bar\" \tlabel != \"string_literal\" - \ -> not equal; also matches if label is not present \tlabel in - { \"a\", \"b\", \"c\", ... } -> true if the value of label X is - one of \"a\", \"b\", \"c\" \tlabel not in { \"a\", \"b\", \"c\", - ... } -> true if the value of label X is not one of \"a\", \"b\", - \"c\" \thas(label_name) -> True if that label is present \t! expr - -> negation of expr \texpr && expr -> Short-circuit and \texpr - || expr -> Short-circuit or \t( expr ) -> parens for grouping \tall() - or the empty selector -> matches all endpoints. \n Label names are - allowed to contain alphanumerics, -, _ and /. String literals are - more permissive but they do not support escape characters. \n Examples - (with made-up labels): \n \ttype == \"webserver\" && deployment - == \"prod\" \ttype in {\"frontend\", \"backend\"} \tdeployment != - \"dev\" \t! has(label_name)" - type: string - serviceAccountSelector: - description: ServiceAccountSelector is an optional field for an expression - used to select a pod based on service accounts. - type: string - types: - description: "Types indicates whether this policy applies to ingress, - or to egress, or to both. When not explicitly specified (and so - the value on creation is empty or nil), Calico defaults Types according - to what Ingress and Egress rules are present in the policy. The - default is: \n - [ PolicyTypeIngress ], if there are no Egress rules - (including the case where there are also no Ingress rules) \n - - [ PolicyTypeEgress ], if there are Egress rules but no Ingress - rules \n - [ PolicyTypeIngress, PolicyTypeEgress ], if there are - both Ingress and Egress rules. \n When the policy is read back again, - Types will always be one of these values, never empty or nil." - items: - description: PolicyType enumerates the possible values of the PolicySpec - Types field. - type: string - type: array - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/globalnetworksets-crd.yaml b/cluster/addons/calico-policy-controller/globalnetworksets-crd.yaml deleted file mode 100644 index 7a700d69a5..0000000000 --- a/cluster/addons/calico-policy-controller/globalnetworksets-crd.yaml +++ /dev/null @@ -1,53 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: globalnetworksets.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: GlobalNetworkSet - listKind: GlobalNetworkSetList - plural: globalnetworksets - singular: globalnetworkset - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - description: GlobalNetworkSet contains a set of arbitrary IP sub-networks/CIDRs - that share labels to allow rules to refer to them via selectors. The labels - of GlobalNetworkSet are not namespaced. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: GlobalNetworkSetSpec contains the specification for a NetworkSet - resource. - properties: - nets: - description: The list of IP networks that belong to this set. - items: - type: string - type: array - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/hostendpoints-crd.yaml b/cluster/addons/calico-policy-controller/hostendpoints-crd.yaml deleted file mode 100644 index b9a1d85b26..0000000000 --- a/cluster/addons/calico-policy-controller/hostendpoints-crd.yaml +++ /dev/null @@ -1,108 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: hostendpoints.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: HostEndpoint - listKind: HostEndpointList - plural: hostendpoints - singular: hostendpoint - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: HostEndpointSpec contains the specification for a HostEndpoint - resource. - properties: - expectedIPs: - description: "The expected IP addresses (IPv4 and IPv6) of the endpoint. - If \"InterfaceName\" is not present, Calico will look for an interface - matching any of the IPs in the list and apply policy to that. Note: - \tWhen using the selector match criteria in an ingress or egress - security Policy \tor Profile, Calico converts the selector into - a set of IP addresses. For host \tendpoints, the ExpectedIPs field - is used for that purpose. (If only the interface \tname is specified, - Calico does not learn the IPs of the interface for use in match - \tcriteria.)" - items: - type: string - type: array - interfaceName: - description: "Either \"*\", or the name of a specific Linux interface - to apply policy to; or empty. \"*\" indicates that this HostEndpoint - governs all traffic to, from or through the default network namespace - of the host named by the \"Node\" field; entering and leaving that - namespace via any interface, including those from/to non-host-networked - local workloads. \n If InterfaceName is not \"*\", this HostEndpoint - only governs traffic that enters or leaves the host through the - specific interface named by InterfaceName, or - when InterfaceName - is empty - through the specific interface that has one of the IPs - in ExpectedIPs. Therefore, when InterfaceName is empty, at least - one expected IP must be specified. Only external interfaces (such - as “eth0”) are supported here; it isn't possible for a HostEndpoint - to protect traffic through a specific local workload interface. - \n Note: Only some kinds of policy are implemented for \"*\" HostEndpoints; - initially just pre-DNAT policy. Please check Calico documentation - for the latest position." - type: string - node: - description: The node name identifying the Calico node instance. - type: string - ports: - description: Ports contains the endpoint's named ports, which may - be referenced in security policy rules. - items: - properties: - name: - type: string - port: - type: integer - protocol: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - required: - - name - - port - - protocol - type: object - type: array - profiles: - description: A list of identifiers of security Profile objects that - apply to this endpoint. Each profile is applied in the order that - they appear in this list. Profile rules are applied after the selector-based - security policy. - items: - type: string - type: array - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/ipamblock-crd.yaml b/cluster/addons/calico-policy-controller/ipamblock-crd.yaml deleted file mode 100644 index 18a76b225f..0000000000 --- a/cluster/addons/calico-policy-controller/ipamblock-crd.yaml +++ /dev/null @@ -1,81 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: ipamblocks.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: IPAMBlock - listKind: IPAMBlockList - plural: ipamblocks - singular: ipamblock - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: IPAMBlockSpec contains the specification for an IPAMBlock - resource. - properties: - affinity: - type: string - allocations: - items: - type: integer - # TODO: This nullable is manually added in. We should update controller-gen - # to handle []*int properly itself. - nullable: true - type: array - attributes: - items: - properties: - handle_id: - type: string - secondary: - additionalProperties: - type: string - type: object - type: object - type: array - cidr: - type: string - deleted: - type: boolean - strictAffinity: - type: boolean - unallocated: - items: - type: integer - type: array - required: - - allocations - - attributes - - cidr - - strictAffinity - - unallocated - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/ipamconfig-crd.yaml b/cluster/addons/calico-policy-controller/ipamconfig-crd.yaml deleted file mode 100644 index d51ce6e7f0..0000000000 --- a/cluster/addons/calico-policy-controller/ipamconfig-crd.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: ipamconfigs.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: IPAMConfig - listKind: IPAMConfigList - plural: ipamconfigs - singular: ipamconfig - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: IPAMConfigSpec contains the specification for an IPAMConfig - resource. - properties: - autoAllocateBlocks: - type: boolean - strictAffinity: - type: boolean - required: - - autoAllocateBlocks - - strictAffinity - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/ipamhandle-crd.yaml b/cluster/addons/calico-policy-controller/ipamhandle-crd.yaml deleted file mode 100644 index c7663c3b50..0000000000 --- a/cluster/addons/calico-policy-controller/ipamhandle-crd.yaml +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: ipamhandles.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: IPAMHandle - listKind: IPAMHandleList - plural: ipamhandles - singular: ipamhandle - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: IPAMHandleSpec contains the specification for an IPAMHandle - resource. - properties: - block: - additionalProperties: - type: integer - type: object - handleID: - type: string - required: - - block - - handleID - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/ippool-crd.yaml b/cluster/addons/calico-policy-controller/ippool-crd.yaml deleted file mode 100644 index 46e24a959a..0000000000 --- a/cluster/addons/calico-policy-controller/ippool-crd.yaml +++ /dev/null @@ -1,99 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: ippools.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: IPPool - listKind: IPPoolList - plural: ippools - singular: ippool - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: IPPoolSpec contains the specification for an IPPool resource. - properties: - blockSize: - description: The block size to use for IP address assignments from - this pool. Defaults to 26 for IPv4 and 112 for IPv6. - type: integer - cidr: - description: The pool CIDR. - type: string - disabled: - description: When disabled is true, Calico IPAM will not assign addresses - from this pool. - type: boolean - ipip: - description: 'Deprecated: this field is only used for APIv1 backwards - compatibility. Setting this field is not allowed, this field is - for internal use only.' - properties: - enabled: - description: When enabled is true, ipip tunneling will be used - to deliver packets to destinations within this pool. - type: boolean - mode: - description: The IPIP mode. This can be one of "always" or "cross-subnet". A - mode of "always" will also use IPIP tunneling for routing to - destination IP addresses within this pool. A mode of "cross-subnet" - will only use IPIP tunneling when the destination node is on - a different subnet to the originating node. The default value - (if not specified) is "always". - type: string - type: object - ipipMode: - description: Contains configuration for IPIP tunneling for this pool. - If not specified, then this is defaulted to "Never" (i.e. IPIP tunneling - is disabled). - type: string - nat-outgoing: - description: 'Deprecated: this field is only used for APIv1 backwards - compatibility. Setting this field is not allowed, this field is - for internal use only.' - type: boolean - natOutgoing: - description: When nat-outgoing is true, packets sent from Calico networked - containers in this pool to destinations outside of this pool will - be masqueraded. - type: boolean - nodeSelector: - description: Allows IPPool to allocate for a specific node by label - selector. - type: string - vxlanMode: - description: Contains configuration for VXLAN tunneling for this pool. - If not specified, then this is defaulted to "Never" (i.e. VXLAN - tunneling is disabled). - type: string - required: - - cidr - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/kubecontrollersconfigurations-crd.yaml b/cluster/addons/calico-policy-controller/kubecontrollersconfigurations-crd.yaml deleted file mode 100644 index 7609fb8822..0000000000 --- a/cluster/addons/calico-policy-controller/kubecontrollersconfigurations-crd.yaml +++ /dev/null @@ -1,223 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: kubecontrollersconfigurations.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: KubeControllersConfiguration - listKind: KubeControllersConfigurationList - plural: kubecontrollersconfigurations - singular: kubecontrollersconfiguration - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: KubeControllersConfigurationSpec contains the values of the - Kubernetes controllers configuration. - properties: - controllers: - description: Controllers enables and configures individual Kubernetes - controllers - properties: - namespace: - description: Namespace enables and configures the namespace controller. - Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform reconciliation - with the Calico datastore. [Default: 5m]' - type: string - type: object - node: - description: Node enables and configures the node controller. - Enabled by default, set to nil to disable. - properties: - hostEndpoint: - description: HostEndpoint controls syncing nodes to host endpoints. - Disabled by default, set to nil to disable. - properties: - autoCreate: - description: 'AutoCreate enables automatic creation of - host endpoints for every node. [Default: Disabled]' - type: string - type: object - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform reconciliation - with the Calico datastore. [Default: 5m]' - type: string - syncLabels: - description: 'SyncLabels controls whether to copy Kubernetes - node labels to Calico nodes. [Default: Enabled]' - type: string - type: object - policy: - description: Policy enables and configures the policy controller. - Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform reconciliation - with the Calico datastore. [Default: 5m]' - type: string - type: object - serviceAccount: - description: ServiceAccount enables and configures the service - account controller. Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform reconciliation - with the Calico datastore. [Default: 5m]' - type: string - type: object - workloadEndpoint: - description: WorkloadEndpoint enables and configures the workload - endpoint controller. Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform reconciliation - with the Calico datastore. [Default: 5m]' - type: string - type: object - type: object - etcdV3CompactionPeriod: - description: 'EtcdV3CompactionPeriod is the period between etcdv3 - compaction requests. Set to 0 to disable. [Default: 10m]' - type: string - healthChecks: - description: 'HealthChecks enables or disables support for health - checks [Default: Enabled]' - type: string - logSeverityScreen: - description: 'LogSeverityScreen is the log severity above which logs - are sent to the stdout. [Default: Info]' - type: string - required: - - controllers - type: object - status: - description: KubeControllersConfigurationStatus represents the status - of the configuration. It's useful for admins to be able to see the actual - config that was applied, which can be modified by environment variables - on the kube-controllers process. - properties: - environmentVars: - additionalProperties: - type: string - description: EnvironmentVars contains the environment variables on - the kube-controllers that influenced the RunningConfig. - type: object - runningConfig: - description: RunningConfig contains the effective config that is running - in the kube-controllers pod, after merging the API resource with - any environment variables. - properties: - controllers: - description: Controllers enables and configures individual Kubernetes - controllers - properties: - namespace: - description: Namespace enables and configures the namespace - controller. Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform - reconciliation with the Calico datastore. [Default: - 5m]' - type: string - type: object - node: - description: Node enables and configures the node controller. - Enabled by default, set to nil to disable. - properties: - hostEndpoint: - description: HostEndpoint controls syncing nodes to host - endpoints. Disabled by default, set to nil to disable. - properties: - autoCreate: - description: 'AutoCreate enables automatic creation - of host endpoints for every node. [Default: Disabled]' - type: string - type: object - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform - reconciliation with the Calico datastore. [Default: - 5m]' - type: string - syncLabels: - description: 'SyncLabels controls whether to copy Kubernetes - node labels to Calico nodes. [Default: Enabled]' - type: string - type: object - policy: - description: Policy enables and configures the policy controller. - Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform - reconciliation with the Calico datastore. [Default: - 5m]' - type: string - type: object - serviceAccount: - description: ServiceAccount enables and configures the service - account controller. Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform - reconciliation with the Calico datastore. [Default: - 5m]' - type: string - type: object - workloadEndpoint: - description: WorkloadEndpoint enables and configures the workload - endpoint controller. Enabled by default, set to nil to disable. - properties: - reconcilerPeriod: - description: 'ReconcilerPeriod is the period to perform - reconciliation with the Calico datastore. [Default: - 5m]' - type: string - type: object - type: object - etcdV3CompactionPeriod: - description: 'EtcdV3CompactionPeriod is the period between etcdv3 - compaction requests. Set to 0 to disable. [Default: 10m]' - type: string - healthChecks: - description: 'HealthChecks enables or disables support for health - checks [Default: Enabled]' - type: string - logSeverityScreen: - description: 'LogSeverityScreen is the log severity above which - logs are sent to the stdout. [Default: Info]' - type: string - required: - - controllers - type: object - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/networkpolicies-crd.yaml b/cluster/addons/calico-policy-controller/networkpolicies-crd.yaml deleted file mode 100644 index 11fc9ee693..0000000000 --- a/cluster/addons/calico-policy-controller/networkpolicies-crd.yaml +++ /dev/null @@ -1,752 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: networkpolicies.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: NetworkPolicy - listKind: NetworkPolicyList - plural: networkpolicies - singular: networkpolicy - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - properties: - egress: - description: The ordered set of egress rules. Each rule contains - a set of packet match criteria and a corresponding action to apply. - items: - description: "A Rule encapsulates a set of match criteria and an - action. Both selector-based security Policy and security Profiles - reference rules - separated out as a list of rules for both ingress - and egress packet matching. \n Each positive match criteria has - a negated version, prefixed with ”Not”. All the match criteria - within a rule must be satisfied for a packet to match. A single - rule can contain the positive and negative version of a match - and both must be satisfied for the rule to match." - properties: - action: - type: string - destination: - description: Destination contains the match criteria that apply - to destination entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - http: - description: HTTP contains match criteria that apply to HTTP - requests. - properties: - methods: - description: Methods is an optional field that restricts - the rule to apply only to HTTP requests that use one of - the listed HTTP Methods (e.g. GET, PUT, etc.) Multiple - methods are OR'd together. - items: - type: string - type: array - paths: - description: 'Paths is an optional field that restricts - the rule to apply to HTTP requests that use one of the - listed HTTP Paths. Multiple paths are OR''d together. - e.g: - exact: /foo - prefix: /bar NOTE: Each entry may - ONLY specify either a `exact` or a `prefix` match. The - validator will check for it.' - items: - description: 'HTTPPath specifies an HTTP path to match. - It may be either of the form: exact: : which matches - the path exactly or prefix: : which matches - the path prefix' - properties: - exact: - type: string - prefix: - type: string - type: object - type: array - type: object - icmp: - description: ICMP is an optional field that restricts the rule - to apply to a specific type and code of ICMP traffic. This - should only be specified if the Protocol field is set to "ICMP" - or "ICMPv6". - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - ipVersion: - description: IPVersion is an optional field that restricts the - rule to only match a specific IP version. - type: integer - metadata: - description: Metadata contains additional information for this - rule - properties: - annotations: - additionalProperties: - type: string - description: Annotations is a set of key value pairs that - give extra information about the rule - type: object - type: object - notICMP: - description: NotICMP is the negated version of the ICMP field. - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - notProtocol: - anyOf: - - type: integer - - type: string - description: NotProtocol is the negated version of the Protocol - field. - pattern: ^.* - x-kubernetes-int-or-string: true - protocol: - anyOf: - - type: integer - - type: string - description: "Protocol is an optional field that restricts the - rule to only apply to traffic of a specific IP protocol. Required - if any of the EntityRules contain Ports (because ports only - apply to certain protocols). \n Must be one of these string - values: \"TCP\", \"UDP\", \"ICMP\", \"ICMPv6\", \"SCTP\", - \"UDPLite\" or an integer in the range 1-255." - pattern: ^.* - x-kubernetes-int-or-string: true - source: - description: Source contains the match criteria that apply to - source entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - required: - - action - type: object - type: array - ingress: - description: The ordered set of ingress rules. Each rule contains - a set of packet match criteria and a corresponding action to apply. - items: - description: "A Rule encapsulates a set of match criteria and an - action. Both selector-based security Policy and security Profiles - reference rules - separated out as a list of rules for both ingress - and egress packet matching. \n Each positive match criteria has - a negated version, prefixed with ”Not”. All the match criteria - within a rule must be satisfied for a packet to match. A single - rule can contain the positive and negative version of a match - and both must be satisfied for the rule to match." - properties: - action: - type: string - destination: - description: Destination contains the match criteria that apply - to destination entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - http: - description: HTTP contains match criteria that apply to HTTP - requests. - properties: - methods: - description: Methods is an optional field that restricts - the rule to apply only to HTTP requests that use one of - the listed HTTP Methods (e.g. GET, PUT, etc.) Multiple - methods are OR'd together. - items: - type: string - type: array - paths: - description: 'Paths is an optional field that restricts - the rule to apply to HTTP requests that use one of the - listed HTTP Paths. Multiple paths are OR''d together. - e.g: - exact: /foo - prefix: /bar NOTE: Each entry may - ONLY specify either a `exact` or a `prefix` match. The - validator will check for it.' - items: - description: 'HTTPPath specifies an HTTP path to match. - It may be either of the form: exact: : which matches - the path exactly or prefix: : which matches - the path prefix' - properties: - exact: - type: string - prefix: - type: string - type: object - type: array - type: object - icmp: - description: ICMP is an optional field that restricts the rule - to apply to a specific type and code of ICMP traffic. This - should only be specified if the Protocol field is set to "ICMP" - or "ICMPv6". - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - ipVersion: - description: IPVersion is an optional field that restricts the - rule to only match a specific IP version. - type: integer - metadata: - description: Metadata contains additional information for this - rule - properties: - annotations: - additionalProperties: - type: string - description: Annotations is a set of key value pairs that - give extra information about the rule - type: object - type: object - notICMP: - description: NotICMP is the negated version of the ICMP field. - properties: - code: - description: Match on a specific ICMP code. If specified, - the Type value must also be specified. This is a technical - limitation imposed by the kernel’s iptables firewall, - which Calico uses to enforce the rule. - type: integer - type: - description: Match on a specific ICMP type. For example - a value of 8 refers to ICMP Echo Request (i.e. pings). - type: integer - type: object - notProtocol: - anyOf: - - type: integer - - type: string - description: NotProtocol is the negated version of the Protocol - field. - pattern: ^.* - x-kubernetes-int-or-string: true - protocol: - anyOf: - - type: integer - - type: string - description: "Protocol is an optional field that restricts the - rule to only apply to traffic of a specific IP protocol. Required - if any of the EntityRules contain Ports (because ports only - apply to certain protocols). \n Must be one of these string - values: \"TCP\", \"UDP\", \"ICMP\", \"ICMPv6\", \"SCTP\", - \"UDPLite\" or an integer in the range 1-255." - pattern: ^.* - x-kubernetes-int-or-string: true - source: - description: Source contains the match criteria that apply to - source entity. - properties: - namespaceSelector: - description: "NamespaceSelector is an optional field that - contains a selector expression. Only traffic that originates - from (or terminates at) endpoints within the selected - namespaces will be matched. When both NamespaceSelector - and Selector are defined on the same rule, then only workload - endpoints that are matched by both selectors will be selected - by the rule. \n For NetworkPolicy, an empty NamespaceSelector - implies that the Selector is limited to selecting only - workload endpoints in the same namespace as the NetworkPolicy. - \n For NetworkPolicy, `global()` NamespaceSelector implies - that the Selector is limited to selecting only GlobalNetworkSet - or HostEndpoint. \n For GlobalNetworkPolicy, an empty - NamespaceSelector implies the Selector applies to workload - endpoints across all namespaces." - type: string - nets: - description: Nets is an optional field that restricts the - rule to only apply to traffic that originates from (or - terminates at) IP addresses in any of the given subnets. - items: - type: string - type: array - notNets: - description: NotNets is the negated version of the Nets - field. - items: - type: string - type: array - notPorts: - description: NotPorts is the negated version of the Ports - field. Since only some protocols have ports, if any ports - are specified it requires the Protocol match in the Rule - to be set to "TCP" or "UDP". - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - notSelector: - description: NotSelector is the negated version of the Selector - field. See Selector field for subtleties with negated - selectors. - type: string - ports: - description: "Ports is an optional field that restricts - the rule to only apply to traffic that has a source (destination) - port that matches one of these ranges/values. This value - is a list of integers or strings that represent ranges - of ports. \n Since only some protocols have ports, if - any ports are specified it requires the Protocol match - in the Rule to be set to \"TCP\" or \"UDP\"." - items: - anyOf: - - type: integer - - type: string - pattern: ^.* - x-kubernetes-int-or-string: true - type: array - selector: - description: "Selector is an optional field that contains - a selector expression (see Policy for sample syntax). - \ Only traffic that originates from (terminates at) endpoints - matching the selector will be matched. \n Note that: in - addition to the negated version of the Selector (see NotSelector - below), the selector expression syntax itself supports - negation. The two types of negation are subtly different. - One negates the set of matched endpoints, the other negates - the whole match: \n \tSelector = \"!has(my_label)\" matches - packets that are from other Calico-controlled \tendpoints - that do not have the label “my_label”. \n \tNotSelector - = \"has(my_label)\" matches packets that are not from - Calico-controlled \tendpoints that do have the label “my_label”. - \n The effect is that the latter will accept packets from - non-Calico sources whereas the former is limited to packets - from Calico-controlled endpoints." - type: string - serviceAccounts: - description: ServiceAccounts is an optional field that restricts - the rule to only apply to traffic that originates from - (or terminates at) a pod running as a matching service - account. - properties: - names: - description: Names is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account whose name is in the list. - items: - type: string - type: array - selector: - description: Selector is an optional field that restricts - the rule to only apply to traffic that originates - from (or terminates at) a pod running as a service - account that matches the given label selector. If - both Names and Selector are specified then they are - AND'ed. - type: string - type: object - type: object - required: - - action - type: object - type: array - order: - description: Order is an optional field that specifies the order in - which the policy is applied. Policies with higher "order" are applied - after those with lower order. If the order is omitted, it may be - considered to be "infinite" - i.e. the policy will be applied last. Policies - with identical order will be applied in alphanumerical order based - on the Policy "Name". - type: number - selector: - description: "The selector is an expression used to pick pick out - the endpoints that the policy should be applied to. \n Selector - expressions follow this syntax: \n \tlabel == \"string_literal\" - \ -> comparison, e.g. my_label == \"foo bar\" \tlabel != \"string_literal\" - \ -> not equal; also matches if label is not present \tlabel in - { \"a\", \"b\", \"c\", ... } -> true if the value of label X is - one of \"a\", \"b\", \"c\" \tlabel not in { \"a\", \"b\", \"c\", - ... } -> true if the value of label X is not one of \"a\", \"b\", - \"c\" \thas(label_name) -> True if that label is present \t! expr - -> negation of expr \texpr && expr -> Short-circuit and \texpr - || expr -> Short-circuit or \t( expr ) -> parens for grouping \tall() - or the empty selector -> matches all endpoints. \n Label names are - allowed to contain alphanumerics, -, _ and /. String literals are - more permissive but they do not support escape characters. \n Examples - (with made-up labels): \n \ttype == \"webserver\" && deployment - == \"prod\" \ttype in {\"frontend\", \"backend\"} \tdeployment != - \"dev\" \t! has(label_name)" - type: string - serviceAccountSelector: - description: ServiceAccountSelector is an optional field for an expression - used to select a pod based on service accounts. - type: string - types: - description: "Types indicates whether this policy applies to ingress, - or to egress, or to both. When not explicitly specified (and so - the value on creation is empty or nil), Calico defaults Types according - to what Ingress and Egress are present in the policy. The default - is: \n - [ PolicyTypeIngress ], if there are no Egress rules (including - the case where there are also no Ingress rules) \n - [ PolicyTypeEgress - ], if there are Egress rules but no Ingress rules \n - [ PolicyTypeIngress, - PolicyTypeEgress ], if there are both Ingress and Egress rules. - \n When the policy is read back again, Types will always be one - of these values, never empty or nil." - items: - description: PolicyType enumerates the possible values of the PolicySpec - Types field. - type: string - type: array - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/networkset-crd.yaml b/cluster/addons/calico-policy-controller/networkset-crd.yaml deleted file mode 100644 index 0793a040c8..0000000000 --- a/cluster/addons/calico-policy-controller/networkset-crd.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: networksets.crd.projectcalico.org -spec: - group: crd.projectcalico.org - names: - kind: NetworkSet - listKind: NetworkSetList - plural: networksets - singular: networkset - scope: Namespaced - versions: - - name: v1 - schema: - openAPIV3Schema: - description: NetworkSet is the Namespaced-equivalent of the GlobalNetworkSet. - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: NetworkSetSpec contains the specification for a NetworkSet - resource. - properties: - nets: - description: The list of IP networks that belong to this set. - items: - type: string - type: array - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/cluster/addons/calico-policy-controller/typha-deployment.yaml b/cluster/addons/calico-policy-controller/typha-deployment.yaml deleted file mode 100644 index bc31e4b230..0000000000 --- a/cluster/addons/calico-policy-controller/typha-deployment.yaml +++ /dev/null @@ -1,75 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: calico-typha - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile - k8s-app: calico-typha -spec: - revisionHistoryLimit: 2 - selector: - matchLabels: - k8s-app: calico-typha - template: - metadata: - labels: - k8s-app: calico-typha - spec: - priorityClassName: system-cluster-critical - tolerations: - - key: CriticalAddonsOnly - operator: Exists - hostNetwork: true - serviceAccountName: calico - containers: - - image: gcr.io/projectcalico-org/typha:v3.19.1 - name: calico-typha - ports: - - containerPort: 5473 - name: calico-typha - protocol: TCP - env: - - name: TYPHA_LOGFILEPATH - value: "none" - - name: TYPHA_LOGSEVERITYSYS - value: "none" - - name: TYPHA_LOGSEVERITYSCREEN - value: "info" - - name: TYPHA_PROMETHEUSMETRICSENABLED - value: "true" - - name: TYPHA_CONNECTIONREBALANCINGMODE - value: "kubernetes" - - name: TYPHA_PROMETHEUSMETRICSPORT - value: "9093" - - name: TYPHA_DATASTORETYPE - value: "kubernetes" - - name: TYPHA_REPORTINGINTERVALSECS - value: "0" - - name: TYPHA_MAXCONNECTIONSLOWERLIMIT - value: "1" - - name: TYPHA_HEALTHENABLED - value: "true" - - name: USE_POD_CIDR - value: "true" - volumeMounts: - - mountPath: /etc/calico - name: etc-calico - readOnly: true - livenessProbe: - httpGet: - path: /liveness - port: 9098 - host: localhost - periodSeconds: 30 - initialDelaySeconds: 30 - readinessProbe: - httpGet: - path: /readiness - port: 9098 - host: localhost - periodSeconds: 10 - volumes: - - name: etc-calico - hostPath: - path: /etc/calico diff --git a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrole.yaml b/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrole.yaml deleted file mode 100644 index 216053187c..0000000000 --- a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrole.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: typha-cpha - labels: - addonmanager.kubernetes.io/mode: Reconcile -rules: - - apiGroups: [""] - resources: ["nodes"] - verbs: ["list", "watch"] diff --git a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrolebinding.yaml b/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrolebinding.yaml deleted file mode 100644 index 62832c7b1c..0000000000 --- a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-clusterrolebinding.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: typha-cpha - labels: - addonmanager.kubernetes.io/mode: Reconcile -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: typha-cpha -subjects: - - kind: ServiceAccount - name: typha-cpha - namespace: kube-system diff --git a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-configmap.yaml b/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-configmap.yaml deleted file mode 100644 index b81724045f..0000000000 --- a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: calico-typha-horizontal-autoscaler - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile -data: - ladder: |- - { - "coresToReplicas": [], - "nodesToReplicas": - [ - [1, 1], - [10, 2], - [100, 3], - [250, 4], - [500, 5], - [1000, 6], - [1500, 7], - [2000, 8] - ] - } diff --git a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-deployment.yaml b/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-deployment.yaml deleted file mode 100644 index 9def228ef1..0000000000 --- a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-deployment.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: calico-typha-horizontal-autoscaler - namespace: kube-system - labels: - k8s-app: calico-typha-autoscaler - addonmanager.kubernetes.io/mode: Reconcile -spec: - replicas: 1 - selector: - matchLabels: - k8s-app: calico-typha-autoscaler - template: - metadata: - labels: - k8s-app: calico-typha-autoscaler - spec: - priorityClassName: system-cluster-critical - securityContext: - supplementalGroups: [ 65534 ] - fsGroup: 65534 - containers: - - image: registry.k8s.io/cluster-proportional-autoscaler-amd64:1.7.1 - name: autoscaler - command: - - /cluster-proportional-autoscaler - - --namespace=kube-system - - --configmap=calico-typha-horizontal-autoscaler - - --target=deployment/calico-typha - - --logtostderr=true - - --v=2 - resources: - requests: - cpu: 10m - limits: - cpu: 10m - serviceAccountName: typha-cpha diff --git a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-role.yaml b/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-role.yaml deleted file mode 100644 index 385f517940..0000000000 --- a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-role.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: typha-cpha - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile -rules: - - apiGroups: [""] - resources: ["configmaps"] - verbs: ["get"] - - apiGroups: ["apps"] - resources: ["deployments/scale"] - verbs: ["get", "update"] diff --git a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-rolebinding.yaml b/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-rolebinding.yaml deleted file mode 100644 index 7b90f57a3e..0000000000 --- a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-rolebinding.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: typha-cpha - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: typha-cpha -subjects: - - kind: ServiceAccount - name: typha-cpha - namespace: kube-system diff --git a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-serviceaccount.yaml b/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-serviceaccount.yaml deleted file mode 100644 index b44d28844d..0000000000 --- a/cluster/addons/calico-policy-controller/typha-horizontal-autoscaler-serviceaccount.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: typha-cpha - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile diff --git a/cluster/addons/calico-policy-controller/typha-service.yaml b/cluster/addons/calico-policy-controller/typha-service.yaml deleted file mode 100644 index c9c2b382af..0000000000 --- a/cluster/addons/calico-policy-controller/typha-service.yaml +++ /dev/null @@ -1,17 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: calico-typha - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - k8s-app: calico-typha -spec: - ports: - - port: 5473 - protocol: TCP - targetPort: calico-typha - name: calico-typha - selector: - k8s-app: calico-typha diff --git a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrole.yaml b/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrole.yaml deleted file mode 100644 index 35af7416ac..0000000000 --- a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrole.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: typha-cpva - labels: - addonmanager.kubernetes.io/mode: Reconcile -rules: - - apiGroups: [""] - resources: ["nodes"] - verbs: ["list"] - - apiGroups: ["apps"] - resources: ["deployments"] - verbs: ["patch"] diff --git a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrolebinding.yaml b/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrolebinding.yaml deleted file mode 100644 index 8b57abd275..0000000000 --- a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-clusterrolebinding.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: typha-cpva - labels: - addonmanager.kubernetes.io/mode: Reconcile -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: typha-cpva -subjects: - - kind: ServiceAccount - name: typha-cpva - namespace: kube-system diff --git a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-configmap.yaml b/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-configmap.yaml deleted file mode 100644 index 119b3976e5..0000000000 --- a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-configmap.yaml +++ /dev/null @@ -1,21 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: - name: calico-typha-vertical-autoscaler - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile -data: - typha-autoscaler: |- - { - "calico-typha": { - "requests": { - "cpu": { - "base": "120m", - "step": "80m", - "nodesPerStep": 10, - "max": "1000m" - } - } - } - } diff --git a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-deployment.yaml b/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-deployment.yaml deleted file mode 100644 index bb636e58de..0000000000 --- a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-deployment.yaml +++ /dev/null @@ -1,38 +0,0 @@ -kind: Deployment -apiVersion: apps/v1 -metadata: - name: calico-typha-vertical-autoscaler - namespace: kube-system - labels: - k8s-app: calico-typha-autoscaler - addonmanager.kubernetes.io/mode: Reconcile -spec: - replicas: 1 - selector: - matchLabels: - k8s-app: calico-typha-autoscaler - template: - metadata: - labels: - k8s-app: calico-typha-autoscaler - spec: - priorityClassName: system-cluster-critical - containers: - - image: registry.k8s.io/cpvpa-amd64:v0.8.3 - name: autoscaler - command: - - /cpvpa - - --target=deployment/calico-typha - - --namespace=kube-system - - --logtostderr=true - - --poll-period-seconds=30 - - --v=2 - - --config-file=/etc/config/typha-autoscaler - volumeMounts: - - name: config - mountPath: /etc/config - volumes: - - name: config - configMap: - name: calico-typha-vertical-autoscaler - serviceAccountName: calico-cpva diff --git a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-serviceaccount.yaml b/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-serviceaccount.yaml deleted file mode 100644 index a07c8283b7..0000000000 --- a/cluster/addons/calico-policy-controller/typha-vertical-autoscaler-serviceaccount.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: typha-cpva - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile diff --git a/cluster/addons/cloud-controller-manager/cloud-node-controller-binding.yaml b/cluster/addons/cloud-controller-manager/cloud-node-controller-binding.yaml deleted file mode 100644 index 4be96052de..0000000000 --- a/cluster/addons/cloud-controller-manager/cloud-node-controller-binding.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: system::leader-locking-cloud-controller-manager - namespace: kube-system -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: system::leader-locking-cloud-controller-manager -subjects: -- kind: ServiceAccount - name: cloud-controller-manager - namespace: kube-system ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: system:cloud-controller-manager -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:cloud-controller-manager -subjects: -- kind: User - apiGroup: rbac.authorization.k8s.io - name: system:cloud-controller-manager ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: system:controller:cloud-node-controller -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:controller:cloud-node-controller -subjects: -- kind: ServiceAccount - name: cloud-node-controller - namespace: kube-system - diff --git a/cluster/addons/cloud-controller-manager/cloud-node-controller-role.yaml b/cluster/addons/cloud-controller-manager/cloud-node-controller-role.yaml deleted file mode 100644 index 8f4644cb30..0000000000 --- a/cluster/addons/cloud-controller-manager/cloud-node-controller-role.yaml +++ /dev/null @@ -1,177 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: system:cloud-controller-manager -rules: -- apiGroups: - - "" - - events.k8s.io - resources: - - events - verbs: - - create - - patch - - update -- apiGroups: - - coordination.k8s.io - resources: - - leases - verbs: - - create -- apiGroups: - - coordination.k8s.io - resourceNames: - - cloud-controller-manager - resources: - - leases - verbs: - - get - - update -- apiGroups: - - "" - resources: - - endpoints - - serviceaccounts - verbs: - - create - - get - - update -- apiGroups: - - "" - resources: - - nodes - verbs: - - get - - patch - - update -- apiGroups: - - "" - resources: - - namespaces - verbs: - - get -- apiGroups: - - "" - resources: - - nodes/status - verbs: - - patch - - update -- apiGroups: - - "" - resources: - - secrets - verbs: - - create - - delete - - get - - update -- apiGroups: - - "authentication.k8s.io" - resources: - - tokenreviews - verbs: - - create -- apiGroups: - - "*" - resources: - - "*" - verbs: - - list - - watch -- apiGroups: - - "" - resources: - - serviceaccounts/token - verbs: - - create -- apiGroups: - - authentication.k8s.io - resources: - - subjectaccessreviews - verbs: - - create -- apiGroups: - - "" - resources: - - namespaces - - configmaps - verbs: - - get ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: system::leader-locking-cloud-controller-manager - namespace: kube-system -rules: -- apiGroups: - - "" - resources: - - configmaps - verbs: - - watch -- apiGroups: - - "" - resources: - - configmaps - resourceNames: - - cloud-controller-manager - verbs: - - get - - update ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: system:controller:cloud-node-controller -rules: -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - - update -- apiGroups: - - "" - resources: - - nodes - verbs: - - get - - list - - update - - delete - - patch -- apiGroups: - - "" - resources: - - nodes/status - verbs: - - get - - list - - update - - delete - - patch - -- apiGroups: - - "" - resources: - - pods - verbs: - - list - - delete -- apiGroups: - - "" - resources: - - pods/status - verbs: - - list - - delete diff --git a/cluster/addons/cloud-controller-manager/pvl-controller-role.yaml b/cluster/addons/cloud-controller-manager/pvl-controller-role.yaml deleted file mode 100644 index fb3306655c..0000000000 --- a/cluster/addons/cloud-controller-manager/pvl-controller-role.yaml +++ /dev/null @@ -1,23 +0,0 @@ -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - addonmanager.kubernetes.io/mode: Reconcile - name: system:controller:pvl-controller -rules: -- apiGroups: - - "" - resources: - - events - verbs: - - create - - patch - - update -- apiGroups: - - "" - resources: - - persistentvolumeclaims - - persistentvolumes - verbs: - - list - - watch diff --git a/cluster/addons/cluster-loadbalancing/glbc/README.md b/cluster/addons/cluster-loadbalancing/glbc/README.md deleted file mode 100644 index d1a1d93f03..0000000000 --- a/cluster/addons/cluster-loadbalancing/glbc/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# GCE Load-Balancer Controller (GLBC) Cluster Addon - -This cluster addon is composed of a 404 default backend service and deployment. -On GCE, this 404 service is used in conjunction with the -[Ingress-GCE](https://github.com/kubernetes/ingress-gce) controller. - -See the Ingress-GCE docs for more information. - - diff --git a/cluster/addons/cluster-loadbalancing/glbc/default-svc-controller.yaml b/cluster/addons/cluster-loadbalancing/glbc/default-svc-controller.yaml deleted file mode 100644 index 01d77e6577..0000000000 --- a/cluster/addons/cluster-loadbalancing/glbc/default-svc-controller.yaml +++ /dev/null @@ -1,45 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: l7-default-backend - namespace: kube-system - labels: - k8s-app: glbc - kubernetes.io/name: "GLBC" - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile -spec: - selector: - matchLabels: - k8s-app: glbc - template: - metadata: - labels: - k8s-app: glbc - name: glbc - spec: - securityContext: - seccompProfile: - type: RuntimeDefault - containers: - - name: default-http-backend - # Any image is permissible as long as: - # 1. It serves a 404 page at / - # 2. It serves 200 on a /healthz endpoint - image: registry.k8s.io/networking/ingress-gce-404-server-with-metrics-amd64:v1.10.11 - livenessProbe: - httpGet: - path: /healthz - port: 8080 - scheme: HTTP - initialDelaySeconds: 30 - timeoutSeconds: 5 - ports: - - containerPort: 8080 - resources: - limits: - cpu: 10m - memory: 20Mi - requests: - cpu: 10m - memory: 20Mi diff --git a/cluster/addons/cluster-loadbalancing/glbc/default-svc.yaml b/cluster/addons/cluster-loadbalancing/glbc/default-svc.yaml deleted file mode 100644 index 84b8881dfa..0000000000 --- a/cluster/addons/cluster-loadbalancing/glbc/default-svc.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - # This must match the --default-backend-service argument of the l7 lb - # controller and is required because GCE mandates a default backend. - name: default-http-backend - namespace: kube-system - labels: - k8s-app: glbc - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "GLBCDefaultBackend" -spec: - # The default backend must be of type NodePort. - type: NodePort - ports: - - port: 80 - targetPort: 8080 - protocol: TCP - name: http - selector: - k8s-app: glbc diff --git a/cluster/addons/dns-horizontal-autoscaler/MAINTAINERS.md b/cluster/addons/dns-horizontal-autoscaler/MAINTAINERS.md deleted file mode 100644 index 740f029729..0000000000 --- a/cluster/addons/dns-horizontal-autoscaler/MAINTAINERS.md +++ /dev/null @@ -1,3 +0,0 @@ -# Maintainers - -Zihong Zheng diff --git a/cluster/addons/dns-horizontal-autoscaler/README.md b/cluster/addons/dns-horizontal-autoscaler/README.md deleted file mode 100644 index 3acc2d5e64..0000000000 --- a/cluster/addons/dns-horizontal-autoscaler/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# DNS Horizontal Autoscaler - -DNS Horizontal Autoscaler enables horizontal autoscaling feature for DNS service -in Kubernetes clusters. This autoscaler runs as a Deployment. It collects cluster -status from the APIServer, horizontally scales the number of DNS backends based -on demand. Autoscaling parameters could be tuned by modifying the `kube-dns-autoscaler` -ConfigMap in `kube-system` namespace. - -Learn more about: -- Usage: http://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/ -- Implementation: https://github.com/kubernetes-incubator/cluster-proportional-autoscaler/ diff --git a/cluster/addons/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml b/cluster/addons/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml deleted file mode 100644 index 1f4df041cd..0000000000 --- a/cluster/addons/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2016 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. - -kind: ServiceAccount -apiVersion: v1 -metadata: - name: kube-dns-autoscaler - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile ---- -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: system:kube-dns-autoscaler - labels: - addonmanager.kubernetes.io/mode: Reconcile -rules: - - apiGroups: [""] - resources: ["nodes"] - verbs: ["list", "watch"] - - apiGroups: [""] - resources: ["replicationcontrollers/scale"] - verbs: ["get", "update"] - - apiGroups: ["apps"] - resources: ["deployments/scale", "replicasets/scale"] - verbs: ["get", "update"] -# Remove the configmaps rule once below issue is fixed: -# kubernetes-incubator/cluster-proportional-autoscaler#16 - - apiGroups: [""] - resources: ["configmaps"] - verbs: ["get", "create"] ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: system:kube-dns-autoscaler - labels: - addonmanager.kubernetes.io/mode: Reconcile -subjects: - - kind: ServiceAccount - name: kube-dns-autoscaler - namespace: kube-system -roleRef: - kind: ClusterRole - name: system:kube-dns-autoscaler - apiGroup: rbac.authorization.k8s.io - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kube-dns-autoscaler - namespace: kube-system - labels: - k8s-app: kube-dns-autoscaler - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile -spec: - selector: - matchLabels: - k8s-app: kube-dns-autoscaler - template: - metadata: - labels: - k8s-app: kube-dns-autoscaler - spec: - priorityClassName: system-cluster-critical - securityContext: - seccompProfile: - type: RuntimeDefault - supplementalGroups: [ 65534 ] - fsGroup: 65534 - nodeSelector: - kubernetes.io/os: linux - containers: - - name: autoscaler - image: registry.k8s.io/cpa/cluster-proportional-autoscaler:1.8.4 - resources: - requests: - cpu: "20m" - memory: "10Mi" - command: - - /cluster-proportional-autoscaler - - --namespace=kube-system - - --configmap=kube-dns-autoscaler - # Should keep target in sync with cluster/addons/dns/kube-dns.yaml.base - - --target={{.Target}} - # When cluster is using large nodes(with more cores), "coresPerReplica" should dominate. - # If using small nodes, "nodesPerReplica" should dominate. - - --default-params={"linear":{"coresPerReplica":256,"nodesPerReplica":16,"preventSinglePointFailure":true,"includeUnschedulableNodes":true}} - - --logtostderr=true - - --v=2 - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - serviceAccountName: kube-dns-autoscaler diff --git a/cluster/addons/dns/coredns/Makefile b/cluster/addons/dns/coredns/Makefile deleted file mode 100644 index d3455dd853..0000000000 --- a/cluster/addons/dns/coredns/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2016 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. - -# Makefile for the kubedns underscore templates to Salt/Pillar and other formats. - -# If you update the *.base templates, please run this Makefile before pushing. -# -# Usage: -# make - -all: transform - -# .base -> .in pattern rule -%.in: %.base - sed -f transforms2salt.sed $< | sed s/__SOURCE_FILENAME__/$ $@ - -# .base -> .sed pattern rule -%.sed: %.base - sed -f transforms2sed.sed $< | sed s/__SOURCE_FILENAME__/$ $@ - -transform: coredns.yaml.in coredns.yaml.sed - -.PHONY: transform diff --git a/cluster/addons/dns/coredns/coredns.yaml.base b/cluster/addons/dns/coredns/coredns.yaml.base deleted file mode 100644 index 9cce5c3453..0000000000 --- a/cluster/addons/dns/coredns/coredns.yaml.base +++ /dev/null @@ -1,216 +0,0 @@ -# __MACHINE_GENERATED_WARNING__ - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: coredns - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: Reconcile - name: system:coredns -rules: -- apiGroups: - - "" - resources: - - endpoints - - services - - pods - - namespaces - verbs: - - list - - watch -- apiGroups: - - discovery.k8s.io - resources: - - endpointslices - verbs: - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - annotations: - rbac.authorization.kubernetes.io/autoupdate: "true" - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: EnsureExists - name: system:coredns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:coredns -subjects: -- kind: ServiceAccount - name: coredns - namespace: kube-system ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: coredns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists -data: - Corefile: | - .:53 { - errors - health { - lameduck 5s - } - ready - kubernetes __DNS__DOMAIN__ in-addr.arpa ip6.arpa { - pods insecure - fallthrough in-addr.arpa ip6.arpa - ttl 30 - } - prometheus :9153 - forward . /etc/resolv.conf { - max_concurrent 1000 - } - cache 30 - loop - reload - loadbalance - } ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: coredns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "CoreDNS" -spec: - # replicas: not specified here: - # 1. In order to make Addon Manager do not reconcile this replicas parameter. - # 2. Default is 1. - # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 1 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - spec: - securityContext: - seccompProfile: - type: RuntimeDefault - priorityClassName: system-cluster-critical - serviceAccountName: coredns - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: k8s-app - operator: In - values: ["kube-dns"] - topologyKey: kubernetes.io/hostname - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - nodeSelector: - kubernetes.io/os: linux - containers: - - name: coredns - image: registry.k8s.io/coredns/coredns:v1.13.1 - imagePullPolicy: IfNotPresent - resources: - limits: - memory: __DNS__MEMORY__LIMIT__ - requests: - cpu: 100m - memory: 70Mi - args: [ "-conf", "/etc/coredns/Corefile" ] - volumeMounts: - - name: config-volume - mountPath: /etc/coredns - readOnly: true - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - - containerPort: 9153 - name: metrics - protocol: TCP - livenessProbe: - httpGet: - path: /health - port: 8080 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /ready - port: 8181 - scheme: HTTP - securityContext: - allowPrivilegeEscalation: false - capabilities: - add: - - NET_BIND_SERVICE - drop: - - ALL - readOnlyRootFilesystem: true - dnsPolicy: Default - volumes: - - name: config-volume - configMap: - name: coredns - items: - - key: Corefile - path: Corefile ---- -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - annotations: - prometheus.io/port: "9153" - prometheus.io/scrape: "true" - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "CoreDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: __DNS__SERVER__ - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP - - name: metrics - port: 9153 - protocol: TCP diff --git a/cluster/addons/dns/coredns/coredns.yaml.in b/cluster/addons/dns/coredns/coredns.yaml.in deleted file mode 100644 index ee07de6c32..0000000000 --- a/cluster/addons/dns/coredns/coredns.yaml.in +++ /dev/null @@ -1,216 +0,0 @@ -# Warning: This is a file generated from the base underscore template file: coredns.yaml.base - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: coredns - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: Reconcile - name: system:coredns -rules: -- apiGroups: - - "" - resources: - - endpoints - - services - - pods - - namespaces - verbs: - - list - - watch -- apiGroups: - - discovery.k8s.io - resources: - - endpointslices - verbs: - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - annotations: - rbac.authorization.kubernetes.io/autoupdate: "true" - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: EnsureExists - name: system:coredns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:coredns -subjects: -- kind: ServiceAccount - name: coredns - namespace: kube-system ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: coredns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists -data: - Corefile: | - .:53 { - errors - health { - lameduck 5s - } - ready - kubernetes dns_domain in-addr.arpa ip6.arpa { - pods insecure - fallthrough in-addr.arpa ip6.arpa - ttl 30 - } - prometheus :9153 - forward . /etc/resolv.conf { - max_concurrent 1000 - } - cache 30 - loop - reload - loadbalance - } ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: coredns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "CoreDNS" -spec: - # replicas: not specified here: - # 1. In order to make Addon Manager do not reconcile this replicas parameter. - # 2. Default is 1. - # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 1 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - spec: - securityContext: - seccompProfile: - type: RuntimeDefault - priorityClassName: system-cluster-critical - serviceAccountName: coredns - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: k8s-app - operator: In - values: ["kube-dns"] - topologyKey: kubernetes.io/hostname - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - nodeSelector: - kubernetes.io/os: linux - containers: - - name: coredns - image: registry.k8s.io/coredns/coredns:v1.13.1 - imagePullPolicy: IfNotPresent - resources: - limits: - memory: 'dns_memory_limit' - requests: - cpu: 100m - memory: 70Mi - args: [ "-conf", "/etc/coredns/Corefile" ] - volumeMounts: - - name: config-volume - mountPath: /etc/coredns - readOnly: true - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - - containerPort: 9153 - name: metrics - protocol: TCP - livenessProbe: - httpGet: - path: /health - port: 8080 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /ready - port: 8181 - scheme: HTTP - securityContext: - allowPrivilegeEscalation: false - capabilities: - add: - - NET_BIND_SERVICE - drop: - - ALL - readOnlyRootFilesystem: true - dnsPolicy: Default - volumes: - - name: config-volume - configMap: - name: coredns - items: - - key: Corefile - path: Corefile ---- -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - annotations: - prometheus.io/port: "9153" - prometheus.io/scrape: "true" - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "CoreDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: 'dns_server' - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP - - name: metrics - port: 9153 - protocol: TCP diff --git a/cluster/addons/dns/coredns/coredns.yaml.sed b/cluster/addons/dns/coredns/coredns.yaml.sed deleted file mode 100644 index 5df370800c..0000000000 --- a/cluster/addons/dns/coredns/coredns.yaml.sed +++ /dev/null @@ -1,216 +0,0 @@ -# Warning: This is a file generated from the base underscore template file: coredns.yaml.base - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: coredns - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: Reconcile - name: system:coredns -rules: -- apiGroups: - - "" - resources: - - endpoints - - services - - pods - - namespaces - verbs: - - list - - watch -- apiGroups: - - discovery.k8s.io - resources: - - endpointslices - verbs: - - list - - watch ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - annotations: - rbac.authorization.kubernetes.io/autoupdate: "true" - labels: - kubernetes.io/bootstrapping: rbac-defaults - addonmanager.kubernetes.io/mode: EnsureExists - name: system:coredns -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: system:coredns -subjects: -- kind: ServiceAccount - name: coredns - namespace: kube-system ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: coredns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists -data: - Corefile: | - .:53 { - errors - health { - lameduck 5s - } - ready - kubernetes $DNS_DOMAIN in-addr.arpa ip6.arpa { - pods insecure - fallthrough in-addr.arpa ip6.arpa - ttl 30 - } - prometheus :9153 - forward . /etc/resolv.conf { - max_concurrent 1000 - } - cache 30 - loop - reload - loadbalance - } ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: coredns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "CoreDNS" -spec: - # replicas: not specified here: - # 1. In order to make Addon Manager do not reconcile this replicas parameter. - # 2. Default is 1. - # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. - strategy: - type: RollingUpdate - rollingUpdate: - maxUnavailable: 1 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - spec: - securityContext: - seccompProfile: - type: RuntimeDefault - priorityClassName: system-cluster-critical - serviceAccountName: coredns - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: k8s-app - operator: In - values: ["kube-dns"] - topologyKey: kubernetes.io/hostname - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - nodeSelector: - kubernetes.io/os: linux - containers: - - name: coredns - image: registry.k8s.io/coredns/coredns:v1.13.1 - imagePullPolicy: IfNotPresent - resources: - limits: - memory: $DNS_MEMORY_LIMIT - requests: - cpu: 100m - memory: 70Mi - args: [ "-conf", "/etc/coredns/Corefile" ] - volumeMounts: - - name: config-volume - mountPath: /etc/coredns - readOnly: true - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - - containerPort: 9153 - name: metrics - protocol: TCP - livenessProbe: - httpGet: - path: /health - port: 8080 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /ready - port: 8181 - scheme: HTTP - securityContext: - allowPrivilegeEscalation: false - capabilities: - add: - - NET_BIND_SERVICE - drop: - - ALL - readOnlyRootFilesystem: true - dnsPolicy: Default - volumes: - - name: config-volume - configMap: - name: coredns - items: - - key: Corefile - path: Corefile ---- -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - annotations: - prometheus.io/port: "9153" - prometheus.io/scrape: "true" - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "CoreDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: $DNS_SERVER_IP - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP - - name: metrics - port: 9153 - protocol: TCP diff --git a/cluster/addons/dns/coredns/transforms2salt.sed b/cluster/addons/dns/coredns/transforms2salt.sed deleted file mode 100644 index 6183aee5fe..0000000000 --- a/cluster/addons/dns/coredns/transforms2salt.sed +++ /dev/null @@ -1,5 +0,0 @@ -s/__DNS__SERVER__/{{ pillar['dns_server'] }}/g -s/__DNS__DOMAIN__/{{ pillar['dns_domain'] }}/g -s/__CLUSTER_CIDR__/{{ pillar['service_cluster_ip_range'] }}/g -s/__DNS__MEMORY__LIMIT__/{{ pillar['dns_memory_limit'] }}/g -s/__MACHINE_GENERATED_WARNING__/Warning: This is a file generated from the base underscore template file: __SOURCE_FILENAME__/g diff --git a/cluster/addons/dns/coredns/transforms2sed.sed b/cluster/addons/dns/coredns/transforms2sed.sed deleted file mode 100644 index f8285b401e..0000000000 --- a/cluster/addons/dns/coredns/transforms2sed.sed +++ /dev/null @@ -1,5 +0,0 @@ -s/__DNS__SERVER__/$DNS_SERVER_IP/g -s/__DNS__DOMAIN__/$DNS_DOMAIN/g -s/__CLUSTER_CIDR__/$SERVICE_CLUSTER_IP_RANGE/g -s/__DNS__MEMORY__LIMIT__/$DNS_MEMORY_LIMIT/g -s/__MACHINE_GENERATED_WARNING__/Warning: This is a file generated from the base underscore template file: __SOURCE_FILENAME__/g diff --git a/cluster/addons/dns/kube-dns/Makefile b/cluster/addons/dns/kube-dns/Makefile deleted file mode 100644 index 50419ff324..0000000000 --- a/cluster/addons/dns/kube-dns/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2016 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. - -# Makefile for the kubedns underscore templates to Salt/Pillar and other formats. - -# If you update the *.base templates, please run this Makefile before pushing. -# -# Usage: -# make - -all: transform - -# .base -> .in pattern rule -%.in: %.base - sed -f transforms2salt.sed $< | sed s/__SOURCE_FILENAME__/$ $@ - -# .base -> .sed pattern rule -%.sed: %.base - sed -f transforms2sed.sed $< | sed s/__SOURCE_FILENAME__/$ $@ - -transform: kube-dns.yaml.in kube-dns.yaml.sed - -.PHONY: transform diff --git a/cluster/addons/dns/kube-dns/README.md b/cluster/addons/dns/kube-dns/README.md deleted file mode 100644 index 38883f0c60..0000000000 --- a/cluster/addons/dns/kube-dns/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# kube-dns - -`kube-dns` schedules DNS Pods and Service on the cluster, other pods in cluster -can use the DNS Service’s IP to resolve DNS names. - -* [Administrators guide](http://kubernetes.io/docs/admin/dns/) -* [Code repository](http://www.github.com/kubernetes/dns) - -## Manually scale kube-dns Deployment - -kube-dns creates only one DNS Pod by default. If -[dns-horizontal-autoscaler](../../dns-horizontal-autoscaler/) -is not enabled, you may need to manually scale kube-dns Deployment. - -Please use below `kubectl scale` command to scale: -``` -kubectl --namespace=kube-system scale deployment kube-dns --replicas= -``` - -Do not use `kubectl edit` to modify kube-dns Deployment object if it is -controlled by [Addon Manager](../../addon-manager/). Otherwise the modifications -will be clobbered, in addition the replicas count for kube-dns Deployment will -be reset to 1. See [Cluster add-ons README](../../README.md) and -[#36411](https://github.com/kubernetes/kubernetes/issues/36411) for reference. - -## kube-dns addon templates - -This directory contains the base UNDERSCORE templates that can be used to -generate the kube-dns.yaml.in needed in Salt format. - -Due to a varied preference in templating language choices, the transform -Makefile in this directory should be enhanced to generate all required formats -from the base underscore templates. - -**N.B.**: When you add a parameter you should also update the various scripts -that supply values for your new parameter. Here is one way you might find those -scripts: - -``` -cd kubernetes && git grep 'kube-dns.yaml' -``` - -### Base Template files - -These are the authoritative base templates. -Run 'make' to generate the Salt and Sed yaml templates from these. - -``` -kube-dns.yaml.base -``` - -### Generated Salt files - -``` -kube-dns.yaml.in -``` - -### Generated Sed files - -``` -kube-dns.yaml.sed -``` \ No newline at end of file diff --git a/cluster/addons/dns/kube-dns/kube-dns.yaml.base b/cluster/addons/dns/kube-dns/kube-dns.yaml.base deleted file mode 100644 index 2b97de8a6c..0000000000 --- a/cluster/addons/dns/kube-dns/kube-dns.yaml.base +++ /dev/null @@ -1,247 +0,0 @@ -# Copyright 2016 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. - -# Should keep target in cluster/addons/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml -# in sync with this file. - -# __MACHINE_GENERATED_WARNING__ - -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "KubeDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: __DNS__SERVER__ - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: kube-dns - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: kube-dns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile -spec: - # replicas: not specified here: - # 1. In order to make Addon Manager do not reconcile this replicas parameter. - # 2. Default is 1. - # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. - strategy: - rollingUpdate: - maxSurge: 10% - maxUnavailable: 0 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - annotations: - prometheus.io/port: "10054" - prometheus.io/scrape: "true" - spec: - priorityClassName: system-cluster-critical - securityContext: - seccompProfile: - type: RuntimeDefault - supplementalGroups: [ 65534 ] - fsGroup: 65534 - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: k8s-app - operator: In - values: ["kube-dns"] - topologyKey: kubernetes.io/hostname - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - volumes: - - name: kube-dns-config - configMap: - name: kube-dns - optional: true - nodeSelector: - kubernetes.io/os: linux - containers: - - name: kubedns - image: registry.k8s.io/dns/k8s-dns-kube-dns:1.26.4 - resources: - # TODO: Set memory limits when we've profiled the container for large - # clusters, then set request = limit to keep this container in - # guaranteed class. Currently, this container falls into the - # "burstable" category so the kubelet doesn't backoff from restarting it. - limits: - memory: __DNS__MEMORY__LIMIT__ - requests: - cpu: 100m - memory: 70Mi - livenessProbe: - httpGet: - path: /healthcheck/kubedns - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /readiness - port: 8081 - scheme: HTTP - # we poll on pod startup for the Kubernetes master service and - # only setup the /readiness HTTP server once that's available. - initialDelaySeconds: 3 - timeoutSeconds: 5 - args: - - --domain=__DNS__DOMAIN__. - - --dns-port=10053 - - --config-dir=/kube-dns-config - - --v=2 - env: - - name: PROMETHEUS_PORT - value: "10055" - ports: - - containerPort: 10053 - name: dns-local - protocol: UDP - - containerPort: 10053 - name: dns-tcp-local - protocol: TCP - - containerPort: 10055 - name: metrics - protocol: TCP - volumeMounts: - - name: kube-dns-config - mountPath: /kube-dns-config - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsUser: 1001 - runAsGroup: 1001 - - name: dnsmasq - image: registry.k8s.io/dns/k8s-dns-dnsmasq-nanny:1.26.4 - livenessProbe: - httpGet: - path: /healthcheck/dnsmasq - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - -v=2 - - -configDir=/etc/k8s/dns/dnsmasq-nanny - - -restartDnsmasq=true - - -- - - -k - - --cache-size=1000 - - --no-negcache - - --dns-loop-detect - - --log-facility=- - - --server=/__DNS__DOMAIN__/127.0.0.1#10053 - - --server=/in-addr.arpa/127.0.0.1#10053 - - --server=/ip6.arpa/127.0.0.1#10053 - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - # see: https://github.com/kubernetes/kubernetes/issues/29055 for details - resources: - requests: - cpu: 150m - memory: 20Mi - volumeMounts: - - name: kube-dns-config - mountPath: /etc/k8s/dns/dnsmasq-nanny - securityContext: - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - - SETGID - - name: sidecar - image: registry.k8s.io/dns/k8s-dns-sidecar:1.26.4 - livenessProbe: - httpGet: - path: /metrics - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - --v=2 - - --probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.__DNS__DOMAIN__,5,SRV - - --probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.__DNS__DOMAIN__,5,SRV - ports: - - containerPort: 10054 - name: metrics - protocol: TCP - resources: - requests: - memory: 20Mi - cpu: 10m - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsUser: 1001 - runAsGroup: 1001 - dnsPolicy: Default # Don't use cluster DNS. - serviceAccountName: kube-dns diff --git a/cluster/addons/dns/kube-dns/kube-dns.yaml.in b/cluster/addons/dns/kube-dns/kube-dns.yaml.in deleted file mode 100644 index bf80cb7668..0000000000 --- a/cluster/addons/dns/kube-dns/kube-dns.yaml.in +++ /dev/null @@ -1,247 +0,0 @@ -# Copyright 2016 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. - -# Should keep target in cluster/addons/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml -# in sync with this file. - -# Warning: This is a file generated from the base underscore template file: kube-dns.yaml.base - -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "KubeDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: dns_server - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: kube-dns - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: kube-dns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile -spec: - # replicas: not specified here: - # 1. In order to make Addon Manager do not reconcile this replicas parameter. - # 2. Default is 1. - # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. - strategy: - rollingUpdate: - maxSurge: 10% - maxUnavailable: 0 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - annotations: - prometheus.io/port: "10054" - prometheus.io/scrape: "true" - spec: - priorityClassName: system-cluster-critical - securityContext: - seccompProfile: - type: RuntimeDefault - supplementalGroups: [ 65534 ] - fsGroup: 65534 - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: k8s-app - operator: In - values: ["kube-dns"] - topologyKey: kubernetes.io/hostname - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - volumes: - - name: kube-dns-config - configMap: - name: kube-dns - optional: true - nodeSelector: - kubernetes.io/os: linux - containers: - - name: kubedns - image: registry.k8s.io/dns/k8s-dns-kube-dns:1.26.4 - resources: - # TODO: Set memory limits when we've profiled the container for large - # clusters, then set request = limit to keep this container in - # guaranteed class. Currently, this container falls into the - # "burstable" category so the kubelet doesn't backoff from restarting it. - limits: - memory: 'dns_memory_limit' - requests: - cpu: 100m - memory: 70Mi - livenessProbe: - httpGet: - path: /healthcheck/kubedns - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /readiness - port: 8081 - scheme: HTTP - # we poll on pod startup for the Kubernetes master service and - # only setup the /readiness HTTP server once that's available. - initialDelaySeconds: 3 - timeoutSeconds: 5 - args: - - --domain=dns_domain. - - --dns-port=10053 - - --config-dir=/kube-dns-config - - --v=2 - env: - - name: PROMETHEUS_PORT - value: "10055" - ports: - - containerPort: 10053 - name: dns-local - protocol: UDP - - containerPort: 10053 - name: dns-tcp-local - protocol: TCP - - containerPort: 10055 - name: metrics - protocol: TCP - volumeMounts: - - name: kube-dns-config - mountPath: /kube-dns-config - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsUser: 1001 - runAsGroup: 1001 - - name: dnsmasq - image: registry.k8s.io/dns/k8s-dns-dnsmasq-nanny:1.26.4 - livenessProbe: - httpGet: - path: /healthcheck/dnsmasq - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - -v=2 - - -configDir=/etc/k8s/dns/dnsmasq-nanny - - -restartDnsmasq=true - - -- - - -k - - --cache-size=1000 - - --no-negcache - - --dns-loop-detect - - --log-facility=- - - --server=/dns_domain/127.0.0.1#10053 - - --server=/in-addr.arpa/127.0.0.1#10053 - - --server=/ip6.arpa/127.0.0.1#10053 - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - # see: https://github.com/kubernetes/kubernetes/issues/29055 for details - resources: - requests: - cpu: 150m - memory: 20Mi - volumeMounts: - - name: kube-dns-config - mountPath: /etc/k8s/dns/dnsmasq-nanny - securityContext: - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - - SETGID - - name: sidecar - image: registry.k8s.io/dns/k8s-dns-sidecar:1.26.4 - livenessProbe: - httpGet: - path: /metrics - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - --v=2 - - --probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.dns_domain,5,SRV - - --probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.dns_domain,5,SRV - ports: - - containerPort: 10054 - name: metrics - protocol: TCP - resources: - requests: - memory: 20Mi - cpu: 10m - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsUser: 1001 - runAsGroup: 1001 - dnsPolicy: Default # Don't use cluster DNS. - serviceAccountName: kube-dns diff --git a/cluster/addons/dns/kube-dns/kube-dns.yaml.sed b/cluster/addons/dns/kube-dns/kube-dns.yaml.sed deleted file mode 100644 index 71e2f04ed5..0000000000 --- a/cluster/addons/dns/kube-dns/kube-dns.yaml.sed +++ /dev/null @@ -1,247 +0,0 @@ -# Copyright 2016 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. - -# Should keep target in cluster/addons/dns-horizontal-autoscaler/dns-horizontal-autoscaler.yaml -# in sync with this file. - -# Warning: This is a file generated from the base underscore template file: kube-dns.yaml.base - -apiVersion: v1 -kind: Service -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "KubeDNS" -spec: - selector: - k8s-app: kube-dns - clusterIP: $DNS_SERVER_IP - ports: - - name: dns - port: 53 - protocol: UDP - - name: dns-tcp - port: 53 - protocol: TCP ---- -apiVersion: v1 -kind: ServiceAccount -metadata: - name: kube-dns - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: kube-dns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: EnsureExists ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: kube-dns - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile -spec: - # replicas: not specified here: - # 1. In order to make Addon Manager do not reconcile this replicas parameter. - # 2. Default is 1. - # 3. Will be tuned in real time if DNS horizontal auto-scaling is turned on. - strategy: - rollingUpdate: - maxSurge: 10% - maxUnavailable: 0 - selector: - matchLabels: - k8s-app: kube-dns - template: - metadata: - labels: - k8s-app: kube-dns - annotations: - prometheus.io/port: "10054" - prometheus.io/scrape: "true" - spec: - priorityClassName: system-cluster-critical - securityContext: - seccompProfile: - type: RuntimeDefault - supplementalGroups: [ 65534 ] - fsGroup: 65534 - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: k8s-app - operator: In - values: ["kube-dns"] - topologyKey: kubernetes.io/hostname - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - volumes: - - name: kube-dns-config - configMap: - name: kube-dns - optional: true - nodeSelector: - kubernetes.io/os: linux - containers: - - name: kubedns - image: registry.k8s.io/dns/k8s-dns-kube-dns:1.26.4 - resources: - # TODO: Set memory limits when we've profiled the container for large - # clusters, then set request = limit to keep this container in - # guaranteed class. Currently, this container falls into the - # "burstable" category so the kubelet doesn't backoff from restarting it. - limits: - memory: $DNS_MEMORY_LIMIT - requests: - cpu: 100m - memory: 70Mi - livenessProbe: - httpGet: - path: /healthcheck/kubedns - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - readinessProbe: - httpGet: - path: /readiness - port: 8081 - scheme: HTTP - # we poll on pod startup for the Kubernetes master service and - # only setup the /readiness HTTP server once that's available. - initialDelaySeconds: 3 - timeoutSeconds: 5 - args: - - --domain=$DNS_DOMAIN. - - --dns-port=10053 - - --config-dir=/kube-dns-config - - --v=2 - env: - - name: PROMETHEUS_PORT - value: "10055" - ports: - - containerPort: 10053 - name: dns-local - protocol: UDP - - containerPort: 10053 - name: dns-tcp-local - protocol: TCP - - containerPort: 10055 - name: metrics - protocol: TCP - volumeMounts: - - name: kube-dns-config - mountPath: /kube-dns-config - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsUser: 1001 - runAsGroup: 1001 - - name: dnsmasq - image: registry.k8s.io/dns/k8s-dns-dnsmasq-nanny:1.26.4 - livenessProbe: - httpGet: - path: /healthcheck/dnsmasq - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - -v=2 - - -configDir=/etc/k8s/dns/dnsmasq-nanny - - -restartDnsmasq=true - - -- - - -k - - --cache-size=1000 - - --no-negcache - - --dns-loop-detect - - --log-facility=- - - --server=/$DNS_DOMAIN/127.0.0.1#10053 - - --server=/in-addr.arpa/127.0.0.1#10053 - - --server=/ip6.arpa/127.0.0.1#10053 - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - # see: https://github.com/kubernetes/kubernetes/issues/29055 for details - resources: - requests: - cpu: 150m - memory: 20Mi - volumeMounts: - - name: kube-dns-config - mountPath: /etc/k8s/dns/dnsmasq-nanny - securityContext: - capabilities: - drop: - - all - add: - - NET_BIND_SERVICE - - SETGID - - name: sidecar - image: registry.k8s.io/dns/k8s-dns-sidecar:1.26.4 - livenessProbe: - httpGet: - path: /metrics - port: 10054 - scheme: HTTP - initialDelaySeconds: 60 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 5 - args: - - --v=2 - - --probe=kubedns,127.0.0.1:10053,kubernetes.default.svc.$DNS_DOMAIN,5,SRV - - --probe=dnsmasq,127.0.0.1:53,kubernetes.default.svc.$DNS_DOMAIN,5,SRV - ports: - - containerPort: 10054 - name: metrics - protocol: TCP - resources: - requests: - memory: 20Mi - cpu: 10m - securityContext: - allowPrivilegeEscalation: false - readOnlyRootFilesystem: true - runAsUser: 1001 - runAsGroup: 1001 - dnsPolicy: Default # Don't use cluster DNS. - serviceAccountName: kube-dns diff --git a/cluster/addons/dns/kube-dns/transforms2salt.sed b/cluster/addons/dns/kube-dns/transforms2salt.sed deleted file mode 100644 index 6183aee5fe..0000000000 --- a/cluster/addons/dns/kube-dns/transforms2salt.sed +++ /dev/null @@ -1,5 +0,0 @@ -s/__DNS__SERVER__/{{ pillar['dns_server'] }}/g -s/__DNS__DOMAIN__/{{ pillar['dns_domain'] }}/g -s/__CLUSTER_CIDR__/{{ pillar['service_cluster_ip_range'] }}/g -s/__DNS__MEMORY__LIMIT__/{{ pillar['dns_memory_limit'] }}/g -s/__MACHINE_GENERATED_WARNING__/Warning: This is a file generated from the base underscore template file: __SOURCE_FILENAME__/g diff --git a/cluster/addons/dns/kube-dns/transforms2sed.sed b/cluster/addons/dns/kube-dns/transforms2sed.sed deleted file mode 100644 index f8285b401e..0000000000 --- a/cluster/addons/dns/kube-dns/transforms2sed.sed +++ /dev/null @@ -1,5 +0,0 @@ -s/__DNS__SERVER__/$DNS_SERVER_IP/g -s/__DNS__DOMAIN__/$DNS_DOMAIN/g -s/__CLUSTER_CIDR__/$SERVICE_CLUSTER_IP_RANGE/g -s/__DNS__MEMORY__LIMIT__/$DNS_MEMORY_LIMIT/g -s/__MACHINE_GENERATED_WARNING__/Warning: This is a file generated from the base underscore template file: __SOURCE_FILENAME__/g diff --git a/cluster/addons/dns/nodelocaldns/README.md b/cluster/addons/dns/nodelocaldns/README.md deleted file mode 100644 index 4b0be07edb..0000000000 --- a/cluster/addons/dns/nodelocaldns/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Nodelocal DNS Cache - -Using NodeLocal DNSCache in Kubernetes clusters(https://kubernetes.io/docs/tasks/administer-cluster/nodelocaldns/). -This addon runs a node-local-dns pod on all cluster nodes. The pod runs CoreDNS as the dns cache. It runs with `hostNetwork:True` and creates a dedicated dummy interface with a link local ip(169.254.20.10/32 by default) to listen for DNS queries. The cache instances connect to clusterDNS in case of cache misses. - -Design details [here](https://github.com/kubernetes/enhancements/blob/master/keps/sig-network/1024-nodelocal-cache-dns/README.md) - -This feature is graduating to GA in release 1.18(Beta in release 1.15). - -## nodelocaldns addon template - -This directory contains the addon config yaml - `nodelocaldns.yaml` -The variables will be substituted by the configure scripts when the yaml is copied into master. - -We have the following variables in the yaml: -`__PILLAR__DNS__SERVER__` - set to kube-dns service IP. -`__PILLAR__LOCAL__DNS__` - set to the link-local IP(169.254.20.10 by default). -`__PILLAR__DNS__DOMAIN__` - set to the cluster domain(cluster.local by default). - -Note: The local listen IP address for NodeLocal DNSCache can be any address that can be guaranteed to not collide with any existing IP in your cluster. It's recommended to use an address with a local scope, per example, from the link-local range 169.254.0.0/16 for IPv4 or from the Unique Local Address range in IPv6 fd00::/8. - -The following variables will be set by the node-cache images - registry.k8s.io/k8s-dns-node-cache:1.15.6 or later. -The values will be determined by reading the kube-dns configMap for custom -Upstream server configuration. -`__PILLAR__CLUSTER__DNS__` - Upstream server for in-cluster queries. -`__PILLAR__UPSTREAM__SERVERS__` - Upstream servers for external queries. - -### Network policy and DNS connectivity - -When running nodelocaldns addon on clusters using network policy, additional rules might be required to enable dns connectivity. -Using a namespace selector for dns egress traffic as shown [here](https://docs.projectcalico.org/security/tutorials/kubernetes-policy-advanced) -might not be enough since the node-local-dns pods run with `hostNetwork: True` - -One way to enable connectivity from node-local-dns pods to clusterDNS ip is to use an ipBlock rule instead: - -``` -spec: - egress: - - ports: - - port: 53 - protocol: TCP - - port: 53 - protocol: UDP - to: - - ipBlock: - cidr: /32 - podSelector: {} - policyTypes: - - Ingress - - Egress -``` - -### Negative caching - -The `denial` cache TTL has been reduced to the minimum of 5 seconds [here](https://github.com/kubernetes/kubernetes/blob/a38ed2c5ceedf682cbc19442aac5224ae6e10eaa/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml#L61). In the unlikely event that this impacts performance, setting this TTL to a higher value make help alleviate issues, but be aware that operations that rely on DNS polling for orchestration may fail (for example operators with StatefulSets). diff --git a/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml b/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml deleted file mode 100644 index 30a594227d..0000000000 --- a/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml +++ /dev/null @@ -1,211 +0,0 @@ -# Copyright 2018 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. -# - -apiVersion: v1 -kind: ServiceAccount -metadata: - name: node-local-dns - namespace: kube-system - labels: - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile ---- -apiVersion: v1 -kind: Service -metadata: - name: kube-dns-upstream - namespace: kube-system - labels: - k8s-app: kube-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile - kubernetes.io/name: "KubeDNSUpstream" -spec: - ports: - - name: dns - port: 53 - protocol: UDP - targetPort: 53 - - name: dns-tcp - port: 53 - protocol: TCP - targetPort: 53 - selector: - k8s-app: kube-dns ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: node-local-dns - namespace: kube-system - labels: - addonmanager.kubernetes.io/mode: Reconcile -data: - Corefile: | - __PILLAR__DNS__DOMAIN__:53 { - errors - cache { - success 9984 30 - denial 9984 5 - } - reload - loop - bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__ - forward . __PILLAR__CLUSTER__DNS__ { - force_tcp - } - prometheus :9253 - health __PILLAR__LOCAL__DNS__:8080 - } - in-addr.arpa:53 { - errors - cache 30 - reload - loop - bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__ - forward . __PILLAR__CLUSTER__DNS__ { - force_tcp - } - prometheus :9253 - } - ip6.arpa:53 { - errors - cache 30 - reload - loop - bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__ - forward . __PILLAR__CLUSTER__DNS__ { - force_tcp - } - prometheus :9253 - } - .:53 { - errors - cache 30 - reload - loop - bind __PILLAR__LOCAL__DNS__ __PILLAR__DNS__SERVER__ - forward . __PILLAR__UPSTREAM__SERVERS__ - prometheus :9253 - } ---- -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: node-local-dns - namespace: kube-system - labels: - k8s-app: node-local-dns - kubernetes.io/cluster-service: "true" - addonmanager.kubernetes.io/mode: Reconcile -spec: - updateStrategy: - rollingUpdate: - maxUnavailable: 10% - selector: - matchLabels: - k8s-app: node-local-dns - template: - metadata: - labels: - k8s-app: node-local-dns - annotations: - prometheus.io/port: "9253" - prometheus.io/scrape: "true" - spec: - priorityClassName: system-node-critical - serviceAccountName: node-local-dns - hostNetwork: true - dnsPolicy: Default # Don't use cluster DNS. - tolerations: - - key: "CriticalAddonsOnly" - operator: "Exists" - - effect: "NoExecute" - operator: "Exists" - - effect: "NoSchedule" - operator: "Exists" - containers: - - name: node-cache - image: registry.k8s.io/dns/k8s-dns-node-cache:1.26.4 - resources: - requests: - cpu: 25m - memory: 5Mi - args: [ "-localip", "__PILLAR__LOCAL__DNS__,__PILLAR__DNS__SERVER__", "-conf", "/etc/Corefile", "-upstreamsvc", "kube-dns-upstream" ] - securityContext: - capabilities: - add: - - NET_ADMIN - ports: - - containerPort: 53 - name: dns - protocol: UDP - - containerPort: 53 - name: dns-tcp - protocol: TCP - - containerPort: 9253 - name: metrics - protocol: TCP - livenessProbe: - httpGet: - host: __PILLAR__LOCAL__DNS__ - path: /health - port: 8080 - initialDelaySeconds: 60 - timeoutSeconds: 5 - volumeMounts: - - mountPath: /run/xtables.lock - name: xtables-lock - readOnly: false - - name: config-volume - mountPath: /etc/coredns - - name: kube-dns-config - mountPath: /etc/kube-dns - volumes: - - name: xtables-lock - hostPath: - path: /run/xtables.lock - type: FileOrCreate - - name: kube-dns-config - configMap: - name: kube-dns - optional: true - - name: config-volume - configMap: - name: node-local-dns - items: - - key: Corefile - path: Corefile.base ---- -# A headless service is a service with a service IP but instead of load-balancing it will return the IPs of our associated Pods. -# We use this to expose metrics to Prometheus. -apiVersion: v1 -kind: Service -metadata: - annotations: - prometheus.io/port: "9253" - prometheus.io/scrape: "true" - labels: - k8s-app: node-local-dns - name: node-local-dns - namespace: kube-system -spec: - clusterIP: None - ports: - - name: metrics - port: 9253 - targetPort: 9253 - selector: - k8s-app: node-local-dns diff --git a/cluster/addons/fluentd-gcp/README.md b/cluster/addons/fluentd-gcp/README.md deleted file mode 100644 index 8516519e54..0000000000 --- a/cluster/addons/fluentd-gcp/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# Stackdriver Logging Agent -============== - -Stackdriver Logging Agent is a DaemonSet which spawns a pod on each node -that reads logs, generated by kubelet, container runtime and containers -and sends them to the Stackdriver. When logs are exported to the Stackdriver, -they can be searched, viewed, and analyzed. - -Learn more at: https://kubernetes.io/docs/tasks/debug-application-cluster/logging-stackdriver - -## Troubleshooting - -In Kubernetes clusters in version 1.10.0 or later, fluentd-gcp DaemonSet can be -manually scaled. This is useful e.g. when applications running in the cluster -are sending a large volume of logs (i.e. over 100kB/s), causing fluentd-gcp to -fail with OutOfMemory errors. Conversely, if the applications aren't generating -a lot of logs, it may be useful to reduce the amount of resources consumed by -fluentd-gcp, making these resources available to other applications. To learn -more about Kubernetes resource requests and limits, see the official -documentation ([CPU][cpu], [memory][memory]). The amount of resources requested -by fluentd-gcp on every node in the cluster can be fetched by running following -command: - -``` -$ kubectl get ds -n kube-system -l k8s-app=fluentd-gcp \ --o custom-columns=NAME:.metadata.name,\ -CPU_REQUEST:.spec.template.spec.containers[].resources.requests.cpu,\ -MEMORY_REQUEST:.spec.template.spec.containers[].resources.requests.memory,\ -MEMORY_LIMIT:.spec.template.spec.containers[].resources.limits.memory -``` - -This will display an output similar to the following: - -``` -NAME CPU_REQUEST MEMORY_REQUEST MEMORY_LIMIT -fluentd-gcp-v2.0.15 100m 200Mi 300Mi -``` - -In order to change those values, a [ScalingPolicy][scalingPolicy] needs to be -defined. Currently, only base values are supported (no automatic scaling). The -ScalingPolicy can be created using kubectl. E.g. to set cpu request to 101m, -memory request to 150Mi and memory limit to 400Mi: - -``` -$ cat < - # /var/lib/docker/containers/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b/997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b-json.log - # The /var/log directory on the host is mapped to the /var/log directory in the container - # running this instance of Fluentd and we end up collecting the file: - # /var/log/containers/synthetic-logger-0.25lps-pod_default_synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log - # This results in the tag: - # var.log.containers.synthetic-logger-0.25lps-pod_default_synth-lgr-997599971ee6366d4a5920d25b79286ad45ff37a74494f262e3bc98d909d0a7b.log - # where 'synthetic-logger-0.25lps-pod' is the pod name, 'default' is the - # namespace name, 'synth-lgr' is the container name and '997599971ee6..' is - # the container ID. - # The record reformer is used is discard the var.log.containers prefix and - # the Docker container ID suffix and "kubernetes." is pre-pended giving the tag: - # kubernetes.synthetic-logger-0.25lps-pod_default_synth-lgr - # Tag is then parsed by google_cloud plugin and translated to the metadata, - # visible in the log viewer - - # Json Log Example: - # {"log":"[info:2016-02-16T16:04:05.930-08:00] Some log text here\n","stream":"stdout","time":"2016-02-17T00:04:05.931087621Z"} - # CRI Log Example: - # 2016-02-17T00:04:05.931087621Z stdout F [info:2016-02-16T16:04:05.930-08:00] Some log text here - - @type tail - path /var/log/containers/*.log - pos_file /var/log/gcp-containers.log.pos - # Tags at this point are in the format of: - # reform.var.log.containers.__-.log - tag reform.* - read_from_head true - - @type multi_format - - format json - time_key time - time_format %Y-%m-%dT%H:%M:%S.%NZ - - - format /^(? - - - - - @type parser - format /^(?\w)(? - - - @type record_reformer - enable_ruby true - # Tags at this point are in the format of: - # 'raw.kubernetes.__'. - tag raw.kubernetes.${tag_suffix[4].split('-')[0..-2].join('-')} - - - # Detect exceptions in the log output and forward them as one log entry. - - @type detect_exceptions - - remove_tag_prefix raw - message log - stream stream - multiline_flush_interval 5 - max_bytes 500000 - max_lines 1000 - - system.input.conf: |- - # Example: - # Dec 21 23:17:22 gke-foo-1-1-4b5cbd14-node-4eoj startupscript: Finished running startup script /var/run/google.startup.script - - @type tail - format syslog - path /var/log/startupscript.log - pos_file /var/log/gcp-startupscript.log.pos - tag startupscript - - - # Examples: - # time="2016-02-04T06:51:03.053580605Z" level=info msg="GET /containers/json" - # time="2016-02-04T07:53:57.505612354Z" level=error msg="HTTP Error" err="No such image: -f" statusCode=404 - # TODO(random-liu): Remove this after cri container runtime rolls out. - - @type tail - format /^time="(?